/* CourtWatch dashboard — design tokens */
:root {
  --bg: #0b0f14;
  --bg-2: #0f141b;
  --panel: #131a22;
  --panel-2: #18212b;
  --line: #233040;
  --line-soft: #1b2531;
  --text: #e6edf3;
  --text-2: #a9b6c3;
  --muted: #6f7f90;
  --accent: #14b8a6;
  --accent-2: #0ea5e9;
  --accent-soft: rgba(20, 184, 166, .14);
  --in: #22c55e;
  --in-soft: rgba(34, 197, 94, .14);
  --out: #f97362;
  --out-soft: rgba(249, 115, 98, .14);
  --warn: #f5b041;
  --warn-soft: rgba(245, 176, 65, .14);
  --bad: #ef4444;
  --bad-soft: rgba(239, 68, 68, .14);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, .14);
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.25);
  --radius: 14px;
  --radius-sm: 9px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f6f9; --bg-2: #eef1f5; --panel: #ffffff; --panel-2: #f7f9fb; --line: #dfe5ec; --line-soft: #ebeff4;
    --text: #0f1720; --text-2: #3d4b5a; --muted: #758396; --accent: #0d9488; --accent-2: #0284c7;
    --accent-soft: rgba(13,148,136,.10); --in: #16a34a; --in-soft: rgba(22,163,74,.10); --out: #e5533f;
    --out-soft: rgba(229,83,63,.10); --warn-soft: rgba(245,176,65,.16); --shadow: 0 1px 2px rgba(16,24,40,.05), 0 6px 18px rgba(16,24,40,.06);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f4f6f9; --bg-2: #eef1f5; --panel: #ffffff; --panel-2: #f7f9fb; --line: #dfe5ec; --line-soft: #ebeff4;
  --text: #0f1720; --text-2: #3d4b5a; --muted: #758396; --accent: #0d9488; --accent-2: #0284c7;
  --accent-soft: rgba(13,148,136,.10); --in: #16a34a; --in-soft: rgba(22,163,74,.10); --out: #e5533f;
  --out-soft: rgba(229,83,63,.10); --warn-soft: rgba(245,176,65,.16); --shadow: 0 1px 2px rgba(16,24,40,.05), 0 6px 18px rgba(16,24,40,.06);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* layout */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 20px 14px;
  background: var(--bg-2); border-right: 1px solid var(--line-soft); }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 8px; }
.logo { color: var(--accent); }
.logo svg { width: 34px; height: 34px; }
.brand-name { font-weight: 700; letter-spacing: -.01em; font-size: 15.5px; }
.brand-sub { color: var(--muted); font-size: 12px; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 10px; color: var(--text-2); font-weight: 500; position: relative; }
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav a.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--accent); }
.nav .badge { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700; background: var(--warn-soft); color: var(--warn);
  padding: 1px 7px; border-radius: 99px; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 6px; }
.conn { display: inline-flex; align-items: center; gap: 8px; padding: 7px 11px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line-soft);
  font-size: 12.5px; color: var(--text-2); width: fit-content; }
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.conn.ok .dot { background: var(--in); box-shadow: 0 0 0 4px var(--in-soft); animation: pulse 2s infinite; }
.conn.bad .dot { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px transparent; } }
.foot-meta { color: var(--muted); font-size: 11.5px; line-height: 1.6; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 16px 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-soft); }
.titles { min-width: 0; }
.titles h1 { margin: 0; font-size: 19px; letter-spacing: -.015em; }
.subtitle { color: var(--muted); font-size: 12.5px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.view { padding: 22px 28px 48px; display: flex; flex-direction: column; gap: 18px; }

/* controls */
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; color: var(--text-2); }
.icon-btn:hover { color: var(--text); border-color: var(--muted); }
.date-ctl { display: flex; align-items: center; gap: 6px; }
.date-ctl input, .input, select.input { height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); }
.input:focus, .date-ctl input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.chip-toggle { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; color: var(--text-2); font-size: 13px; user-select: none; }
.chip-toggle input { accent-color: var(--accent); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--panel-2); cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text); white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #04211e; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--panel); }
.seg button { border: 0; background: transparent; padding: 0 12px; height: 32px; cursor: pointer; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.seg button.on { background: var(--accent-soft); color: var(--accent); }
.theme-seg button { display: inline-flex; align-items: center; gap: 6px; }
.theme-seg svg { width: 15px; height: 15px; }
@media (max-width: 1100px) { .theme-seg span { display: none; } }

/* cards */
.grid { display: grid; gap: 18px; }
.kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-1 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 15px 18px 0; }
.card-h h3 { margin: 0; font-size: 14px; font-weight: 650; letter-spacing: -.005em; }
.card-h .hint { color: var(--muted); font-size: 12px; }
.card-h .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-b { padding: 14px 18px 18px; }
.card-b.flush { padding: 10px 0 4px; }
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 200px; }

.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.kpi .k-label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; display: flex; align-items: center; gap: 7px; }
.kpi .k-val { font-size: 28px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi .k-sub { color: var(--text-2); font-size: 12.5px; }
.kpi .k-ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; }
.kpi .k-ico svg { width: 15px; height: 15px; }
.kpi.accent .k-ico { background: var(--accent-soft); color: var(--accent); }
.kpi.in .k-ico { background: var(--in-soft); color: var(--in); }
.kpi.out .k-ico { background: var(--out-soft); color: var(--out); }
.kpi.info .k-ico { background: var(--info-soft); color: var(--info); }
.kpi.warn .k-ico { background: var(--warn-soft); color: var(--warn); }
.delta { font-size: 11.5px; font-weight: 700; padding: 1px 6px; border-radius: 6px; margin-left: 4px; }
.delta.up { color: var(--in); background: var(--in-soft); }
.delta.down { color: var(--out); background: var(--out-soft); }

/* live */
.live-wrap { position: relative; border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 16/9; }
.live-wrap img { width: 100%; height: 100%; object-fit: contain; display: block; }
.live-badge { position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 7px;
  background: rgba(0,0,0,.55); color: #fff; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; }
.live-badge .rec { width: 7px; height: 7px; border-radius: 50%; background: #ef4444; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.live-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line-soft); border-top: 1px solid var(--line-soft); }
.live-stats div { background: var(--panel); padding: 10px 14px; }
.live-stats b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.live-stats span { color: var(--muted); font-size: 11.5px; }

/* feed */
.feed { display: flex; flex-direction: column; max-height: 430px; overflow: auto; }
.feed-item { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 9px 18px; border-top: 1px solid var(--line-soft); cursor: pointer; }
.feed-item:hover { background: var(--panel-2); }
.feed-item:first-child { border-top: 0; }
.avatar { width: 44px; height: 44px; border-radius: 11px; object-fit: cover; background: var(--panel-2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.avatar.sm { width: 34px; height: 34px; border-radius: 9px; }
.avatar.lg { width: 96px; height: 96px; border-radius: 18px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar svg { width: 55%; height: 55%; opacity: .55; }
.who { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { color: var(--muted); font-size: 12px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.pill.in { background: var(--in-soft); color: var(--in); }
.pill.out { background: var(--out-soft); color: var(--out); }
.pill.muted { background: var(--panel-2); color: var(--text-2); border: 1px solid var(--line); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.good { background: var(--in-soft); color: var(--in); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.empty { color: var(--muted); text-align: center; padding: 34px 18px; font-size: 13px; }
.empty b { display: block; color: var(--text-2); font-size: 14px; margin-bottom: 4px; }

/* inside list */
.inside-list { display: flex; flex-direction: column; max-height: 430px; overflow: auto; }
.inside-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 11px; align-items: center; padding: 8px 18px; border-top: 1px solid var(--line-soft); cursor: pointer; }
.inside-row:first-child { border-top: 0; }
.inside-row:hover { background: var(--panel-2); }
.elapsed { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--accent); font-size: 13px; }

/* tables */
.table-wrap { overflow: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--panel); }
.tbl td { padding: 9px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; white-space: nowrap; }
.tbl tr:hover td { background: var(--panel-2); }
.tbl .person-cell { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.dur-bar { height: 6px; border-radius: 6px; background: var(--panel-2); min-width: 90px; overflow: hidden; }
.dur-bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding: 12px 18px; color: var(--muted); font-size: 12.5px; }

/* people */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.person-card { padding: 14px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; transition: transform .12s, border-color .12s; }
.person-card:hover { transform: translateY(-2px); border-color: var(--line); }
.person-card .top { display: flex; gap: 12px; align-items: center; }
.person-card .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.person-card .stats div { background: var(--panel-2); border-radius: 8px; padding: 6px 9px; }
.person-card .stats b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
.person-card .stats span { color: var(--muted); font-size: 11px; }
.tags { display: flex; gap: 5px; flex-wrap: wrap; }
.merge-sug { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.merge-item { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--panel-2); }
.merge-item .vs { color: var(--muted); font-size: 11.5px; text-align: center; }
.merge-item .vs b { display: block; color: var(--warn); font-size: 13px; }

/* drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(3,6,10,.55); z-index: 20; backdrop-filter: blur(2px); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 21; background: var(--bg-2); border-left: 1px solid var(--line);
  overflow-y: auto; box-shadow: -20px 0 50px rgba(0,0,0,.3); animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer-h { display: flex; align-items: center; gap: 14px; padding: 20px 22px; border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; background: var(--bg-2); z-index: 1; }
.drawer-b { padding: 18px 22px 40px; display: flex; flex-direction: column; gap: 18px; }
.face-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.face-strip img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { color: var(--muted); font-size: 12px; font-weight: 600; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-row { display: grid; grid-template-columns: 92px 1fr auto; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line-soft); align-items: center; font-size: 13px; }

/* review */
.review-card { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 0; overflow: hidden; }
.review-card .shot { background: #000; position: relative; min-height: 300px; }
.review-card .shot img { width: 100%; height: 100%; object-fit: contain; display: block; cursor: zoom-in; }
.review-side { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compare figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.compare img, .compare .ph { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); cursor: zoom-in; }
.compare .ph { display: grid; place-items: center; color: var(--muted); font-size: 12px; cursor: default; }
.compare figcaption { color: var(--muted); font-size: 11.5px; text-align: center; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }
.review-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.review-actions .btn { height: 40px; justify-content: flex-start; }
.review-actions .btn kbd { margin-left: auto; font: 11px var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.review-actions .btn.ok { border-color: color-mix(in srgb, var(--in) 50%, var(--line)); color: var(--in); }
.progress { height: 6px; border-radius: 6px; background: var(--panel-2); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width .3s; }

/* accuracy */
.score-ring { --v: 0; --c: var(--accent); width: 108px; height: 108px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--v) * 1%), var(--panel-2) 0); }
.score-ring > div { width: 86px; height: 86px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; text-align: center; }
.score-ring b { font-size: 22px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.score-ring span { display: block; color: var(--muted); font-size: 10.5px; margin-top: -4px; }
.acc-hero { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.acc-hero .card { display: flex; gap: 18px; align-items: center; padding: 18px; }
.acc-hero h4 { margin: 0 0 4px; font-size: 14px; }
.acc-hero p { margin: 0; color: var(--text-2); font-size: 12.5px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line-soft); border-radius: 12px; overflow: hidden; border: 1px solid var(--line-soft); }
.metric { background: var(--panel); padding: 14px 16px; }
.metric .m-l { color: var(--muted); font-size: 12px; display: flex; gap: 6px; align-items: center; }
.metric .m-v { font-size: 22px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.metric .m-s { color: var(--muted); font-size: 11.5px; }
.metric .m-bar { height: 4px; border-radius: 4px; background: var(--panel-2); margin-top: 8px; overflow: hidden; }
.metric .m-bar i { display: block; height: 100%; }
.recs { display: flex; flex-direction: column; gap: 10px; }
.rec { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-soft); background: var(--panel-2); font-size: 13px; }
.rec .ic { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; flex: none; font-weight: 800; font-size: 13px; }
.rec.bad .ic { background: var(--bad-soft); color: var(--bad); }
.rec.warn .ic { background: var(--warn-soft); color: var(--warn); }
.rec.info .ic { background: var(--info-soft); color: var(--info); }
.rec.good .ic { background: var(--in-soft); color: var(--in); }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-row .field { min-width: 120px; }

/* settings / calibration */
.calib { position: relative; border-radius: 12px; overflow: hidden; background: #000; user-select: none; touch-action: none; }
.calib img { width: 100%; display: block; }
.calib svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.calib .handle { cursor: grab; }
.range { width: 100%; accent-color: var(--accent); }
.sys-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13px; }
.sys-list dt { color: var(--muted); }
.sys-list dd { margin: 0; font-family: var(--mono); font-size: 12px; word-break: break-all; }
.log-list { font: 12px var(--mono); max-height: 260px; overflow: auto; }
.log-list div { padding: 5px 0; border-bottom: 1px dashed var(--line-soft); color: var(--text-2); }
.log-list b { color: var(--text); font-weight: 600; }

.lightbox { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.85); display: grid; place-items: center; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 92vh; border-radius: 10px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 50; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 13px; box-shadow: var(--shadow); }
.skeleton { background: linear-gradient(90deg, var(--panel-2), var(--line-soft), var(--panel-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

.only-mobile { display: none; }
@media (max-width: 1280px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 1050px) { .g-2-1, .g-1-1, .g-3, .acc-hero, .review-card { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 30; width: 250px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 20px 0 50px rgba(0,0,0,.4); }
  .only-mobile { display: inline-grid; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .top-actions { width: 100%; margin-left: 0; flex-wrap: wrap; }
  .view { padding: 16px 16px 40px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .live-stats { grid-template-columns: repeat(2, 1fr); }
  .chip-toggle span { display: none; }
}

/* pattern lock (shown before the dashboard loads) */
.lock { position: fixed; inset: 0; z-index: 1000; background: var(--bg); display: grid; place-items: center; padding: 16px; transition: opacity .25s; }
.lock.out { opacity: 0; pointer-events: none; }
.lock-card { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; width: 100%; max-width: 340px; }
.lock-card .logo { color: var(--accent); }
.lock-card .logo svg { width: 52px; height: 52px; }
.lock-title { font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.lock-msg { color: var(--text-2); min-height: 21px; }
.lock-msg.bad { color: var(--bad); }
.lock-pad { position: relative; width: min(300px, 82vw); aspect-ratio: 1; margin-top: 10px; touch-action: none; user-select: none; -webkit-user-select: none; border-radius: var(--radius); outline: none; cursor: pointer; }
.lock-pad:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.lock-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.lock-lines line { stroke: var(--accent); stroke-width: 5; stroke-linecap: round; opacity: .85; }
.lock-dots { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); }
.lock-dot { display: grid; place-items: center; }
.lock-dot i { width: 18px; height: 18px; border-radius: 50%; background: var(--muted); opacity: .55; transition: transform .12s, background .12s, opacity .12s, box-shadow .12s; }
.lock-dot.on i { background: var(--accent); opacity: 1; transform: scale(1.3); box-shadow: 0 0 0 12px var(--accent-soft); }
.lock-pad.bad .lock-lines line { stroke: var(--bad); }
.lock-pad.bad .lock-dot.on i { background: var(--bad); box-shadow: 0 0 0 12px var(--bad-soft); }
.lock-pad.bad { animation: lock-shake .35s; }
@keyframes lock-shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@media (prefers-reduced-motion: reduce) { .lock, .lock-dot i { transition: none; } .lock-pad.bad { animation: none; } }
.lock-pad.disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }
