/* Codelyne Machine-Zone Presence Monitor
   Palette: clean industrial light. Warm off-white floor, charcoal ink and controls,
   safety-yellow markers. State colours are always paired with a text label. */
/* Self-hosted (SIL OFL) so the UI works on isolated workshop networks */
@font-face { font-family: "Barlow"; font-weight: 400; font-style: normal; font-display: swap; src: url("/static/fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-style: normal; font-display: swap; src: url("/static/fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-style: normal; font-display: swap; src: url("/static/fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 500; font-style: normal; font-display: swap; src: url("/static/fonts/barlow-semi-condensed-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 600; font-style: normal; font-display: swap; src: url("/static/fonts/barlow-semi-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 700; font-style: normal; font-display: swap; src: url("/static/fonts/barlow-semi-condensed-latin-700-normal.woff2") format("woff2"); }
:root {
  --bg: #F2F3F0;
  --surface: #FFFFFF;
  --surface-2: #F7F7F5;
  --ink: #1D2125;
  --muted: #5D646C;
  --rule: #DCDED9;
  --rule-strong: #C3C7C0;
  /* charcoal is the action colour; safety yellow marks "you are here" and focus */
  --accent: #1D2125;
  --accent-ink: #FFFFFF;
  --mark: #F5B400;
  --mark-soft: #FFF4CC;
  --mark-ink: #8A5A00;
  --pos: #1B7F4B;
  --pos-soft: #E6F4EC;
  --neg: #C2410C;
  --neg-soft: #FDEEE6;
  --unk: #6B7178;
  --unk-soft: #EEEFEC;
  --danger: #C62828;
  --danger-soft: #FCEAEA;
  --rail: #1D2125;
  --rail-ink: #C9CDD1;
  --radius: 6px;
  --hazard: repeating-linear-gradient(-45deg, var(--mark) 0 10px, var(--ink) 10px 20px);
  --shadow: 0 1px 2px rgba(29, 33, 37, .06);
  --f-head: "Barlow Semi Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --f-body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { font-family: var(--f-head); font-weight: 600; letter-spacing: .01em; margin: 0; line-height: 1.15; }
h1 { font-size: 1.85rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
a { color: inherit; }
main a:not(.btn):not(.company-card):not(.home-card):not(.kpi) { color: var(--mark-ink); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-family: var(--f-head); font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
body:has(.demo-banner) .shell { min-height: calc(100vh - 34px); }
.rail {
  background: var(--rail); color: var(--rail-ink); display: flex; flex-direction: column;
  padding: 0 12px 16px; border-right: none;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
/* hazard tape across the top of the rail */
.rail::before { content: ""; display: block; height: 6px; margin: 0 -12px 18px; background: var(--hazard); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 20px; font-family: var(--f-head); line-height: 1.1; border-bottom: 1px solid rgba(255, 255, 255, .08); margin-bottom: 8px; }
.brand .mark { width: 34px; height: 34px; border-radius: 4px; background: var(--mark); box-shadow: inset 0 0 0 3px var(--rail), 0 0 0 2px var(--mark); flex: none; }
.brand img.mark.logo { object-fit: contain; background: #fff; box-shadow: none; border: none; padding: 2px; }
.brand b { display: block; color: #FFFFFF; font-size: 1.15rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.brand span { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: #8C949C; }
.rail nav { display: grid; gap: 2px; align-content: start; }
.nav-mod { display: grid; gap: 2px; }
.nav-k { margin: 16px 12px 4px; font-family: var(--f-head); font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #7D858D; }
.rail nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; text-decoration: none; color: var(--rail-ink);
  border-left: 3px solid transparent; border-radius: 0 4px 4px 0; font-family: var(--f-body); font-weight: 500; font-size: .95rem;
}
.nav-ico { width: 18px; height: 18px; display: grid; place-items: center; color: #8C949C; flex: none; }
.nav-ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rail nav a:hover { background: rgba(255, 255, 255, .06); color: #FFFFFF; }
.rail nav a:hover .nav-ico { color: #FFFFFF; }
.rail nav a[aria-current="page"] { border-left-color: var(--mark); color: #FFFFFF; background: rgba(245, 180, 0, .12); font-weight: 600; }
.rail nav a[aria-current="page"] .nav-ico { color: var(--mark); }
.rail .who { margin-top: auto; padding: 16px 8px 0; border-top: 1px solid rgba(255, 255, 255, .08); font-size: .9rem; }
.who-name { color: #FFFFFF; font-weight: 600; }
.who-role { color: #8C949C; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; margin-top: 2px; }
.rail .who button { margin-top: 12px; width: 100%; }
main { padding: 26px 30px 44px; min-width: 0; }
.page-head {
  display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
  padding-bottom: 14px; border-bottom: 2px solid var(--ink);
}
.page-head h1::before { content: ""; display: inline-block; width: 6px; height: .8em; margin-right: 10px; background: var(--mark); vertical-align: baseline; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 72ch; }
.page-head .grow { flex: 1; }
.demo-banner {
  background: var(--mark); color: var(--ink); border-bottom: 4px solid transparent;
  border-image: var(--hazard) 0 0 1 0 / 0 0 4px 0 stretch;
  padding: 6px 30px; font-weight: 700; font-family: var(--f-head); letter-spacing: .06em; text-transform: uppercase;
}

/* ---------- controls ---------- */
button, .btn {
  font: inherit; font-family: var(--f-head); font-weight: 600; font-size: .95rem; letter-spacing: .04em; text-transform: uppercase; cursor: pointer;
  border: 1px solid transparent; background: var(--accent); color: var(--accent-ink); padding: 8px 16px; border-radius: 4px;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}
button:hover, .btn:hover { background: #343A40; }
button.secondary, a.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--rule-strong); }
button.secondary:hover, a.btn.secondary:hover { border-color: var(--ink); background: var(--surface-2); color: var(--ink); }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
button.danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
button.danger:hover { background: var(--danger-soft); }
button.link { background: none; border: none; padding: 0; color: var(--mark-ink); text-decoration: underline; text-underline-offset: 2px; font-family: var(--f-body); font-weight: 500; letter-spacing: 0; text-transform: none; }
button.link:hover { background: none; color: var(--ink); }
button:disabled { opacity: .45; cursor: not-allowed; }
.rail button { background: transparent; border-color: rgba(255, 255, 255, .18); color: var(--rail-ink); font-size: .8rem; padding: 5px 10px; }
.rail button:hover { background: transparent; border-color: var(--mark); color: var(--mark); }
label { display: grid; gap: 4px; font-size: .78rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--rule-strong); border-radius: 4px; padding: 8px 10px;
  min-width: 0; letter-spacing: 0; text-transform: none; font-weight: 400;
}
input:hover, select:hover, textarea:hover { border-color: #A7ACA4; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgba(245, 180, 0, .45); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--ink); }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: .92rem; font-weight: 500; letter-spacing: 0; text-transform: none; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 14px; align-items: end; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { background: var(--surface); color: var(--ink); border-color: var(--rule-strong); font-size: .84rem; padding: 4px 10px; }
.chips button:hover { background: var(--surface-2); border-color: var(--ink); }
.chips button[aria-pressed="true"] { background: var(--mark-soft); border-color: var(--ink); color: var(--ink); box-shadow: inset 0 -3px 0 var(--mark); }

/* ---------- panels & tables ---------- */
.panel { background: var(--surface); border: 1px solid var(--rule); border-top: 3px solid var(--ink); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.panel + .panel, .stack > * + * { margin-top: 14px; }
.panel h2, .panel h3 { margin-bottom: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; font-size: 1rem; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th {
  text-align: left; font-family: var(--f-head); font-weight: 600; color: var(--muted); font-size: .76rem; letter-spacing: .08em; text-transform: uppercase;
  padding: 8px 10px; background: var(--surface-2); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule-strong);
}
td { padding: 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
tbody tr:nth-child(even) td { background: #FBFBFA; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--mark-soft); }
tr.selected td { background: var(--mark-soft); box-shadow: inset 0 -1px 0 var(--mark); }
tr.selected td:first-child { box-shadow: inset 4px 0 0 var(--mark); }
.table-wrap { overflow-x: auto; }
.notice { border-left: 4px solid var(--neg); background: var(--neg-soft); color: var(--ink); padding: 10px 12px; border-radius: 0 4px 4px 0; margin: 8px 0; }
.notice.info { border-left-color: var(--unk); background: var(--unk-soft); }
.notice.err { border-left-color: var(--danger); background: var(--danger-soft); color: var(--ink); }
.empty {
  padding: 32px; text-align: center; color: var(--muted); border: 1px dashed var(--rule-strong); border-radius: var(--radius);
  background: var(--surface-2);
}
td.empty { border: none; border-bottom: 1px solid var(--rule); border-radius: 0; background: transparent !important; }

/* ---------- state labels ---------- */
.state { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; font-family: var(--f-head); font-weight: 700; font-size: .86rem; letter-spacing: .06em; text-transform: uppercase; }
.state::before { content: ""; width: 10px; height: 10px; border-radius: 1px; background: var(--unk); }
.state.pos { color: var(--pos); }
.state.neg { color: var(--neg); }
.state.pos::before { background: var(--pos); }
.state.neg::before { background: var(--neg); }
.health {
  font-family: var(--f-head); font-weight: 700; padding: 2px 8px; border-radius: 3px; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase;
  background: var(--unk-soft); color: var(--ink); border: 1px solid var(--rule-strong);
}
.health.online { background: var(--pos-soft); color: var(--pos); border-color: rgba(27, 127, 75, .35); }
.health.offline, .health.stale, .health.frozen, .health.error { background: var(--danger-soft); color: var(--danger); border-color: rgba(198, 40, 40, .35); }
.health.review { background: var(--neg-soft); color: var(--neg); border-color: rgba(194, 65, 12, .35); }

/* ---------- live view ---------- */
.shop-tabs, .cam-tabs { display: flex; gap: 0; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1px solid var(--rule-strong); }
.shop-tabs { margin-bottom: 12px; }
.shop-tabs button, .cam-tabs button {
  background: transparent; color: var(--muted); border: none; border-bottom: 3px solid transparent; border-radius: 0;
  font-size: .92rem; padding: 8px 16px; margin-bottom: -1px;
}
.shop-tabs button:hover, .cam-tabs button:hover { background: transparent; color: var(--ink); border-bottom-color: var(--rule-strong); }
.shop-tabs button[aria-selected="true"], .cam-tabs button[aria-selected="true"] { background: transparent; color: var(--ink); border-bottom-color: var(--mark); box-shadow: none; }
.floor {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 20px; align-items: start;
}
.floor-card { display: grid; gap: 10px; min-width: 0; }
.floor-card h2 { font-size: 1.05rem; margin: 0; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.floor-card .cam-meta { margin-top: 0; }
.floor-card .plate { min-height: 0; }
.floor-card .plate .band { font-size: 1.1rem; padding: 9px 12px; }
.floor-card .plate .elapsed { font-size: 2rem; }
#assoc-panel { margin-top: 20px; }
.viewer {
  position: relative; background: #1D2125; border-radius: var(--radius); overflow: hidden; line-height: 0;
  border: 1px solid var(--ink); box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--rule); min-height: 220px; margin: 5px;
}
.viewer img, .viewer video { width: 100%; height: auto; display: block; background: #0E1114; }
.viewer:has(img.frame-failed)::after {
  content: "Picture did not load. Trying again.";
  position: absolute; left: 12px; bottom: 12px; z-index: 2;
  padding: 6px 10px; border-radius: 8px; background: #3b1212; color: #fff;
  font-size: .82rem; line-height: 1.3;
}
.viewer canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.cam-meta {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 12px; padding: 9px 14px;
  font-size: .86rem; background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--ink); border-radius: 4px;
}
.cam-meta .grow { flex: 1; }

.plates { display: grid; gap: 12px; }
.plate {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--rule-strong); border-radius: var(--radius);
  overflow: hidden; min-height: 156px; box-shadow: var(--shadow);
}
.plate .band {
  background: var(--unk); color: #fff; display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px;
  padding: 12px 16px; font-family: var(--f-head); font-weight: 700; font-size: 1.4rem; letter-spacing: .1em; text-transform: uppercase;
}
.plate:not(.pos):not(.neg) .band { background: repeating-linear-gradient(-45deg, #6B7178 0 10px, #62686F 10px 20px); }
.plate.pos { border-color: rgba(27, 127, 75, .45); }
.plate.neg { border-color: rgba(194, 65, 12, .45); }
.plate.pos .band { background: var(--pos); }
.plate.neg .band { background: var(--neg); }
.plate .band .rule { text-transform: none; letter-spacing: 0; font-size: 1.15rem; }
.plate .band small { font-weight: 600; font-size: .74rem; letter-spacing: .02em; text-transform: none; opacity: .9; margin-left: auto; text-align: right; }
.plate .why.quiet { color: var(--neg); }
.plate .why.delayed { color: var(--neg); font-weight: 600; }
.health.delayed { background: var(--neg-soft); color: var(--neg); }
.plate .body { padding: 14px 16px 16px; display: grid; gap: 4px; align-content: start; }
.plate .name { font-family: var(--f-head); font-size: 1.05rem; font-weight: 600; line-height: 1.1; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.plate .elapsed { font-family: var(--f-head); font-size: 2.6rem; font-weight: 700; line-height: 1; letter-spacing: -.01em; }
.plate.pos .elapsed { color: var(--pos); }
.plate.neg .elapsed { color: var(--neg); }
.plate .why { font-size: .82rem; color: var(--muted); }
.plate .today { display: flex; gap: 14px; font-size: .82rem; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--rule-strong); flex-wrap: wrap; }
.plate .today b { font-family: var(--f-head); font-weight: 700; }
.plate.selected { outline: 3px solid var(--mark); outline-offset: -1px; }
.mode-tag { font-size: .74rem; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }

/* ---------- report ---------- */
.report-head { align-items: flex-start; }
.export-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-export { background: var(--accent); color: var(--accent-ink); border-color: transparent; padding: 10px 16px; box-shadow: inset 0 -3px 0 var(--mark); }
.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; border: none; border-radius: 0; background: transparent; }
.figure {
  padding: 14px 16px; background: var(--surface); border: 1px solid var(--rule); border-left: 5px solid var(--ink);
  border-radius: 4px; box-shadow: var(--shadow);
}
.figure .v { white-space: nowrap; font-family: var(--f-head); font-size: clamp(1.35rem, 1.1vw + .85rem, 1.9rem); font-weight: 700; line-height: 1.05; }
.figure .k { font-family: var(--f-head); font-size: .76rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.figure.pos { border-left-color: var(--pos); }
.figure.neg { border-left-color: var(--neg); }
.figure.unk { border-left-color: var(--unk); }
.figure.pos .v { color: var(--pos); }
.figure.neg .v { color: var(--neg); }
.figure.unk .v { color: var(--unk); }
.formula { font-size: .83rem; color: var(--muted); margin-top: 12px; }
.timeline { margin: 8px 0 4px; }
.tl-bar { display: flex; height: 52px; border-radius: 3px; overflow: hidden; border: 1px solid var(--ink); background: var(--unk-soft); }
.tl-seg { height: 100%; border: none; padding: 0; border-radius: 0; min-width: 1px; cursor: pointer; background: var(--unk); transition: none; }
.tl-seg.pos { background: var(--pos); }
.tl-seg.neg { background: var(--neg); }
.tl-seg.unk { background: repeating-linear-gradient(45deg, #C9CCC5 0 4px, #B5B9B1 4px 8px); }
.tl-seg:hover, .tl-seg.sel { box-shadow: inset 0 0 0 3px var(--mark); }
.tl-seg.pos:hover { background: var(--pos); }
.tl-seg.neg:hover { background: var(--neg); }
.tl-seg.unk:hover { background: repeating-linear-gradient(45deg, #C9CCC5 0 4px, #B5B9B1 4px 8px); }
.tl-ticks { position: relative; height: 22px; font-size: .76rem; color: var(--muted); }
.tl-ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; top: 3px; }
.tl-ticks span::before { content: ""; position: absolute; left: 50%; top: -6px; height: 5px; border-left: 1px solid var(--ink); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .85rem; margin-top: 4px; }
.unknown-line { margin: 8px 0 0; }
.hour-chart { display: flex; align-items: flex-end; gap: 6px; overflow-x: auto; min-width: 0; padding-bottom: 4px; }
.hour { display: grid; justify-items: center; gap: 4px; flex: 1 0 36px; }
.hour .col { width: 18px; height: 88px; display: flex; flex-direction: column-reverse; background: var(--unk-soft); border-radius: 2px; overflow: hidden; }
.hour b { display: block; width: 100%; }
.hour b.pos { background: var(--pos); }
.hour b.neg { background: var(--neg); }
.hour b.unk { background: var(--unk); }
.hour span { font-size: .68rem; color: var(--muted); white-space: nowrap; }
.seg-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; font-size: .9rem; }
.seg-detail dt { color: var(--muted); font-size: .74rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.seg-detail dd { margin: 0 0 6px; }
.evidence img, .evidence video { max-width: 100%; border-radius: 3px; border: 1px solid var(--ink); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.split > *, .stack, .panel, .table-wrap { min-width: 0; }

/* ---------- zone editor ---------- */
.editor {
  position: relative; line-height: 0; background: #1D2125; border-radius: var(--radius); overflow: hidden; user-select: none;
  border: 1px solid var(--ink); box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--rule); margin: 5px;
}
.editor img, .editor video { width: 100%; display: block; }
.editor canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.editor + p { margin: 10px 2px 0; }
.zone-list { padding: 0; margin: 10px 0 0; }
.zone-list li { list-style: none; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 4px; margin-bottom: 8px; background: var(--surface); cursor: pointer; }
.zone-list li:hover { border-color: var(--rule-strong); background: var(--surface-2); }
.zone-list li.muted { cursor: default; }
.zone-list li[aria-selected="true"] { border-color: var(--ink); background: var(--mark-soft); box-shadow: inset 5px 0 0 var(--mark); }

/* ---------- login: CCTV scene, sign-in card framed as a detected zone ---------- */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 20px; position: relative; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(circle, rgba(52, 72, 90, .11) 1.2px, transparent 1.7px) 0 0 / 14px 14px,
    radial-gradient(1200px 720px at 60% 42%, #F1F4F6 0%, #DAE1E7 52%, #C2CCD4 100%);
}
.login::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 1100px; height: 640px; transform: translate(-50%, -50%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1100 640'%3E%3Cdefs%3E%3ClinearGradient id='beam' gradientUnits='userSpaceOnUse' x1='700' y1='0' x2='260' y2='0'%3E%3Cstop offset='0' stop-color='%23FFFFFF' stop-opacity='.85'/%3E%3Cstop offset='.55' stop-color='%23FFFFFF' stop-opacity='.3'/%3E%3Cstop offset='1' stop-color='%23FFFFFF' stop-opacity='0'/%3E%3C/linearGradient%3E%3ClinearGradient id='body' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23F4F6F7'/%3E%3Cstop offset='.45' stop-color='%23D3D8DC'/%3E%3Cstop offset='.8' stop-color='%23A9B0B6'/%3E%3Cstop offset='1' stop-color='%238E959B'/%3E%3C/linearGradient%3E%3ClinearGradient id='hood' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23FFFFFF'/%3E%3Cstop offset='1' stop-color='%23C4CACF'/%3E%3C/linearGradient%3E%3ClinearGradient id='dark' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%235B6267'/%3E%3Cstop offset='1' stop-color='%232A2F33'/%3E%3C/linearGradient%3E%3CradialGradient id='glass' cx='.4' cy='.35' r='.7'%3E%3Cstop offset='0' stop-color='%235A6B7A'/%3E%3Cstop offset='.35' stop-color='%231F2A33'/%3E%3Cstop offset='1' stop-color='%2307090B'/%3E%3C/radialGradient%3E%3CradialGradient id='plate' cx='.4' cy='.35' r='.75'%3E%3Cstop offset='0' stop-color='%23FFFFFF'/%3E%3Cstop offset='.7' stop-color='%23D9DEE2'/%3E%3Cstop offset='1' stop-color='%23AEB5BB'/%3E%3C/radialGradient%3E%3ClinearGradient id='arm' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23E9ECEE'/%3E%3Cstop offset='1' stop-color='%239AA1A7'/%3E%3C/linearGradient%3E%3Cfilter id='soft' x='-20%25' y='-20%25' width='140%25' height='160%25'%3E%3CfeDropShadow dx='0' dy='14' stdDeviation='14' flood-color='%232B3A47' flood-opacity='.28'/%3E%3C/filter%3E%3C/defs%3E%3Cg filter='url(%23soft)'%3E%3Ccircle cx='1010' cy='392' r='66' fill='url(%23plate)'/%3E%3Ccircle cx='1010' cy='392' r='40' fill='%23E6EAED' stroke='%23BCC3C8'/%3E%3Cg fill='%237D858C'%3E%3Ccircle cx='1010' cy='338' r='4'/%3E%3Ccircle cx='1010' cy='446' r='4'/%3E%3Ccircle cx='956' cy='392' r='4'/%3E%3Ccircle cx='1064' cy='392' r='4'/%3E%3C/g%3E%3Cpath d='M1010 392 H968 Q942 392 940 366 L940 300' fill='none' stroke='url(%23arm)' stroke-width='26' stroke-linecap='round'/%3E%3C/g%3E%3Cg transform='rotate(0 940 300)'%3E%3CanimateTransform attributeName='transform' type='rotate' values='5 940 300;-6 940 300;5 940 300' calcMode='spline' keyTimes='0;.5;1' keySplines='.45 0 .55 1;.45 0 .55 1' dur='5.6s' repeatCount='indefinite'/%3E%3Cg%3E%3CanimateTransform attributeName='transform' type='rotate' values='12 700 252;-38 700 252;12 700 252' calcMode='spline' keyTimes='0;.5;1' keySplines='.45 0 .55 1;.45 0 .55 1' dur='5.6s' repeatCount='indefinite'/%3E%3Cpath d='M700 252 L260 220 L260 284 Z' fill='url(%23beam)'/%3E%3C/g%3E%3Cg fill='none' stroke='%23fff' stroke-width='1.5'%3E%3Ccircle cx='700' cy='252' r='20' stroke-opacity='0'%3E%3Canimate attributeName='r' values='20;175' dur='2.4s' begin='0s' repeatCount='indefinite'/%3E%3Canimate attributeName='stroke-opacity' values='.75;0' dur='2.4s' begin='0s' repeatCount='indefinite'/%3E%3C/circle%3E%3Ccircle cx='700' cy='252' r='20' stroke-opacity='0'%3E%3Canimate attributeName='r' values='20;175' dur='2.4s' begin='0.8s' repeatCount='indefinite'/%3E%3Canimate attributeName='stroke-opacity' values='.75;0' dur='2.4s' begin='0.8s' repeatCount='indefinite'/%3E%3C/circle%3E%3Ccircle cx='700' cy='252' r='20' stroke-opacity='0'%3E%3Canimate attributeName='r' values='20;175' dur='2.4s' begin='1.6s' repeatCount='indefinite'/%3E%3Canimate attributeName='stroke-opacity' values='.75;0' dur='2.4s' begin='1.6s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/g%3E%3Cg filter='url(%23soft)'%3E%3Cg transform='translate(700 252) rotate(-12)'%3E%3Crect x='210' y='40' width='40' height='34' rx='6' fill='url(%23arm)'/%3E%3Crect x='6' y='-50' width='292' height='100' rx='22' fill='url(%23body)'/%3E%3Crect x='286' y='-44' width='26' height='88' rx='10' fill='url(%23dark)'/%3E%3Cpath d='M-26 -60 Q-30 -74 -14 -76 L290 -76 Q306 -76 306 -60 L306 -46 L24 -46 Q4 -46 -4 -36 Z' fill='url(%23hood)' stroke='%23B7BEC3'/%3E%3Crect x='150' y='-90' width='22' height='16' rx='4' fill='%239AA1A7'/%3E%3Crect x='146' y='-96' width='30' height='8' rx='4' fill='%23C9CED2'/%3E%3Cellipse cx='6' cy='0' rx='26' ry='50' fill='url(%23dark)'/%3E%3Cellipse cx='2' cy='0' rx='20' ry='40' fill='%231A1F23'/%3E%3Cellipse cx='0' cy='0' rx='15' ry='31' fill='url(%23glass)'/%3E%3Cellipse cx='-4' cy='-10' rx='4' ry='9' fill='%23fff' fill-opacity='.55'/%3E%3Cg fill='%238A2A2A'%3E%3Ccircle cx='8' cy='-36' r='2'/%3E%3Ccircle cx='12' cy='-24' r='2'/%3E%3Ccircle cx='12' cy='24' r='2'/%3E%3Ccircle cx='8' cy='36' r='2'/%3E%3C/g%3E%3Ccircle cx='40' cy='-30' r='3.5' fill='%23E53935'%3E%3Canimate attributeName='opacity' values='1;.15;1' dur='1.2s' repeatCount='indefinite'/%3E%3C/circle%3E%3Cpath d='M30 -46 H286' stroke='%23fff' stroke-opacity='.8' stroke-width='2'/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3Ccircle cx='940' cy='300' r='18' fill='%238E959B'/%3E%3Ccircle cx='940' cy='300' r='8' fill='%235B6267'/%3E%3C/svg%3E") center / contain no-repeat; z-index: -1; pointer-events: none;
}
/* camera locks on once both fields are filled */
.login:has(form:valid)::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1100 640'%3E%3Cdefs%3E%3ClinearGradient id='beam' gradientUnits='userSpaceOnUse' x1='700' y1='0' x2='260' y2='0'%3E%3Cstop offset='0' stop-color='%23BDF0D0' stop-opacity='.85'/%3E%3Cstop offset='.55' stop-color='%23BDF0D0' stop-opacity='.3'/%3E%3Cstop offset='1' stop-color='%23BDF0D0' stop-opacity='0'/%3E%3C/linearGradient%3E%3ClinearGradient id='body' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23F4F6F7'/%3E%3Cstop offset='.45' stop-color='%23D3D8DC'/%3E%3Cstop offset='.8' stop-color='%23A9B0B6'/%3E%3Cstop offset='1' stop-color='%238E959B'/%3E%3C/linearGradient%3E%3ClinearGradient id='hood' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23FFFFFF'/%3E%3Cstop offset='1' stop-color='%23C4CACF'/%3E%3C/linearGradient%3E%3ClinearGradient id='dark' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%235B6267'/%3E%3Cstop offset='1' stop-color='%232A2F33'/%3E%3C/linearGradient%3E%3CradialGradient id='glass' cx='.4' cy='.35' r='.7'%3E%3Cstop offset='0' stop-color='%235A6B7A'/%3E%3Cstop offset='.35' stop-color='%231F2A33'/%3E%3Cstop offset='1' stop-color='%2307090B'/%3E%3C/radialGradient%3E%3CradialGradient id='plate' cx='.4' cy='.35' r='.75'%3E%3Cstop offset='0' stop-color='%23FFFFFF'/%3E%3Cstop offset='.7' stop-color='%23D9DEE2'/%3E%3Cstop offset='1' stop-color='%23AEB5BB'/%3E%3C/radialGradient%3E%3ClinearGradient id='arm' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23E9ECEE'/%3E%3Cstop offset='1' stop-color='%239AA1A7'/%3E%3C/linearGradient%3E%3Cfilter id='soft' x='-20%25' y='-20%25' width='140%25' height='160%25'%3E%3CfeDropShadow dx='0' dy='14' stdDeviation='14' flood-color='%232B3A47' flood-opacity='.28'/%3E%3C/filter%3E%3C/defs%3E%3Cg filter='url(%23soft)'%3E%3Ccircle cx='1010' cy='392' r='66' fill='url(%23plate)'/%3E%3Ccircle cx='1010' cy='392' r='40' fill='%23E6EAED' stroke='%23BCC3C8'/%3E%3Cg fill='%237D858C'%3E%3Ccircle cx='1010' cy='338' r='4'/%3E%3Ccircle cx='1010' cy='446' r='4'/%3E%3Ccircle cx='956' cy='392' r='4'/%3E%3Ccircle cx='1064' cy='392' r='4'/%3E%3C/g%3E%3Cpath d='M1010 392 H968 Q942 392 940 366 L940 300' fill='none' stroke='url(%23arm)' stroke-width='26' stroke-linecap='round'/%3E%3C/g%3E%3Cg transform='rotate(-2 940 300)'%3E%3Cg%3E%3Cpath d='M700 252 L486 118 L486 522 Z' fill='url(%23beam)'/%3E%3C/g%3E%3Cg fill='none' stroke='%23fff' stroke-width='1.5'%3E%3Ccircle cx='700' cy='252' r='70' stroke-opacity='.5'/%3E%3Ccircle cx='700' cy='252' r='125' stroke-opacity='.25'/%3E%3C/g%3E%3Cg filter='url(%23soft)'%3E%3Cg transform='translate(700 252) rotate(-12)'%3E%3Crect x='210' y='40' width='40' height='34' rx='6' fill='url(%23arm)'/%3E%3Crect x='6' y='-50' width='292' height='100' rx='22' fill='url(%23body)'/%3E%3Crect x='286' y='-44' width='26' height='88' rx='10' fill='url(%23dark)'/%3E%3Cpath d='M-26 -60 Q-30 -74 -14 -76 L290 -76 Q306 -76 306 -60 L306 -46 L24 -46 Q4 -46 -4 -36 Z' fill='url(%23hood)' stroke='%23B7BEC3'/%3E%3Crect x='150' y='-90' width='22' height='16' rx='4' fill='%239AA1A7'/%3E%3Crect x='146' y='-96' width='30' height='8' rx='4' fill='%23C9CED2'/%3E%3Cellipse cx='6' cy='0' rx='26' ry='50' fill='url(%23dark)'/%3E%3Cellipse cx='2' cy='0' rx='20' ry='40' fill='%231A1F23'/%3E%3Cellipse cx='0' cy='0' rx='15' ry='31' fill='url(%23glass)'/%3E%3Cellipse cx='-4' cy='-10' rx='4' ry='9' fill='%23fff' fill-opacity='.55'/%3E%3Cg fill='%238A2A2A'%3E%3Ccircle cx='8' cy='-36' r='2'/%3E%3Ccircle cx='12' cy='-24' r='2'/%3E%3Ccircle cx='12' cy='24' r='2'/%3E%3Ccircle cx='8' cy='36' r='2'/%3E%3C/g%3E%3Ccircle cx='40' cy='-30' r='3.5' fill='%2322C55E'%3E%3C/circle%3E%3Cpath d='M30 -46 H286' stroke='%23fff' stroke-opacity='.8' stroke-width='2'/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3Ccircle cx='940' cy='300' r='18' fill='%238E959B'/%3E%3Ccircle cx='940' cy='300' r='8' fill='%235B6267'/%3E%3C/svg%3E"); }
.login::before {
  content: "REC \00a0\00a0 CAM 01 \00b7  MAIN GATE"; position: absolute; top: 22px; left: 26px; padding-left: 18px;
  font-family: var(--f-head); font-weight: 700; font-size: .8rem; letter-spacing: .16em; color: #3A4651;
  background: radial-gradient(circle at 5px 50%, #D32F2F 4.5px, transparent 5px);
}
.login form {
  position: relative; transform: translateX(-260px); overflow: visible;
  width: min(400px, 100%); background: var(--surface); border: 1px solid var(--rule-strong); border-radius: var(--radius);
  padding: 0 28px 30px; display: grid; gap: 14px; box-shadow: 0 24px 50px rgba(36, 52, 66, .18);
}
.login form::before { content: ""; display: block; height: 8px; margin: 0 -28px 18px; background: var(--hazard); border-radius: var(--radius) var(--radius) 0 0; }
/* detection box corners */
.login form::after {
  --c: var(--mark); --l: 28px; --t: 3px;
  content: ""; position: absolute; inset: -16px; pointer-events: none;
  background:
    linear-gradient(var(--c), var(--c)) top left / var(--l) var(--t) no-repeat,
    linear-gradient(var(--c), var(--c)) top left / var(--t) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) top right / var(--l) var(--t) no-repeat,
    linear-gradient(var(--c), var(--c)) top right / var(--t) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / var(--l) var(--t) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / var(--t) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / var(--l) var(--t) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / var(--t) var(--l) no-repeat;
}
.login form > div:first-child::before {
  content: "SCANNING ZONE \00b7  AWAITING SIGN-IN"; position: absolute; left: -16px; top: -42px; white-space: nowrap;
  background: var(--mark); color: var(--ink); padding: 4px 9px; border-radius: 2px;
  font-family: var(--f-head); font-weight: 700; font-size: .74rem; letter-spacing: .1em;
}
/* scan bar while the form is incomplete; same 5.6s ease cycle as the camera beam */
.login form > div:first-child::after {
  content: ""; position: absolute; left: -16px; right: -16px; top: -16px; height: 48px; pointer-events: none;
  background: linear-gradient(rgba(245, 180, 0, 0), rgba(245, 180, 0, .14) 44%, rgba(245, 180, 0, .75) 50%, rgba(245, 180, 0, .14) 56%, rgba(245, 180, 0, 0));
  animation: login-scan 2.8s cubic-bezier(.45, 0, .55, 1) infinite alternate;
}
@keyframes login-scan { from { top: -40px; } to { top: calc(100% - 8px); } }
.login:has(form:valid)::before { background-image: radial-gradient(circle at 5px 50%, var(--pos) 4.5px, transparent 5px); }
@media (prefers-reduced-motion: reduce) {
  .login::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1100 640'%3E%3Cdefs%3E%3ClinearGradient id='beam' gradientUnits='userSpaceOnUse' x1='700' y1='0' x2='260' y2='0'%3E%3Cstop offset='0' stop-color='%23FFFFFF' stop-opacity='.85'/%3E%3Cstop offset='.55' stop-color='%23FFFFFF' stop-opacity='.3'/%3E%3Cstop offset='1' stop-color='%23FFFFFF' stop-opacity='0'/%3E%3C/linearGradient%3E%3ClinearGradient id='body' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23F4F6F7'/%3E%3Cstop offset='.45' stop-color='%23D3D8DC'/%3E%3Cstop offset='.8' stop-color='%23A9B0B6'/%3E%3Cstop offset='1' stop-color='%238E959B'/%3E%3C/linearGradient%3E%3ClinearGradient id='hood' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23FFFFFF'/%3E%3Cstop offset='1' stop-color='%23C4CACF'/%3E%3C/linearGradient%3E%3ClinearGradient id='dark' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%235B6267'/%3E%3Cstop offset='1' stop-color='%232A2F33'/%3E%3C/linearGradient%3E%3CradialGradient id='glass' cx='.4' cy='.35' r='.7'%3E%3Cstop offset='0' stop-color='%235A6B7A'/%3E%3Cstop offset='.35' stop-color='%231F2A33'/%3E%3Cstop offset='1' stop-color='%2307090B'/%3E%3C/radialGradient%3E%3CradialGradient id='plate' cx='.4' cy='.35' r='.75'%3E%3Cstop offset='0' stop-color='%23FFFFFF'/%3E%3Cstop offset='.7' stop-color='%23D9DEE2'/%3E%3Cstop offset='1' stop-color='%23AEB5BB'/%3E%3C/radialGradient%3E%3ClinearGradient id='arm' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23E9ECEE'/%3E%3Cstop offset='1' stop-color='%239AA1A7'/%3E%3C/linearGradient%3E%3Cfilter id='soft' x='-20%25' y='-20%25' width='140%25' height='160%25'%3E%3CfeDropShadow dx='0' dy='14' stdDeviation='14' flood-color='%232B3A47' flood-opacity='.28'/%3E%3C/filter%3E%3C/defs%3E%3Cg filter='url(%23soft)'%3E%3Ccircle cx='1010' cy='392' r='66' fill='url(%23plate)'/%3E%3Ccircle cx='1010' cy='392' r='40' fill='%23E6EAED' stroke='%23BCC3C8'/%3E%3Cg fill='%237D858C'%3E%3Ccircle cx='1010' cy='338' r='4'/%3E%3Ccircle cx='1010' cy='446' r='4'/%3E%3Ccircle cx='956' cy='392' r='4'/%3E%3Ccircle cx='1064' cy='392' r='4'/%3E%3C/g%3E%3Cpath d='M1010 392 H968 Q942 392 940 366 L940 300' fill='none' stroke='url(%23arm)' stroke-width='26' stroke-linecap='round'/%3E%3C/g%3E%3Cg transform='rotate(0 940 300)'%3E%3Cg%3E%3Cpath d='M700 252 L486 118 L486 522 Z' fill='url(%23beam)'/%3E%3C/g%3E%3Cg fill='none' stroke='%23fff' stroke-width='1.5'%3E%3Ccircle cx='700' cy='252' r='70' stroke-opacity='.5'/%3E%3Ccircle cx='700' cy='252' r='125' stroke-opacity='.25'/%3E%3C/g%3E%3Cg filter='url(%23soft)'%3E%3Cg transform='translate(700 252) rotate(-12)'%3E%3Crect x='210' y='40' width='40' height='34' rx='6' fill='url(%23arm)'/%3E%3Crect x='6' y='-50' width='292' height='100' rx='22' fill='url(%23body)'/%3E%3Crect x='286' y='-44' width='26' height='88' rx='10' fill='url(%23dark)'/%3E%3Cpath d='M-26 -60 Q-30 -74 -14 -76 L290 -76 Q306 -76 306 -60 L306 -46 L24 -46 Q4 -46 -4 -36 Z' fill='url(%23hood)' stroke='%23B7BEC3'/%3E%3Crect x='150' y='-90' width='22' height='16' rx='4' fill='%239AA1A7'/%3E%3Crect x='146' y='-96' width='30' height='8' rx='4' fill='%23C9CED2'/%3E%3Cellipse cx='6' cy='0' rx='26' ry='50' fill='url(%23dark)'/%3E%3Cellipse cx='2' cy='0' rx='20' ry='40' fill='%231A1F23'/%3E%3Cellipse cx='0' cy='0' rx='15' ry='31' fill='url(%23glass)'/%3E%3Cellipse cx='-4' cy='-10' rx='4' ry='9' fill='%23fff' fill-opacity='.55'/%3E%3Cg fill='%238A2A2A'%3E%3Ccircle cx='8' cy='-36' r='2'/%3E%3Ccircle cx='12' cy='-24' r='2'/%3E%3Ccircle cx='12' cy='24' r='2'/%3E%3Ccircle cx='8' cy='36' r='2'/%3E%3C/g%3E%3Ccircle cx='40' cy='-30' r='3.5' fill='%23E53935'%3E%3C/circle%3E%3Cpath d='M30 -46 H286' stroke='%23fff' stroke-opacity='.8' stroke-width='2'/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3Ccircle cx='940' cy='300' r='18' fill='%238E959B'/%3E%3Ccircle cx='940' cy='300' r='8' fill='%235B6267'/%3E%3C/svg%3E"); }
  .login form > div:first-child::after { display: none; }
}
.login form:valid::after { --c: var(--pos); }
.login form:valid > div:first-child::before { content: "IN ZONE \00b7  READY TO SIGN IN"; background: var(--pos); color: #fff; }
.login form:valid > div:first-child::after { display: none; }
.login h1 { font-size: 1.7rem; }
.login button { width: 100%; padding: 11px 16px; }
@media (max-width: 1000px) {
  .login::after { display: none; }
  .login form { transform: none; margin-top: 40px; }
}
.toast {
  position: fixed; right: 18px; bottom: 18px; background: var(--ink); color: #FFFFFF; border: none; border-left: 5px solid var(--mark);
  padding: 12px 16px; border-radius: 4px; max-width: 420px; z-index: 50; box-shadow: 0 12px 32px rgba(29, 33, 37, .25);
}
.toast.err { background: var(--danger); color: #FFFFFF; border-left-color: #7F1515; }
dialog {
  background: var(--surface); color: var(--ink); border: 1px solid var(--rule-strong); border-top: 4px solid var(--mark); border-radius: var(--radius);
  padding: 20px 22px; max-width: 560px; width: calc(100% - 32px); box-shadow: 0 24px 60px rgba(29, 33, 37, .22);
}
dialog::backdrop { background: rgba(29, 33, 37, .5); }
.progress { height: 8px; background: var(--unk-soft); border: 1px solid var(--rule-strong); border-radius: 2px; overflow: hidden; min-width: 120px; margin-top: 6px; }
.progress div { height: 100%; background: repeating-linear-gradient(-45deg, var(--mark) 0 6px, #E0A400 6px 12px); }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.previews figure { margin: 0; cursor: pointer; background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; }
.previews figure:hover { border-color: var(--rule-strong); }
.previews img { width: 100%; display: block; border: none; border-radius: 0; }
.previews figcaption { padding: 8px 10px 10px; color: var(--muted); }
.previews figure[aria-selected="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--mark); }

/* ---------- portals ---------- */
.dash-grid, .home-grid, .company-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.dash-card h2 { margin: 0 0 12px; font-size: 1.05rem; }
.dash-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.dash-cols article { background: var(--surface-2); border: 1px solid var(--rule); border-radius: 4px; padding: 12px; min-width: 0; }
.dash-cols .k { font-family: var(--f-head); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.dash-cols strong { display: block; font-family: var(--f-head); font-size: 1.8rem; font-weight: 700; line-height: 1.05; margin-top: 6px; }
.dash-zone { margin-top: 8px; }
.dash-zone b { display: block; font-size: .85rem; }
.home-card { text-decoration: none; display: grid; gap: 6px; align-content: start; min-height: 132px; transition: border-color .12s ease; }
.home-card h2 { font-size: 1.1rem; }
.home-card p { margin: 0; color: var(--muted); }
.home-card:hover { border-color: var(--ink); border-top-color: var(--mark); }
.company-card {
  display: flex; align-items: center; gap: 12px; text-decoration: none; background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.company-card[aria-current="true"] { border-color: var(--ink); box-shadow: inset 4px 0 0 var(--mark); }
.company-card img, .avatar, .logo-preview {
  width: 44px; height: 44px; border-radius: 4px; object-fit: contain; background: var(--surface-2);
  border: 1px solid var(--rule); flex: none;
}
.avatar, .logo-preview.placeholder {
  display: grid; place-items: center; font-family: var(--f-head); font-weight: 700; color: var(--ink); background: var(--mark);
  border-color: transparent;
}
.logo-preview { width: 72px; height: 72px; }
.company-card .grow { display: grid; min-width: 0; flex: 1; }
.company-card .grow b, .company-card .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-label { margin: 16px 0 8px; font-family: var(--f-head); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.mod-list { display: grid; gap: 8px; }
.mod-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--rule); border-radius: 4px; background: var(--surface-2); color: var(--ink);
  font-size: .9rem; font-weight: 400; letter-spacing: 0; text-transform: none;
}
.mod-row span { display: grid; gap: 2px; }
.logo-row { display: flex; gap: 14px; align-items: end; margin-top: 16px; flex-wrap: wrap; }
textarea { resize: vertical; }

.co-page .page-head { align-items: center; margin-bottom: 20px; }
.co-page .page-head .btn[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--mark); }
.co-directory {
  grid-template-columns: repeat(auto-fill, minmax(280px, 340px));
  justify-content: start;
  gap: 12px;
}
.co-page .company-card {
  min-height: 78px;
  padding: 14px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.co-page .company-card:hover { border-color: var(--rule-strong); background: var(--surface-2); }
.co-page .company-card[aria-current="true"] {
  border-color: var(--ink);
  background: var(--mark-soft);
  box-shadow: inset 4px 0 0 var(--mark);
}
.co-create { margin-top: 16px; max-width: 920px; padding: 20px 22px; }
.co-create h3 { margin-bottom: 14px; }
.co-create-form {
  grid-template-columns: minmax(200px, 280px) minmax(240px, 1fr) auto;
  gap: 16px 18px;
  align-items: end;
}
.co-create-form input, .co-create-form textarea { background: #fff; padding: 10px 12px; }
.co-create-form button { min-width: 148px; padding: 10px 16px; }

.co-workspace { margin-top: 16px; }
.co-stack { display: grid; gap: 14px; }
.co-block h3 { margin-bottom: 14px; }
.co-identity { display: grid; gap: 14px; }
.co-identity input, .co-identity textarea, .co-login-form input, .co-login-form select, .co-logo input {
  background: #fff; padding: 10px 12px;
}
.co-address textarea { min-height: 84px; }
.co-save-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 2px; }
.co-empty {
  margin: 0; color: var(--muted); background: var(--surface-2); border: 1px dashed var(--rule-strong); border-radius: 4px; padding: 12px 14px;
}
.co-people { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.co-people li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--rule); border-radius: 4px;
}
.co-who { display: grid; gap: 2px; min-width: 0; }
.co-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co-login-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; margin-top: 14px; }
.co-login-form button { grid-column: 1 / -1; justify-self: start; }
.co-logo { margin-top: 0; align-items: center; }

.co-modules > h3 { margin-bottom: 4px; }
.co-modules .mod-group h4 {
  margin: 18px 2px 8px; font-family: var(--f-head); font-size: .8rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.co-modules .mod-row {
  align-items: center; padding: 12px 14px; border-radius: 4px; background: #fff;
  border: 1px solid var(--rule); box-shadow: var(--shadow); cursor: pointer;
}
.co-modules .mod-row:hover { border-color: var(--rule-strong); }
.co-modules .mod-row:has(input:checked) { border-color: var(--ink); background: var(--mark-soft); box-shadow: inset 4px 0 0 var(--mark); }
.co-modules .mod-row > span { min-width: 0; }
.co-modules .mod-row b { font-size: .95rem; }
.co-modules .mod-row .small { line-height: 1.35; }
.co-modules .mod-row input[type="checkbox"] {
  appearance: none; width: 44px; height: 24px; margin: 0; padding: 0; border: 1px solid var(--rule-strong); border-radius: 3px;
  background: #D9DCD6; position: relative; cursor: pointer; flex: none;
}
.co-modules .mod-row input[type="checkbox"]::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 2px;
  background: #fff; box-shadow: 0 1px 2px rgba(29, 33, 37, .3); transition: transform .15s ease;
}
.co-modules .mod-row input[type="checkbox"]:checked { background: var(--ink); border-color: var(--ink); }
.co-modules .mod-row input[type="checkbox"]:checked::after { transform: translateX(20px); background: var(--mark); }
.co-modules .mod-row input[type="checkbox"]:focus { box-shadow: none; }
.co-modules .mod-row input[type="checkbox"]:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; }
.co-modules .mod-row input[type="checkbox"]:disabled { cursor: wait; }

@media (max-width: 1100px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .co-create-form { grid-template-columns: 1fr 1fr; }
  .co-create-form button { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 760px) {
  .floor { grid-template-columns: 1fr; }
  .plate .band small { flex: 1 0 100%; margin-left: 0; text-align: left; }
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-cols { grid-template-columns: 1fr; }
  .shell { grid-template-columns: 1fr; }
  body:has(.demo-banner) .shell { min-height: 0; }
  .rail { flex-direction: row; flex-wrap: wrap; padding: 0 10px 10px; align-items: center; gap: 8px; position: static; height: auto; overflow: visible; }
  .page-head .grow { flex: 1 0 100%; }
  .rail::before { flex: 1 0 100%; margin: 0 -10px 4px; height: 5px; }
  .brand { padding: 0 6px; border-bottom: none; margin-bottom: 0; }
  .rail nav { display: grid; gap: 8px; flex: 1 0 100%; order: 3; }
  .nav-mod { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
  .nav-k { flex: 1 0 100%; margin: 4px 8px 0; }
  .rail nav a { border-left: none; border-radius: 3px; padding: 7px 10px; }
  .rail nav a[aria-current="page"] { border-left-color: transparent; box-shadow: inset 0 -3px 0 var(--mark); }
  .rail .who { margin: 0 0 0 auto; border: none; padding: 0; }
  .rail .who button { width: auto; margin-top: 0; }
  .who-role { display: none; }
  main { padding: 16px; }
  h1 { font-size: 1.5rem; }
  .co-page .page-head { align-items: flex-start; }
  .co-directory { grid-template-columns: 1fr; }
  .co-create { padding: 16px; }
  .co-create-form { grid-template-columns: 1fr; }
  .co-create-form button { justify-self: start; }
  .co-login-form { grid-template-columns: 1fr; }
  .co-logo { align-items: flex-start; }
  .seg-detail { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print {
  .rail, .demo-banner, .export-actions, .toast { display: none !important; }
  .shell { grid-template-columns: 1fr; }
  body { background: #fff; }
  .panel, .figure, .plate { box-shadow: none; break-inside: avoid; }
}

/* ---------- premium industrial layer: navy rail, soft cards, icon tiles ---------- */
:root {
  --bg: #F2F4F7;
  --surface-2: #F6F8FA;
  --ink: #142033;
  --muted: #5F6B7A;
  --rule: #E3E7EC;
  --rule-strong: #CDD3DB;
  --accent: #142033;
  --navy: #0E1A2B;
  --navy-2: #13233A;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(14, 26, 43, .05), 0 8px 24px rgba(14, 26, 43, .06);
  --pos-tint: #E7F6EE; --neg-tint: #FDF0E8; --unk-tint: #EEF1F4; --mark-tint: #FFF6D6; --danger-tint: #FDECEC; --info: #4C5BD4; --info-tint: #ECEEFC;
}
button:hover, .btn:hover { background: #22324A; }

/* rail: deep navy with a faint factory skyline */
.rail {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 200'%3E%3Cpath fill='%23ffffff' fill-opacity='.05' d='M0 200V120h18V92h8v28h20V70h10v50h14V104h22v-22h6v22h16V60h12v60h10V96h26v24h12V80l14-10 14 10v40h14V88h10v32h14V100h20v100z'/%3E%3Cpath fill='%23ffffff' fill-opacity='.035' d='M0 200v-40h30v-20h24v20h40v-30h18v30h36v-24h30v24h62v40z'/%3E%3C/svg%3E") bottom / 100% auto no-repeat,
    linear-gradient(180deg, var(--navy-2), var(--navy));
}
.rail::before { height: 4px; }
.brand { border-bottom-color: rgba(255, 255, 255, .07); }
.brand .mark { border-radius: 8px; box-shadow: inset 0 0 0 3px var(--navy-2), 0 0 0 2px var(--mark); }
.rail nav a { border-radius: 8px; border-left: none; margin: 0 2px; }
.rail nav a[aria-current="page"] {
  background: linear-gradient(90deg, rgba(245, 180, 0, .2), rgba(245, 180, 0, .06)); color: #fff;
  box-shadow: inset 3px 0 0 var(--mark);
}
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #E5484D; color: #fff; font: 700 .72rem/20px var(--f-head); text-align: center; }
.rail .who { display: grid; grid-template-columns: 36px 1fr; gap: 0 10px; align-items: center; }
.rail .who::before { content: ""; grid-row: span 2; width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23C9D2DC' stroke-width='1.8'%3E%3Ccircle cx='12' cy='9' r='3.5'/%3E%3Cpath d='M5 19c1.5-3 4-4.5 7-4.5s5.5 1.5 7 4.5'/%3E%3C/svg%3E") center / 22px no-repeat; }
.rail .who button { grid-column: 1 / -1; }

/* page head */
main { padding: 24px 28px 44px; }
.page-head { border-bottom: none; padding-bottom: 0; margin-bottom: 22px; align-items: center; }
.page-head h1 { text-transform: none; font-size: 2rem; letter-spacing: 0; }
.page-head h1::before { width: 5px; height: 1.05em; vertical-align: -0.15em; border-radius: 2px; }
.page-kicker { font-family: var(--f-head); font-weight: 600; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 2px 0 0 15px; }
.page-head p { margin-left: 15px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px; font: 600 .9rem var(--f-head); background: var(--pos-tint); color: var(--pos); }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px rgba(27, 127, 75, .15); }
.pill.warn { background: var(--danger-tint); color: var(--danger); }

/* cards */
.panel { border: 1px solid var(--rule); border-top: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.panel h2, .panel h3 { display: flex; align-items: center; gap: 10px; text-transform: none; letter-spacing: .01em; font-size: 1.15rem; }
.h-ico { width: 22px; height: 22px; color: var(--ink); flex: none; }
.h-ico svg, .kpi-ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
th { background: transparent; border-top: none; }
tbody tr:nth-child(even) td { background: transparent; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { display: grid; grid-template-columns: 52px 1fr; gap: 0 14px; align-items: start; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
a.kpi { color: inherit; text-decoration: none; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
a.kpi:hover { border-color: var(--rule-strong); box-shadow: 0 2px 4px rgba(14, 26, 43, .06), 0 14px 32px rgba(14, 26, 43, .1); transform: translateY(-2px); }
a.kpi:hover .k { text-decoration: underline; text-underline-offset: 3px; }
a.kpi:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; }
.kpi-ico { grid-row: span 3; width: 52px; height: 52px; padding: 13px; border-radius: 12px; background: var(--info-tint); color: var(--info); }
.kpi.pos .kpi-ico { background: var(--pos-tint); color: var(--pos); }
.kpi.neg .kpi-ico { background: var(--neg-tint); color: var(--neg); }
.kpi.bad .kpi-ico { background: var(--danger-tint); color: var(--danger); }
.kpi.cam .kpi-ico { background: #F1ECFC; color: #7A4FD6; }
.kpi .k { font: 600 .95rem var(--f-head); color: var(--ink); }
.kpi .v { font: 700 2.1rem/1.1 var(--f-head); margin-top: 2px; }
.kpi.bad .v { color: var(--danger); }
.kpi .s { font-size: .84rem; color: var(--muted); }

/* dashboard windows */
.dash-cols article { background: var(--surface-2); border: 1px solid var(--rule); border-radius: 10px; padding: 14px; }
.dash-cols .k { color: var(--ink); }

/* live floor */
.shop-tabs button[aria-selected="true"] { color: var(--ink); }
.floor-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; gap: 14px; }
.floor-card h2 { display: flex; align-items: center; gap: 10px; text-transform: none; letter-spacing: .01em; font-size: 1.1rem; }
.viewer { margin: 0; border-radius: 10px; border: none; box-shadow: none; background: #0B121C; }
.osd { position: absolute; inset: 0; pointer-events: none; line-height: 1.2; font-family: var(--f-head); font-weight: 600; color: #fff; }
.osd > * { position: absolute; padding: 4px 9px; border-radius: 6px; background: rgba(8, 14, 22, .72); font-size: .82rem; letter-spacing: .04em; }
.osd-live { top: 12px; left: 12px; }
.osd-live::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: #E5484D; }
.osd-live.off::before { background: #8A94A0; }
.osd-name { bottom: 12px; left: 12px; }
.osd-count { bottom: 12px; right: 12px; background: rgba(27, 127, 75, .9); }
.cam-meta { border-left: none; border-radius: 10px; background: var(--surface-2); }
.plates { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.plate { border-radius: 10px; border: 1px solid var(--rule); border-left: 5px solid var(--unk); }
.plate.pos { border-left-color: var(--pos); }
.plate.neg { border-left-color: var(--neg); }
.plate .band { background: transparent !important; color: var(--unk); font-size: .95rem; padding: 12px 14px 0; }
.plate.pos .band { color: var(--pos); }
.plate.neg .band { color: var(--neg); }
.plate .band::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 50%; background: currentColor; }
.plate .band small { color: var(--muted); }
.plate .body { padding: 6px 14px 14px; }
.plate .name { color: var(--ink); text-transform: none; letter-spacing: .01em; font-size: 1.1rem; }
.plate .elapsed { font-size: 2.1rem; }

/* alerts as cards */
.alert-list { display: grid; gap: 10px; }
.alert-card { display: grid; grid-template-columns: 40px 1fr auto; gap: 4px 14px; align-items: start; padding: 14px 16px; border-radius: 10px; border: 1px solid var(--rule); background: var(--surface-2); }
.alert-card .a-ico { grid-row: span 3; width: 40px; height: 40px; padding: 9px; border-radius: 50%; background: var(--unk); color: #fff; }
.alert-card .a-ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.alert-card.open { background: var(--danger-tint); border-color: rgba(198, 40, 40, .25); }
.alert-card.open .a-ico { background: var(--danger); }
.alert-card.acknowledged { background: var(--mark-tint); border-color: rgba(245, 180, 0, .4); }
.alert-card.acknowledged .a-ico { background: #E09A00; }
.alert-card.resolved .a-ico { background: var(--pos); }
.alert-card .a-title { font: 700 1.02rem var(--f-head); }
.alert-card.open .a-title { color: var(--danger); }
.alert-card .a-meta { font-size: .84rem; color: var(--muted); }
.alert-card .a-title, .alert-card .a-meta { grid-column: 2; }
.alert-card .a-side { grid-column: 3; grid-row: 1 / span 3; display: grid; justify-items: end; gap: 8px; }
.alert-card img { max-width: 180px; margin-top: 6px; border-radius: 8px; }
@media (max-width: 760px) {
  .rail { background: linear-gradient(180deg, var(--navy-2), var(--navy)); }
  .rail .who { display: flex; }
  .rail .who::before { display: none; }
  .page-kicker, .page-head p { margin-left: 0; }
  .alert-card { grid-template-columns: 40px 1fr; }
  .alert-card .a-side { grid-row: auto; grid-column: 2; justify-items: start; }
}
