/* Knight Agent portal. Brochure look: night-navy chrome, moonlight-blue knight, mist panels,
   Inter. One bold device: viewfinder corner brackets round every detected subject.
   Light by default; dark follows the system. No framework. */

@font-face {
    font-family: "Inter";
    src: url("../fonts/InterVariable.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --night: #0c1b2a;
    --night-2: #142a40;
    --night-deep: #07101c;
    --moon: #7cc4f2;
    --haze: #c8d3de;
    --haze-dim: #8a9bb0;

    --paper: #f4f7fb;
    --surface: #ffffff;
    --mist: #eef2f7;
    --line: #e1e8f0;
    --ink: #0c1b2a;
    --text: #3d4a5c;
    --muted: #6b7787;
    --accent: #0c4a6e;
    --accent-ink: #ffffff;
    --ok: #2e8b57;
    --bad: #c2453a;

    --person: #2f7bc0;
    --vehicle: #b7791f;
    --animal: #3b8257;
    --mark-person: #7cc4f2;
    --mark-vehicle: #f2b544;
    --mark-animal: #74d39a;
    --mark-object: #e7d3b8;

    --nav-on: #18395a;
    --tint: #e6f1f8;
    --tint-ink: #0c4a6e;
    --ok-bg: #e8f4ec;
    --ok-line: #b9dcc6;
    --ok-ink: #17472c;
    --warn-bg: #fff8e8;
    --warn-line: #ecd9a8;
    --warn-ink: #5c3d06;
    --bad-bg: #fbe9e7;
    --bad-line: #efc4be;
    --bad-ink: #6e1f17;
    --violet: #5b3fb0;
    --violet-bg: #efe9fb;
    --violet-ink: #3c2a78;
    --lift: 0 1px 2px rgba(12, 27, 42, 0.04), 0 14px 30px -20px rgba(12, 27, 42, 0.35);

    --r-s: 6px;
    --r: 10px;
    --r-l: 14px;
    --r-xl: 16px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #0a1422;
        --surface: #0f1c2d;
        --mist: #132235;
        --line: #1e2f45;
        --ink: #e8eef5;
        --text: #c3cedb;
        --muted: #8c9aad;
        --accent: #7cc4f2;
        --accent-ink: #07101c;
        --person: #7cc4f2;
        --vehicle: #f2b544;
        --animal: #74d39a;
        --ok: #4fbf82;
        --bad: #ef6b60;
        --tint: #12304a;
        --tint-ink: #a9d8f6;
        --ok-bg: #10291d;
        --ok-line: #1f4a33;
        --ok-ink: #a6dfbf;
        --warn-bg: #2a2110;
        --warn-line: #4d3c17;
        --warn-ink: #f1d28c;
        --bad-bg: #2e1614;
        --bad-line: #57261f;
        --bad-ink: #f5b3ab;
        --violet: #a48cf0;
        --violet-bg: #211a3d;
        --violet-ink: #cdbff7;
        --lift: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 30px -20px rgba(0, 0, 0, 0.8);
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }

html { font-size: 15px; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--text);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-feature-settings: "cv11";
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { color: var(--ink); margin: 0; letter-spacing: -0.012em; }
h1 { font-size: 2rem; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.05rem; font-weight: 600; }
h3 { font-size: 0.95rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 2px; }
code { font-size: 0.88em; background: var(--mist); padding: 1px 5px; border-radius: 4px; }
time, .num { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--moon); outline-offset: 2px; border-radius: 4px; }

.icon {
    width: 20px;
    height: 20px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- Shell: night sidebar, top bar, tabs ---------- */

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 10; padding: 10px 14px; border-radius: var(--r); background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.skip:focus { top: 12px; }

.shell { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }

.side {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 20px 14px 24px;
    background: var(--night);
    color: var(--haze);
}

.brand {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 12px;
    align-items: center;
    padding: 0 8px;
    color: inherit;
    text-decoration: none;
}
.brand .mark { grid-row: span 2; display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--r); background: var(--night-2); }
.brand .knight { width: 19px; height: 24px; color: var(--moon); }
.brand .wordmark { align-self: end; color: #fff; font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.brand .site { align-self: start; color: var(--haze-dim); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The menu: four groups, twelve links (PortalNav). The pages under a link are its tabs. */
.side nav { display: flex; flex-direction: column; gap: 20px; min-height: 0; margin-right: -6px; padding-right: 6px; overflow-y: auto; }
.nav-links { display: flex; flex-direction: column; gap: 2px; }
.side .nav-head { display: block; padding: 0 12px 6px; color: var(--haze-dim); font-size: 0.8rem; font-weight: 600; }
.side nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
    padding: 9px 12px;
    border-radius: var(--r);
    color: #dfe7ef;
    text-decoration: none;
    font-weight: 500;
}
.side nav a .icon { width: 18px; height: 18px; color: var(--moon); stroke-width: 1.8; }
.side nav a > span { flex: 1; min-width: 0; }
.side nav a:hover { background: var(--night-2); color: #fff; }
.side nav a.on { background: var(--nav-on); color: #fff; }
/* A number on a link: alarms since you last opened Notifications, questions waiting in Review. */
.side nav a .count {
    min-width: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--moon);
    color: var(--night-deep);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.55;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.side nav a .count[hidden] { display: none; }

.main { display: flex; flex-direction: column; gap: 18px; min-width: 0; padding: 18px 32px 56px; }
.main > main { min-width: 0; }
.main > main:focus { outline: none; }

.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.topbar .find { position: relative; flex: 1 1 280px; max-width: 560px; margin: 0; }
.topbar .find .icon { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; margin-top: -9px; color: var(--muted); pointer-events: none; }
.topbar .find input { min-height: 46px; padding: 10px 46px 10px 42px; border-radius: 12px; }
.topbar .find kbd {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    padding: 1px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--paper);
    color: var(--muted);
    font: 600 0.8rem/1.5 inherit;
}
.topbar .find input:focus + kbd { display: none; }
.topbar-end { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.top-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 8px 14px;
    border-radius: 12px;
    background: var(--tint);
    color: var(--tint-ink);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}
.top-chip:hover { filter: brightness(0.97); }
.top-chip .icon { width: 18px; height: 18px; stroke-width: 2; }
.top-btn {
    position: relative;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
}
.top-btn:hover { border-color: var(--haze-dim); }
.top-btn .dot { position: absolute; right: 9px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); border: 2px solid var(--surface); }
.who { display: flex; align-items: center; gap: 2px; margin: 0; }
.who .user { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 6px; color: var(--ink); text-decoration: none; font-weight: 600; }
.who .user:hover .user-name { color: var(--accent); }
.who .avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--night); color: var(--moon); font-weight: 700; }
.who .user-name { display: flex; flex-direction: column; max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.2; }
.who .user-name small { color: var(--muted); font-weight: 500; font-size: 0.78rem; }
.who .quiet { min-width: 40px; min-height: 40px; justify-content: center; color: var(--muted); border-radius: var(--r); }
.who .quiet:hover { color: var(--ink); background: var(--mist); }

/* The pages under one menu link. */
.tabs { display: flex; gap: 4px; margin-bottom: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a {
    flex: none;
    padding: 10px 14px 11px;
    margin-bottom: -1px;
    border-bottom: 3px solid transparent;
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
}
.tabs a:hover { color: var(--ink); border-bottom-color: var(--line); }
.tabs a.on { color: var(--ink); font-weight: 650; border-bottom-color: var(--accent); }
/* Tabs inside a page: one camera's pages. */
.tabs.sub { margin-bottom: 18px; }

/* ---------- Page header, buttons, forms ---------- */

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px 24px;
    margin-bottom: 28px;
    max-width: 1180px;
}
.page-head .lede { margin-top: 6px; color: var(--muted); max-width: 60ch; }
.page-head.wide { max-width: none; }
.events-head { align-items: center; margin-bottom: 18px; }
.events-head .actions-row { justify-content: flex-end; gap: 10px 12px; }
.events-head .clear-today { margin-top: 6px; }
.events-head .clear-today button { font-size: 0.88rem; }
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 10px; color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.back .icon { width: 16px; height: 16px; }
.back:hover { color: var(--accent); }

button, .btn {
    font: inherit;
    cursor: pointer;
    border-radius: var(--r);
    border: 1px solid transparent;
    min-height: 40px;
    padding: 8px 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}
.btn.primary, button.primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover, button.primary:hover { filter: brightness(1.12); }
.btn.secondary { background: var(--surface); border-color: var(--line); color: var(--ink); font-weight: 600; }
.btn.secondary:hover { border-color: var(--haze-dim); }
button.quiet { background: none; border: none; min-height: 0; padding: 6px; color: var(--muted); }
button.danger { background: none; border: none; min-height: 0; padding: 0; color: var(--bad); font-weight: 500; }
.btn .icon, button .icon { width: 18px; height: 18px; }

label { display: block; margin: 16px 0 6px; font-weight: 600; color: var(--ink); font-size: 0.9rem; }
input, select {
    font: inherit;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    min-height: 42px;
    padding: 9px 12px;
}
input { width: 100%; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; padding: 0; accent-color: var(--accent); }
input:focus, select:focus { outline: none; border-color: var(--moon); box-shadow: 0 0 0 3px color-mix(in srgb, var(--moon) 30%, transparent); }
.error { color: var(--bad); font-size: 0.88rem; }
.error ul { margin: 6px 0 0; padding-left: 18px; }
.field-error { display: block; margin-top: 4px; }

/* ---------- Empty states ---------- */

.empty {
    max-width: 620px;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    background: var(--surface);
    box-shadow: var(--lift);
    color: var(--text);
}
.empty h2 { margin-bottom: 6px; }
.empty p + p { margin-top: 10px; }

/* ---------- The bracket device ---------- */

.brackets {
    position: absolute;
    --c: var(--mark-person);
    --arm: 26%;
    --w: 2px;
    background:
        linear-gradient(var(--c) 0 0) left top / var(--arm) var(--w),
        linear-gradient(var(--c) 0 0) left top / var(--w) var(--arm),
        linear-gradient(var(--c) 0 0) right top / var(--arm) var(--w),
        linear-gradient(var(--c) 0 0) right top / var(--w) var(--arm),
        linear-gradient(var(--c) 0 0) left bottom / var(--arm) var(--w),
        linear-gradient(var(--c) 0 0) left bottom / var(--w) var(--arm),
        linear-gradient(var(--c) 0 0) right bottom / var(--arm) var(--w),
        linear-gradient(var(--c) 0 0) right bottom / var(--w) var(--arm);
    background-repeat: no-repeat;
    filter: drop-shadow(0 0 1px rgba(7, 16, 28, 0.85));
    pointer-events: none;
}
.k-vehicle .brackets { --c: var(--mark-vehicle); }
.k-animal .brackets { --c: var(--mark-animal); }
.k-object .brackets { --c: var(--mark-object); }
.k-camera .brackets { display: none; }

/* A snapshot zoomed onto its subject (style from Ui.Crop / crop() in events.js). */
.crop {
    position: relative;
    display: block;
    aspect-ratio: 4 / 5;
    border-radius: 8px;
    background-color: var(--night-deep);
    background-repeat: no-repeat;
    overflow: hidden;
}
.crop .brackets { --w: 1.5px; }

/* ---------- Events: a timeline by day ---------- */

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 24px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--mist); }
.seg a { padding: 6px 12px; border-radius: 7px; color: var(--text); text-decoration: none; font-size: 0.9rem; font-weight: 500; }
.seg a:hover { color: var(--ink); }
.seg a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(12, 27, 42, 0.12); }

.live { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--muted); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--haze-dim); }
.live[data-state="on"] { color: var(--ink); }
.live[data-state="on"]::before { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 22%, transparent); }
.live[data-state="off"]::before { background: var(--bad); }

.day + .day { margin-top: 26px; }
.day h2 {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 10px 0 8px;
    background: var(--paper);
    font-size: 0.95rem;
}
.rows { list-style: none; margin: 0; padding: 0; }
.row > a {
    display: grid;
    grid-template-columns: 52px 76px minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    padding: 8px 12px 8px 0;
    border-radius: var(--r);
    color: inherit;
    text-decoration: none;
}
.row > a:hover { background: var(--mist); }
.row time { color: var(--ink); font-weight: 600; text-align: right; }
.row .what { display: flex; flex-direction: column; min-width: 0; }
.row .what strong { color: var(--ink); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.row .what strong .icon { width: 16px; height: 16px; }
.row .where { color: var(--muted); font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sure { color: var(--muted); font-size: 0.8rem; }
.k-person .what .icon { color: var(--person); }
.k-vehicle .what .icon { color: var(--vehicle); }
.k-animal .what .icon { color: var(--animal); }
.k-object .what .icon { color: var(--muted); }
.k-camera .what .icon, .k-camera .what strong { color: var(--bad); }

/* The Events page: a grid of snapshots across the whole width (_EventCard, card() in events.js). */
.timeline { max-width: none; }
.cards {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
}
.card > a {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "pic pic" "what when";
    gap: 8px 10px;
    padding: 8px 8px 10px;
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    background: var(--surface);
    box-shadow: var(--lift);
    color: inherit;
    text-decoration: none;
}
.card > a:hover { border-color: var(--haze-dim); }
.card .crop { grid-area: pic; }
.crop.wide { aspect-ratio: 4 / 3; }
.card .what { grid-area: what; display: flex; flex-direction: column; min-width: 0; }
.card .what strong { color: var(--ink); font-weight: 600; display: flex; align-items: center; gap: 6px; min-width: 0; }
.card .what strong .icon { width: 16px; height: 16px; flex: none; }
.card .where { color: var(--muted); font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .when { grid-area: when; display: flex; flex-direction: column; align-items: flex-end; }
.card time { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.card .sure { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.plate-filters { margin-bottom: 18px; }
.usual-say { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 0; }
.just-now { margin-top: 28px; max-width: 1400px; }
.wall:fullscreen { padding: 10px; background: var(--night-deep); max-width: none; align-content: start; overflow: auto; }
/* Search: where a query leads besides events. */
.places { max-width: 860px; margin: 18px 0; padding: 12px 20px; }
.places h2 { margin-top: 10px; color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.places .rows > a { padding: 10px 0; color: inherit; text-decoration: none; }
.places .rows > a:hover .name { color: var(--accent); }
/* What a setting did this week, beside it. */
.evidence { margin-top: 8px; padding: 8px 12px; border-radius: var(--r); background: var(--tint); color: var(--tint-ink); font-size: 0.9rem; }
.evidence a { font-weight: 600; margin-left: 4px; }
.hint.leaves { padding-left: 18px; }
table.data.kept { margin-top: 8px; font-size: 0.9rem; }
.auth-form .keep { margin-top: 16px; font-weight: 500; }
.auth-form .auth-help { margin-top: 12px; }
.phones-note { max-width: 860px; }
.list li.changed-row { grid-template-columns: 220px minmax(0, 1fr); }
.check-taught { font-size: 0.9rem; }
.check-rule { font-size: 0.9rem; }
.rule-asks { margin: 6px 0 0; }
.rule-asks strong { color: var(--ink); }
.check-what .meter { max-width: 320px; }
.check-alerts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 0.9rem; }
.check-edit summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.check-edit form { margin-top: 8px; max-width: 520px; }
.nt-judge { display: flex; flex-wrap: wrap; gap: 6px; }
.nt-more { font-weight: 600; font-size: 0.9rem; }
.card .alert-words { align-self: flex-start; margin-top: 4px; font-size: 0.78rem; padding: 1px 8px; }
.timeline .day > h2 .dim { color: var(--muted); font-weight: 500; font-size: 0.9rem; }
.has-clip {
    position: absolute;
    top: 8px;
    right: 8px;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(7, 16, 28, 0.72);
    color: #fff;
}
.has-clip .icon { width: 16px; height: 16px; fill: currentColor; }
/* A visit: one person or vehicle on several cameras, as one card that looks like a small stack. */
.visit-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px 3px 7px;
    border-radius: 999px;
    background: rgba(7, 16, 28, 0.78);
    color: #fff;
    font-size: 0.76rem;
    font-weight: 600;
}
.visit-badge .icon { width: 14px; height: 14px; color: var(--moon); }
.card.visit > a { box-shadow: 5px 5px 0 -1px var(--surface), 5px 5px 0 0 var(--line), 10px 10px 0 -2px var(--surface), 10px 10px 0 -1px var(--line); }

.row.fresh > a, .card.fresh > a { animation: arrive 2.6s ease-out; }
@keyframes arrive {
    from { background: color-mix(in srgb, var(--moon) 28%, transparent); }
    to { background: transparent; }
}

.pages { display: flex; gap: 12px; margin-top: 28px; }

/* ---------- One event ---------- */

.detail { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; max-width: 1180px; align-items: start; }
.frame {
    position: relative;
    margin: 0;
    border-radius: var(--r-l);
    overflow: hidden;
    background: var(--night-deep);
    aspect-ratio: 16 / 9;
}
.frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.frame .brackets { --arm: 22%; --w: 2.5px; }
.media { display: grid; gap: 14px; min-width: 0; }
.media .note { margin-top: 0; }
.frame.clip video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.frame .nopic { display: none; position: absolute; inset: 0; place-items: center; color: var(--haze-dim); }
.frame.down .nopic { display: grid; }
.frame.down img { visibility: hidden; }

.facts { margin: 0; display: grid; gap: 14px; }
.facts div { display: grid; gap: 2px; }
.facts dt { color: var(--muted); font-size: 0.82rem; }
.facts dd { margin: 0; color: var(--ink); font-weight: 500; }
.aside h3 { margin: 28px 0 8px; }
.aside > h3:first-child { margin-top: 0; }
.actions { margin-top: 22px; }
.aside .rows .row > a { grid-template-columns: 44px 52px minmax(0, 1fr); gap: 12px; padding: 6px 8px 6px 0; }
.aside .rows .sure { display: none; }

/* ---------- Cameras: a video wall ---------- */

.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; max-width: 1400px; }
.tile {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    border-radius: var(--r);
    overflow: hidden;
    background: var(--night-deep);
    color: #fff;
    text-decoration: none;
}
.tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tile .label {
    position: absolute;
    inset: auto 0 0 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    padding: 28px 14px 12px;
    background: linear-gradient(transparent, rgba(7, 16, 28, 0.82));
}
.tile .label strong { font-weight: 600; }
.tile .label span { color: var(--haze); font-size: 0.85rem; }
.tile .nopic { display: none; position: absolute; inset: 0; place-items: center; color: var(--haze-dim); font-size: 0.9rem; }
.tile.down .nopic { display: grid; }
.tile.down img { visibility: hidden; }
.tile:hover { outline: 2px solid var(--moon); outline-offset: -2px; }
/* Frames a second detection analyses, of those the camera sends (cameras.js). */
.rate {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(7, 16, 28, 0.72);
    color: #fff;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}
.rate[hidden], .down .rate { display: none; }

/* Live video (cameras.js with live.js): the still, then video layers over it that fade in as
   they play. */
.tile .layers, .frame .layers { position: absolute; inset: 0; }
.layers video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s;
}
.layers video.on { opacity: 1; }
.down .layers { visibility: hidden; }

/* Live video / Detections, and Auto / HD / SD. */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--mist); border: 1px solid var(--line); }
.seg[hidden] { display: none; }
.seg button {
    border: 0;
    border-radius: 8px;
    padding: 6px 14px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(12, 27, 42, 0.12); }
.seg button:disabled { opacity: 0.5; cursor: default; }
.live-quality { justify-self: start; }

/* ---------- Lists: status, phones, relay ---------- */

.panel { max-width: 860px; }
.panel.wide { max-width: 1180px; }
.panel + .panel { margin-top: 32px; }
.panel > h2 { margin-bottom: 10px; }
.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
/* A list that is a section's whole content is a card of rows. */
.panel > .list:not(.rule-list) { padding: 0 20px; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--lift); }
.panel > .list:not(.rule-list) > li:last-child { border-bottom: 0; }
.list li {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}
.list .name { color: var(--ink); font-weight: 600; }
.list a.name { text-decoration: none; }
/* A phone or a user as a row: a round picture, who it is, a word on how it stands, what you can do. */
.list li.who-row { grid-template-columns: auto minmax(0, 1fr) auto auto; padding: 14px 0; }
.who-pic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--tint); color: var(--tint-ink); }
.who-pic.letter { background: var(--night); color: var(--moon); font-weight: 700; font-size: 1.1rem; }
.who-text { display: flex; flex-direction: column; min-width: 0; }
@media (max-width: 860px) {
    .list li.who-row { grid-template-columns: auto minmax(0, 1fr); }
}
.list a.name:hover { color: var(--accent); text-decoration: underline; }
.list .detail-text { color: var(--muted); font-size: 0.9rem; }
.state { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); }
.state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.state.bad::before { background: var(--bad); }
.state.idle::before { background: var(--haze-dim); }

.pair { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 40px; align-items: start; max-width: 860px; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 14px; }
.steps li::marker { color: var(--muted); font-weight: 600; }
.qr { background: #fff; padding: 14px; border-radius: var(--r-l); border: 1px solid var(--line); }
.qr svg { display: block; width: 260px; height: 260px; }
.pair-code { margin: 0 0 4px; font-size: 2.4rem; font-weight: 700; letter-spacing: 0.08em; color: var(--ink); font-variant-numeric: tabular-nums; }
.pair-when { margin: 0 0 18px; color: var(--muted); }
.note { margin-top: 18px; padding: 12px 16px; border-radius: 12px; background: var(--mist); font-size: 0.92rem; }

.form { max-width: 420px; }
.form button.primary { margin-top: 22px; }

/* ---------- Sign-in and first-run setup ---------- */

.auth { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); min-height: 100vh; }
.auth-brand {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 44px;
    background-color: var(--night);
    background-image: radial-gradient(#1a3550 1px, transparent 1px);
    background-size: 18px 18px;
    color: var(--haze);
}
/* The brochure's crescent. */
.auth-brand::after {
    content: "";
    position: absolute;
    top: -18%;
    right: -30%;
    width: 80%;
    aspect-ratio: 1;
    border-radius: 50%;
    box-shadow: -34px 22px 0 0 rgba(124, 196, 242, 0.07);
}
.auth-brand .brand { padding: 0; }
.auth-brand .brand .mark { width: 46px; height: 46px; }
.auth-brand .brand .knight { width: 23px; height: 29px; }
.auth-brand .brand .wordmark { font-size: 1.25rem; }
.auth-form .form { padding: 28px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--lift); max-width: 420px; }
.auth-form .form button.primary { width: 100%; justify-content: center; min-height: 48px; margin-top: 22px; }
.auth-brand h1 { color: #fff; font-size: 2.4rem; max-width: 16ch; }
.auth-brand p { margin-top: 14px; max-width: 38ch; }
.auth-form { display: grid; place-items: center; padding: 44px 24px; background: var(--paper); }
.auth-form .form { width: 100%; }
.auth-form h2 { font-size: 1.4rem; }
.auth-form .lede { margin-top: 6px; color: var(--muted); }

/* ---------- Setup: cameras, settings, users, audit ---------- */


.actions-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.actions-row form { margin: 0; }

.tile.off { background: var(--night-2); }
.tile.off .nopic { display: grid; }

.hint { margin-top: 6px; color: var(--muted); font-size: 0.85rem; }
label.check { display: flex; align-items: center; gap: 10px; margin-top: 22px; font-weight: 600; }
label.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
label.check + .hint { margin-left: 28px; }
select { width: 100%; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.field-row .narrow { max-width: 130px; }
.field-row:has(.narrow) { grid-template-columns: minmax(0, 1fr) 130px; }
.with-unit { display: flex; align-items: center; gap: 10px; }
.with-unit input { max-width: 120px; }
.with-unit span { color: var(--muted); }
/* A camera's vehicle speed settings (Change camera). */
.speed-settings { border: none; padding: 0; margin: 18px 0 0; min-width: 0; }
.speed-settings legend { padding: 0; font-weight: 600; color: var(--ink); }
.speed-settings .field-row { margin-top: 8px; }
.buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.form .buttons button.primary { margin-top: 0; }

.saved {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 22px;
    padding: 8px 14px;
    border-radius: var(--r);
    background: color-mix(in srgb, var(--ok) 14%, transparent);
    color: var(--ink);
    font-weight: 600;
}

.edit-camera { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 420px); gap: 40px; align-items: start; }
.edit-camera .form { max-width: none; }
.test { padding: 20px; border-radius: var(--r-l); background: var(--mist); }
.test h2 { margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.test h2::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); }
.test.bad h2::before { background: var(--bad); }
.test .frame { margin-bottom: 12px; }
.found { margin-bottom: 32px; }
.found .list li { grid-template-columns: 160px minmax(0, 1fr) auto; }
.danger-zone { margin-top: 48px; padding-top: 22px; border-top: 1px solid var(--line); }
.danger-zone .lede { margin: 4px 0 12px; color: var(--muted); }

.settings { max-width: 560px; }
.settings .panel + .panel { margin-top: 36px; }
.settings .panel > .lede { color: var(--muted); }

.row-actions { display: flex; align-items: center; gap: 14px; }
form.inline { margin: 0; }
.row-actions select { width: auto; padding: 5px 8px; }

table.audit { width: 100%; max-width: 1180px; border-collapse: separate; border-spacing: 0; font-size: 0.92rem; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); overflow: hidden; }
table.audit th, table.audit td { padding-left: 16px; padding-right: 16px; }
table.audit thead th { background: var(--paper); }
table.audit tbody tr:last-child td { border-bottom: 0; }
.audit th { text-align: left; color: var(--muted); font-weight: 500; font-size: 0.82rem; padding: 0 12px 8px 0; }
.audit td { padding: 10px 12px 10px 0; border-top: 1px solid var(--line); vertical-align: top; }
.audit td:first-child { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.audit td:nth-child(2) { color: var(--ink); font-weight: 500; white-space: nowrap; }
.audit strong { color: var(--ink); font-weight: 600; margin-right: 6px; }

/* ---------- Counts (M4) ---------- */

.counts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 14px; }
.counts div { padding: 10px 12px; border-radius: var(--r); background: var(--mist); }
.counts dt { color: var(--muted); font-size: 0.8rem; }
.counts dd { margin: 0; color: var(--ink); font-size: 1.5rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.count-line { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 0.9rem; }
.count-line .what { flex-basis: 100%; color: var(--ink); font-weight: 600; }
.count-line strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.count-line .sub { flex-basis: 100%; color: var(--muted); font-size: 0.82rem; }
.aside .count-line + h3, .aside .counts + h3 { margin-top: 24px; }

/* ---------- Lines and zones editor (M4) ---------- */

.areas { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; max-width: 1280px; align-items: start; }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.tools .btn.on { border-color: var(--moon); box-shadow: 0 0 0 3px color-mix(in srgb, var(--moon) 30%, transparent); }
.tool-hint { color: var(--muted); font-size: 0.88rem; }
.frame.drawing svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.frame.drawing .handle { fill: #fff; stroke: var(--moon); stroke-width: 4; cursor: grab; }
.frame.drawing .handle:active { cursor: grabbing; }
.areas .item-facts a { font-weight: 600; }
.drawing-now .frame.drawing svg { cursor: crosshair; }
.drawing svg .line-shape { stroke: var(--mark-person); stroke-width: 5; stroke-linecap: round; }
.drawing svg .arrow { stroke: var(--mark-vehicle); stroke-width: 4; }
.drawing svg .arrow-head { fill: var(--mark-vehicle); }
.drawing svg .zone-shape { fill: color-mix(in srgb, var(--mark-animal) 22%, transparent); stroke: var(--mark-animal); stroke-width: 3; }
.drawing svg .draft { fill: none; stroke: #fff; stroke-width: 3; stroke-dasharray: 10 8; }
.drawing svg .draft-point { fill: #fff; stroke: var(--night); stroke-width: 2; }
.drawing svg .tag { fill: #fff; font: 600 30px Inter, sans-serif; paint-order: stroke; stroke: rgba(7, 16, 28, 0.85); stroke-width: 6px; }
.drawing svg .tag.direction { fill: var(--mark-vehicle); text-anchor: middle; dominant-baseline: middle; }
.areas-list h2 { margin-bottom: 8px; }
.areas-list .items { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.areas-list .item { padding: 12px 14px 14px; border-radius: var(--r); background: var(--mist); border-left: 3px solid var(--mark-person); }
.areas-list .item.zone { border-left-color: var(--mark-animal); }
.areas-list .item label { margin: 0 0 4px; font-size: 0.82rem; }
.areas-list .item label + label, .areas-list .item .field-row { margin-top: 8px; }
.areas-list .item input { margin-top: 4px; padding: 7px 9px; }
.item-actions { display: flex; justify-content: space-between; margin-top: 10px; }
.empty-note { color: var(--muted); }

/* ---------- Small screens: the sidebar becomes a top bar ---------- */

@media (max-width: 860px) {
    .shell { display: block; }
    .side {
        position: sticky;
        z-index: 2;
        height: auto;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        padding: 10px 12px;
        overflow-x: auto;
    }
    .brand { grid-template-columns: auto; padding: 0 4px; }
    .brand .wordmark, .brand .site { display: none; }
    .brand .mark { grid-row: auto; width: 34px; height: 34px; }
    .side nav { flex-direction: row; gap: 2px; margin: 0; padding: 0; overflow: visible; }
    /* On a phone the menu is one sideways strip: every link, no group names. */
    .nav-group, .nav-links { display: contents; }
    .side .nav-head { display: none; }
    .side nav a { flex: none; padding: 8px 10px; gap: 8px; white-space: nowrap; }
    .side nav a > span { flex: none; }
    .main { padding: 14px 16px 48px; gap: 14px; }
    .who .user-name { display: none; }
    .detail, .pair { grid-template-columns: 1fr; }
    .list li { grid-template-columns: 1fr; gap: 4px; }
    .auth { grid-template-columns: 1fr; }
    .auth-brand { padding: 28px 24px; gap: 28px; }
    .auth-brand h1 { font-size: 1.8rem; }
    .wall { grid-template-columns: 1fr; }
    .edit-camera, .areas { grid-template-columns: 1fr; gap: 24px; }
    .found .list li { grid-template-columns: 1fr; }
    .audit td:nth-child(2) { white-space: normal; }
}

@media (max-width: 520px) {
    .side nav a > span { display: none; }
    .side nav a.on > span { display: inline; }
    .side nav a:has(.count) { position: relative; }
    .side nav a:not(.on) .count { position: absolute; top: 0; right: 0; min-width: 16px; padding: 0 4px; font-size: 0.64rem; }
    .top-chip span { display: none; }
    .top-chip { padding: 8px 12px; }
    .row > a { grid-template-columns: 44px 64px minmax(0, 1fr); gap: 12px; }
    .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .events-head .actions-row { justify-content: flex-start; }
    .card > a { grid-template-areas: "pic pic" "what what" "when when"; gap: 6px; padding: 4px; }
    .card .when { flex-direction: row; align-items: baseline; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Journeys (M5) ---------- */

/* Journeys as cards: when, the pictures, the cameras in order, whether it alerted. */
.journeys { list-style: none; margin: 0; padding: 0; max-width: 1180px; display: flex; flex-direction: column; gap: 10px; }
.journeys a {
    display: grid;
    grid-template-columns: 120px auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 20px;
    padding: 12px 18px;
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    background: var(--surface);
    box-shadow: var(--lift);
    color: inherit;
    text-decoration: none;
}
.journeys a:hover { border-color: var(--haze-dim); }
.journeys .path { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; white-space: normal; }
.journeys a { grid-template-columns: 120px auto minmax(140px, 1fr) minmax(0, 1.4fr) auto; }
.journeys .who { display: flex; flex-direction: column; min-width: 0; }
.journeys .who strong { color: var(--ink); }
.journeys .who span { color: var(--muted); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ct-zones { margin-top: 24px; }
.journeys .path .arrow { color: var(--muted); }
.one-visit { margin: 0 0 20px; max-width: 1180px; }
@media (max-width: 860px) {
    .journeys a { grid-template-columns: 1fr; gap: 10px; }
    .journeys .when { text-align: left; }
}
.journeys .when { display: flex; flex-direction: column; text-align: right; }
.journeys .when strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.journeys .when span { color: var(--muted); font-size: 0.82rem; }
.journeys .strip { display: flex; gap: 6px; }
.journeys .strip .crop { width: 52px; }
.journeys .path { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.steps-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 18px; max-width: 1180px; }
.steps-timeline li { width: 190px; position: relative; }
.steps-timeline li + li::before {
    content: "";
    position: absolute;
    left: -15px;
    top: 50%;
    width: 12px;
    height: 2px;
    background: var(--haze-dim);
}
.steps-timeline a { display: grid; gap: 8px; color: inherit; text-decoration: none; }
.steps-timeline .what { display: flex; flex-direction: column; }
.steps-timeline time { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.steps-timeline strong { color: var(--ink); }

/* A visit's page: its story, then each camera down a rail. */
.page-head h1 .icon { width: 26px; height: 26px; margin-right: 8px; vertical-align: -3px; color: var(--accent); }
.story { margin: 0 0 24px; padding: 22px 26px; border-radius: var(--r-l); background: var(--night); }
.story-text { margin: 0 0 8px; color: #fff; font-size: 1.3rem; line-height: 1.45; max-width: 70ch; }
.story .hint { margin: 0; color: var(--haze-dim); }
.visit-steps { list-style: none; margin: 0; padding: 0; max-width: 980px; }
.visit-steps li { position: relative; display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 0 22px; padding-bottom: 18px; }
.visit-steps li::before { content: ""; position: absolute; top: 6px; bottom: -6px; left: 127px; width: 2px; background: var(--line); }
.visit-steps li:last-child::before { display: none; }
.visit-steps li::after { content: ""; position: absolute; top: 4px; left: 122px; width: 12px; height: 12px; border: 2px solid var(--surface); border-radius: 50%; background: var(--accent); }
.visit-steps .rail { display: grid; align-content: start; justify-items: end; gap: 2px; padding-top: 1px; }
.visit-steps time { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.visit-steps .gap { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.visit-steps .step { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; margin-left: 14px; color: inherit; text-decoration: none; }
.visit-steps .step:hover strong { text-decoration: underline; }
.visit-steps .crop { position: relative; }
.visit-steps .step-text { display: grid; gap: 4px; min-width: 0; }
.visit-steps .step-text strong { color: var(--ink); font-size: 1.05rem; }
.visit-steps .desc { color: var(--text); line-height: 1.45; }
@media (max-width: 640px) {
    .visit-steps li { grid-template-columns: 74px minmax(0, 1fr); gap: 0 14px; }
    .visit-steps li::before { left: 81px; }
    .visit-steps li::after { left: 76px; }
    .visit-steps .step { grid-template-columns: minmax(0, 1fr); margin-left: 12px; }
}

.links .list li { grid-template-columns: minmax(0, 1fr) auto; }
.links label.check { margin: 0; font-weight: 500; }

@media (max-width: 860px) {
    .journeys a { grid-template-columns: 1fr; gap: 8px; }
    .journeys .when { text-align: left; flex-direction: row; gap: 10px; }
}

/* ---------- People (M7) ---------- */

.note.popia { max-width: 860px; margin: 0 0 18px; }
.note.popia strong { color: var(--ink); }
.lede.gap { margin: 0 0 24px; color: var(--muted); }

/* ---------- Plates (M8) ---------- */

.search { display: flex; gap: 8px; }
.search input { width: 240px; }
.plates-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; max-width: 1280px; align-items: start; }
.plate {
    display: inline-block;
    padding: 1px 7px;
    border: 1.5px solid var(--ink);
    border-radius: 4px;
    color: var(--ink);
    font-weight: 700;
    letter-spacing: 0.06em;
    font-variant-numeric: tabular-nums;
}
.tag { margin-left: 6px; font-size: 0.8rem; color: var(--muted); }
.tag.watch { color: var(--bad); font-weight: 600; }
.tag.allow { color: var(--ok); }
.plate-list li { grid-template-columns: minmax(0, 1fr) auto; }
.plate-list .detail-text { grid-column: 1; }
.plate-list form { grid-row: 1 / span 2; grid-column: 2; }
.not-sure { color: var(--muted); }
img.close-up { display: block; height: 40px; max-width: 170px; object-fit: contain; border-radius: 4px; background: var(--mist); }
.plate-close-up { margin: 4px 0 0; }
.plate-close-up img { display: block; max-width: 100%; height: auto; border-radius: var(--r-s); background: var(--mist); }
.reads { display: grid; gap: 2px; font-size: 0.85rem; color: var(--text); }
.reads .read { font-weight: 700; letter-spacing: 0.04em; color: var(--ink); font-variant-numeric: tabular-nums; }
.reads .times, .reads .decided { color: var(--muted); }
.reads .agrees { color: var(--ok); }
.reads .differs { color: var(--bad); }

@media (max-width: 860px) {
    .plates-layout { grid-template-columns: 1fr; }
    .search input { width: 100%; }
}

/* ---------- Descriptions and the briefing (M9) ---------- */

.description { margin: 0 0 18px; padding: 12px 14px; border-left: 3px solid var(--moon); background: var(--mist); border-radius: 0 var(--r) var(--r) 0; color: var(--ink); }
/* One line across the page (Events), opening to the whole text. */
.briefing { margin: 0 0 20px; border-radius: var(--r-l); background: var(--night); color: var(--haze); }
.briefing summary {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 11px 16px;
    cursor: pointer;
    list-style: none;
}
.briefing summary::-webkit-details-marker { display: none; }
.briefing summary strong { flex: none; color: #fff; font-size: 0.95rem; }
.briefing .gist { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.briefing summary::after { content: "Read"; flex: none; margin-left: auto; color: var(--moon); font-size: 0.85rem; }
.briefing[open] summary::after { content: "Hide"; }
.briefing[open] .gist { visibility: hidden; }
.briefing p { max-width: 110ch; padding: 0 16px 14px; color: #fff; }
input.short { width: 140px; }

/* ---------- Search (M10) ---------- */

.search.big { max-width: 640px; margin-bottom: 18px; }
.search.big input { width: 100%; font-size: 1.05rem; padding: 11px 13px; }
.results { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; max-width: 1280px; }
.results a { display: grid; gap: 4px; color: inherit; text-decoration: none; }
.results strong { color: var(--ink); }
.results .where { color: var(--muted); font-size: 0.88rem; }
.results a:hover strong { color: var(--accent); }

/* ---------- Rules (M11) ---------- */

.typed { max-width: 860px; margin-bottom: 36px; }
.typed label { margin-top: 0; }
.typed-row { display: flex; gap: 10px; }
.typed-row input { flex: 1; }
.typed .error { margin-top: 12px; }
/* Rules as cards: the rule, how its alerts of the week turned out, what you can do. */
.rule-list { display: flex; flex-direction: column; gap: 12px; border-top: 0; }
.rule-list li { grid-template-columns: minmax(0, 3fr) minmax(170px, 1.4fr) auto; gap: 14px 24px; padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--lift); }
.rule-list .name { font-size: 1.08rem; font-weight: 700; }
.rule-week { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; font-size: 0.9rem; }
.rule-week .top { display: flex; flex-direction: column; }
.rule-week strong { color: var(--ink); font-weight: 600; }
.rule-week:hover strong { color: var(--accent); }
.split { display: flex; gap: 3px; height: 8px; }
.split i { min-width: 6px; border-radius: 4px; background: #e0a528; }
.split i.real { background: var(--accent); }
.split i.false { background: var(--haze-dim); }
@media (max-width: 860px) {
    .rule-list li { grid-template-columns: 1fr; }
}
.rule-list .detail-text { margin: 4px 0 0; }
.rule-list li.off .name, .rule-list li.off .detail-text { opacity: 0.6; }
.rule-form fieldset { border: none; padding: 0; margin: 0; min-width: 0; }
.rule-form legend { padding: 0; margin-bottom: 4px; font-size: 1.05rem; font-weight: 600; color: var(--ink); }
.rule-form .label { display: block; margin: 16px 0 6px; font-weight: 600; color: var(--ink); font-size: 0.9rem; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
label.choice {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-s);
    background: var(--surface);
    font-weight: 500;
    cursor: pointer;
}
label.choice:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
label.choice input { width: auto; margin: 0; accent-color: var(--accent); }
/* Only the chosen trigger's fields show: no script. */
.rule-form .only { display: none; }
.rule-form:has([name="Form.When"][value="seen"]:checked) .only.seen,
.rule-form:has([name="Form.When"][value="crossing"]:checked) .only.crossing,
.rule-form:has([name="Form.When"][value="entry"]:checked) .only.entry,
.rule-form:has([name="Form.When"][value="stay"]:checked) .only.stay,
.rule-form:has([name="Form.When"][value="face"]:checked) .only.face,
.rule-form:has([name="Form.When"][value="speed"]:checked) .only.speed,
.rule-form:has([name="Form.When"][value="plate"]:checked) .only.plate,
.rule-form:has([name="Form.When"][value="state"]:checked) .only.state { display: block; }
.rule-form:has([name="Form.When"][value="face"]:checked) .not.face,
.rule-form:has([name="Form.When"][value="speed"]:checked) .not.speed,
.rule-form:has([name="Form.When"][value="plate"]:checked) .not.speed,
.rule-form:has([name="Form.When"][value="state"]:checked) .not.speed { display: none; }
.teach-now { display: grid; gap: 8px; align-content: start; }
.teach-now form { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.teach-now .hint { margin: 0; }
.form.wide { max-width: 640px; }
.you-asked { color: var(--muted); }
.rule-text { margin: 10px 0 8px; font-size: 1.2rem; font-weight: 600; color: var(--ink); max-width: 46ch; }

/* ---------- Walls (M12) ---------- */

.drawing svg .wall-shape { stroke: var(--bad); stroke-dasharray: 14 8; }
.areas-list .item.wall { border-left-color: var(--bad); }
.areas-list .item .wall-hint { display: none; margin-top: 4px; }
.areas-list .item.wall .wall-hint { display: block; }
.areas-list .item.wall .directions, .areas-list .item.wall [data-act=flip] { display: none; }

/* Doors and windows: staying at one is a sign of a break-in. */
.drawing svg .door-shape { stroke: var(--bad); stroke-dasharray: 10 6; }
.areas-list .item.door { border-left-color: var(--bad); }
.areas-list .item .door-hint { display: none; margin-top: 4px; }
.areas-list .item.door .door-hint { display: block; }
.k-camera .crop { background-size: cover; }
.nvrs { margin-top: 36px; }

/* ---------- System (resources and software) ---------- */

.sys { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.stat {
    display: grid;
    gap: 4px;
    padding: 16px 20px;
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    background: var(--surface);
}
.stat .k { color: var(--muted); font-size: 0.85rem; }
.stat strong { color: var(--ink); font-size: 1.6rem; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .sub { color: var(--muted); font-size: 0.82rem; min-height: 1.2em; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.chart { margin: 0; padding: 12px 14px 6px; border-radius: var(--r-l); border: 1px solid var(--line); background: var(--surface); }
.chart figcaption { color: var(--ink); font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.chart .plot { position: relative; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--accent); fill-opacity: 0.12; stroke: none; }
.chart .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart-tip {
    position: absolute;
    top: 0;
    padding: 3px 8px;
    border-radius: var(--r-s);
    background: var(--night);
    color: #fff;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    pointer-events: none;
}
.sys-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 22px; align-items: start; }
.sys-cols .panel, .sys .panel { max-width: none; margin: 0; }
/* Tables are cards: a white sheet with a quiet head row. */
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.92rem; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); overflow: hidden; }
table.data th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.82rem; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--paper); }
table.data td { padding: 10px 16px; border-bottom: 1px solid var(--line); color: var(--ink); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .muted { color: var(--muted); }
table.data .behind { color: var(--bad); }
.software .buttons { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.software .buttons form { margin: 0; }
.update-state { color: var(--ink); }
#version { overflow-wrap: anywhere; }
.update-state[data-state="failed"] { color: var(--bad); }
.update-state[data-state="done"] { color: var(--ok); }
.update-log summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.update-log pre {
    max-height: 320px;
    overflow: auto;
    margin-top: 8px;
    padding: 12px;
    border-radius: var(--r);
    background: var(--night-deep);
    color: var(--haze);
    font-size: 0.78rem;
    white-space: pre-wrap;
}

/* ---------- Full width on every page (23 November 2026: the owner's wide screens) ----------
   Pages use the whole window. Text keeps a readable line length (ledes, hints, notes), single
   small forms stay narrow, and pictures are sized to fit the window's height. */
.page-head, .panel, .pair, .wall, .detail, .areas, .journeys, .steps-timeline, .plates-layout,
.results, .typed, .note.popia, .empty, table.audit { max-width: none; }
.detail { grid-template-columns: minmax(0, 1fr) 340px; }
/* A 16:9 picture the full width of a wide screen would be taller than the window. */
.detail .media, .detail > .frame, .areas-canvas { width: 100%; max-width: calc((100vh - 190px) * 16 / 9); }
.settings {
    max-width: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 32px 44px;
    align-items: start;
}
.settings .panel + .panel { margin-top: 0; }
/* Each section of Settings is a card; the links above jump to one, and Save stays in reach. */
.settings .panel { max-width: none; padding: 20px 24px 24px; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--lift); scroll-margin-top: 72px; }
.settings .panel > h2 { font-size: 1.2rem; font-weight: 700; }
.chips.jump { position: sticky; top: 0; z-index: 2; margin: -8px 0 12px; padding: 8px 0; background: var(--paper); }
/* The rule editor says the rule back as a sentence, above its fields. */
.sentence { grid-column: 1 / -1; padding: 18px 22px; border-radius: var(--r-xl); background-color: var(--night); background-image: radial-gradient(#1a3550 1px, transparent 1px); background-size: 18px 18px; color: #fff; }
.sentence .kicker { display: block; margin-bottom: 4px; color: var(--moon); font-size: 0.88rem; font-weight: 600; }
.sentence p { font-size: 1.35rem; line-height: 1.35; font-weight: 600; letter-spacing: -0.01em; }
.sentence p.problem { color: #f5c98a; font-weight: 500; font-size: 1.1rem; }
.sentence p button { display: inline; min-height: 0; padding: 0 2px; border: 0; border-bottom: 2px dashed var(--moon); border-radius: 4px 4px 0 0; background: none; color: var(--moon); font: inherit; text-align: left; }
.sentence p button:hover, .sentence p button:focus-visible { background: rgba(124, 196, 242, 0.14); }
.sentence .tried { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid #1f3d5b; color: var(--haze); }
.sentence .tried:empty { display: none; }
.sentence .tried strong { color: #fff; font-size: 1.6rem; line-height: 1; font-variant-numeric: tabular-nums; }
.sentence .tried .cant { flex-basis: 100%; color: #f5c98a; font-size: 0.9rem; }
.sentence .tried-note { margin-top: 6px; color: var(--haze-dim); font-size: 0.82rem; font-weight: 400; line-height: 1.4; letter-spacing: 0; }
/* The group a tapped part of the sentence took you to. */
.settings .panel.lit { outline: 3px solid var(--moon); outline-offset: 2px; }
/* Settings, a section at a time. The first shows until a link picks another; a form sent back
   with a mistake shows every section, so the mistake can't hide. */
.settings-tabs .settings { display: block; max-width: 900px; }
.settings-tabs .settings > .panel { display: none; }
.settings-tabs .settings > .panel:target,
.settings-tabs:not(:has(.panel:target)) .settings > .panel:first-of-type,
.settings-tabs .settings:has(.input-validation-error) > .panel,
.settings-tabs .settings:has(.validation-summary-errors) > .panel { display: block; }
.settings-tabs .settings:has(.input-validation-error) > .panel + .panel,
.settings-tabs .settings:has(.validation-summary-errors) > .panel + .panel { margin-top: 20px; }
.settings-tabs:has(#site:target) .jump a[href="#site"],
.settings-tabs:has(#alerts:target) .jump a[href="#alerts"],
.settings-tabs:has(#recordings:target) .jump a[href="#recordings"],
.settings-tabs:has(#fine-tuning:target) .jump a[href="#fine-tuning"],
.settings-tabs:has(#reid:target) .jump a[href="#reid"],
.settings-tabs:not(:has(.panel:target)) .jump a[href="#site"] { border-color: var(--ink); background: var(--ink); color: var(--paper); font-weight: 600; }
.save-bar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 14px; padding: 12px 0; background: linear-gradient(transparent, var(--paper) 30%); }
.save-bar .hint { margin: 0; }
.setting-head { display: flex; align-items: center; gap: 10px; margin-top: 24px; font-size: 1rem; }
/* A module's state where it's tuned (Settings); switched on the Modules page. */
.module-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 1px 9px 1px 7px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0;
    text-decoration: none;
    vertical-align: 1px;
    background: var(--mist);
    color: var(--muted);
}
.module-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.module-pill.on { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ink); }
.module-pill.on::before { background: var(--ok); }
.module-pill:hover { outline: 1px solid var(--accent); }
.settings > .error, .settings > .buttons { grid-column: 1 / -1; }
.panel .hint, .empty p { max-width: 80ch; }
.charts > *, .sys-cols > *, .stat-tiles > * { min-width: 0; }
@media (max-width: 860px) {
    .detail { grid-template-columns: 1fr; }
    .settings, .charts, .sys-cols { grid-template-columns: 1fr; }
}

/* ---------- Which cameras connect: a map and a panel (links.js) ---------- */

.connect { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; margin-bottom: 16px; }
.connect[hidden] { display: none; }
.link-map {
    position: relative;
    height: clamp(460px, 64vh, 740px);
    border-radius: var(--r-l);
    background:
        radial-gradient(circle at 1px 1px, rgba(200, 211, 222, 0.09) 1px, transparent 0) 0 0 / 22px 22px,
        radial-gradient(ellipse at 50% 40%, var(--night-2), var(--night) 70%);
    overflow: hidden;
    touch-action: none;
}
.link-lines, .link-pills { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.link-lines path { fill: none; stroke-linecap: round; }
.link-lines .link { transition: opacity 0.15s; }
.link-lines .glow { stroke: var(--moon); stroke-width: 14; opacity: 0.12; }
.link-lines .core { stroke: var(--moon); stroke-width: 3.5; opacity: 0.85; }
.link-lines .flow { stroke: #fff; stroke-width: 3.5; stroke-dasharray: 0.5 18; opacity: 0.75; animation: link-flow 1.8s linear infinite; }
.link-lines .link.on .glow { stroke-width: 20; opacity: 0.28; }
.link-lines .link.on .core { stroke: #d7eefc; stroke-width: 4.5; opacity: 1; }
.link-lines .link.dim { opacity: 0.14; }
.link-lines .link.dim .flow { animation: none; opacity: 0; }
@keyframes link-flow { to { stroke-dashoffset: -18.5; } }
@media (prefers-reduced-motion: reduce) {
    .link-lines .flow { animation: none; opacity: 0; }
}
.link-pills .pill {
    position: absolute;
    transform: translate(-50%, -50%);
    padding: 2px 9px;
    border: 1px solid rgba(124, 196, 242, 0.55);
    border-radius: 999px;
    background: var(--night);
    color: var(--haze);
    font-size: 0.74rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    transition: opacity 0.15s;
}
.link-pills .pill.on { border-color: var(--moon); color: #fff; }
.link-pills .pill.dim { opacity: 0.15; }
.cam-node {
    position: absolute;
    z-index: 1;
    width: clamp(130px, 13vw, 200px);
    border-radius: 12px;
    background: var(--night-deep);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    outline: 2px solid rgba(200, 211, 222, 0.14);
    cursor: pointer;
    user-select: none;
    touch-action: none;
    transition: transform 0.15s, outline-color 0.15s, opacity 0.15s, box-shadow 0.15s;
}
.cam-node img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; pointer-events: none; }
.cam-node .cam-name {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 18px 10px 7px;
    border-radius: 0 0 12px 12px;
    background: linear-gradient(transparent, rgba(7, 16, 28, 0.92));
    color: #fff;
    font-size: 0.86rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cam-node .cam-count {
    position: absolute;
    top: -9px;
    right: -9px;
    display: grid;
    place-items: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    border: 2px solid var(--night);
    border-radius: 12px;
    background: var(--moon);
    color: var(--night);
    font-size: 0.78rem;
    font-weight: 700;
}
.cam-node .cam-count[hidden] { display: none; }
.cam-node.nopic img { visibility: hidden; }
.cam-node .cam-hint {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(7, 16, 28, 0.85);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.15s;
}
.cam-node .cam-hint:empty { display: none; }
.cam-node:hover { outline-color: rgba(200, 211, 222, 0.5); }
.cam-node:focus-visible { outline: 3px solid var(--moon); outline-offset: 3px; }
.cam-node.picked { z-index: 3; transform: scale(1.06); outline: 3px solid var(--moon); box-shadow: 0 0 0 6px rgba(124, 196, 242, 0.22), 0 12px 30px rgba(0, 0, 0, 0.55); }
.cam-node.linked { outline: 3px solid rgba(124, 196, 242, 0.75); }
.cam-node.linked .cam-hint { opacity: 1; background: var(--moon); color: var(--night); }
.cam-node.open { opacity: 0.6; outline-style: dashed; }
.cam-node.open:hover { opacity: 1; }
.cam-node.open:hover .cam-hint { opacity: 1; }
.cam-node.dragging { z-index: 4; cursor: grabbing; transform: scale(1.06); transition: none; }

.connect-panel { min-width: 0; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); }
.connect-panel h2 { margin: 0 0 6px; }
.connect-panel h3 { margin: 18px 0 8px; font-size: 0.92rem; }
.connect-panel p { margin: 0 0 10px; color: var(--text); }
.connect-summary { color: var(--ink) !important; font-weight: 600; }
.cam-picker { display: none; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.cam-picker .chip { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-size: 0.88rem; cursor: pointer; }
.cam-picker .chip.on { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.panel-none[hidden], .panel-camera[hidden] { display: none; }
.panel-pic { position: relative; margin: 0 0 10px; }
.panel-pic img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r); background: var(--night-deep); }
.panel-pic .cam-name { position: absolute; right: 0; bottom: 0; left: 0; padding: 22px 12px 9px; border-radius: 0 0 var(--r) var(--r); background: linear-gradient(transparent, rgba(7, 16, 28, 0.9)); color: #fff; font-size: 1.1rem; font-weight: 650; }
.connect-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 4px; }
.connect-list li { border-radius: var(--r); }
.connect-list li.on { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.connect-list label.switch { display: grid; grid-template-columns: auto 64px minmax(0, 1fr); align-items: center; gap: 10px; margin: 0; padding: 6px 8px; cursor: pointer; }
.connect-list img { width: 64px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; background: var(--night-deep); }
.connect-list span { display: grid; min-width: 0; }
.connect-list strong { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.connect-list small { color: var(--muted); font-size: 0.8rem; }
.switch input { appearance: none; position: relative; flex: none; width: 38px; height: 22px; margin: 0; border-radius: 11px; background: var(--line); cursor: pointer; transition: background 0.15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); transition: transform 0.15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.suggest { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.suggest li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: var(--r); background: var(--mist); }
.link-list summary { margin: 6px 0 10px; color: var(--muted); cursor: pointer; }
.unsaved { align-self: center; color: var(--muted); font-size: 0.9rem; }
@media (max-width: 1100px) {
    .connect { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 760px) {
    .connect { grid-template-columns: minmax(0, 1fr); }
    .link-map { display: none; }
    .cam-picker { display: flex; }
    #link-tidy { display: none; }
}
.links .buttons { display: flex; align-items: center; gap: 14px; }

/* ---------- Learning: patterns and what didn't fit ---------- */

.learn-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 22px 32px; align-items: start; margin-bottom: 26px; }
.learn-cols.three { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.learn-cols > * { min-width: 0; }
.learn-cols .panel + .panel { margin-top: 0; }
.note-text { color: var(--ink); font-size: 1.02rem; line-height: 1.55; max-width: 90ch; }
.learn-note h3 { margin: 18px 0 8px; }
.rule-ideas { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rule-ideas li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: var(--r); background: var(--mist); color: var(--ink); }
.rule-ideas form { margin: 0; }
.anomalies { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.anomaly a { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 2px 14px; padding: 10px 6px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.anomaly a:hover { background: var(--mist); }
.anomaly .when { grid-row: span 3; color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.anomaly .kind { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.anomaly strong { color: var(--ink); font-weight: 600; }
.anomaly .why { color: var(--text); font-size: 0.9rem; }
.weeks { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 18px 26px; margin-top: 12px; }
.week { margin: 0; min-width: 0; }
.week figcaption { margin-bottom: 6px; color: var(--ink); font-weight: 600; }
.heat { display: grid; grid-template-columns: 30px repeat(24, minmax(0, 1fr)); gap: 2px; align-items: center; font-size: 0.68rem; color: var(--muted); }
.heat .h { text-align: left; font-variant-numeric: tabular-nums; }
.heat .c { aspect-ratio: 1; border-radius: 2px; background: color-mix(in srgb, var(--accent) var(--p), var(--mist)); }
.heat .c:hover { outline: 2px solid var(--ink); outline-offset: 1px; }
.heat-legend { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--muted); font-size: 0.82rem; }
.heat-legend i { width: 120px; height: 10px; border-radius: 2px; background: linear-gradient(90deg, var(--mist), var(--accent)); }
@media (max-width: 860px) {
    .learn-cols, .learn-cols.three, .weeks { grid-template-columns: minmax(0, 1fr); }
    .anomaly a { grid-template-columns: 1fr; }
    .anomaly .when { grid-row: auto; }
}

/* A call to action at the top of a page (e.g. Training data with collecting off). */
.callout {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px 28px;
    margin: 0 0 22px;
    padding: 18px 22px;
    border: 1px solid transparent;
    border-radius: var(--r-xl);
    background: var(--tint);
}
.callout h2 { margin-bottom: 4px; }
.callout p { max-width: 80ch; color: var(--text); }
.callout form { margin: 0; }

/* The operator card and its training rings (Learning). */
.operator {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 18px 36px;
    margin: 0 0 18px;
    padding: 18px 22px;
    border-radius: var(--r-l);
    background: var(--night);
    color: var(--haze);
}
.operator .live { color: #fff; }
.op-line { margin: 10px 0 4px; color: #fff; font-size: 1.12rem; line-height: 1.5; max-width: 70ch; }
.operator .hint { color: var(--haze-dim); }
.rings { display: flex; flex-wrap: wrap; gap: 14px 18px; }
.ring { margin: 0; display: grid; justify-items: center; gap: 4px; width: 96px; }
.ring svg { width: 78px; height: 78px; }
.ring .track { fill: none; stroke: rgba(200, 211, 222, 0.16); stroke-width: 8; }
.ring .done { fill: none; stroke: var(--moon); stroke-width: 8; stroke-linecap: round; }
.ring text { fill: #fff; font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }
.ring figcaption { display: grid; text-align: center; font-size: 0.78rem; line-height: 1.3; }
.ring figcaption strong { max-width: 96px; overflow: hidden; color: #fff; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.ring figcaption span { color: var(--haze-dim); }
.routines td { vertical-align: middle; }
.often { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.often i { width: 70px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--accent) var(--p), var(--line) var(--p)); }

/* Picture checks (Rules › Picture checks). */
.checks-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 22px 36px; align-items: start; }
.checks-cols > * { min-width: 0; }
.checks-cols .panel + .panel { margin-top: 0; }
.check-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.check-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.check-list li.off .check-what { opacity: 0.7; }
.check-what { display: grid; gap: 2px; min-width: 0; }
.check-what strong { color: var(--ink); }
.check-what span { color: var(--muted); font-size: 0.88rem; }
.check-what .check-last { color: var(--text); }
.check-what .check-last.yes { color: var(--bad); }
.check-what .check-sure { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 0; }
.check-sure label { margin: 0; color: var(--muted); font-size: 0.88rem; font-weight: 400; }
.check-sure input { width: 72px; padding: 4px 8px; }
.check-sure .btn { padding: 4px 12px; font-size: 0.85rem; }
/* Pictures a check got wrong, shown to the model as known no's: small, with when and Forget. */
.check-wrong { margin: 8px 0 0; }
.check-wrong ul { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 0; padding: 0; list-style: none; }
.check-list .check-wrong li { display: grid; gap: 3px; justify-items: start; padding: 0; border: 0; }
.check-wrong img { display: block; width: 128px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r-s); background: var(--night-deep); }
.check-wrong form { margin: 0; }
.check-wrong button.danger { font-size: 0.85rem; }
.row-actions form { margin: 0; }
@media (max-width: 860px) {
    .checks-cols { grid-template-columns: minmax(0, 1fr); }
}

/* The focused clock (Learning › Overview): the site's day as a clock, one routine (or one thing
   that didn't fit) picked at a time, its card beside it. */
.learn-tabs { display: flex; width: max-content; max-width: 100%; margin: 0 0 18px; overflow-x: auto; scrollbar-width: none; }
.learn-tabs a { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.learn-tabs .n { min-width: 22px; padding: 1px 7px; border-radius: 10px; background: var(--line); color: var(--text); font-size: 0.75rem; font-weight: 650; text-align: center; font-variant-numeric: tabular-nums; }
.learn-tabs a.on .n { background: var(--accent); color: var(--accent-ink); }
.operator.focus { display: grid; grid-template-columns: minmax(300px, 580px) minmax(320px, 1fr); align-items: center; gap: 24px 52px; padding: 28px 32px; }
.rhythm-clock { margin: 0; min-width: 0; }
.rhythm-clock svg { display: block; width: 100%; height: auto; }
.rhythm-track { fill: none; stroke: rgba(200, 211, 222, 0.08); stroke-width: 20; }
.rhythm-clock .tick { stroke: rgba(200, 211, 222, 0.32); stroke-width: 1; }
.rhythm-clock .tick.major { stroke: rgba(200, 211, 222, 0.7); stroke-width: 2; }
.rhythm-clock .hour { fill: var(--haze-dim); font-size: 11px; }
.rhythm-clock a.pick { cursor: pointer; outline: none; }
.routine-arc { fill: none; stroke: var(--moon); stroke-width: 18; stroke-linecap: round; transition: stroke 0.15s; }
.arc-hit { fill: none; stroke: transparent; stroke-width: 34; stroke-linecap: round; pointer-events: stroke; }
.dot-hit { fill: transparent; }
.rhythm-clock a.pick:hover .routine-arc,
.rhythm-clock a.pick:focus-visible .routine-arc { opacity: 1 !important; stroke: #d7eefc; }
.rhythm-clock a.pick.on .routine-arc { opacity: 1 !important; stroke: #fff; filter: drop-shadow(0 0 6px rgba(124, 196, 242, 0.85)); }
.rhythm-clock a.pick:focus-visible .arc-hit { stroke: rgba(255, 255, 255, 0.14); }
.now-hand { stroke: #fff; stroke-width: 2; stroke-linecap: round; opacity: 0.7; }
.odd-dot { fill: var(--bad); stroke: var(--night); stroke-width: 2.5; }
.rhythm-clock a.pick:hover .odd-dot,
.rhythm-clock a.pick:focus-visible .odd-dot,
.rhythm-clock a.pick.on .odd-dot { stroke: #fff; stroke-width: 3; }
.centre-number { fill: #fff; font-size: 46px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.centre-label { fill: var(--haze-dim); font-size: 13px; }
.centre-label.strong { fill: #fff; font-size: 15px; font-weight: 600; }
.rhythm-key { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin-top: 10px; color: var(--haze-dim); font-size: 0.8rem; }
.rhythm-key span { display: inline-flex; align-items: center; gap: 6px; }
.rhythm-key i { display: inline-block; flex: none; }
.key-ring { width: 14px; height: 14px; border: 3px solid rgba(200, 211, 222, 0.25); border-radius: 50%; }
.key-arc { width: 18px; height: 6px; border-radius: 3px; background: var(--moon); }
.key-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }

.focus-side { display: grid; gap: 16px; align-content: start; min-width: 0; }
.focus-side .op-line { margin: 0; color: var(--haze); font-size: 1.04rem; }
.focus-side .hint { margin: 0; }
.pick-card { padding: 20px 22px; border: 1px solid rgba(124, 196, 242, 0.25); border-radius: var(--r-l); background: var(--night-2); }
.pick-card[hidden] { display: none; }
.pick-card.odd { border-color: rgba(194, 69, 58, 0.6); }
.pick-card.empty p { margin: 0; color: var(--haze); }
.pick-card .kicker { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; color: var(--haze-dim); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.pick-card .kicker svg { width: 16px; height: 16px; }
.pick-card h2 { margin: 0 0 8px; color: #fff; font-size: 1.6rem; line-height: 1.2; overflow-wrap: anywhere; }
.pick-card h2:focus { outline: none; }
.pick-card p { margin: 0 0 8px; }
.pick-card .usual { color: var(--haze); }
.pick-card .usual strong { color: #fff; font-variant-numeric: tabular-nums; }
.pick-card .why { color: var(--haze); line-height: 1.5; }
.pick-card .often { display: flex; color: var(--haze-dim); }
.pick-card .often i { width: 140px; background: linear-gradient(90deg, var(--moon) var(--p), rgba(200, 211, 222, 0.16) var(--p)); }
.today { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: 600; }
.today::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.today.seen { color: var(--ok); }
.today.due { color: var(--accent); }
.today.missed { color: var(--bad); }
.today.off { color: var(--muted); font-weight: 500; }
.pick-card .today.seen { color: #74d39a; }
.pick-card .today.due { color: var(--moon); }
.pick-card .today.missed { color: #ff9b92; }
.pick-card .today.off { color: var(--haze-dim); }
.pick-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pick-nav a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: var(--r); background: rgba(200, 211, 222, 0.08); color: #fff; font-size: 0.88rem; font-weight: 500; text-decoration: none; }
.pick-nav a:hover { background: rgba(200, 211, 222, 0.18); }
.pick-nav a:focus-visible { outline: 2px solid var(--moon); outline-offset: 2px; }
.pick-nav svg { width: 16px; height: 16px; }
.pick-nav .later svg { transform: scaleX(-1); }
.focus-status { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px 18px; padding-top: 16px; border-top: 1px solid rgba(200, 211, 222, 0.12); }
.odd-count { display: grid; justify-items: center; gap: 4px; width: 96px; color: #fff; text-align: center; text-decoration: none; }
.odd-count strong { display: grid; place-items: center; box-sizing: border-box; width: 78px; height: 78px; border: 8px solid rgba(194, 69, 58, 0.5); border-radius: 50%; font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.odd-count span { color: var(--haze-dim); font-size: 0.78rem; line-height: 1.3; }
.odd-count:hover strong { border-color: var(--bad); }
.rings.light .ring .track { stroke: var(--line); }
.rings.light .ring .done { stroke: var(--accent); }
.rings.light .ring text { fill: var(--ink); }
.rings.light .ring figcaption strong { color: var(--ink); }
.rings.light .ring figcaption span { color: var(--muted); }
.routines .today { font-size: 0.85rem; }
.routines .clock { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 1000px) {
    .operator.focus { grid-template-columns: minmax(0, 1fr); padding: 20px; }
    .rhythm-clock { width: 100%; max-width: 520px; margin: 0 auto; }
}
@media (max-width: 600px) {
    .learn-tabs { flex-wrap: wrap; width: auto; }
    .operator.focus { padding: 16px; }
    .pick-card { padding: 16px; }
    .pick-card h2 { font-size: 1.35rem; }
    .pick-nav a { flex: 1 1 auto; justify-content: center; }
    .focus-status { justify-content: space-between; gap: 12px 6px; }
    .focus-status .ring, .odd-count { width: 88px; }
}
@media (max-width: 600px) {
    /* Each routine as a small block: its time on the left, what, where, when, how often and today beside it. */
    .routines thead { display: none; }
    .routines, .routines tbody { display: block; }
    .routines tr { display: grid; grid-template-columns: 52px minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "clock what what" "clock where when" "clock often today"; gap: 3px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
    table.data.routines td { padding: 0; border: 0; }
    .routines td:nth-child(1) { grid-area: what; font-weight: 600; }
    .routines td:nth-child(2) { grid-area: where; color: var(--muted); }
    .routines td:nth-child(3) { grid-area: clock; font-size: 1.05rem; }
    .routines td:nth-child(4) { grid-area: when; color: var(--muted); }
    .routines td:nth-child(5) { grid-area: often; }
    .routines td:nth-child(6) { grid-area: today; }
    .routines .often i { display: none; }
    .routines .often { white-space: normal; }
}

/* An event that's part of a visit: its story and steps beside the picture. */
/* A possible break-in raised on this event: the signs Core counted. */
.break-in-box { margin: 0 0 18px; padding: 14px 18px; border-left: 4px solid var(--bad); border-radius: var(--r-l); background: var(--surface); }
.break-in-kicker { margin: 0 0 6px; color: var(--bad); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.break-in-box ul { margin: 0; padding-left: 18px; }
.break-in-box li + li { margin-top: 3px; }

.visit-box { margin: 0 0 18px; padding: 16px 18px; border-radius: var(--r-l); background: var(--night); color: var(--haze); }
.visit-kicker { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; color: var(--haze-dim); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.visit-kicker .icon { width: 16px; height: 16px; color: var(--moon); }
.visit-story { margin: 0 0 12px; color: #fff; font-size: 1.05rem; line-height: 1.45; }
.visit-mini { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 2px; }
.visit-mini a { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 10px; padding: 6px 8px; border-radius: var(--r); color: var(--haze); text-decoration: none; }
.visit-mini a:hover { background: rgba(200, 211, 222, 0.08); color: #fff; }
.visit-mini time { color: #fff; font-variant-numeric: tabular-nums; }
.visit-mini li.here a { background: rgba(124, 196, 242, 0.16); color: #fff; }
.visit-mini span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visit-all { color: var(--moon); font-weight: 600; text-decoration: none; }
.visit-all:hover { text-decoration: underline; }

/* "Not the same" on a visit's step: under its text, small. */
.visit-steps .step-out { grid-column: 2; margin: 6px 0 0 250px; }
.visit-steps .step-out .btn { padding: 4px 10px; font-size: 0.8rem; }
@media (max-width: 640px) {
    .visit-steps .step-out { margin-left: 12px; }
}

/* "3rd pass": a vehicle that came by before (casing's own count). */
.pass-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(194, 69, 58, 0.92);
    color: #fff;
    font-size: 0.74rem;
    font-weight: 650;
}

/* A vehicle's speed (vehicle speed), bottom right of its card; red when fast for the camera. */
.speed-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(7, 16, 28, 0.78);
    color: #fff;
    font-size: 0.76rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}
.speed-badge.fast { background: rgba(194, 69, 58, 0.92); }
.speed-correct { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; }
.speed-correct label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-weight: 500; }
.speed-correct .with-unit input { max-width: 90px; }

/* Cars that came back today: one row per car, its passes as a strip of pictures to compare. */
.repeats { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.repeat { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); }
.repeat.many { border-color: var(--bad); }
.repeat-car { display: grid; gap: 4px; align-content: start; }
.repeat-car .crop { border-radius: var(--r); margin-bottom: 6px; }
.repeat-car h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 1.05rem; }
.repeat-car h2 .icon { width: 18px; height: 18px; color: var(--accent); }
.repeat-count { margin: 0; color: var(--text); }
.repeat.many .repeat-count strong { color: var(--bad); }
.repeat-when { margin: 0; color: var(--muted); font-size: 0.85rem; }
.repeat-when time { color: var(--ink); font-variant-numeric: tabular-nums; }
.repeat-strip { list-style: none; margin: 0; padding: 0 0 8px; display: flex; gap: 10px; align-items: start; overflow-x: auto; scroll-snap-type: x proximity; }
.repeat-strip > li { position: relative; flex: 0 0 168px; scroll-snap-align: start; }
.repeat-strip .crop { border-radius: var(--r); }
.pass-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin: 6px 2px 0; color: var(--muted); font-size: 0.8rem; }
.pass-meta time { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.pass-meta .alike { color: var(--text); font-variant-numeric: tabular-nums; }
.pass-meta .cam { flex-basis: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.not-this-car { position: absolute; top: 6px; right: 6px; margin: 0; }
.not-this-car button {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--night-deep) 72%, transparent);
    color: var(--haze); /* light in both themes, on the dark chip */
    cursor: pointer;
}
.not-this-car button:hover, .not-this-car button:focus-visible { background: var(--bad); color: #fff; }
.not-this-car .icon { width: 14px; height: 14px; }
@media (max-width: 760px) {
    .repeat { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .repeat-car { grid-template-columns: 120px minmax(0, 1fr); column-gap: 12px; }
    .repeat-car .crop { grid-row: span 3; margin: 0; }
    .repeat-strip > li { flex-basis: 136px; }
}

/* What the language model was asked (System). */
.model-filter { display: flex; flex-wrap: wrap; width: auto; margin: 0 0 18px; }
.model-filter a { display: inline-flex; align-items: center; gap: 6px; }
.model-filter .n { min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--line); color: var(--text); font-size: 0.75rem; font-weight: 650; text-align: center; }
.calls { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.call { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); }
.call.unanswered { border-style: dashed; }
.call-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 0.88rem; }
.call-head time { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.call-head .chip { padding: 2px 9px; border-radius: 999px; background: var(--mist); color: var(--ink); font-weight: 600; }
.call-answer { margin: 8px 0 6px; color: var(--ink); line-height: 1.45; }
.call.unanswered .call-answer { color: var(--muted); }
.call details summary { color: var(--muted); font-size: 0.85rem; cursor: pointer; }
.call pre { margin: 8px 0 0; padding: 10px 12px; border-radius: var(--r); background: var(--mist); color: var(--text); font-size: 0.82rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.pager { display: flex; gap: 10px; margin-top: 16px; }

/* False alarms: what the language model said about alerts, and what the box learned to ignore. */
.fa-gap { margin-bottom: 28px; }
.fa-panel { max-width: none; }
.fa-filters { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.fa-filters li { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 12px 18px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.fa-filters li.off .fa-what, .fa-filters li.off .fa-pic { opacity: 0.6; }
.fa-pic { display: grid; place-items: center; width: 96px; aspect-ratio: 1; border-radius: var(--r); background: var(--night-deep); color: var(--haze-dim); overflow: hidden; }
.fa-pic img { width: 100%; height: 100%; object-fit: cover; }
.fa-pic .icon { width: 28px; height: 28px; }
.fa-what { display: grid; gap: 3px; min-width: 0; }
.fa-what strong { color: var(--ink); }
.fa-what span { color: var(--muted); font-size: 0.88rem; }
.fa-says { margin: 0; color: var(--text); font-size: 0.9rem; font-style: italic; }
.fa-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.fa-head h2 { margin: 0; }
.fa-alerts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.fa-alerts li { display: grid; grid-template-rows: auto 1fr; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); overflow: hidden; }
.fa-alerts li.false { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.fa-shot .crop { border-radius: 0; }
.fa-body { display: grid; align-content: start; gap: 6px; padding: 10px 12px 12px; }
.fa-body p { margin: 0; }
.fa-title { color: var(--muted); font-size: 0.88rem; }
.fa-title strong { color: var(--ink); }
.fa-verdict { display: flex; flex-wrap: wrap; gap: 6px; }
.fa-verdict .tag, .verdict-box .tag { margin: 0; padding: 2px 8px; border-radius: 999px; background: var(--mist); color: var(--text); font-size: 0.8rem; font-weight: 600; }
.fa-verdict .tag.false, .verdict-box .tag.false { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.fa-verdict .tag.real, .verdict-box .tag.real { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.fa-verdict .tag.held, .verdict-box .tag.held { background: transparent; border: 1px solid var(--muted); color: var(--ink); }
.fa-body form, .verdict-box form { margin: 4px 0 0; }
.verdict-box { margin: 0 0 18px; padding: 14px 18px; border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line); }
.verdict-box p { margin: 0 0 6px; }
.verdict-kicker { color: var(--muted); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
@media (max-width: 640px) {
    .fa-filters li { grid-template-columns: 64px 1fr; }
    .fa-pic { width: 64px; }
    .fa-filters .row-actions { grid-column: 1 / -1; }
}

/* Models and trials (System). */
.trial-form { display: flex; flex-wrap: wrap; align-items: end; gap: 14px 18px; margin: 10px 0; }
.trial-form label { display: grid; gap: 4px; font-size: 0.88rem; color: var(--muted); }
.hint.age-poor strong { color: var(--bad); }

/* Teaching a picture check (Rules > Picture checks > Teach it). */
.teach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; list-style: none; margin: 12px 0 0; padding: 0; }
.teach-grid li { display: grid; gap: 4px; font-size: 0.88rem; }
.teach-grid img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r); background: var(--mist); display: block; }
.teach-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.teach-actions form { margin: 0; }

/* ---------- Parts shared by the redesigned pages (25 November 2026) ---------- */

/* A white card that lifts off the page. */
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--lift); padding: 18px 22px; }
.sheet.flat { box-shadow: none; }
.sheet > h2 { font-size: 1.13rem; font-weight: 700; }
.sheet > h2 .dim { font-weight: 500; color: var(--muted); }
.sheet-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin-bottom: 12px; }
.sheet-head h2 { font-size: 1.13rem; font-weight: 700; }
.sheet-head a { font-weight: 600; text-decoration: none; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.cols > .wide { flex: 3 1 420px; min-width: 0; }
.cols > .narrow { flex: 2 1 300px; min-width: 0; }
.numtiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 16px; }

/* The night band at the top of a page that leads with one thing. */
.hero {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px 28px;
    padding: 26px 30px;
    border-radius: 20px;
    background-color: var(--night);
    background-image: radial-gradient(#1a3550 1px, transparent 1px);
    background-size: 18px 18px;
    color: #fff;
    overflow: hidden;
}
.hero h1 { color: #fff; font-size: 2.1rem; line-height: 1.1; }
.hero p { margin-top: 8px; color: var(--haze); font-size: 1rem; max-width: 70ch; }
.hero .hero-text { flex: 1 1 320px; min-width: 0; }
.hero .hero-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.hero .btn.primary, .hero button.primary { background: var(--moon); color: var(--night-deep); }
.hero .btn.ghost, .hero button.ghost { background: transparent; border-color: #34506c; color: #fff; }
.hero .state-ring { flex: none; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--night-2); color: var(--moon); border: 3px solid var(--moon); }
.hero .state-ring.ok { color: #74d39a; border-color: #74d39a; }
.hero .state-ring.bad { color: #ef8f86; border-color: #ef8f86; }
.hero .state-ring .icon { width: 28px; height: 28px; stroke-width: 2; }
.hero + .panel, .hero + section { margin-top: 24px; }

/* Buttons a thumb can hit. */
.btn.big, button.big { min-height: 46px; padding: 10px 18px; border-radius: var(--r); font-weight: 600; }
.btn.plain, button.plain { background: var(--surface); border-color: var(--line); color: var(--ink); font-weight: 600; }
.btn.plain:hover, button.plain:hover { border-color: var(--haze-dim); }
.btn.warn, button.warn { background: var(--surface); border-color: var(--bad-line); color: var(--bad); font-weight: 600; }

/* Round filters: links that narrow a list, with the number each holds. */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips a, .chips button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
}
.chips a:hover, .chips button:hover { border-color: var(--haze-dim); color: var(--ink); }
.chips a.on, .chips button.on { border-color: var(--ink); background: var(--ink); color: var(--paper); font-weight: 600; }
.chips .n { opacity: 0.75; font-variant-numeric: tabular-nums; }

/* A small coloured word beside a thing. */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 6px; background: var(--mist); color: var(--ink); font-size: 0.86rem; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge.bad { background: var(--bad-bg); color: var(--bad-ink); }
.badge.tint { background: var(--tint); color: var(--tint-ink); }
.badge.violet { background: var(--violet-bg); color: var(--violet-ink); }
.badge.round { border-radius: 999px; }

/* A strip that says how things stand. */
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); }
.banner > div { flex: 1 1 260px; min-width: 0; }
.banner strong { display: block; color: inherit; font-weight: 700; }
.banner.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-ink); }
.banner.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.banner.bad { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad-ink); }
.banner.tint { background: var(--tint); border-color: transparent; color: var(--tint-ink); }
.banner form { margin: 0; }
.banner.verdict { margin-bottom: 20px; padding: 18px 22px; }
.banner.verdict h2 { color: inherit; font-size: 1.3rem; font-weight: 700; }
.banner.verdict p { color: inherit; }
.banner .ring { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--ok); color: #fff; }
.banner.bad .ring { background: var(--bad); }
.banner .ring .icon { width: 24px; height: 24px; stroke-width: 2.6; }

/* How far along: a bar and its words. */
.meter { height: 8px; border-radius: 4px; background: var(--mist); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.meter.done > i { background: var(--ok); }
.meter.warn > i { background: #e0a528; }
.meter.bad > i { background: var(--bad); }

/* A big number with a name over it. */
.numtile { display: flex; flex-direction: column; gap: 2px; padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); text-decoration: none; color: inherit; }
a.numtile:hover { border-color: var(--haze-dim); }
.numtile .k { color: var(--ink); font-weight: 600; }
.numtile strong { color: var(--ink); font-size: 2.2rem; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.numtile .sub { font-size: 0.88rem; }
.numtile.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-ink); }
.numtile.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.numtile.ok .k, .numtile.warn .k, .numtile.ok strong, .numtile.warn strong { color: inherit; }
.numtile .split { margin-top: 8px; }
.numtile strong.words { font-size: 1.5rem; }
.ct-summary { max-width: 1180px; margin-bottom: 20px; }
.numtile.warn .k { font-weight: 700; }
.plate-week { max-width: 1180px; margin-bottom: 22px; }

/* ---------- The model log: by job ---------- */

.model-tiles { margin-bottom: 16px; }
.by-job { display: flex; flex-direction: column; gap: 4px; margin-bottom: 20px; }
.by-job .job { display: grid; grid-template-columns: minmax(130px, 1.4fr) minmax(0, 4fr) minmax(120px, auto); gap: 14px; align-items: center; padding: 6px 0; color: inherit; text-decoration: none; }
.by-job .job .name { color: var(--ink); font-weight: 600; }
.by-job .job:hover .name { color: var(--accent); }
.by-job .job .num { text-align: right; }
.by-job .split { height: 10px; }
.by-job .split i { min-width: 0; border-radius: 5px; }
.by-job .split i.asked { background: var(--violet); min-width: 6px; }
.by-job .split i.lost { background: var(--bad); min-width: 6px; }
.by-job .split i.rest { background: var(--mist); }
@media (max-width: 640px) {
    .by-job .job { grid-template-columns: 1fr auto; }
    .by-job .split { grid-column: 1 / -1; order: 3; }
}

/* Rows inside a sheet: a thing on the left, what you can do on the right. */
.rows { display: flex; flex-direction: column; }
.rows > * { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; padding: 14px 0; border-top: 1px solid var(--line); }
.rows > :first-child { border-top: 0; }
.rows .name { color: var(--ink); font-weight: 700; }
.rows .sub { font-size: 0.9rem; }
.rows form { margin: 0; }

/* A camera picture with its name and time written on it. */
.shot { position: relative; display: block; margin: 0; overflow: hidden; border-radius: var(--r-l); background-color: var(--night); background-image: radial-gradient(#1a3550 1px, transparent 1px); background-size: 18px 18px; aspect-ratio: 16 / 9; color: var(--haze); }
.shot img { display: block; width: 100%; height: 100%; object-fit: cover; }
.shot.whole img { object-fit: contain; }
.shot .brackets { --arm: 22%; --w: 3px; }
.shot .on-top { position: absolute; left: 10px; top: 10px; display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 6px; background: rgba(7, 16, 28, 0.85); color: #fff; font-size: 0.8rem; font-weight: 600; }
.shot .on-top.right { left: auto; right: 10px; font-variant-numeric: tabular-nums; }
.shot .on-top.low { top: auto; bottom: 10px; }
.shot .live-dot { width: 7px; height: 7px; border-radius: 50%; background: #ef6b60; }

/* A switch drawn from a checkbox. */
input.switch { appearance: none; flex: none; width: 42px; height: 24px; padding: 0; border: 0; border-radius: 12px; background: #c3ceda; position: relative; cursor: pointer; transition: background 0.15s; }
input.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
input.switch:checked { background: var(--accent); }
input.switch:checked::after { transform: translateX(18px); }
input.switch:focus-visible { outline: 2px solid var(--moon); outline-offset: 2px; box-shadow: none; }

/* A setting that is one switch: its words on the left, the switch on the right. */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0; padding: 14px 0; border-top: 1px solid var(--line); font-weight: 400; cursor: pointer; }
.switch-row:first-of-type { border-top: 0; }
.switch-row strong { display: block; color: var(--ink); font-weight: 700; }
.switch-row .hint { display: block; margin-top: 2px; }
form.switch-row { cursor: default; }
/* A switch that is a button: one press saves it (a form posts the other state). */
.switch-btn { flex: none; width: 42px; height: 24px; min-height: 0; padding: 0; border: 0; border-radius: 12px; background: #c3ceda; position: relative; }
.switch-btn i { position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch-btn.on { background: var(--accent); }
.switch-btn.on i { transform: translateX(18px); }
kbd { padding: 1px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--muted); font: 600 0.8rem/1.5 inherit; }

/* ---------- Review: one question at a time ---------- */

.review-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; margin-bottom: 16px; }
.review-head .lede { margin-top: 4px; font-size: 1rem; }
.review-left { display: flex; align-items: center; gap: 12px; color: var(--ink); font-weight: 600; }
.review-left .pips { display: flex; gap: 5px; }
.review-left .pips i { width: 22px; height: 6px; border-radius: 3px; background: var(--line); }
.review-left .pips i.now { background: var(--accent); }
.review { max-width: 1240px; }
.review .chips { margin-bottom: 18px; }
.review-body { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }

.question { flex: 2 1 480px; min-width: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; box-shadow: 0 1px 2px rgba(12, 27, 42, 0.04), 0 24px 48px -28px rgba(12, 27, 42, 0.45); }
.question .shot { border-radius: 0; }
.question .pic-links { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 24px 0; font-weight: 600; }
.question .pic-links a { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.question .pic-links .icon { width: 16px; height: 16px; }
.question .ask { display: flex; flex-direction: column; gap: 16px; padding: 18px 24px 22px; }
.question .kind { color: var(--accent); font-weight: 700; font-size: 0.9rem; }
.question h2 { margin-top: 2px; font-size: 1.6rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }
.thinks { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--paper); }
.thinks .glyph { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--night); color: var(--moon); }
.thinks .glyph .icon { width: 16px; height: 16px; }
.thinks strong { display: block; color: var(--ink); font-weight: 600; }
.answers { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0; }
.answers button { min-height: 52px; padding: 10px 20px; border-radius: 12px; font-weight: 700; font-size: 1.02rem; }
.answers button.pick { flex: 1 1 150px; justify-content: center; background: var(--accent); color: var(--accent-ink); }
.answers button.pick:hover { filter: brightness(1.12); }
.answers button.pick.alt { background: var(--surface); border-color: var(--line); color: var(--ink); }
.answers button.pick.alt:hover { filter: none; border-color: var(--haze-dim); }
.answers.many button.pick { flex: 1 1 150px; padding: 10px 12px; background: var(--surface); border-color: var(--line); color: var(--ink); font-size: 0.98rem; white-space: nowrap; }
.answers.many button.pick:hover { filter: none; border-color: var(--accent); }
.answers.many button.pick.guess { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.answers button kbd { margin-left: 4px; background: transparent; border-color: currentColor; color: inherit; opacity: 0.7; }
.answers .skip { min-height: 52px; padding: 10px 14px; background: none; border: 0; color: var(--muted); font-weight: 500; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.answers .skip:hover { color: var(--ink); }
.effect { display: flex; flex-direction: column; gap: 4px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 0.92rem; }
.effect strong { color: var(--ink); font-weight: 600; }
.effect .related-links { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.effect .related-links a { font-weight: 600; }

.review-done { flex: 2 1 480px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 56px 24px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--lift); }
.review-done .tick { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); }
.review-done .tick .icon { width: 30px; height: 30px; stroke-width: 2.4; }
.review-done h2 { font-size: 1.5rem; font-weight: 700; }

.review-side { flex: 1 1 290px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.saved { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: var(--r-l); background: var(--ok-bg); border: 1px solid var(--ok-line); color: var(--ok-ink); }
.saved form { margin: 0; }
.saved button { background: var(--surface); border-color: var(--ok-line); color: var(--ok-ink); font-weight: 700; min-height: 40px; }
.saved.undone { background: var(--tint); border-color: transparent; color: var(--tint-ink); }
.learned { display: flex; flex-direction: column; gap: 16px; }
.learned .item { display: flex; flex-direction: column; gap: 5px; color: inherit; text-decoration: none; }
.learned .item .top { display: flex; justify-content: space-between; gap: 12px; color: var(--ink); font-weight: 600; }
.learned .item .top span:last-child { font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.learned .item .sub { font-size: 0.88rem; }
a.item:hover .top span:first-child { color: var(--accent); }

@media (max-width: 860px) {
    .hero { padding: 20px; }
    .hero h1 { font-size: 1.6rem; }
    .hero-tiles { width: 100%; }
    .hero-tiles a { flex: 1 1 130px; min-width: 0; padding: 12px 14px; }
    .question .ask { padding: 16px 16px 18px; }
    .question .pic-links { padding: 10px 16px 0; }
    .question h2 { font-size: 1.3rem; }
    .answers button.pick { flex: 1 1 100%; }
    .answers.many button.pick { flex: 1 1 40%; }
    .answers button kbd { display: none; }
}

/* ---------- Home ---------- */

.section-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 12px; }
.sheet-head .section-title { margin-bottom: 0; }
.hero-date { color: var(--moon); font-weight: 600; font-size: 0.92rem; margin-bottom: 6px; }
.hero-briefing { font-size: 0.95rem; }
.hero-briefing strong { color: #fff; margin-right: 6px; }
.hero-tiles { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-tiles a { display: flex; flex-direction: column; min-width: 150px; padding: 14px 18px; border-radius: var(--r-l); background: rgba(20, 42, 64, 0.85); border: 1px solid #1f3d5b; color: var(--haze); text-decoration: none; }
.hero-tiles a:hover { border-color: var(--moon); }
.hero-tiles strong { color: #fff; font-size: 1.9rem; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hero-tiles span { color: #fff; font-weight: 600; }
.hero-tiles small { font-size: 0.85rem; }

/* First-run setup, step by step: on the setup page, then on Home until a camera and a phone exist. */
.setup-steps { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 22px; padding: 0; list-style: none; font-size: 0.9rem; color: var(--muted); }
.setup-steps li { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.setup-steps .n { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); font-weight: 700; font-size: 0.82rem; }
.setup-steps .n .icon { width: 14px; height: 14px; stroke-width: 2.6; }
.setup-steps .now { color: var(--ink); font-weight: 700; }
.setup-steps .now .n { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.setup-steps .done { color: var(--ok); }
.setup-steps .done .n { border-color: var(--ok); background: var(--ok); color: #fff; }
.setup-steps a { color: inherit; text-decoration: none; }
.setup-steps a:hover { text-decoration: underline; }
.setup-steps.wide { margin: 0; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); }
.todos { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 16px; }
.todo { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--lift); }
.todo .todo-head { display: flex; gap: 12px; align-items: center; }
.todo h3 { font-size: 1.05rem; font-weight: 700; }
.todo .glyph { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r); background: var(--tint); color: var(--tint-ink); }
.todo.warn .glyph { background: var(--warn-bg); color: var(--warn-ink); }
.todo.bad .glyph { background: var(--bad-bg); color: var(--bad-ink); }
.todo.bad { border-color: var(--bad-line); }
.todo p { flex: 1; }
.todo .btn { align-self: flex-start; }

.strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 16px; }
.strip-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--lift); overflow: hidden; color: inherit; text-decoration: none; }
.strip-card:hover { border-color: var(--haze-dim); }
.strip-card .shot { border-radius: 0; }
.strip-text { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px 16px 14px; }
.strip-text strong { color: var(--ink); font-weight: 700; }

/* ---------- Cameras: the list to set up ---------- */

.actions-row .btn.big, .actions-row button.big { white-space: nowrap; }
.cam-list { display: flex; flex-direction: column; gap: 12px; max-width: 1180px; }
.cam-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--lift); }
.cam-row.off { box-shadow: none; }
.cam-row.off .shot { opacity: 0.6; }
.cam-pic { flex: 0 0 210px; display: block; border-radius: 12px; overflow: hidden; }
.cam-pic .shot { border-radius: 0; }
.cam-what { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cam-what h2 { font-size: 1.2rem; font-weight: 700; }
.cam-what h2 a { color: inherit; text-decoration: none; }
.cam-what h2 a:hover { color: var(--accent); }
.cam-what p { display: flex; flex-wrap: wrap; gap: 6px; }
.cam-what .sub { font-size: 0.9rem; }
.cam-do { display: flex; flex-wrap: wrap; gap: 8px; }
.sheet.nvrs { max-width: 1180px; margin-top: 24px; }
/* What is set up on a camera: each rule, check and its lines and zones, a row that opens it. */
.set-up .rows { border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); overflow: hidden; }
.set-up .rows > a { padding: 12px 14px; color: inherit; text-decoration: none; flex-wrap: nowrap; align-items: flex-start; }
.set-up .rows > a:hover { background: var(--mist); }
.set-up .rows > a > span:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.set-up .rows .sub { color: var(--text); }
.set-up .warn-text { color: var(--bad); font-weight: 600; }
.set-up-more { margin-top: 10px; font-size: 0.9rem; }
@media (max-width: 640px) {
    .cam-pic { flex-basis: 100%; }
}

/* ---------- Page heads and the event page, redesigned ---------- */

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; color: var(--muted); }
.crumbs a { font-weight: 600; text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.status-line { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.page-head form.actions-row { margin: 0; }
.detail .frame { border-radius: var(--r-xl); box-shadow: var(--lift); }
.verdict-box, .break-in-box { border-radius: var(--r-xl); box-shadow: var(--lift); }
.visit-box { border-radius: var(--r-xl); }
/* Where to go from here: one row each, the whole row a link. */
.related { display: flex; flex-direction: column; margin: 18px 0 0; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); overflow: hidden; }
.related a { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 10px 14px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; }
.related a:first-child { border-top: 0; }
.related a span { flex: 1; min-width: 0; }
.related a .icon { width: 18px; height: 18px; color: var(--accent); }
.related a .icon:last-child { width: 14px; height: 14px; color: var(--muted); }
.related a:hover { background: var(--mist); }
/* The event's picture: the clip or the snapshot, one at a time. */
.media-one { position: relative; display: grid; gap: 10px; }
.media-one .see { justify-self: start; }
.media-one .see label { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 6px 14px; border-radius: 7px; color: var(--text); font-size: 0.9rem; font-weight: 500; cursor: pointer; }
.media-one .see label .icon { width: 16px; height: 16px; }
.media-one:has(#see-clip:checked) .see label[for="see-clip"],
.media-one:has(#see-shot:checked) .see label[for="see-shot"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(12, 27, 42, 0.12); }
.media-one:has(#see-clip:checked) .frame.still,
.media-one:has(#see-shot:checked) .frame.clip { display: none; }
.media-one:has(#see-clip:focus-visible) .see label[for="see-clip"],
.media-one:has(#see-shot:focus-visible) .see label[for="see-shot"] { outline: 2px solid var(--moon); outline-offset: 2px; }
/* Everything else followed in the picture (since 25 November 2026): thinner brackets in each one's
   own kind's colour, the event's own staying bold; one that is an event of its own is a link with
   its name. On the clip they move with the video (clip-boxes.js), only the name a link there, so a
   click on the video still plays it. "Boxes" hides them all. */
.brackets.k-person { --c: var(--mark-person); }
.brackets.k-vehicle { --c: var(--mark-vehicle); }
.brackets.k-animal { --c: var(--mark-animal); }
.brackets.k-object { --c: var(--mark-object); }
.frame .brackets.other { --arm: 18%; --w: 1.5px; }
.frame a.brackets { pointer-events: auto; }
.frame a.brackets:focus-visible { outline: 2px solid var(--moon); outline-offset: 2px; }
.brackets .box-name { position: absolute; left: 0; bottom: 100%; margin-bottom: 3px; padding: 1px 6px; border-radius: 4px; background: var(--c); color: var(--night-deep); font-size: 0.72rem; font-weight: 600; line-height: 1.4; white-space: nowrap; }
.brackets.low .box-name { bottom: auto; top: 3px; left: 3px; margin: 0; }
.frame a.brackets:hover .box-name { text-decoration: underline; }
.clip-boxes { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
.clip-boxes a.brackets { pointer-events: none; }
.clip-boxes a.brackets .box-name { pointer-events: auto; }
.media-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.media-bar .hint { margin: 0; }
.see-boxes { display: inline-flex; align-items: center; gap: 7px; margin: 0; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); font-size: 0.9rem; font-weight: 500; cursor: pointer; }
.see-boxes::before { content: ""; width: 10px; height: 10px; border: 1.5px solid currentColor; border-radius: 3px; }
.media-one:has(#see-boxes:checked) .see-boxes { color: var(--ink); }
.media-one:has(#see-boxes:checked) .see-boxes::before { border-color: var(--accent); background: var(--accent); }
.media-one:has(#see-boxes:focus-visible) .see-boxes { outline: 2px solid var(--moon); outline-offset: 2px; }
.media-one:has(#see-boxes:not(:checked)) .frame .brackets,
.media-one:has(#see-boxes:not(:checked)) .clip-boxes { display: none; }
.detail .media .description { margin: 0; padding: 0 2px; border: 0; background: none; color: var(--ink); font-size: 1.08rem; line-height: 1.5; }
.page-head form.actions-row .hint { margin: 0; align-self: center; }
/* A long visit: the steps near this one, the rest behind "N more". */
.visit-box:has(#visit-open:not(:checked)) .visit-mini li.far { display: none; }
.visit-box:has(#visit-open:checked) .visit-mini li.gap { display: none; }
.visit-mini li.gap label { display: block; margin: 0; padding: 4px 8px 4px 92px; color: var(--moon); font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.visit-mini li.gap label:hover { text-decoration: underline; }
/* What, age, camera and the rest: a card of facts, two to a row where there's room. */
.detail .aside > .facts { padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px 16px; }
.detail .aside > .facts > div:has(form), .detail .aside > .facts > #age { grid-column: 1 / -1; }
.related a small { color: var(--muted); font-weight: 500; font-size: 0.85rem; white-space: nowrap; }
.facts.quick { margin-top: 18px; }
.detail .says { color: var(--ink); font-size: 1.05rem; }
/* Why this alerted: the steps in order, joined by a line. */
.why ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.why li { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 0 0 16px 26px; }
.why li:last-child { padding-bottom: 0; }
.why li::before { content: ""; position: absolute; left: 4px; top: 5px; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); }
.why li::after { content: ""; position: absolute; left: 9px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.why li:last-child::after { display: none; }
.why li strong { color: var(--ink); font-weight: 700; }
.why li a { align-self: flex-start; font-weight: 600; }

/* ---------- A person's own page ---------- */

.hero-more { position: relative; }
.hero-more > summary { list-style: none; cursor: pointer; }
.hero-more > summary::-webkit-details-marker { display: none; }
.hero-more[open] > form { position: absolute; right: 0; z-index: 3; margin-top: 8px; width: min(320px, 80vw); padding: 16px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); box-shadow: var(--lift); color: var(--text); }
.hero-more form label:first-of-type { margin-top: 0; }
.hero-more form button { margin-top: 12px; }
.face-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.face-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: var(--night-2); }
.hero-initial { flex: none; display: grid; place-items: center; width: 96px; height: 96px; border-radius: 50%; background: var(--night-2); border: 3px solid var(--moon); color: var(--moon); font-size: 2.6rem; font-weight: 700; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.hero-badges .badge { background: var(--night-2); color: var(--haze); }
.hero-badges .badge.ok { background: #1f6b41; color: #fff; }
.strip.small { grid-template-columns: repeat(auto-fill, minmax(min(170px, 100%), 1fr)); gap: 12px; }
.strip.small .strip-card { box-shadow: none; }
.sheet form { margin: 12px 0 0; }
.sheet > p + form { margin-top: 12px; }
.banner.link { margin-top: 12px; padding: 10px 14px; border-radius: var(--r); text-decoration: none; justify-content: space-between; }
.banner.link strong { flex: 1; }
.banner.link .icon { width: 18px; height: 18px; }

/* ---------- The plate log: one card per vehicle ---------- */

.plate-cards { display: flex; flex-direction: column; gap: 12px; }
.plate-card { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--lift); }
.plate-card.small { border-color: var(--warn-line); }
.plate-shot { flex: 0 0 170px; display: block; border-radius: 12px; overflow: hidden; }
.plate-shot .shot { border-radius: 0; }
.plate-what { flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 130px; }
.plate-what .tag { margin-left: 0; }
.plate-card .not-sure { padding: 4px 14px; border: 2px dashed var(--haze-dim); border-radius: 8px; color: var(--muted); font-weight: 700; }
.plate-how { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.plate-how strong { color: var(--ink); font-weight: 700; }
.plate-how .reads { display: flex; flex-direction: column; gap: 2px; font-size: 0.9rem; }
.plate.typed { border-style: dashed; }
.plate-type { display: flex; gap: 8px; margin: 0; }
.plate-type input { width: 150px; text-transform: uppercase; }
.plate-zoom img.close-up { display: block; height: auto; max-width: 180px; max-height: 70px; border-radius: 8px; }
@media (max-width: 640px) {
    .plate-shot { flex-basis: 100%; }
}

/* ---------- A model trial: where each was right, and the pictures they got wrong ---------- */

.trial-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 16px; margin: 20px 0; }
.where-right { display: flex; flex-direction: column; gap: 12px; }
.where-right .keys { display: flex; gap: 12px; font-size: 0.85rem; font-weight: 600; }
.where-right .key::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; background: var(--accent); }
.where-right .key.tried::before { background: var(--violet); }
.where-right .slice { display: flex; flex-direction: column; gap: 4px; }
.where-right .slice .top { display: flex; justify-content: space-between; gap: 12px; font-size: 0.9rem; }
.where-right .slice .top strong { color: var(--ink); font-weight: 600; }
.meter.violet > i { background: var(--violet); }
.section-title .dim { font-weight: 500; color: var(--muted); }
.trial-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 16px; }
.trial-card { border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--lift); overflow: hidden; }
.trial-card .shot { border-radius: 0; }
.trial-card .trial-where { padding: 14px 18px 0; color: var(--ink); font-weight: 600; }
.trial-card dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; padding: 14px 18px; }
.trial-card dt { color: var(--text); }
.trial-card dd { margin: 0; color: var(--ink); font-weight: 700; }
.trial-card dd.right { color: var(--ok); }
.trial-card dd.wrong { color: var(--bad); }

/* States (Rules › States): what the box watches, as cards; a state's Edit page with a box
   drawn on the camera's picture; and teaching it. */
.badge.big { padding: 5px 14px; border-radius: 999px; font-size: 1rem; font-weight: 700; }
.states-banner { max-width: 1240px; margin-bottom: 18px; }
.states-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px 28px; align-items: start; max-width: 1240px; }
.states-layout > section { min-width: 0; }
.state-cards { display: grid; gap: 16px; margin: 0; padding: 0; list-style: none; }
.state-card { display: grid; gap: 14px; }
.state-card.off { opacity: 0.75; }
.state-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 20px; }
.state-name { min-width: 0; }
.state-name h2 { font-size: 1.2rem; font-weight: 700; overflow-wrap: anywhere; }
.state-name p { margin: 2px 0 0; color: var(--muted); font-size: 0.92rem; }
.state-now { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.state-now .since { color: var(--muted); font-size: 0.9rem; }
.state-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 24px; }
.state-facts > div { display: grid; gap: 5px; align-content: start; min-width: 0; }
.state-facts .k { color: var(--muted); font-size: 0.82rem; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; }
.state-facts .v { color: var(--ink); font-size: 0.92rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.state-facts.tall { grid-template-columns: minmax(0, 1fr); align-content: start; }
.state-facts .hint { margin: 0; }
.state-read { margin: 0; color: var(--text); font-size: 0.92rem; }
/* Its own model: how it reads its pictures beside the fingerprints, who decides, and the switch. */
.state-model { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; }
.state-model p { flex: 1 1 260px; margin: 0; color: var(--text); font-size: 0.92rem; }
.state-model form { margin: 0; }
.state-tip { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 10px 14px; border: 1px solid var(--warn-line); border-radius: var(--r); background: var(--warn-bg); color: var(--warn-ink); font-size: 0.94rem; }
.state-tip .icon { flex: none; width: 18px; height: 18px; margin-top: 2px; }
.state-tip strong { color: inherit; }
.state-tip a { color: inherit; font-weight: 700; }
.state-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.state-rules { margin: 0; color: var(--muted); font-size: 0.92rem; }
.state-rules a { font-weight: 600; }
.state-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.state-actions form { margin: 0; }
.state-actions button.danger { margin-left: 6px; }
.states-how { max-width: 80ch; margin-top: 16px; }
.state-new { position: sticky; top: 16px; scroll-margin-top: 16px; }
.state-new .form { max-width: none; }
.state-new .form button.primary { width: 100%; margin-top: 18px; }
.states-add { display: none; }
.empty-state { margin-bottom: 16px; }
.empty-state p { margin: 6px 0 0; max-width: 70ch; color: var(--text); }
.state-tip + .state-tip { margin-top: -6px; }
@media (max-width: 1000px) {
    .states-layout { grid-template-columns: minmax(0, 1fr); }
    .state-new { position: static; }
    .states-add { display: inline-flex; }
}

.state-edit { display: grid; gap: 20px; max-width: 980px; }
.state-edit .sheet > label { display: block; margin-top: 12px; }
.state-edit .sheet-head { align-items: center; }
.area-pick { position: relative; overflow: hidden; border-radius: var(--r); background: var(--night-deep); aspect-ratio: 16 / 9; cursor: crosshair; touch-action: none; user-select: none; }
.area-pick img { display: block; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.area-pick img[hidden] { display: none; }
.area-box { position: absolute; border: 2px solid #ffffff; border-radius: 4px; box-shadow: 0 0 0 9999px rgba(7, 16, 28, 0.55), 0 0 0 1px rgba(7, 16, 28, 0.8) inset; pointer-events: none; }
.area-none { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 24px; color: #dbe6f2; text-align: center; }
.area-none[hidden] { display: none; }

.teach-top { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); gap: 20px; max-width: 1240px; margin-bottom: 28px; }
.teach-top .teach-now { display: block; }
.teach-top .teach-now p { margin: 0 0 10px; color: var(--text); }
.teach-top .teach-now form { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 0; }
.teach-set { max-width: 1240px; margin-top: 28px; }
.teach-set .section-title .dim { color: var(--muted); font-weight: 500; }
.teach-set > .hint { max-width: 90ch; margin: 4px 0 0; }
.teach-grid li { padding: 10px; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); gap: 8px; }
.teach-pic { position: relative; display: block; overflow: hidden; border-radius: var(--r); }
.teach-pic .brackets { --c: #ffffff; --arm: 24%; --w: 2px; }
.teach-grid .when { color: var(--muted); }
.teach-actions { align-items: center; }
.teach-actions .btn { min-width: 76px; justify-content: center; }
@media (max-width: 900px) {
    .teach-top { grid-template-columns: minmax(0, 1fr); }
}

