/* EzyMonitor — mobile-first, native-style UI (iOS look, works on Android). */
:root {
  --bg: #f2f2f7; --bg2: #ffffff; --bg3: #f2f2f7; --fill: rgba(120,120,128,.12); --fill2: rgba(120,120,128,.2);
  --label: #000; --label2: rgba(60,60,67,.6); --label3: rgba(60,60,67,.3); --sep: rgba(60,60,67,.18);
  --tint: #007aff; --green: #34c759; --orange: #ff9500; --blue: #007aff; --red: #ff3b30; --gray: #8e8e93; --gray2: #aeaeb2;
  --active: var(--green); --idle: var(--orange); --away: var(--blue); --absent: var(--red); --off_shift: #c7c7cc; --unknown: #636366;
  --running: var(--green); --stopped: var(--red);
  --ok: var(--green); --warn: var(--orange); --critical: var(--red);
  --bar-bg: rgba(249,249,249,.86); --radius: 12px; --tabbar-h: 50px;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
/* Dark: when the system is dark and this device was not set to light, or when this device was set to dark
   (data-theme on <html>, see theme.js). The same values twice: CSS has no way to say "either of these". */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000; --bg2: #1c1c1e; --bg3: #2c2c2e; --fill: rgba(118,118,128,.24); --fill2: rgba(118,118,128,.32);
    --label: #fff; --label2: rgba(235,235,245,.6); --label3: rgba(235,235,245,.3); --sep: rgba(84,84,88,.65);
    --tint: #0a84ff; --green: #30d158; --orange: #ff9f0a; --blue: #0a84ff; --red: #ff453a; --gray: #8e8e93;
    --off_shift: #48484a; --unknown: #8e8e93; --bar-bg: rgba(22,22,24,.86); --seg-on: #636366;
  }
}
:root[data-theme="dark"] {
  --bg: #000; --bg2: #1c1c1e; --bg3: #2c2c2e; --fill: rgba(118,118,128,.24); --fill2: rgba(118,118,128,.32);
  --label: #fff; --label2: rgba(235,235,245,.6); --label3: rgba(235,235,245,.3); --sep: rgba(84,84,88,.65);
  --tint: #0a84ff; --green: #30d158; --orange: #ff9f0a; --blue: #0a84ff; --red: #ff453a; --gray: #8e8e93;
  --off_shift: #48484a; --unknown: #8e8e93; --bar-bg: rgba(22,22,24,.86); --seg-on: #636366;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--label); font: 17px/1.3 var(--font); -webkit-font-smoothing: antialiased; }
body { overscroll-behavior-y: none; }
button, input, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: var(--tint); text-decoration: none; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- layout ---------- */
#app { min-height: 100%; }
.page { min-height: 100vh; padding: calc(var(--safe-top) + 44px) 0 calc(var(--tabbar-h) + var(--safe-bottom) + 24px); }
/* --pad = side gutter; grids below size themselves from .content's width (container queries), not the window's */
.content { --pad: 16px; max-width: 760px; margin: 0 auto; padding: 0 var(--pad); container-type: inline-size; container-name: content; }
.content.wide { max-width: 1100px; }

/* nav bar with collapsing large title */
.navbar { position: fixed; top: 0; left: 0; right: 0; z-index: 20; padding-top: var(--safe-top); height: calc(44px + var(--safe-top));
  display: flex; align-items: center; justify-content: space-between; padding-left: 8px; padding-right: 8px;
  background: transparent; transition: background .2s, border-color .2s; border-bottom: .5px solid transparent; }
.navbar.solid { background: var(--bar-bg); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom-color: var(--sep); }
.navbar .title { position: absolute; left: 50%; transform: translateX(-50%); font-weight: 600; font-size: 17px; opacity: 0; transition: opacity .2s; white-space: nowrap; max-width: 60%; overflow: hidden; text-overflow: ellipsis; }
.navbar.solid .title, .navbar.always .title { opacity: 1; }
.nav-btn { display: inline-flex; align-items: center; gap: 2px; color: var(--tint); font-size: 17px; min-height: 44px; min-width: 44px; padding: 0 8px; }
.nav-btn svg { width: 22px; height: 22px; }
.nav-right { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.large-title { font-size: 34px; font-weight: 700; letter-spacing: .37px; margin: 4px 0 2px; line-height: 1.15; }
.subtitle { color: var(--label2); font-size: 15px; margin-bottom: 14px; }
.badge-dot { position: relative; }
.badge-dot[data-count]:not([data-count="0"])::after { content: attr(data-count); position: absolute; top: 6px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--red); color: #fff; font-size: 12px; font-weight: 600; line-height: 18px; text-align: center; }

/* tab bar (bottom on phones, sidebar on wide screens) */
.tabbar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: calc(var(--tabbar-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  display: flex; background: var(--bar-bg); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-top: .5px solid var(--sep); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--gray); font-size: 10px; font-weight: 500; position: relative; }
.tab svg { width: 26px; height: 26px; }
.tab.on { color: var(--tint); }
.tab .tab-badge { position: absolute; top: 3px; left: calc(50% + 6px); min-width: 17px; height: 17px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; line-height: 17px; padding: 0 4px; text-align: center; }
.brand { display: none; }

@media (min-width: 900px) {
  :root { --tabbar-h: 0px; }
  .tabbar { top: 0; right: auto; width: 240px; height: 100%; flex-direction: column; justify-content: flex-start; padding: 16px 12px; gap: 2px; border-top: 0; border-right: .5px solid var(--sep); }
  .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; padding: 8px 10px 18px; }
  .brand img { width: 32px; height: 32px; border-radius: 8px; }
  .tab { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 15px; padding: 9px 12px; border-radius: 10px; color: var(--label); }
  .tab svg { width: 22px; height: 22px; color: var(--tint); }
  .tab.on { background: var(--tint); color: #fff; }
  .tab.on svg { color: #fff; }
  .tab .tab-badge { position: static; margin-left: auto; }
  .page, .navbar { margin-left: 240px; }
  .navbar { left: 240px; margin-left: 0; }
}

/* ---------- grouped lists ---------- */
.section { margin: 22px 0 0; }
.section-h { display: flex; justify-content: space-between; align-items: baseline; padding: 0 16px 7px; color: var(--label2); font-size: 13px; text-transform: uppercase; letter-spacing: -.08px; }
.section-h a, .section-h button { text-transform: none; font-size: 15px; line-height: 1; color: var(--tint); }
.section-f { padding: 7px 16px 0; color: var(--label2); font-size: 13px; }
.list { background: var(--bg2); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 16px; position: relative; width: 100%; text-align: left; }
.row + .row::before { content: ""; position: absolute; top: 0; right: 0; left: var(--inset, 16px); border-top: .5px solid var(--sep); }
.row.icon-row { --inset: 60px; }
.row.avatar-row { --inset: 68px; }
button.row:active, a.row:active { background: var(--fill); }
.row .main { flex: 1; min-width: 0; }
.row .t { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--label); }
.row .s { font-size: 13px; color: var(--label2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .v { color: var(--label2); font-size: 17px; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.chev { width: 8px; height: 13px; color: var(--label3); flex: none; }
.row-icon { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; color: #fff; flex: none; }
.row-icon svg { width: 19px; height: 19px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 15px; color: #fff; flex: none; position: relative; }
.avatar.lg { width: 72px; height: 72px; font-size: 28px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; color: #fff; }
.pill.soft { color: var(--label); background: var(--fill); font-weight: 500; }
.destructive { color: var(--red) !important; }
.tinted { color: var(--tint) !important; }

/* ---------- cards / tiles ---------- */
.card { background: var(--bg2); border-radius: var(--radius); padding: 16px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@container (min-width: 720px) { .tiles { grid-template-columns: repeat(6, 1fr); } }
.tile { background: var(--bg2); border-radius: var(--radius); padding: 12px; text-align: left; display: flex; flex-direction: column; gap: 6px; min-height: 84px; }
.tile .n { font-size: 28px; font-weight: 700; line-height: 1; }
.tile .l { font-size: 13px; color: var(--label2); font-weight: 500; display: flex; align-items: center; gap: 6px; white-space: nowrap; min-width: 0; }
button.tile:active { transform: scale(.97); }
.stack { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--fill); }
.stack i { display: block; height: 100%; }
.big-stat { display: flex; align-items: baseline; gap: 8px; }
.big-stat b { font-size: 44px; font-weight: 700; letter-spacing: -.5px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--label2); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.banner { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--bg2); }
.banner .row-icon { width: 36px; height: 36px; border-radius: 50%; }
.grid2 { display: grid; gap: 0 22px; }
@container (min-width: 760px) { .grid2 { grid-template-columns: 1fr 1fr; align-items: start; } }

/* ---------- camera views ---------- */
.cam { position: relative; background: #111; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; }
/* fill: the box takes the picture's real shape (shapeOf in app.js), and a still the recorder squeezed is stretched back to it */
.cam img { width: 100%; height: 100%; object-fit: fill; display: block; background: #111; }
.cam svg.ov { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cam .cam-tag { position: absolute; left: 8px; top: 8px; display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 6px;
  background: rgba(0,0,0,.55); color: #fff; font-size: 12px; font-weight: 600; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
/* While a camera connects: a light sweeping across the dark tile (the same shimmer as the loading placeholders). */
.cam.busy::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(100deg, transparent 35%, rgba(255, 255, 255, .09) 50%, transparent 65%) 0 0 / 200% 100%; animation: sk 1.3s linear infinite; }
@media (prefers-reduced-motion: reduce) { .cam.busy::after { animation-duration: 6s; } }
.cam .cam-states { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; max-width: 60%; }
.cam .cam-states span { padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cams.dense .cam .cam-states { right: 4px; top: 4px; }
.cams.dense .cam .cam-states span { padding: 1px 5px; font-size: 9px; }
.cam .cam-tag.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: pulse 1.6s infinite; }
.cam video { width: 100%; height: 100%; object-fit: contain; display: block; background: #111; }
.cam img[hidden], .cam video[hidden] { display: none; }
/* video wall: the Cameras grid in full screen, names over the video, no chrome */
.cams:fullscreen { background: #000; padding: 6px; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 32vw), 1fr)); align-content: center; overflow: auto; }
.cams:fullscreen .cam-card { position: relative; border-radius: 6px; background: #000; }
.cams:fullscreen .cam-card .meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 10px; background: linear-gradient(transparent, rgba(0,0,0,.7)); color: #fff; }
.cams:fullscreen .cam-card .meta .small, .cams:fullscreen .chips { display: none; }
.cam .cam-msg { position: absolute; inset: 0; display: grid; place-items: center; color: #aaa; font-size: 15px; text-align: center; padding: 16px; }
@keyframes pulse { 50% { opacity: .3; } }
.cams { display: grid; gap: 16px; }
@container (min-width: 560px) { .cams { grid-template-columns: 1fr 1fr; } }
@container (min-width: 1200px) { .cams { grid-template-columns: repeat(3, 1fr); } }
.cam-card { background: var(--bg2); border-radius: var(--radius); overflow: hidden; text-align: left; width: 100%; }
.cam-card .cam { border-radius: 0; }
.cam-card .meta { padding: 10px 14px 12px; }
/* The chosen width is a maximum: a tile never gets narrower than 150px, so "4 wide" becomes 2 on a phone. */
.cams.fixed { grid-template-columns: repeat(auto-fill, minmax(min(100%, max(150px, calc((100% - (var(--cols) - 1) * 16px) / var(--cols) - .1px))), 1fr)); }
.cam-card { container-type: inline-size; }
.cam-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 3ch; }
.cam-stat { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 9999 auto; min-width: 0; }
.cam .cam-tag { max-width: calc(100% - 16px); white-space: nowrap; overflow: hidden; }
.chip { white-space: nowrap; }
@container (max-width: 250px) {   /* small tiles: picture and name only */
  .cam-card .meta { padding: 6px 8px 8px; font-size: 13px; }
  .cam-card .cam-stat, .cam-card .chips { display: none; }
  .cam .cam-tag { left: 5px; top: 5px; padding: 2px 6px; font-size: 10px; gap: 4px; }
  .cam .cam-msg { font-size: 12px; padding: 6px; }
}
@container (max-width: 520px) { .cams { gap: 10px; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; background: var(--fill); font-size: 13px; }
/* swipe strip on narrow screens: bleeds to the screen edge, but cards snap to the gutter, not the edge */
.hscroll { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 0 var(--pad) 4px; margin: 0 calc(-1 * var(--pad));
  scroll-padding-inline: var(--pad); scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { flex: 0 0 82%; scroll-snap-align: start; }
@container (min-width: 520px) { .hscroll > * { flex-basis: calc(50% - 6px); } }
/* wide: a plain grid, no scrolling */
@container (min-width: 760px) { .hscroll { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; overflow: visible; margin: 0; padding: 0; } }
.fullscreen-cam:fullscreen { background: #000; display: grid; place-items: center; }
.fullscreen-cam:fullscreen .cam { width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; }
.fullscreen-cam:fullscreen .cam img { object-fit: contain; }

/* ---------- controls ---------- */
.seg { display: flex; background: var(--fill); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button { flex: 1; padding: 6px 8px; border-radius: 7px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.seg button.on { background: var(--seg-on, var(--bg2)); box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 3px 1px rgba(0,0,0,.04); font-weight: 600; }
.search { display: flex; align-items: center; gap: 6px; background: var(--fill); border-radius: 10px; padding: 0 8px; height: 36px; margin-bottom: 10px; }
.search svg { width: 16px; height: 16px; color: var(--label2); flex: none; }
.search input { flex: 1; border: 0; background: none; outline: none; font-size: 17px; min-width: 0; }
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 16px; background: var(--fill2); transition: background .25s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 3px 1px rgba(0,0,0,.06); transition: transform .25s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px; border-radius: 12px; background: var(--tint); color: #fff; font-weight: 600; font-size: 17px; }
.btn.gray { background: var(--fill); color: var(--tint); }
.btn:disabled { opacity: .5; }
.btn:active { opacity: .7; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 36px; height: 36px; border-radius: 50%; background: var(--fill); color: var(--tint); display: grid; place-items: center; }
.stepper button svg { width: 16px; height: 16px; }
.stepper .date { flex: 1; text-align: center; font-weight: 600; position: relative; }
.stepper input[type=date] { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.field { display: block; width: 100%; border: 0; outline: none; background: none; font-size: 17px; padding: 12px 16px; min-height: 44px; }
.field + .field { border-top: .5px solid var(--sep); }
/* a control at the right end of a list row (setup forms) */
.fin { flex: 0 1 58%; min-width: 0; min-height: 38px; padding: 8px 10px; border: 0; border-radius: 8px; background: var(--fill); font-size: 16px; }
.fin.sm { flex: 0 0 96px; text-align: center; text-align-last: center; }   /* short values sit in the middle of their box, so a column of them lines up */
.fin:focus-visible, .days button:focus-visible { outline: 2px solid var(--tint); outline-offset: 1px; }
.vrow { flex-wrap: wrap; row-gap: 6px; }
.vrow .main { flex: 1 0 100%; }
.vrow .fin { flex: 1 1 40%; }
.fin-x { flex: none; color: var(--red); font-size: 15px; padding: 6px 2px; }
.btn-row { display: flex; gap: 10px; margin-top: 12px; }
.cam-bar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
/* "All" layout: many small tiles, so tighter gaps and a tile may go below the usual minimum width */
.cams.dense { gap: 6px; grid-template-columns: repeat(auto-fill, minmax(min(100%, max(96px, calc((100% - (var(--cols) - 1) * 6px) / var(--cols) - .1px))), 1fr)); }
.cams.dense .cam-card { border-radius: 8px; }
.cams.dense .cam-card .meta { padding: 4px 6px 5px; font-size: 12px; }
.cams.dense .cam-card .cam-stat, .cams.dense .cam-card .chips { display: none; }
.cams.dense .cam .cam-tag { left: 4px; top: 4px; padding: 1px 5px; font-size: 9px; gap: 3px; }
.cams.dense .cam .cam-msg { font-size: 11px; padding: 4px; }
.cam-bar .seg { flex: 0 1 auto; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.cam-bar .seg button { flex: 0 0 auto; padding: 6px 12px; }
.stepper .date span { white-space: nowrap; }
.avatar.has-photo { padding: 2.5px; }
.avatar.has-photo img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar.xl { width: 112px; height: 112px; font-size: 40px; }
.em-photo { display: flex; align-items: center; justify-content: center; gap: 20px; margin: 12px 0 4px; }
.em-photo > div { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.em-pick { width: auto; min-width: 0; min-height: 44px; padding: 0 18px; cursor: pointer; }
.step-n { width: 26px; height: 26px; border-radius: 50%; background: var(--tint); color: #fff; font-size: 14px; font-weight: 600; display: grid; place-items: center; flex: none; align-self: flex-start; margin-top: 2px; }
.row .t.wrap { white-space: normal; overflow: visible; line-height: 1.35; }
.kbd { display: inline-grid; place-items: center; width: 26px; height: 26px; vertical-align: -7px; border-radius: 6px; background: var(--fill); color: var(--tint); }
.kbd svg { width: 17px; height: 17px; }
.install-b { margin-bottom: 14px; }
.ibtn { flex: none; padding: 7px 14px; border-radius: 999px; background: var(--tint); color: #fff; font-size: 15px; font-weight: 600; }
.ibtn.ghost { background: none; color: var(--label2); font-weight: 500; padding: 7px 4px; }
.login-install { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; color: var(--tint); font-size: 15px; }
.login-install svg { width: 18px; height: 18px; }
#login-install-how { text-align: left; }
details.more { margin-top: 18px; }
details.more > summary { list-style: none; cursor: pointer; color: var(--tint); font-size: 15px; padding: 6px 16px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: " ›"; }
details.more[open] > summary::after { content: " ⌄"; }
.row.tall .s { -webkit-line-clamp: 8; line-clamp: 8; }
/* A row's second line explains something: let it wrap (up to three lines) instead of ending in "…".
   Titles stay on one line, except in forms, where the label is the only way to know what the field is. */
.row .s { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; line-height: 1.3; }
label.row .t, .vrow .t { white-space: normal; overflow: visible; line-height: 1.25; }
/* "Edit", "See all", "New shift" in a section header: the text is small, the tap area must not be */
.section-h a, .section-h button { padding: 12px 0 12px 16px; margin: -12px 0; }
/* phones: five tabs (Overview, Desks, Attendance, Cameras, More); wide screens: the full sidebar, no More */
@media (max-width: 899px) { .tab[data-tab="machines"], .tab[data-tab="reports"], .tab[data-tab="settings"], .tab[data-tab="system"] { display: none; } }
.avatar svg { width: 22px; height: 22px; }
.desk-head .avatar svg { width: 28px; height: 28px; }
@media (min-width: 900px) { .tab[data-tab="more"] { display: none; } }
@media (min-width: 900px) { .tab[data-tab="settings"] { margin-top: 14px; } }
/* settings: the list of panes, then one pane; side by side once there is room */
.settings { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 32px; }
.set-nav { min-width: 0; }
.settings.has-pane .set-nav, .settings:not(.has-pane) .set-pane { display: none; }
.set-pane { max-width: 680px; min-width: 0; }
.set-pane .pane-title { display: none; }
@container (min-width: 820px) {
  .settings { grid-template-columns: 320px minmax(0, 1fr); align-items: start; }
  .settings.has-pane .set-nav, .settings:not(.has-pane) .set-pane { display: block; }
  .set-nav { position: sticky; top: calc(var(--safe-top) + 52px); }
  .set-nav .row.on { background: var(--fill); }
  .set-pane .pane-title { display: block; }   /* same size and line as "Settings" beside it */
}
.section-f a { color: var(--tint); }
.days { display: flex; flex-wrap: wrap; gap: 6px; }
.days button { flex: 1; min-width: 44px; min-height: 40px; border-radius: 9px; background: var(--bg2); font-size: 14px; font-weight: 500; }
.days button.on { background: var(--tint); color: #fff; }

/* ---------- timeline ---------- */
.tl { position: relative; height: 26px; border-radius: 6px; background: var(--fill); overflow: hidden; }
.tl i { position: absolute; top: 0; bottom: 0; }
.tl.sm { height: 8px; border-radius: 4px; margin-top: 6px; }
.tl-axis { position: relative; height: 18px; font-size: 11px; color: var(--label2); margin-top: 4px; }
.tl-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.tl-axis span:first-child { transform: none; }
.tl-axis span:last-child { transform: translateX(-100%); }
.meter { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 3px; transition: width .4s; }

/* ---------- sheet / toast / misc ---------- */
.backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.4); opacity: 0; transition: opacity .25s; }
.backdrop.show { opacity: 1; }
.sheet { position: fixed; z-index: 51; left: 8px; right: 8px; bottom: calc(8px + var(--safe-bottom)); transform: translateY(120%); transition: transform .3s cubic-bezier(.2,.9,.3,1); max-width: 520px; margin: 0 auto; }
.sheet.show { transform: none; }
.sheet .group { background: var(--bar-bg); -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px); border-radius: 14px; overflow: hidden; }
.sheet .group + .group { margin-top: 8px; }
.sheet .head { padding: 14px 16px; text-align: center; color: var(--label2); font-size: 13px; border-bottom: .5px solid var(--sep); }
.sheet .act { display: block; width: 100%; padding: 17px; text-align: center; color: var(--tint); font-size: 20px; }
.sheet .act + .act { border-top: .5px solid var(--sep); }
.sheet .act.cancel { font-weight: 600; background: var(--bg2); }
.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 18px); transform: translate(-50%, 20px); opacity: 0;
  background: rgba(30,30,30,.92); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 15px; transition: all .25s; pointer-events: none; max-width: 90%; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty { text-align: center; color: var(--label2); padding: 28px 16px; font-size: 15px; }
.empty svg { width: 44px; height: 44px; color: var(--label3); display: block; margin: 0 auto 8px; }
.skeleton { background: linear-gradient(90deg, var(--fill) 25%, var(--fill2) 50%, var(--fill) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--radius); }
@keyframes sk { to { background-position: -200% 0; } }
.ptr { position: fixed; top: calc(var(--safe-top) + 50px); left: 50%; transform: translateX(-50%); z-index: 15; width: 28px; height: 28px; border-radius: 50%;
  border: 2.5px solid var(--fill2); border-top-color: var(--label2); opacity: 0; transition: opacity .2s; }
.ptr.on { opacity: 1; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: translateX(-50%) rotate(360deg); } }
.page-enter { animation: enter .28s cubic-bezier(.2,.9,.3,1); }
@keyframes enter { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; }
.small { font-size: 13px; color: var(--label2); }
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 8px 0 4px; }
.hero h1 { font-size: 26px; margin: 4px 0 0; }
/* desk detail header: one compact card instead of a tall centred stack */
.desk-head { display: flex; align-items: center; gap: 14px; margin-top: 8px; padding: 14px 16px; background: var(--bg2); border-radius: var(--radius); }
.desk-head .avatar { width: 52px; height: 52px; font-size: 20px; }
.desk-head .main { flex: 1; min-width: 0; }
.desk-head h1 { font-size: 22px; line-height: 1.2; margin: 0 0 2px; overflow-wrap: anywhere; }
.desk-head .status { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login .box { width: 100%; max-width: 380px; text-align: center; }
.login img { width: 84px; height: 84px; border-radius: 20px; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.login h1 { font-size: 28px; margin: 18px 0 4px; }
.login .list { text-align: left; margin: 26px 0 16px; }
.login .demo-login { margin-top: 20px; padding: 14px 16px; border-radius: var(--radius); background: var(--bg2); display: grid; gap: 8px; font-size: 15px; }
.login .demo-login .btn { min-height: 44px; font-size: 15px; }
.login .err { color: var(--red); font-size: 15px; min-height: 20px; margin-bottom: 8px; }

/* attendance month: one cell per day */
.att-month { padding-top: 12px; padding-bottom: 6px; }
.att-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.att-head .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-strip { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 2px; margin-top: 8px; }
.att-strip i { height: 18px; border-radius: 3px; background: var(--fill); }
.att-strip i[data-d] { cursor: pointer; }
@media (hover: hover) { .att-strip i[data-d]:hover { outline: 2px solid var(--label2); outline-offset: 1px; } }

/* zone helper */
.draw { position: relative; touch-action: none; cursor: crosshair; }
.draw svg { position: absolute; inset: 0; width: 100%; height: 100%; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.row.acked .t { color: var(--label2); }
.grid2 > *, .content > * { min-width: 0; }
.row.wrap .t { white-space: normal; overflow: visible; font-size: 15px; line-height: 1.3; }
.cam-card { color: var(--label); display: block; }
.btn svg { width: 20px; height: 20px; flex: none; }
a.row, a.row b { color: var(--label); }

/* ---------- desktop: use the width (sidebar already switches on at 900px) ---------- */
/* .split: one column; two (live | day, video | controls) once the content is wide enough */
.split { display: grid; gap: 0 28px; }
.split > * { container-type: inline-size; min-width: 0; }
@container (min-width: 900px) {
  .split { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); grid-template-rows: auto auto auto 1fr; align-items: start; }
  .split > .side { grid-column: 2; grid-row: 1 / -1; }
  .split.cam-split { grid-template-columns: minmax(0, 1.8fr) minmax(300px, 1fr); }
  .split > .side > .section:first-child { margin-top: 8px; }
}
/* row lists that tile into columns (desks, report desks) */
@container (min-width: 700px) {
  .cols .list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .5px; background: var(--sep); }
  .cols .list > * { background: var(--bg2); }
  .cols .list > .row::before { display: none; }
  .cols .list > .empty { grid-column: 1 / -1; }
}
@media (min-width: 900px) {
  .content { --pad: 32px; max-width: 1320px; }
  .content.narrow { max-width: 860px; }
  .page { padding-top: 56px; padding-bottom: 48px; }
  /* controls keep a comfortable width instead of stretching across the screen */
  .search, .content > .seg, #d-seg .seg, .content > .section > .stepper, .side > .section > .stepper { max-width: 560px; }
  .content .btn { width: auto; min-width: 200px; padding: 0 24px; display: inline-flex; }
  button.row:hover, a.row:hover, button.tile:hover, .cam-card:hover { background: var(--fill); }
}

/* site-wide notice while a new site is being calibrated */
.calib { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 12px; padding: 10px 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--orange) 18%, var(--bg2)); font-size: 14px; line-height: 1.35; }
.calib svg { width: 20px; height: 20px; flex: none; color: var(--orange); margin-top: 1px; }

/* ---- Interaction states -------------------------------------------------------------------------------
   Hover only where the pointer can actually hover (a mouse), so nothing "sticks" after a tap on a phone.
   Pressed and keyboard-focus states apply everywhere. */
.row, .tile, .cam-card, .tab, .btn, .seg button, .nav-btn, .stepper button, .ibtn, .fin, .fin-x, .days button, .sheet .act, .cam-card .cam, .section-h a, .section-h button {
  transition: background-color .15s, color .15s, opacity .15s, filter .15s, box-shadow .15s, transform .1s;
}
:where(a, button, select, input, summary, [tabindex]):focus-visible { outline: 2px solid var(--tint); outline-offset: 2px; border-radius: 6px; }
/* Our own arrow on dropdowns: the browser's sits against the edge of the box, with no room around it. */
select.fin { cursor: pointer; appearance: none; -webkit-appearance: none; padding-right: 30px; background-repeat: no-repeat; background-position: right 11px center; background-size: 11px 7px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%238e8e93' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1.5 1.5 6 6l4.5-4.5'/%3E%3C/svg%3E"); }
select.fin.sm { padding-left: 30px; }
.btn:disabled, .stepper button:disabled, .seg button:disabled { cursor: not-allowed; }
.tab:active, .seg button:active, .nav-btn:active, .stepper button:active, .ibtn:active, .days button:active, .fin-x:active, .section-h a:active, .section-h button:active { opacity: .6; }
@media (hover: hover) {
  button.row:hover, a.row:hover, button.tile:hover, .cam-card:hover { background: var(--fill); }
  .set-nav .row.on:hover { background: var(--fill2); }
  .tab:hover:not(.on) { background: var(--fill); }
  .btn:hover:not(:disabled) { filter: brightness(1.1); }
  .btn.gray:hover:not(:disabled) { filter: none; background: var(--fill2); }
  .ibtn:hover { filter: brightness(1.1); }
  .ibtn.ghost:hover { filter: none; color: var(--label); }
  .seg button:hover:not(.on) { background: color-mix(in srgb, var(--bg2) 60%, transparent); }
  .days button:hover:not(.on), .stepper button:hover:not(:disabled), .fin:hover, .sheet .act:hover { background-color: var(--fill2); }
  .sheet .act.cancel:hover { background: var(--fill); }
  .nav-btn:hover, .section-h a:hover, .section-h button:hover, .fin-x:hover, .login-install:hover, details.more > summary:hover, .section-f a:hover, .subtitle a:hover { opacity: .7; }
  .cam-card:hover .cam { filter: brightness(1.08); }
  button.tile:hover { box-shadow: inset 0 0 0 1px var(--sep); }
}

/* a recorder on the System page: its line opens to the list of its cameras */
details.rec > summary { list-style: none; cursor: pointer; }
details.rec > summary::-webkit-details-marker { display: none; }
details.rec[open] > summary .row { background: var(--fill); }
details.rec + details.rec { border-top: .5px solid var(--sep); }

/* a timeline a moment can be picked on: the hairline and its time follow the finger */
.tl.seek { cursor: pointer; touch-action: none; }
.tl.seek b { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--label); pointer-events: none; }
.tl.seek b::after { content: attr(data-t); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); padding: 2px 6px; border-radius: 6px; background: var(--label); color: var(--bg); font-size: 12px; font-weight: 600; white-space: nowrap; }

/* Playback: its own picture under the live one, with a bar to drag through time. */
.pb .pb-cam { margin-bottom: 10px; }
.cam .pb-tag { background: var(--orange); text-transform: uppercase; }
.pb-line { display: flex; align-items: center; gap: 10px; padding: 0 2px; }
.pb-when { font-size: 13px; color: var(--label2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pb-range { flex: 1; min-width: 60px; height: 28px; accent-color: var(--tint); }
.pb-steps { display: flex; gap: 6px; margin-top: 10px; }
.pb-steps .btn { flex: 1; min-width: 0; min-height: 42px; padding: 0 4px; font-size: 15px; }
/* One column (phones): the day's coloured timeline also sits in the playback view, to drag without scrolling down to it. */
.pb-tl { margin-bottom: 10px; }
@container content (min-width: 900px) { .pb-tl { display: none; } }
.calib.bad { background: color-mix(in srgb, var(--red) 18%, var(--bg2)); }
.calib.bad svg { color: var(--red); }
/* The period of a report (periodPicker), and the reports portal: its rows open nothing. */
.pp-custom { display: flex; gap: 12px; flex-wrap: wrap; padding: 4px 16px 0; font-size: 15px; color: var(--label2); }
.pp-custom label { display: flex; align-items: center; gap: 8px; }
.pp-custom input { font: inherit; color: var(--label); background: var(--fill); border: 0; border-radius: 8px; padding: 7px 10px; }
.portal #rp-body a.row { pointer-events: none; }
.portal #rp-body a.row > svg { display: none; }
/* After signing in: what to open. */
.login .open-what { display: grid; gap: 8px; margin-top: 26px; }
.login .open-what .btn svg { width: 20px; height: 20px; }
.login .open-what .small { margin-bottom: 12px; }
