/* Warehouse Ops Copilot — dark "control tower" theme. No external fonts or assets. */
:root {
  --bg: #070b12;
  --bg2: #0a101a;
  --panel: #0f1622;
  --panel2: #131c2b;
  --line: #1d2939;
  --line2: #273548;
  --text: #e6edf6;
  --muted: #8a9bb3;
  --dim: #5d6d84;
  --cyan: #22d3ee;
  --orange: #fb923c;
  --amber: #fbbf24;
  --red: #f43f5e;
  --green: #34d399;
  --blue: #60a5fa;
  --violet: #a78bfa;
  --radius: 14px;
  --font: Inter, "Segoe UI", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, "SFMono-Regular", ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(34, 211, 238, .07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(251, 146, 60, .05), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.amber { color: var(--amber); }
.accent { color: var(--cyan); }
.label { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.hint { color: var(--dim); font-size: 12px; margin-top: 6px; }
.link { color: var(--cyan); font-size: 12px; font-weight: 600; }
.link:hover { text-decoration: underline; }
.ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
::selection { background: rgba(34, 211, 238, .3); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #223046; border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------------ top bar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 18px;
  padding: 10px 22px;
  background: rgba(7, 11, 18, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 34px; height: 34px; flex: none; filter: drop-shadow(0 0 10px rgba(34, 211, 238, .35)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 750; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; }
.brand-sub { color: var(--muted); font-size: 11px; white-space: nowrap; }
.tabs { display: flex; gap: 2px; margin: 0 auto; padding: 4px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
.tabs a {
  position: relative; display: flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap;
  transition: color .15s, background .15s;
}
.tabs a:hover { color: var(--text); background: rgba(255, 255, 255, .03); }
.tabs a.active { color: var(--text); background: var(--panel2); box-shadow: inset 0 -2px 0 var(--cyan), 0 0 0 1px var(--line2); }
.tab-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; line-height: 18px; text-align: center; box-shadow: 0 0 12px rgba(244, 63, 94, .6); }
.status { display: flex; align-items: center; gap: 8px; flex: none; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px;
  border: 1px solid var(--line2); border-radius: 12px; background: var(--bg2);
  color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .03em; white-space: nowrap;
}
.pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.pill.live { color: var(--red); border-color: rgba(244, 63, 94, .35); }
.pill.live i { background: var(--red); animation: pulse 1.6s infinite; }
.pill.ok { color: var(--green); border-color: rgba(52, 211, 153, .35); }
.pill.warn { color: var(--amber); border-color: rgba(251, 191, 36, .35); }
.pill.conn.ok i { background: var(--green); box-shadow: 0 0 8px var(--green); }
.pill.conn.bad { color: var(--dim); }
.pill.conn.bad i { background: var(--red); }
.clock { color: var(--muted); font-size: 12px; min-width: 62px; text-align: right; }
.lang { display: flex; border: 1px solid var(--line2); border-radius: 9px; overflow: hidden; }
.lang button { border: 0; background: transparent; padding: 3px 9px; font-size: 12px; font-weight: 650; color: var(--muted); cursor: pointer; }
.lang button.on { background: var(--cyan); color: #04121a; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* ------------------------------------------------------------------ layout + primitives */
.view { padding: 20px 22px 40px; max-width: 1680px; margin: 0 auto; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .018), transparent 40%), var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  min-width: 0;
}
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-h.sub { margin-top: 18px; }
.card-h h2 { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 650; color: #cfd9e6; letter-spacing: .01em; }
.card-h h2 .ico { color: var(--cyan); }
.count { min-width: 24px; padding: 1px 8px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line2); color: var(--muted); font-size: 12px; text-align: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line2);
  background: var(--panel2); color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap;
  transition: border-color .15s, background .15s, transform .05s;
}
.btn:hover { border-color: #3a4d68; background: #182336; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, #2bd9f2, #12b4d1); border-color: transparent; color: #03131b; box-shadow: 0 6px 18px rgba(34, 211, 238, .25); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line2); background: var(--panel2); cursor: pointer; }
.icon-btn:hover { border-color: #3a4d68; }
.icon-btn.big { width: 44px; height: 44px; border-radius: 50%; background: var(--cyan); color: #03131b; border: 0; box-shadow: 0 0 20px rgba(34, 211, 238, .35); }
.icon-btn.big .ico { width: 20px; height: 20px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px;
  border: 1px solid var(--line2); border-radius: 14px; background: var(--bg2);
  color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.chip small { color: var(--dim); font-weight: 500; }
.chip b { color: var(--text); }
.chip:hover { color: var(--text); border-color: #3a4d68; }
.chip.on { color: var(--text); border-color: var(--cyan); background: rgba(34, 211, 238, .1); }
.chip.sm { height: 22px; padding: 0 8px; font-size: 11px; cursor: default; }
.chip.sev-high.on { border-color: var(--red); background: rgba(244, 63, 94, .12); }
.chip.sev-medium.on { border-color: var(--amber); background: rgba(251, 191, 36, .1); }
.chip.sev-low.on { border-color: var(--blue); background: rgba(96, 165, 250, .1); }
.toggle { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; user-select: none; white-space: nowrap; }
.toggle input { appearance: none; width: 30px; height: 17px; border-radius: 9px; background: #263347; position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #9fb0c7; transition: transform .15s, background .15s; }
.toggle input:checked { background: rgba(34, 211, 238, .45); }
.toggle input:checked::after { transform: translateX(13px); background: var(--cyan); }
.toggle.sm { font-size: 11px; }
select, input {
  height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line2);
  background: var(--bg2); color: var(--text); outline: none; min-width: 0;
}
select:focus, input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, .15); }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field span { color: var(--muted); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; margin: 0; }
.seg-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.seg { display: flex; flex-direction: column; align-items: flex-start; padding: 7px 14px; border-radius: 10px; border: 1px solid var(--line2); background: var(--panel); cursor: pointer; line-height: 1.25; }
.seg b { font-size: 13px; }
.seg small { color: var(--dim); font-size: 11px; }
.seg.on { border-color: var(--cyan); background: rgba(34, 211, 238, .08); box-shadow: 0 0 0 1px rgba(34, 211, 238, .25) inset; }
.seg-ctrl { display: inline-flex; border: 1px solid var(--line2); border-radius: 9px; overflow: hidden; }
.seg-ctrl button { border: 0; background: transparent; padding: 4px 11px; font-size: 12px; font-weight: 650; color: var(--muted); cursor: pointer; }
.seg-ctrl button.on { background: rgba(34, 211, 238, .15); color: var(--cyan); }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 28px 12px; color: var(--muted); text-align: center; }
.empty .ico { width: 30px; height: 30px; color: var(--dim); }
.loading-screen { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 18vh 0; color: var(--muted); }
.error-card { display: flex; flex-direction: column; align-items: center; padding-bottom: 26px; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid rgba(34, 211, 238, .2); border-top-color: var(--cyan); animation: spin .8s linear infinite; }
.spinner.big { width: 40px; height: 40px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { height: 16px; margin: 12px 0; border-radius: 6px; background: linear-gradient(90deg, #141d2b, #1c2738, #141d2b); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton.short { width: 55%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translate(-50%, 20px); opacity: 0;
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: #111b2a; border: 1px solid var(--line2); border-radius: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------------ severity + tags */
.sev-tag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 6px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.sev-tag .ico { width: 13px; height: 13px; }
.sev-tag.sev-high { color: #ff8da1; background: rgba(244, 63, 94, .14); }
.sev-tag.sev-medium { color: var(--amber); background: rgba(251, 191, 36, .12); }
.sev-tag.sev-low { color: var(--blue); background: rgba(96, 165, 250, .12); }
.tag { display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 7px; border-radius: 6px; background: var(--panel2); color: var(--muted); font-size: 11px; font-weight: 600; }
.tag .ico { width: 12px; height: 12px; }
.tag.ok { color: var(--green); }
.new { padding: 1px 6px; border-radius: 5px; background: var(--red); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .06em; animation: pulse 1.4s infinite; }
.ackd { color: var(--green); }
.sev-bar { position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--dim); }
.sev-high > .sev-bar { background: var(--red); box-shadow: 0 0 10px rgba(244, 63, 94, .7); }
.sev-medium > .sev-bar { background: var(--amber); }
.sev-low > .sev-bar { background: var(--blue); }

/* ------------------------------------------------------------------ overview */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { position: relative; overflow: hidden; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); }
.kpi::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--k, var(--cyan)); opacity: .9; }
.kpi::after { content: ""; position: absolute; right: -40px; top: -40px; width: 120px; height: 120px; border-radius: 50%; background: var(--k, var(--cyan)); opacity: .06; }
.kpi.accent-cyan { --k: var(--cyan); }
.kpi.accent-amber { --k: var(--amber); }
.kpi.accent-orange { --k: var(--orange); }
.kpi.accent-red { --k: var(--red); }
.kpi.accent-violet { --k: var(--violet); }
.kpi.accent-blue { --k: var(--blue); }
.kpi-h { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 600; }
.kpi-h .ico { color: var(--k); }
.kpi-v { margin: 6px 0 4px; font: 700 30px/1.1 var(--font); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-v small { font-size: 16px; color: var(--muted); font-weight: 600; }
.kpi-s { color: var(--dim); font-size: 11.5px; line-height: 1.35; }
.kpi-bar { height: 4px; margin: 6px 0 7px; border-radius: 3px; background: #1a2536; overflow: hidden; }
.kpi-bar i { display: block; height: 100%; border-radius: 3px; background: var(--k); }
.sev-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.ov-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(340px, 1fr); gap: 14px; align-items: start; }
.ov-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.cam-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cam-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg2); transition: border-color .15s, transform .15s; }
.cam-card:hover { border-color: #3a4d68; transform: translateY(-2px); }
.cam-card.st-alert { border-color: rgba(244, 63, 94, .55); box-shadow: 0 0 0 1px rgba(244, 63, 94, .2), 0 0 24px rgba(244, 63, 94, .12); }
.cam-card.st-warn { border-color: rgba(251, 191, 36, .35); }
.thumb-wrap { position: relative; aspect-ratio: 16 / 9; background: #02050a; overflow: hidden; }
.thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-tag { position: absolute; left: 8px; top: 8px; display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px; background: rgba(2, 6, 12, .72); font-size: 11px; font-weight: 650; }
.cam-tag .ico { width: 13px; height: 13px; color: var(--cyan); }
.st-pill { position: absolute; right: 8px; top: 8px; display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px; background: rgba(2, 6, 12, .72); font-size: 11px; font-weight: 700; }
.st-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.st-warn .st-pill { color: var(--amber); }
.st-warn .st-pill i { background: var(--amber); }
.st-alert .st-pill { color: #ff8da1; }
.st-alert .st-pill i { background: var(--red); animation: pulse 1s infinite; }
.cam-body { padding: 10px 12px 8px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.cam-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.cam-stats div { display: flex; flex-direction: column; }
.cam-stats b { font: 700 17px/1.2 var(--font); font-variant-numeric: tabular-nums; }
.cam-stats span { color: var(--dim); font-size: 10.5px; }
.spark { width: 100%; height: 40px; display: block; }
.scn-title { font-weight: 650; font-size: 13px; }
.scn-meta { color: var(--dim); font-size: 11.5px; }
.scn-events { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; }
.card-links { display: inline-flex; gap: 14px; }
.pill.conn.busy { color: var(--amber); border-color: rgba(251, 191, 36, .4); }
.pill.conn.busy i { background: var(--amber); animation: pulse .9s infinite; }
.agent-card { border-color: rgba(34, 211, 238, .3); }
.agent-card.ag-st-analyzing { border-color: rgba(251, 191, 36, .55); box-shadow: 0 0 22px rgba(251, 191, 36, .1); }
.agent-card.ag-st-offline { border-color: var(--line); opacity: .8; }
.agent-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); animation: pulse 1.6s infinite; }
.ag-st-analyzing .agent-dot { background: var(--amber); box-shadow: 0 0 10px var(--amber); animation-duration: .8s; }
.ag-st-offline .agent-dot, .ag-st-error .agent-dot { background: var(--dim); box-shadow: none; animation: none; }
.ag-indexing { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--amber); font-size: 12px; }
.ag-indexing .spinner { width: 14px; height: 14px; border-width: 2px; flex: none; }
.agent-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 230px; overflow: auto; }
.agent-log li { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 8px; font-size: 12px; line-height: 1.4; color: #c9d4e2; }
.agent-log li .mono { color: var(--dim); font-size: 11px; padding-top: 1px; }
.agent-log .ag-msg { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.agent-log .ag-alert { color: #ff8da1; font-weight: 600; }
.agent-log .ag-done { color: var(--green); }
.agent-log .ag-detected, .agent-log .ag-analyzing { color: var(--amber); }
.agent-log .ag-error { color: var(--dim); }
.roi { margin-bottom: 14px; }
.roi-body { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.roi-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.roi-tile { display: flex; flex-direction: column; gap: 3px; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); }
.roi-tile span { color: var(--muted); font-size: 12px; font-weight: 600; }
.roi-tile b { font: 700 26px/1.15 var(--font); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.roi-tile small { color: var(--dim); font-size: 11.5px; line-height: 1.35; }
.roi-tile.hi { border-color: rgba(52, 211, 153, .45); background: linear-gradient(180deg, rgba(52, 211, 153, .1), transparent), var(--bg2); }
.roi-tile.hi b { color: var(--green); }
.roi-inputs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.roi-in { display: flex; flex-direction: column; gap: 3px; color: var(--dim); font-size: 11.5px; }
.roi-field { display: flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg2); }
.roi-field:focus-within { border-color: var(--cyan); }
.roi-field input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: 600 14px/1.2 var(--font); font-variant-numeric: tabular-nums; }
.roi-field small { color: var(--dim); white-space: nowrap; }
.roi-note { margin: 10px 0 0; color: var(--dim); font-size: 11.5px; line-height: 1.45; }
@media (max-width: 1100px) { .roi-body { grid-template-columns: 1fr; } }
.lib-head { margin-bottom: 14px; }
.lib-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.lib-stats div { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); }
.lib-stats b { font: 700 24px/1.15 var(--font); font-variant-numeric: tabular-nums; }
.lib-stats b small { font-size: 14px; color: var(--muted); font-weight: 600; }
.lib-stats span { color: var(--dim); font-size: 11.5px; }
.lib-site { margin-bottom: 14px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.lib-card { padding: 0; text-align: left; color: inherit; font: inherit; cursor: pointer; }
.lib-thumb { position: absolute; inset: 0; background-repeat: no-repeat; background-color: #02050a; }
.lib-preview { position: absolute; inset: 0; }
.lib-time { position: absolute; left: 8px; bottom: 8px; padding: 1px 7px; border-radius: 6px; background: rgba(2, 6, 12, .72); font-size: 11px; }
.lib-play { position: absolute; right: 8px; bottom: 8px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: rgba(34, 211, 238, .9); color: #03131b; opacity: 0; transition: opacity .15s; }
.lib-play .ico { width: 13px; height: 13px; }
.lib-card:hover .lib-play, .lib-card:focus-visible .lib-play { opacity: 1; }
.lib-foot { display: flex; flex-wrap: wrap; gap: 6px; }
.lib-foot .tag .ico { width: 12px; height: 12px; }
.modal-back { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; background: rgba(2, 5, 10, .74); backdrop-filter: blur(3px); }
.modal { width: min(1100px, 100%); max-height: calc(100vh - 48px); overflow: auto; }
.modal-video { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; background: #000; }
.modal-stats { margin: 12px 0 4px; }
.modal-caption { margin: 8px 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
@media (max-width: 900px) { .lib-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 10px var(--red); animation: pulse 1.4s infinite; }
.feed { display: flex; flex-direction: column; gap: 6px; }
.feed-item, .al-item {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 9px 10px 9px 14px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--bg2);
  transition: border-color .15s, background .15s;
}
.feed-item { animation: slidein .35s ease both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes slidein { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
.feed-item:hover, .al-item:hover { border-color: #3a4d68; background: #0e1623; }
.feed-item.acked, .al-item.acked { opacity: .6; }
.feed-ico { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 8px; background: var(--panel2); }
.sev-high .feed-ico { color: var(--red); background: rgba(244, 63, 94, .12); }
.sev-medium .feed-ico { color: var(--amber); background: rgba(251, 191, 36, .1); }
.sev-low .feed-ico { color: var(--blue); background: rgba(96, 165, 250, .1); }
.feed-main, .al-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.feed-main b, .al-main b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-main small, .al-main small { color: var(--dim); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 12px; color: var(--muted); }
.flag-items, .rec-items { display: flex; flex-direction: column; gap: 6px; }
.flag-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); }
.flag-item:hover { border-color: #3a4d68; }
.ftag { padding: 2px 7px; border-radius: 6px; font-size: 10.5px; font-weight: 700; white-space: nowrap; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.flag-msg { font-size: 12px; color: #c4d0de; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.flag-val { font-size: 13px; font-weight: 700; color: var(--c); }
.flag-val small { color: var(--dim); font-weight: 500; }
.rec-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); }
.rec-item:hover { border-color: #3a4d68; }
.rec-item b { display: block; font-size: 13px; font-weight: 600; }
.rec-item small { display: block; color: var(--dim); font-size: 11.5px; }
.rec-num { display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 7px; background: rgba(52, 211, 153, .14); color: var(--green); font-weight: 750; font-size: 12px; }

/* ------------------------------------------------------------------ safety alerts */
.alerts-layout { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 14px; align-items: start; }
.alert-list { position: sticky; top: 78px; max-height: calc(100vh - 100px); display: flex; flex-direction: column; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.sev-filter { grid-column: 1 / -1; display: flex; gap: 6px; }
.filters .toggle { grid-column: 1 / -1; }
.list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; padding-right: 2px; margin-right: -6px; }
.al-item { align-items: flex-start; }
.al-item.sel { border-color: var(--cyan); background: rgba(34, 211, 238, .06); box-shadow: 0 0 0 1px rgba(34, 211, 238, .25) inset; }
.al-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.detail { position: relative; overflow: hidden; }
.detail::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--dim); }
.detail.sev-high::before { background: linear-gradient(90deg, var(--red), transparent); }
.detail.sev-medium::before { background: linear-gradient(90deg, var(--amber), transparent); }
.detail.sev-low::before { background: linear-gradient(90deg, var(--blue), transparent); }
.detail-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.detail-tags { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.detail h1 { font-size: 21px; line-height: 1.25; }
.sev-badge { padding: 3px 10px; border-radius: 7px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.sev-badge.sev-high { background: var(--red); color: #fff; box-shadow: 0 0 16px rgba(244, 63, 94, .45); }
.sev-badge.sev-medium { background: var(--amber); color: #1d1300; }
.sev-badge.sev-low { background: var(--blue); color: #04101f; }
.type-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 7px; background: var(--panel2); border: 1px solid var(--line2); font-size: 12px; font-weight: 650; }
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 8px; color: var(--muted); font-size: 12.5px; }
.detail-meta span { display: inline-flex; align-items: center; gap: 5px; }
.detail-meta b { color: var(--text); }
.conf-bar { display: inline-block; width: 70px; height: 5px; border-radius: 3px; background: #1d2a3d; overflow: hidden; }
.conf-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--green)); }
.views-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 12px 0 4px; }
.view-chip .ico { width: 13px; height: 13px; }
.desc { margin: 12px 0 0; color: #c9d4e2; font-size: 14px; }
.sec-h { margin: 20px 0 10px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; font-weight: 700; }
.evidence { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ev-card { padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); min-width: 0; font-size: 12.5px; display: flex; flex-direction: column; gap: 8px; }
.ev-card.cons { border-color: rgba(52, 211, 153, .3); }
.ev-h { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 12px; color: #cfd9e6; }
.ev-h .ico { color: var(--cyan); }
.ev-card.cons .ev-h .ico { color: var(--green); }
.ev-card p { color: #c4d0de; overflow-wrap: anywhere; }
.k { display: block; color: var(--dim); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 2px; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 10px; margin: 0; }
.kv dt { color: var(--dim); font-size: 11.5px; }
.kv dd { margin: 0; color: var(--text); font-size: 12px; overflow-wrap: anywhere; }
.ev-spark { display: flex; align-items: center; gap: 8px; }
.ev-spark .spark { width: 160px; height: 34px; }
.ev-list { margin: 0; padding-left: 16px; color: #c4d0de; }
table.mini { width: 100%; border-collapse: collapse; font-size: 11px; }
table.mini th { text-align: left; color: var(--dim); font-weight: 600; padding: 3px 4px; border-bottom: 1px solid var(--line); }
table.mini td { padding: 3px 4px; border-bottom: 1px solid rgba(29, 41, 57, .6); color: #c4d0de; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cmp { padding: 14px; border-radius: 12px; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.cmp.old { background: repeating-linear-gradient(135deg, rgba(255, 255, 255, .012) 0 8px, transparent 8px 16px), var(--bg2); }
.cmp.new { background: rgba(34, 211, 238, .05); border-color: rgba(34, 211, 238, .35); }
.cmp-h { font-weight: 750; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; }
.cmp.old .cmp-h { color: var(--muted); }
.cmp.new .cmp-h { color: var(--cyan); }
.cmp blockquote { margin: 0; padding-left: 10px; border-left: 2px solid var(--line2); color: var(--muted); font-style: italic; }
.cmp-verdict { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.cmp-foot { margin-top: auto; color: var(--dim); font-size: 11.5px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

/* ------------------------------------------------------------------ video player */
.player { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #000; }
.video-wrap { position: relative; aspect-ratio: 16 / 9; max-height: 64vh; width: 100%; margin: 0 auto; background: #000; }
.video-wrap video { width: 100%; height: 100%; object-fit: contain; display: block; cursor: pointer; }
canvas.overlay { position: absolute; left: 0; top: 0; pointer-events: none; }
.v-tl { position: absolute; left: 10px; top: 10px; display: flex; align-items: center; gap: 7px; padding: 3px 9px; border-radius: 7px; background: rgba(2, 6, 12, .7); font-size: 12px; font-weight: 650; pointer-events: none; }
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: pulse 1.2s infinite; }
.v-scene { color: var(--cyan); font-weight: 600; }
.v-legend { position: absolute; right: 10px; top: 10px; display: flex; gap: 6px; pointer-events: none; }
.lg { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px; background: rgba(2, 6, 12, .7); font-size: 11px; }
.lg::before { content: ""; width: 10px; height: 10px; border: 2px solid; border-radius: 2px; }
.lg.person::before { border-color: var(--cyan); }
.lg.machine::before { border-color: var(--orange); }
.v-state, .v-error { position: absolute; inset: 0; display: none; place-items: center; pointer-events: none; }
.video-wrap.loading .v-state { display: grid; }
.v-error { flex-direction: column; gap: 8px; color: var(--muted); background: rgba(0, 0, 0, .6); }
.video-wrap.err .v-error { display: flex; align-items: center; justify-content: center; }
.video-wrap.flash::after { content: ""; position: absolute; inset: 0; border: 3px solid var(--red); border-radius: 2px; pointer-events: none; animation: flashring 1.2s ease-out forwards; }
@keyframes flashring { 0% { opacity: 1; box-shadow: inset 0 0 60px rgba(244, 63, 94, .55); } 100% { opacity: 0; box-shadow: inset 0 0 0 transparent; } }
.video-wrap:fullscreen { max-height: none; aspect-ratio: auto; width: 100vw; height: 100vh; }
.controls { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: #0b111b; border-top: 1px solid var(--line); }
.scrub { position: relative; flex: 1; height: 8px; border-radius: 4px; background: #1c2739; cursor: pointer; touch-action: none; }
.scrub-fill { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: linear-gradient(90deg, #0ea5c3, var(--cyan)); pointer-events: none; }
.scrub-marks { position: absolute; inset: 0; pointer-events: none; }
.mk { position: absolute; top: -5px; width: 4px; height: 18px; margin-left: -2px; border-radius: 2px; background: var(--red); box-shadow: 0 0 8px var(--red); }
.mk.sev-medium { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.mk.sev-low { background: var(--blue); box-shadow: 0 0 8px var(--blue); }
.time { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ------------------------------------------------------------------ resources */
.res-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.cam-chips { justify-content: flex-end; }
.res-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px; margin: 4px 2px 12px; }
.res-title h1 { font-size: 19px; }
.res-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.res-people { grid-column: 1; grid-row: 1; }
.res-heat { grid-column: 2; grid-row: 1 / span 2; }
.res-mach { grid-column: 1; grid-row: 2; }
.res-bars { grid-column: 1; grid-row: 3; }
.res-flags { grid-column: 2; grid-row: 3 / span 2; }
.res-recs { grid-column: 1; grid-row: 4; }
.legend { display: flex; gap: 12px; color: var(--muted); font-size: 11.5px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend span::before { content: ""; width: 12px; height: 3px; border-radius: 2px; background: var(--c); }
.chart-host { position: relative; }
svg.chart { width: 100%; height: auto; display: block; cursor: crosshair; overflow: visible; }
svg.chart .gl { stroke: #18222f; stroke-width: 1; }
svg.chart .tk { stroke: #2a384c; }
svg.chart .ax { fill: #5d6d84; font: 10px var(--mono); }
svg.chart .band { opacity: .16; cursor: pointer; }
svg.chart .band:hover, svg.chart .band.sel { opacity: .32; }
svg.chart .mark { cursor: pointer; }
svg.chart .mark:hover circle { r: 7; }
svg.chart .cursor { stroke: #e6edf6; stroke-width: 1.2; stroke-dasharray: 3 3; opacity: .8; }
svg.chart .guide { stroke: rgba(230, 237, 246, .35); stroke-width: 1; pointer-events: none; }
.chart-tip { position: absolute; z-index: 5; display: flex; flex-direction: column; gap: 2px; min-width: 150px; padding: 8px 10px; border-radius: 9px; background: rgba(9, 14, 22, .96); border: 1px solid var(--line2); font-size: 12px; pointer-events: none; box-shadow: 0 10px 24px rgba(0, 0, 0, .4); }
.chart-tip b { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.chart-tip span { display: flex; align-items: center; gap: 6px; }
.chart-tip span::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.heat-wrap { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #000; border: 1px solid var(--line); }
.heat-wrap video { width: 100%; height: 100%; object-fit: contain; display: block; filter: saturate(.65) brightness(.75); }
.heat-wrap canvas { position: absolute; left: 0; top: 0; pointer-events: none; }
.heat-cap { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 6px; background: rgba(2, 6, 12, .75); font-size: 11px; color: #cfd9e6; }
.seg-detail { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.seg-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cong { padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; background: var(--panel2); color: var(--muted); }
.cong-low { color: var(--blue); }
.cong-medium { color: var(--amber); background: rgba(251, 191, 36, .1); }
.cong-high { color: #ff8da1; background: rgba(244, 63, 94, .12); }
.seg-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.seg-stats span { display: flex; flex-direction: column; padding: 7px 9px; border-radius: 9px; background: var(--bg2); border: 1px solid var(--line); color: var(--dim); font-size: 11px; }
.seg-stats b { color: var(--text); font-size: 16px; font-variant-numeric: tabular-nums; }
.seg-stats b.amber { color: var(--amber); }
.seg-text { padding: 9px 11px; border-radius: 9px; background: rgba(34, 211, 238, .05); border: 1px solid rgba(34, 211, 238, .2); font-size: 12.5px; color: #c9d4e2; }
.seg-text .k { display: flex; align-items: center; gap: 5px; color: var(--cyan); }
.seg-text .k .ico { width: 12px; height: 12px; }
.seg-text.old { background: var(--bg2); border-color: var(--line); color: var(--muted); }
.seg-text.old .k { color: var(--dim); }
.seg-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bars { display: flex; flex-direction: column; gap: 4px; }
.bar-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) 46px; align-items: center; gap: 10px; padding: 4px 6px; border: 1px solid transparent; border-radius: 8px; background: transparent; cursor: pointer; text-align: left; }
.bar-row:hover { background: var(--bg2); }
.bar-row.sel { border-color: rgba(34, 211, 238, .4); background: rgba(34, 211, 238, .06); }
.bar-label { font-size: 12px; color: #c4d0de; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { position: relative; height: 10px; border-radius: 5px; background: #172131; }
.bar-fill { position: absolute; inset: 0 auto 0 0; border-radius: 5px; opacity: .9; }
.bar-th { position: absolute; top: -3px; bottom: -3px; width: 2px; background: rgba(230, 237, 246, .55); }
.bar-val { font-size: 12px; text-align: right; color: var(--text); }
.flag-list { display: flex; flex-direction: column; gap: 8px; max-height: 760px; overflow-y: auto; }
.flag-row { display: grid; grid-template-columns: auto minmax(0, 1fr) 110px; gap: 10px; align-items: start; padding: 10px; border-radius: 10px; border: 1px solid var(--line); border-left: 3px solid var(--c); background: var(--bg2); cursor: pointer; }
.flag-row:hover { border-color: #3a4d68; border-left-color: var(--c); }
.flag-row.sel { background: color-mix(in srgb, var(--c) 8%, var(--bg2)); border-color: color-mix(in srgb, var(--c) 60%, transparent); }
.flag-main b { font-size: 12.5px; font-weight: 600; }
.flag-main p { color: var(--muted); font-size: 12px; margin-top: 2px; }
.flag-metric { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.flag-metric b { font-size: 16px; color: var(--c); }
.flag-metric small { color: var(--dim); font-size: 10.5px; }
.flag-metric .small { color: var(--dim); font-size: 10.5px; }
.mbar { position: relative; width: 100%; height: 5px; border-radius: 3px; background: #1a2536; }
.mbar i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--c); }
.mbar em { position: absolute; top: -3px; bottom: -3px; width: 2px; background: rgba(230, 237, 246, .6); }
.rec-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.rec-card { padding: 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); display: flex; flex-direction: column; gap: 8px; }
.rec-card.sel { border-color: rgba(52, 211, 153, .5); }
.rec-card.flash, .clip.flash { animation: glow 1.6s ease-out; }
@keyframes glow { 0% { box-shadow: 0 0 0 2px var(--cyan), 0 0 24px rgba(34, 211, 238, .5); } 100% { box-shadow: 0 0 0 0 transparent; } }
.rec-h { display: flex; gap: 9px; align-items: flex-start; }
.rec-h b { font-size: 13.5px; }
.rec-action { color: #d5deea; font-size: 13px; }
.rec-kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; margin: 0; font-size: 12px; }
.rec-kv dt { color: var(--dim); font-weight: 650; }
.rec-kv dd { margin: 0; color: var(--muted); }
.cite {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; margin: 1px 2px;
  border-radius: 6px; border: 1px solid var(--line2); background: var(--panel2);
  font: 600 11px var(--mono); color: #c4d0de; vertical-align: 1px; white-space: nowrap;
}
.cite .ico { width: 12px; height: 12px; }
a.cite:hover { border-color: var(--cyan); color: var(--text); }
.cite.ev { color: #ff8da1; border-color: rgba(244, 63, 94, .35); }
.cite.ev.sev-medium { color: var(--amber); border-color: rgba(251, 191, 36, .35); }
.cite.ev.sev-low { color: var(--blue); border-color: rgba(96, 165, 250, .35); }
.cite.fl { color: var(--violet); border-color: rgba(167, 139, 250, .35); }
.cite.rc { color: var(--green); border-color: rgba(52, 211, 153, .35); }
.cite.cl { color: var(--cyan); border-color: rgba(34, 211, 238, .35); }

/* ------------------------------------------------------------------ multi-camera replay */
.replay-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; margin-bottom: 12px; padding: 12px 16px; }
.replay-head .muted { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.tiles { display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles.n1 { grid-template-columns: minmax(0, 1fr); }
.tiles.n2, .tiles.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tiles.n7, .tiles.n8 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tiles.n10 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tiles.n5 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tiles.n5 .tile:first-child { grid-column: span 2; grid-row: span 2; aspect-ratio: auto; }
.tiles.n5.has-focus .tile:first-child:not(.focus) { grid-column: auto; grid-row: auto; aspect-ratio: 16 / 9; }
.tile { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #000; border: 1px solid var(--line); cursor: zoom-in; }
.tile video { width: 100%; height: 100%; object-fit: contain; display: block; }
.tiles.has-focus .tile.focus { grid-column: 1 / -1; order: -1; cursor: zoom-out; max-height: 66vh; border-color: rgba(34, 211, 238, .5); }
.tiles.has-focus .tile.focus video { max-height: 66vh; }
.tile-label { position: absolute; left: 8px; top: 8px; display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px; background: rgba(2, 6, 12, .72); font-size: 11.5px; font-weight: 650; pointer-events: none; }
.tile-label .ico { width: 13px; height: 13px; color: var(--cyan); }
.tile-label small { color: var(--muted); font-weight: 500; }
.tile-state, .tile-err { position: absolute; inset: 0; display: none; place-items: center; pointer-events: none; }
.tile.buffering .tile-state { display: grid; background: rgba(0, 0, 0, .25); }
.tile.err .tile-err { display: grid; color: var(--muted); font-size: 12px; background: rgba(0, 0, 0, .6); }
.transport { position: sticky; bottom: 12px; z-index: 10; display: flex; align-items: center; gap: 16px; margin-top: 12px; padding: 12px 18px; background: rgba(15, 22, 34, .94); backdrop-filter: blur(10px); }
.rp-time { min-width: 110px; font-size: 14px; color: var(--text); }
.rp-scrub { position: relative; flex: 1; height: 12px; border-radius: 6px; background: #1a2536; cursor: pointer; touch-action: none; }
.rp-fill { position: absolute; inset: 0 auto 0 0; border-radius: 6px; background: linear-gradient(90deg, rgba(34, 211, 238, .35), var(--cyan)); pointer-events: none; }
.rp-head { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(34, 211, 238, .35); pointer-events: none; }
.rp-tick { position: absolute; top: 2px; bottom: 2px; width: 1px; background: rgba(230, 237, 246, .18); pointer-events: none; }
.rp-mark { position: absolute; top: -8px; width: 12px; height: 28px; margin-left: -6px; border: 0; border-radius: 4px; background: var(--red); box-shadow: 0 0 10px var(--red); cursor: pointer; z-index: 2; }
.rp-mark.sev-medium { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.rp-mark.sev-low { background: var(--blue); box-shadow: 0 0 10px var(--blue); }
.rp-mark.hot { animation: pulse .6s infinite; }
.rp-events { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 12px; }
.rp-events .chip .ico { width: 13px; height: 13px; }

/* ------------------------------------------------------------------ ask */
.ask-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
.chat { display: flex; flex-direction: column; height: calc(100vh - 120px); min-height: 520px; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding: 6px 4px 12px; }
.chat-empty { margin: auto; max-width: 460px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; color: var(--muted); }
.chat-empty .ico { width: 38px; height: 38px; color: var(--cyan); filter: drop-shadow(0 0 12px rgba(34, 211, 238, .5)); }
.chat-input { display: flex; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.chat-input input { flex: 1; height: 42px; font-size: 14px; }
.chat-input .btn { height: 42px; }
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: linear-gradient(180deg, #0f3b4a, #0c2f3c); border-color: rgba(34, 211, 238, .35); max-width: 70%; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 10px; background: rgba(34, 211, 238, .12); color: var(--cyan); border: 1px solid rgba(34, 211, 238, .3); }
.bubble { padding: 11px 14px; border-radius: 14px; border: 1px solid var(--line2); background: var(--panel2); max-width: 100%; min-width: 0; flex: 1; }
.msg.user .bubble { flex: none; }
.bubble.pending { display: flex; align-items: center; gap: 12px; flex: none; color: var(--muted); }
.bubble.err { border-color: rgba(244, 63, 94, .4); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; flex: none; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); animation: bounce 1s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-5px); opacity: 1; } }
.msg-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 10px; color: var(--dim); font-size: 11.5px; }
.engine { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px; background: rgba(34, 211, 238, .1); color: var(--cyan); font-weight: 650; }
.engine .ico { width: 12px; height: 12px; }
.engine-rules, .engine-vss_agent, .engine-vss_search { background: rgba(251, 191, 36, .1); color: var(--amber); }
.used { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 8px; }
.used .label { margin-right: 4px; }
.bubble > .label { display: block; margin-top: 12px; }
.clips { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 8px; }
.clip { border-radius: 11px; overflow: hidden; border: 1px solid var(--line); background: var(--bg2); }
.clip-media { position: relative; aspect-ratio: 16 / 9; background: #000; }
.clip-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.clip-play { position: absolute; inset: 0; margin: auto; width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(34, 211, 238, .88); color: #03131b; cursor: pointer; display: grid; place-items: center; box-shadow: 0 0 22px rgba(34, 211, 238, .45); }
.clip-play .ico { width: 20px; height: 20px; margin-left: 2px; }
.clip-play[hidden] { display: none; }
.clip-n { position: absolute; left: 7px; top: 7px; width: 20px; height: 20px; border-radius: 6px; background: rgba(2, 6, 12, .75); font-size: 11px; font-weight: 750; display: grid; place-items: center; }
.clip-info { padding: 8px 10px 10px; }
.clip-h { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.clip-h b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip-h .mono { color: var(--cyan); }
.score { padding: 1px 6px; border-radius: 5px; background: rgba(52, 211, 153, .12); color: var(--green); font-weight: 700; font-size: 11px; }
.clip-info p { margin-top: 4px; color: var(--muted); font-size: 11.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ask-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 78px; }
.suggest { display: flex; flex-direction: column; gap: 6px; }
.suggest-q { text-align: left; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); color: #cfd9e6; font-size: 13px; cursor: pointer; transition: border-color .15s, transform .1s; }
.suggest-q:hover { border-color: var(--cyan); transform: translateX(2px); }
.how ol { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; display: flex; flex-direction: column; gap: 6px; }

/* ------------------------------------------------------------------ markdown */
.md { font-size: 14px; line-height: 1.6; color: #d5deea; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md h1 { font-size: 22px; margin: 0 0 6px; }
.md h2 { font-size: 15px; margin: 22px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); color: var(--cyan); }
.md h3, .md h4 { font-size: 14px; margin: 16px 0 6px; }
.md p { margin: 8px 0; }
.md ul, .md ol { margin: 8px 0; padding-left: 22px; }
.md li { margin: 4px 0; }
.md li::marker { color: var(--dim); }
.md strong { color: var(--text); }
.md em { color: var(--muted); }
.md code { padding: 1px 6px; border-radius: 5px; background: var(--bg2); border: 1px solid var(--line); font: 12px var(--mono); }
.md blockquote { margin: 10px 0; padding: 4px 12px; border-left: 3px solid var(--cyan); color: var(--muted); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.table-wrap { overflow-x: auto; margin: 10px 0; border: 1px solid var(--line); border-radius: 10px; }
.md table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.md th { text-align: left; padding: 8px 10px; background: var(--bg2); color: var(--muted); font-weight: 650; border-bottom: 1px solid var(--line); white-space: nowrap; }
.md td { padding: 7px 10px; border-bottom: 1px solid rgba(29, 41, 57, .7); font-variant-numeric: tabular-nums; }
.md tr:last-child td { border-bottom: 0; }
.md tr:hover td { background: rgba(255, 255, 255, .015); }

/* ------------------------------------------------------------------ report */
.report-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; align-items: start; }
.report-ctrl { position: sticky; top: 78px; }
.report-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.report-btns .btn { flex: 1; }
.report-btns.tools { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.r-status { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.r-status:empty { display: none; }
.writing { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 10px; background: rgba(34, 211, 238, .06); border: 1px solid rgba(34, 211, 238, .25); color: var(--cyan); font-size: 12.5px; }
.writing .spinner { width: 16px; height: 16px; border-width: 2px; flex: none; }
.badge { display: flex; align-items: flex-start; gap: 7px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg2); font-size: 12px; color: var(--muted); }
.badge .ico { margin-top: 1px; }
.badge.ok { color: var(--green); border-color: rgba(52, 211, 153, .35); }
.badge.warn { color: var(--amber); border-color: rgba(251, 191, 36, .35); }
.badge.engine-cosmos { color: var(--cyan); border-color: rgba(34, 211, 238, .3); }
.report-doc { padding: 26px 30px; min-height: 60vh; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1520px) {
  .brand-sub, .clock { display: none; }
}
@media (max-width: 1400px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cam-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles.n10 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tabs a { padding: 7px 10px; }
}
@media (max-width: 1300px) {
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .tabs { order: 3; width: 100%; margin: 0; justify-content: center; }
  .status { margin-left: auto; }
  .brand-sub { display: block; }
}
@media (max-width: 1180px) {
  .ov-grid, .alerts-layout, .ask-layout, .report-layout { grid-template-columns: minmax(0, 1fr); }
  .alert-list, .ask-side, .report-ctrl { position: static; max-height: none; }
  .alert-list .list { max-height: 340px; }
  .res-grid { grid-template-columns: minmax(0, 1fr); }
  .res-grid > .card { grid-column: 1 !important; grid-row: auto !important; }
  .evidence { grid-template-columns: minmax(0, 1fr); }
  .tiles, .tiles.n5, .tiles.n7, .tiles.n8, .tiles.n10 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles.n5 .tile:first-child { grid-row: auto; aspect-ratio: 16 / 9; }
}
@media (max-width: 720px) {
  .view { padding: 14px 12px 30px; }
  .brand-sub, .clock, .pill.live { display: none; }
  .kpis, .cam-grid, .compare { grid-template-columns: minmax(0, 1fr); }
  .tiles, .tiles.n2, .tiles.n4, .tiles.n5, .tiles.n7, .tiles.n8, .tiles.n10 { grid-template-columns: minmax(0, 1fr); }
  .tiles.n5 .tile:first-child { grid-column: auto; }
  .detail-h { flex-direction: column; }
}

/* ------------------------------------------------------------------ print (shift report) */
@media print {
  body { background: #fff; color: #111; }
  .topbar, .report-ctrl, .toast { display: none !important; }
  .view { padding: 0; max-width: none; animation: none; }
  .report-layout { display: block; }
  .card { box-shadow: none; border: 0; background: #fff; padding: 0; }
  .md { color: #111; }
  .md h2 { color: #0b6b7d; border-color: #ccc; }
  .md th { background: #f2f4f7; color: #333; }
  .md td, .md th, .table-wrap { border-color: #ddd; }
  .md em, .md blockquote { color: #444; }
  .md code, .cite { background: #f2f4f7; border-color: #ddd; color: #111; }
  .cite .ico { display: none; }
}
