/* Sim Config menu and outputs dashboard (lane B; PRD Addendum 06 A6.4 / A6.5). Uses the shell's colour tokens (index 01_css)
   and adds only its own. Desktop: parameters and outputs side by side; at phone width (A6.4: 412 px, the S26 Ultra) the
   tabs become a select and one pane shows at a time, chosen by the Parameters / Outputs / Project switch. */
:root { --simcfg-band: rgba(31, 78, 121, 0.35); --simcfg-changed: #c2410c; --simcfg-needs: #b45309; --simcfg-alarm: #b91c1c;
        --simcfg-launch-h: 36px; --simcfg-launch-bottom: 76px; }
.simcfg-launch { position: fixed; top: 16px; right: 64px; z-index: 28; height: var(--simcfg-launch-h); min-height: var(--simcfg-launch-h); box-sizing: border-box; padding: 0 12px; border-radius: var(--radius);
  background: var(--panel); color: var(--text); border: 1px solid var(--panel-border); box-shadow: var(--shadow); font-weight: 600; }
body.simcfg-open .simcfg-launch { display: none; }
/* The structure card (#card, index 01_css) and the equipment card that takes its slot (#eq-info) never lie under the launcher, whatever its height (design review: Sim Config
   covered the card's badge): body.simcfg-launch-on (set when the launcher is mounted, simcfg_ui.js) starts the card below the
   launcher and caps it to the space left, scrolling inside. At 641-720 px the launcher is at the bottom right and the card
   stops above it; at 640 px and less the card is at the bottom and starts above the launcher (a phone, body.gp-mob, has
   no launcher: Sim Config is in More). */
body.simcfg-launch-on:not(.gp-mob) #card.show, body.simcfg-launch-on:not(.gp-mob) #eq-info:not([hidden]) { top: calc(16px + var(--simcfg-launch-h) + 8px); max-height: calc(100vh - 16px - var(--simcfg-launch-h) - 8px - 16px); overflow: auto; }
#simcfg { position: fixed; inset: 12px; z-index: 31; display: flex; flex-direction: column; padding: 10px 12px; overflow: hidden; font-size: 13px; }
#simcfg[hidden] { display: none; }
#simcfg:focus { outline: none; }
.simcfg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border-bottom: 1px solid var(--panel-border); padding-bottom: 8px; }
.simcfg-head h2 { font-size: 16px; margin: 0 6px 0 0; }
#simcfg-preset { max-width: 360px; min-height: 32px; }
.simcfg-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.simcfg-actions button, .simcfg-close { min-height: 32px; }
.simcfg-close { margin-left: auto; min-width: 40px; font-size: 20px; line-height: 1; }
.simcfg-disc { margin: 6px 0; color: var(--muted); }
.simcfg-status { color: var(--text); }
.simcfg-diff, .simcfg-errors { border: 1px solid var(--panel-border); border-radius: var(--radius); padding: 6px 10px; margin: 4px 0; max-height: 30vh; overflow: auto; }
.simcfg-errors { border-color: var(--simcfg-alarm); color: var(--simcfg-alarm); }
.simcfg-diff ul, .simcfg-errors ul { margin: 4px 0; padding-left: 18px; }
.simcfg-views { display: none; margin: 4px 0; }
.simcfg-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 12px; }
.simcfg-pane { min-height: 0; overflow: auto; }
.simcfg-projectpane { display: none; }
#simcfg[data-view="project"] .simcfg-projectpane { display: block; grid-column: 1 / -1; }
#simcfg[data-view="project"] .simcfg-params, #simcfg[data-view="project"] .simcfg-outputs { display: none; }
.simcfg-find { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.simcfg-sticky { position: sticky; top: 0; background: var(--panel); z-index: 1; padding-bottom: 2px; }
#simcfg-search { flex: 1; min-height: 32px; padding: 4px 8px; }
.simcfg-chk { white-space: nowrap; color: var(--muted); }
.simcfg-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.simcfg-tabs button { padding: 4px 8px; font-size: 12px; }
.simcfg-tabs button[aria-selected="true"] { background: var(--btn-active); color: var(--btn-active-text); }
.simcfg-tabsel { display: none; width: 100%; min-height: 36px; margin: 6px 0; }
.simcfg-row { border-bottom: 1px solid var(--panel-border); padding: 6px 2px; }
.simcfg-row.flash { background: var(--simcfg-band); }
.simcfg-rhead { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.simcfg-label { font-weight: 600; }
.simcfg-group { color: var(--muted); font-size: 11px; }
.simcfg-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.simcfg-row.changed .simcfg-dot { background: var(--simcfg-changed); }
.simcfg-badges { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.simcfg-badge { font-size: 10px; padding: 1px 5px; border-radius: 8px; border: 1px solid var(--panel-border); color: var(--muted); }
.simcfg-badge.prov-S { color: #15803d; border-color: #15803d; }
.simcfg-badge.prov-D { color: #1d4ed8; border-color: #1d4ed8; }
.simcfg-badge.needs, .simcfg-badge.prov-gap { color: var(--simcfg-needs); border-color: var(--simcfg-needs); }
.simcfg-badge.rebuild { color: var(--accent); border-color: var(--accent); }
.simcfg-q, .simcfg-reset { padding: 1px 7px; font-size: 11px; min-height: 24px; }
.simcfg-q { margin-left: auto; border-radius: 50%; }
.simcfg-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.simcfg-ctl input[type="range"] { flex: 1; min-width: 120px; }
.simcfg-ctl input[type="range"].banded { -webkit-appearance: none; appearance: none; height: 6px; border-radius: 3px; }
.simcfg-ctl input[type="number"] { width: 110px; }
.simcfg-ctl textarea { width: 100%; font-family: ui-monospace, monospace; font-size: 11px; }
.simcfg-unit { color: var(--muted); font-size: 12px; }
.simcfg-warn { color: var(--simcfg-needs); font-size: 11px; }
.simcfg-err { color: var(--simcfg-alarm); font-size: 12px; margin-top: 2px; }
.simcfg-help { margin-top: 4px; padding: 6px 8px; border-left: 3px solid var(--btn-active); font-size: 12px; }
.simcfg-help p, .simcfg-help ul { margin: 2px 0; }
.simcfg-kv, .simcfg-multi { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 10px; width: 100%; }
.simcfg-kv label, .simcfg-multi label { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12px; }
.simcfg-kv input[type="number"], .simcfg-kv input[type="text"] { width: 90px; }
.simcfg-link { background: none; border: 0; padding: 0 4px 0 0; color: var(--btn-active); text-decoration: underline; cursor: pointer; font-size: 11px; min-height: 0; }
.simcfg-ptable { width: 100%; border-collapse: collapse; font-size: 12px; }
.simcfg-ptable td, .simcfg-ptable th { border-bottom: 1px solid var(--panel-border); padding: 3px 4px; text-align: left; vertical-align: top; }
/* dashboard */
.dash-h { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 6px 0; }
.dash-card { border: 1px solid var(--panel-border); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.dash-card.alarm { border-color: var(--simcfg-alarm); }
.dash-head { width: 100%; display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; background: var(--btn); border: 0; text-align: left; cursor: pointer; }
.dash-title { font-weight: 700; }
.dash-key { color: var(--muted); text-align: right; }
.dash-card.alarm .dash-key { color: var(--simcfg-alarm); font-weight: 700; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.dash-table th, .dash-table td { border-top: 1px solid var(--panel-border); padding: 3px 6px; text-align: left; vertical-align: top; }
.dash-table tr.needs .dash-val { color: var(--simcfg-needs); }
.dash-table tr.alarm .dash-val { color: var(--simcfg-alarm); font-weight: 700; }
.dash-table th { width: 45%; }
.dash-drivers { display: block; font-weight: 400; }
.dash-val { white-space: normal; }
.dash-rules { font-size: 11px; max-height: 240px; overflow: auto; padding-left: 18px; }
.dash-card .note { padding: 0 10px; }
@media (max-width: 720px) {
  #simcfg { inset: 0; border-radius: 0; padding: calc(8px + env(safe-area-inset-top)) 10px 8px; }
  .simcfg-launch { top: auto; bottom: var(--simcfg-launch-bottom); right: 16px; }
  .simcfg-views { display: flex; }
  .simcfg-body { display: block; }
  .simcfg-pane { height: 100%; }
  #simcfg[data-view="params"] .simcfg-outputs, #simcfg[data-view="outputs"] .simcfg-params { display: none; }
  .simcfg-tabs { display: none; }
  .simcfg-tabsel { display: block; }
  #simcfg-preset { max-width: 100%; flex: 1 1 100%; }
  .simcfg-actions button { padding: 4px 8px; }
  .simcfg-close { position: absolute; top: calc(6px + env(safe-area-inset-top)); right: 8px; }
  .simcfg-head h2 { margin-right: 48px; }
}
@media (min-width: 641px) and (max-width: 720px) {
  body.simcfg-launch-on:not(.gp-mob) #card.show, body.simcfg-launch-on:not(.gp-mob) #eq-info:not([hidden]) { top: 16px; max-height: calc(100vh - 16px - var(--simcfg-launch-bottom) - var(--simcfg-launch-h) - 8px); }
}
@media (max-width: 640px) {
  body.simcfg-launch-on:not(.gp-mob) #card.show, body.simcfg-launch-on:not(.gp-mob) #eq-info:not([hidden]) { top: auto; bottom: calc(var(--simcfg-launch-bottom) + var(--simcfg-launch-h) + 8px);
    max-height: calc(100vh - 16px - var(--simcfg-launch-bottom) - var(--simcfg-launch-h) - 8px); }
}
