/* The prototype's look. Local only: system fonts, no external files. The state colours follow the reader's own
   pages (src/sdsreader/view.py, scripts/build_review.py). */
:root {
  --bg: #f3f4f6; --panel: #fff; --ink: #1b2230; --muted: #5d6878; --line: #dde2e8; --line2: #edf0f3;
  --nav: #17202e; --nav2: #212c3e; --nav-ink: #c6cfdb; --nav-act: #2d3d57;
  --accent: #1f5fae; --accent2: #e8f0fb;
  --ok: #17663a; --ok-bg: #ddf2e5; --rev: #1f4f9a; --rev-bg: #e2eafa; --man: #4d5866; --man-bg: #eceef1;
  --bad: #a4251c; --bad-bg: #f8dfdc; --warn: #7d5300; --warn-bg: #fbeec8;
  --ev: #fff1a8; --ev-line: #d9a800;
  --radius: 8px; --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font: 12.5px ui-monospace, Consolas, monospace; background: #f3f5f8; padding: 1px 4px; border-radius: 4px; }
.ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* frame */
#app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
#sidebar { background: var(--nav); color: var(--nav-ink); position: sticky; top: 0; height: 100vh; overflow-y: auto; padding-bottom: 24px; }
.brand { padding: 16px 18px 12px; border-bottom: 1px solid #263248; }
.brand b { display: block; color: #fff; font-size: 15px; }
.brand small { color: #8e9bb0; font-size: 11.5px; }
.nav-grp { padding: 14px 18px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #7f8ca2; }
.nav-a { display: flex; align-items: center; gap: 10px; padding: 7px 18px 7px 15px; color: var(--nav-ink); border-left: 3px solid transparent; }
.nav-a:hover { background: var(--nav2); color: #fff; text-decoration: none; }
.nav-a.act { background: var(--nav-act); color: #fff; border-left-color: #5b9cff; }
.nav-a .ic { width: 17px; height: 17px; }
.nav-a .tag { margin-left: auto; font-size: 10px; color: #8e9bb0; border: 1px solid #3a4a63; border-radius: 4px; padding: 0 4px; }
#main { min-width: 0; display: flex; flex-direction: column; }
.band { background: #fff4d6; color: #6b4e00; font-size: 12px; padding: 4px 22px; border-bottom: 1px solid #f0dfa8; }
#topbar { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 8px 22px; }
.search { position: relative; flex: 1; max-width: 560px; }
.search input { width: 100%; padding: 7px 10px 7px 32px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: #f8f9fb; }
.search > .ic { position: absolute; left: 10px; top: 9px; color: var(--muted); }
.search-res, .bell-pop { position: absolute; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(16, 24, 40, .14); z-index: 30; }
.search-res { top: 38px; left: 0; right: 0; }
.search-res a, .bell-pop a { display: block; padding: 8px 12px; color: var(--ink); border-bottom: 1px solid var(--line2); }
.search-res a:hover, .bell-pop a:hover { background: var(--accent2); text-decoration: none; }
.search-res .none { padding: 8px 12px; color: var(--muted); }
.langs { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin-left: auto; }
.langs button { border: 0; background: #fff; padding: 5px 10px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--muted); }
.langs button.act { background: var(--accent); color: #fff; }
.bell-wrap { position: relative; }
.bell { position: relative; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 5px 8px; cursor: pointer; color: var(--ink); display: flex; }
.bell .ic { width: 18px; height: 18px; }
.bell .cnt { position: absolute; top: -7px; right: -7px; background: var(--bad); color: #fff; border-radius: 9px; font-size: 11px; padding: 0 5px; line-height: 17px; }
.bell-pop { right: 0; top: 40px; width: 400px; max-width: 80vw; }
.bell-pop .bell-all { text-align: center; color: var(--accent); border-bottom: 0; }
.who { display: flex; flex-direction: column; align-items: flex-end; font-size: 12px; color: var(--muted); gap: 2px; }
.who select { font: inherit; font-size: 12.5px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); }
#view { padding: 18px 22px 48px; min-width: 0; }

/* shared parts */
.page-head { display: flex; align-items: baseline; gap: 6px 14px; margin: 0 0 14px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; margin: 0; display: flex; align-items: center; gap: 8px; }
.page-head h1 .ic { width: 20px; height: 20px; }
.page-head .sub { color: var(--muted); max-width: 980px; flex-basis: 100%; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin: 0 0 14px; min-width: 0; }
.card > h2 { font-size: 15px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card h3 { font-size: 12px; margin: 14px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.grow { flex: 1; }
.okc { color: var(--ok); } .badc { color: var(--bad); } .warnc { color: var(--warn); }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 6px; padding: 5px 11px; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #b4bfcc; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.sm { padding: 1px 8px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-rev { background: var(--rev-bg); color: var(--rev); }
.b-man { background: var(--man-bg); color: var(--man); }
.b-bad { background: var(--bad-bg); color: var(--bad); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-info { background: var(--accent2); color: var(--accent); }
.tbl-wrap { overflow-x: auto; }
table.tbl { border-collapse: collapse; width: 100%; }
.tbl th { font-size: 12px; text-align: left; color: var(--muted); font-weight: 600; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfc; }
.tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line2); vertical-align: top; }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #f6f8fb; }
.tbl tr.sel td { background: var(--accent2); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 10px; }
.ms { position: relative; }
.ms-pop { display: none; position: absolute; top: 34px; left: 0; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px rgba(16, 24, 40, .14); padding: 6px 4px; z-index: 25; min-width: 220px; }
.ms.open .ms-pop { display: block; }
.ms-pop label { display: flex; gap: 8px; align-items: center; padding: 4px 8px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.ms-pop label:hover { background: #f3f5f8; }
.ghs { width: 30px; height: 30px; vertical-align: middle; }
.ghs.s { width: 20px; height: 20px; }
.adr { width: 28px; height: 28px; vertical-align: middle; margin-left: 4px; }
.picts { display: inline-flex; gap: 2px; align-items: center; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 5px 14px; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv.stack { grid-template-columns: minmax(0, 1fr); gap: 0; }
.kv.stack dt { font-size: 12px; margin-top: 7px; }
.kv.stack dd code { overflow-wrap: normal; }
.tbl td.nw { white-space: nowrap; }
.note { background: #f7f9fc; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-size: 12.5px; margin: 10px 0; }
.note.bad { background: var(--bad-bg); border-color: #efc2bd; }
.note.warn { background: var(--warn-bg); border-color: #efd99a; }
.note.ok { background: var(--ok-bg); border-color: #b5dfc3; }
.acts { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px); background: #1b2230; color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 13px; opacity: 0; transition: .2s; pointer-events: none; z-index: 60; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#modal { position: fixed; inset: 0; background: rgba(15, 22, 35, .45); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; z-index: 50; overflow-y: auto; }
#modal[hidden] { display: none; }
.modal-card { background: #fff; border-radius: 10px; max-width: 880px; width: 100%; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
.modal-head { padding: 12px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-body { padding: 16px 18px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; }
.steps { display: flex; gap: 6px; list-style: none; margin: 0 0 16px; padding: 0; flex-wrap: wrap; }
.steps li { flex: 1; min-width: 110px; border-top: 3px solid var(--line); padding: 6px 2px 0; font-size: 12.5px; color: var(--muted); }
.steps li.done { border-top-color: #2e9e5b; color: var(--ok); }
.steps li.cur { border-top-color: var(--accent); color: var(--ink); font-weight: 600; }
.ph { max-width: 760px; }
.ph h2 { color: var(--muted); }
#js-errors { position: fixed; bottom: 0; left: 0; right: 0; margin: 0; background: #a4251c; color: #fff; padding: 8px 12px; font-size: 12px; z-index: 99; white-space: pre-wrap; }
#js-errors[hidden] { display: none; }

/* dashboard */
.chain { display: grid; grid-template-columns: 1fr 26px 1fr 26px 1fr 26px 1fr; align-items: stretch; }
.cs { display: block; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; color: var(--ink); background: #fff; min-width: 0; }
.cs:hover { border-color: var(--accent); text-decoration: none; box-shadow: 0 0 0 3px var(--accent2); }
.cs-h { font-weight: 600; display: flex; gap: 8px; align-items: center; }
.cs-n { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.cs-big { font-size: 26px; font-weight: 700; margin-top: 6px; line-height: 1.1; }
.cs-l { color: var(--muted); font-size: 12.5px; }
.cs-sub { font-size: 12.5px; margin-top: 6px; display: flex; gap: 4px; flex-wrap: wrap; }
.chain-arrow { display: flex; align-items: center; justify-content: center; color: #9aa6b6; font-size: 18px; }
.lc { display: grid; grid-template-columns: 1fr 120px 1fr 120px 1fr; grid-template-rows: auto 70px auto; }
.stage { display: block; background: #fff; border: 1px solid #cfd6df; border-radius: 28px; padding: 12px 16px; color: var(--ink); text-align: center; min-height: 100px; }
.stage:hover { border-color: var(--accent); text-decoration: none; box-shadow: 0 0 0 3px var(--accent2); }
.stage.warn { border-color: #e2bd5a; }
.stage.bad { border-color: #df8f87; box-shadow: 0 0 0 2px #fbe3e0; }
.st-name { font-weight: 600; }
.st-desc { font-size: 12px; color: var(--muted); font-style: italic; }
.st-count { font-size: 12.5px; margin-top: 6px; }
.flow { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11.5px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-style: italic; text-align: center; padding: 0 4px; }
.flow .ar { font-size: 20px; color: #8995a7; font-style: normal; line-height: 1; }
.lc-exp { grid-column: 1 / 4; grid-row: 2; position: relative; }
.lc-exp .top { position: absolute; top: 0; height: 50%; left: calc((100% - 120px) / 4); right: calc((100% - 120px) / 4); border-right: 2px dashed #9aa6b6; border-bottom: 2px dashed #9aa6b6; }
.lc-exp .bot { position: absolute; top: 50%; bottom: 4px; left: calc((100% - 120px) / 4); border-left: 2px dashed #9aa6b6; }
.lc-exp .bot::after, .lc-req .vline::after { content: "▼"; position: absolute; bottom: -8px; left: -7px; font-size: 11px; color: #8995a7; }
.lc-exp .lbl, .lc-req .lbl { position: absolute; background: var(--panel); padding: 0 6px; font-size: 11.5px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-style: italic; white-space: nowrap; }
.lc-exp .lbl { top: calc(50% - 9px); left: 50%; transform: translateX(-50%); }
.lc-gap { grid-column: 4; grid-row: 2; }
.lc-req { grid-column: 5; grid-row: 2; position: relative; }
.lc-req .vline { position: absolute; top: 0; bottom: 4px; left: 50%; border-left: 2px dotted #9aa6b6; }
.lc-req .lbl { top: calc(50% - 9px); left: 50%; transform: translateX(-50%); }
.dash-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; }
.tasks { margin: 0; padding-left: 18px; }
.tasks li { margin: 0 0 6px; }
.msg { display: block; border: 1px solid var(--line); border-left: 4px solid var(--bad); border-radius: 6px; padding: 7px 10px; margin: 0 0 8px; color: var(--ink); background: #fff; }
.msg:hover { text-decoration: none; background: #fafbfd; }
.msg.notification { border-left-color: #d29b00; }
.msg.ack { border-left-color: #b7c0cc; }
.msg-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.msg-t { font-size: 13px; margin-top: 4px; }
.msg-do { font-size: 12.5px; margin-top: 3px; }
.msg-m { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* SDS detail */
.sd-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sd-head > div:first-child { flex: 1 1 560px; min-width: 0; }
.sd-head > .appr { flex: 0 0 auto; }
.sd-title { font-size: 20px; font-weight: 700; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; align-items: center; }
.chip { border: 1px solid var(--line); border-radius: 12px; padding: 1px 9px; font-size: 12px; color: var(--muted); background: #fafbfc; }
.appr { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; max-width: 360px; text-align: right; }
.chainbar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.cb { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; }
.cb.done { border-color: #a9d8b8; background: var(--ok-bg); }
.cb.cur { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent2); }
.sd-body { display: grid; grid-template-columns: minmax(0, 46%) minmax(0, 1fr); gap: 14px; align-items: start; }
.pageview { position: sticky; top: 62px; }
.pv-head { display: flex; justify-content: space-between; align-items: center; margin: 0 0 6px; font-size: 12.5px; color: var(--muted); gap: 12px; }
.pv-head > span:first-child { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.pv-head > span:last-child { text-align: right; font-size: 12px; }
.page { background: #fff; border: 1px solid #d5dbe3; box-shadow: 0 2px 10px rgba(0, 0, 0, .08); padding: 20px 24px; font-size: 12.5px; line-height: 1.6; max-height: calc(100vh - 190px); min-height: 420px; overflow-y: auto; }
.ln { padding: 0 4px; border-radius: 3px; border-left: 3px solid transparent; }
.ln.hd { font-weight: 700; margin-top: 8px; }
.ln.sec { border-left-color: #c3d3ea; }
.ln.ev { background: var(--ev); border-left-color: var(--ev-line); }
.page.fixing .w { cursor: pointer; border-radius: 2px; }
.page.fixing .w:hover { background: #cfe0ff; outline: 1px solid #8fb0e6; }
.sectabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 10px; }
.sectab { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 3px 9px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--ink); }
.sectab.act { background: var(--accent); color: #fff; border-color: var(--accent); }
.sectab .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-left: 5px; vertical-align: middle; }
.dot.rev { background: #3b74d1; } .dot.man { background: #9aa3ae; } .dot.ok { background: #2e9e5b; }
.sec-title { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin: 0 0 8px; flex-wrap: wrap; }
.sec-title b { font-size: 14px; }
.fld { border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; margin: 0 0 8px; background: #fff; cursor: pointer; }
.fld.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent2); }
.fld-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.fld-name { font-weight: 600; font-size: 13px; }
.fld-val { font-size: 14.5px; margin: 4px 0; overflow-wrap: anywhere; }
.fld-val input { width: 100%; font: inherit; padding: 5px 8px; border: 1px solid #9db7e0; border-radius: 5px; }
.fld-meta { font-size: 12px; color: var(--muted); }
.hint { color: var(--rev); margin-top: 4px; }
.keys { font-size: 11.5px; color: var(--muted); margin: 4px 0 10px; }
.prow { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line2); font-size: 13px; align-items: center; }

/* receiving */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 14px; align-items: start; }
.side { position: sticky; top: 62px; }
.ck { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line2); font-size: 13px; align-items: center; }
.checklist label { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line2); cursor: pointer; align-items: center; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.form-grid label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.form-grid input { font: inherit; color: var(--ink); padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; }
.bcs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.label-prev { border: 3px solid #111; border-radius: 4px; padding: 12px 14px; max-width: 560px; font-size: 12px; background: #fff; }
.lp-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.lp-name { font-size: 17px; font-weight: 700; }
.lp-sig { font-size: 15px; font-weight: 800; text-transform: uppercase; margin: 6px 0 2px; }
.label-prev ul { margin: 4px 0; padding-left: 18px; }
.lp-dates { border-top: 1px solid #111; margin-top: 8px; padding-top: 6px; font-size: 12px; }
.label-prev .ghs { width: 46px; height: 46px; }
.barcode { height: 50px; width: auto; }

/* integrations */
.int-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 6px; }
.mode { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; color: var(--muted); }
.mode b { display: block; font-size: 13px; color: var(--ink); }
.mode.act { border-color: var(--accent); background: var(--accent2); }

/* step B: shared parts */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 12px; flex-wrap: wrap; }
.tab { border: 0; background: none; padding: 7px 12px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.act { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 0 0 14px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; box-shadow: var(--shadow); min-width: 0; }
.kpi b { display: block; font-size: 21px; line-height: 1.2; overflow-wrap: anywhere; }
.kpi span { font-size: 12px; color: var(--muted); }
.kpi.warn b { color: var(--warn); } .kpi.bad b { color: var(--bad); } .kpi.ok b { color: var(--ok); }
.bar { display: block; width: 100%; min-width: 80px; height: 7px; background: #edf0f4; border-radius: 5px; overflow: hidden; margin: 3px 0; }
.bar > span { display: block; height: 100%; background: #5b8fd6; border-radius: 5px; }
.bar > span.warn { background: #e0a400; } .bar > span.bad { background: #d0453a; } .bar > span.ok { background: #2e9e5b; }
.drop { border: 2px dashed #b9c4d3; border-radius: 10px; padding: 16px; text-align: center; color: var(--muted); background: #fafbfd; cursor: pointer; margin: 10px 0; }
.drop:hover { border-color: var(--accent); color: var(--accent); }
.drop .ic { vertical-align: -3px; }
.card.inner { box-shadow: none; background: #fbfcfd; margin-top: 12px; }
.msg-wrap { margin: 0 0 12px; }
.msg-wrap .msg { margin: 0; }
.msg-wrap .acts { margin-top: 4px; }
.letter { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; background: #fbfcfd; }
.hit { border-bottom: 1px solid var(--line2); padding: 7px 0; font-size: 13px; }
.split.left { grid-template-columns: 250px minmax(0, 1fr); }
.split.rep { grid-template-columns: 260px minmax(0, 1fr); }
.replist a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--ink); cursor: pointer; }
.replist a:hover { background: #f3f5f8; text-decoration: none; }
.replist a.act { background: var(--accent2); font-weight: 600; }
.chart { display: grid; gap: 7px; margin: 6px 0 10px; }
.chart-row { display: grid; grid-template-columns: minmax(110px, 200px) minmax(0, 1fr) 70px; gap: 10px; align-items: center; font-size: 12.5px; }
.chart-row b { text-align: right; }
.tree { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.tree-room { margin: 10px 0 3px; text-transform: uppercase; letter-spacing: .04em; font-size: 11px; }
.tree a { display: flex; justify-content: space-between; gap: 6px; align-items: center; padding: 5px 8px; border-radius: 6px; color: var(--ink); cursor: pointer; }
.tree a:hover { background: #f3f5f8; text-decoration: none; }
.tree a.act { background: var(--accent2); }
.cab-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.cab-head .kv { flex: 1 1 380px; }
.shelf-l { font-size: 11px; color: var(--muted); margin-top: 6px; }
.shelf { border: 2px solid #c9d1dc; border-top: 0; border-radius: 0 0 6px 6px; padding: 8px; min-height: 56px; display: flex; flex-wrap: wrap; gap: 6px; background: #fbfcfd; }
.cchip { display: inline-block; border: 1px solid #9aa3ae; border-left-width: 4px; border-radius: 6px; padding: 3px 8px; font-size: 12px; background: #fff; line-height: 1.35; }
.cchip.conf { box-shadow: 0 0 0 2px #d0453a; }
.g-flam_liq { border-color: #e3001b; background: #fdeeee; } .g-oxidiser { border-color: #c9a100; background: #fff8d9; }
.g-acid { border-color: #c25e00; background: #fdf1e5; } .g-base { border-color: #6d3fb8; background: #f2edfb; }
.g-water_reactive { border-color: #0072bc; background: #e7f1fa; } .g-gas { border-color: #009a49; background: #e6f6ed; }
.g-toxic { border-color: #333; background: #f0f0f0; } .g-unknown { border-color: #9aa3ae; background: #f3f4f6; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.legend .cchip { font-size: 11px; padding: 1px 7px; }
.scan { font: inherit; padding: 6px 10px; border: 1px solid #9db7e0; border-radius: 6px; min-width: 220px; }
.num-in { font: inherit; width: 70px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; }
.filters select { font: inherit; padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; }
.sc-row { padding: 5px 0; border-bottom: 1px solid var(--line2); font-size: 13px; }
.tbl .picts { display: flex; margin-top: 2px; }
.side.wide { position: static; }
.side.wide .card { max-width: 900px; }

@media (max-width: 1180px) {
  .sd-body, .split, .int-grid { grid-template-columns: minmax(0, 1fr); }
  .split.left, .split.rep { grid-template-columns: minmax(0, 1fr); }
  .pageview, .side { position: static; }
  .page { max-height: 460px; }
}
@media (max-width: 860px) {
  #app { grid-template-columns: minmax(0, 1fr); }
  #sidebar { position: static; height: auto; }
  .chain { grid-template-columns: minmax(0, 1fr); }
  .chain-arrow { transform: rotate(90deg); height: 24px; }
  .lc { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .lc .flow, .lc-exp, .lc-gap, .lc-req { display: none; }
  .stage { margin-bottom: 8px; }
  .chainbar, .form-grid, .modes { grid-template-columns: minmax(0, 1fr); }
  #topbar { flex-wrap: wrap; }
}
