/* Piocam console: the one stylesheet.
 *
 * Same family as the device web UI (docs/features/webui-design.md):
 * graphite surfaces, safety-sign colours, Barlow / Barlow Condensed
 * (bundled in static/fonts/, SIL OFL; CSP is font-src 'self', so never a
 * font CDN). Colour carries meaning and nothing else:
 *   red   = act now (unanswered / escalated alert, destructive)
 *   amber = look at this (waiting, offline, failing channel)
 *   green = all clear / someone is on it
 *   steel = links and focus only, never status
 * Dark only for now. Every colour is a token on :root, so a light set is
 * one more block of custom properties later, not a rewrite.
 * No per-page <style> blocks: a page that needs a new look adds a
 * component here. */

@font-face { font-family: Barlow; font-weight: 400; font-display: swap;
  src: url(fonts/barlow-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: Barlow; font-weight: 500; font-display: swap;
  src: url(fonts/barlow-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: Barlow; font-weight: 600; font-display: swap;
  src: url(fonts/barlow-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap;
  src: url(fonts/barlow-condensed-latin-600-normal.woff2) format("woff2"); }

:root {
  color-scheme: dark;
  --bg: #1E2124;        /* page */
  --side: #1A1D20;      /* sidebar / phone top bar */
  --surface: #25292D;   /* panels, rows */
  --raised: #2E3338;    /* inputs, secondary buttons */
  --line: #3A4046;      /* borders */
  --text: #E8EAEC;
  --text-2: #A9B0B6;
  /* Hint grey. #7D858C measured 3.9:1 on --surface (below WCAG AA for
     13 px text); this value is >= 4.5:1 on --surface and --raised. */
  --text-3: #969EA5;
  --amber: #F2A900;     /* look at this */
  --amber-line: #5C4A16;
  --red: #E5484D;       /* act now: fills, borders */
  --red-deep: #B8353A;
  --red-text: #FF6B6F;  /* red as small text: #E5484D is only 3.1:1 on --surface */
  --green: #3DAA78;     /* all clear */
  --steel: #7FA7C9;     /* links, focus, selection; never status */
  /* Shift-group swatches: muted, never red/amber/green. */
  --g1: #6E8FB0; --g2: #8C7BB0; --g3: #A08A6A; --g4: #5F9C9C;
  --g5: #8FA36A; --g6: #B07B8C;

  --r: 6px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --font: Barlow, system-ui, -apple-system, "Segoe UI", sans-serif;
  --head: "Barlow Condensed", Barlow, system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 400 15px/1.45 var(--font); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; }
a { color: var(--steel); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }
code { font-family: var(--mono); font-size: 13px; }
.num, time, .tnum { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--steel); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 20; background: var(--text); color: var(--bg);
  padding: 8px 14px; border-radius: var(--r); font-weight: 600; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Shell: sidebar on desktop, top bar + scroll nav on phones ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(to right, var(--side) 231px, var(--line) 231px,
                              var(--line) 232px, transparent 232px); }
.side { padding: var(--s5) var(--s4); display: flex; flex-direction: column; gap: var(--s5);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .top { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
/* The app icon (static/logo.svg), same mark as the iOS/Android launcher icon. */
.brand .mark { width: 34px; height: 34px; flex: none; display: block; }
.brand b { font: 600 22px/1 var(--head); letter-spacing: .01em; }
.company { font-size: 13px; color: var(--text-2); margin-top: -12px; padding-left: 44px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  color: var(--text-2); padding: 9px 12px; border-radius: var(--r); font-weight: 500; text-decoration: none; }
.nav a:hover { background: var(--surface); color: var(--text); }
.nav a[aria-current] { background: var(--raised); color: var(--text); box-shadow: inset 3px 0 0 var(--text); }
.nav .count { font-size: 12px; font-weight: 600; min-width: 22px; text-align: center;
  padding: 1px 7px; border-radius: 10px; background: var(--red); color: #fff; }
.nav .sep { height: 1px; background: var(--line); margin: var(--s2) 4px; }
.side .me { margin-top: auto; font-size: 13px; color: var(--text-2); border-top: 1px solid var(--line);
  padding-top: var(--s3); }
.side .me b { color: var(--text); font-weight: 500; display: block; overflow-wrap: anywhere; }
.side .me form, .me-m form { display: inline; }
.me-m { display: none; font-size: 14px; color: var(--text-2); }

.main { padding: var(--s6) var(--s6) var(--s7); max-width: 1180px; width: 100%; min-width: 0; }
.main.narrow { max-width: 720px; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4);
  flex-wrap: wrap; margin-bottom: var(--s5); }
.pagehead .acts { display: flex; gap: var(--s2); flex-wrap: wrap; }
.crumb { margin: 0 0 var(--s2); font-size: 14px; }
h1 { font: 600 34px/1.05 var(--head); margin: 0; letter-spacing: .005em; }
h2 { font: 600 22px/1.15 var(--head); margin: 0 0 var(--s3); }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 var(--s2); }
.sub { color: var(--text-2); margin: 6px 0 0; max-width: 72ch; }
.hint { color: var(--text-3); font-size: 13px; }
p.hint { margin: var(--s2) 0 0; }
.section { margin-top: var(--s6); }
.muted { color: var(--text-2); }
.warn-text { color: var(--amber); }
.bad-text { color: var(--red-text); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px; border-radius: var(--r); font: 500 15px var(--font);
  border: 1px solid var(--line); background: var(--raised); color: var(--text); cursor: pointer;
  text-decoration: none; white-space: nowrap; touch-action: manipulation; }
.btn:hover { border-color: var(--text-3); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-primary { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 600; }
.btn-primary:hover { background: #fff; }
.btn-act { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
.btn-act:hover { background: var(--red-deep); border-color: var(--red-deep); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--text-2); padding: 0 10px; }
.btn-quiet:hover { color: var(--text); border-color: var(--line); }
.btn-danger { background: transparent; color: var(--red-text); border-color: var(--red-deep); }
.btn-danger:hover { border-color: var(--red); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 14px; }
.btn-link { background: none; border: 0; color: var(--steel); padding: 0; font: inherit; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }
.btnrow { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
form.inline { display: inline; margin: 0; }

/* ---------- Status ---------- */
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dot.on { background: var(--green); } .dot.off { background: var(--text-3); }
.dot.warn { background: var(--amber); } .dot.bad { background: var(--red); }
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.state.open { color: var(--red-text); } .state.wait { color: var(--amber); }
.state.ok { color: var(--green); } .state.done { color: var(--text-3); font-weight: 500; }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px;
  border: 1px solid var(--line); color: var(--text-2); white-space: nowrap; }
.tag.warn { border-color: var(--amber-line); color: var(--amber); }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 2px; flex: none; }
.sw.g1 { background: var(--g1); } .sw.g2 { background: var(--g2); } .sw.g3 { background: var(--g3); }
.sw.g4 { background: var(--g4); } .sw.g5 { background: var(--g5); } .sw.g6 { background: var(--g6); }
.sw.any { background: transparent; border: 2px solid var(--text-2); }

/* ---------- Notices ---------- */
.notice { border: 1px solid var(--line); border-left: 3px solid var(--steel); background: var(--surface);
  padding: var(--s3) var(--s4); border-radius: var(--r); margin-bottom: var(--s4); }
.notice.warn { border-left-color: var(--amber); }
.notice.bad { border-left-color: var(--red); }
.notice.ok { border-left-color: var(--green); }
.notice p { margin: 0; }
.notice p + p { margin-top: 6px; }
/* One-time secrets (passwords): dashed box, select-all, plus where it's used. */
.secret { font-size: 18px; letter-spacing: .04em; padding: 6px 12px; background: var(--bg);
  border: 1px dashed var(--text-3); border-radius: var(--r); user-select: all; display: inline-block;
  margin-top: 6px; overflow-wrap: anywhere; }
.empty { padding: var(--s5); text-align: center; color: var(--text-2);
  border: 1px dashed var(--line); border-radius: var(--r); }

/* ---------- Panels, tables, lists ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 20px; }
.panel-body { padding: var(--s4); }
.listhead { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3);
  margin-bottom: var(--s3); }
.listhead h2 { margin: 0; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 13px; font-weight: 500; color: var(--text-3);
  padding: 10px var(--s4); border-bottom: 1px solid var(--line); }
.table td { padding: 12px var(--s4); border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .who b { font-weight: 500; display: block; }
.table .who span { color: var(--text-3); font-size: 13px; display: block; max-width: 32ch;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table .who .state { margin-top: 4px; }
/* People: the edit form is its own full-width row, opened by #edit-<id>. */
.table tr.editrow { display: none; }
.table tr.editrow:target { display: table-row; }
.table tr.editrow > td { background: var(--raised); padding: var(--s4); }
.table tr.editrow .resetpw { margin-top: var(--s3); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.table tr.disabled td { color: var(--text-3); }
.table td.r, .table th.r { text-align: right; }
.table td.tnum { white-space: nowrap; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px var(--s4);
  font-size: 14px; margin: var(--s3) 0 0; }
.facts dt { color: var(--text-3); } .facts dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Forms ---------- */
label.f, .f-label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.input, select.input, textarea.input { width: 100%; max-width: 100%; min-height: 40px; padding: 8px 12px;
  font: 400 15px var(--font); color: var(--text); background: var(--raised);
  border: 1px solid var(--line); border-radius: var(--r); }
textarea.input { min-height: 72px; resize: vertical; }
.input:focus { outline: 2px solid var(--steel); outline-offset: -1px; }
.input::placeholder { color: var(--text-3); }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); align-items: end; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; margin-top: var(--s4); }
.checks { display: flex; flex-wrap: wrap; gap: 4px var(--s3); }
.checks label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; min-height: 32px; }
.checks input, .confirm input { width: 18px; height: 18px; accent-color: var(--text); }
.confirm { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2);
  margin: var(--s2) 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.seg a, .seg span { padding: 7px 14px; color: var(--text-2); font-size: 14px; font-weight: 500;
  text-decoration: none; white-space: nowrap; }
.seg a + a { border-left: 1px solid var(--line); }
.seg [aria-current] { background: var(--raised); color: var(--text); }
.seg .c { color: var(--text-3); margin-left: 4px; }
details > summary { cursor: pointer; color: var(--text-2); list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "+\00a0"; color: var(--text-3); }
details[open] > summary::before { content: "\2212\00a0"; }
details.disclose > summary { min-height: 32px; display: inline-flex; align-items: center; }
details.disclose[open] > summary { margin-bottom: var(--s3); }
summary.btn::before, details[open] > summary.btn::before { content: none; }

/* ---------- Alert feed ---------- */
.feed { display: flex; flex-direction: column; gap: var(--s3); }
.alert { display: grid; grid-template-columns: 220px minmax(0, 1fr) auto; gap: var(--s4);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: var(--s3); position: relative; }
.alert.is-open { border-left: 4px solid var(--red); }
.alert.is-wait { border-left: 4px solid var(--amber); }
.alert.is-closed { background: transparent; }
.alert.is-closed .frame img { filter: saturate(.55) brightness(.85); }
.frame { position: relative; border-radius: 4px; overflow: hidden; background: #000; aspect-ratio: 16/9; }
.frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame .noimg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3);
  font-size: 13px; }
.frame .stamp { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 8px 5px;
  font: 600 13px/1 var(--head); letter-spacing: .03em; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.75)); display: flex; justify-content: space-between;
  gap: 8px; }
.frame .stamp span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert .what { min-width: 0; padding-top: 2px; }
.alert .what h3 { font-size: 18px; margin: 0 0 2px; overflow-wrap: anywhere; }
.alert .where { color: var(--text-2); font-size: 14px; display: flex; gap: 4px 10px; flex-wrap: wrap;
  align-items: center; }
.alert .story { margin: var(--s2) 0 0; padding: 0; list-style: none; font-size: 14px; color: var(--text-2); }
.alert .story li { display: flex; gap: 8px; align-items: baseline; padding: 1px 0; }
.alert .story time { color: var(--text-3); min-width: 44px; flex: none; }
.alert .story .warnline { color: var(--amber); }
.alert .acts { display: flex; flex-direction: column; gap: var(--s2); align-items: stretch; min-width: 132px; }
.alert .acts form { display: flex; }
.alert .acts form .btn { flex: 1; }
.alert details { margin-top: var(--s2); font-size: 13px; }
.alert details ul { margin: 6px 0 0; padding-left: 18px; color: var(--text-2); }
.alert .why { color: var(--text-2); font-size: 14px; margin: 0 0 4px; overflow-wrap: anywhere; }
.day { font: 600 15px var(--font); color: var(--text-3); margin: var(--s4) 0 var(--s2); }
.det { grid-template-columns: 160px minmax(0, 1fr) auto; }
.det .what h3 { font-size: 16px; }
.det .prompt { color: var(--text-2); font-size: 14px; margin-top: 2px; }

/* ---------- Now (home) ---------- */
.home-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--s5);
  align-items: start; }
.allclear { display: flex; gap: var(--s3); align-items: center; padding: var(--s4); }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.kpis div { background: var(--surface); padding: var(--s3) var(--s4); }
.kpis b { font: 600 28px/1 var(--head); display: block; }
.kpis span { font-size: 13px; color: var(--text-2); }
.onduty, .camstrip { list-style: none; margin: 0; padding: 0; }
.onduty li { display: flex; align-items: center; gap: var(--s3); padding: 10px var(--s4);
  border-bottom: 1px solid var(--line); }
.onduty li:last-child, .camstrip li:last-child { border-bottom: 0; }
.onduty .sw { width: 10px; height: 28px; }
.onduty .off-now .sw { opacity: .45; }
.onduty .off-now .grow { color: var(--text-2); }
.onduty .grow { flex: 1; min-width: 0; }
.onduty .grow small { display: block; color: var(--text-3); font-size: 13px; }
.camstrip li { display: flex; align-items: center; gap: 10px; padding: 9px var(--s4);
  border-bottom: 1px solid var(--line); font-size: 14px; }
.camstrip .grow { flex: 1; min-width: 0; }
.camstrip small { color: var(--text-3); text-align: right; }
.app-panel { display: flex; gap: var(--s4); align-items: flex-start; }
.app-panel .app-icon { width: 44px; height: 44px; flex: none; }

/* ---------- Cameras ---------- */
.cams { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s4); }
.cam { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
  color: var(--text); text-decoration: none; display: flex; flex-direction: column; }
a.cam:hover { border-color: var(--text-3); text-decoration: none; }
.cam .frame { border-radius: 0; }
.cam.offline .frame img { filter: grayscale(1) brightness(.5); }
.cam .frame .over { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 600;
  color: var(--text); }
.cam .body { padding: var(--s3) var(--s4) var(--s4); display: flex; flex-direction: column; gap: 4px; }
.cam .body h3 { font-size: 17px; margin: 0; display: flex; align-items: center; gap: 8px; }
.cam .meta { font-size: 13px; color: var(--text-2); }
.cam .meta.warn { color: var(--amber); }
.cam.add { text-align: center; padding: var(--s4); border-style: dashed; align-items: center;
  justify-content: center; min-height: 240px; gap: 6px; color: var(--text-2); }
.cam.add b { font-size: 16px; color: var(--text); }
.ops { margin-top: var(--s2); font-size: 13px; }
.ops .facts { font-size: 13px; }

.tabs { display: flex; gap: var(--s5); border-bottom: 1px solid var(--line); margin-bottom: var(--s5);
  overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 0; color: var(--text-2); font-weight: 500; text-decoration: none; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current] { color: var(--text); border-bottom-color: var(--text); }
.camhead { display: grid; grid-template-columns: 420px minmax(0, 1fr); gap: var(--s5); margin-bottom: var(--s5); }

/* What a camera watches for: one row per check (rendered by device_detail.js). */
.rules { display: flex; flex-direction: column; }
.rule { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: var(--s3); align-items: start;
  padding: var(--s4); border-bottom: 1px solid var(--line); }
.rule:last-child { border-bottom: 0; }
.rule h3 { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.rule .q { color: var(--text-2); font-size: 14px; margin-top: 2px; overflow-wrap: anywhere; }
.rule .line { font-size: 13px; color: var(--text-3); margin-top: 6px; display: flex; gap: 4px var(--s3);
  flex-wrap: wrap; }
.rule .line .fired { color: var(--amber); }
.rule.paused h3 { color: var(--text-2); }
.rule .acts { display: flex; gap: var(--s2); }
.rule .ev-status { font-size: 13px; color: var(--text-3); }
.rule .ev-status.ok { color: var(--green); }
.rule .ev-status.err { color: var(--red-text); }
.rule .ev-form { grid-column: 2 / -1; }
/* On/off switch: a real checkbox, styled. */
.toggle { position: relative; display: inline-block; width: 44px; height: 26px; margin-top: 2px; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle .slider { position: absolute; inset: 0; cursor: pointer; border-radius: 13px;
  background: var(--raised); border: 1px solid var(--line); }
.toggle .slider::before { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--text-3); transition: left .15s; }
.toggle input:checked + .slider { background: var(--text); border-color: var(--text); }
.toggle input:checked + .slider::before { left: 21px; background: var(--bg); }
.toggle input:focus-visible + .slider { outline: 2px solid var(--steel); outline-offset: 2px; }
.toggle input:disabled + .slider { opacity: .5; cursor: progress; }
/* Edit / new-check forms (device_detail.js toggles .open). */
.ev-form { display: none; margin-top: var(--s3); padding: var(--s4); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--r); }
.ev-form.open { display: block; }
.ev-form .grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3) var(--s4); }
.ev-form .full { grid-column: 1 / -1; }
.ev-form label { display: block; font-size: 13px; color: var(--text-2); margin: 0 0 6px; }
.ev-form input, .ev-form select, .ev-form textarea { width: 100%; max-width: 100%; min-height: 40px;
  padding: 8px 12px; font: 400 15px var(--font); color: var(--text); background: var(--raised);
  border: 1px solid var(--line); border-radius: var(--r); }
.ev-form textarea { min-height: 64px; resize: vertical; }
.ev-form .save-row { display: flex; gap: var(--s2); margin-top: var(--s4); align-items: center; flex-wrap: wrap; }
.ev-form .ev-status { font-size: 13px; color: var(--text-3); }
.ev-form .ev-status.ok { color: var(--green); }
.ev-form .ev-status.err { color: var(--red-text); }
/* ---- camera page: triggers ---- */
/* Sync badge (amber = look at this, red = act now) + its detail line. */
.tag.bad { border-color: var(--red); color: var(--red-text); }
.ev-sync-detail { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.ev-sync-detail.bad { color: var(--red-text); }
.ev-note:empty { display: none; }
.ev-note.ok { color: var(--green); }
.ev-note.err { color: var(--red-text); }
/* Edit form: shared-trigger line, tuning reset, collapsed outputs. */
.ev-form .ev-shared { margin: 0 0 var(--s3); }
.ev-form input:disabled, .ev-form select:disabled, .ev-form textarea:disabled { opacity: .6; cursor: not-allowed; }
.ev-form .ev-tune { margin-top: var(--s3); }
.ev-form .ev-tune .hint { margin: 0 0 var(--s2); }
.ev-form .ev-tune .hint + .btnrow + .hint { margin: var(--s2) 0 0; }
.ev-form .ev-outputs { margin-top: var(--s4); }
.ev-form .ev-outputs > summary { cursor: pointer; font-size: 14px; color: var(--text-2); }
.ev-form .ev-outputs fieldset { border: 0; padding: 0; margin: var(--s3) 0 0; min-width: 0; }
.ev-form .ev-outputs fieldset:disabled { opacity: .5; }
.ev-form .ev-outputs .lbl { display: block; font-size: 13px; color: var(--text-2); margin: 0 0 6px; }
.ev-form .checks label { display: inline-flex; margin: 0; font-size: 14px; color: var(--text); }
.ev-form .checks input { width: 18px; height: 18px; min-height: 0; padding: 0; }
/* Add existing trigger panel. */
.ae-panel { margin: 0 0 var(--s4); }
.ae-list { display: flex; flex-direction: column; }
.ae-row { display: flex; justify-content: space-between; align-items: center; gap: var(--s3);
  padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.ae-row:last-child { border-bottom: 0; }
.ae-row b { overflow-wrap: anywhere; }
.ae-row .line { font-size: 13px; color: var(--text-3); margin-top: 4px; display: flex; gap: 4px var(--s3);
  flex-wrap: wrap; }
.ae-row.off b { color: var(--text-2); }
.local-only h3 { margin-bottom: var(--s2); }
.rule.local { grid-template-columns: 52px minmax(0, 1fr); }
@media (max-width: 860px) {
  .ae-row { align-items: flex-start; }
  .ev-form .checks label { min-height: 44px; }
  .ev-form .checks input { width: 22px; height: 22px; }
}
.banner { display: none; }
.banner.show { display: block; }

/* ---------- Alert routing ---------- */
.board { display: grid; grid-template-columns: 150px minmax(0, 1fr); font-size: 13px; }
.board .hours { display: grid; grid-template-columns: repeat(6, 1fr); color: var(--text-3); padding-bottom: 6px; }
.board .row-l { padding: 6px 0; color: var(--text-2); display: flex; align-items: center; height: 34px; }
.board .row-l.today { color: var(--text); font-weight: 600; }
.board .track { position: relative; height: 34px; border-top: 1px solid var(--line);
  background-image: linear-gradient(to right, var(--line) 1px, transparent 1px); background-size: calc(100% / 4) 100%; }
.board .bar { position: absolute; top: 6px; bottom: 6px; border-radius: 3px; padding: 0 8px;
  font-weight: 600; color: #121416; display: flex; align-items: center; overflow: hidden; white-space: nowrap;
  font-size: 12px; }
.board .bar.g1 { background: var(--g1); } .board .bar.g2 { background: var(--g2); }
.board .bar.g3 { background: var(--g3); } .board .bar.g4 { background: var(--g4); }
.board .bar.g5 { background: var(--g5); } .board .bar.g6 { background: var(--g6); }
.board .now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--amber); z-index: 1; }
.board .now::before { content: "now"; position: absolute; top: 9px; left: 6px; background: var(--surface);
  padding: 0 3px; color: var(--amber); font-size: 11px; font-weight: 600; }
.groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); align-items: start; }
.group h3 { display: flex; align-items: center; gap: 8px; font-size: 17px; overflow-wrap: anywhere; }
.people { list-style: none; margin: var(--s2) 0; padding: 0; font-size: 14px; }
.people li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0;
  border-bottom: 1px solid var(--line); }
.people li:last-child { border-bottom: 0; }
.people small { color: var(--text-3); text-align: right; }
.people .x { min-height: 28px; padding: 0 8px; font-size: 13px; }
.when { font-size: 14px; color: var(--text-2); margin: 0 0 var(--s2); }
.when-list { list-style: none; margin: 0 0 var(--s2); padding: 0; font-size: 14px; color: var(--text-2); }
.when-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 30px; }
.group details { margin-top: var(--s3); }
.group details .panel-in { margin-top: var(--s3); display: flex; flex-direction: column; gap: var(--s3); }
.sentence { font-size: 15px; line-height: 1.6; }
.sentence b { font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 12px;
  background: var(--raised); border: 1px solid var(--line); font-size: 14px; white-space: nowrap; }
.chip .sw { width: 8px; height: 8px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) 480px; }
.login .pic { position: relative; background: #000 url(login.jpg) center/cover; }
.login .pic::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(30,33,36,0) 40%, var(--bg)); }
.login .pic .cap { position: absolute; left: 32px; bottom: 28px; z-index: 1; max-width: 420px;
  font: 600 30px/1.1 var(--head); text-shadow: 0 2px 12px rgba(0,0,0,.6); }
.login form { align-self: center; padding: var(--s6) var(--s7); display: flex; flex-direction: column; gap: var(--s4); }
.login form .brand { margin-bottom: var(--s4); }
.login h1 { font-size: 28px; }
.login .btn { min-height: 44px; }
/* Store badges on the login page: placeholders until the apps are listed.
   Dimmed + no href + aria-disabled; swap in hrefs and drop the class to go live. */
.login .stores { margin-top: var(--s4); display: flex; flex-direction: column; gap: var(--s2); }
.login .store-badges { display: flex; gap: var(--s3); flex-wrap: wrap; }
.login .store-badge img { display: block; }
.login .store-badge[aria-disabled="true"] { opacity: .35; filter: grayscale(1); cursor: default; pointer-events: none; }
/* Public demo request form (templates/demo_request.html): the login frame, rtl-aware. */
.demo-req form { max-width: 560px; }
.demo-req .consent { display: flex; gap: 10px; align-items: flex-start; }
.demo-req .consent input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.demo-req .hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.demo-req .lang { align-self: flex-end; font-size: 14px; }
.demo-req[dir="rtl"] .lang { align-self: flex-start; }

/* ---------- Assistant (company + camera chat; driven by device_chat.js) ---------- */
.chat-wrap { max-width: 880px; display: flex; flex-direction: column; min-height: calc(100vh - 96px); }
.chat-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: var(--s3);
  border-bottom: 1px solid var(--line); }
.chat-head .grow { flex: 1; }
.chat-head .chip { font-size: 12px; color: var(--text-2); }
.chat-head .chip b { color: var(--text); font-weight: 600; }
.picker-row { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) 0 4px; }
.picker-row select { flex: 1; min-width: 0; max-width: 360px; min-height: 36px; padding: 6px 10px;
  background: var(--raised); border: 1px solid var(--line); color: var(--text); border-radius: var(--r);
  font-size: 14px; }
#msgs { flex: 1; overflow-y: auto; padding: var(--s4) 0; }
.turn { display: flex; flex-direction: column; margin-bottom: 14px; }
.turn.user { align-items: flex-end; }
.turn.assistant { align-items: flex-start; }
.turn .role { font-size: 12px; color: var(--text-3); margin: 0 4px 3px; font-weight: 600; }
.turn .meta { font-size: 12px; color: var(--text-3); margin: 4px 4px 0; }
.chat-wrap:not([data-show-cost]) .turn .meta { display: none; }
.bubble { max-width: 78%; padding: 9px 13px; border-radius: 12px; font-size: 15px; line-height: 1.5;
  overflow-wrap: anywhere; }
.turn.user .bubble { background: var(--raised); border: 1px solid var(--line); border-bottom-right-radius: 4px; }
.turn.assistant .bubble { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble p { margin: 0 0 7px; } .bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 5px 0 9px 20px; padding: 0; }
.bubble strong { font-weight: 600; }
.bubble code { background: var(--bg); padding: 1px 5px; border-radius: 3px; }
.bubble pre { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 9px 11px;
  margin: 7px 0; overflow-x: auto; }
.bubble pre code { padding: 0; }
.bubble h1, .bubble h2, .bubble h3 { font: 600 16px var(--font); margin: 12px 0 5px; }
.bubble table { border-collapse: collapse; margin: 7px 0; font-size: 14px; width: 100%; }
.bubble th, .bubble td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; }
.bubble blockquote { border-left: 3px solid var(--line); margin: 7px 0; padding: 2px 0 2px 11px; color: var(--text-2); }
.tool-strip { margin-top: 6px; max-width: 78%; display: flex; align-items: center; gap: 8px;
  border: 1px dashed var(--line); border-radius: var(--r); padding: 5px 10px; cursor: pointer; user-select: none;
  font-size: 13px; color: var(--text-3); }
.tool-strip:hover { border-style: solid; }
.tool-strip.err { border-color: var(--red-deep); color: var(--red-text); border-style: solid; }
.tool-strip .caret { transition: transform .15s; }
.tool-strip.open .caret { transform: rotate(90deg); }
.tool-strip .verb { color: var(--text-2); font-weight: 600; }
.tool-strip .summary { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-detail { display: none; margin-top: 4px; max-width: 78%; padding: 8px 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); font-size: 12px; color: var(--text-3); }
.tool-detail.open { display: block; }
.tool-detail .section { margin: 0 0 6px; }
.tool-detail .label { font-size: 12px; margin-bottom: 3px; }
.tool-detail pre { margin: 0; padding: 6px 8px; background: var(--bg); border-radius: 3px; max-height: 240px;
  overflow: auto; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); }
.input-row { position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--line);
  padding: var(--s3) 0 max(12px, env(safe-area-inset-bottom)); display: flex; gap: var(--s2); }
#ta { flex: 1; min-height: 44px; max-height: 220px; resize: vertical; font: 400 15px var(--font); padding: 10px 12px;
  background: var(--raised); color: var(--text); border: 1px solid var(--line); border-radius: var(--r); }
#ta:focus { outline: 2px solid var(--steel); outline-offset: -1px; }
#send { min-width: 84px; padding: 0 18px; font: 600 15px var(--font); background: var(--text); color: var(--bg);
  border: 0; border-radius: var(--r); cursor: pointer; }
#send:disabled { background: var(--raised); color: var(--text-3); cursor: progress; }
.helper { color: var(--text-3); font-size: 13px; padding: 4px 2px 0; }
.empty-hint { color: var(--text-2); font-size: 14px; text-align: center; margin: 48px auto; max-width: 540px;
  line-height: 1.8; }
.empty-hint em { color: var(--text); font-style: normal; background: var(--surface); padding: 2px 8px;
  border-radius: 4px; border: 1px solid var(--line); display: inline-block; margin: 3px 0; }
.chat-suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.chat-suggestion { font: 400 14px var(--font); color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 18px; padding: 8px 14px; min-height: 44px; cursor: pointer;
  text-align: left; touch-action: manipulation; max-width: 100%; line-height: 1.3; }
.chat-suggestion:hover { background: var(--raised); }

/* ---------- Weekly report ---------- */
.bars { display: flex; gap: 6px; align-items: flex-end; height: 120px; margin-top: var(--s2); }
.bars .b { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: stretch; height: 100%; }
.bars .col { flex: 1; display: flex; align-items: flex-end; }
.bars .fill { width: 100%; background: var(--g1); border-radius: 2px 2px 0 0; min-height: 2px; position: relative; }
.bars .fill span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 12px;
  color: var(--text-2); }
.bars .lbl { font-size: 12px; color: var(--text-3); text-align: center; margin-top: 4px; }
.heat { display: grid; grid-template-columns: 40px repeat(24, minmax(0, 1fr)); gap: 2px; font-size: 11px;
  color: var(--text-3); }
.heat .c { min-height: 16px; border-radius: 2px; background: var(--raised); }
.heat .rl { text-align: right; padding-right: 6px; line-height: 16px; }
.heat .cl { text-align: center; }
.thumbs img { width: 64px; height: 36px; object-fit: cover; border-radius: 3px; margin-right: 4px;
  vertical-align: middle; border: 1px solid var(--line); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .groups { grid-template-columns: minmax(0, 1fr); }
  .camhead { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .side { position: sticky; top: 0; z-index: 5; height: auto; padding: 10px var(--s4) 0; gap: 8px;
    border-bottom: 1px solid var(--line); background: var(--side); overflow: visible; }
  .company { margin: 0; padding: 0; }
  .nav { flex-direction: row; overflow-x: auto; scrollbar-width: none;
    margin: 0 calc(-1 * var(--s4)); padding: 0 var(--s4); }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 12px; white-space: nowrap; border-radius: 0; min-height: 44px; }
  .nav a[aria-current] { background: none; box-shadow: inset 0 -2px 0 var(--text); }
  .nav .sep, .side .me { display: none; }
  .me-m { display: inline; }
  .main { padding: var(--s5) var(--s4) var(--s7); }
  h1 { font-size: 28px; }
  /* 44 px tap targets on phones (WCAG 2.5.5 / Apple HIG). */
  .btn, .btn-sm, .people .x { min-height: 44px; }
  details > summary { min-height: 44px; display: flex; align-items: center; }
  .checks label, .confirm { min-height: 44px; }
  .checks input, .confirm input { width: 22px; height: 22px; }
  .seg { display: flex; overflow-x: auto; max-width: 100%; }
  .seg a { padding: 11px 14px; }
  .alert { grid-template-columns: minmax(0, 1fr); padding: 0; overflow: hidden; gap: 0; }
  .alert .frame { border-radius: 0; }
  .alert .what { padding: var(--s3) var(--s4) 0; }
  .alert .acts { flex-direction: row; flex-wrap: wrap; padding: var(--s3) var(--s4) var(--s4); }
  .alert .acts form, .alert .acts > .btn { flex: 1; }
  .alert .acts .btn { min-height: 44px; }
  .alert.is-open, .alert.is-wait { border-left-width: 1px; border-top: 4px solid var(--red); }
  .alert.is-wait { border-top-color: var(--amber); }
  .alert.is-closed, .det { display: grid; grid-template-columns: 112px minmax(0, 1fr); }
  .alert.is-closed .frame, .det .frame { height: 100%; aspect-ratio: auto; min-height: 72px; }
  .alert.is-closed .what, .det .what { padding: var(--s3); }
  .alert.is-closed .acts, .alert.is-closed details, .alert.is-closed .story li + li { display: none; }
  .det .acts { grid-column: 1 / -1; padding: 0 var(--s3) var(--s3); }
  .form-grid, .form-grid.cols-2, .form-grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .ev-form .grid { grid-template-columns: minmax(0, 1fr); }
  .board { grid-template-columns: 64px minmax(0, 1fr); }
  .board .hours span:nth-child(even) { visibility: hidden; }
  .table.stack thead { display: none; }
  .table.stack tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; border-bottom: 1px solid var(--line);
    padding: 6px 0; }
  .table.stack tr:last-child { border-bottom: 0; }
  .table.stack td { border: 0; padding: 4px var(--s4); }
  .table.stack td.full { grid-column: 1 / -1; }
  .table.stack tr.editrow:target { display: block; }
  .rule { grid-template-columns: 52px minmax(0, 1fr); }
  .rule .acts { grid-column: 2; }
  .rule .ev-form { grid-column: 1 / -1; }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login .pic { height: 34vh; }
  .login .pic .cap { font-size: 24px; left: var(--s4); right: var(--s4); bottom: var(--s4); }
  .login .pic::after { background: linear-gradient(180deg, rgba(30,33,36,0) 30%, var(--bg)); }
  .login form { padding: var(--s5) var(--s4); }
  .input, .ev-form input, .ev-form select, .ev-form textarea, #ta { font-size: 16px; }
  .bubble, .tool-strip, .tool-detail { max-width: 92%; }
  .kpis b { font-size: 24px; }
  .heat { grid-template-columns: 32px repeat(24, minmax(0, 1fr)); font-size: 9px; }
}

/* ---- triggers page ---- */
/* The library (templates/triggers.html): one .trig row per trigger, its
   forms inside <details> so live.js leaves an open one alone. An open
   disclosure takes the row's full width and moves below the others. */
.tag.bad { border-color: var(--red-deep); color: var(--red-text); }
.tag.quiet { color: var(--text-3); }
a.tag:hover { text-decoration: none; border-color: var(--text-3); }
.tlib { display: flex; flex-direction: column; }
.trig { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2) var(--s4);
  align-items: start; padding: var(--s4); border-bottom: 1px solid var(--line); }
.trig:last-child { border-bottom: 0; }
.trig h3 { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.trig .q { color: var(--text-2); font-size: 14px; margin: 2px 0 0; overflow-wrap: anywhere; }
.trig .badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s2); }
.trig .acts { display: flex; flex-wrap: wrap; gap: 0 var(--s4); justify-content: flex-end; }
.trig .acts > details > summary { min-height: 32px; display: inline-flex; align-items: center; }
.trig .acts:has(details[open]) { grid-column: 1 / -1; justify-content: flex-start; }
.trig .acts > details[open] { flex-basis: 100%; order: 2; min-width: 0; }
.t-panel { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r);
  padding: var(--s4); margin-top: var(--s2); }
.t-panel .input { background: var(--surface); }
.t-sub { margin-top: var(--s4); padding-top: var(--s4); border-top: 1px solid var(--line); }
.t-form fieldset, .t-pick, .t-keep { border: 0; padding: 0; margin: 0; min-width: 0; }
.t-hours .t-times { margin-top: var(--s2); max-width: 420px; }
.t-impact { font-size: 14px; color: var(--text-2); margin: var(--s3) 0 0; }
.t-grow { flex: 1; min-width: 0; width: auto; }
.t-assigned { list-style: none; margin: 0; padding: 0; }
.t-assigned li { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s3);
  padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
.t-assigned li:last-child { border-bottom: 0; }
.t-assigned .who { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.t-assigned .who a { font-weight: 500; overflow-wrap: anywhere; }
.t-assigned .who .hint { flex-basis: 100%; margin: 0; }
.t-pick { display: flex; flex-wrap: wrap; gap: 4px var(--s4); margin: var(--s3) 0 var(--s2); }
.t-pick legend { width: 100%; }
.t-pick label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; min-height: 32px; }
.t-pick label.off { color: var(--text-3); }
.t-pick input { width: 18px; height: 18px; accent-color: var(--text); }
.t-similar details { margin-top: var(--s2); }
.t-keep label { margin: 4px 0; }
.t-local-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s3);
  margin-top: var(--s3); }
.t-local-list, .t-arch-list { list-style: none; margin: 0; padding: 0; }
.t-local-list li { display: flex; justify-content: space-between; gap: var(--s3); font-size: 14px; padding: 4px 0; }
.t-arch-list li { display: flex; justify-content: space-between; align-items: center; gap: var(--s3);
  flex-wrap: wrap; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
.t-arch-list li:last-child { border-bottom: 0; }
@media (max-width: 860px) {
  .trig .acts > details > summary { min-height: 44px; }
  .t-pick label { min-height: 44px; }
  .t-pick input { width: 22px; height: 22px; }
}
@media (max-width: 640px) {
  .trig { grid-template-columns: minmax(0, 1fr); padding: var(--s3); }
  .trig .acts { justify-content: flex-start; }
  .t-panel { padding: var(--s3); }
  .t-hours .t-times { max-width: none; }
}

/* ---------- Browser demo (/demo, static/demo.js) ---------- */
.demo-steps { list-style: none; margin: 0 0 var(--s4); padding: 0; display: flex; gap: var(--s2); flex-wrap: wrap; }
.demo-steps button { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px;
  border-radius: var(--r); border: 1px solid var(--line); background: transparent; color: var(--text-2);
  font: 500 14px var(--font); touch-action: manipulation; }
.demo-steps button .n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--line); font-size: 12px; }
.demo-steps button[aria-current="step"] { color: var(--text); border-color: var(--text-3); background: var(--surface); }
.demo-steps button.done .n { background: var(--green); border-color: var(--green); color: var(--bg); }
.demo-steps button:disabled { opacity: .5; cursor: not-allowed; }
.demo-card { max-width: 860px; }
.demo-lead { font-size: 17px; margin: 0 0 var(--s3); }
.demo-lead b { font-weight: 600; }
.demo-msg { margin: var(--s3) 0 0; color: var(--text-2); }
.demo-chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s4); }
.demo-chip { min-height: 44px; padding: 8px 14px; border-radius: 22px; border: 1px solid var(--line);
  background: var(--raised); color: var(--text); font: 400 15px var(--font); text-align: left;
  touch-action: manipulation; }
.demo-chip:hover { border-color: var(--text-3); }
.demo-chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 600; }
.demo-card textarea.input { font-size: 16px; }
.demo-video { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
  aspect-ratio: 4 / 3; max-width: 480px; width: 100%; display: grid; place-items: center; }
.demo-video:empty::after { content: "Camera off"; color: var(--text-3); font-size: 14px; }
.demo-cam { width: 100%; height: 100%; object-fit: cover; display: block; }
.demo-watch { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s4); align-items: start; }
.demo-side { display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.demo-side .form-actions { margin-top: 0; }
.demo-status { margin: 0; display: flex; align-items: center; gap: var(--s2); font-weight: 500; }
.demo-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line);
  border-top-color: var(--steel); animation: demo-spin 1s linear infinite; flex: none; }
@keyframes demo-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .demo-spin { animation-duration: 3s; } }
.demo-verdict { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3); }
.demo-answer { display: flex; align-items: baseline; gap: var(--s2); }
.demo-answer b { font: 600 30px/1 var(--head); }
.demo-answer b.yes { color: var(--red-text); }
.demo-answer b.no { color: var(--green); }
.demo-bar { height: 8px; border-radius: 4px; background: var(--bg); margin: var(--s2) 0 0; overflow: hidden; }
.demo-bar span { display: block; height: 100%; width: 0; background: var(--amber); transition: width .4s; }
.demo-verdict .hint { margin: var(--s2) 0 0; }
.demo-time { margin: 0; color: var(--text-2); font-size: 14px; }
.demo-fire { display: flex; gap: var(--s4); align-items: flex-start; flex-wrap: wrap; margin-bottom: var(--s4);
  padding: var(--s3) var(--s4); border: 1px solid var(--red-deep); border-left: 4px solid var(--red);
  border-radius: var(--r); background: var(--raised); }
.demo-fire-text { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 200px; }
.demo-fire-text b { font: 600 22px/1.15 var(--head); color: var(--red-text); }
.demo-fire-text span { color: var(--text-2); font-size: 14px; }
.demo-fire img { width: 240px; max-width: 100%; border-radius: var(--r); border: 1px solid var(--line); }
.demo-alerts { margin-top: var(--s4); border-top: 1px solid var(--line); padding-top: var(--s3); }
.demo-alerts ul { list-style: none; margin: 0; padding: 0; font-size: 14px; color: var(--text-2); }
.demo-alerts li { padding: 4px 0; }
.demo-alerts li b { color: var(--text); font-weight: 600; }
@media (max-width: 640px) {
  .demo-watch { grid-template-columns: minmax(0, 1fr); }
  .demo-video { max-width: none; }
  .demo-steps button { padding: 0 10px; }
  .demo-side .form-actions .btn { flex: 1; min-height: 44px; }
  .demo-fire img { width: 100%; }
}
