/* SpotBot — engineering calculator, same family as PlotBot. */
:root {
  --bg: #f7f8f9; --panel: #fff; --panel-2: #f3f5f7; --panel-3: #eceff2;
  --line: #e1e5ea; --line-2: #cdd3da; --text: #1b2127; --text-2: #4b5560; --text-3: #7a8591;
  --accent: #c4410a; --accent-soft: #fff3ec; --accent-line: #f3c4a8; --brand: #fb4d07;
  --ok: #2b8a3e; --err: #c92a2a; --err-soft: #fff0f0; --focus: #1f6feb;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 4px; --r2: 6px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--bg); }
body { font: 13px/1.4 var(--font); color: var(--text); -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
kbd { font: 500 11px/1 var(--mono); padding: 2px 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 3px; background: var(--panel); color: var(--text-2); white-space: nowrap; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--text-3); }
.fine { font-size: 11.5px; color: var(--text-3); margin: 8px 0 0; }
.pad { padding: 12px; }
#root { height: 100%; }

/* ---------- shell ---------- */
.sb { height: 100vh; height: 100dvh; display: grid; grid-template-rows: 48px 0 minmax(0, 1fr) 28px; grid-template-columns: 236px minmax(0, 1fr) 300px;
  grid-template-areas: "top top top" "tabs tabs tabs" "rail main hist" "status status status"; }
.sb.no-hist { grid-template-columns: 236px minmax(0, 1fr) 0; }
.sb-top { grid-area: top; display: flex; align-items: center; gap: 12px; padding: 0 10px 0 12px; background: var(--panel); border-bottom: 1px solid var(--line-2); min-width: 0; }
.sb-sub { font-size: 11.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); white-space: nowrap; padding-left: 12px; border-left: 1px solid var(--line-2); }
.sb-job input { width: 200px; height: 30px; border: 1px solid transparent; border-radius: var(--r); background: none; padding: 0 8px; font-weight: 500; }
.sb-job input:hover { border-color: var(--line); } .sb-job input:focus { border-color: var(--focus); outline: none; background: var(--panel); }
.sb-top-r { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--panel-3); border-radius: var(--r2); }
.seg button { border: 0; background: none; padding: 4px 10px; border-radius: var(--r); font-size: 12.5px; color: var(--text-2); }
.seg button.on { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--line-2); }
.seg .s { display: none; }
.ibtn { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: var(--r); background: none; color: var(--text-2); position: relative; }
.ibtn:hover:not(:disabled), .ibtn.on { background: var(--panel-3); color: var(--text); }
.ibtn:disabled { opacity: .35; cursor: default; }
.ibtn.sm { width: 26px; height: 26px; }
.ibtn.sm.on { color: #f59f00; background: none; }
.hist-btn i { position: absolute; top: 2px; right: 1px; font: 600 9.5px/14px var(--font); font-style: normal; min-width: 14px; padding: 0 3px; border-radius: 7px; background: var(--panel-3); color: var(--text-2); }
.menu-wrap { position: relative; }
.pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r2); box-shadow: 0 8px 28px rgba(16, 24, 40, .18); padding: 10px 12px; width: 260px; font-size: 12.5px; }
.pop.help { width: 340px; }
.pop-h { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin: 4px 0 6px; }
.pop-h:not(:first-child) { margin-top: 12px; }
.pop label { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; }
.pop select { height: 28px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--panel); padding: 0 6px; font-family: var(--mono); }
.pop table { width: 100%; border-collapse: collapse; } .pop td { padding: 3px 0; } .pop td:first-child { width: 96px; }
.pop p { margin: 4px 0; color: var(--text-2); line-height: 1.5; }

.sb-rail { grid-area: rail; background: var(--panel); border-right: 1px solid var(--line-2); padding: 10px 8px; overflow-y: auto; min-height: 0; }
.rail-h { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); padding: 4px 8px 8px; }
.rail-i { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; align-items: center; gap: 0 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r); background: none; text-align: left; margin-bottom: 2px; }
.rail-i span { font-weight: 600; font-size: 13.5px; } .rail-i small { grid-column: 1; font-size: 11.5px; color: var(--text-3); }
.rail-i kbd { grid-row: 1 / span 2; grid-column: 2; opacity: 0; font-size: 10px; }
.rail-i:hover { background: var(--panel-2); } .rail-i:hover kbd { opacity: .8; }
.rail-i.on { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--brand); }
.rail-i.on span { color: var(--accent); }
.rail-sub { display: flex; flex-direction: column; padding: 2px 0 8px 12px; margin-bottom: 4px; }
.rail-sub button { border: 0; background: none; text-align: left; padding: 5px 10px; border-radius: var(--r); color: var(--text-2); font-size: 12.5px; border-left: 1px solid var(--line); }
.rail-sub button:hover { background: var(--panel-2); color: var(--text); }
.rail-sub button.on { color: var(--accent); font-weight: 600; border-left-color: var(--brand); }
.sb-tabs { grid-area: tabs; display: none; }

.sb-main { grid-area: main; overflow-y: auto; min-height: 0; padding: 20px 24px 28px; overscroll-behavior: contain; }
.notice { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 0 0 14px; border: 1px solid var(--line); border-radius: var(--r2); background: var(--panel); font-size: 12.5px; color: var(--text-2); }
.notice span { flex: 1; } .notice button { border: 0; background: none; color: var(--text-3); display: grid; }

/* ---------- grade calculator ---------- */
.grade { display: grid; grid-template-columns: minmax(300px, 420px) minmax(340px, 1fr); gap: 24px; align-items: start; max-width: 1080px; }
.inputs { position: relative; padding-left: 34px; }
.inputs::before { content: ""; position: absolute; left: 12px; top: 34px; bottom: 96px; width: 2px; background: repeating-linear-gradient(var(--line-2) 0 6px, transparent 6px 10px); }
.pt { position: relative; }
.pt-tag { position: absolute; left: -34px; top: 23px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 600 12px/1 var(--mono); background: var(--text); color: #fff; }
.link { padding: 6px 0 6px; }
.fld { margin-bottom: 12px; }
.fld label { display: flex; align-items: baseline; gap: 6px; font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 4px; }
.fld label em { font-style: normal; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.fld-box { display: flex; align-items: center; height: 42px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--panel); transition: border-color .12s, background-color .12s; }
.fld-box:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(31, 111, 235, .14); }
.fld-box input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; padding: 0 10px; font: 500 18px/1 var(--mono); letter-spacing: -.01em; }
.fld-box input::placeholder { font: 400 13px var(--font); color: #a7b0b9; letter-spacing: 0; }
.fld-box .unit { padding-right: 10px; font-size: 11.5px; font-weight: 600; color: var(--text-3); letter-spacing: .04em; white-space: nowrap; }
.fld-box .fmt { height: 30px; margin-right: 6px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel-2); padding: 0 4px; font-size: 12px; color: var(--text-2); }
.fld.derived .fld-box { background: var(--accent-soft); border-color: var(--accent-line); }
.fld.derived input { color: var(--accent); }
.fld.primary .fld-box { border-color: var(--accent); }
.fld.bad .fld-box { border-color: var(--err); background: var(--err-soft); }
.fld-note { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.fld-note.err, .err { color: var(--err); }
.fld-box.sm { height: 34px; } .fld-box.sm input { font-size: 15px; }
.fld-box.big { height: 50px; } .fld-box.big input { font-size: 22px; }
.slope-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -4px 0 14px; }
.dir { display: inline-flex; padding: 2px; gap: 2px; background: var(--panel-3); border-radius: var(--r2); }
.dir button { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 4px 10px; border-radius: var(--r); font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.dir button.on { background: var(--text); color: #fff; }
.dir.locked button { cursor: default; } .dir.locked button:not(.on) { opacity: .45; } .dir.locked button.on { background: var(--text-2); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips button { border: 1px solid var(--line-2); background: var(--panel); border-radius: 12px; padding: 2px 9px; font: 500 12px/1.4 var(--mono); color: var(--text-2); }
.chips button:hover { border-color: var(--brand); color: var(--accent); }
.chips button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--panel); font-weight: 500; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--text-3); background: var(--panel-2); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.ghost { border-color: transparent; background: none; color: var(--text-2); }

.result { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); padding: 18px 20px 16px; min-width: 0; }
.res-label { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.res-num { display: inline-flex; align-items: baseline; gap: 6px; margin: 4px 0 2px; }
.res-num .n { font: 600 52px/1.05 var(--mono); letter-spacing: -.03em; color: var(--text); }
.res-num .u { font: 600 16px var(--font); color: var(--text-3); letter-spacing: .04em; }
.dirpill { align-self: center; margin-left: 6px; font: 600 12px var(--font); padding: 3px 8px; border-radius: 10px; background: var(--panel-3); color: var(--text-2); }
.dirpill.fall { background: #fff1e6; color: var(--accent); } .dirpill.rise { background: #e7f5ec; color: var(--ok); }
.res-eq { font: 500 13px/1.5 var(--mono); color: var(--text-2); }
.res-empty { font-size: 15px; color: var(--text-2); margin: 10px 0 4px; min-height: 58px; }
.res-err { color: var(--err); font-size: 12.5px; margin-top: 4px; }
.copyable { display: inline-flex; align-items: baseline; gap: 4px; border: 0; background: none; padding: 0; text-align: left; border-radius: var(--r); position: relative; }
.copyable:hover { background: var(--panel-2); box-shadow: 0 0 0 4px var(--panel-2); }
.copy-hint { align-self: center; display: inline-flex; font: 600 11px var(--font); color: var(--text-3); opacity: 0; transition: opacity .12s; margin-left: 2px; }
.copyable:hover .copy-hint, .copyable:focus-visible .copy-hint, .copyable.copied .copy-hint { opacity: 1; }
.copyable.copied .copy-hint { color: var(--ok); }
.diag { width: 100%; max-width: 440px; height: auto; display: block; margin: 12px 0 6px; }
.d-line { stroke: var(--line-2); stroke-width: 2; stroke-dasharray: 4 4; } .d-line.on { stroke: var(--brand); stroke-width: 3; stroke-dasharray: none; }
.d-arrow { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.d-pt { fill: var(--text); } .d-dim { stroke: var(--text-3); stroke-width: 1; }
.d-t { font: 500 11.5px var(--mono); fill: var(--text-2); text-anchor: middle; } .d-l { text-anchor: start; } .d-r { text-anchor: end; } .d-s { fill: var(--accent); font-weight: 600; }
.res-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; margin: 6px 0 0; border-top: 1px solid var(--line); }
.res-grid > div { padding: 8px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.res-grid .wide { grid-column: 1 / -1; }
.res-grid dt { font-size: 11.5px; color: var(--text-3); margin-bottom: 2px; }
.res-grid dd { margin: 0; font: 500 15px var(--mono); display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; }
.res-grid dd small { font: 500 11px var(--font); color: var(--text-3); letter-spacing: .03em; }
.res-grid .calc dd { color: var(--accent); }
.eqv { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; color: var(--text-2); font-size: 13.5px; }
.inter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; font-size: 12.5px; color: var(--text-2); }
.inter .fld-box { width: 170px; }
.inter-eq { color: var(--text-3); } .inter-v { font: 600 16px var(--mono); }

/* ---------- conversion ---------- */
.convert { display: grid; grid-template-columns: minmax(300px, 460px) minmax(260px, 380px); gap: 28px; align-items: start; }
.conv-in label { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 4px; }
.conv-out { margin: 14px 0; border-top: 1px solid var(--line); }
.conv-out > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.conv-out dt { color: var(--text-2); } .conv-out dd { margin: 0; font: 500 16px var(--mono); }
.conv-ref h2 { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin: 4px 0 8px; }
.conv-ref table { width: 100%; border-collapse: collapse; font: 500 13px var(--mono); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); }
.conv-ref th { font: 600 11px var(--font); color: var(--text-3); text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line-2); letter-spacing: .04em; }
.conv-ref td { padding: 6px 10px; border-bottom: 1px solid var(--line); }
.conv-ref tr:last-child td { border-bottom: 0; }
.conv-ref tbody tr { cursor: pointer; } .conv-ref tbody tr:hover td { background: var(--panel-2); } .conv-ref tr.on td { background: var(--accent-soft); color: var(--accent); }
.conv-ref .r { text-align: right; }

/* ---------- history ---------- */
.sb-hist { grid-area: hist; background: var(--panel); border-left: 1px solid var(--line-2); min-height: 0; overflow: hidden; }
.no-hist .sb-hist { display: none; }
.hist { display: flex; flex-direction: column; height: 100%; }
.hist-h { display: flex; align-items: center; gap: 2px; height: 40px; padding: 0 6px 0 12px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.hist-h h2 { flex: 1; margin: 0; font-size: 13px; font-weight: 600; }
.hist-q { margin: 8px 10px 0; height: 30px; border: 1px solid var(--line-2); border-radius: var(--r); padding: 0 8px; }
.hist-b { flex: 1; overflow-y: auto; padding: 4px 0 12px; }
.h-grp { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); padding: 10px 12px 4px; }
.hist ul { list-style: none; margin: 0; padding: 0; }
.hist li { display: flex; align-items: center; gap: 2px; padding-right: 6px; border-bottom: 1px solid var(--line); }
.h-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; border: 0; background: none; padding: 7px 12px; text-align: left; }
.h-main:hover { background: var(--panel-2); }
.h-name { font-size: 12.5px; } .h-ab { font: 500 14px var(--mono); } .h-sub { font: 500 11.5px var(--mono); color: var(--text-3); }
.h-main .solved { color: var(--accent); font-weight: 600; }
.h-run .h-main span { font-size: 11.5px; color: var(--text-3); }

/* ---------- status ---------- */
.sb-status { grid-area: status; display: flex; align-items: center; background: var(--panel-2); border-top: 1px solid var(--line-2); font-size: 11.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; }
.sb-status > span { padding: 0 10px; border-right: 1px solid var(--line); height: 100%; display: inline-flex; align-items: center; }
.sb-status .st-msg { flex: 1; border-right: 0; color: var(--text); }
.sb-status .st-keys { border-right: 0; color: var(--text-3); }

/* ---------- site run (original engine, restyled) ---------- */
.siterun { max-width: 1240px; }
.sr-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 12px; }
.sr-head h2 { margin: 0; font-size: 16px; } .sr-head .btn { margin-left: auto; }
.cl-root { display: grid; grid-template-columns: minmax(0, 1fr) 300px; grid-template-areas: "build side" "profile profile"; border: 1px solid var(--line-2); border-radius: var(--r2); background: var(--panel); overflow: hidden; }
.cl-build { grid-area: build; border-right: 1px solid var(--line-2); display: flex; flex-direction: column; min-width: 0; }
.cl-build-scroll { padding: 12px; display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; }
.cl-card { border: 1px solid var(--line-2); border-radius: var(--r); background: var(--panel); }
.cl-card.start { border-color: var(--text-3); } .cl-card.bad { border-color: var(--err); } .cl-card.dragging { opacity: .5; outline: 2px dashed var(--brand); outline-offset: -2px; }
.cl-card-head { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-bottom: 1px solid var(--line); background: var(--panel-2); border-radius: var(--r) var(--r) 0 0; }
.cl-idx { font: 500 11px var(--mono); color: var(--text-3); min-width: 16px; text-align: center; }
.cl-tag { font: 600 9.5px/1 var(--font); letter-spacing: .06em; padding: 3px 6px; border-radius: 3px; color: #fff; background: var(--text-2); white-space: nowrap; }
.cl-tag.t-start { background: var(--brand); } .cl-tag.t-run.v-ramp { background: var(--accent); }
.cl-tag.t-run.v-landing { background: var(--panel); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.cl-tag.t-target { background: var(--panel); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cl-name { flex: 1; min-width: 0; border: 0; background: none; outline: 0; font-weight: 500; font-size: 12.5px; padding: 3px 2px; border-bottom: 1px dashed transparent; }
.cl-name:focus { border-bottom-color: var(--line-2); }
.cl-card-actions { display: flex; gap: 2px; }
.cl-mini, .cl-drag { width: 24px; height: 24px; border: 1px solid var(--line-2); border-radius: 3px; background: var(--panel); color: var(--text-2); font-size: 11px; display: grid; place-items: center; padding: 0; }
.cl-drag { cursor: grab; touch-action: none; }
.cl-mini:hover:not(:disabled), .cl-drag:hover { border-color: var(--text-3); color: var(--text); }
.cl-mini:disabled { opacity: .3; } .cl-mini.del:hover { background: var(--err); border-color: var(--err); color: #fff; }
.cl-card-body { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; padding: 6px; }
.cl-inp { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cl-inp-l { font-size: 9.5px; letter-spacing: .06em; color: var(--text-3); text-transform: uppercase; }
.cl-inp-box { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 3px; background: var(--panel); }
.cl-inp-box:focus-within { border-color: var(--focus); }
.cl-inp-box input { border: 0; outline: 0; background: none; font: 500 14px var(--mono); padding: 6px; width: 100%; min-width: 0; }
.cl-inp-box i { font-style: normal; font-size: 10.5px; color: var(--text-3); padding-right: 5px; }
.cl-dir { display: flex; border: 1px solid var(--line-2); border-radius: 3px; overflow: hidden; }
.cl-dir button { border: 0; border-right: 1px solid var(--line-2); background: var(--panel); font-size: 10.5px; color: var(--text-3); padding: 6px 8px; }
.cl-dir button:last-child { border-right: 0; } .cl-dir button.on { background: var(--text); color: #fff; }
.cl-end { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; }
.cl-end-k { font-size: 9.5px; color: var(--text-3); letter-spacing: .06em; } .cl-end-v { font: 600 16px var(--mono); color: var(--accent); }
.cl-flags { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 6px 6px; align-items: center; }
.cl-meta { font-size: 10.5px; color: var(--text-3); }
.cl-flag { font-size: 10px; padding: 1px 5px; border-radius: 3px; border: 1px solid; } .cl-flag.ok { color: var(--ok); } .cl-flag.no { color: var(--accent); background: var(--accent-soft); }
.cl-vrow { flex-basis: 100%; display: flex; align-items: center; gap: 6px; }
.cl-vpreset { gap: 0; border: 1px solid var(--line-2); border-radius: 3px; overflow: hidden; }
.cl-vpreset button { flex: 1; border: 0; border-right: 1px solid var(--line-2); background: var(--panel); font-size: 10.5px; color: var(--text-3); padding: 6px 4px; }
.cl-vpreset button:last-child { border-right: 0; } .cl-vpreset button.on { background: var(--accent); color: #fff; }
.cl-vopts { flex-wrap: wrap; } .cl-vlbl { font-size: 9.5px; color: var(--text-3); letter-spacing: .06em; }
.cl-vcall { border: 1px solid var(--line-2); background: var(--panel); font-size: 10.5px; color: var(--text-3); padding: 4px 8px; border-radius: 3px; } .cl-vcall.on { background: var(--text); color: #fff; }
.cl-empty { padding: 20px; text-align: center; font-size: 12.5px; line-height: 1.6; color: var(--text-3); display: flex; flex-direction: column; gap: 4px; }
.cl-empty strong { color: var(--text); font-size: 13.5px; } .cl-empty em { font-style: normal; color: var(--accent); } .cl-empty-arrow { font-size: 11px; letter-spacing: .1em; color: var(--accent); font-weight: 600; }
.cl-total { display: flex; align-items: baseline; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--line); background: var(--panel-2); }
.cl-total-k { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); } .cl-total-v { font: 600 18px var(--mono); color: var(--accent); } .cl-total-sub { margin-left: auto; font-size: 11px; color: var(--text-3); }
.cl-palette { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--line); }
.cl-pal-l { font-size: 10.5px; color: var(--text-3); letter-spacing: .08em; margin-right: 2px; }
.cl-palette button { border: 1px solid var(--line-2); background: var(--panel); border-radius: var(--r); font-size: 12px; padding: 4px 8px; }
.cl-palette button:hover { border-color: var(--brand); color: var(--accent); }
.cl-side { grid-area: side; display: flex; flex-direction: column; min-width: 0; }
.cl-sum { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; border-bottom: 1px solid var(--line); }
.cl-sum-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 11.5px; color: var(--text-3); letter-spacing: .04em; }
.cl-sum-row b { font: 600 17px var(--mono); color: var(--text); } .cl-sum-row.hi b { color: var(--accent); }
.cl-sched { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.cl-sched-head { display: flex; justify-content: space-between; padding: 8px 14px; font-size: 10.5px; letter-spacing: .08em; color: var(--text-3); text-transform: uppercase; border-bottom: 1px solid var(--line); }
.cl-sched-list { overflow-y: auto; max-height: 34vh; }
.cl-sched-row { display: grid; grid-template-columns: 20px 1fr auto; gap: 2px 8px; align-items: baseline; padding: 6px 14px; border-bottom: 1px solid var(--line); font-size: 12px; }
.cl-sched-row.tgt { background: var(--accent-soft); }
.cl-sched-i { font-size: 10px; color: var(--text-3); } .cl-sched-n { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-sched-st { grid-column: 2; font: 500 10.5px var(--mono); color: var(--text-3); } .cl-sched-e { grid-row: 1 / span 2; grid-column: 3; align-self: center; font: 600 13px var(--mono); }
.cl-sched-empty { padding: 14px; text-align: center; color: var(--text-3); }
.cl-side-actions { display: flex; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--line); }
.cl-side-actions .iconbtn { flex: 1; height: 30px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--panel); font-size: 12px; }
.cl-side-actions .iconbtn:hover:not(:disabled) { border-color: var(--text-3); } .cl-side-actions .iconbtn:disabled { opacity: .4; }
.cl-profile { grid-area: profile; border-top: 1px solid var(--line-2); padding: 6px 10px 10px; }
.cl-profile svg { width: 100%; height: auto; max-height: 44vh; display: block; }

/* ---------- print ---------- */
#print-root { display: none; }
@media print {
  html, body { overflow: visible !important; height: auto !important; background: #fff; }
  #root { display: none !important; } #print-root { display: block !important; }
  @page { margin: 14mm; }
}
.ps { font: 10pt/1.4 var(--font); color: #111; }
.ps header { display: flex; justify-content: space-between; border-bottom: 2px solid #111; padding-bottom: 6px; margin-bottom: 10px; font-size: 12pt; }
.ps header span { font-size: 9pt; color: #666; }
.ps table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 9.5pt; }
.ps th, .ps td { text-align: left; padding: 4px 6px; border-bottom: 1px solid #ddd; }
.ps th { font-family: var(--font); font-size: 8.5pt; color: #666; }
.ps footer { margin-top: 12px; font-size: 8.5pt; color: #666; }

/* ---------- tablet ---------- */
@media (max-width: 1180px) { .grade { grid-template-columns: minmax(280px, 380px) minmax(300px, 1fr); gap: 18px; } .sb-job input { width: 140px; } .res-num .n { font-size: 44px; } }
@media (max-width: 1080px) { .sb, .sb.no-hist { grid-template-columns: 212px minmax(0, 1fr) 0; } .sb-hist { display: none; } .sb-hist.sheet-open { display: block; } .convert { grid-template-columns: 1fr; } }

/* ---------- phone / narrow: field-first layout ---------- */
@media (max-width: 899px) {
  .sb, .sb.no-hist { grid-template-columns: minmax(0, 1fr); grid-template-rows: 48px 42px minmax(0, 1fr) 0; grid-template-areas: "top" "tabs" "main" "status"; }
  .sb-rail, .sb-status, .sb-sub, .sb-job, .st-keys { display: none; }
  .sb-top { gap: 8px; padding: 0 6px 0 10px; }
  .seg .l { display: none; } .seg .s { display: inline; }
  .sb-tabs { display: flex; background: var(--panel); border-bottom: 1px solid var(--line-2); }
  .sb-tabs button { flex: 1; border: 0; background: none; font-weight: 600; font-size: 13.5px; color: var(--text-2); border-bottom: 2px solid transparent; }
  .sb-tabs button.on { color: var(--accent); border-bottom-color: var(--brand); }
  .sb-main { padding: 0 12px 24px; }
  .grade { display: flex; flex-direction: column; gap: 0; align-items: stretch; }
  .result { display: contents; }
  .res-main { order: -1; position: sticky; top: 0; z-index: 5; background: var(--bg); margin: 0 -12px 10px; padding: 10px 14px 10px; border-bottom: 1px solid var(--line-2); box-shadow: 0 6px 12px -10px rgba(16, 24, 40, .35); }
  .res-num .n { font-size: 40px; } .res-eq { font-size: 12px; } .res-empty { min-height: 0; font-size: 13.5px; margin: 6px 0 2px; }
  .inputs { order: 0; }
  .diag, .res-grid, .inter { order: 1; }
  .res-grid { margin-top: 14px; }
  .fld-box { height: 46px; } .fld-box input { font-size: 18px; }
  .acts .btn { height: 40px; flex: 1; justify-content: center; }
  .chips button { padding: 5px 10px; font-size: 13px; }
  .dir button { padding: 7px 12px; }
  .convert { gap: 18px; padding-top: 12px; }
  .siterun { padding-top: 12px; }
  .cl-root { grid-template-columns: 1fr; grid-template-areas: "build" "side" "profile"; }
  .cl-build { border-right: 0; border-bottom: 1px solid var(--line-2); }
  .cl-build-scroll { max-height: none; }
  .sb-hist, .sb-hist.sheet-open { display: block; position: fixed; left: 0; right: 0; bottom: 0; height: 70dvh; z-index: 40; border: 0; border-top: 1px solid var(--line-2); border-radius: 12px 12px 0 0; box-shadow: 0 -10px 30px rgba(16, 24, 40, .2); transform: translateY(105%); transition: transform .2s ease; }
  .sb-hist.sheet-open { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 39; background: rgba(16, 24, 40, .3); }
  .h-main { padding: 10px 14px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
