:root {
  --bg: #0b1020; --panel: #111830; --panel2: #162040; --line: #243055; --text: #e8eefc; --muted: #93a2c6;
  --accent: #4cc9f0; --hot: #ffbe3c; --danger: #ff6b6b; --ok: #5fd38d;
  --radius: 10px; font-size: 14px; color-scheme: dark;
  --field: #0d142a; --overlay: rgba(17, 24, 48, .82); --overlay-strong: rgba(17, 24, 48, .94); --line-soft: rgba(36, 48, 85, .6);
  --hover: #1d2a52; --stage-hi: #121a36; --tip: rgba(13, 20, 42, .96); --loading-bg: rgba(8, 12, 24, .92); --backdrop: rgba(5, 8, 18, .7);
  --scroll: #2a3766; --bond: #c9d4f0; --shadow: var(--shadow);
}
/* light theme: soft, low-glare pastel surfaces */
:root[data-theme="light"] {
  --bg: #eceff5; --panel: #f7f8fb; --panel2: #e6ebf3; --line: #d0d7e4; --text: #283044; --muted: #67718a;
  --accent: #2b7ca3; --hot: #b26f0e; --danger: #c24c4c; --ok: #368a5b; color-scheme: light;
  --field: #fdfdfe; --overlay: rgba(247, 248, 251, .9); --overlay-strong: rgba(247, 248, 251, .96); --line-soft: rgba(196, 205, 222, .7);
  --hover: #e0e7f2; --stage-hi: #f6f8fb; --tip: rgba(255, 255, 255, .97); --loading-bg: rgba(236, 239, 245, .94); --backdrop: rgba(70, 80, 100, .32);
  --scroll: #c2cad9; --bond: #3e4759; --shadow: rgba(60, 70, 95, .18);
}
[hidden] { display: none !important; }
* { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif; display: flex; flex-direction: column; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; transition: background .15s, border-color .15s; }
button:hover { border-color: var(--accent); }
button.primary { background: linear-gradient(135deg, #2aa8d8, #5b7cfa); border: none; font-weight: 600; color: #fff; }
button.primary:disabled { opacity: .55; cursor: progress; }
button.icon { padding: 4px 9px; min-width: 30px; }
button.link { background: none; border: none; color: var(--accent); padding: 0; font-size: 12px; font-weight: 400; }
input[type=search], input[type=number], select { background: var(--field); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; outline: none; }
input:focus, select:focus { border-color: var(--accent); }
input[type=number] { width: 78px; text-align: right; }
code { background: var(--field); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.spacer { flex: 1; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.45; margin: 4px 0 10px; }

#topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 14px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 5; }
.tb-side { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tb-side.right { justify-content: flex-end; }
.tb-center { display: flex; align-items: center; gap: 10px; }
/* Simulate + automatic re-run switch, joined into one control */
.runbox { display: flex; align-items: stretch; }
.runbox #runBtn { border-radius: 8px 0 0 8px; padding: 6px 14px; position: relative; }
.runbox #runBtn.pending::after { content: ""; position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--hot); box-shadow: 0 0 0 2px var(--panel); }
#autoBtn { border-radius: 0 8px 8px 0; border-left: none; display: flex; align-items: center; gap: 6px; padding: 5px 10px; font-size: 12.5px; color: var(--muted); }
#autoBtn .sw-track { width: 24px; height: 14px; border-radius: 7px; background: var(--line); position: relative; transition: background .15s; flex: none; }
#autoBtn .sw-track i { position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
#autoBtn.on { color: var(--text); }
#autoBtn.on .sw-track { background: var(--accent); }
#autoBtn.on .sw-track i { transform: translateX(10px); background: #fff; }
@media (prefers-reduced-motion: reduce) { #autoBtn .sw-track, #autoBtn .sw-track i { transition: none; } }
button.theme { display: grid; place-items: center; padding: 4px 7px; }
button.theme svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button.theme .moon { fill: currentColor; stroke: none; }
:root:not([data-theme="light"]) button.theme .sun, :root[data-theme="light"] button.theme .moon { display: none; }
.brand { font-size: 17px; letter-spacing: .2px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand b { color: var(--accent); }
.logo { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, var(--accent) 45%, #5b7cfa 100%); box-shadow: 0 0 12px rgba(76, 201, 240, .7); }
.search { position: relative; flex: 0 1 420px; min-width: 110px; }
.search input { width: 100%; }
.dropdown { position: absolute; top: calc(100% + 4px); left: 0; right: 0; max-height: 60vh; overflow: auto; background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 16px 40px var(--shadow); z-index: 30; min-width: 280px; }
.sr-row { display: flex; gap: 9px; align-items: center; padding: 7px 10px; cursor: pointer; border-bottom: 1px solid var(--line-soft); }
.sr-row.active, .sr-row:hover { background: var(--hover); }
.sr-title { font-weight: 600; font-size: 13px; }
.sr-sub { color: var(--muted); font-size: 11.5px; }
.sr-text { min-width: 0; } .sr-text > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; border-radius: 5px; padding: 2px 6px; white-space: nowrap; flex: 0 0 78px; text-align: center; }
.b-met { background: rgba(95, 211, 141, .16); color: #7fe3a6; } .b-rxn { background: rgba(76, 201, 240, .16); color: #7fd9f5; }
.b-gene { background: rgba(180, 140, 255, .18); color: #c9aeff; } .b-cancer { background: rgba(255, 110, 110, .16); color: #ff9c9c; } .b-sub { background: rgba(255, 190, 60, .16); color: #ffd27a; }
.segmented { display: flex; background: var(--field); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.segmented button { border: none; background: none; padding: 5px 12px; border-radius: 7px; color: var(--muted); }
.segmented button.on { background: var(--panel2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }

main { flex: 1; display: grid; grid-template-columns: var(--left-w, 318px) 0 minmax(0, 1fr) 0 var(--right-w, 348px); min-height: 0; }
aside { background: var(--panel); overflow-y: auto; min-height: 0; }
#left { border-right: 1px solid var(--line); } #right { border-left: 1px solid var(--line); }
aside section { padding: 12px 14px; border-bottom: 1px solid var(--line); }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 0 0 6px; display: flex; justify-content: space-between; align-items: baseline; }
h3 { margin: 0; font-size: 16px; } h4 { margin: 14px 0 6px; font-size: 13px; }
.row { display: flex; gap: 6px; align-items: center; } .grow { flex: 1; }
.add { position: relative; margin-bottom: 8px; } .add input { width: 100%; }
.check { display: flex; gap: 7px; align-items: center; font-size: 12.5px; color: var(--muted); margin-top: 8px; cursor: pointer; }
.field { display: flex; justify-content: space-between; align-items: center; margin: 7px 0; font-size: 13px; }
.field span { color: var(--muted); } .field span.t { color: var(--text); }
.chip { display: inline-block; margin-top: 8px; background: var(--field); border: 1px solid var(--line); border-radius: 20px; padding: 3px 10px; font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.supply { display: grid; grid-template-columns: 1fr 74px 28px 22px; gap: 5px; align-items: center; padding: 3px 0; }
.supply .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; cursor: pointer; }
.supply .name small { color: var(--muted); }
.supply input { width: 100%; padding: 3px 6px; font-size: 12.5px; }
.supply .inf { text-align: right; color: var(--muted); font-size: 12px; padding-right: 6px; }
.supply button { padding: 1px 0; font-size: 15px; line-height: 1; border-color: transparent; background: none; color: var(--muted); }
.supply button:hover { color: var(--text); }
.supply button.lab.on { color: var(--hot); text-shadow: 0 0 8px rgba(255, 190, 60, .7); }
.supply.changed .name { color: var(--accent); }
.tracer { background: linear-gradient(135deg, rgba(255, 190, 60, .13), rgba(255, 45, 120, .08)); border: 1px solid rgba(255, 190, 60, .4); border-radius: 9px; padding: 7px 9px; margin-bottom: 8px; font-size: 12.5px; display: flex; gap: 8px; align-items: center; }
.tracer b { color: var(--hot); } .tracer .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

#stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: radial-gradient(1200px 700px at 50% 40%, var(--stage-hi) 0%, var(--bg) 70%); }
#map { display: block; cursor: grab; touch-action: none; }
#crumbs { position: absolute; top: 10px; left: 12px; display: flex; gap: 6px; align-items: center; font-size: 13px; background: var(--overlay); border: 1px solid var(--line); border-radius: 20px; padding: 4px 12px; backdrop-filter: blur(6px); }
#crumbs { max-width: 32%; white-space: nowrap; } #crumbs span:last-child { overflow: hidden; text-overflow: ellipsis; }
#crumbs a { color: var(--accent); cursor: pointer; text-decoration: none; } #crumbs span.sep { color: var(--muted); }
#viewOpts { position: absolute; top: 10px; right: 12px; display: flex; flex-wrap: wrap; justify-content: flex-end; max-width: 64%; gap: 4px 10px; align-items: center; background: var(--overlay); border: 1px solid var(--line); border-radius: 20px; padding: 3px 6px 3px 12px; backdrop-filter: blur(6px); }
#viewOpts .check { margin: 0; }
#viewOpts select { padding: 2px 6px; font-size: 12.5px; border-radius: 14px; }
#langSel { padding: 5px 6px; }
#emptyNote { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); max-width: 360px; text-align: center; color: var(--muted); background: var(--overlay); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; font-size: 13px; line-height: 1.5; }
.pert { display: grid; grid-template-columns: 1fr 76px 42px 22px; gap: 6px; align-items: center; padding: 3px 0; font-size: 12.5px; }
.pert .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.pert .name small { color: var(--muted); }
.pert input[type=range] { width: 100%; accent-color: var(--danger); }
.pert output { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.pert output.ko { color: var(--danger); font-weight: 700; }
.pert.noeffect .name { color: var(--muted); text-decoration: line-through dotted; }
.pert button { padding: 1px 0; font-size: 15px; line-height: 1; border-color: transparent; background: none; color: var(--muted); }
.delta { font-size: 11.5px; margin-top: 2px; color: var(--muted); } .delta.down { color: #7fb0ff; } .delta.up { color: #ffb27a; }
.bar-row.wide { grid-template-columns: 1fr auto; }
#legendBox { position: absolute; left: 12px; bottom: 12px; max-width: 250px; display: flex; flex-direction: column; gap: 6px; }
#legendBox .qty { display: flex; align-items: center; gap: 6px; background: var(--overlay); border: 1px solid var(--line); border-radius: var(--radius); padding: 5px 8px; font-size: 11.5px; color: var(--muted); backdrop-filter: blur(6px); }
#legendBox .qty select { flex: 1; min-width: 0; font-size: 12px; }
#legendBox .qhelp { color: var(--muted); text-decoration: none; border: 1px solid var(--line); border-radius: 50%; width: 17px; height: 17px; line-height: 15px; text-align: center; font-size: 11px; flex: none; }
#legendBox .qhelp:hover { color: var(--text); border-color: var(--text); }
#legend { background: var(--overlay); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 11px; font-size: 11.5px; color: var(--muted); backdrop-filter: blur(6px); max-width: 250px; }
#legend .ramp { height: 8px; border-radius: 4px; margin: 4px 0 2px; }
#legend .scale { display: flex; justify-content: space-between; }
#legend .comps { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; }
#legend .comps i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 2px solid; margin-right: 4px; vertical-align: -1px; }
#timeline { position: absolute; left: 276px; right: 250px; bottom: 12px; display: flex; gap: 10px; align-items: center; background: var(--overlay); border: 1px solid var(--line); border-radius: 24px; padding: 6px 14px 6px 8px; backdrop-filter: blur(6px); }
#timeline input { flex: 1; accent-color: var(--accent); } #timeLabel { font-variant-numeric: tabular-nums; min-width: 64px; text-align: right; font-size: 13px; }
#status { position: absolute; right: 12px; bottom: 12px; font-size: 12px; color: var(--muted); background: var(--overlay); border: 1px solid var(--line); border-radius: 20px; padding: 4px 12px; max-width: 226px; }
#status.err { color: var(--danger); border-color: var(--danger); } #status:empty { display: none; }
#tooltip { position: fixed; pointer-events: none; background: var(--tip); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 12px; z-index: 40; max-width: 320px; box-shadow: 0 8px 24px var(--shadow); }
#tooltip b { display: block; } #tooltip span { color: var(--muted); }
#listView { position: absolute; inset: 52px 12px 12px; overflow: auto; background: var(--overlay-strong); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }

#details { padding: 14px; }
#details h3 { line-height: 1.25; word-break: break-word; }
#details .kind { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin-bottom: 3px; }
#details .meta { color: var(--muted); font-size: 12.5px; margin: 4px 0 10px; line-height: 1.5; }
#details .eq { background: var(--field); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; line-height: 1.6; }
#details a, .linkish { color: var(--accent); cursor: pointer; text-decoration: none; }
#details a:hover, .linkish:hover { text-decoration: underline; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 12.5px; margin: 8px 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.bar-row { display: grid; grid-template-columns: 1fr 64px; gap: 8px; align-items: center; font-size: 12.5px; padding: 3px 0; cursor: pointer; }
.bar-row:hover .nm { color: var(--accent); }
.bar-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.bar-row .bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--field); overflow: hidden; margin-top: -1px; }
.bar-row .bar i { display: block; height: 100%; border-radius: 2px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 8px 0; }
.tabs button { padding: 2px 9px; font-size: 12px; border-radius: 14px; } .tabs button.on { border-color: var(--accent); color: var(--accent); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; } .actions button { font-size: 12.5px; padding: 4px 10px; }
.note { font-size: 12px; color: var(--muted); background: var(--field); border-left: 3px solid var(--hot); border-radius: 4px; padding: 6px 9px; margin: 8px 0; line-height: 1.45; }
.big { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; } .big small { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.card { background: var(--field); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; }
.card .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.chart { width: 100%; height: 130px; background: var(--field); border: 1px solid var(--line); border-radius: 9px; margin-top: 6px; }
table.list { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.list th { text-align: left; color: var(--muted); font-weight: 500; padding: 4px 8px; position: sticky; top: -12px; background: var(--panel); }
table.list td { padding: 4px 8px; border-top: 1px solid var(--line-soft); } table.list tr:hover td { background: var(--hover); cursor: pointer; }
table.list td.num { text-align: right; font-variant-numeric: tabular-nums; }

svg.mol { width: 100%; display: block; }
svg.mol .bonds line { stroke: var(--bond); stroke-width: .075; stroke-linecap: round; }
svg.mol .wedge { fill: var(--bond); }
svg.mol .mask { fill: var(--mol-bg, var(--field)); }
svg.mol text { font-family: Inter, system-ui, sans-serif; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
svg.mol text.atom { font-size: .62px; font-weight: 600; }
svg.mol text.lab-text { font-size: .46px; font-weight: 700; fill: #10141f; }
svg.mol .lab { stroke: #fff; stroke-width: .05; filter: drop-shadow(0 0 .25px rgba(255, 190, 60, .9)); }
svg.mol .hit { fill: transparent; } svg.mol .hit.editable { cursor: pointer; }
svg.mol .hit.editable:hover { fill: rgba(76, 201, 240, .25); stroke: var(--accent); stroke-width: .05; }
.molbox { background: var(--field); border: 1px solid var(--line); border-radius: 9px; padding: 6px; margin: 8px 0; }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(760px, 92vw); max-height: 92vh; box-shadow: 0 30px 80px var(--shadow); }
dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(3px); }
dialog form { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
dialog header, dialog footer { display: flex; align-items: center; gap: 8px; }
.mol-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12.5px; }
.mol-tools label { display: flex; gap: 6px; align-items: center; color: var(--muted); } .mol-tools input[type=range] { accent-color: var(--hot); }
#molCanvas { background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 8px; min-height: 180px; display: grid; place-items: center; }
#molName { color: var(--hot); font-weight: 600; }
.methods { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.methods article { background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; line-height: 1.5; }
.methods h4 { margin: 0 0 4px; font-size: 14px; color: var(--accent); } .methods h4 small { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; }
.methods ul { padding-left: 16px; margin: 6px 0; } .methods .when { color: var(--hot); margin: 6px 0 0; }
#methodsDialog p { font-size: 12.5px; line-height: 1.5; margin: 4px 0; }

#loading { position: fixed; inset: 0; background: var(--loading-bg); display: grid; place-items: center; z-index: 100; transition: opacity .3s; }
#loading.done { opacity: 0; pointer-events: none; }
#loading .box { display: flex; flex-direction: column; gap: 14px; align-items: center; color: var(--muted); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
@media (max-width: 1100px) { main { grid-template-columns: min(var(--left-w, 280px), 300px) 0 minmax(0, 1fr) 0; } #resRight { display: none; } #right { position: absolute; right: 0; top: 49px; bottom: 0; width: 320px; z-index: 4; box-shadow: -10px 0 30px var(--shadow); } #right:has(#details:empty) { display: none; } }

/* collapsible sections of the left panel */
section.fold > h2 { justify-content: flex-start; gap: 6px; cursor: pointer; user-select: none; border-radius: 4px; }
section.fold > h2::before { content: "▾"; width: 10px; flex: none; transition: transform .15s; }
section.fold > h2:hover, section.fold > h2:focus-visible { color: var(--text); outline: none; }
section.fold > h2 > button { margin-left: auto; }
section.fold.folded > h2 { margin-bottom: 0; }
section.fold.folded > h2::before { transform: rotate(-90deg); }
section.fold.folded > :not(h2), section.fold.folded > h2 > button { display: none; }
.medium-bar { margin-bottom: 6px; } .medium-bar select { min-width: 0; padding: 4px 6px; font-size: 12.5px; }
#mediumNote { margin-bottom: 4px; } #mediumNote:empty { display: none; } #mediumNote a { color: var(--accent); }
@media (prefers-reduced-motion: reduce) { section.fold > h2::before { transition: none; } }

/* draggable panel borders: a zero-width grid track with a wider grab area */
.resizer { position: relative; z-index: 6; }
.resizer::before { content: ""; position: absolute; top: 0; bottom: 0; left: -4px; width: 9px; cursor: col-resize; }
.resizer::after { content: ""; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: var(--accent); opacity: 0; transition: opacity .15s; }
.resizer:hover::after, .resizer:focus-visible::after, .resizer.dragging::after { opacity: .9; }
.resizer:focus { outline: none; }
body.resizing { cursor: col-resize; user-select: none; }
a.btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; color: var(--text); text-decoration: none; white-space: nowrap; transition: border-color .15s; }
a.btn:hover { border-color: var(--accent); }
#topbar button { white-space: nowrap; }
/* isotopologue distribution in the metabolite panel */
.mid { display: flex; align-items: flex-end; gap: 2px; height: 126px; margin: 12px 0 2px; padding-top: 22px; border-bottom: 1px solid var(--line); }
.mid .col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.mid .col i { display: block; width: 100%; max-width: 30px; background: var(--hot); border-radius: 4px 4px 0 0; min-height: 1px; }
.mid .col span { position: absolute; font-size: 10.5px; color: var(--text); transform: translateY(-100%); white-space: nowrap; }
.mid-axis { display: flex; gap: 2px; font-size: 10.5px; color: var(--muted); } .mid-axis span { flex: 1; min-width: 0; text-align: center; overflow: hidden; }
/* results download */
#expList { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 18px; max-height: 56vh; overflow: auto; }
#expList h4 { grid-column: 1 / -1; margin: 10px 0 2px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .8px; }
#expList label { margin-top: 4px; color: var(--text); align-items: flex-start; }
#expList label.off { color: var(--muted); opacity: .6; cursor: default; }
#expList label small { display: block; color: var(--muted); }
#expStatus { margin: 0; }

/* scheduled events of the dynamic mode */
#eventList { margin-top: 8px; }
.event { display: grid; grid-template-columns: 66px minmax(0, 1fr) 62px 24px 20px; gap: 5px; align-items: center; padding: 4px 0; border-top: 1px solid var(--line-soft); }
.event.medium { grid-template-columns: 66px minmax(0, 1fr) 20px; }
.event input, .event select { width: 100%; padding: 3px 6px; font-size: 12.5px; min-width: 0; }
.event .when { display: flex; align-items: center; gap: 3px; color: var(--muted); font-size: 12px; }
.event .name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event .name small { display: block; color: var(--hot); overflow: hidden; text-overflow: ellipsis; }
.event .name small.muted { color: var(--muted); }
.event button { padding: 1px 0; font-size: 15px; line-height: 1; border-color: transparent; background: none; color: var(--muted); }
.event button:hover { color: var(--text); } .event button.lab.on { color: var(--hot); text-shadow: 0 0 8px rgba(255, 190, 60, .7); }
.event.late { opacity: .5; }
.evlist { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; } .evlist div.done { color: var(--text); } .evlist div::before { content: "○ "; } .evlist div.done::before { content: "● "; color: var(--accent); }
.midtime { margin-top: 8px; } .midtime svg { width: 100%; height: 130px; display: block; background: var(--field); border-radius: 8px; }

/* measured exchange fluxes */
.tol { display: flex; align-items: center; gap: 3px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.tol input { width: 52px; padding: 3px 6px; font-size: 12.5px; }
.meas { display: grid; grid-template-columns: minmax(0, 1fr) 84px 70px 20px; gap: 5px; align-items: center; padding: 3px 0; }
.meas .name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.meas .name small { color: var(--muted); }
.meas select, .meas input { width: 100%; min-width: 0; padding: 3px 5px; font-size: 12px; }
.meas button { padding: 1px 0; font-size: 15px; line-height: 1; border-color: transparent; background: none; color: var(--muted); }
.meas button:hover { color: var(--text); }
.meas.off .name { text-decoration: line-through; color: var(--muted); }
.meas-head { display: grid; grid-template-columns: minmax(0, 1fr) 84px 70px 20px; gap: 5px; font-size: 11px; color: var(--muted); padding: 2px 0; }
.supply.fixed .name::after { content: " ⊙"; color: var(--accent); }

/* ---- model editor */
button.toggle.on { background: rgba(255, 190, 60, .16); border-color: var(--hot); color: var(--hot); }
button.danger { color: #ff9aa4; border-color: rgba(255, 107, 107, .45); }
section.edits { background: linear-gradient(180deg, rgba(255, 190, 60, .06), transparent 70%); }
.ed-buttons { margin-bottom: 8px; } .ed-buttons button { flex: 1; font-size: 12.5px; }
.editrow { display: grid; grid-template-columns: 16px minmax(0, 1fr) 16px 22px 22px; gap: 5px; align-items: center; padding: 4px 0; border-top: 1px solid var(--line-soft); font-size: 12.5px; }
.editrow .op { color: var(--muted); font-weight: 700; text-align: center; }
.editrow .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.editrow .st { font-size: 12px; text-align: center; } .editrow.ok .st { color: var(--ok); } .editrow.warn .st { color: var(--hot); } .editrow.error .st { color: var(--danger); } .editrow.error .name { text-decoration: line-through; color: var(--muted); }
.editrow button { padding: 1px 0; font-size: 14px; line-height: 1; border-color: transparent; background: none; color: var(--muted); } .editrow button:hover { color: var(--text); }
b.err, .hint.err { color: var(--danger); }
.issues { display: flex; flex-direction: column; gap: 3px; margin: 6px 0; max-height: 220px; overflow: auto; }
.iss { display: grid; grid-template-columns: 16px 1fr; gap: 6px; font-size: 12.5px; line-height: 1.4; padding: 4px 8px; border-radius: 6px; background: var(--field); }
.iss.error { border-left: 3px solid var(--danger); } .iss.error b { color: var(--danger); }
.iss.warn { border-left: 3px solid var(--hot); } .iss.warn b { color: var(--hot); }
.iss.info { border-left: 3px solid var(--accent); color: var(--muted); } .iss.info b { color: var(--accent); }
.iss.ok { border-left: 3px solid var(--ok); color: var(--ok); }
dialog.editor { width: min(880px, 96vw); }
dialog.editor form { overflow: auto; max-height: 92vh; }
dialog.editor header h3 { flex: 1; } dialog.editor header .link { font-size: 12.5px; color: var(--accent); }
dialog.editor input[type=text], dialog.editor textarea, dialog.editor select { background: var(--field); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; color: var(--text); font: inherit; width: 100%; outline: none; }
dialog.editor textarea { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 12px; resize: vertical; }
dialog.editor input[type=number] { width: 100%; text-align: left; }
.ed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 12px; }
.ed-grid label, label.block { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.ed-grid label.wide { grid-column: 1 / -1; }
.ed-grid code { padding: 7px 9px; }
.eqbox { display: grid; grid-template-columns: minmax(0, 1fr) 38px minmax(0, 1fr); gap: 8px; align-items: start; }
.eqbox h4 { margin: 4px 0; } .eqbox .arrow { padding-top: 34px; text-align: center; }
.eqrow { display: grid; grid-template-columns: 58px minmax(0, 1fr) 118px 22px; gap: 5px; align-items: center; padding: 2px 0; font-size: 12.5px; }
.eqrow input { padding: 3px 6px !important; }
.eqrow select { padding: 3px 4px !important; font-size: 12px !important; }
.eqrow .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eqrow button { padding: 1px 0; border-color: transparent; background: none; color: var(--muted); }
.radios { flex-wrap: wrap; gap: 4px 16px; } .radios .check { margin-top: 2px; color: var(--text); }
.edtag { border-left-color: var(--hot); color: var(--hot); }
.actions.edit { margin-top: -4px; padding-top: 8px; border-top: 1px dashed rgba(255, 190, 60, .35); }
#badges { position: absolute; top: 46px; left: 12px; display: flex; flex-direction: column; gap: 5px; align-items: flex-start; pointer-events: none; }
.badge-chip { pointer-events: auto; font-size: 12px; border-radius: 14px; padding: 3px 10px; background: var(--overlay); border: 1px solid var(--line); backdrop-filter: blur(6px); }
.badge-chip.edit { border-color: rgba(255, 190, 60, .55); color: var(--hot); }
.badge-chip.cmp { border-color: rgba(76, 201, 240, .55); color: var(--accent); cursor: pointer; }

/* ---- comparison */
.scen { display: grid; grid-template-columns: 18px minmax(0, 1fr) 24px 22px; gap: 6px; align-items: center; padding: 5px 0; border-top: 1px solid var(--line-soft); font-size: 12.5px; }
.scen .name { cursor: pointer; min-width: 0; } .scen .name b { display: block; }
.scen .name small { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scen.on .name b { color: var(--accent); } .scen.off { opacity: .5; }
.scen button { padding: 1px 0; font-size: 14px; line-height: 1; border-color: transparent; background: none; color: var(--muted); } .scen button:hover { color: var(--text); }
#saveScenario { width: 100%; margin-bottom: 6px; }
.cmpnote { border-left-color: var(--accent); }
.mid.paired .col { flex-direction: row; align-items: flex-end; justify-content: center; gap: 1px; }
.mid.paired .col i { max-width: 15px; flex: 1; }
.mid.paired .col i.a, .sw.a { background: #8fa3c8; } .mid.paired .col i.b, .sw.b { background: var(--hot); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; }

/* ---- light theme: colours that are not plain variables */
:root[data-theme="light"] .b-met { color: #2f7d4f; } :root[data-theme="light"] .b-rxn { color: #23708f; }
:root[data-theme="light"] .b-gene { color: #6b4bb0; } :root[data-theme="light"] .b-cancer { color: #a8323a; } :root[data-theme="light"] .b-sub { color: #8f5f0a; }
:root[data-theme="light"] .delta.down { color: #3566b8; } :root[data-theme="light"] .delta.up { color: #b8621f; }
:root[data-theme="light"] button.danger { color: #b23a46; }
:root[data-theme="light"] button.primary { background: linear-gradient(135deg, #4aa3c9, #6f8be0); }
:root[data-theme="light"] .logo { box-shadow: 0 0 8px rgba(43, 124, 163, .35); }
:root[data-theme="light"] .supply button.lab.on, :root[data-theme="light"] .event button.lab.on { text-shadow: none; }
:root[data-theme="light"] #stage { background: radial-gradient(1200px 700px at 50% 40%, var(--stage-hi) 0%, var(--bg) 70%); }
:root[data-theme="light"] svg.mol text.atom.el-S { fill: #9c7c06; } :root[data-theme="light"] svg.mol text.atom.el-O { fill: #c93f3f; }
:root[data-theme="light"] svg.mol text.atom.el-N { fill: #2f66c4; } :root[data-theme="light"] svg.mol text.atom.el-P { fill: #c4661f; }
:root[data-theme="light"] svg.mol text.atom.el-F, :root[data-theme="light"] svg.mol text.atom.el-Cl { fill: #2f8a55; }
:root[data-theme="light"] svg.mol text.atom.el-R { fill: #5b6784; } :root[data-theme="light"] svg.mol text.atom.el-I { fill: #7550c0; }
:root[data-theme="light"] svg.mol text.atom.el-x { fill: #3e4759; }
.chart-cursor { stroke: var(--text); opacity: .5; }
/* header that does not fit (narrow window, long words): icon buttons, then no brand text */
#topbar.compact2 .brand-text { display: none; }
#topbar .tb-side.right > button.iconized { padding: 6px 10px; }
#topbar.compact3 #modelSelect { max-width: 118px; }
#topbar.compact3 .search { min-width: 70px; }
#topbar.compact4 #autoBtn span { display: none; }
#topbar.compact3 .tb-center { gap: 6px; }
#topbar.compact4 .tb-center, #topbar.compact4 .tb-side { gap: 6px; }
/* status line: amber while computing, green when the result is ready */
#status.busy { background: #f2b53a; border-color: #f2b53a; color: #241a00; font-weight: 600; }
#status.done { background: #3fae6c; border-color: #3fae6c; color: #062312; }
:root[data-theme="light"] #status.busy { background: #f6cf72; border-color: #e4b24a; color: #3a2a00; }
:root[data-theme="light"] #status.done { background: #9fd8b4; border-color: #6fbf8e; color: #10351f; }
#runBtn.running { opacity: 1 !important; cursor: progress; background: linear-gradient(135deg, #d99a1e, #e0b23c); color: #231800; }
@media (prefers-reduced-motion: no-preference) { #runBtn.running { animation: runpulse 1.2s ease-in-out infinite; } }
@keyframes runpulse { 50% { filter: brightness(1.15); } }
/* comparison picker: Show [X] compared with [Y] */
.cmp-pick { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 8px; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 12.5px; color: var(--muted); }
.cmp-pick label { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cmp-pick label:last-child { grid-column: 1; }
.cmp-pick select { width: 100%; min-width: 0; padding: 4px 6px; font-size: 12.5px; color: var(--text); }
.cmp-pick #cmpSwap { grid-row: 1 / span 2; grid-column: 2; align-self: center; }

/* cell-type context */
.ctx-chip { display: block; margin: 6px 0; padding: 6px 8px; border-radius: 8px; line-height: 1.35; }
.ctx-chip .badge { display: inline-block; flex: none; margin-right: 4px; }
.ctx-chip .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.ctx-chip.none { color: var(--muted); }
.ctx-rescued summary { cursor: pointer; }
.ctx-rescued ul { margin: 4px 0 4px 16px; padding: 0; }
.ctx-src { color: var(--muted); font-size: 11px; }
#ctxNote .warn { color: var(--hot); }
.note.ctxnote { border-left-color: var(--hot); }

/* essential-gene screen: one line per gene, groups collapsible with their own scroll */
.scr-group { margin: 6px 0; }
.scr-group summary { cursor: pointer; font-weight: 600; font-size: 12.5px; }
.scr-list { max-height: 220px; overflow: auto; margin-top: 4px; border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.scr-row { display: grid; grid-template-columns: minmax(0, 1fr) 14px auto 44px 22px; gap: 6px; align-items: center; font-size: 12.5px; padding: 2px 0; }
.scr-row > .linkish { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scr-row .val { text-align: right; font-variant-numeric: tabular-nums; }
.scr-row button { padding: 0; }
