:root {
  --bg: #060a13;
  --bg-2: #0a1020;
  --panel: #0e1526;
  --panel-2: #121b30;
  --panel-3: #18233d;
  --line: #1f2b46;
  --line-2: #2a3a5c;
  --text: #e8eef8;
  --muted: #93a3bf;
  --dim: #5f6f8d;
  --accent: #facc15;
  --accent-ink: #1a1400;
  --run: #22c55e;
  --idle: #64748b;
  --planned: #3b82f6;
  --down: #ef4444;
  --warn: #f59e0b;
  --good: #22c55e;
  --info: #38bdf8;
  --l0: #38bdf8; --l1: #a78bfa; --l2: #fb923c; --l3: #f472b6;
  --radius: 12px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 700px at 30% -10%, #12204a 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-rows: auto 1fr 30px; height: 100vh; }
.main { display: grid; grid-template-columns: minmax(0, 1fr) 420px; min-height: 0; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 10px 18px; white-space: nowrap;
  background: linear-gradient(180deg, rgba(18, 27, 48, .95), rgba(10, 16, 32, .95));
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  position: relative; z-index: 5;
}
.topbar::after { /* hazard stripe */
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 3px;
  background: repeating-linear-gradient(135deg, var(--accent) 0 10px, #111 10px 20px); opacity: .55;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(145deg, #1b2747, #0c1324); border: 1px solid var(--line-2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 0 18px rgba(250, 204, 21, .18);
}
.brand-mark svg { width: 24px; height: 24px; fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.brand-title { font-weight: 800; letter-spacing: .2px; font-size: 15px; }
.brand-sub { color: var(--dim); font-size: 11.5px; }

.clock-block { display: flex; align-items: center; gap: 12px; padding: 4px 14px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.clock-time { font: 700 30px/1 var(--mono); letter-spacing: 1px; color: #fff; text-shadow: 0 0 18px rgba(56, 189, 248, .35); min-width: 98px; }
.clock-meta { display: grid; gap: 5px; min-width: 130px; }
.clock-bar { height: 6px; background: var(--panel-3); border-radius: 99px; overflow: hidden; }
.clock-bar > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--info), var(--accent)); border-radius: 99px; }
.clock-sub { font-size: 11.5px; color: var(--muted); }

.stat { display: grid; gap: 4px; min-width: 104px; }
.stat:empty { display: none; }
.stat-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.1px; color: var(--dim); font-weight: 700; }
.stat-value { font: 700 18px/1 var(--mono); }
.stat-value small { color: var(--dim); font-weight: 500; font-size: 12px; }
.meter { height: 5px; background: var(--panel-3); border-radius: 99px; overflow: hidden; position: relative; }
.meter > div { height: 100%; border-radius: 99px; background: var(--run); transition: width .3s; }
.meter .tick { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #fff; opacity: .6; }

.priorities { margin-left: auto; display: flex; align-items: center; gap: 5px; }
.prio-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.1px; color: var(--dim); font-weight: 700; margin-right: 2px; }
.prio { font-size: 11.5px; font-weight: 700; padding: 4px 8px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--panel-2); white-space: nowrap; }
.p-safety { color: #fca5a5; border-color: rgba(239, 68, 68, .45); background: rgba(239, 68, 68, .1); }
.p-quality { color: #7dd3fc; }
.p-delivery { color: #fde68a; }
.p-cost { color: var(--muted); }
.prio.flash { animation: flash 1.2s ease 3; }
@keyframes flash { 50% { box-shadow: 0 0 0 3px rgba(250, 204, 21, .5); } }

.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: var(--panel-3); }
.icon-btn svg { width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- floor ---------- */
.floor { position: relative; min-width: 0; min-height: 0; }
.floor canvas { position: absolute; inset: 0; display: block; cursor: default; }
.legend { position: absolute; left: 16px; bottom: 12px; display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); background: rgba(8, 12, 24, .7); padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); backdrop-filter: blur(6px); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.run { background: var(--run); box-shadow: 0 0 8px var(--run); }
.dot.idle { background: var(--idle); }
.dot.planned { background: var(--planned); box-shadow: 0 0 8px var(--planned); }
.dot.down { background: var(--down); box-shadow: 0 0 8px var(--down); }

.techbar {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; padding: 8px 16px 8px 10px;
  background: rgba(10, 16, 32, .86); border: 1px solid var(--line-2); border-radius: 99px;
  backdrop-filter: blur(8px); box-shadow: 0 12px 30px rgba(0, 0, 0, .4); font-size: 13px; white-space: nowrap;
}
.techbar .avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 11px; box-shadow: 0 0 14px rgba(250, 204, 21, .45); }
.techbar .what { color: var(--text); font-weight: 600; }
.techbar .sub { color: var(--muted); }
.techbar .mini { width: 90px; height: 5px; background: var(--panel-3); border-radius: 99px; overflow: hidden; }
.techbar .mini > div { height: 100%; background: var(--accent); }
.techbar.idle { border-color: rgba(245, 158, 11, .6); }
.techbar.idle .avatar { animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(250, 204, 21, .15); } }

.toasts { position: absolute; right: 16px; bottom: 14px; display: flex; flex-direction: column-reverse; gap: 8px; width: min(340px, 60%); pointer-events: none; }
.toast {
  pointer-events: auto; padding: 10px 14px 10px 12px; border-radius: 12px; font-size: 13px;
  background: rgba(14, 21, 38, .95); border: 1px solid var(--line-2); border-left: 4px solid var(--info);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .45); animation: toastIn .25s ease; display: flex; gap: 10px; align-items: flex-start;
}
.toast b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 2px; }
.toast.bad { border-left-color: var(--down); } .toast.bad b { color: #fca5a5; }
.toast.warn { border-left-color: var(--warn); } .toast.warn b { color: #fcd34d; }
.toast.good { border-left-color: var(--good); } .toast.good b { color: #86efac; }
.toast.hint { border-left-color: var(--accent); background: linear-gradient(135deg, rgba(40, 33, 5, .96), rgba(14, 21, 38, .96)); }
.toast.hint b { color: var(--accent); }
.toast.out { animation: toastOut .3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* ---------- side panel ---------- */
.side { display: flex; flex-direction: column; min-height: 0; background: linear-gradient(180deg, var(--bg-2), var(--bg)); border-left: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); }
.tab { flex: 1; padding: 9px 8px 10px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 650; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; font-size: 11px; display: inline-grid; place-items: center; background: var(--panel-3); color: var(--muted); font-weight: 700; }
.badge:empty { display: none; }
.badge.hot { background: var(--down); color: #fff; animation: pulse 1.4s infinite; }
.tabbody { flex: 1; overflow-y: auto; padding: 12px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

/* job card */
#jobcard:empty { display: none; }
.job {
  margin: 12px 12px 0; padding: 14px; border-radius: var(--radius);
  background: linear-gradient(160deg, #15203a, #0f172b); border: 1px solid var(--line-2);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255,255,255,.04);
}
.job.deciding { border-color: rgba(250, 204, 21, .65); box-shadow: 0 0 0 1px rgba(250, 204, 21, .25), 0 10px 28px rgba(0, 0, 0, .35); }
.job-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.job-head .title { font-weight: 750; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-steps { display: flex; gap: 4px; margin: 6px 0 10px; }
.job-steps span { flex: 1; height: 4px; border-radius: 99px; background: var(--panel-3); }
.job-steps span.done { background: var(--run); }
.job-steps span.now { background: var(--accent); box-shadow: 0 0 8px rgba(250, 204, 21, .6); }
.job-now { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.job-now strong { color: var(--text); }
.bar { height: 8px; background: var(--panel-3); border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; background: linear-gradient(90deg, var(--accent), #fde68a); border-radius: 99px; }
.decide-q { font-weight: 700; margin: 2px 0 8px; font-size: 14px; }
.decide-timer { font: 600 12px var(--mono); color: var(--accent); display: inline-flex; align-items: center; gap: 6px; }
.decide-timer::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite; }
.evidence { background: rgba(0, 0, 0, .22); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; font-size: 12.5px; display: grid; gap: 6px; }
.evidence .k { color: var(--dim); font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.evidence .alarm { font-family: var(--mono); color: #fca5a5; }
.evidence .found { color: #86efac; }
.choices { display: grid; gap: 6px; }
.choice {
  text-align: left; padding: 10px 12px; border-radius: 10px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; transition: background .12s, border-color .12s, transform .06s;
}
.choice:hover:not([disabled]) { background: var(--panel-3); border-color: #3b4f7a; }
.choice:active:not([disabled]) { transform: scale(.99); }
.choice[disabled] { opacity: .38; cursor: not-allowed; text-decoration: line-through; }
.choice .c-main { flex: 1; }
.choice .c-title { font-weight: 650; display: block; }
.choice .c-sub { font-size: 12px; color: var(--muted); display: block; }
.choice .c-cost { font: 600 12px var(--mono); color: var(--muted); white-space: nowrap; }
.choice.primary { border-color: rgba(34, 197, 94, .55); background: linear-gradient(160deg, rgba(34, 197, 94, .14), rgba(34, 197, 94, .04)); }
.choice.danger { border-color: rgba(239, 68, 68, .45); }
.choice.danger .c-title { color: #fecaca; }
.choice.best { border-color: rgba(34, 197, 94, .7); }
.job-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 12px; color: var(--dim); }
.link-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px 4px; border-radius: 6px; font-size: 12px; }
.link-btn:hover { color: var(--text); background: var(--panel-3); }

/* work orders */
.section-h { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--dim); font-weight: 750; }
.wo {
  display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center;
  padding: 10px 12px; margin-bottom: 7px; border-radius: 11px; background: var(--panel); border: 1px solid var(--line);
  cursor: pointer; transition: border-color .12s, background .12s; position: relative; overflow: hidden;
}
.wo:hover { border-color: var(--line-2); background: var(--panel-2); }
.wo.active { border-color: rgba(250, 204, 21, .6); background: linear-gradient(160deg, rgba(250, 204, 21, .08), var(--panel)); }
.wo.waiting { opacity: .7; }
.wo::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--line-2); }
.wo.p1::before { background: var(--down); }
.wo.p2::before { background: var(--warn); }
.wo.p3::before { background: var(--info); }
.wo.p4::before { background: var(--dim); }
.pri { font: 800 11px var(--mono); padding: 3px 6px; border-radius: 6px; background: var(--panel-3); color: var(--muted); }
.p1 .pri { background: rgba(239, 68, 68, .18); color: #fca5a5; }
.p2 .pri { background: rgba(245, 158, 11, .16); color: #fcd34d; }
.p3 .pri { background: rgba(56, 189, 248, .12); color: #7dd3fc; }
.wo-title { font-weight: 650; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wo-meta { grid-column: 2 / 4; font-size: 11.5px; color: var(--dim); display: flex; gap: 10px; flex-wrap: wrap; }
.wo-meta .hot { color: #fca5a5; font-weight: 600; }
.wo-meta .warm { color: #fcd34d; }
.mtag { font: 700 11px var(--mono); padding: 2px 6px; border-radius: 5px; color: #0b1020; }
.btn {
  padding: 7px 12px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel-3);
  font-weight: 700; font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.btn:hover:not([disabled]) { background: #22304f; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.go { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 0 16px rgba(250, 204, 21, .25); }
.btn.go:hover { background: #fde047; }
.btn.ghost { background: transparent; }
.empty { color: var(--dim); text-align: center; padding: 26px 10px; font-size: 13px; }

/* machine panel */
.mhead { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.mhead .mtag { font-size: 13px; padding: 4px 8px; }
.mhead h3 { margin: 0; font-size: 17px; }
.mhead .line { color: var(--dim); font-size: 12px; }
.state-pill { margin-left: auto; font-size: 11.5px; font-weight: 750; padding: 4px 10px; border-radius: 99px; text-transform: uppercase; letter-spacing: .8px; }
.s-run { background: rgba(34, 197, 94, .14); color: #86efac; }
.s-starved, .s-blocked { background: rgba(100, 116, 139, .22); color: #cbd5e1; }
.s-planned { background: rgba(59, 130, 246, .18); color: #93c5fd; }
.s-down { background: rgba(239, 68, 68, .2); color: #fca5a5; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; }
.card .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); font-weight: 700; margin-bottom: 4px; }
.card .v { font: 700 18px var(--mono); }
.card .s { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.card.unknown .v { color: var(--dim); }
.hbar { height: 6px; border-radius: 99px; background: var(--panel-3); overflow: hidden; margin-top: 6px; }
.hbar > div { height: 100%; border-radius: 99px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 14px; }
.action { padding: 10px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; text-align: left; }
.action:hover:not([disabled]) { background: var(--panel-3); }
.action[disabled] { opacity: .4; cursor: not-allowed; }
.action b { display: block; font-size: 13px; }
.action span { font-size: 11.5px; color: var(--muted); }
.action.rca { grid-column: 1 / 3; border-color: rgba(250, 204, 21, .55); background: linear-gradient(160deg, rgba(250, 204, 21, .12), var(--panel-2)); }
.hist { display: grid; gap: 5px; }
.hist-row { display: grid; grid-template-columns: 74px 1fr; gap: 8px; font-size: 12.5px; padding: 7px 10px; background: var(--panel); border-radius: 8px; border: 1px solid var(--line); }
.hist-row .when { color: var(--dim); font-family: var(--mono); font-size: 11.5px; }
.hist-row .unk { color: var(--warn); font-style: italic; }
.code { font: 700 11px var(--mono); padding: 1px 6px; border-radius: 5px; background: var(--panel-3); color: #e2e8f0; margin-right: 6px; }

/* radio */
.msg { padding: 12px; border-radius: 11px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 8px; }
.msg.unread { border-color: rgba(250, 204, 21, .55); background: linear-gradient(160deg, rgba(250, 204, 21, .07), var(--panel)); }
.msg-head { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #0b1020; flex: none; }
.msg-head .who { font-weight: 700; font-size: 13px; }
.msg-head .role { color: var(--dim); font-size: 11.5px; }
.msg-head .when { margin-left: auto; font: 12px var(--mono); color: var(--dim); }
.msg-text { font-size: 13px; color: #d5deec; }
.msg-opts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.msg-ans { margin-top: 8px; font-size: 12px; color: var(--muted); }
.msg-ans.missed { color: #fca5a5; }

/* ticker */
.ticker { display: flex; align-items: center; gap: 22px; padding: 0 16px; border-top: 1px solid var(--line); background: #070c18; font-size: 12px; color: var(--muted); overflow: hidden; white-space: nowrap; }
.ticker .tk { display: inline-flex; gap: 8px; }
.ticker .tk .t { font-family: var(--mono); color: var(--dim); }
.ticker .bad { color: #fca5a5; } .ticker .good { color: #86efac; } .ticker .warn { color: #fcd34d; } .ticker .decision { color: #c4b5fd; }

/* ---------- overlay screens ---------- */
.overlay { position: fixed; inset: 0; z-index: 20; display: none; place-items: center; overflow-y: auto; padding: 32px 16px;
  background: radial-gradient(900px 600px at 50% 0%, rgba(30, 58, 138, .45), transparent 70%), rgba(4, 7, 14, .9); backdrop-filter: blur(10px); }
.overlay.show { display: grid; }
.screen { width: min(980px, 100%); animation: rise .45s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.hero { text-align: center; padding: 10px 0 24px; }
.hero .kicker { display: inline-flex; gap: 8px; align-items: center; font: 700 11.5px var(--mono); letter-spacing: 2px; text-transform: uppercase; color: var(--accent); padding: 6px 12px; border: 1px solid rgba(250, 204, 21, .35); border-radius: 99px; background: rgba(250, 204, 21, .06); }
.hero h1 { font-size: clamp(36px, 6vw, 68px); line-height: 1.02; margin: 18px 0 12px; letter-spacing: -1.5px; font-weight: 850;
  background: linear-gradient(180deg, #fff, #9fb3d9); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--accent), #fb923c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); font-size: 16.5px; max-width: 640px; margin: 0 auto; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 24px 0; }
.feature { padding: 18px; border-radius: 16px; background: linear-gradient(160deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); }
.feature .ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 10px; background: var(--panel-3); }
.feature .ico svg { width: 20px; height: 20px; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.feature h4 { margin: 0 0 4px; font-size: 15px; }
.feature p { margin: 0; color: var(--muted); font-size: 13px; }
.cta-row { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.cta { padding: 14px 26px; border-radius: 12px; font-weight: 800; font-size: 15px; cursor: pointer; border: 1px solid var(--line-2); background: var(--panel-2); }
.cta.go { background: linear-gradient(180deg, #fde047, var(--accent)); color: var(--accent-ink); border: 0; box-shadow: 0 10px 30px rgba(250, 204, 21, .3); }
.cta.go:hover { filter: brightness(1.06); }
.fine { text-align: center; color: var(--dim); font-size: 12px; margin-top: 16px; }

.clipboard { position: relative; margin: 8px auto 0; max-width: 720px; padding: 34px 34px 26px; border-radius: 18px;
  background: linear-gradient(180deg, #f8f4e8, #efe8d4); color: #1f2433; box-shadow: 0 30px 60px rgba(0,0,0,.5); }
.clipboard::before { content: ""; position: absolute; top: -14px; left: 50%; transform: translateX(-50%); width: 140px; height: 30px; border-radius: 8px;
  background: linear-gradient(180deg, #9aa6bd, #66728a); box-shadow: 0 4px 10px rgba(0,0,0,.35); }
.clipboard h2 { margin: 0 0 2px; font-size: 22px; }
.clipboard .from { color: #6b6450; font-size: 13px; margin-bottom: 16px; font-family: var(--mono); }
.clipboard ul { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.clipboard li { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding-bottom: 10px; border-bottom: 1px dashed #cfc5a6; font-size: 14.5px; }
.clipboard li b { font-family: var(--mono); font-size: 13px; color: #8a2b1d; }
.clipboard .prios { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; color: #4b4738; }
.clipboard .prios span { background: #1f2433; color: #f8f4e8; padding: 4px 10px; border-radius: 99px; font-weight: 700; font-size: 12px; }
.howto { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px auto; max-width: 980px; }
.howto div { padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.howto b { display: block; color: var(--text); margin-bottom: 4px; font-size: 13.5px; }
.howto .n { font: 800 12px var(--mono); color: var(--accent); }

/* modal (incidents) */
.modal-root:empty { display: none; }
.modal-root { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(40, 0, 0, .55); backdrop-filter: blur(3px); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(480px, calc(100% - 32px)); padding: 24px; border-radius: 18px; background: #1a0f14; border: 1px solid rgba(239, 68, 68, .6); box-shadow: 0 0 60px rgba(239, 68, 68, .3); text-align: center; }
.modal .big { font-size: 46px; line-height: 1; margin-bottom: 8px; }
.modal h3 { margin: 0 0 8px; font-size: 22px; color: #fecaca; }
.modal p { color: #e5c4c4; margin: 0 0 16px; }

/* debrief */
.debrief { width: min(1180px, 100%); }
.db-top { display: grid; grid-template-columns: 220px 1fr; gap: 16px; margin-bottom: 16px; }
.grade { border-radius: 20px; padding: 20px; text-align: center; background: linear-gradient(160deg, var(--panel-2), var(--panel)); border: 1px solid var(--line-2); display: grid; place-content: center; }
.grade .letter { font: 900 96px/1 var(--font); letter-spacing: -3px; }
.grade .num { font: 700 15px var(--mono); color: var(--muted); }
.grade .cap { font-size: 12px; color: #fca5a5; margin-top: 6px; }
.scorecard { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.sc { padding: 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
.sc .k { font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--dim); font-weight: 750; display: flex; justify-content: space-between; }
.sc .v { font: 800 30px/1.1 var(--mono); margin: 6px 0; }
.sc .s { font-size: 12px; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 10px; }
.kpi { padding: 10px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.kpi .k { font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.kpi .v { font: 700 18px var(--mono); margin-top: 3px; }
.kpi .s { font-size: 11px; color: var(--muted); }
.db-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; }
.panel { padding: 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 16px; }
.panel h3 { margin: 0 0 4px; font-size: 15px; }
.panel .sub { color: var(--dim); font-size: 12px; margin-bottom: 12px; }
.gantt { width: 100%; display: block; }
.lessons { display: grid; gap: 8px; }
.lesson { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 11px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13.5px; }
.lesson .ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 900; font-size: 13px; }
.lesson.bad .ic { background: rgba(239, 68, 68, .18); color: #fca5a5; }
.lesson.good .ic { background: rgba(34, 197, 94, .16); color: #86efac; }
.lesson.info .ic { background: rgba(56, 189, 248, .14); color: #7dd3fc; }
.lesson .src { display: block; font: 11px var(--mono); color: var(--dim); margin-top: 3px; }
.stack { display: flex; height: 22px; border-radius: 8px; overflow: hidden; margin: 6px 0 10px; }
.stack > div { height: 100%; }
.stack-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.stack-legend span { display: flex; align-items: center; gap: 6px; }
.stack-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.stack-legend b { margin-left: auto; font-family: var(--mono); color: var(--text); font-weight: 600; }

/* ---------- small screens ---------- */
@media (max-width: 1560px) {
  .prio-label, .brand-sub { display: none; }
}
@media (max-width: 1240px) {
  .priorities { display: none; }
}
@media (max-width: 1100px) {
  .main { grid-template-columns: minmax(0, 1fr) 360px; }
}
@media (max-width: 820px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100vh; grid-template-rows: auto auto auto 30px; }
  .main { grid-template-columns: 1fr; }
  .floor { height: 62vw; min-height: 300px; }
  .side { border-left: 0; border-top: 1px solid var(--line); }
  .tabbody { max-height: none; }
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 16px; white-space: normal; }
  .brand { min-width: 0; }
  .clock-block { border: 0; padding: 0; }
  .legend { display: none; }
  .techbar { top: 8px; font-size: 12px; max-width: calc(100% - 32px); overflow: hidden; }
  .feature-grid, .howto, .scorecard { grid-template-columns: 1fr 1fr; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .db-top, .db-grid { grid-template-columns: 1fr; }
  .clipboard li { grid-template-columns: 1fr; gap: 2px; }
}
@media (max-width: 480px) {
  .feature-grid, .howto { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
