:root {
  --ink: #0e1a2b; --ink2: #16263c; --ink3: #223651; --gold: #f2b705; --gold-d: #b98600; --teal: #12a594; --red: #d13b3b; --green: #1f8a5b; --blue: #2d6cdf;
  --bg: #f3f5f8; --card: #fff; --line: #dfe4ec; --text: #17212f; --mut: #5d6b7e; --r: 10px; --sh: 0 1px 2px rgba(14,26,43,.06), 0 6px 20px rgba(14,26,43,.05);
  --sans: 'IBM Plex Sans', system-ui, sans-serif; --head: 'Barlow Semi Condensed', 'IBM Plex Sans', sans-serif; --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.5 var(--sans); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--head); line-height: 1.15; margin: 0; letter-spacing: .1px; }
h1 { font-size: 30px; } h2 { font-size: 21px; } h3 { font-size: 17px; }
a { color: var(--blue); }
code, .mono { font-family: var(--mono); }
.mut { color: var(--mut); } .small { font-size: 13px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; padding: 7px 13px; border-radius: 8px; cursor: pointer; font-weight: 500; white-space: nowrap; transition: .12s; text-decoration: none; color: var(--text); }
.btn:hover { border-color: #b8c2d1; background: #fafbfc; }
.btn.pri { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.pri:hover { background: var(--ink3); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--ink); font-weight: 600; }
.btn.gold:hover { background: #ffc81f; }
.btn.danger { color: var(--red); border-color: #efc4c4; }
.btn.sm { padding: 4px 9px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* layout */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #cfd8e6; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; gap: 10px; align-items: center; padding: 2px 8px 16px; color: #fff; }
.brand svg { flex: none; } .brand b { font: 700 18px/1.05 var(--head); display: block; } .brand span { font-size: 11.5px; color: #8fa1ba; letter-spacing: .4px; }
.nav { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: inherit; text-decoration: none; }
.nav:hover { background: var(--ink2); color: #fff; }
.nav.on { background: var(--ink3); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.side .grow { flex: 1; }
.who { border-top: 1px solid var(--ink3); padding: 12px 8px 2px; margin-top: 8px; font-size: 13px; }
.who b { display: block; color: #fff; } .who a { color: #9fb0c8; cursor: pointer; text-decoration: none; margin-right: 12px; }
.who a:hover { color: #fff; }
.main { padding: 26px 30px 60px; min-width: 0; max-width: 1280px; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.top p { margin: 3px 0 0; color: var(--mut); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--sh); }
.card + .card { margin-top: 14px; } .grid .card + .card { margin-top: 0; }
.tile { padding: 14px 16px; } .tile b { font: 700 30px/1 var(--head); display: block; margin-bottom: 4px; } .tile.warn { border-color: #f1d48a; background: #fffaf0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 16px; overflow-x: auto; }
.tabs a, .tabs button { background: none; border: 0; padding: 9px 14px; cursor: pointer; color: var(--mut); border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs .on { color: var(--text); font-weight: 600; border-bottom-color: var(--gold-d); }

/* tables and forms */
.tw { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--mut); padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 8px 10px; border-bottom: 1px solid #edf0f4; vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover { background: #fafbfd; }
label.f { display: block; margin-bottom: 12px; font-weight: 500; font-size: 13.5px; }
label.f small { display: block; font-weight: 400; color: var(--mut); }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; border: 1px solid #cfd6e0; border-radius: 8px; padding: 8px 10px; background: #fff; font-weight: 400; margin-top: 3px; }
textarea { resize: vertical; min-height: 92px; }
.f2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 14px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin-bottom: 7px; cursor: pointer; } .check input { margin-top: 4px; }
.pick { max-height: 210px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 500; background: #e8edf4; color: #3e4c60; white-space: nowrap; }
.chip.ok { background: #dcf3e8; color: #14704a; } .chip.go { background: #fff1c9; color: #7d5a00; } .chip.bad { background: #fbe1e1; color: #a12a2a; } .chip.info { background: #dfe9fb; color: #1e4fa8; }
.empty { text-align: center; color: var(--mut); padding: 34px 12px; }
.note { background: #fffaf0; border: 1px solid #f1d48a; border-radius: 8px; padding: 9px 12px; font-size: 14px; }
.spin { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--gold-d); border-radius: 50%; animation: sp .8s linear infinite; margin: 50px auto; }
@keyframes sp { to { transform: rotate(360deg); } }
.bar { height: 7px; background: #e6ebf2; border-radius: 9px; overflow: hidden; display: flex; } .bar i { display: block; height: 100%; }

/* modal, toast */
#modal .bg { position: fixed; inset: 0; background: rgba(14,26,43,.5); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow: auto; }
#modal .box { background: #fff; border-radius: 12px; width: min(640px, 100%); padding: 20px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
#modal .box.wide { width: min(980px, 100%); }
#modal .box h2 { margin-bottom: 12px; }
.acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; max-width: 360px; box-shadow: 0 6px 20px rgba(0,0,0,.25); font-size: 14px; }
.toast.bad { background: #a12a2a; }

/* sign-in */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; background: var(--ink); }
.hero { position: relative; overflow: hidden; color: #fff; padding: 56px 60px; display: flex; flex-direction: column; justify-content: space-between; background: radial-gradient(1100px 600px at 20% 10%, #1d3350 0%, var(--ink) 60%); }
.hero h1 { font-size: 54px; max-width: 12ch; line-height: 1.02; } .hero p { color: #b9c6d8; max-width: 44ch; font-size: 16px; }
.hero .scope { position: absolute; left: 0; right: 0; top: 150px; height: 200px; opacity: .9; }
.hero .scope path { fill: none; stroke: var(--gold); stroke-width: 2; filter: drop-shadow(0 0 6px rgba(242,183,5,.7)); stroke-dasharray: 1400; animation: trace 5s linear infinite; }
.hero .scope path.b { stroke: var(--teal); filter: drop-shadow(0 0 6px rgba(18,165,148,.7)); animation-delay: -2.2s; }
.hero .scope line { stroke: rgba(255,255,255,.07); }
@keyframes trace { from { stroke-dashoffset: 1400; } to { stroke-dashoffset: -1400; } }
@media (prefers-reduced-motion: reduce) { .hero .scope path { animation: none; stroke-dasharray: none; } }
.signin { background: #fff; display: flex; align-items: center; justify-content: center; padding: 40px; }
.signin form { width: min(360px, 100%); }
.signin h2 { font-size: 28px; margin-bottom: 4px; }

/* lab cards */
.lab { display: flex; flex-direction: column; gap: 8px; border-left: 4px solid var(--line); }
.lab.open { border-left-color: var(--gold); } .lab.done { border-left-color: var(--green); } .lab.shut { border-left-color: #b9c3d0; }
.lab h3 { font-size: 18px; }

/* workspace */
.ws { display: flex; flex-direction: column; height: 100vh; background: var(--ink); }
.station { display: flex; align-items: center; gap: 16px; padding: 7px 14px; color: #c7d2e1; font-size: 13px; background: linear-gradient(#17283f, #101d2f); border-bottom: 1px solid #000; flex-wrap: wrap; }
.station b { color: #fff; font: 600 16px/1.1 var(--head); }
.station .plate { font: 600 12px var(--mono); color: var(--ink); background: linear-gradient(#e7ecf3, #bcc6d4); padding: 3px 8px; border-radius: 3px; box-shadow: inset 0 0 0 1px #8896a8; letter-spacing: .5px; }
.led { display: inline-flex; align-items: center; gap: 6px; font: 500 12px var(--mono); }
.led i { width: 10px; height: 10px; border-radius: 50%; background: #3c4a5c; box-shadow: inset 0 1px 2px rgba(0,0,0,.6); }
.led.on i { background: #ff4a3d; box-shadow: 0 0 8px #ff4a3d; } .led.ok i { background: #36d399; box-shadow: 0 0 6px #36d399; }
.clock { font: 600 19px var(--mono); color: #7dffb0; background: #06110c; padding: 2px 10px; border-radius: 4px; box-shadow: inset 0 0 0 1px #1f3a2c; letter-spacing: 1px; }
.clock.low { color: #ff8b7e; }
.station .sp { flex: 1; }
.wtabs { display: flex; background: #101d2f; padding: 0 8px; gap: 2px; overflow-x: auto; }
.wtabs button { background: none; border: 0; color: #9fb0c8; padding: 8px 14px; cursor: pointer; border-radius: 7px 7px 0 0; white-space: nowrap; }
.wtabs button:hover { color: #fff; } .wtabs button.on { background: var(--bg); color: var(--text); font-weight: 600; }
.wbody { flex: 1; position: relative; min-height: 0; background: var(--bg); }
.pane { position: absolute; inset: 0; overflow: auto; padding: 20px 24px 40px; }
.pane.off { visibility: hidden; pointer-events: none; }
.pane.bench { padding: 0; overflow: hidden; }
.pane.bench iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.narrow { max-width: 900px; margin: 0 auto; }
.docf { width: 100%; border: 0; display: block; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
table.sheet { border-collapse: collapse; font-size: 14px; min-width: 60%; }
.sheet th { background: #eef2f7; border: 1px solid #cfd6e0; padding: 6px 8px; font-weight: 600; text-align: left; }
.sheet td { border: 1px solid #cfd6e0; padding: 0; } .sheet td.lbl { padding: 6px 8px; background: #fafbfd; }
.sheet input { border: 0; border-radius: 0; margin: 0; padding: 6px 8px; font-family: var(--mono); min-width: 84px; background: transparent; }
.sheet input:focus { background: #fff8df; outline: none; }
.cap td.pick1 { cursor: copy; } .cap td.pick1:hover { background: #fff1c9; }
.plotbox svg { width: 100%; height: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; }

/* full screen bench */
.pane.bench.vlfs { position: fixed !important; inset: 0; width: auto; height: auto !important; z-index: 45; visibility: visible; pointer-events: auto; }
.fsbar { position: fixed; top: 6px; right: 10px; z-index: 55; display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 8px; color: #c7d2e1; background: rgba(14,26,43,.92); box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.fsbar .clock { font-size: 15px; padding: 1px 7px; }
.owner { font-size: 12px; color: var(--mut); margin: 14px 0 0; }
.owner.dark { color: #8fa1ba; margin-top: 10px; line-height: 1.35; }

/* report */
.report { background: #fff; max-width: 860px; margin: 0 auto; padding: 36px 44px; box-shadow: var(--sh); border-radius: 6px; }
.report h1 { font-size: 26px; } .report h2 { margin: 26px 0 8px; padding-bottom: 4px; border-bottom: 2px solid var(--ink); font-size: 19px; }
.report table.kv td { padding: 2px 16px 2px 0; } .report table.kv td:first-child { color: var(--mut); }
.report img { max-width: 100%; border: 1px solid var(--line); }
.report pre { white-space: pre-wrap; font: inherit; margin: 0; }
.report table.sheet { width: 100%; } .report .sheet td { padding: 5px 8px; font-family: var(--mono); font-size: 13px; }
.cols { column-count: 2; column-gap: 26px; font-family: var(--mono); font-size: 12.5px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px; } .brand { padding: 0 8px; width: 100%; } .side .grow { display: none; } .who { width: 100%; border: 0; padding: 6px 8px; margin: 0; }
  .main { padding: 16px; } .login { grid-template-columns: 1fr; } .hero { padding: 28px 22px; min-height: 240px; } .hero h1 { font-size: 36px; } .hero .scope { display: none; } .grid2 { grid-template-columns: 1fr; } .report { padding: 20px; }
  .ws { height: auto; min-height: 100vh; } .pane { position: static; } .pane.off { display: none; } .pane.bench { height: 80vh; } .wbody { overflow: visible; }
}
@media print {
  .side, .noprint, #toasts, #modal { display: none !important; } .shell { display: block; } .main { padding: 0; max-width: none; } body { background: #fff; } .report { box-shadow: none; max-width: none; padding: 0; }
  .report h2 { break-after: avoid; } table, img, svg { break-inside: avoid; }
}
