/* Admin dashboard. Builds on app.css tokens. */
body.dash { background: var(--bg); }
.dash-shell { min-height: 100dvh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 6px;
  padding: 18px 14px; background: var(--surface); border-inline-end: 1px solid var(--line); z-index: 50;
}
.sidebar .brand { padding: 4px 8px 18px; }
.side-nav { display: grid; gap: 2px; }
.side-label { padding: 14px 10px 6px; color: var(--text-3); font-size: 12px; font-weight: 600; }
.side-link {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--radius-control);
  color: var(--text-2); font-size: 14px; font-weight: 500; transition: background .2s var(--ease), color .2s var(--ease);
}
.side-link .ph { font-size: 19px; }
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-link .count { margin-inline-start: auto; font: 500 12px var(--mono); color: var(--text-3); }
.side-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-elevated); }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: 600 15px var(--mono); text-transform: uppercase; }
.side-user-info { min-width: 0; display: grid; }
.side-user-info strong { font-size: 14px; direction: ltr; text-align: start; }
.side-user-info span { font-size: 12px; color: var(--text-3); }
.side-user .icon-btn { margin-inline-start: auto; width: 36px; height: 36px; font-size: 17px; }

/* ---------- Main ---------- */
.dash-main { min-width: 0; display: flex; flex-direction: column; }
.dash-top {
  position: sticky; top: 0; z-index: 30; height: var(--header-h); display: flex; align-items: center; gap: 12px;
  padding: 0 28px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.dash-top h1 { font-size: 18px; font-weight: 600; }
.dash-top .updated { color: var(--text-3); font-size: 12px; }
.dash-top-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.sidebar-toggle { display: none; }
.dash-content { padding: 28px; display: grid; gap: 20px; align-content: start; max-width: 1440px; width: 100%; }
.view { display: grid; gap: 20px; align-content: start; }
.view[hidden] { display: none; }
.view-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.view-head h2 { font-size: 24px; font-weight: 700; }
.view-head p { color: var(--text-2); font-size: 14px; margin-top: 4px; }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { padding: 18px 20px; display: grid; gap: 6px; }
.kpi-label { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; font-weight: 500; }
.kpi-label .ph { font-size: 18px; color: var(--accent); }
.kpi-value { font: 600 32px var(--mono); letter-spacing: -.02em; direction: ltr; text-align: right; line-height: 1.2; }
.kpi-sub { color: var(--text-3); font-size: 12px; }

/* ---------- Grids ---------- */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.grid-2-even { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-people { display: grid; grid-template-columns: minmax(300px, .8fr) minmax(0, 1.6fr); gap: 20px; align-items: start; }

/* ---------- Segmented control ---------- */
.segmented { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); gap: 2px; }
.segmented button { white-space: nowrap; padding: 5px 13px; border: 0; border-radius: 999px; background: transparent; color: var(--text-2); font-size: 13px; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); }

/* ---------- Charts ---------- */
.chart-wrap { position: relative; }
.chart { width: 100%; height: 260px; direction: ltr; }
.chart text { font-family: var(--mono); font-size: 11px; fill: var(--text-3); }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .series-line { fill: none; stroke: var(--chart-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .series-area { fill: var(--chart-1); opacity: .12; }
.chart .series-bar { fill: var(--chart-1); }
.chart .series-bar.is-hover { opacity: .75; }
.chart .crosshair { stroke: var(--line-strong); stroke-width: 1; }
.chart .hover-dot { fill: var(--chart-1); stroke: var(--surface); stroke-width: 2; }
.chart-tooltip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 120px; padding: 8px 11px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-md); font-size: 12px; color: var(--text-2);
  transform: translate(-50%, calc(-100% - 12px));
}
.chart-tooltip strong { display: block; font: 600 15px var(--mono); color: var(--text); direction: ltr; text-align: start; }
.chart-empty { height: 260px; display: grid; place-items: center; color: var(--text-3); font-size: 13px; text-align: center; }
.chart-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 12px; }
.chart-table th, .chart-table td { padding: 6px 8px; text-align: start; border-bottom: 1px solid var(--line); }
.chart-table td.num { text-align: left; }

.breakdown { display: grid; gap: 14px; }
.breakdown-row { display: grid; gap: 6px; }
.breakdown-row .top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--text-2); }
.breakdown-row .top .num { color: var(--text); font-weight: 500; }
.breakdown-bar { height: 8px; border-radius: 4px; background: var(--chart-1); min-width: 2px; transition: width .6s var(--ease); }

/* ---------- Meters ---------- */
.meters { display: grid; gap: 18px; }
.meter { display: grid; gap: 7px; }
.meter-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--text-2); }
.meter-top .num { color: var(--text); font-weight: 500; }
.meter-track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter-fill { height: 100%; border-radius: inherit; background: var(--chart-1); transition: width .6s var(--ease); }
.meter-fill.warn { background: var(--warn); }
.meter-fill.danger { background: var(--danger); }

/* ---------- Activity feed ---------- */
.feed { display: grid; }
.feed-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 0; }
.feed-item + .feed-item { border-top: 1px solid var(--line); }
.feed-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2); color: var(--text-2); font-size: 17px; }
.feed-icon.accent { background: var(--accent-soft); color: var(--accent); }
.feed-icon.danger { background: var(--danger-soft); color: var(--danger); }
.feed-item strong { display: block; font-size: 14px; font-weight: 600; }
.feed-item span { color: var(--text-3); font-size: 12px; }
.feed-item time { color: var(--text-3); font-size: 12px; white-space: nowrap; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { padding: 10px 16px; text-align: start; font-size: 12px; font-weight: 600; color: var(--text-3); background: var(--bg-elevated); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--bg-elevated); }
.table .actions { display: flex; justify-content: flex-end; gap: 6px; }
.person-cell { display: flex; align-items: center; gap: 12px; }
.person-cell .avatar { width: 34px; height: 34px; font: 600 14px var(--font); background: var(--surface-3); color: var(--text-2); }
.toolbar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.search { position: relative; min-width: 220px; flex: 1 1 220px; max-width: 320px; }
.search .ph { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 17px; }
.search .input { padding-inline-start: 38px; min-height: 40px; }

/* ---------- Upload preview ---------- */
.upload-preview { position: relative; display: none; border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.upload-preview.visible { display: block; }
.upload-preview img { width: 100%; max-height: 300px; object-fit: contain; }
.upload-preview .icon-btn { position: absolute; top: 10px; inset-inline-end: 10px; }
.match-results { display: grid; gap: 10px; }
.match-card { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; }
.match-card .ph-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; font-size: 22px; background: var(--surface-2); color: var(--text-3); }
.match-card.found { border-color: var(--accent-line); background: var(--accent-soft); }
.match-card.found .ph-icon { background: var(--accent); color: var(--accent-ink); }
.match-card strong { display: block; font-size: 15px; }
.match-card span { color: var(--text-2); font-size: 13px; }
.match-score { font: 600 22px var(--mono); color: var(--accent); }

/* ---------- Snapshots ---------- */
.chip-filter { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-filter button { padding: 6px 13px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--text-2); font-size: 13px; cursor: pointer; }
.chip-filter button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); font-weight: 600; }
.chip-filter .num { margin-inline-start: 4px; opacity: .8; }
.snapshot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.snapshot-card { overflow: hidden; display: grid; }
.snapshot-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface-2); cursor: zoom-in; }
.snapshot-meta { padding: 12px 14px; display: grid; gap: 6px; }
.snapshot-meta .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.snapshot-meta strong { font-size: 14px; }
.snapshot-meta small { color: var(--text-3); font-size: 12px; }
.image-viewer { width: min(94vw, 960px); }
.image-viewer img { width: 100%; max-height: 78vh; object-fit: contain; background: #0a0e11; }

/* ---------- System ---------- */
.kv { display: grid; gap: 0; }
.kv-row { display: flex; justify-content: space-between; gap: 14px; padding: 11px 0; font-size: 14px; }
.kv-row + .kv-row { border-top: 1px solid var(--line); }
.kv-row span:first-child { color: var(--text-2); }
.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.perm { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--bg-elevated); border: 1px solid var(--line); }
.perm .ph { color: var(--ok); font-size: 19px; margin-top: 2px; }
.perm strong { display: block; font-size: 14px; }
.perm code { font: 400 11px var(--mono); color: var(--text-3); direction: ltr; display: block; text-align: start; }
.model-list { display: grid; gap: 10px; }
.model-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--bg-elevated); }
.model-row .ph { color: var(--accent); font-size: 20px; }
.model-row strong { font: 500 14px var(--mono); direction: ltr; }
.model-row span { color: var(--text-2); font-size: 13px; margin-inline-start: auto; }

.load-more { justify-self: center; }
.gate { min-height: 100dvh; display: grid; place-items: center; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-people { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .dash-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; width: 280px; transform: translateX(100%);
    transition: transform .3s var(--ease); box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 45; background: var(--scrim); }
  .sidebar-toggle { display: inline-grid; }
  .dash-top { padding: 0 16px; }
  .dash-top .updated { display: none; }
  .dash-content { padding: 18px 16px; }
  .grid-2-even, .perm-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .panel-head { flex-wrap: wrap; }
  .kpis { grid-template-columns: 1fr; }
  .kpi-value { font-size: 28px; }
  .table th:nth-child(3), .table td:nth-child(3) { display: none; }
}

/* ---------- Shared stage helpers (dashboard) ---------- */
.stage-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 28px; text-align: center; color: var(--text-3); font-size: 13px; }
.stage-empty .ph { font-size: 40px; color: var(--line-strong); }
.stage-empty strong { color: var(--text-2); font-size: 15px; }
.loader { position: absolute; inset: 0; z-index: 3; display: none; place-items: center; background: color-mix(in srgb, var(--bg-elevated) 86%, transparent); backdrop-filter: blur(3px); }
.loader.visible { display: grid; }
.loader-box { display: grid; justify-items: center; gap: 12px; color: var(--accent); font-size: 14px; font-weight: 600; text-align: center; padding: 0 20px; }
.entity-list { display: grid; gap: 8px; max-height: 460px; overflow: auto; }
.entity { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; }
.entity b { font-size: 14px; font-weight: 600; }
.entity small { display: block; color: var(--text-3); font-size: 12px; }
.entity em { font: 500 13px var(--mono); font-style: normal; color: var(--accent); }
.an-stage { position: relative; display: grid; place-items: center; min-height: 260px; overflow: hidden; border-radius: 14px; border: 1px solid var(--line); background: #0a0e11; }
.an-stage img { grid-area: 1 / 1; max-width: 100%; max-height: 520px; }
.an-stage canvas { grid-area: 1 / 1; max-width: 100%; max-height: 520px; pointer-events: none; }
.v-stage { background: var(--bg-elevated); background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 18px 18px; }
.v-stage img { max-height: 560px; }

/* ---------- Live analysis ---------- */
.live-stage {
  position: relative; overflow: hidden; border-radius: 18px; background: #070a0c; border: 1px solid var(--line);
  aspect-ratio: 16 / 9; max-height: 78vh; display: grid; place-items: center;
}
.live-stage video, .live-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.live-stage video { opacity: 0; }
.live-stage.is-live video { opacity: 1; }
.live-idle { position: relative; z-index: 1; display: grid; justify-items: center; gap: 8px; color: #8d9da5; font-size: 13px; text-align: center; }
.live-idle .ph { font-size: 44px; color: #31404a; }
.live-idle strong { color: #e7edef; font-size: 16px; }
.live-loading { position: absolute; inset: 0; z-index: 4; display: grid; place-content: center; justify-items: center; gap: 12px; color: #e7edef; background: rgb(7 10 12 / .7); font-size: 14px; }
.live-loading[hidden] { display: none; }
/* HUD sits on the left edge of the video (inline-end in RTL). */
.live-hud {
  position: absolute; z-index: 3; inset-block: 14px; inset-inline-end: 14px; width: min(300px, 38%);
  display: flex; flex-direction: column; gap: 10px; padding: 14px; overflow: auto;
  border-radius: 14px; border: 1px solid rgb(255 255 255 / .12); color: #e7edef;
  background: rgb(8 12 14 / .66); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .08);
}
.live-hud[hidden] { display: none; }
@media (prefers-reduced-transparency: reduce) { .live-hud { background: #0b1013; backdrop-filter: none; } }
.hud-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: #a9b8bf; }
.hud-live { display: inline-flex; align-items: center; gap: 6px; color: #f87171; font-weight: 600; }
.hud-dot { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.hud-block { display: grid; gap: 6px; padding-top: 10px; border-top: 1px solid rgb(255 255 255 / .1); }
.hud-block h4 { font-size: 12px; font-weight: 600; color: #8d9da5; }
.hud-verdict { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.hud-verdict strong { font-size: 22px; font-weight: 700; color: #5eead4; }
.hud-verdict .num { font-size: 18px; color: #e7edef; }
.hud-verdict.is-alert strong { color: #f87171; }
.hud-bar { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(40px, 1fr) 38px; align-items: center; gap: 8px; font-size: 12px; color: #c5d1d6; }
.hud-bar span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-track { height: 5px; border-radius: 999px; background: rgb(255 255 255 / .1); overflow: hidden; }
.hud-fill { height: 100%; border-radius: inherit; background: #2dd4bf; transition: width .3s var(--ease); }
.hud-fill.is-alert { background: #f87171; }
.hud-bar .num { font-size: 11px; color: #e7edef; }
.hud-state { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.hud-state div { display: grid; }
.hud-state span { font-size: 11px; color: #8d9da5; }
.hud-state strong { font-size: 13px; font-weight: 600; }
.hud-empty { font-size: 12px; color: #a9b8bf; }
.live-alert {
  position: absolute; z-index: 5; top: 16px; inset-inline-start: 16px; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: 12px; background: #dc2626; color: #fff; font-weight: 600; font-size: 15px;
  box-shadow: 0 10px 30px -8px rgb(220 38 38 / .6); animation: alert-in .3s var(--ease);
}
.live-alert[hidden] { display: none; }
.live-alert .ph { font-size: 20px; }
@keyframes alert-in { from { opacity: 0; transform: translateY(-8px); } }
.alert-list { display: grid; max-height: 360px; overflow: auto; }
.alert-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; }
.alert-row + .alert-row { border-top: 1px solid var(--line); }
.alert-row img { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; }
.alert-row strong { display: block; font-size: 14px; color: var(--danger); }
.alert-row span { color: var(--text-3); font-size: 12px; }

/* ---------- Reports ---------- */
.report-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.report-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.report-card { display: grid; padding: 0; overflow: hidden; text-align: start; cursor: pointer; color: inherit; font: inherit; transition: border-color .2s var(--ease), transform .2s var(--ease); }
.report-card:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.report-card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: var(--surface-2); }
.report-card-body { display: grid; gap: 4px; padding: 12px 14px; }
.report-card-body .chip { justify-self: start; }
.report-card-body strong { font-size: 14px; }
.report-card-body span:last-child { color: var(--text-3); font-size: 12px; }
.rp-list { display: grid; gap: 22px; }
.rp-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-panel); overflow: hidden; break-inside: avoid; }
.rp-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 22px; border-bottom: 2px solid var(--accent); background: var(--bg-elevated); }
.rp-brand { display: flex; align-items: center; gap: 12px; }
.rp-brand h3 { font-size: 19px; font-weight: 700; }
.rp-brand span:not(.brand-mark) { color: var(--text-3); font-size: 12px; }
.rp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rp-section { padding: 20px 22px; display: grid; gap: 14px; }
.rp-section + .rp-section { border-top: 1px solid var(--line); }
.rp-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.rp-title .ph { color: var(--accent); font-size: 19px; }
.rp-figures { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.rp-figure { margin: 0; display: grid; gap: 8px; }
.rp-figure img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: #0a0e11; border: 1px solid var(--line); }
.rp-figure figcaption { display: grid; text-align: center; }
.rp-figure strong { font-size: 13px; }
.rp-figure span { font-size: 11px; color: var(--text-3); }
.rp-two { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.rp-method h5 { font: 600 14px var(--mono); color: var(--accent); }
.rp-method-sub { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.rp-bars { display: grid; gap: 6px; }
.rp-bar-row { display: grid; grid-template-columns: 70px minmax(0, 1fr) 54px; gap: 10px; align-items: center; font-size: 13px; color: var(--text-2); }
.rp-bar-row.is-top { color: var(--text); font-weight: 600; }
.rp-bar-track { height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.rp-bar-fill { height: 100%; border-radius: inherit; background: var(--chart-1); }
.rp-bar-row.is-top .rp-bar-fill { background: var(--accent); }
.rp-bar-value { font-size: 12px; }
.rp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rp-table th { text-align: start; padding: 8px 10px; color: var(--text-3); font-weight: 600; font-size: 12px; background: var(--bg-elevated); border-bottom: 1px solid var(--line); }
.rp-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.rp-table tr:last-child td { border-bottom: 0; }
.rp-code { font-weight: 600; color: var(--accent); }
.rp-latin { display: block; font: 400 11px var(--mono); color: var(--text-3); direction: ltr; text-align: right; }
.rp-strength { min-width: 140px; display: grid; grid-template-columns: minmax(60px, 1fr) 40px; gap: 8px; align-items: center; }
.rp-kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.rp-kv-cell { display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--bg-elevated); border: 1px solid var(--line); }
.rp-kv-cell span { font-size: 12px; color: var(--text-3); }
.rp-kv-cell strong { font-size: 15px; }
.rp-kv-cell small { font-size: 11px; color: var(--text-3); line-height: 1.6; }
.rp-note { font-size: 13px; color: var(--text-2); }
.rp-lbp-chart { width: 100%; height: auto; direction: ltr; }
.rp-lbp-chart .rp-lbp-bar { fill: var(--chart-1); }
.rp-lbp-chart .rp-lbp-bar.is-other { fill: var(--text-3); }
.rp-lbp-chart text { font: 10px var(--mono); fill: var(--text-3); }
.rp-steps { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; counter-reset: step; }
.rp-steps li { position: relative; display: grid; gap: 4px; padding: 12px; border-radius: 12px; background: var(--bg-elevated); border: 1px solid var(--line); font-size: 12px; color: var(--text-2); counter-increment: step; }
.rp-steps li::before { content: counter(step); width: 24px; height: 24px; display: grid; place-items: center; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: 600 12px var(--mono); }
.rp-steps strong { font-size: 13px; color: var(--text); }
.rp-disclaimer { font-size: 12px; color: var(--text-3); padding: 12px 14px; border-inline-start: 3px solid var(--warn); background: var(--warn-soft); border-radius: 8px; }

@media (max-width: 1100px) { .rp-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .live-stage { aspect-ratio: 3 / 4; }
  .live-hud { inset-block: auto 10px; inset-inline: 10px; width: auto; max-height: 45%; }
  .rp-two { grid-template-columns: 1fr; }
}

/* ---------- Print a single report ---------- */
@media print {
  @page { size: A4; margin: 10mm; }
  body.dash { background: #fff; }
  body[data-printing] .sidebar, body[data-printing] .dash-top, body[data-printing] .report-actions,
  body[data-printing] .view-head, body[data-printing] .grid-2, body[data-printing] .report-index { display: none !important; }
  body[data-printing] .dash-shell { display: block; }
  body[data-printing] .dash-content { padding: 0; }
  .rp-card { border: 1px solid #ccc; break-inside: auto; }
  .rp-section { break-inside: avoid; }
  .rp-figure img, .rp-bar-fill, .rp-steps li::before { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* Case report (automatic capture) */
.rp-case { background: color-mix(in srgb, var(--danger-soft) 55%, transparent); }
.rp-case .rp-title .ph { color: var(--danger); }
.rp-case-chart { width: 100%; height: auto; direction: ltr; }
.rp-case-chart text { font: 10px var(--mono); fill: var(--text-3); }
.rp-case-chart .rp-grid { stroke: var(--chart-grid); }
.rp-case-chart .rp-threshold { stroke: var(--danger); stroke-dasharray: 5 5; }
.rp-case-chart .rp-threshold-label { fill: var(--danger); font-family: var(--font); font-size: 11px; }
.rp-case-chart .rp-case-line { fill: none; stroke: var(--chart-1); stroke-width: 2; stroke-linejoin: round; }
.rp-case-chart .rp-case-dot { fill: var(--chart-1); stroke: var(--surface); stroke-width: 2; }
.rp-case-chart .rp-case-dot.is-hot { fill: var(--danger); }
.report-card.is-case { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }

.rp-legend { display: flex; flex-wrap: wrap; gap: 18px; font-size: 12px; color: var(--text-2); }
.rp-legend span { display: inline-flex; align-items: center; gap: 7px; }
.rp-swatch-line { width: 18px; height: 2px; background: var(--chart-1); }
.rp-swatch-hot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); }
.rp-swatch-threshold { width: 18px; border-top: 2px dashed var(--danger); }

/* Faces, objects and dangers */
.feed-icon.face-number { color: #fff; font-weight: 700; }
.subhead-sm { margin-top: 16px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.entity.is-danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); background: var(--danger-soft); }
.entity.is-danger b, .entity.is-danger em { color: var(--danger); }
.v-stage .live-alert { position: absolute; }
.hud-danger { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: #dc2626; color: #fff; font-size: 14px; }
.hud-danger .ph { font-size: 18px; }
.hud-objects { font-size: 12px; color: #c5d1d6; }
.rp-card.has-face-color { border-top: 4px solid var(--face-color); }
.rp-face-number { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; color: #fff; font-weight: 700; font-size: 16px; }
.rp-danger { display: flex; gap: 12px; align-items: flex-start; margin: 16px 22px 0; padding: 14px 16px; border-radius: 12px; background: #dc2626; color: #fff; }
.rp-danger .ph { font-size: 24px; }
.rp-danger strong { display: block; font-size: 15px; }
.rp-danger span { font-size: 13px; opacity: .92; }
.rp-attached { margin: 0; display: grid; gap: 10px; }
.rp-attached img { width: 100%; max-height: 640px; object-fit: contain; border-radius: 12px; background: #0a0e11; border: 1px solid var(--line); }
.rp-attached figcaption { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--text-2); }
.rp-attached-actions { display: flex; gap: 8px; }
.rp-face-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.rp-face-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-elevated); }
.rp-face-item strong { display: block; font-size: 14px; }
.rp-face-item span { font-size: 12px; color: var(--text-3); }
.rp-table tr.is-danger td { background: var(--danger-soft); }
@media print { .rp-attached-actions { display: none; } .rp-danger, .rp-face-number { print-color-adjust: exact; -webkit-print-color-adjust: exact; } }

/* Analysis center */
.segmented-lg button { display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; font-size: 14px; }
.segmented-lg .ph { font-size: 17px; }
.center-controls { display: grid; gap: 16px; }
.control-group { display: grid; gap: 8px; }
.control-group .field-label { display: flex; align-items: center; gap: 6px; }
.control-group .field-label .ph { color: var(--accent); font-size: 16px; }
.center-actions { align-items: center; }
[data-pane] { display: grid; gap: 20px; }
[data-pane][hidden] { display: none; }

/* eMotion-style expression table on the video */
.hud-emotions { display: grid; gap: 3px; }
.hud-emo {
  position: relative; display: flex; justify-content: space-between; align-items: center; gap: 8px; overflow: hidden;
  padding: 5px 9px; border-radius: 6px; font-size: 13px; color: #c5d1d6; background: rgb(255 255 255 / .04);
}
.hud-emo > span { position: relative; z-index: 1; }
.hud-emo .num { font-size: 12px; color: #e7edef; }
.hud-emo-fill { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--emo); opacity: .22; transition: width .25s var(--ease); }
.hud-emo.is-top { color: #fff; font-weight: 700; }
.hud-emo.is-top .hud-emo-fill { width: 100% !important; opacity: .92; }
.hud-emo.is-watched > span:first-of-type::after { content: " •"; color: #fca5a5; }
.hud-confirm { font-size: 12px; color: #a9b8bf; padding: 6px 9px; border-radius: 6px; background: rgb(255 255 255 / .05); }
.hud-confirm.is-alert { color: #fff; background: #dc2626; }
.hud-status { display: grid; gap: 3px; font-size: 12px; }
.hud-status div { display: flex; justify-content: space-between; gap: 8px; }
.hud-status span { color: #8d9da5; }
.hud-status strong { font-weight: 600; color: #e7edef; text-align: end; }
@media (prefers-reduced-motion: reduce) { .hud-emo-fill { transition: none; } }

/* =====================================================================
   Operations room (compound monitoring)
   ===================================================================== */
.nav-badge { margin-inline-start: auto; min-width: 22px; height: 22px; padding: 0 7px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--danger); color: #fff; font: 600 12px var(--mono); }
.nav-badge[hidden] { display: none; }
.kpi-alert.is-hot { border-color: color-mix(in srgb, var(--danger) 55%, var(--line)); background: color-mix(in srgb, var(--danger-soft) 70%, var(--surface)); }
.kpi-alert.is-hot .kpi-value, .kpi-alert.is-hot .kpi-label .ph { color: var(--danger); }
.ops-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 20px; align-items: start; }
.map-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-3); }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.legend-dot.is-ok { background: var(--chart-1); } .legend-dot.is-alert { background: var(--danger); } .legend-dot.is-off { background: var(--line-strong); }
#ops-alerts { max-height: 520px; overflow: auto; }

/* Compound map (functional site schematic) */
.compound-map svg { width: 100%; height: auto; display: block; }
.map-ground { fill: var(--bg-elevated); stroke: var(--line-strong); stroke-width: .4; }
.map-road { fill: none; stroke: var(--surface-3); stroke-width: 3; stroke-linecap: round; }
.map-gate { fill: var(--warn); }
.map-area { stroke-width: .3; }
.area-building { fill: var(--surface-3); stroke: var(--line-strong); }
.area-play { fill: color-mix(in srgb, var(--chart-1) 16%, var(--surface)); stroke: color-mix(in srgb, var(--chart-1) 40%, var(--line)); }
.area-green { fill: color-mix(in srgb, #22c55e 14%, var(--surface)); stroke: color-mix(in srgb, #22c55e 35%, var(--line)); }
.area-parking { fill: var(--surface-2); stroke: var(--line-strong); stroke-dasharray: 1 1; }
.area-school { fill: color-mix(in srgb, var(--accent) 7%, var(--surface)); stroke: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.area-room { fill: var(--surface); stroke: var(--line); stroke-dasharray: .8 .6; }
.area-plaza { fill: color-mix(in srgb, var(--warn) 9%, var(--surface)); stroke: color-mix(in srgb, var(--warn) 35%, var(--line)); }
.area-pool { fill: color-mix(in srgb, #0ea5e9 16%, var(--surface)); stroke: color-mix(in srgb, #0ea5e9 45%, var(--line)); }
.map-label { font: 500 2.1px var(--font); fill: var(--text-3); direction: rtl; }
.map-gate-label { fill: var(--warn); font-weight: 700; }
.map-cam { cursor: pointer; }
.map-cam:focus-visible { outline: none; }
.map-cam:focus-visible .map-dot { stroke: var(--text); stroke-width: .8; }
.map-dot { fill: var(--chart-1); stroke: var(--surface); stroke-width: .6; }
.map-code { font: 600 2.4px var(--mono); fill: var(--text); }
.map-cam.has-alert .map-dot { fill: var(--danger); }
.map-cam.is-off .map-dot { fill: var(--line-strong); }
.map-pulse { fill: var(--danger); opacity: .35; transform-box: fill-box; transform-origin: center; }
@media (prefers-reduced-motion: no-preference) { .map-pulse { animation: map-pulse 1.6s ease-out infinite; } }
@keyframes map-pulse { 0% { transform: scale(.5); opacity: .55; } 100% { transform: scale(1.6); opacity: 0; } }

/* Camera wall */
.area-filter { margin-bottom: 14px; }
.area-filter:empty { display: none; }
.grid-3-even { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 1100px) { .grid-3-even { grid-template-columns: 1fr; } }
.camera-wall { --cols: 2; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 16px; }
.camera-wall-mini { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1400px) { .camera-wall-mini { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .camera-wall-mini { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cam-tile { display: grid; gap: 8px; }
.cam-screen { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 14px; background: #070a0c; border: 1px solid var(--line); }
.cam-screen[role="button"] { cursor: pointer; }
.cam-screen[role="button"]:hover { border-color: var(--accent-line); }
.cam-screen img, .cam-screen canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.cam-screen .empty-state { position: absolute; inset: 0; color: #8d9da5; }
.cam-head { position: absolute; z-index: 2; inset-inline: 0; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; background: linear-gradient(180deg, rgb(5 8 10 / .75), transparent); color: #e7edef; font-size: 13px; }
.cam-head strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cam-status { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: #a9b8bf; white-space: nowrap; }
.cam-status i { width: 7px; height: 7px; border-radius: 50%; background: #64748b; }
.cam-status.is-on i { background: #ef4444; }
@media (prefers-reduced-motion: no-preference) { .cam-status.is-on i { animation: pulse 1.4s infinite; } }
.cam-alert { position: absolute; z-index: 2; inset-inline-start: 10px; bottom: 10px; padding: 4px 10px; border-radius: 8px; background: #dc2626; color: #fff; font-size: 12px; font-weight: 600; }
.cam-alert[hidden] { display: none; }
.cam-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.cam-foot .cam-counts { margin-inline-start: auto; font-family: var(--mono); color: var(--text-2); }
.is-mini .cam-head { font-size: 12px; padding: 6px 8px; }
.focus-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 20px; align-items: start; margin-top: 14px; }

/* Feed links */
.feed-link { color: inherit; border-radius: 10px; }
.feed-link:hover strong { color: var(--accent); }
.feed-side { display: grid; justify-items: end; gap: 4px; }
.feed-side time { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.sim-chip { margin-inline-start: 6px; font-size: 11px; padding: 1px 8px; background: var(--warn-soft); color: var(--warn); }
.chip.likely { font-size: 11px; padding: 1px 8px; margin-inline-start: 6px; font-weight: 600; }
.likely-high { background: var(--danger-soft); color: var(--danger); }
.likely-mid { background: var(--warn-soft); color: var(--warn); }
.likely-low { background: var(--surface-2); color: var(--text-3); }

/* Alerts */
.alerts-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.alerts-filters .select { width: auto; min-width: 180px; min-height: 38px; }
.alert-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.alert-card { position: relative; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; border-radius: var(--radius-panel); background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--line-strong); color: inherit; transition: transform .2s var(--ease), border-color .2s var(--ease); }
.alert-card:hover { transform: translateY(-2px); }
.alert-card.sev-critical { border-top-color: var(--danger); }
.alert-card.sev-high { border-top-color: var(--warn); }
.alert-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #0a0e11; }
.alert-card-body { display: grid; gap: 8px; padding: 12px 14px 14px; }
.alert-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.alert-card-top strong { display: inline-flex; align-items: center; gap: 7px; font-size: 15px; }
.alert-card-top .ph { color: var(--accent); font-size: 18px; }
.alert-card.sev-critical .alert-card-top .ph { color: var(--danger); }
.alert-card p { font-size: 13px; color: var(--text-2); line-height: 1.7; }
.alert-card-meta { font-size: 12px; color: var(--text-3); }
.alert-card-link { display: grid; color: inherit; text-decoration: none; }
.alert-card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.alert-select { position: absolute; inset-block-start: 10px; inset-inline-start: 10px; z-index: 1; display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px; background: rgb(255 255 255 / .92); box-shadow: 0 1px 4px rgb(0 0 0 / .25); cursor: pointer; }
.alert-select input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.alert-card-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 14px 14px; }
.btn-icon-danger { color: var(--text-3); padding-inline: 10px; }
.btn-icon-danger:hover:not(:disabled) { color: var(--danger); background: var(--danger-soft); }
.btn .spinner { width: 16px; height: 16px; border-width: 2px; }
.repeat-chip { font-size: 11px; padding: 1px 8px; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.alerts-bulk { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 14px; border-radius: 12px;
  background: var(--accent-soft); border: 1px solid var(--accent-line); font-size: 14px; font-weight: 600; }
.alerts-bulk #alerts-bulk-count { margin-inline-end: auto; }
.alerts-bulk[hidden] { display: none; }

/* Incident report */
.incident { border-top: 4px solid var(--line-strong); }
.incident.sev-critical { border-top-color: var(--danger); }
.incident.sev-high { border-top-color: var(--warn); }
.incident-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-size: 24px; }
.incident-icon.sev-critical { background: var(--danger); color: #fff; }
.incident-icon.sev-high { background: var(--warn-soft); color: var(--warn); }
.incident-sim { margin: 16px 22px 0; }
.incident-summary { font-size: 16px; font-weight: 500; }
.incident-history { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.incident-history li { display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--bg-elevated); border: 1px solid var(--line); }
.incident-history li span { font-size: 12px; color: var(--text-3); }
.incident-history .muted { color: var(--text-3); font-size: 13px; }
.incident-form { display: grid; gap: 10px; }
.incident-form textarea { resize: vertical; min-height: 64px; }

/* Zones editor */
.zones-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 20px; align-items: start; }
.zone-canvas-wrap { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #070a0c; }
.zone-canvas-wrap img, .zone-canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.zone-canvas-wrap.is-drawing canvas { cursor: crosshair; outline: 2px solid #fbbf24; outline-offset: -2px; }
.zone-list { display: grid; gap: 8px; }
.zone-row { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-elevated); }
.zone-row strong { display: block; font-size: 14px; }
.zone-row span { font-size: 12px; color: var(--text-3); }
.zone-swatch { width: 14px; height: 14px; border-radius: 4px; }
.zone-swatch.is-child { background: #2dd4bf; } .zone-swatch.is-danger { background: #ef4444; }
.rules-form { display: grid; gap: 16px; }
.rule-group { margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 12px; }
.rule-group legend { padding: 0 6px; font-weight: 600; font-size: 14px; }

/* Critical alert banner (any dashboard page) */
.critical-banner {
  position: fixed; z-index: 90; top: 76px; left: 50%; transform: translateX(-50%); width: min(720px, calc(100% - 32px));
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: #b91c1c; color: #fff;
  box-shadow: 0 20px 50px -12px rgb(185 28 28 / .7); animation: alert-in .3s var(--ease);
}
.critical-banner > .ph { font-size: 28px; }
.critical-banner div { min-width: 0; flex: 1; display: grid; }
.critical-banner strong { font-size: 15px; }
.critical-banner span { font-size: 13px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.critical-banner .btn { background: #fff; color: #b91c1c; }
.critical-banner .icon-btn { background: transparent; border-color: rgb(255 255 255 / .4); color: #fff; }

@media (max-width: 1200px) { .ops-grid, .focus-grid, .zones-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .camera-wall { --cols: 1 !important; } }
@media print {
  body[data-printing="incident"] .sidebar, body[data-printing="incident"] .dash-top, body[data-printing="incident"] .report-actions,
  body[data-printing="incident"] .incident-form, body[data-printing="incident"] .critical-banner { display: none !important; }
  body[data-printing="incident"] .dash-shell { display: block; }
}

/* Live monitoring switch */
.monitor-control { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-radius: var(--radius-panel); border: 1px solid var(--line); background: var(--surface); }
.monitor-control[data-state="running"] { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); background: color-mix(in srgb, var(--ok-soft) 60%, var(--surface)); }
.monitor-control[data-state="stopped"] { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: color-mix(in srgb, var(--warn-soft) 70%, var(--surface)); }
.mc-status { display: flex; align-items: center; gap: 14px; }
.mc-status div { display: grid; }
.mc-status strong { font-size: 17px; }
.mc-status span { font-size: 13px; color: var(--text-2); }
.mc-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--line-strong); flex: 0 0 auto; }
[data-state="running"] .mc-dot { background: var(--ok); box-shadow: 0 0 0 5px color-mix(in srgb, var(--ok) 22%, transparent); }
[data-state="stopped"] .mc-dot { background: var(--warn); }
@media (prefers-reduced-motion: no-preference) { [data-state="running"] .mc-dot { animation: pulse 1.6s infinite; } }
.monitor-control .btn-danger { background: var(--danger); color: #fff; border-color: transparent; }
.monitor-control .btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 85%, #000); }
.monitor-control .btn .spinner { width: 18px; height: 18px; border-width: 2px; border-color: rgb(255 255 255 / .35); border-top-color: currentColor; }
.monitor-pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); color: var(--text-2); white-space: nowrap; }
.monitor-pill[hidden] { display: none; }
.monitor-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.monitor-pill[data-state="running"] { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.monitor-pill[data-state="running"] i { background: var(--ok); }
.monitor-pill[data-state="stopped"] { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); background: var(--warn-soft); }
.monitor-pill[data-state="stopped"] i { background: var(--warn); }
@media (max-width: 520px) { .monitor-control .btn { width: 100%; } }
.rp-history { display: grid; gap: 4px; padding-inline-start: 18px; font-size: 13px; color: var(--text-2); }

/* Users */
.avatar-sm { width: 30px; height: 30px; font-size: 13px; flex: 0 0 auto; }
tr.is-muted td { color: var(--text-3); }
.user-form { display: grid; gap: 16px; padding: 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.user-form[hidden] { display: none; }
.user-form h3 { font-size: 16px; }
.user-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1; }
.preset-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.perm-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.perm-group { display: grid; gap: 8px; align-content: start; margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.perm-group legend { padding: 0 6px; font-size: 13px; font-weight: 700; color: var(--text); }
.perm-check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; line-height: 1.5; }
.perm-check input { margin-top: 3px; accent-color: var(--accent); }
.perm-check:has(input:disabled) { opacity: .5; cursor: not-allowed; }
@media (max-width: 1100px) { .perm-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .perm-picker, .user-form-grid { grid-template-columns: 1fr; } }
