:root {
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a;
  --bg: #f6f7f9; --card: #ffffff; --ink: #1c2330; --muted: #5e6878; --line: #dfe3ea; --soft: #eef1f5;
  --accent: #2f6fdf; --accent-ink: #ffffff; --ok: #1f8a4c; --warn: #b26a00; --err: #c62f2f;
  --ap1: #2f6fdf; --ap2: #1f9d74; --univ: #c94a4a; --resv: #9aa3b0; --nbr: #d39b2a;
  --ok-bg: #e5f4ec; --warn-bg: #fdf1dc; --err-bg: #fbe4e4; --note-bg: #e8effc;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161d; --card: #1a2029; --ink: #e5e9f0; --muted: #9aa4b4; --line: #2c3442; --soft: #222a35;
    --accent: #5b8ef0; --accent-ink: #0d1117; --ok: #46c27f; --warn: #e3a23c; --err: #f06c6c;
    --ap1: #5b8ef0; --ap2: #3fc99a; --univ: #e06b6b; --resv: #5c6573; --nbr: #e0b04e;
    --ok-bg: #173325; --warn-bg: #3a2c12; --err-bg: #3d1c1c; --note-bg: #1c2a44;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70;
  }
}
:root[data-theme="dark"] {
  --bg: #12161d; --card: #1a2029; --ink: #e5e9f0; --muted: #9aa4b4; --line: #2c3442; --soft: #222a35;
  --accent: #5b8ef0; --accent-ink: #0d1117; --ok: #46c27f; --warn: #e3a23c; --err: #f06c6c;
  --ap1: #5b8ef0; --ap2: #3fc99a; --univ: #e06b6b; --resv: #5c6573; --nbr: #e0b04e;
  --ok-bg: #173325; --warn-bg: #3a2c12; --err-bg: #3d1c1c; --note-bg: #1c2a44;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
.hidden { display: none !important; }
h1 { font-size: 20px; margin: 0 0 6px; } h2 { font-size: 16px; margin: 0 0 10px; } h3 { font-size: 14px; margin: 14px 0 6px; }
a { color: var(--accent); }
.muted { color: var(--muted); } .small { font-size: 12px; } .mono { font-family: var(--mono); font-size: 12px; }
.err { color: var(--err); } .okc { color: var(--ok); } .warnc { color: var(--warn); }
.top { display: flex; align-items: center; gap: 16px; padding: 8px 16px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { font-weight: 650; }
nav { display: flex; gap: 2px; flex-wrap: wrap; }
nav button { background: none; border: 0; padding: 7px 11px; border-radius: 6px; color: var(--muted); cursor: pointer; font: inherit; }
nav button.on { background: var(--soft); color: var(--ink); font-weight: 600; }
.who { margin-left: auto; color: var(--muted); font-size: 13px; }
main { padding: 16px; max-width: 1400px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.cols { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 420px; align-items: start; }
@media (max-width: 1000px) { .cols { grid-template-columns: minmax(0, 1fr); } .sticky { position: static !important; max-height: none; } }
.sticky { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow: auto; }
label { display: block; margin: 6px 0; } label > input, label > select, label > textarea { display: block; margin-top: 3px; }
label > input[type=checkbox], label > input[type=radio] { display: inline; margin-top: 0; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; max-width: 100%; }
input[type=number] { width: 90px; } input[type=checkbox] { margin-right: 6px; }
textarea { width: 100%; font-family: var(--mono); font-size: 12px; }
button { background: var(--soft); border: 1px solid var(--line); border-radius: 6px; padding: 5px 11px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.link { background: none; border: 0; color: var(--accent); padding: 0 4px; }
button.danger { color: var(--err); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > label { margin: 0; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; background: var(--soft); color: var(--muted); }
.pill.running { background: var(--note-bg); color: var(--accent); } .pill.done { background: var(--ok-bg); color: var(--ok); }
.pill.failed { background: var(--err-bg); color: var(--err); } .pill.queued, .pill.held { background: var(--soft); }
.pill.cancelled { background: var(--soft); color: var(--muted); text-decoration: line-through; }
.msg { border-radius: 8px; padding: 8px 10px; margin: 6px 0; }
.msg.err { background: var(--err-bg); } .msg.warn { background: var(--warn-bg); color: var(--ink); }
.msg.note { background: var(--note-bg); } .msg.ok { background: var(--ok-bg); }
.msg ul { margin: 2px 0 0 18px; padding: 0; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 2px 10px; }
.kv > div:nth-child(odd) { color: var(--muted); }
.devrow { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 6px 0; }
.devrow.on { border-color: var(--accent); }
.devrow .hd { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.devrow .hd select { width: 260px; max-width: 100%; }
.devrow .opts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.devrow .opts label { margin: 0; font-size: 12px; color: var(--muted); }
.phases td input { width: 70px; }
.progress { height: 6px; background: var(--soft); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.progress > div { height: 100%; background: var(--accent); }
.bar { height: 10px; background: var(--accent); border-radius: 3px; display: inline-block; vertical-align: middle; }
pre.log { background: var(--soft); padding: 10px; border-radius: 8px; max-height: 420px; overflow: auto; font-size: 11.5px; white-space: pre-wrap; }
.chanstrip { display: flex; gap: 2px; flex-wrap: wrap; margin: 8px 0; }
.chan { width: 34px; text-align: center; border-radius: 4px; padding: 3px 0 2px; font-size: 11px; border: 1px solid var(--line); background: var(--card); }
.chan .lab { display: block; font-size: 9px; color: var(--muted); min-height: 11px; }
.chan.univ { background: var(--err-bg); border-color: var(--univ); }
.chan.resv { background: var(--soft); color: var(--muted); }
.chan.nbr { border-color: var(--nbr); }
.chan.ap1 { box-shadow: inset 0 -4px 0 var(--ap1); } .chan.ap2 { box-shadow: inset 0 -4px 0 var(--ap2); }
.chan.ap1.ap2 { box-shadow: inset 0 -4px 0 var(--ap1), inset 0 -8px 0 var(--ap2); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; border: 1px solid var(--line); }
.timeline { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.tl-row { position: relative; height: 34px; border-bottom: 1px solid var(--line); }
.tl-row:last-child { border-bottom: 0; }
.tl-name { position: absolute; left: 6px; top: 8px; font-size: 12px; color: var(--muted); z-index: 2; }
.tl-block { position: absolute; top: 5px; height: 24px; border-radius: 5px; font-size: 11px; padding: 4px 6px; overflow: hidden; white-space: nowrap;
  color: #fff; }
.tl-block.mine { outline: 2px solid var(--ink); }
.tl-hour { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--line); font-size: 10px; color: var(--muted); padding-left: 2px; }
.tl-axis { position: relative; height: 18px; }
.tl-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--err); z-index: 3; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; cursor: pointer; user-select: none; background: var(--card); }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip input { display: none; }
.help { font-size: 12px; color: var(--muted); margin: 2px 0 6px; }
.knob { display: grid; grid-template-columns: 170px 150px 1fr; gap: 8px; align-items: center; padding: 3px 0; }
@media (max-width: 640px) { .knob { grid-template-columns: 1fr; } .kv { grid-template-columns: 1fr; } main { padding: 10px 16px; } }
.login { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); padding: 16px; }
.login-card { width: 360px; max-width: 100%; }
.login-card input { width: 100%; }
.kpi { display: inline-block; min-width: 110px; margin: 0 14px 8px 0; }
.kpi b { display: block; font-size: 20px; }
details > summary { cursor: pointer; color: var(--accent); margin: 6px 0; }

.who { margin-left: 0; }
.guide { margin-left: auto; }
.group { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
.group.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.group .opts { display: flex; gap: 10px; flex-wrap: wrap; }
.group .opts label { margin: 0; font-size: 12px; color: var(--muted); }
.chip.dev { display: inline-flex; gap: 6px; align-items: center; font: inherit; }
.chip.dev.muted { opacity: .55; }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
table.edca td, table.edca th { padding: 3px 5px; }
table.edca td.changed select, table.edca td.changed input { border-color: var(--warn); background: var(--warn-bg); }
.charts { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin: 8px 0; }
.chartbox { margin: 0; }
.charthead { margin-bottom: 4px; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart .axis { stroke: var(--resv); stroke-width: 1; }
svg.chart .tick { fill: var(--muted); font-size: 14px; }
.tip { position: fixed; z-index: 50; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px;
  font-size: 12px; pointer-events: none; display: none; box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.tiprow { display: flex; gap: 6px; align-items: center; }
.tip .key { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.tour { position: fixed; right: 20px; bottom: 20px; z-index: 40; max-width: 420px; }
.tour.left { right: auto; left: 20px; }
.tour.center { inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.35); max-width: none; padding: 16px; }
.tour-card { background: var(--card); border: 1px solid var(--accent); border-radius: 10px; padding: 14px 16px; max-width: 460px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.tour-card p { margin: 6px 0; }
.tour-target { position: relative; z-index: 30; outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 10px; }
@media (max-width: 640px) { .tour { left: 10px; right: 10px; bottom: 10px; } }

label.chip > input[type=checkbox], label.chip > input[type=radio] { display: none; }

.cols > *, .card { min-width: 0; }
select, input:not([type=checkbox]):not([type=radio]) { max-width: 100%; }
.card p, .help { overflow-wrap: anywhere; }
.armrow { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin: 6px 0; }
.armno { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 600; flex: none; }
optgroup { font-weight: 600; }
