/* css/base.css
   Owns: the rules every page rests on: [hidden], the role gating, html/body, type, form controls, the scroll-focus
   ring, and the words every page and setup.php use (.muted, .pad, .err). Loads after tokens.css and before every other
   sheet. */

/* The whole UI hides elements with the `hidden` attribute (modals, tooltips, no-signal overlays, panels). A normal
   author rule like `.modal{display:grid}` OUTRANKS the browser's own `[hidden]{display:none}` (author beats UA), so
   without this every such element (the modal backdrop above all) stays painted after JS sets `hidden`, dimming the
   app. `!important` makes `hidden` win regardless of the element's own display rule. Visibility is tested by computed
   style, never by `el.hidden`. */
[hidden] { display: none !important; }

* { box-sizing: border-box; }

/* ---------- role gating ------------------------------------------------
   The server refuses every endpoint a role may not use; the UI does not tease controls it cannot use either. The
   body carries the role and permission classes (set from the bootstrap 'can' map). */
/* Viewer role (e.g. police): anything marked [data-admin] is hidden once the app knows it runs as a non-admin. */
body:not([data-role="admin"]) [data-admin] { display: none !important; }
/* Export needs the 'export' permission; the demo role does not have it. */
body.no-export [data-export] { display: none !important; }
/* A security responder (body.limited, js/stage/access.js): what such an account may never have, at any time (the
   Stills tab, a frame's Download). The server refuses each of them regardless. */
body.limited [data-full] { display: none !important; }
/* Auto-cashier controls: .perm-acw when the role holds ANY ACW perm, and a class per specific one. */
body:not(.perm-acw) [data-acw] { display: none !important; }
body:not(.perm-acw-operate) [data-acw-operate] { display: none !important; }
body:not(.perm-acw-manage)  [data-acw-manage]  { display: none !important; }
body:not(.perm-acw-audit)   [data-acw-audit]   { display: none !important; }
/* The books (Sales): managers and auditors. */
body:not(.perm-acw-books)   [data-acw-books]   { display: none !important; }

/* ---------- html / body ------------------------------------------------ */

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: var(--fs-base)/var(--lh) var(--font-ui);
  overscroll-behavior: none;
}
/* The whole app fits the window: top bar, then the stage + side panel taking exactly what is left. Nothing here
   scrolls the page itself: lists scroll inside their panels, and the video, transport and timeline are always on
   screen together. */
body { display: flex; flex-direction: column; overflow: hidden; }

/* The app is driven by taps, drags, scrubs and pinches, not by reading prose. A stray text selection only fights a
   timeline drag or a pane pan, and long-pressing a label on a phone pops the OS copy/define callout over the video.
   Selection (and the iOS callout) is off everywhere except where the content exists to be copied: form fields (a share
   link is an input). A value meant to be copied whole (a share hash, a wash code an attendant reads out) is
   user-select: all (kit.css .hash-full, .code-big). */
body {
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
input, textarea, [contenteditable="true"] {
  user-select: text; -webkit-user-select: text; -webkit-touch-callout: default;
}

/* ---------- type and form controls ------------------------------------- */

button, select, input { font: inherit; color: inherit; }
a:not([class]) { color: var(--accent); }   /* a link in running text (the browser's own is lavender on dark) */
code, kbd { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92em; }
kbd { background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }

input[type=date] {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 5px 8px; color-scheme: dark;
}

/* ---------- scroll-focus ring (scroll-focus.js) -------------------------
   Frames the nested panel the wheel will scroll while the pointer is over it. No ring = nothing under the pointer
   scrolls on its own. A fixed overlay that never catches the pointer; above dialogs and the frame viewer, under
   tooltips. */
.scroll-focus {
  position: fixed; pointer-events: none; z-index: var(--z-scrollfocus); border-radius: 6px; opacity: 0;
  box-shadow: inset 0 0 0 2px var(--accent, var(--accent-hi)), inset 0 0 12px var(--accent, var(--accent-hi));
  transition: opacity .12s ease, top .09s ease, left .09s ease, width .09s ease, height .09s ease;
}
.scroll-focus.is-on { opacity: .55; }

/* ---------- words every page uses (setup.php too) ---------------------- */

.muted { color: var(--muted); }
.pad { padding: 12px 14px; }
.err { color: var(--err); }

/* Installed on a phone's home screen (standalone): keep the top bar out of the notch and the timeline above the home
   indicator. In a browser tab the browser's own chrome already does this. (Not a width query: it stays here, where
   setup.php gets it too.) */
@media (display-mode: standalone) {
  body { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
}
