:root {
  --bg: #eef0f3;
  --win: #ffffff;
  --head: #f6f7f9;
  --head-2: #eceef1;
  --line: #dcdfe4;
  --line-2: #c8cdd5;
  --text: #1d2126;
  --muted: #59616c;
  --dim: #8a919b;
  --ink: #23272e;
  --ok: #1e8e3e;
  --warn: #a86400;
  --bad: #c5221f;
  --r: #b3261e; --r-fill: #fbeceb; --r-line: #eec4c1;
  --c: #935700; --c-fill: #fdf2de; --c-line: #efd3a2;
  --i: #56606b; --i-fill: #f0f2f4; --i-line: #d7dbe0;
  --mono: 'IBM Plex Mono', Consolas, 'Courier New', monospace;
  --sans: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 13px; overflow: hidden; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.tspacer { flex: 1; }

.view { display: none; height: 100vh; height: 100dvh; flex-direction: column; }
.view.active { display: flex; }

/* ---------- window chrome ---------- */
.titlebar { height: 30px; flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding-left: 10px; background: #e7e9ec; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); user-select: none; }
.tb-icon { width: 16px; height: 16px; flex-shrink: 0; }
.tb-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-ctrls { display: flex; align-self: stretch; }
.tb-ctrls span { width: 44px; display: grid; place-items: center; color: #6b7280; font-size: 12px; }

.menubar { height: 28px; flex-shrink: 0; display: flex; align-items: stretch; padding: 0 4px; background: var(--win); border-bottom: 1px solid var(--line); position: relative; z-index: 40; }
.mb { display: flex; align-items: center; padding: 0 10px; font-size: 12.5px; border: 0; background: none; border-radius: 3px; margin: 2px 0; }
.menubar:not(.static) .mb:hover, .mb.open { background: var(--head-2); }
.mb-right { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); padding-right: 8px; white-space: nowrap; }
.mb-right b { color: var(--text); font-weight: 600; }
.linkbtn { border: 0; background: none; color: var(--text); text-decoration: underline; text-underline-offset: 2px; font-size: 12px; }
.linkbtn:hover { color: #000; }
.menu-drop { position: absolute; top: 100%; min-width: 230px; background: #fff; border: 1px solid var(--line-2); border-radius: 4px; box-shadow: 0 10px 28px rgba(20, 24, 30, .16); padding: 4px 0; }
.menu-item { display: flex; align-items: center; width: 100%; gap: 16px; padding: 6px 14px 6px 30px; font-size: 12.5px; background: none; border: 0; text-align: left; position: relative; white-space: nowrap; }
.menu-item:hover:not(:disabled) { background: var(--head-2); }
.menu-item:disabled { color: var(--dim); cursor: default; }
.menu-item .k { margin-left: auto; color: var(--dim); font-size: 11.5px; }
.menu-item.checked::before { content: '\2713'; position: absolute; left: 11px; font-size: 12px; }
.menu-sep { height: 1px; background: var(--line); margin: 4px 0; }

/* ---------- controls ---------- */
.field { display: block; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, textarea { width: 100%; height: 34px; background: #fff; border: 1px solid var(--line-2); border-radius: 4px; padding: 0 10px; outline: none; transition: border-color .12s, box-shadow .12s; }
textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.4; }
.field input[readonly] { background: var(--head); color: var(--muted); }
.field input:focus, .field select:focus, textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(35, 39, 46, .08); }

.btn { height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; border: 1px solid var(--line-2); background: #fff; border-radius: 4px; font-size: 13px; font-weight: 500; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover:not(:disabled) { background: var(--head); border-color: #b5bbc4; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #3a4048; border-color: #3a4048; }
.btn.primary kbd { background: transparent; color: #c3c8cf; border-color: #5a616b; }
.btn.block { width: 100%; }
.btn.lg { height: 42px; font-size: 14px; }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn.loading::before { content: ''; width: 13px; height: 13px; border-radius: 50%; border: 2px solid #ffffff55; border-top-color: #fff; animation: spin .7s linear infinite; }
kbd { font-family: var(--mono); font-size: 10px; font-weight: 500; color: var(--dim); background: #fff; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 3px; padding: 0 4px; line-height: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: .2; } }

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--dim); flex-shrink: 0; }
.dot.ok { background: var(--ok); }

.code { display: inline-block; min-width: 30px; text-align: center; font-family: var(--mono); font-size: 10.5px; font-weight: 600; padding: 1px 5px; border: 1px solid; border-radius: 3px; line-height: 16px; }
.code.R { color: var(--r); background: var(--r-fill); border-color: var(--r-line); }
.code.C { color: var(--c); background: var(--c-fill); border-color: var(--c-line); }
.code.I, .code.SR { color: var(--i); background: var(--i-fill); border-color: var(--i-line); }
.code.X { color: #fff; background: var(--ink); border-color: var(--ink); }
.code.A { color: var(--muted); background: #fff; border-color: var(--line-2); border-style: dashed; }
.code.S { color: var(--muted); background: var(--head); border-color: var(--line); }

/* ---------- login ---------- */
#view-login { align-items: center; justify-content: center; background: linear-gradient(#f3f4f6, #e6e8eb); }
.login-shell { width: 100%; max-width: 440px; padding: 16px; }
.window { background: #fff; border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 24px 60px rgba(20, 24, 30, .16); }
.login-body { padding: 26px 28px 20px; }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.lb-name { font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.lb-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
#login-form .field { margin-bottom: 14px; }
.form-error { color: var(--bad); font-size: 12.5px; min-height: 18px; margin: -4px 0 8px; }
.device-line { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.login-foot { padding: 10px 28px; background: var(--head); border-top: 1px solid var(--line); font-size: 11.5px; color: var(--dim); }
.login-copy { text-align: center; font-size: 11px; color: var(--dim); margin-top: 12px; }

/* ---------- panels ---------- */
.panel { background: var(--win); border: 1px solid var(--line); border-radius: 4px; display: flex; flex-direction: column; min-height: 0; }
.panel > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 32px; flex-shrink: 0; padding: 0 10px; background: var(--head); border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); border-radius: 4px 4px 0 0; }
.panel > header .linkbtn { text-transform: none; letter-spacing: 0; font-weight: 500; }
.hdr-note { font-family: var(--mono); font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--dim); }
.hdr-ok { display: flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--ok); }
.panel-body { padding: 14px; }
.panel.grow { flex: 1; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px 12px; font-size: 12px; }
.kv.pad { padding: 9px 10px; }
.kv dt { color: var(--dim); white-space: nowrap; }
.kv dd { font-family: var(--mono); font-size: 11.5px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- setup ---------- */
.setup-main { flex: 1; overflow: auto; padding: 24px 16px 40px; }
.setup-head { max-width: 1120px; margin: 0 auto 18px; }
.setup-head h1 { font-size: 21px; font-weight: 600; letter-spacing: -.01em; }
.setup-head p { color: var(--muted); margin-top: 3px; }
.setup-grid { max-width: 1120px; margin: 0 auto; display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; align-items: start; }
.setup-grid .col { display: grid; gap: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.qfield { display: grid; grid-template-columns: 38px 1fr; gap: 10px; align-items: start; margin-bottom: 10px; }
.qfield .code { padding: 8px 0; }
.hint { font-size: 12px; color: var(--dim); }
.seq-preview { list-style: none; padding: 6px 0; max-height: 280px; overflow: auto; }
.seq-preview li { display: grid; grid-template-columns: 26px 40px 1fr; gap: 8px; align-items: start; padding: 5px 14px; font-size: 12.5px; color: var(--muted); }
.seq-preview li::before { content: counter(list-item); font-family: var(--mono); font-size: 11px; color: var(--dim); padding-top: 1px; }
.seq-preview li .code { justify-self: start; }
.panel-body .kv { padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.sensor-list { list-style: none; }
.sensor-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #eef0f2; }
.s-port { font-family: var(--mono); font-size: 10.5px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 3px; width: 38px; text-align: center; flex-shrink: 0; }
.s-name { flex: 1; display: flex; flex-direction: column; font-size: 12.5px; }
.s-detail { font-family: var(--mono); font-size: 11px; color: var(--dim); min-height: 15px; }
.s-status { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; color: var(--dim); }
.s-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.s-status.chk { color: var(--warn); }
.s-status.chk::before { background: var(--warn); animation: blink .5s infinite; }
.s-status.ok { color: var(--ok); }
.s-status.ok::before { background: var(--ok); }
.sensor-summary { font-size: 12px; color: var(--muted); padding-top: 10px; }
.checklist { display: grid; gap: 10px; }
.checklist label { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; cursor: pointer; }
.checklist input { width: 15px; height: 15px; margin-top: 1px; accent-color: var(--ink); flex-shrink: 0; }
.start-box { display: grid; gap: 8px; }
.start-hint { font-size: 12px; color: var(--dim); text-align: center; }

/* ---------- exam ---------- */
.toolbar { flex-shrink: 0; display: flex; align-items: center; gap: 6px; padding: 5px 8px; background: var(--head); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tgroup { display: flex; align-items: center; gap: 2px; padding-right: 8px; border-right: 1px solid var(--line); }
.tbtn { height: 30px; display: inline-flex; align-items: center; gap: 6px; padding: 0 9px; border: 1px solid transparent; background: transparent; border-radius: 4px; font-size: 12.5px; white-space: nowrap; }
.tbtn:hover:not(:disabled) { background: #fff; border-color: var(--line-2); }
.tbtn:disabled { opacity: .38; cursor: default; }
.tbtn svg { width: 14px; height: 14px; flex-shrink: 0; }
.tbtn.rec svg { color: #e5484d; }
.tbtn.sm { height: 26px; padding: 0 7px; font-family: var(--mono); font-size: 11px; font-weight: 500; background: #fff; border-color: var(--line-2); }
.tbtn.strong { background: var(--ink); color: #fff; }
.tbtn.strong:hover:not(:disabled) { background: #3a4048; border-color: #3a4048; }
.tlabel { font-size: 11px; color: var(--dim); margin: 0 5px 0 3px; }
.tsel { height: 26px; border: 1px solid var(--line-2); border-radius: 4px; background: #fff; padding: 0 4px; font-size: 12px; margin-right: 4px; }

.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: 228px minmax(0, 1fr) 348px; }
.side { background: var(--bg); padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow: auto; min-height: 0; }
.side.left { border-right: 1px solid var(--line); }
.side.right { border-left: 1px solid var(--line); }

.tree { list-style: none; padding: 6px 4px; font-size: 12.5px; }
.tree li { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 3px; white-space: nowrap; }
.tree li svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--muted); }
.tree li .nm { overflow: hidden; text-overflow: ellipsis; }
.tree .l1 { padding-left: 18px; } .tree .l2 { padding-left: 30px; } .tree .l3 { padding-left: 44px; }
.tree li.active { background: var(--head-2); font-weight: 600; }
.tree .st { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--dim); font-weight: 500; }
.tree .st.rec { color: var(--bad); }
.tree .st.ok { color: var(--ok); }

.center { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--win); }
.chart-head { height: 36px; flex-shrink: 0; display: flex; align-items: center; gap: 12px; padding: 0 12px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.ch-title { font-weight: 600; white-space: nowrap; }
.ch-meta { font-family: var(--mono); font-size: 11.5px; color: var(--dim); white-space: nowrap; }
.ch-time { color: var(--muted); white-space: nowrap; }
.ch-time b { font-family: var(--mono); font-weight: 500; color: var(--text); margin-left: 4px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; padding: 2px 8px; border: 1px solid; border-radius: 3px; white-space: nowrap; }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill b { font-weight: 600; }
.pill.standby { color: var(--muted); background: var(--head); border-color: var(--line); }
.pill.cal { color: var(--warn); background: #fff5e3; border-color: #efd3a2; }
.pill.cal i { animation: blink .6s infinite; }
.pill.rec { color: var(--bad); background: #fdecea; border-color: #f1bdb9; }
.pill.rec i { animation: blink 1s infinite; }
.pill.paused { color: var(--warn); background: #fff5e3; border-color: #efd3a2; }
.pill.done { color: var(--ok); background: #e7f4eb; border-color: #b8dfc4; }
.live-btn { height: 24px; padding: 0 9px; border: 1px solid var(--line-2); background: #fff; border-radius: 3px; font-size: 12px; }
.live-btn:hover { background: var(--head); }

.chart-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 138px minmax(0, 1fr); }
.ch-labels { display: flex; flex-direction: column; min-height: 0; background: #fafbfc; border-right: 1px solid var(--line-2); }
.ch-labels .rs { height: 22px; flex: none; display: flex; align-items: center; padding: 0 10px; border-bottom: 1px solid var(--line-2); font-family: var(--mono); font-size: 10px; color: var(--dim); background: var(--head); }
.chl { flex: 1 1 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: 1px; padding: 0 8px 0 9px; border-left: 3px solid var(--c); border-bottom: 1px solid #e3e6ea; }
.chl:last-child { border-bottom: 0; }
.chl-top { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; }
.chl-name { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--c); }
.chl-val { font-family: var(--mono); font-size: 12px; font-weight: 500; white-space: nowrap; }
.chl-val.warn { color: var(--warn); }
.chl-sub { font-size: 10.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chl-gain { display: flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 10px; color: var(--dim); margin-top: 2px; }
.chl-gain button { width: 16px; height: 16px; display: grid; place-items: center; border: 1px solid var(--line-2); background: #fff; border-radius: 2px; font-size: 11px; line-height: 1; padding: 0; }
.chl-gain button:hover { background: var(--head-2); }
.ch-labels.compact .chl-sub, .ch-labels.compact .chl-gain { display: none; }

.chart-wrap { position: relative; min-width: 0; min-height: 0; cursor: crosshair; touch-action: pan-y; }
.chart-wrap.dragging { cursor: grabbing; }
#chart { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.qbanner { position: absolute; left: 50%; top: 32px; z-index: 2; max-width: min(620px, 86%); display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: #fff; border: 1px solid var(--line-2); border-radius: 4px; box-shadow: 0 6px 20px rgba(20, 24, 30, .12); font-size: 14px; opacity: 0; transform: translate(-50%, -6px); transition: opacity .2s, transform .2s; pointer-events: none; }
.qbanner.show { opacity: 1; transform: translate(-50%, 0); }
.qbanner .code { flex-shrink: 0; }

.overview { height: 42px; flex-shrink: 0; position: relative; border-top: 1px solid var(--line-2); background: #fafbfc; cursor: pointer; }
#overview { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.logpanel { height: 148px; flex-shrink: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line-2); }
.log-head { height: 28px; flex-shrink: 0; display: flex; align-items: center; gap: 12px; padding: 0 12px; background: var(--head); border-bottom: 1px solid var(--line); font-size: 12px; }
.log-head .tab { font-weight: 600; }
.log-count { margin-left: auto; color: var(--dim); font-family: var(--mono); font-size: 11px; }
.log-scroll { flex: 1; overflow: auto; }
table.log { width: 100%; border-collapse: collapse; font-size: 12px; }
table.log td { padding: 3px 12px; border-bottom: 1px solid #f0f2f4; vertical-align: top; }
table.log td.t { width: 78px; font-family: var(--mono); font-size: 11px; color: var(--dim); white-space: nowrap; padding-top: 4px; }
table.log td.k { width: 48px; padding-left: 0; padding-right: 0; }
table.log td.msg { color: var(--muted); }

.qc-body { padding: 10px; display: grid; gap: 8px; }
.qc-now { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.qc-type { color: var(--muted); }
.qc-state { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
.qc-state.live { color: var(--bad); }
.qc-text { font-size: 14.5px; line-height: 1.4; min-height: 42px; }
.ans-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.recovery-row { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 11px; color: var(--muted); padding-top: 2px; }
.recovery-row span:first-child { white-space: nowrap; min-width: 118px; }
.recovery { flex: 1; height: 4px; background: var(--head-2); border-radius: 2px; overflow: hidden; }
.recovery i { display: block; height: 100%; width: 0; background: var(--ink); }
.recovery i.ready { background: var(--ok); }

.table-scroll { flex: 1; overflow: auto; min-height: 0; scroll-padding-top: 28px; }
.qtable, .meas { width: 100%; border-collapse: collapse; font-size: 12px; }
.qtable th, .meas th { position: sticky; top: 0; z-index: 1; background: #fafbfc; text-align: left; font-size: 10.5px; font-weight: 600; color: var(--dim); letter-spacing: .03em; padding: 5px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.qtable td, .meas td { padding: 6px 8px; border-bottom: 1px solid #eef0f2; vertical-align: top; }
.qtable td:first-child { width: 46px; }
.qtable td.qt { line-height: 1.35; }
.qtable .r, .meas .r { text-align: right; }
.qtable td.ans { font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.qtable tr.current td { background: #f4f5f7; }
.qtable tr.current td:first-child { box-shadow: inset 3px 0 0 var(--ink); }
.qtable tr.done td { color: var(--dim); }
.meas-scroll { max-height: 190px; }
.meas td { font-family: var(--mono); font-size: 11.5px; white-space: nowrap; }
.meas td:first-child { font-family: var(--sans); }
.meas tr.pending td { color: var(--dim); }
.meas tr.empty td { color: var(--dim); font-family: var(--sans); text-align: center; padding: 14px 8px; }

/* response analysis */
.ra-body { padding: 12px; display: grid; gap: 10px; }
.ra-status-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); }
.ra-time { font-family: var(--mono); font-size: 11.5px; color: var(--dim); }
.ra-note { font-size: 12px; color: var(--dim); }
.ra-progress { height: 3px; background: var(--head-2); border-radius: 2px; overflow: hidden; margin-top: -4px; }
.ra-progress i { display: block; height: 100%; width: 0; background: var(--ink); }
.meter { padding-top: 18px; }
.meter-track { position: relative; height: 26px; border: 1px solid var(--line-2); border-radius: 3px; background: #f3f4f6; overflow: visible; }
.meter-cover { position: absolute; inset: 0; border-radius: 2px; background: linear-gradient(90deg, #2e9d4f 0%, #8cbf3f 30%, #e3b021 55%, #e0701f 75%, #c5221f 100%); clip-path: inset(0 calc(100% - var(--v, 0%)) 0 0); transition: clip-path .35s ease-out; }
.meter-ticks { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(255,255,255,.55) calc(10% - 1px) 10%); pointer-events: none; }
.meter-pin { position: absolute; top: -5px; bottom: -5px; left: var(--v, 0%); width: 2px; margin-left: -1px; background: var(--ink); transition: left .35s ease-out; }
.meter-pin span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-family: var(--mono); font-size: 10.5px; font-weight: 600; color: var(--ink); background: #fff; padding: 0 3px; white-space: nowrap; }
.meter-scale { display: flex; justify-content: space-between; margin-top: 8px; font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; }
.verdict-box { border: 1px solid; border-radius: 4px; padding: 10px 12px; text-align: center; transition: background .2s, border-color .2s, color .2s; }
.verdict-box .vb-label { font-family: var(--mono); font-size: 16px; font-weight: 600; letter-spacing: .05em; }
.verdict-box .vb-sub { font-size: 12px; margin-top: 2px; }
.verdict-box.idle { color: var(--muted); background: var(--head); border-color: var(--line); }
.verdict-box.run { color: var(--warn); background: #fff7e8; border-color: #efd3a2; }
.verdict-box.run .vb-label { animation: blink 1s infinite; }
.verdict-box.truth { color: var(--ok); background: #e9f5ed; border-color: #b8dfc4; }
.verdict-box.lie { color: var(--r); background: var(--r-fill); border-color: var(--r-line); }
.ra-kv { padding-top: 8px; border-top: 1px solid var(--line); }
.meas td.res-t { color: var(--ok); font-weight: 600; }
.meas td.res-l { color: var(--r); font-weight: 600; }

.statusbar { height: 24px; flex-shrink: 0; display: flex; align-items: center; background: var(--head-2); border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.statusbar > span { padding: 0 12px; border-right: 1px solid var(--line); display: flex; align-items: center; }
.statusbar > .tspacer { border-right: 0; }
.statusbar > span:last-child { border-right: 0; font-family: var(--mono); }
.sig { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); border: 1.5px solid var(--ok); margin-right: 7px; }
.sig.armed { background: transparent; }

/* ---------- dialogs ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(28, 32, 38, .32); }
.overlay.show { display: flex; }
.dialog { width: 100%; max-width: 440px; max-height: 100%; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden; box-shadow: 0 24px 60px rgba(20, 24, 30, .25); }
.dialog .titlebar { padding-right: 10px; }
.dialog-body { padding: 18px; overflow: auto; }
.dialog-actions { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--head); border-top: 1px solid var(--line); flex-wrap: wrap; }
.dlg-sub { color: var(--muted); margin-bottom: 14px; }
.report-dlg { max-width: 860px; }
.steps { list-style: none; display: grid; gap: 9px; margin-bottom: 16px; }
.steps li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--dim); }
.steps li::before { content: ''; width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--line-2); flex-shrink: 0; }
.steps li.run { color: var(--text); }
.steps li.run::before { border-top-color: var(--ink); animation: spin .7s linear infinite; }
.steps li.ok { color: var(--muted); }
.steps li.ok::before { border-color: var(--ok); background: var(--ok); box-shadow: inset 0 0 0 2px #fff; }
.steps li .val { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--dim); }
.progress { height: 4px; background: var(--head-2); border-radius: 2px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .3s; }
.info-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 12.5px; }
.info-list dt { font-family: var(--mono); font-size: 11.5px; }
.info-list dd { color: var(--muted); }

/* report */
.report { font-size: 12.5px; color: var(--text); }
.rp-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding-bottom: 10px; border-bottom: 2px solid var(--ink); margin-bottom: 14px; }
.rp-head h2 { font-size: 17px; font-weight: 600; }
.rp-head .rp-org { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.rp-head small { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; }
.rp-grid { display: grid; grid-template-columns: repeat(4, auto minmax(0, 1fr)); gap: 5px 12px; margin-bottom: 16px; font-size: 12px; }
.rp-grid dt { color: var(--dim); white-space: nowrap; }
.rp-grid dd { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-sec { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 16px 0 6px; }
.rp-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rp-table th { text-align: left; font-size: 10.5px; font-weight: 600; color: var(--dim); padding: 5px 8px; border-bottom: 1px solid var(--line-2); background: #fafbfc; white-space: nowrap; }
.rp-table td { padding: 7px 8px; border-bottom: 1px solid #eceef1; vertical-align: top; }
.rp-table .n { text-align: center; font-family: var(--mono); white-space: nowrap; }
.rp-table tfoot td { font-weight: 600; border-bottom: 0; border-top: 1px solid var(--line-2); }
.rp-table td.q { color: var(--muted); min-width: 200px; }
.neg { color: var(--r); } .pos { color: var(--ok); } .zero { color: var(--dim); } .na { color: #c3c8cf; }
.verdict { display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid; border-radius: 4px; padding: 12px 16px; margin-top: 16px; }
.verdict .v-label { font-family: var(--mono); font-size: 16px; font-weight: 600; letter-spacing: .04em; }
.verdict .v-sub { font-size: 12.5px; margin-top: 2px; }
.verdict .v-score { text-align: right; font-family: var(--mono); font-size: 12px; }
.verdict .v-score b { display: block; font-size: 22px; }
.verdict.di { color: var(--r); background: var(--r-fill); border-color: var(--r-line); }
.verdict.ndi { color: var(--ok); background: #e9f5ed; border-color: #b8dfc4; }
.verdict.inc { color: var(--c); background: var(--c-fill); border-color: var(--c-line); }
.rp-note { font-size: 11.5px; color: var(--muted); margin-top: 10px; line-height: 1.55; }
.rp-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 30px; }
.rp-sign div { border-top: 1px solid var(--text); padding-top: 4px; font-size: 11px; color: var(--muted); }

.toast { position: fixed; right: 16px; bottom: 36px; z-index: 80; background: var(--ink); color: #fff; font-size: 12.5px; padding: 9px 14px; border-radius: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.2); opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 1320px) {
  .workspace { grid-template-columns: 206px minmax(0, 1fr) 318px; }
}
@media (max-width: 1140px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 312px; }
  .side.left { display: none; }
}
@media (max-width: 900px) {
  .setup-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  body { overflow: auto; }
  #view-exam.active { height: auto; min-height: 100vh; }
  .workspace { display: flex; flex-direction: column; }
  .center { height: 76vh; min-height: 460px; }
  .side.right { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .hide-sm { display: none !important; }
  .tb-ctrls { display: none; }
  .logpanel { height: 120px; }
  .chart-body { grid-template-columns: 96px minmax(0, 1fr); }
  .chl-sub, .chl-gain { display: none; }
  .ch-meta { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .rp-grid { grid-template-columns: auto minmax(0, 1fr); }
  .menubar .mb-right { display: none; }
}

@media print {
  body { overflow: visible; background: #fff; }
  body * { visibility: hidden; }
  #report, #report * { visibility: visible; }
  #report { position: absolute; left: 0; top: 0; width: 100%; padding: 12mm; }
  .overlay { background: none; }
}
