/* css/pages/system.css: the System section's pages (pages/system/*.js; setup.php loads it too); the narrower screens'
   rules are in css/mobile.css */

/* Cameras: the list; a camera's page (its tabs beside the live still); its zone editor */
tr.off td { opacity: .55; }
.cam-head, .cam-layout { max-width: 1456px; }
.cam-head { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s2); }
.cam-head h2 { margin: 0; font-size: var(--fs-lg); }
.cam-layout { display: grid; grid-template-columns: minmax(440px, 1fr) minmax(280px, 560px); gap: var(--s4); align-items: start; }   /* the tabs whole (429 px) down to the one-column fold; .cam-head's 1456 px caps it at 880 */
.cam-main > .seg { margin-bottom: var(--s3); }
.cam-main form > .kit-card + .kit-card { margin-top: 0; }
.cam-side { display: grid; gap: var(--s2); justify-items: start; }
.cam-still { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: var(--panel-2); border-radius: var(--radius-sm); }
.cam-h4 { margin: var(--s4) 0 var(--s1); font-size: var(--fs-sm); }
.cam-h4 .muted { font-weight: normal; }
.cam-enc { border-top: 1px solid var(--line); padding-top: var(--s2); margin-top: var(--s2); }
.cam-enc p { margin: 0 0 var(--s1); }
.enc-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.cam-refs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.cam-ref img { display: block; width: 100%; max-width: 320px; border-radius: var(--radius-sm); }
.cam-ref .cam-h4 { margin-top: 0; }
.cam-new { max-width: 880px; }

.zv-bar { margin-top: 0; }
.zv-title { margin: 0; font-size: var(--fs-lg); }
.zv-title .muted { font-weight: normal; }
.zv-zoom { display: inline-flex; align-items: center; gap: var(--s1); }
.zv-layout { display: grid; grid-template-columns: minmax(0, 1280px) minmax(300px, 380px); gap: var(--s4); align-items: start; }
.zv-stagewrap { position: relative; width: max-content; max-width: 100%; }
.zv-stage { max-width: 100%; max-height: calc(100vh - 220px); overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel-2); touch-action: pan-x pan-y; }
.zv-canvas { position: relative; width: 100%; aspect-ratio: 16 / 9; user-select: none; }
.zv-canvas img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; display: block; }
.zv-grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--cols), 1fr); grid-template-rows: repeat(var(--rows), 1fr);
  touch-action: none; }
.zv-grid i { border: 1px solid transparent; }
.zv-grid.lines i { border-color: var(--zone-grid); cursor: crosshair; }
/* a layer per zone (cameras-zones.js paintCells): --z its fill (striped where zones overlap), --zl its edge colour */
.zv-grid i[style] { background: var(--z); }
.zv-grid i.on { border-color: var(--zl); box-shadow: inset 0 0 0 1px var(--zl); }
/* the navigator: the whole picture, small and see-through, in the corner of the zoomed view; its box is what is in view */
.zv-nav { position: absolute; right: 10px; bottom: 10px; width: 200px; aspect-ratio: var(--ar, 16 / 9); z-index: 2;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--black); opacity: .8; cursor: pointer;
  overflow: hidden; touch-action: none; }
.zv-nav:hover { opacity: 1; }
.zv-nav img { display: block; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.zv-nav-box { position: absolute; border: 2px solid var(--accent); background: var(--region-fill); pointer-events: none; }
.zv-row { display: flex; gap: var(--s1); align-items: stretch; }
.zv-row .zv-zone { flex: 1 1 auto; min-width: 0; }
.zv-eye { flex: none; padding: 0 6px; }
.zv-eye[aria-pressed="false"] { color: var(--faint); }
.zv-swatch { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; border-radius: 2px;
  background: var(--z); border: 1px solid var(--zl); }
.zv-poly { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.zv-poly.active { pointer-events: auto; cursor: crosshair; touch-action: none; }
.zv-poly polygon { fill: var(--zone-fill); stroke: var(--ok-fg); stroke-width: 3; vector-effect: non-scaling-stroke; }
.zv-poly polyline { fill: none; stroke: var(--zone-draw); stroke-width: 3; stroke-dasharray: 8 6; vector-effect: non-scaling-stroke; }
.zv-poly circle { fill: var(--ok-fg); stroke: var(--on-accent); stroke-width: 2; vector-effect: non-scaling-stroke; cursor: grab; }
.zv-poly circle.cur { fill: var(--zone-draw); cursor: crosshair; }
.zv-side { display: grid; gap: var(--s3); }
.zv-side > .kit-card + .kit-card { margin-top: 0; }
.zv-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.zv-zone { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); width: 100%; padding: 6px 8px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); color: var(--text); font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.zv-zone.sel { border-color: var(--accent); }
.zv-zone:hover, .zv-zone:focus-visible { border-color: var(--accent); outline: none; }

/* Settings: the sub-nav beside the section showing; a row across the top on a narrow screen. A section fills the rest,
   each with its own scroll (kit-split / kit-main). */
.sys-frame { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--subnav-w) minmax(0, 1fr); }
.subnav { display: flex; flex-direction: column; gap: 2px; padding: var(--s3) var(--s2); border-right: 1px solid var(--line); overflow-y: auto; }
.subnav a { padding: 6px 10px; border-radius: var(--radius-sm); color: var(--muted); text-decoration: none; font-size: var(--fs-md); white-space: nowrap; }
.subnav a:hover { color: var(--text); background: var(--panel-2); }
.subnav a[aria-current] { color: var(--text); background: var(--panel-2); box-shadow: inset 2px 0 0 var(--accent); }
.sys-body, .sys-section { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.sys-body { overflow: hidden; }
.sys-section { flex: 1; }
.sec-head { margin-top: 0; }
.sec-head h2 { margin: 0; font-size: var(--fs-lg); }
.usr-role { margin: calc(-1 * var(--s1)) 0 var(--s2); }

/* Your account: its cards in a column (two side by side on a wide screen) */
.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr)); gap: var(--s4); align-items: start; max-width: 1200px; }
.acc-grid > .kit-card + .kit-card { margin-top: 0; }

/* Site & playback, Recorder, Detection: form blocks in one column (≤ 880), each with its own Save and "unsaved" mark */
.set-blocks { max-width: 880px; }
.set-block .field { margin-bottom: var(--s2); }
.set-block [data-unsaved]:empty { display: none; }
.set-block .kv { margin: var(--s2) 0; }
.set-block .dt { margin-bottom: var(--s2); }
.rec-login { border-top: 1px solid var(--line); padding-top: var(--s3); margin-top: var(--s3); }
.rec-login .kit-card-head h4 { margin: 0; font-size: var(--fs-base); }
.det-zones-head { margin: var(--s5) 0 var(--s1); font-size: var(--fs-md); max-width: 880px; }

/* Alerts, Email & push, Sensors: two tables and a side pane each (the pane's forms in fieldsets); long addresses wrap */
.set-head { margin: var(--s5) 0 var(--s1); font-size: var(--fs-md); }
.sec-head + .about + .set-head, .sec-head + .set-head { margin-top: var(--s3); }
.alr-where { overflow-wrap: anywhere; min-width: 0; }
.alr-form .field { margin-bottom: var(--s2); }
.alr-set { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s2) var(--s3) var(--s1); margin: 0 0 var(--s3); min-width: 0; }
.alr-set legend { padding: 0 var(--s1); color: var(--muted); font-size: var(--fs-sm); }
.alr-chans { display: grid; gap: var(--s1); margin-bottom: var(--s2); }
.sen-token .field input { font-family: var(--font-mono); }
.sen-curl { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-mono); font-size: var(--fs-sm); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--s2) var(--s3); }

/* Backups, Server, Activity log */
.bak-key { width: 100%; font-family: var(--font-mono); font-size: var(--fs-xs); background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s2); }
.srv-caps td:nth-child(2) { white-space: nowrap; }
.act-bar { flex-wrap: wrap; gap: var(--s2); }
.act-bar input[type="search"] { flex: 1 1 260px; min-width: 0; }
.act-scroll { overflow-x: auto; max-width: 100%; }
.act-table .act-row { cursor: pointer; }
.act-table td:last-child { overflow-wrap: anywhere; }
.act-table .act-when { white-space: nowrap; font-variant-numeric: tabular-nums; }
.act-table .lv-warn td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.act-table .lv-error td:first-child { box-shadow: inset 3px 0 0 var(--err); }
.act-detail td { background: var(--panel-2); }
.act-facts { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); font-size: var(--fs-sm); color: var(--muted); }
.act-detail pre { margin: var(--s2) 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-mono); font-size: var(--fs-xs); }
.act-keep { margin-top: var(--s5); max-width: 880px; }

/* The box's own hardware (server-sections.js): in Settings › Server and Backups, and on setup.php */
.srv-disk { border: 1px solid var(--line); background: var(--panel-2); border-radius: var(--radius); padding: var(--s2) var(--s3); margin: var(--s2) 0; }
.srv-disk-name { font-weight: 600; overflow-wrap: anywhere; }
.srv-disk-name .badge { margin-left: var(--s1); }
.srv-radios { display: flex; flex-wrap: wrap; gap: var(--s4); margin: var(--s2) 0; }
.srv-radios input[type="radio"] { width: 18px; height: 18px; flex: none; }
.srv-steps { padding-left: 20px; margin: var(--s2) 0; font-size: var(--fs-sm); color: var(--muted); }
.srv-steps li { margin: var(--s1) 0; }
.srv-sub { margin: var(--s4) 0 var(--s1); font-size: var(--fs-base); }
.srv-tune [data-unsaved]:empty { display: none; }
#srvAbout + .kit-card, .set-blocks + .set-blocks { margin-top: var(--s4); }
.srv-manual { border: 0; padding: 0; margin: 0; min-width: 0; }

/* Settings › Backups › Backup files (pages/system/backups-files.js): one block per backup group */
.bk-group { margin-top: var(--s3); padding-top: var(--s2); border-top: 1px solid var(--line); }
.bk-group .kit-card-head h4 { margin: 0; }
.bk-files { list-style: none; margin: 0; padding: 0; }
.bk-file { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--s2); padding: 6px 0; border-top: 1px solid var(--line); }
.bk-file:first-child { border-top: 0; }
.bk-file-what { flex: 1 1 14em; min-width: 0; }
.bk-file-acts { display: flex; flex-wrap: wrap; gap: 4px; }

/* Remote access (server-sections.js mountRemote): the state, its actions, the sign-in link with its QR code */
.rm-box { margin: var(--s2) 0; }
.rm-head { margin: 0 0 var(--s1); display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.rm-next { margin: var(--s1) 0; padding-left: 20px; }
.rm-acts { flex-wrap: wrap; }
.rm-key { margin-top: var(--s2); max-width: 36em; }
.rm-signin { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: flex-start; margin: var(--s2) 0; }
.rm-signin > div { flex: 1 1 14em; min-width: 0; overflow-wrap: anywhere; }
.rm-qr { width: 160px; height: 160px; image-rendering: pixelated; background: var(--white); padding: 8px; border-radius: var(--radius-sm); }
.rm-err, .rm-box .fine { overflow-wrap: anywhere; }
.rm-other { margin-top: var(--s3); }
.rm-other > summary { cursor: pointer; color: var(--muted); }

/* Settings › Users: a sign-in code, shown once (big, to read aloud); the desk PCs. */
.usr-code { font-size: 32px; font-weight: 700; letter-spacing: 3px; font-variant-numeric: tabular-nums; text-align: center; margin: 6px 0 12px; }
.usr-desk-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.usr-desk-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* Settings › Initial settings (start.js): the steps across the top, one step's card below. */
.wiz-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 12px; padding: 0; }
.wiz-steps button { color: var(--muted); text-decoration: none; }
.wiz-steps li[aria-current="step"] button { color: var(--text); font-weight: 600; }
.wiz-steps li.done button { color: var(--ok-fg); }
.wiz-n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); font-size: 12px; margin-right: 4px; }
.wiz-steps li[aria-current="step"] .wiz-n { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.wiz-step h4 { margin: 14px 0 6px; font-size: 14px; }
.wiz-nav .spacer { flex: 1; }
.wiz-found td input[type="text"] { width: 100%; min-width: 120px; }
.wiz-added { margin: 8px 0; padding-left: 18px; }
.wiz-sum th { text-align: left; width: 40%; font-weight: 500; color: var(--muted); }
.subnav a.due::after { content: " •"; color: var(--warn-fg); }
