/* Camera AI Attendance — a door control room.
   Graphite surfaces lit by the amber door line (the system's one accent), signal green for recognised people and
   red for unknown faces. Wide Archivo for numbers and headings, Manrope for reading, JetBrains Mono for times. */

@font-face { font-family: "Archivo"; src: url("fonts/archivo.woff2") format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("fonts/manrope.woff2") format("woff2"); font-weight: 300 800; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #0b0d10; --glow: rgba(255, 186, 60, 0.07);
  --panel: #12151a; --panel-2: #181c22; --panel-3: #20252d;
  --line: #262c35; --line-strong: #39414d;
  --fg: #e9ecf1; --fg-soft: #bac1cc; --muted: #7f8996;
  --accent: #ffc533; --accent-text: #ffd166; --accent-soft: rgba(255, 197, 51, 0.13); --accent-ink: #1b1400;
  --ok: #34d399; --ok-soft: rgba(52, 211, 153, 0.13);
  --bad: #ff5d63; --bad-soft: rgba(255, 93, 99, 0.14);
  --warn: #ffa53d; --warn-soft: rgba(255, 165, 61, 0.14);
  --info: #7aa7ff; --info-soft: rgba(122, 167, 255, 0.14);
  --screen: #07090c; --screen-grid: rgba(255, 255, 255, 0.045);
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.38);
  --radius: 16px; --radius-sm: 10px;
  --font-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #eef1f5; --glow: rgba(255, 190, 60, 0.18);
    --panel: #ffffff; --panel-2: #f5f7fa; --panel-3: #e9edf2;
    --line: #dce1e8; --line-strong: #c3cad5;
    --fg: #10141a; --fg-soft: #343c48; --muted: #5e6876;
    --accent: #f0ad12; --accent-text: #8a5d00; --accent-soft: rgba(240, 173, 18, 0.16); --accent-ink: #1b1400;
    --ok: #0f9d63; --ok-soft: rgba(15, 157, 99, 0.12);
    --bad: #dd343b; --bad-soft: rgba(221, 52, 59, 0.1);
    --warn: #b96500; --warn-soft: rgba(229, 132, 0, 0.13);
    --info: #2f63d6; --info-soft: rgba(47, 99, 214, 0.1);
    --shadow: 0 10px 30px rgba(24, 34, 52, 0.1);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef1f5; --glow: rgba(255, 190, 60, 0.18);
  --panel: #ffffff; --panel-2: #f5f7fa; --panel-3: #e9edf2;
  --line: #dce1e8; --line-strong: #c3cad5;
  --fg: #10141a; --fg-soft: #343c48; --muted: #5e6876;
  --accent: #f0ad12; --accent-text: #8a5d00; --accent-soft: rgba(240, 173, 18, 0.16); --accent-ink: #1b1400;
  --ok: #0f9d63; --ok-soft: rgba(15, 157, 99, 0.12);
  --bad: #dd343b; --bad-soft: rgba(221, 52, 59, 0.1);
  --warn: #b96500; --warn-soft: rgba(229, 132, 0, 0.13);
  --info: #2f63d6; --info-soft: rgba(47, 99, 214, 0.1);
  --shadow: 0 10px 30px rgba(24, 34, 52, 0.1);
}
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body::before { content: ""; position: fixed; inset: -25vh auto auto -15vw; width: 70vw; height: 70vh; pointer-events: none; z-index: 0;
  background: radial-gradient(closest-side, var(--glow), transparent 75%); }
a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--font-display); font-stretch: 112%; letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
h2 { font-size: 1.12rem; font-weight: 700; }
small { font-size: 0.8rem; }
img { max-width: 100%; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 0.9em; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.spacer { flex: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* -- shell ---------------------------------------------------------------------------------------------------------- */
.shell { position: relative; z-index: 1; display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 20px 14px;
  background: color-mix(in srgb, var(--panel) 92%, transparent); border-right: 1px solid var(--line); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 14px; color: var(--fg); text-decoration: none; border-bottom: 1px solid var(--line); }
.brand strong { display: block; font-family: var(--font-display); font-stretch: 125%; font-weight: 800; font-size: 1.12rem; letter-spacing: 0.01em; }
.brand small { display: block; color: var(--muted); }
.mark { width: 34px; height: 34px; flex: none; }
.mark .post { stroke: var(--fg-soft); stroke-width: 2.4; stroke-linecap: round; fill: none; }
.mark .beam { stroke: var(--accent); stroke-width: 3; stroke-linecap: round; filter: drop-shadow(0 0 4px var(--accent)); }
.mark .dot { fill: var(--ok); }
nav { display: grid; gap: 2px; }
.nav-group { margin: 14px 10px 6px; font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.nav-item { position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--fg-soft); text-decoration: none; font-weight: 600; transition: background 0.15s, color 0.15s; }
.nav-item:hover { background: var(--panel-2); color: var(--fg); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--fg); }
.nav-item[aria-current="page"]::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.ico { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rail-foot { margin-top: auto; display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; padding: 6px 8px; border-radius: var(--radius-sm); }
.me:hover { background: var(--panel-2); }
.me small { display: block; color: var(--muted); }
.rail-actions { display: flex; gap: 6px; padding: 0 6px; }
.rail-actions form { margin: 0; }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; font-weight: 800; font-size: 0.85rem;
  background: linear-gradient(140deg, var(--panel-3), var(--panel-2)); border: 1px solid var(--line-strong); color: var(--fg); }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--fg-soft); cursor: pointer; }
.icon-btn:hover { color: var(--fg); border-color: var(--line-strong); }
.when-light { display: none; }
:root[data-theme="light"] .when-light { display: block; } :root[data-theme="light"] .when-dark { display: none; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .when-light { display: block; } :root:not([data-theme="dark"]) .when-dark { display: none; } }

.main { min-width: 0; display: flex; flex-direction: column; }
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 16px 28px;
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.bar-title { min-width: 0; flex: 1; }
.bar-title h1 { font-size: clamp(1.35rem, 2.4vw, 1.85rem); font-weight: 800; }
.bar-title .sub { margin: 2px 0 0; color: var(--muted); font-size: 0.88rem; }
.bar-right { display: flex; align-items: center; gap: 14px; }
.clock { color: var(--fg-soft); }
.menu { display: none; }
.live-pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 999px; font-size: 0.72rem; font-weight: 800;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ok); background: var(--ok-soft); }
.live-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse 1.8s infinite; }
.live-pill.down { color: var(--warn); background: var(--warn-soft); }
.live-pill.down i { background: var(--warn); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 70%, transparent); } 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.content { padding: 24px 28px 48px; display: grid; gap: 22px; max-width: 1480px; width: 100%; }
footer { display: none; }

/* -- building blocks ------------------------------------------------------------------------------------------------ */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card .pad, .card.flush > h2 { padding: 16px 20px 6px; }
.section-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.section-head h2 { flex: none; }
.section-head p { margin: 0; flex: 1; min-width: 220px; font-size: 0.86rem; }
.section-head a { margin-left: auto; font-size: 0.88rem; font-weight: 600; }
.count { display: inline-block; margin-left: 6px; padding: 0 9px; border-radius: 999px; background: var(--panel-3); font-family: var(--font-mono); font-size: 0.8rem; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 22px; }
.narrow, .narrow-form { max-width: 760px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.att-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 14px; }
.att-filters label { display: grid; gap: 4px; font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.att-filters label.check { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; }
.att-filters select, .att-filters input[type="search"] { min-width: 0; padding: 6px 10px; font-size: 0.88rem; }
.flash { margin: 0; padding: 11px 14px 11px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); border-left: 4px solid var(--ok); background: var(--panel); font-weight: 600; }
.flash.error { border-left-color: var(--bad); background: var(--bad-soft); }
.flash.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.empty-state { display: flex; align-items: center; gap: 14px; color: var(--muted); }
.empty-state .ico { width: 30px; height: 30px; }
.empty-state.good { color: var(--ok); }
.empty { padding: 12px 0; }

button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 700; cursor: pointer;
  text-decoration: none; transition: transform 0.1s, filter 0.15s, background 0.15s; white-space: nowrap; }
button:hover, .button:hover { filter: brightness(1.08); }
button:active, .button:active { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }
button.ghost, .button.ghost { background: transparent; color: var(--fg); border-color: var(--line-strong); }
button.ghost:hover, .button.ghost:hover { background: var(--panel-2); filter: none; }
button.danger { background: var(--bad); color: #fff; }
button.ghost.danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
button.small, .button.small { padding: 5px 10px; font-size: 0.84rem; }
button.big { padding: 12px 22px; font-size: 1rem; }
.linkish { background: none; border: 0; color: var(--accent-text); padding: 0; font-weight: 600; }
input, select, textarea { font: inherit; color: var(--fg); background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 9px 11px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[aria-invalid="true"] { border-color: var(--bad); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); padding: 0; }
input.short { width: 150px; }
.inline { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.stack { display: grid; gap: 8px; }
.stack.tight { gap: 6px; margin-bottom: 10px; }
.stack label, .grid-form > label { font-weight: 600; font-size: 0.88rem; color: var(--fg-soft); }
.grid-form { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); gap: 12px 16px; align-items: center; }
.grid-form .span2 { grid-column: 2; margin-top: -6px; }
.field { display: grid; gap: 3px; }
.field .err { color: var(--bad); font-weight: 600; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--fg-soft); }
.row-actions { display: flex; gap: 8px; }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700;
  background: var(--panel-3); color: var(--fg-soft); white-space: nowrap; text-decoration: none; }
.chip.good { background: var(--ok-soft); color: var(--ok); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.dim { background: var(--panel-3); color: var(--muted); }
.chip.role { margin-left: 8px; background: var(--accent-soft); color: var(--accent-text); }
.pill { padding: 3px 10px; border-radius: 999px; font-size: 0.74rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { position: sticky; top: 0; background: var(--panel-2); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 800; white-space: nowrap; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: color-mix(in srgb, var(--panel-2) 70%, transparent); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
tr.unknown td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
tr.done { opacity: 0.55; }
td.detail { max-width: 520px; color: var(--fg-soft); font-size: 0.86rem; word-break: break-word; }
.person { display: inline-flex; align-items: center; gap: 10px; }
.person small { display: block; }
.face { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; display: inline-block; vertical-align: middle; background: var(--panel-3); }
.face.ph { display: inline-grid; place-items: center; font-weight: 800; color: var(--muted); }
.face.big { width: 120px; height: 120px; font-size: 2rem; }
.big-code { font-family: var(--font-display); font-stretch: 125%; font-size: 4rem; font-weight: 800; margin: 0; color: var(--accent-text); }

/* -- dashboard ------------------------------------------------------------------------------------------------------ */
.dash { display: grid; gap: 22px; }
.hero { display: grid; grid-template-columns: minmax(260px, 1.1fr) 2fr; gap: 16px; }
.hero-main { position: relative; overflow: hidden; padding: 22px 24px; border-radius: var(--radius); border: 1px solid var(--line);
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 16%, var(--panel)) 0%, var(--panel) 62%); }
.hero-main::after { content: ""; position: absolute; left: 0; right: 0; top: 58%; height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent); opacity: 0.55; box-shadow: 0 0 18px var(--accent); }
.label { margin: 0; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.mega { margin: 6px 0 14px; font-family: var(--font-display); font-stretch: 125%; font-weight: 800; font-size: clamp(3.6rem, 7vw, 6rem); line-height: 0.95; font-variant-numeric: tabular-nums; }
.mega small { font-size: 0.32em; font-weight: 600; color: var(--muted); margin-left: 8px; }
.meter { height: 8px; border-radius: 999px; background: var(--panel-3); overflow: hidden; }
.meter i { display: block; height: 100%; width: var(--v, 0%); border-radius: inherit; background: linear-gradient(90deg, var(--ok), var(--accent)); transition: width 0.8s cubic-bezier(.2,.8,.2,1); }
.hero-stats { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.hero-stats div, .stat-row div { padding: 16px 18px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); min-width: 0; }
.hero-stats dt, .stat-row dt { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.hero-stats dd, .stat-row dd { margin: 4px 0 0; font-family: var(--font-display); font-stretch: 120%; font-size: 2.3rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-stats .hot, .stat-row .hot { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); background: linear-gradient(160deg, var(--bad-soft), var(--panel) 70%); }
.hero-stats .hot dd, .stat-row .hot dd { color: var(--bad); }
.stat-row { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.stat-row dd small { font-size: 0.45em; color: var(--muted); font-weight: 600; }

.radars { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 16px; }
.radar-card { display: grid; gap: 0; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); overflow: hidden; }
.radar-card header, .radar-card footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; }
.radar-card footer { padding: 10px 16px; color: var(--muted); font-size: 0.84rem; border-top: 1px solid var(--line); justify-content: flex-start; }
.radar-card .pill { background: var(--ok-soft); color: var(--ok); }
.radar-card.offline .pill { background: var(--bad-soft); color: var(--bad); }
.radar { display: block; width: 100%; aspect-ratio: 16 / 9; max-width: 100%; background: var(--screen); }
.radar-card.offline .radar { opacity: 0.45; filter: grayscale(0.6); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 22px; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 520px; overflow-y: auto; }
.ev { display: grid; grid-template-columns: 34px 44px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 9px 12px;
  border-radius: var(--radius-sm); background: var(--panel-2); border: 1px solid var(--line); }
.ev .dir { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); }
.ev.out .dir { background: var(--accent-soft); color: var(--accent-text); }
.ev.unknown { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); background: linear-gradient(90deg, var(--bad-soft), var(--panel-2) 60%); }
.ev.unknown .dir { background: var(--bad-soft); color: var(--bad); }
.ev .face { width: 44px; height: 44px; }
.ev .who { min-width: 0; }
.ev .who strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev .who small { color: var(--muted); }
.ev .when { color: var(--fg-soft); }
.ev.fresh { animation: arrive 0.9s cubic-bezier(.2,.8,.2,1); }
@keyframes arrive { 0% { transform: translateX(-14px); opacity: 0; box-shadow: 0 0 0 0 var(--accent); } 40% { opacity: 1; box-shadow: 0 0 0 3px var(--accent-soft); } 100% { transform: none; box-shadow: none; } }
.chip.score { background: var(--ok-soft); color: var(--ok); }

.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.board-col { min-width: 0; }
.board-col ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.board-col li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); background: var(--panel-2); min-width: 0; font-size: 0.88rem; }
.board-col li span:last-child { min-width: 0; overflow-wrap: anywhere; line-height: 1.3; }
.board-col li small { display: block; color: var(--muted); }
.board-col[data-group="in office"] .avatar { border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok-soft); }
.board-col[data-group="absent"] li { opacity: 0.6; }
.board-col li.moved { animation: arrive 0.9s cubic-bezier(.2,.8,.2,1); }

.flow { width: 100%; height: auto; display: block; }
.flow .axis { stroke: var(--line-strong); stroke-width: 1; }
.flow .bar.in { fill: var(--ok); }
.flow .bar.out { fill: var(--accent); }
.flow .tick { fill: var(--muted); font-family: var(--font-mono); font-size: 11px; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 5px 0 10px; vertical-align: -1px; }
.key.in { background: var(--ok); } .key.out { background: var(--accent); }

.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.alert-row { display: grid; grid-template-columns: 22px 74px 150px minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--panel-2); color: var(--fg-soft); }
.alert-row .ico { color: var(--warn); }
.alert-row.unknown_face .ico, .alert-row.tailgating .ico, .alert-row.camera_offline .ico { color: var(--bad); }
.alert-row strong { color: var(--fg); text-transform: capitalize; }

/* -- people, cameras, calibration ------------------------------------------------------------------------------------- */
.people-grid, .cam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 14px; }
.person-card, .cam-card { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--fg); transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s; }
.person-card:hover, .cam-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.person-card.inactive { opacity: 0.6; }
.portrait { width: 56px; height: 56px; flex: none; border-radius: 14px; object-fit: cover; background: var(--panel-3); }
.portrait.ph { display: grid; place-items: center; font-family: var(--font-display); font-stretch: 125%; font-weight: 800; font-size: 1.4rem; color: var(--fg-soft); }
.portrait.big { width: 132px; height: 132px; border-radius: 22px; font-size: 3rem; }
.pc-body { display: grid; gap: 3px; min-width: 0; }
.pc-body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.cam-thumb { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 14px; background: var(--screen); color: var(--accent); flex: none; }
.cam-thumb .ico { width: 26px; height: 26px; }
.profile { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 22px; }
.profile-card { display: grid; gap: 16px; justify-items: start; }
.facts { margin: 0; display: grid; gap: 10px; width: 100%; }
.facts dt { font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.facts dd { margin: 2px 0 0; font-weight: 600; word-break: break-word; }
.dropzone { position: relative; display: grid; justify-items: center; gap: 10px; text-align: center; padding: 28px 18px; margin-top: 12px;
  border: 2px dashed var(--line-strong); border-radius: var(--radius); background: var(--panel-2); transition: border-color 0.15s, background 0.15s; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .dz-ico { width: 34px; height: 34px; color: var(--accent-text); }
.dropzone input[type="file"] { max-width: 100%; }
.dz-list { margin: 0; font-size: 0.86rem; }
.bar-mini { display: inline-block; width: 90px; height: 6px; border-radius: 999px; background: var(--panel-3); overflow: hidden; vertical-align: middle; }
.bar-mini i { display: block; height: 100%; width: var(--v, 0%); background: linear-gradient(90deg, var(--warn), var(--ok)); }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); background: linear-gradient(160deg, var(--bad-soft), var(--panel) 55%); }
.danger-zone p { color: var(--fg-soft); }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 14px; margin: 0 0 12px; }
.filters label { display: grid; gap: 4px; font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.filters select, .filters input { min-width: 0; padding: 6px 10px; font-size: 0.88rem; }
.pager { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 10px; }
.pager .off { opacity: 0.45; pointer-events: none; }
.review-table td { vertical-align: middle; }
.review-table td.mono { white-space: nowrap; }
.review-table .face { width: 48px; height: 48px; }
.review-actions { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.review-act { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; }
.review-act select, .review-act input { min-width: 0; width: 108px; padding: 6px 10px; font-size: 0.86rem; }
.review-act select { width: 156px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--line); }
.tab { display: inline-flex; align-items: center; gap: 4px; padding: 9px 16px; border-radius: 10px 10px 0 0; font-weight: 700;
       color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--fg); }
.tab[aria-current="page"] { color: var(--accent-text); border-bottom-color: var(--accent); background: var(--accent-soft); }
.calib { display: grid; gap: 12px; }
.calib-stage { position: relative; width: 100%; max-width: 1100px; border-radius: var(--radius-sm); overflow: hidden; background: var(--screen); }
.calib-stage img { display: block; width: 100%; height: auto; user-select: none; }
.calib-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.calib-empty { aspect-ratio: 16 / 9; display: grid; place-items: center; padding: 24px; color: var(--muted); text-align: center; }
.calib-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.settings { display: grid; gap: 18px; }
.settings .card h2 { margin-bottom: 14px; }
.sticky-save { position: sticky; bottom: 12px; display: flex; justify-content: flex-end; }
.sticky-save button { box-shadow: var(--shadow); }
.token-new { border-color: var(--accent); background: linear-gradient(160deg, var(--accent-soft), var(--panel) 60%); }
.copy-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.copy-row code { padding: 9px 12px; border-radius: var(--radius-sm); background: var(--panel-2); border: 1px solid var(--line); word-break: break-all; }
details summary { cursor: pointer; font-weight: 600; }

/* -- toasts --------------------------------------------------------------------------------------------------------- */
.toasts { position: fixed; top: 18px; right: 18px; z-index: 50; display: grid; gap: 10px; width: min(380px, calc(100vw - 36px)); pointer-events: none; }
.toast { pointer-events: auto; display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--panel); border: 1px solid var(--line-strong); border-left: 4px solid var(--warn); box-shadow: var(--shadow); animation: toast-in 0.35s cubic-bezier(.2,.8,.2,1); }
.toast.bad { border-left-color: var(--bad); } .toast.good { border-left-color: var(--ok); }
.toast strong { display: block; text-transform: capitalize; }
.toast small { color: var(--fg-soft); }
.toast.leaving { animation: toast-out 0.3s ease forwards; }
@keyframes toast-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-out { to { transform: translateX(24px); opacity: 0; } }

/* -- sign in ------------------------------------------------------------------------------------------------------------ */
.solo { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; gap: 14px; }
.login-card { position: relative; z-index: 2; width: min(420px, 100%); padding: 32px 30px; border-radius: 22px; background: color-mix(in srgb, var(--panel) 90%, transparent);
  border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(10px); display: grid; gap: 14px; }
.login-card h1 { font-size: 1.9rem; font-weight: 800; }
.login-card p { margin: 0; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand strong { display: block; font-family: var(--font-display); font-stretch: 125%; font-weight: 800; font-size: 1.2rem; }
.login-brand span { color: var(--muted); font-size: 0.86rem; }
.login-art { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.login-art .beam { position: absolute; left: -10%; right: -10%; top: 58%; height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 24px var(--accent); opacity: 0.6; animation: sweep 7s ease-in-out infinite; }
.login-art .beam.b2 { top: 38%; opacity: 0.25; animation-delay: -3.5s; }
@keyframes sweep { 0%, 100% { transform: translateY(-30px) scaleX(0.8); } 50% { transform: translateY(30px) scaleX(1.05); } }

/* -- small screens -------------------------------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .hero, .dash-grid, .profile { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 880px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; z-index: 30; left: 0; top: 0; width: 270px; transform: translateX(-102%); transition: transform 0.25s; box-shadow: var(--shadow); }
  body.rail-open .rail { transform: none; }
  .menu { display: inline-grid; }
  .bar { padding: 12px 16px; }
  .content { padding: 18px 16px 40px; }
  .grid-form { grid-template-columns: minmax(0, 1fr); }
  .grid-form .span2 { grid-column: 1; }
  .board { grid-template-columns: minmax(0, 1fr); }
  .alert-row { grid-template-columns: 22px 64px minmax(0, 1fr); }
  .alert-row span:last-child { grid-column: 2 / -1; }
  .ev { grid-template-columns: 34px 40px minmax(0, 1fr) auto; }
  .ev > :last-child:not(.when) { display: none; }
  .clock { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* -- live view ------------------------------------------------------------------------------------------------------ */
.live-stage { border-radius: var(--radius-sm); overflow: hidden; background: var(--screen); min-height: 200px; }
.live-stage img { display: block; width: 100%; height: auto; }
.live-badge { display: inline-flex; align-items: center; gap: 6px; background: var(--bad-soft); color: var(--bad); }
.live-badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); animation: pulse 1.8s infinite; }

/* camera stream fields: password with a show button, connection test result */
.pw-field { display: flex; gap: 0.5rem; align-items: center; }
.pw-field input { flex: 1; min-width: 0; }
.probe-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.probe-row output { font-size: 0.92em; line-height: 1.4; }
.probe-row output.ok { color: var(--ok); }
.probe-row output.warn { color: var(--warn); }
.probe-row output.bad { color: var(--bad); }
code.wrap { white-space: normal; word-break: break-all; }
.placement-hint { margin-top: 0.75rem; padding: 0.6rem 0.8rem; border-radius: 10px; color: var(--warn); background: var(--warn-soft); }
