/* console v2: base shell copied from the nmr-flux console (same card grammar),
   so the two consoles read the same. */
:root {
  --bg: #101216; --surface: #171a20; --surface-2: #1d2128; --line: #282d37;
  --fg: #e8ebf1; --muted: #8b94a6; --dim: #626b7d;
  --accent: #6ea8fe; --accent-dim: #2f4a78;
  --good: #57c98b; --warn: #e0a458;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 10px;
  --panel-h: 440px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 14px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }

/* ---------- shell: ~60% of a wide screen, centred; nearly the whole window when the
   window is half a big screen or smaller ---------- */
.shell { width: clamp(min(96vw, 1060px), 60vw, 1720px); margin: 0 auto; padding: 0 4px; }
@media (max-width: 2000px) { .shell { width: calc(100vw - 28px); } }

header.top { border-bottom: 1px solid var(--line); background: var(--bg);
             position: sticky; top: 0; z-index: 20; }
header.top .shell { display: flex; align-items: center; gap: 16px; height: 52px; }
header.top h1 { font-size: 15px; margin: 0; font-weight: 600; letter-spacing: .01em; }
header.top .badge { font-family: var(--mono); font-size: 11px; color: var(--muted);
                    border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; }
header.top .status { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--dim); }
/* header progress bar for long batch runs */
header.top .hprogress { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 260px; }
header.top .hprogress + .status { margin-left: 0; }
header.top .hprogress .plabel { font-family: var(--mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
header.top .hprogress .bar { flex: 1; height: 6px; background: var(--surface-2); border: 1px solid var(--line);
                             border-radius: 999px; overflow: hidden; min-width: 120px; }
header.top .hprogress .fill { height: 100%; width: 0%; background: var(--accent); transition: width .3s ease; }
header.top .hprogress .pcancel { width: auto; padding: 0 7px; font-size: 11px; line-height: 1.6; color: var(--dim); }

.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px;
          align-items: start; padding: 20px 0 40px; }
@media (max-width: 1300px) { .layout { grid-template-columns: 210px minmax(0, 1fr); gap: 14px; } }
@media (max-width: 900px)  { .layout { grid-template-columns: minmax(0, 1fr); }
                              nav.pages { position: static; } }

/* ---------- left: stacked nav cards ---------- */
nav.pages { display: flex; flex-direction: column; gap: 8px; position: sticky; top: 72px; }
nav.pages .eyebrow { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
                     color: var(--dim); margin: 2px 0 4px 2px; font-weight: 600; }
#nav { display: flex; flex-direction: column; gap: 8px; }
.navcard {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; color: var(--fg); font: inherit;
  transition: border-color .12s, background .12s;
}
.navcard:hover { border-color: var(--accent-dim); background: var(--surface-2); }
.navcard[aria-current="page"] { border-color: var(--accent); background: var(--surface-2); }
.navcard .t { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; }
.navcard .d { color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.4; }
.navcard .dot { width: 6px; height: 6px; border-radius: 999px; background: var(--dim); flex: none; }
.navcard.live .dot { background: var(--good); }
.navcard[aria-current="page"] .t { color: var(--accent); }
.navcard[aria-current="page"] .dot { background: var(--accent); }

/* sub-pages: indented under their parent, shown only while the parent is open */
.subnav { display: flex; flex-direction: column; gap: 6px; margin: -2px 0 2px 18px;
          padding-left: 10px; border-left: 1px solid var(--line); }
.subcard { display: block; width: 100%; text-align: left; cursor: pointer;
           background: transparent; border: 1px solid transparent; border-radius: 8px;
           padding: 6px 10px; color: var(--muted); font: inherit; font-size: 12.5px;
           transition: border-color .12s, background .12s, color .12s; }
.subcard:hover { color: var(--fg); background: var(--surface-2); border-color: var(--line); }
.subcard[aria-current="page"] { color: var(--accent); background: var(--surface-2); border-color: var(--accent-dim); }
.subcard .t { font-weight: 600; }
.subcard .d { font-size: 11.5px; color: var(--dim); margin-top: 1px; line-height: 1.35; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line);
        border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.card > h2 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
             color: var(--muted); margin: 0 0 10px; font-weight: 600;
             display: flex; align-items: center; gap: 10px; }
.card > h2 .right { margin-left: auto; font-family: var(--mono); font-size: 11px;
                    color: var(--dim); text-transform: none; letter-spacing: 0; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
@media (max-width: 1300px) { .grid2 { grid-template-columns: minmax(0, 1fr) 280px; } }
@media (max-width: 1000px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.grid2 > .card { margin-bottom: 0; }
.grid2 .stack > .card + .card { margin-top: 14px; }
.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 10px; }
.controls .wide { grid-column: span 2; }

label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
select, input, button {
  width: 100%; background: var(--surface-2); color: var(--fg);
  border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px;
  font: inherit; font-size: 13px;
}
button { cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button.primary { border-color: var(--accent); color: var(--accent); }
.btnrow { display: flex; gap: 8px; align-items: end; }
.btnrow button { width: auto; flex: none; }
.btnrow input { flex: 1; min-width: 0; }
.check { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.check input { width: auto; }

dl.kv { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px 12px; font-size: 13px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; text-align: right; }
.plot { height: var(--panel-h); }
.plot.short { height: 220px; }
.note { color: var(--dim); font-size: 11.5px; font-family: var(--mono); margin-top: 6px; }
.hint { color: var(--dim); font-size: 11.5px; font-family: var(--mono); }
.err { color: #ff8f8f; font-size: 12.5px; white-space: pre-wrap; margin-top: 8px; }
.empty { height: 100%; min-height: 120px; display: flex; align-items: center; justify-content: center;
         border: 1px dashed var(--line); border-radius: 8px; color: var(--dim);
         font-size: 12.5px; text-align: center; padding: 0 20px; }
.planned { color: var(--muted); font-size: 13.5px; }
.planned ul { margin: 8px 0 0; padding-left: 18px; }
.planned li { margin: 5px 0; }
.tag { display: inline-block; font-family: var(--mono); font-size: 10.5px;
       border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px;
       color: var(--dim); margin-left: 6px; }
.spinner { color: var(--dim); font-size: 12px; font-family: var(--mono); }
.smiles { font-family: var(--mono); font-size: 11.5px; word-break: break-all; color: var(--muted); margin-top: 8px; }

/* ---------- tables ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.tbl th, table.tbl td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); }
table.tbl th { color: var(--muted); font-weight: 600; font-size: 10.5px;
               text-transform: uppercase; letter-spacing: .06em; }
table.tbl th.n, table.tbl td.n { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl td.mono { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
table.tbl tbody tr.clickable { cursor: pointer; }
table.tbl tbody tr.clickable:hover { background: var(--surface-2); }
table.tbl tbody tr.on { background: var(--surface-2); box-shadow: inset 2px 0 0 var(--accent); }

/* ---------- reports ---------- */
.report { line-height: 1.6; font-size: 13.5px; }

/* ================= console v2 additions ================= */
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.stat .statv { font-size: 22px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat .statl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat .statv.good { color: var(--good); } .stat .statv.warn { color: var(--warn); } .stat .statv.bad { color: #ff8f8f; }
.stats { display: flex; flex-wrap: wrap; gap: 26px; margin: 2px 0 10px; }
.row { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.row > * { min-width: 0; }
.cols2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.cols3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1100px) { .cols2, .cols3 { grid-template-columns: minmax(0, 1fr); } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; border: 1px solid var(--line);
        border-radius: 999px; padding: 2px 9px 2px 7px; color: var(--fg); background: var(--surface-2); white-space: nowrap; }
.chip .dot { width: 9px; height: 9px; border-radius: 999px; flex: none; }
.chip .n { color: var(--dim); font-family: var(--mono); font-size: 10.5px; }
button.chip { width: auto; cursor: pointer; }
button.chip.on { border-color: var(--good); color: var(--good); }
button.chip.off { border-color: #ff8f8f; color: #ff8f8f; text-decoration: line-through; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tile { background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 6px; cursor: pointer;
        transition: border-color .12s; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile:hover { border-color: var(--accent-dim); }
.tile.on { border-color: var(--accent); }
.tile img { width: 100%; height: 130px; object-fit: contain; }
.tile .smi { font-family: var(--mono); font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .meta { font-size: 10.5px; color: var(--dim); font-family: var(--mono); display: flex; justify-content: space-between; }
.tile .fgs { display: flex; flex-wrap: wrap; gap: 3px; }
.tile .fgs .dot { width: 8px; height: 8px; border-radius: 999px; }
.svgbox { display: flex; justify-content: center; align-items: center; min-height: 200px; }
.svgbox svg { max-width: 100%; height: auto; }
.viewer3d { position: relative; width: 100%; height: 320px; border-radius: 8px; overflow: hidden; background: #0c0e12; }
.viewer3d.small { height: 240px; }
.badge2 { display: inline-block; font-family: var(--mono); font-size: 10.5px; border-radius: 999px; padding: 1px 8px; border: 1px solid var(--line); }
.badge2.good { color: var(--good); border-color: #2c6b4a; } .badge2.bad { color: #ff8f8f; border-color: #7a3a3a; } .badge2.warn { color: var(--warn); border-color: #7a5a2a; }
.samples { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.sample { background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 8px; cursor: pointer; min-width: 0; }
.sample.on { border-color: var(--accent); }
.sample .hd { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.bar { height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.bar > div { height: 100%; background: var(--accent); }
.kvline { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); font-family: var(--mono); gap: 8px; }
.kvline b { color: var(--fg); font-weight: 500; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.tabs button { width: auto; padding: 4px 12px; font-size: 12.5px; }
.tabs button.on { border-color: var(--accent); color: var(--accent); background: var(--surface); }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-size: 12px; color: var(--muted); }
.pager button { width: auto; padding: 4px 10px; }
.searchgrid { display: grid; grid-template-columns: 1.4fr 3fr 1fr 0.7fr 0.7fr auto auto; gap: 8px; align-items: end; }
@media (max-width: 1100px) { .searchgrid { grid-template-columns: 1fr 1fr; } }
.fgpicker { margin-top: 10px; max-height: 170px; overflow-y: auto; }
.mono { font-family: var(--mono); }
.small { font-size: 11.5px; }
.muted { color: var(--muted); }
.plot.mid { height: 320px; }
.plot.tall { height: 560px; }
.latgrid { display: grid; gap: 12px; grid-template-columns: repeat(var(--nmaps, 2), minmax(0, 1fr)); }
@media (max-width: 1100px) { .latgrid { grid-template-columns: minmax(0, 1fr); } }
.latplot { height: 520px; }
.prov { font-size: 12px; }
.prov dt { color: var(--muted); }
.spin::after { content: '…'; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; align-items: start; }
@media (max-width: 1250px) { .split { grid-template-columns: minmax(0, 1fr); } }
.sticky { position: sticky; top: 70px; }

/* lab: side-by-side comparison */
.cmpgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-top: 10px; }
.cmpcol { background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 10px; min-width: 0; }
.cmptitle { font-weight: 600; font-size: 14px; color: var(--accent); text-decoration: none; display: block; margin-bottom: 6px; }
.cmptiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 8px; }
.cmptiles .sample { cursor: default; padding: 6px; }

/* public build: quieter chrome */
body.public header.top h1 { font-weight: 600; letter-spacing: 0.01em; }
body.public .pages .eyebrow { display: none; }

/* phase 9: inputs-given selector + conditioning matrix */
.givenrow { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 4px; }
.check.given.implied { opacity: .55; }
.givenstatus { margin-top: 8px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); }
.givenstatus.ok { border-color: #2c6b4a; }
.givenstatus.no { border-color: #7a3a3a; background: rgba(255, 107, 107, .05); }
button.mini.on { border-color: var(--good); color: var(--good); }
table.cmatrix td.yes { color: var(--good); }
table.cmatrix td.yes:hover { background: rgba(87, 201, 139, .08); }
table.cmatrix td.no { color: var(--dim); font-size: 11px; }
table.cmatrix tr.cur td:first-child, table.cmatrix th.cur { color: var(--warn); font-weight: 600; }
.presets button.mini { width: auto; padding: 2px 9px; font-size: 11.5px; }

/* phase 9b: spectrum inspector (ported from the old console's spectra analyser) */
.svhost { margin-top: 6px; }
.specpanel + .specpanel, .svhost + .svhost { margin-top: 14px; }
.spechead { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: end; margin-bottom: 6px; }
.spechead .svtitle { flex: 1; min-width: 120px; font-size: 11.5px; color: var(--muted); font-family: var(--mono); padding-bottom: 6px; }
.spechead .check { flex: none; padding-bottom: 6px; }
.spechead button.mini { flex: none; width: auto; padding: 4px 10px; font-size: 12px; }
.spechead button.mini.mode { font-family: var(--mono); font-size: 11.5px; min-width: 92px; }
.spechead .cutoff { flex: none; width: 104px; }
.spechead .cutoff label { margin-bottom: 2px; }
select.narrow { padding: 4px 6px; }
.svplot { width: 100%; }
.note { color: var(--dim); font-size: 11.5px; font-family: var(--mono); margin-top: 4px; }

/* phase 9c: latent map (one map, web-map navigation) */
.ltgrid { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.ltgrid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1100px) { .ltgrid.two { grid-template-columns: minmax(0, 1fr); } }
.ltstage { position: relative; height: calc(100vh - 92px); min-height: 520px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #0c0e12; touch-action: none; outline: none; cursor: grab; user-select: none; }
.ltgrid.two .ltstage { height: calc(100vh - 160px); }
.ltcanvas { position: absolute; inset: 0; }
.lttitle { position: absolute; top: 8px; left: 10px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); background: rgba(12,14,18,.75); padding: 2px 8px; border-radius: 6px; pointer-events: none; }
.ltlegend { position: absolute; bottom: 34px; left: 10px; max-width: 340px; max-height: 38%; overflow: auto; font-size: 11.5px; color: var(--fg); background: rgba(16,18,22,.85); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.ltlegend .ltitem { display: flex; align-items: center; gap: 6px; cursor: pointer; padding: 1px 0; }
.ltlegend .ltitem.off { opacity: .4; text-decoration: line-through; }
.ltlegend .lthead { white-space: pre-line; font-size: 10.5px; color: var(--muted); margin-bottom: 4px; font-family: var(--mono); }
.ltlegend .dot { width: 9px; height: 9px; border-radius: 999px; flex: none; }
.ltlegend .ltbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-family: var(--mono); font-size: 10.5px; }
.ltlegend .ramp { display: inline-block; width: 140px; height: 10px; border-radius: 3px; }
.ltbtns { position: absolute; top: 8px; right: 10px; display: flex; flex-direction: column; gap: 4px; }
.ltbtn { width: 32px; height: 32px; padding: 0; font-size: 16px; line-height: 1; background: rgba(29,33,40,.92); }
.ltbtn.on { border-color: var(--accent); color: var(--accent); }
.ltstatus { position: absolute; left: 10px; bottom: 8px; font-family: var(--mono); font-size: 11px; color: var(--muted); background: rgba(12,14,18,.75); padding: 2px 8px; border-radius: 6px; pointer-events: none; }
.ltmini { position: absolute; right: 10px; bottom: 10px; border: 1px solid var(--line); border-radius: 6px; cursor: crosshair; }
.lttip { position: absolute; z-index: 5; max-width: 380px; background: rgba(23,26,32,.97); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 12px; pointer-events: none; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
.lttip .mono { font-family: var(--mono); font-size: 11.5px; word-break: break-all; }
.ltdrawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 46vw); z-index: 50; background: var(--bg); border-left: 1px solid var(--line); overflow: auto; padding: 12px 14px; transform: translateX(105%); transition: transform .2s ease; box-shadow: -8px 0 24px rgba(0,0,0,.4); }
.ltdrawer.open { transform: none; }
@media (max-width: 800px) { .ltdrawer { width: 100vw; } }
.ltclose { width: auto; padding: 4px 10px; }

.ltpanel { position: absolute; top: 34px; left: 10px; width: min(640px, calc(100% - 80px)); max-height: calc(100% - 44px); overflow: auto; z-index: 4; cursor: default; }
.ltpanel > .card { margin: 0; background: rgba(23,26,32,.96); box-shadow: 0 4px 18px rgba(0,0,0,.45); }
.ltpanel.closed > .card { display: none; }
.ltpanel .lttoggle { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; font-size: 14px; z-index: 2; }
.ltpanel.closed .lttoggle { position: static; }

/* phase 9e: wide page, taller responsive boxes, user-resizable (height remembered per box type) */
.shell { width: min(96vw, 1920px) !important; max-width: none; padding: 0 16px; }
@media (max-width: 2000px) { .shell { width: min(96vw, 1920px) !important; } }
.layout { grid-template-columns: 200px minmax(0, 1fr) !important; gap: 16px !important; }
@media (max-width: 1300px) { .layout { grid-template-columns: 170px minmax(0, 1fr) !important; } nav.pages .d { display: none; } }
@media (max-width: 900px)  { .layout { grid-template-columns: minmax(0, 1fr) !important; } }
nav.pages .navcard .d { font-size: 11px; }
:root { --panel-h: clamp(380px, 52vh, 620px); }
.plot { height: var(--panel-h); }
.plot.short { height: clamp(300px, 38vh, 460px); }
.plot.mid { height: clamp(380px, 48vh, 600px); }
.plot.tall { height: clamp(460px, 60vh, 760px); }
.viewer3d { height: clamp(480px, 58vh, 720px); }
.viewer3d.small { height: clamp(420px, 50vh, 640px); }
.svplot { height: clamp(260px, 32vh, 400px); }
.svplot[data-nuc="13C"] { height: clamp(210px, 26vh, 330px); }
.attnplot { height: clamp(560px, 75vh, 1100px); }
.ltstage { height: max(560px, 80vh); }
.rsz { resize: vertical; overflow: hidden; min-height: 160px; }
.rsz::after { content: ''; }
/* model internals (collapsible) */
details.internals { margin-top: 18px; border-top: 2px solid var(--line); padding-top: 10px; }
details.internals > summary { cursor: pointer; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 6px 0 10px; }
details.internals > summary b { color: var(--fg); }
/* inline in-train lookup */
.lookup { margin-top: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--surface-2); font-size: 12px; }
.lookup .svgbox { min-height: 90px; }
/* trajectory viewer */
.trajbar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 8px; }
.trajbar input[type=range] { flex: 1; min-width: 240px; }
.trajbar button, .trajbar select { width: auto; }
.trajsw { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.trajsw .dot { width: 10px; height: 10px; border-radius: 999px; }
.attnlegend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 11.5px; color: var(--muted); margin: 6px 0; }
.attnlegend span.sw { display: inline-block; width: 12px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
/* phase 9g: molecule card = structure | stacked spectra */
.molgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 18px; margin-top: 10px; align-items: start; }
@media (max-width: 1100px) { .molgrid { grid-template-columns: minmax(0, 1fr); } }
.molleft .svgbox { min-height: 300px; }
button.mini.on { border-color: var(--accent); color: var(--accent); }
/* phase 9g layout: vertical flow of full-width sections, more whitespace, at most 2 columns per row */
.card { padding: 18px 20px; margin-bottom: 28px; }
.card > h2 { font-size: 12.5px; margin-bottom: 14px; color: var(--fg); }
.cols3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.cols2 { gap: 20px; }
.split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 1100px) { .cols2, .cols3, .split { grid-template-columns: minmax(0, 1fr); } }
.samples { gap: 16px; }
#lbout > .card, #lbout > div > .card { margin-bottom: 30px; }
/* phase 9f: lab controls */
.lbrow { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: end; margin-bottom: 10px; }
.lbrow > div { min-width: 90px; }
.lbrow .grow { flex: 1 1 260px; } .lbrow .grow2 { flex: 2 1 320px; }
.lbrow .mdesc { flex: 2 1 320px; padding-bottom: 9px; }
button.primary.big { font-size: 15px; padding: 9px 28px; font-weight: 600; width: auto; }
details.advanced { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
details.advanced > summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.progress { flex: 1 1 260px; position: relative; height: 22px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.progress .pbar { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(110,168,254,.35); transition: width .4s; }
.progress .ptext { position: relative; font-size: 11.5px; font-family: var(--mono); padding: 0 8px; line-height: 20px; color: var(--fg); }
.trajinfo { min-width: 0; }
.trajnow .statv { font-size: 20px; font-weight: 600; }
.trajrow { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; font-size: 12.5px; padding: 3px 0; border-bottom: 1px solid var(--line); }
.trajrow .dot { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }
.mol23 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; }   /* 2D on top, 3D below, at every width */
.mol23 .viewer3d { height: clamp(280px, 34vh, 420px); }
.mol23 .svgbox { min-height: 260px; }
/* phase 9h: lab step flow */
.steps { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.steppill { display: flex; align-items: center; gap: 8px; width: auto; padding: 8px 14px; border-radius: 999px; background: var(--surface-2); }
.steppill .num { width: 22px; height: 22px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; background: var(--line); font-weight: 600; font-size: 12px; }
.steppill.on { border-color: var(--accent); }
.steppill.on .num { background: var(--accent); color: #0c0e12; }
.steppill .t { font-weight: 600; }
.steppill .sum { color: var(--muted); font-size: 12px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stepbody { padding: 6px 2px 4px; }
.choicegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.choice { text-align: left; width: 100%; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); display: flex; flex-direction: column; gap: 4px; }
.choice.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.genbar { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.stepbody .row > button, .stepbody button.mini { width: auto; }
.trajinfo input[type=checkbox], .trajsw input, .trajinfo button, .trajinfo select { width: auto; } .trajinfo input[type=range] { width: 100%; }
/* phase 11: trajectory paths / edit / branch */
.ctxmenu { position: absolute; z-index: 30; min-width: 220px; background: #161a22; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.5); padding: 4px; }
.ctxmenu .ctxhead { font-size: 11.5px; color: var(--muted); padding: 4px 8px; border-bottom: 1px solid var(--line); margin-bottom: 2px; }
.ctxmenu .ctxitem { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--fg, #e5e7eb); padding: 5px 8px; border-radius: 5px; font-size: 12.5px; cursor: pointer; }
.ctxmenu .ctxitem:hover:not(:disabled) { background: rgba(255,255,255,.08); }
.ctxmenu .ctxrow { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 2px 6px; }
.ctxmenu .ctxrow .ctxitem { display: inline-block; width: auto; padding: 3px 8px; border: 1px solid var(--line); }
.trajedit { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 8px; }
.trajsel { margin-top: 8px; font-size: 12.5px; }
