/* PKS portal stylesheet.
 *
 * Look and feel follows the Mustang Apsardze brand (mustangapsardze.lv):
 * brand dark #191A1D, brand red #DB1E35, warm greys #7D7A77 / #EBE9E8,
 * Arial, an 8 px spacing grid (4/8/16/24/32), 16 px card corners and
 * fully rounded buttons and inputs.  Two themes: dark (the site's footer,
 * white logo; the default for a dispatch console) and light (the site's
 * pages, black logo).  <html data-theme> is set by the server from the
 * pks_theme cookie that the header toggle writes; without the cookie the
 * device's own light/dark setting decides.  No icon fonts, no web fonts:
 * the dispatch posts must render this without any download from the
 * internet.
 */

:root {
  --bg: #191A1D;          /* page background = brand dark */
  --panel: #212226;       /* cards, tables                */
  --panel-2: #2A2B30;     /* table header, inputs         */
  --line: #36373D;        /* borders                      */
  --text: #EBE9E8;        /* brand light grey             */
  --muted: #A29F9C;       /* brand grey #7D7A77, lifted for contrast on dark */
  --red: #DB1E35;         /* brand red                    */
  --red-dark: #B5172A;
  --ok: #2e9e5b;
  --warn: #e0a400;
  --bad: #e5484d;
  --info: #3b82f6;
  --strong: #FFFFFF;      /* headings, links, figures   */
  --soft: #DDDDDD;        /* secondary text on panels   */
  --nav-bg: #111214;
  --hover-line: #55565c;
  --row-hover: #26272c;
  --row-new: #4a2229;
  --ok-bg: #1f3f2b;   --ok-fg: #7fe0a0;
  --warn-bg: #3f3416; --warn-fg: #ffd166;
  --bad-bg: #4a1d1f;  --bad-fg: #ff8a8e;
  --info-bg: #1f2c40; --info-fg: #9ec2ff;
  --scroll: #444;
  --shadow: 0 8px 32px rgba(0,0,0,.6);
  --radius: 16px;         /* cards, tables                */
  --radius-sm: 8px;       /* small boxes inside cards     */
  --pill: 24px;           /* buttons, inputs, chips       */
  --gap: 16px;            /* default gap between blocks   */
  color-scheme: dark;
}

/* Light theme = the website's look: white panels, #191A1D text, warm grey
 * #EBE9E8 lines.  Written twice on purpose: once for an explicit choice,
 * once for "no choice yet, the device prefers light". */
:root[data-theme=light] {
  --bg: #F4F3F2; --panel: #FFFFFF; --panel-2: #F7F6F5; --line: #EBE9E8;
  --text: #191A1D; --muted: #7D7A77; --strong: #191A1D; --soft: #3A3B40;
  --nav-bg: #FFFFFF; --hover-line: #7D7A77; --row-hover: #FAF9F8; --row-new: #FDE3E6;
  --ok-bg: #E3F5EA; --ok-fg: #1B6B3A; --warn-bg: #FFF3D6; --warn-fg: #8A5A00;
  --bad-bg: #FDE3E6; --bad-fg: #B5172A; --info-bg: #E3ECFB; --info-fg: #1F4FA3;
  --scroll: #C9C6C3; --shadow: 0 8px 32px rgba(25,26,29,.18);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #F4F3F2; --panel: #FFFFFF; --panel-2: #F7F6F5; --line: #EBE9E8;
    --text: #191A1D; --muted: #7D7A77; --strong: #191A1D; --soft: #3A3B40;
    --nav-bg: #FFFFFF; --hover-line: #7D7A77; --row-hover: #FAF9F8; --row-new: #FDE3E6;
    --ok-bg: #E3F5EA; --ok-fg: #1B6B3A; --warn-bg: #FFF3D6; --warn-fg: #8A5A00;
    --bad-bg: #FDE3E6; --bad-fg: #B5172A; --info-bg: #E3ECFB; --info-fg: #1F4FA3;
    --scroll: #C9C6C3; --shadow: 0 8px 32px rgba(25,26,29,.18);
    color-scheme: light;
  }
}
/* The logo follows the theme: white on dark, black on light.  !important
 * because the header's own "img { display: block }" is more specific. */
img.on-light { display: none !important; }
:root[data-theme=light] img.on-dark { display: none !important; }
:root[data-theme=light] img.on-light { display: block !important; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) img.on-dark { display: none !important; }
  :root:not([data-theme]) img.on-light { display: block !important; }
}

* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--scroll) var(--bg); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 8px; }

html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 Arial, Helvetica, sans-serif;
}
a { color: var(--strong); text-decoration: none; transition: color .2s; }
a:hover { color: var(--red); }
h1 { font-size: 24px; line-height: 1.2; font-weight: bold; color: var(--strong); margin: 0 0 24px; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted);
     margin: 0 0 8px; }
code.secret { font-size: 18px; letter-spacing: 2px; background: var(--panel-2); padding: 4px 8px;
              border-radius: var(--radius-sm); user-select: all; display: inline-block; max-width: 100%;
              overflow-wrap: anywhere; }
.card small { overflow-wrap: anywhere; }
pre.instr { white-space: pre-wrap; background: var(--panel-2); padding: 8px 16px;
            border-radius: var(--radius-sm); }
.muted { color: var(--muted); }

/* Line icons from pks/icons.py: they take the text colour. */
svg.ic { width: 18px; height: 18px; flex: 0 0 auto; display: inline-block; vertical-align: -4px; }
button:has(> svg.ic), .btn:has(> svg.ic), nav.top .links a, nav.top .user {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }

/* ----------------------------------------------------------------- top bar */
/* nav.top = .topbar (brand, account controls) over .links (the pages).  The
 * desktop/tablet/phone layouts are at the end of this file. */
nav.top {
  background: var(--nav-bg); border-bottom: 2px solid var(--red); position: sticky; top: 0; z-index: 10;
}
nav.top .topbar { display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 64px; }
/* Logo (58:42) + a thin divider + the product name. */
nav.top .brand { display: flex; align-items: center; gap: 16px; flex: 0 0 auto; }
nav.top .brand img { height: 44px; width: auto; display: block; }
nav.top .brand img.mark { display: none; height: 40px; border-radius: var(--radius-sm); }
nav.top .brand i, .login-brand i {
  font-style: normal; font-weight: bold; color: var(--strong); letter-spacing: 2px;
  padding-left: 16px; border-left: 1px solid var(--line);
}
nav.top .brand i { font-size: 15px; line-height: 1.2; letter-spacing: .5px; max-width: 220px;
                   padding-block: 6px; }
nav.top .menu-btn { display: none; }
nav.top .menu-btn .i-close, nav.top.open .menu-btn .i-menu { display: none; }
nav.top.open .menu-btn .i-close { display: inline-block; }
nav.top .links a svg.ic { display: none; }     /* shown in the phone menu */
nav.top .user { gap: 6px; }
nav.top .links { display: flex; gap: 4px; flex-wrap: wrap; padding: 0 24px 8px; }
nav.top .links a {
  padding: 8px 12px; border-radius: var(--pill); font-size: 12px; font-weight: bold;
  text-transform: uppercase; letter-spacing: .5px; color: var(--soft); position: relative; white-space: nowrap;
}
nav.top .links a:hover { background: var(--panel-2); color: var(--strong); }
nav.top .links a.on { background: var(--red); color: #fff; }
nav.top .me { margin-left: auto; display: flex; align-items: center; gap: 8px; }
nav.top .me form.inline { margin: 0; gap: 4px; flex-wrap: nowrap; }
nav.top .me button { min-height: 32px; white-space: nowrap; }
nav.top .user { color: var(--muted); font-size: 13px; }
.badge {
  background: var(--red); color: #fff; border-radius: var(--pill); font-size: 11px; padding: 0 6px;
  margin-left: 4px; vertical-align: top;
}
nav.top .links a.on .badge { background: #fff; color: var(--red); }
button.lang { padding: 4px 8px; font-size: 11px; }
#theme-toggle, #sound-toggle { padding: 4px 10px; letter-spacing: 0; line-height: 1; }
/* sun on dark (click = light), moon on light (click = dark) */
#theme-toggle .i-moon { display: none; }
:root[data-theme=light] #theme-toggle .i-sun { display: none; }
:root[data-theme=light] #theme-toggle .i-moon { display: inline-block; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) #theme-toggle .i-sun { display: none; }
  :root:not([data-theme]) #theme-toggle .i-moon { display: inline-block; }
}
#sound-toggle .i-on, #sound-toggle.on .i-off { display: none; }
#sound-toggle.on .i-on { display: inline-block; }
#sound-toggle.on { background: var(--red); border-color: var(--red); color: #fff; }
#sound-toggle .lbl { font-size: 11px; }
.login-langs #theme-toggle { margin-left: 8px; color: #7D7A77; border-color: #EBE9E8; background: #fff;
                             min-height: 32px; vertical-align: middle; }
button.lang.on { background: var(--red); border-color: var(--red); color: #fff; }
#alarm-banner {
  background: var(--red); color: #fff; padding: 8px 24px; font-weight: bold; letter-spacing: 1px;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
#alarm-banner[hidden] { display: none; }
#alarm-banner a { color: #fff; text-decoration: underline; }
#alarm-banner button { background: transparent; border: 1px solid rgba(255,255,255,.5); color: #fff;
  padding: 0 .5rem; min-height: 0; line-height: 1.4; }
#alarm-banner .bcount { opacity: .85; }
#alarm-banner span { flex: 1; }
#alarm-banner.p3 { filter: saturate(.6); }
/* The server's own notices (app.js): a tab the stream caps turned away. */
#pks-notice { background: var(--warn-bg); color: var(--warn-fg); border-bottom: 1px solid var(--warn);
  padding: 8px 24px; font-weight: bold; }
#pks-notice[hidden] { display: none; }

main.wrap { max-width: 1140px; margin: 0 auto; padding: 32px 24px 64px; }
main.wrap.wide { max-width: 1540px; }

/* --------------------------------------------------------------- layout */
.cols { display: flex; gap: var(--gap); align-items: flex-start; flex-wrap: wrap; }
.grow { flex: 1 1 560px; min-width: 0; }
.side { flex: 0 1 380px; min-width: 280px; display: flex; flex-direction: column; gap: var(--gap); }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; margin-bottom: var(--gap);
}
.side .card { margin-bottom: 0; }

/* KPI cards on the dashboard: number on top, label below, colour = state. */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--gap);
        margin-bottom: var(--gap); }
.kpi {
  position: relative;
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line);
  border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 4px;
}
.kpi .v { font-size: 28px; line-height: 1.2; font-weight: bold; color: var(--strong); }
.kpi svg.kpi-ic { position: absolute; top: 16px; right: 16px; width: 22px; height: 22px; color: var(--muted); }
.kpi.good svg.kpi-ic { color: var(--ok); }
.kpi.warn svg.kpi-ic { color: var(--warn); }
.kpi.bad svg.kpi-ic { color: var(--bad); }
.kpi .l { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.kpi.good { border-left-color: var(--ok); }
.kpi.warn { border-left-color: var(--warn); }
.kpi.bad  { border-left-color: var(--bad); }
.kpi:hover { color: inherit; border-color: var(--hover-line); }

/* Hourly passage bars, pure CSS. */
.bars { display: flex; align-items: flex-end; gap: 2px; height: 96px; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%;
       align-items: center; font-size: 9px; color: var(--muted); }
.bar i { display: block; width: 100%; background: var(--red); border-radius: 2px 2px 0 0;
         min-height: 1px; }
.bar { min-width: 0; }
.bar span { margin-top: 4px; }
.bar:not(:nth-child(3n+1)) span { visibility: hidden; }   /* label 00, 03, 06 ... */

/* Terminal tiles: green online, red offline, grey never seen. */
.tiles { display: flex; flex-wrap: wrap; gap: 8px; }
.tile { padding: 8px 12px; border-radius: var(--radius-sm); background: var(--panel-2); font-weight: bold;
        border-left: 4px solid var(--muted); }
.tile.on  { border-left-color: var(--ok); }
.tile.off { border-left-color: var(--bad); }
.tile.demo { border-left-style: dashed; font-weight: normal; }   /* a demo's reader: no device (Q71 B2) */
/* An information note among the attendance warnings (Q71 B6). */
.cd-note svg.ic { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }

.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok);
            margin-left: 6px; box-shadow: 0 0 6px var(--ok); }
.live-dot.dead { background: var(--bad); box-shadow: none; }

/* ---------------------------------------------------------------- tables */
table.grid { width: 100%; border-collapse: collapse; background: var(--panel);
             border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.grid th, table.grid td { padding: 8px 12px; border-bottom: 1px solid var(--line);
                               text-align: left; vertical-align: middle; }
table.grid th { background: var(--panel-2); font-size: 11px; text-transform: uppercase;
                letter-spacing: 1px; color: var(--muted); }
table.grid tr:last-child td { border-bottom: 0; }
table.grid.compact th, table.grid.compact td { padding: 4px 8px; font-size: 13px; }
table.grid tr:hover td { background: var(--row-hover); }
table.grid tr.off td { color: var(--muted); }
table.grid tr.k-denied td:first-child { border-left: 3px solid var(--warn); }
table.grid tr.k-alarm td:first-child { border-left: 3px solid var(--bad); }
table.grid tr.p1 td:first-child { border-left: 3px solid var(--bad); }
table.grid tr.p2 td:first-child { border-left: 3px solid var(--warn); }
table.grid tr.check td:first-child { border-left: 3px solid var(--warn); }   /* a day to check (Q64) */
table.grid tr.new td { animation: flash 1.5s ease-out; }
@keyframes flash { from { background: var(--row-new); } to { background: transparent; } }
table.kv th { text-align: left; color: var(--muted); font-weight: normal; padding: 4px 16px 4px 0;
              white-space: nowrap; vertical-align: top; }
table.kv td { padding: 4px 0; }
td.acts { white-space: nowrap; }
/* Controls inside table rows stay compact so lists keep their density. */
table.grid td button, table.grid td input, table.grid td select, table.grid td .btn {
  min-height: 32px; padding: 4px 12px; }
table.sched td input[type=time] { width: 104px; }
td.box { font-size: 18px; }

img.thumb { height: 40px; border-radius: var(--radius-sm); display: block; }
img.big { max-width: 100%; border-radius: var(--radius); }
img.face { width: 160px; height: 160px; object-fit: cover; border-radius: var(--radius); display: block;
           margin-bottom: 8px; }
.face.none { width: 160px; height: 160px; border-radius: var(--radius); background: var(--panel-2);
             margin-bottom: 8px; }

/* Pills: small status chips. */
.pill { display: inline-block; padding: 2px 8px; border-radius: var(--pill); font-size: 11px;
        background: var(--panel-2); color: var(--soft); white-space: nowrap; }
.pill.ok, .pill.granted { background: var(--ok-bg); color: var(--ok-fg); }
.pill.warn, .pill.denied, .pill.risk { background: var(--warn-bg); color: var(--warn-fg); }
.pill.bad, .pill.alarm, .pill.exception { background: var(--bad-bg); color: var(--bad-fg); }
.pill.door { background: var(--info-bg); color: var(--info-fg); }
.pill.suggestion { background: var(--info-bg); color: var(--info-fg); }
.prio { font-weight: bold; padding: 2px 8px; border-radius: var(--pill); font-size: 12px; }
.prio.p1 { background: var(--bad); color: #fff; }
.prio.p2 { background: var(--warn); color: #000; }
.prio.p3 { background: var(--panel-2); }

ul.findings { list-style: none; padding: 0; margin: 0; }
ul.findings li { padding: 8px 12px; border-left: 4px solid var(--muted); margin-bottom: 8px;
                 background: var(--panel-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
ul.findings li.exception { border-left-color: var(--bad); }
ul.findings li.risk { border-left-color: var(--warn); }
ul.findings li.suggestion { border-left-color: var(--info); }
ul.findings li.ok { border-left-color: var(--ok); }

/* ----------------------------------------------------------------- forms */
/* Brand form controls: 40 px tall, fully rounded, 16 px side padding. */
input, select, textarea, button {
  font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--pill); padding: 8px 16px; min-height: 40px;
  transition: border-color .2s, background-color .2s, color .2s;
}
textarea { border-radius: var(--radius); }
input[type=checkbox], input[type=radio] { min-height: 0; padding: 0; accent-color: var(--red); }
input:hover, select:hover, textarea:hover { border-color: var(--hover-line); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--red); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; text-transform: uppercase;
        letter-spacing: 1px; color: var(--muted); }
label.check, label.radio { flex-direction: row; align-items: center; text-transform: none;
                            letter-spacing: 0; font-size: 13px; color: var(--text); gap: 8px; }
button, .btn { cursor: pointer; padding: 8px 16px; text-transform: uppercase; letter-spacing: 1px;
               font-size: 12px; font-weight: bold; display: inline-block; }
.btn { border: 1px solid var(--line); border-radius: var(--pill); line-height: 22px; }
button:hover, .btn:hover { border-color: var(--hover-line); }
button.primary, .btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
button.primary:hover, .btn.primary:hover { background: var(--red-dark); }
button.danger { background: var(--bad-bg); border-color: var(--bad); color: var(--bad-fg); }
button.ghost, .btn.ghost { background: transparent; }
button.wide { width: 100%; padding: 12px 16px; font-size: 14px; min-height: 48px; }
form.inline { display: inline-flex; gap: 8px; align-items: center; margin: 4px 8px 4px 0;
              flex-wrap: wrap; }
form.filters { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap;
               margin-bottom: var(--gap); background: var(--panel); padding: 16px;
               border-radius: var(--radius); border: 1px solid var(--line); }
form.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px;
            align-items: end; }
form.form button { grid-column: 1 / -1; justify-self: start; }
form.form textarea { grid-column: 1 / -1; }
/* Full-width rows inside a grid form (the CSP allows no inline styles). */
form.form .span { grid-column: 1 / -1; }
form.form .stack { display: grid; gap: 4px; }
form.form .row { display: flex; gap: 16px; flex-wrap: wrap; }
/* A row of fields starts at the top of its cell: a taller row beside it
 * leaves no empty block over the shorter ones (the visitor form). */
form.form > .row { align-self: start; }
/* Forms folded into a table cell (an API key's edit and leak rotation). */
td details { margin-top: 4px; }
td details summary { cursor: pointer; font-size: 12px; color: var(--muted); }
td details[open] { padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); }
h2.mt { margin-top: 24px; }
form.door { display: inline-flex; gap: 8px; align-items: center; margin: 4px 8px 4px 0; }
form.door input { width: 220px; }
form.ack { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-top: 16px;
           background: var(--panel); padding: 16px; border-radius: var(--radius);
           border: 1px solid var(--line); }
form.ack .cats { display: flex; gap: 16px; }
form.ack input[name=remark] { flex: 1 1 240px; }
.tabs { display: flex; gap: 8px; margin-bottom: var(--gap); flex-wrap: wrap; }
.tab { padding: 8px 16px; border-radius: var(--pill); background: var(--panel-2); text-transform: uppercase;
       letter-spacing: 1px; font-size: 12px; font-weight: bold; }
.tab.on { background: var(--red); color: #fff; }
.jobbox { white-space: pre-wrap; font-family: monospace; font-size: 12px; margin-top: 8px;
          color: var(--muted); }
.jobbox.running { color: var(--warn); }
.jobbox.done { color: var(--ok-fg); }
.jobbox.failed { color: var(--bad-fg); }

.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: var(--gap); border: 1px solid; }
.flash.ok { background: var(--ok-bg); border-color: var(--ok); color: var(--ok-fg); }
.flash.err { background: var(--bad-bg); border-color: var(--bad); color: var(--bad-fg); }
.flash.warn { background: var(--warn-bg); border-color: var(--warn); color: var(--warn-fg); }

/* ----------------------------------------------------------------- login */
body.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center;
             justify-content: center; }
/* Logo, system name and card share one centre line. */
body.login { padding: 32px 16px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-bottom: 32px;
               text-align: center; }
.login-brand img { height: 112px; width: auto; display: block; }
.login-brand i { font-size: 18px; line-height: 1.3; letter-spacing: .5px; padding: 0; border: 0; }
/* The login card is the light variant of the brand: white, #191A1D text,
 * #EBE9E8 borders that turn #7D7A77 on hover/focus, like the site's forms. */
.login-card { background: #fff; color: #191A1D; border: 1px solid #EBE9E8; border-radius: var(--radius); padding: 32px; width: 400px;
              max-width: calc(100vw - 32px); }
.login-card label { color: #191A1D; font-weight: bold; margin-bottom: 8px; }
.login-card input { width: 100%; background: #fff; color: #191A1D; border: 1px solid #EBE9E8;
                    padding: 8px 16px; margin-bottom: 24px; }
.login-card input:hover, .login-card input:focus { border-color: #7D7A77; }
.login-card .flash { margin-bottom: 16px; }
.login-langs { margin-top: 24px; text-align: center; }
.login-langs a { color: #7D7A77; margin: 0 8px; font-size: 12px; letter-spacing: 1px; }
.login-langs a.on { color: var(--red); font-weight: bold; }

/* ---------------------------------------------------------------- print */
@media print {
  nav.top, form.filters, button, .flash, #alarm-banner, .noprint { display: none !important; }
  pre.instr { white-space: pre-wrap; word-break: break-word; }
  table.kv tr, ol li { break-inside: avoid; }
  body { background: #fff; color: #000; }
  .card, table.grid { background: #fff; border-color: #999; color: #000; }
  table.grid th { background: #eee; color: #000; }
  a { color: #000; }
}

/* --------------------------------------------------------------- cameras */
/* Live pictures: JPEG frames refreshed by app.js.  A 16:9 box keeps the
 * wall stable while a new frame loads. */
img.cam { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000;
          border-radius: var(--radius-sm); display: block; }
img.cam.big { max-height: 70vh; object-fit: contain; }
img.cam.stale { opacity: 0.45; }
.cam.none { aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center;
            background: var(--panel-2); color: var(--muted); border-radius: var(--radius-sm); }
.camwall { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: var(--gap); }
.camtile { display: block; background: var(--panel); border: 1px solid var(--line);
           border-radius: var(--radius); padding: 8px; }
.camtile:hover { border-color: var(--red); }
.camtile .cap { display: block; padding: 8px 4px 0; font-size: 12px; letter-spacing: 1px;
                text-transform: uppercase; color: var(--muted); }

/* --------------------------------------------------------------- storage */
progress.meter { width: 100%; height: 14px; border: 0; border-radius: var(--pill); overflow: hidden;
                 background: var(--panel-2); appearance: none; -webkit-appearance: none; }
progress.meter::-webkit-progress-bar { background: var(--panel-2); border-radius: var(--pill); }
progress.meter::-webkit-progress-value { background: var(--ok); border-radius: var(--pill); }
progress.meter::-moz-progress-bar { background: var(--ok); border-radius: var(--pill); }
progress.meter.low::-webkit-progress-value { background: var(--bad); }
progress.meter.low::-moz-progress-bar { background: var(--bad); }

/* ---------------------------------------------------------------- manual */
article.manual { max-width: 900px; line-height: 1.6; }
article.manual h1 { display: none; }              /* the page already has the title */
article.manual h2 { font-size: 18px; text-transform: none; letter-spacing: 0; color: var(--strong);
                    margin: 32px 0 8px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
article.manual h3 { font-size: 15px; margin: 24px 0 8px; color: var(--soft); }
article.manual p, article.manual li { margin: 8px 0; }
article.manual ul, article.manual ol { padding-left: 24px; }
article.manual table { margin: 8px 0 16px; }
article.manual code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
nav.toc { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
          padding: 16px 24px; margin-bottom: var(--gap); column-count: 2; column-gap: 32px; }
nav.toc ul { list-style: none; margin: 0; padding: 0; }     /* the headings carry their own numbers */
nav.toc li { margin: 4px 0; font-size: 13px; break-inside: avoid; }
p.muted a.on { color: var(--red); font-weight: bold; }
@media (max-width: 700px) { nav.toc { column-count: 1; } }

/* ------------------------------------------- operator confirmation popup */
#confirm-box {
  position: fixed; right: 24px; bottom: 24px; z-index: 50; width: 352px;
  background: var(--panel); border: 3px solid var(--red); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); display: flex; flex-wrap: wrap; gap: 16px; align-items: center;
}
#confirm-box[hidden] { display: none; }
#confirm-box img { width: 112px; height: 112px; object-fit: cover; border-radius: var(--radius-sm); }
#confirm-box .who { flex: 1; min-width: 150px; font-size: 15px; line-height: 1.4; }
#confirm-box .left { font-size: 22px; font-weight: bold; color: var(--red); }
#confirm-box .btns { display: flex; gap: 8px; width: 100%; }
#confirm-box .btns button { flex: 1; font-size: 18px; padding: 12px; }
#confirm-box .btns .allow { background: #1e7d3a; color: #fff; }
#confirm-box .btns .deny { color: #fff; }
#confirm-box .btns .deny { background: var(--red); }
#confirm-box.busy .btns button { opacity: .5; pointer-events: none; }
#confirm-box .err { color: var(--bad-fg); }
table.grid tr.allowed td b { color: var(--ok-fg); }
table.grid tr.denied td b, table.grid tr.expired td b { color: var(--bad-fg); }
table.sched td select { max-width: 200px; }
@media (max-width: 480px) { #confirm-box { left: 16px; right: 16px; width: auto; } }

.card.live canvas { width: 100%; max-width: 900px; background: #000; border-radius: var(--radius-sm); display: block; }

.card.live .audio-bar button { font-size: 16px; padding: 8px 24px; margin-right: 8px; min-height: 48px; }
.card.live .audio-bar button.on { background: #1e7d3a; color: #fff; }
.card.live .audio-bar button.talk { background: var(--red); color: #fff; }
.card.live .audio-bar button.talk.on { background: #1e7d3a; color: #fff; }

/* ================================================================ layouts
 * Desktop (> 1100 px): brand bar with account controls, all page links in a
 *   row below it, content with a side column.
 * Tablet (701-1100 px): the link row scrolls sideways instead of wrapping,
 *   the side column drops under the content, controls are finger-sized.
 * Phone (<= 700 px): the red horse mark and a Menu button; the links and
 *   account controls fold out as a list; tables turn into one card per row
 *   (app.js puts each column title into td[data-label]).
 */

/* A wide table scrolls inside its own box, never the whole page. */
.tscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
main.wrap > .tscroll { margin-bottom: var(--gap); }
.card .tscroll + *, .tscroll + .tscroll { margin-top: 0; }

@media (max-width: 1100px) {
  nav.top .links { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
                   -webkit-overflow-scrolling: touch; }
  nav.top .links::-webkit-scrollbar { display: none; }
  nav.top .me #sound-toggle .lbl, nav.top .me .lbl { display: none; }  /* icons alone, title says the rest */
  .grow, .side { flex-basis: 100%; }
  .kpis { grid-template-columns: repeat(3, 1fr); }     /* six figures = two even rows */
  /* the side cards sit next to each other under the main column */
  .side { min-width: 0; flex-direction: row; flex-wrap: wrap; align-items: stretch; }
  .side > * { flex: 1 1 300px; min-width: 0; }
  main.wrap { padding: 24px 24px 64px; }
}

/* Touch screens: at least 44 px targets. */
@media (pointer: coarse) {
  nav.top .links a { padding: 12px 16px; }
  button, .btn, input, select { min-height: 44px; }
  input[type=checkbox], input[type=radio] { min-height: 0; width: 20px; height: 20px; }
  table.grid td button, table.grid td input, table.grid td select, table.grid td .btn {
    min-height: 40px; }
}

@media (max-width: 700px) {
  body { font-size: 15px; }
  h1 { font-size: 20px; margin-bottom: 16px; }

  /* header: mark + PKS + Menu; the rest folds out */
  nav.top .topbar { height: 56px; padding: 0 16px; gap: 8px 16px; flex-wrap: wrap; }
  nav.top .brand { gap: 12px; }
  nav.top .brand img.logo { display: none !important; }   /* beats the theme's logo swap */
  nav.top .brand img.mark { display: block; }
  nav.top .brand i { display: none; }        /* the mark alone is enough on a phone */
  nav.top .menu-btn { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
  nav.top .me, nav.top .links { display: none; }
  nav.top.open { max-height: 100vh; overflow-y: auto; }
  nav.top.open .topbar { height: auto; min-height: 56px; padding-bottom: 8px; }
  nav.top.open .me { display: flex; flex-wrap: wrap; width: 100%; order: 3; margin: 0;
                     padding-top: 8px; border-top: 1px solid var(--line); }
  nav.top.open .me .user { margin-left: auto; }
  nav.top.open .me #sound-toggle .lbl, nav.top.open .me .lbl { display: inline; }
  nav.top.open .links a { justify-content: flex-start; gap: 12px; }
  nav.top.open .links a svg.ic { display: inline-block; width: 20px; height: 20px; }
  nav.top.open .links { display: flex; flex-direction: column; gap: 4px; padding: 0 16px 16px; }
  nav.top.open .links a { padding: 12px 16px; font-size: 14px; }

  main.wrap { padding: 16px 16px 48px; }
  .side { flex-direction: column; }
  .card { padding: 16px; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .kpi { padding: 12px 16px; }
  .kpi .v { font-size: 24px; }

  /* forms: one field per line, full-width buttons */
  form.filters { flex-direction: column; align-items: stretch; gap: 8px; padding: 16px; }
  form.filters > *, form.filters input, form.filters select { width: 100%; }
  form.form { grid-template-columns: 1fr; }
  form.form button { justify-self: stretch; }
  form.ack { flex-direction: column; align-items: stretch; }
  form.ack .cats { flex-wrap: wrap; }
  form.door input { width: 100%; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tab { flex: 0 0 auto; }

  /* tables: one card per row, "column title: value" */
  .tscroll { overflow: visible; }
  table.grid, table.grid tbody { display: block; width: 100%; }
  table.grid { background: transparent; border: 0; border-radius: 0; overflow: visible; }
  table.grid thead { display: none; }
  table.grid tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px;
                  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius);
                  padding: 12px 16px; margin-bottom: 8px; border-left-width: 4px; }
  table.grid td, table.grid.compact td {
    display: block; min-width: 0; padding: 0; border: 0; text-align: left; font-size: 14px;
    overflow-wrap: anywhere; }
  table.grid td::before { content: attr(data-label); display: block; margin-bottom: 2px;
                          font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
                          color: var(--muted); }
  table.grid td[data-label=""]::before, table.grid td:not([data-label])::before { content: none; }
  table.grid td[data-label=""], table.grid td[colspan] { grid-column: 1 / -1; }
  table.grid td:empty { display: none; }
  table.grid td.acts { grid-column: 1 / -1; white-space: normal; display: flex; flex-wrap: wrap;
                       gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
  table.grid td.acts::before { content: none; }
  table.grid td.acts form.inline { margin: 0; }
  table.grid tr:hover td { background: transparent; }
  table.grid tr.k-denied, table.grid tr.p2, table.grid tr.check { border-left-color: var(--warn); }
  table.grid tr.off { opacity: .7; }
  table.grid tr.k-alarm, table.grid tr.p1 { border-left-color: var(--bad); }
  table.grid tr td:first-child { border-left: 0 !important; }
  table.grid img.thumb { height: 56px; }

  .card.live canvas { width: 100%; }
  nav.toc { column-count: 1; }
  .login-brand { gap: 12px; margin-bottom: 24px; }
  .login-brand img { height: 88px; }
  .login-brand i { font-size: 16px; }
  .login-card { padding: 24px; }
}

/* cameras: paused by default, caption tells live / snapshot time */
figure.camf { margin: 0; position: relative; }
figure.camf .camcap { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  padding: 6px 2px; font-size: 12px; color: var(--muted, #888); }
figure.camf.live .camstate { color: #1e7d3a; font-weight: 600; }
figure.camf .cambtns { margin-left: auto; display: flex; gap: 6px; }
figure.camf .cambtns button { padding: 3px 10px; font-size: 12px; }
figure.camf.live .campause { display: inline-block; }
figure.camf:not(.live) .campause { display: none; }
.camtile > a .cap { padding: 6px 4px; }
.camstrip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0; -webkit-overflow-scrolling: touch; }
.camstrip a { flex: 0 0 auto; width: 128px; text-align: center; font-size: 11px; color: var(--muted, #888); }
.camstrip img { width: 128px; aspect-ratio: 16 / 9; object-fit: cover; background: #000; border-radius: 4px; display: block; }
/* camera pictures (pks/webcamonly.py) */
.snapgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.snaptile { display: flex; flex-direction: column; gap: 4px; font-size: 12px; min-width: 0; }
.snaptile img, .camtile > a > img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000;
  border-radius: 4px; display: block; }
.snapempty { width: 100%; aspect-ratio: 16 / 9; display: grid; place-items: center; border-radius: 4px;
  background: var(--panel); border: 1px dashed var(--line); color: var(--muted); font-size: 12px; }
.snaphead { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.snapfull { max-width: 100%; height: auto; display: block; border-radius: 4px; cursor: zoom-in; }
.snapcmpwrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.snapcmp { margin: 0; min-width: 0; }
.snapcmp img { width: 100%; height: auto; display: block; border-radius: 4px; }
.snapcmp figcaption { font-size: 12px; color: var(--muted); padding-top: 4px; }
.camactions .btn { font-size: 15px; padding: 10px 18px; }
img.face.mini, .face.mini.none { width: 44px; height: 44px; border-radius: 50%; display: inline-block; vertical-align: middle; }
.face.mini.none { background: var(--panel-2, #eee); }
table.grid.people td.thumb { width: 52px; }
@media (max-width: 700px) {
  table.grid.people td.thumb { float: right; }
  table.grid.people td.thumb::before { content: none; }
}

/* terminal settings */
.card.ts .tsgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 18px; margin-bottom: 10px; }
.card.ts .tsf { padding: 4px 6px; border-left: 3px solid transparent; }
.card.ts .tsf.changed { border-left-color: #d9a400; background: rgba(217, 164, 0, 0.07); }
.card.ts .tsf small.was { display: block; color: #9a7400; font-size: 11px; margin-top: 2px; }
.card.ts form.inline { margin-top: 8px; }
b.warn { color: #9a7400; }
.card.ts table.voices audio { width: 100%; max-width: 320px; height: 32px; }
.card.ts .pics { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0; }
.card.ts .bootpic { text-align: center; font-size: 12px; color: var(--muted, #888); }
.card.ts .bootpic img { width: 120px; height: 205px; object-fit: cover; border-radius: 6px; display: block; margin: 4px auto; background: #26262f; }
.card.ts .bootpic.none { width: 120px; height: 230px; border: 1px dashed var(--line, #ccc); border-radius: 6px; display: flex; flex-direction: column; justify-content: center; }
.card.ts .shots { display: flex; gap: 14px; flex-wrap: wrap; }
.card.ts figure.shot { margin: 0; font-size: 12px; color: var(--muted, #888); }
.card.ts figure.shot .pair { display: flex; gap: 8px; }
.card.ts figure.shot .pair > div { text-align: center; }
.card.ts figure.shot img { width: 96px; height: 164px; object-fit: contain; background: #26262f; border-radius: 6px; display: block; margin-top: 2px; }
input.narrow { width: 6em; padding-left: 12px; padding-right: 8px; }   /* "00:00" and 3 digits fit (client-view audit 7) */
pre.log { font-size: 11px; max-height: 60vh; overflow: auto; white-space: pre-wrap; }
.printhead { display: none; }
@media print { .printhead { display: block; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid #999; font-size: 12px; }
  .jobbox, .quick, nav.toc, .cambtns { display: none !important; } }

.txtbars td.bar { font-family: monospace; color: var(--accent, #c8102e); white-space: nowrap; letter-spacing: -1px; }
.txtbars td.num { text-align: right; }

/* sites map */
#map { height: 70vh; min-height: 360px; border-radius: 10px; border: 1px solid var(--line, #ddd); }
.map-legend span { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.map-legend .ok { background: #2e8b57; } .map-legend .warn { background: #e08a00; } .map-legend .bad { background: #c8102e; }
.event-card img.big { max-width: 100%; max-height: 60vh; border-radius: 8px; }

/* attendance calendar */
.cal td { vertical-align: top; height: 4.5em; width: 14%; }
.cal td.pad { background: transparent; }
.cal td.we { background: rgba(127,127,127,.08); }
.cal td.hol { background: rgba(200,16,46,.10); }
.cal td.leave { background: rgba(46,139,87,.12); }
.cal td.absent { background: rgba(224,138,0,.18); }
.cal td.warn b { text-decoration: underline dotted; }
.cal td.warn { box-shadow: inset 0 0 0 2px var(--warn); }   /* a day to check (Q64) */
/* On a phone the month stays a 7-column month, not one card per week (the
 * card rule of table.grid piled the days on top of each other); the plan's
 * text and the pill give way to the day, the hours and the frame. */
@media (max-width: 700px) {
  table.grid.cal { display: table; table-layout: fixed; width: 100%; background: var(--panel);
                   border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
  table.grid.cal thead { display: table-header-group; }
  table.grid.cal tbody { display: table-row-group; }
  table.grid.cal tr { display: table-row; padding: 0; margin: 0; border: 0; background: transparent; }
  table.grid.cal th, table.grid.cal td, table.grid.cal td:empty {
    display: table-cell; padding: 4px 2px; height: 3.2em; font-size: 12px; letter-spacing: 0;
    border-bottom: 1px solid var(--line); vertical-align: top; }
  table.grid.cal td::before { content: none; }
  /* "Neierašanās", a leave type or a holiday is wider than a phone's day:
   * one line cut with an ellipsis, not broken in the middle of the word */
  table.grid.cal td small { display: block; font-size: 10px; white-space: nowrap; overflow: hidden;
                            text-overflow: ellipsis; overflow-wrap: normal; }
  table.grid.cal td small.muted, table.grid.cal td small.pill { display: none; }
}

.findings li.ignored { opacity: .6; }

form.door .jobbox:empty { display: none; }
form.door .jobbox { display: inline-block; margin-left: 6px; white-space: pre-line; font-size: .85em; }

/* monthly timesheet */
.scroll { overflow-x: auto; }
.tabele td, .tabele th { text-align: center; padding: 2px 4px; font-size: .85em; }
.tabele td:first-child { text-align: left; }
.tabele th.we { background: rgba(127,127,127,.12); }
.tabele td.cA, .tabele td.cS, .tabele td.cBA, .tabele td.cK, .tabele td.cC { background: rgba(46,139,87,.12); }
.tabele td.cN { background: rgba(224,138,0,.25); font-weight: bold; }
.tabele td.cSV { background: rgba(200,16,46,.08); }
/* days to check (question 64): a missing, doubled or guessed mark */
.tabele td.check { box-shadow: inset 0 0 0 2px var(--warn); background: var(--warn-bg); color: var(--warn-fg); cursor: help; }
.tabele td.cQ { font-weight: bold; }
.tabele td.check a { color: var(--warn-fg); font-weight: bold; }
.printonly { display: none; }
@media print { .printonly { display: block; margin-top: 30px; } .tabele td, .tabele th { font-size: 8pt; } }

.roster select { font-size: .8em; padding: 0; max-width: 4.2em; }
.roster td.set { background: rgba(46,139,87,.12); }

/* floor plan */
#plan { position: relative; display: inline-block; max-width: 100%; }
#plan img { max-width: 100%; display: block; border-radius: 8px; border: 1px solid var(--line, #ddd); }
#plan.editing img { cursor: crosshair; }
#plan .spot { position: absolute; transform: translate(-50%, -50%); min-width: 22px; height: 22px; border-radius: 11px;
  padding: 0 6px; font-size: 11px; line-height: 22px; color: #fff; text-align: center; text-decoration: none;
  border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); background: #2e8b57; }
#plan .spot.offline { background: #e08a00; }
#plan .spot.alarm { background: #c8102e; animation: pksblink 1s infinite; }
#plan .spot.open { background: #1f6fd1; }
#plan .spot.locked { background: #555; }
#plan .spot.link { border-radius: 4px; padding: 0 6px; background: #2e7d32; }
#plan .spot.link.offline { background: #e08a00; }
#plan .spot.link.alarm { background: #c8102e; }
@keyframes pksblink { 50% { opacity: .45; } }

/* full-screen alarm wall */
body.wall { background: #111; color: #eee; margin: 0; padding: 12px; font-size: 18px; }
body.wall header { margin-bottom: 10px; font-size: 20px; }
.wallgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.wallcard { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 10px; color: #fff; text-decoration: none; background: #2a2a2a; border-left: 8px solid #888; }
.wallcard.p1 { border-left-color: #e0102e; background: #3a1116; animation: pksblink 1.5s infinite; }
.wallcard.p2 { border-left-color: #e08a00; }
.wallcard.p3 { border-left-color: #5a8; }
.wallcard small { opacity: .75; }
.wallcard .wallimg { width: 100%; max-height: 180px; object-fit: cover; border-radius: 6px; }

img.clogo { max-height: 32px; max-width: 160px; vertical-align: middle; }   /* a client's logo (Q62) */
img.clogo.big { max-height: 60px; max-width: 240px; }
.printhead img.clogo { max-height: 32px; }

.boardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.boardw h3 { margin-top: 0; }

.qrgrid { display: flex; flex-wrap: wrap; gap: 16px; }
.qrcard { text-align: center; page-break-inside: avoid; }

/* ------------------------------------ areas inside an object (question 61) */
ul.areas { list-style: none; margin: 4px 0 0; padding-left: 0; }
ul.areas ul.areas { padding-left: 16px; margin-left: 8px; border-left: 1px solid var(--line); }
ul.areas li { padding: 4px 0; }
ul.areas .area { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.devs { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.devs .pill svg.ic { width: 12px; height: 12px; vertical-align: -2px; margin-right: 2px; }
ul.areas details { margin: 4px 0 4px 24px; }
@media (max-width: 700px) {
  ul.areas ul.areas { padding-left: 8px; margin-left: 4px; }
  ul.areas details { margin-left: 0; }
}

/* keyboard-selected alarm row */
tr.kbsel td { outline: 2px solid var(--accent, #2b6cb0); outline-offset: -2px; }
.kbd-help { margin-top: .2rem; }

/* find a section in the menu */
nav.top .links input.navfind { width: 11rem; max-width: 100%; margin: .2rem .4rem; padding: .25rem .5rem; }
nav.top .links a[hidden] { display: none; }

/* ---------------------------------------- a client's own look (question 62)
 * pks/webskin.py.  The client's colour comes from its own stylesheet
 * (/clients/<id>/skin.css: --red and --red-dark only).  Its logo and name
 * follow the system's name in the bar - never next to the Mustang logo - and
 * on a phone they fold into the menu: only the red horse mark stays. */
nav.top .cbrand { display: flex; align-items: center; gap: 8px; flex: 0 1 auto; min-width: 0;
                  padding-left: 16px; border-left: 1px solid var(--line); }
nav.top .cbrand b { font-size: 14px; color: var(--strong); white-space: nowrap; overflow: hidden;
                    text-overflow: ellipsis; max-width: 240px; }
footer.operated { margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--line); text-align: center; }
.login-client { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 24px;
                text-align: center; }
.login-client b { font-size: 18px; color: #191A1D; }
/* Question 71: a client's logo and name on a page without a login (the reset
 * link, a one-time key link it made) in place of the Mustang logo; the PIN
 * tick of a key form only once "make a one-time link" is ticked. */
.pub-brand { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.pub-brand b { font-size: 18px; color: var(--strong); }
p.langs a { margin-right: 6px; }
p.langs a.on { font-weight: 700; text-decoration: none; }
:is(fieldset, .kh-ticks):has(input[name=handover]:not(:checked)) label.kh-pin { display: none; }
svg.swatch { width: 40px; height: 40px; flex: 0 0 auto; }
.colorrow { display: flex; align-items: center; gap: 8px; }
.colorrow input[type=color] { width: 72px; padding: 4px 8px; cursor: pointer; }
.skinpreview { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; padding-top: 16px;
               border-top: 1px solid var(--line); }
form.form.upload { margin-top: 8px; }
.printhead .muted { color: #555; }
/* A long figure (face / finger / PIN / card) stays on one line, clear of its icon. */
.kpi .v { padding-right: 28px; }
.kpi.long .v { font-size: 20px; white-space: nowrap; }
input[type=file] { max-width: 100%; }
@media (max-width: 1100px) {
  nav.top .cbrand img.clogo + b { display: none; }        /* the logo alone when there is one */
}
@media (max-width: 700px) {
  nav.top .cbrand { display: none; }
  nav.top.open .cbrand { display: flex; order: 2; width: 100%; padding: 8px 0 0; border-left: 0;
                         border-top: 1px solid var(--line); }
  nav.top.open .cbrand img.clogo + b { display: inline; }
  /* filters: a checkbox stays next to its label */
  form.filters input[type=checkbox], form.filters input[type=radio] { width: auto; }
  form.filters label.check { flex-direction: row; }
  form.inline { max-width: 100%; }
  form.inline input:not([type=checkbox]):not([type=radio]):not([type=hidden]), form.inline select {
    flex: 1 1 160px; min-width: 0; max-width: 100%; }
  /* A field under its label (label is a column flex box): the 160 px basis
   * above would be its height - a 100 px tall box on /users (the owner's walk). */
  form.inline label > input:not([type=checkbox]):not([type=radio]), form.inline label > select {
    flex: 0 0 auto; height: auto; }
  form.inline > label { flex: 1 1 140px; min-width: 0; }
  /* The period chips (work marks, the plan) wrap instead of running off the screen. */
  .pa-period .pa-chips { flex-wrap: wrap; overflow: visible; }
  /* Grids of days (the calendar, the roster, the timesheet) stay grids: the
   * box scrolls sideways, the names stay in view (client-view audit 4, 5). */
  table.grid.cal, table.grid.tabele { display: table; border-collapse: collapse; background: var(--panel);
                                      border: 1px solid var(--line); border-radius: var(--radius-sm); }
  table.grid.cal thead, table.grid.tabele thead { display: table-header-group; }
  table.grid.cal tbody, table.grid.tabele tbody { display: table-row-group; }
  table.grid.cal tr, table.grid.tabele tr { display: table-row; padding: 0; margin: 0; border: 0;
                                            background: transparent; }
  table.grid.cal td, table.grid.cal th, table.grid.tabele td, table.grid.tabele th {
    display: table-cell; padding: 4px; border-bottom: 1px solid var(--line); font-size: 12px; }
  table.grid.cal td::before, table.grid.tabele td::before { content: none; }
  table.grid.cal td:empty, table.grid.tabele td:empty { display: table-cell; }
  table.grid.cal { table-layout: fixed; width: 100%; }
  table.grid.cal td { height: auto; text-align: center; vertical-align: top; overflow-wrap: normal; }
  table.grid.cal td b { display: block; }
  table.grid.cal td small, table.grid.cal td br { display: none; }
  table.grid.cal td span { display: block; font-size: 11px; }
  .scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.grid.tabele { width: max-content; }
  table.grid.tabele td:first-child, table.grid.tabele th:first-child {
    position: sticky; left: 0; z-index: 1; background: var(--panel); max-width: 40vw; overflow-wrap: anywhere; }
}

/* ------------------------------ a client's own API keys (question 65) */
.card.secret-once { border-color: var(--red); }
.acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.acts details.act { flex: 0 1 auto; }
.acts details.act[open] { flex: 1 1 100%; padding: 8px 16px; border: 1px solid var(--line);
                          border-radius: var(--radius); background: var(--panel); }
.acts details.act summary { cursor: pointer; font-size: 12px; font-weight: bold; text-transform: uppercase;
                            letter-spacing: 1px; color: var(--soft); padding: 4px 12px;
                            border: 1px solid var(--line); border-radius: var(--pill); display: inline-block; }
.acts details.act[open] summary { margin-bottom: 8px; }
table.grid tr.sub td { background: var(--panel-2); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 16px 12px; margin: 0;
           min-width: 0; }
legend { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); padding: 0 4px; }
p.row { display: flex; flex-wrap: wrap; gap: 8px; }
/* A row that failed (an import line that will not be made, a refused API call). */
table.grid tr.bad td { color: var(--bad-fg); }
table.grid tr.bad td:first-child { border-left: 3px solid var(--bad); }
@media (max-width: 700px) {
  table.grid tr.bad { border-left-color: var(--bad); }
  table.grid tr.sub { background: var(--panel); }
  .acts details.act { flex: 1 1 100%; }
  .acts details.act summary { display: block; text-align: center; }
  p.row .btn { flex: 1 1 100%; justify-content: flex-start; }
  code.secret { font-size: 15px; letter-spacing: 1px; }
}

/* ------------------------- a client's own people (question 65): phone fixes */
/* A narrow field that carries its own label (a placeholder) or a password: room for it. */
input.narrow[placeholder]:not([type=number]), input.narrow[type=password] { width: 12em; }
@media (max-width: 700px) {
  table.grid.users td { grid-column: 1 / -1; }
  table.grid td select, table.grid td input:not([type=checkbox]):not([type=radio]) { max-width: 100%; }
  .card form.inline { max-width: 100%; }
  form.inline input.narrow:not([type=number]) { width: auto;
    flex: 1 1 140px; min-width: 0; }
  form.inline input[type=file] { max-width: 100%; }
}

/* ------------------------------------ planned and actual (question 63) */
/* /attendance/plan: a person x day grid (pks/webplanactual.py).  Red only
 * for what needs action (a missing mark, an absence) and for a negative
 * difference; amber late / early; the info colour overtime; green leave.
 * Every state also has its text and its own icon: colour is never alone.
 * Desktop: the grid with a sticky person column (totals in it, so they are
 * never off-screen); month view = compact cells; tablet: the grid scrolls
 * sideways inside its box; phone: a card per person and day. */
table.pa, .pa-kpis, .pa-detail, .pa-legend { --neg: #ff6b7a; --shade: #2c2d32; }
:root[data-theme=light] table.pa, :root[data-theme=light] .pa-kpis, :root[data-theme=light] .pa-detail,
:root[data-theme=light] .pa-legend { --neg: #DB1E35; --shade: #EBE9E8; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) table.pa, :root:not([data-theme]) .pa-kpis, :root:not([data-theme]) .pa-detail,
  :root:not([data-theme]) .pa-legend { --neg: #DB1E35; --shade: #EBE9E8; }
}
.pa-period { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: var(--gap); }
.pa-period .pa-label { font-size: 18px; color: var(--strong); min-width: 136px; text-align: center; }
.pa-period .pa-chips { margin: 0; }
.pa-ftoggle { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
main label.pa-fbtn.btn { display: none; }
.pa-kpis { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 12px; }
/* the icon sits by the label, bottom right: a month's "10560:00" keeps the whole width */
.pa-kpis .kpi .v { font-size: 20px; white-space: nowrap; }
.pa-kpis .kpi svg.kpi-ic { width: 18px; height: 18px; top: auto; bottom: 12px; right: 12px; }
.pa-kpis .kpi .l, .pa-kpis .kpi .small { padding-right: 20px; }
.pa-kpis .kpi .small { font-size: 11px; }
.pa-kpis a.kpi.on { border-color: var(--red); }
.pa-kpis .kpi.bad .v { color: var(--neg); }
.pill svg.ic { width: 12px; height: 12px; vertical-align: -2px; margin-right: 4px; }
.pill.pa-pill i, .pill.pa-pend i { font-style: normal; }
.pa-legend { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 var(--gap); }
.pa-legend a.pa-lg.on .pill { outline: 2px solid var(--red); outline-offset: 1px; }
.neg, .pa-diff.neg, .pa-x.neg { color: var(--neg); }
.pa-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line);
             border-radius: var(--radius); background: var(--panel); margin-bottom: var(--gap); max-height: 78vh; }
table.pa { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12px; }
table.pa th, table.pa td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 0;
                           vertical-align: top; text-align: left; }
table.pa thead th { position: sticky; top: 0; z-index: 2; background: var(--panel-2); color: var(--muted);
                    font-size: 11px; text-transform: uppercase; letter-spacing: .5px; padding: 8px; white-space: nowrap; }
table.pa thead th.d.we, table.pa thead th.d.hol { background: var(--shade); }
table.pa th.pa-who { position: sticky; left: 0; z-index: 1; background: var(--panel); min-width: 216px;
                     max-width: 248px; padding: 8px 12px; font-weight: normal; }
table.pa thead th.pa-who { z-index: 3; background: var(--panel-2); }
table.pa th.pa-who > a { font-weight: bold; color: var(--strong); }
table.pa th.pa-who small { display: block; color: var(--muted); font-size: 11px; }
.pa-sum { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 4px; color: var(--muted); }
.pa-sum b { color: var(--strong); }
.pa-diff { font-weight: bold; color: var(--ok-fg); }
progress.meter.pa-meter { display: block; height: 6px; margin-top: 6px; }
.pa-counts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.pa-counts .pill { padding: 1px 6px; }
td.pa-c { min-width: 112px; }
td.pa-c a.pa-open { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; color: var(--text);
                    min-height: 64px; }
td.pa-c a.pa-open:hover { background: var(--row-hover); color: var(--text); }
.pa-d, .pa-fw { display: none; }
.pa-p { color: var(--muted); font-size: 11px; white-space: nowrap; }
.pa-f { white-space: nowrap; }
.pa-w { font-weight: bold; font-size: 13px; color: var(--strong); }
.pa-x { font-size: 11px; font-weight: bold; }
.pa-pills { display: flex; flex-wrap: wrap; gap: 2px; }
.pa-pills .pill { font-size: 10px; padding: 1px 6px; }
td.pa-c.we, td.pa-c.hol { background: var(--shade); }
td.pa-c.s-missing, td.pa-c.s-absent { background: var(--bad-bg); box-shadow: inset 3px 0 0 var(--red); }
td.pa-c.s-late, td.pa-c.s-early { background: var(--warn-bg); }
td.pa-c.s-overtime { background: var(--info-bg); }
td.pa-c.s-leave { background: var(--ok-bg); }
td.pa-c.s-off .pa-w, td.pa-c.s-planned .pa-w, td.pa-c.s-planned .pa-p { color: var(--muted); font-weight: normal; }
td.pa-c.pa-dim a.pa-open { opacity: .35; }
main td.pa-c a.pa-fix.btn { display: none; }
.pa-x.pos { color: var(--muted); }
form.pa-filters select { max-width: 240px; }
.pa-closed svg.ic { width: 12px; height: 12px; color: var(--muted); margin-left: 4px; vertical-align: -2px; }
table.pa tr.pa-dept th, table.pa tr.pa-dept td, table.pa tr.pa-total th, table.pa tr.pa-total td { background: var(--panel-2); }
table.pa tr.pa-dept th.pa-who { font-weight: bold; color: var(--strong); }
table.pa tr.pa-total th.pa-who { font-weight: bold; color: var(--strong); }
td.pa-t { text-align: center; padding: 6px 4px; font-size: 11px; color: var(--muted); }
.pa-detail .pa-pills { margin: 0 0 8px; gap: 6px; }
.pa-detail .pa-pills .pill { font-size: 12px; padding: 2px 10px; }
.pa-detail .pa-locked { color: var(--muted); }
ul.pa-fixes { list-style: none; padding: 0; margin: 8px 0 0; }
/* month: 28-31 narrow columns - the worked time or a code and the state's icon */
table.pa-month td.pa-c { min-width: 36px; }
table.pa-month th.pa-who { min-width: 212px; }
table.pa-month tr.pa-row th.pa-who small, table.pa-month progress.meter.pa-meter { display: none; }
table.pa-month tr.pa-row th.pa-who small.pa-whole { display: block; }
table.pa-month .pa-sum { font-size: 11px; flex-wrap: nowrap; white-space: nowrap; }
table.pa-month .pa-p, table.pa-month .pa-f, table.pa-month .pa-x, table.pa-month .pa-pills .pill i { display: none; }
table.pa-month td.pa-c a.pa-open { align-items: center; padding: 6px 2px; min-height: 48px; }
table.pa-month .pa-pills { justify-content: center; }
table.pa-month .pa-pills .pill { padding: 1px 2px; background: transparent; }
table.pa-month .pa-pills .pill svg.ic { margin: 0; }
table.pa-month thead th.d { padding: 6px 2px; text-align: center; font-size: 10px; line-height: 1.3; }
table.pa-month .pa-w { font-size: 11px; }
@media (max-width: 1100px) {
  table.pa th.pa-who { min-width: 176px; }
  table.pa-week td.pa-c { min-width: 100px; }
}
@media (max-width: 700px) {
  main label.pa-fbtn.btn { display: inline-flex; flex-direction: row; margin-bottom: 8px; }
  .pa-ftoggle:not(:checked) ~ form.pa-filters { display: none; }
  .pa-period .pa-label { min-width: 0; flex: 1; }
  .pa-period .pa-chips { width: 100%; }
  .pa-kpis { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .pa-kpis .kpi { padding: 8px 10px; }
  .pa-kpis .kpi .v { font-size: 16px; padding-right: 0; }
  .pa-kpis .kpi .l { font-size: 9px; letter-spacing: .5px; padding-right: 0; }
  .pa-kpis .kpi svg.kpi-ic, .pa-kpis .kpi .small { display: none; }
  .pa-scroll { overflow: visible; border: 0; background: transparent; max-height: none; }
  table.pa, table.pa tbody, table.pa tr, table.pa th, table.pa td { display: block; width: auto; }
  table.pa thead { display: none; }
  table.pa th, table.pa td { border: 0; }
  table.pa th.pa-who { position: static; max-width: none; min-width: 0; border: 1px solid var(--line);
                       border-radius: var(--radius); background: var(--panel); margin: 0 0 8px; padding: 12px 16px; }
  table.pa tr.pa-row { margin-bottom: 24px; }
  table.pa td.pa-c { border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 8px;
                     background: var(--panel); min-width: 0; overflow: hidden; }
  table.pa td.pa-c.s-off, table.pa td.pa-c.s-none, table.pa td.pa-c.pa-dim { display: none; }
  table.pa td.pa-c a.pa-open, table.pa-month td.pa-c a.pa-open {
    display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 16px; align-items: start;
    min-height: 0; }
  table.pa .pa-d { display: block; font-weight: bold; color: var(--strong); grid-column: 1; grid-row: 1; }
  table.pa .pa-pills, table.pa-month .pa-pills { grid-column: 2; grid-row: 1; justify-content: flex-end; }
  table.pa-month .pa-pills .pill { padding: 1px 6px; }
  table.pa-month .pa-pills .pill svg.ic { margin-right: 4px; }
  table.pa .pa-p, table.pa .pa-f, table.pa-month .pa-p, table.pa-month .pa-f, table.pa-month .pa-pills .pill i {
    display: block; grid-column: 1; font-size: 14px; white-space: normal; }
  table.pa-month .pa-pills .pill i { display: inline; }
  table.pa .pa-p::before, table.pa .pa-f::before { content: attr(data-l) " "; color: var(--muted); }
  table.pa .pa-fw { display: inline; }
  table.pa .pa-w { display: none; }
  table.pa .pa-x, table.pa-month .pa-x { display: block; grid-column: 2; grid-row: 2 / span 2; font-size: 24px;
                                        align-self: center; text-align: right; }
  main td.pa-c a.pa-fix.btn { display: flex; justify-content: center; margin: 0 16px 12px; }
  form.pa-filters select { max-width: none; }
  table.pa .pa-x.pos { font-size: 16px; }
  table.pa tr.pa-dept td, table.pa td.pa-t { display: none; }
  table.pa tr.pa-dept th.pa-who, table.pa tr.pa-total th.pa-who { background: var(--panel-2); }
}
@media print {
  .pa-period, .pa-fbtn, .pa-legend, .pa-fix, .pa-kpis a.kpi svg { display: none !important; }
  .pa-scroll { overflow: visible; max-height: none; border: 0; }
  table.pa thead th, table.pa th.pa-who { position: static; }
  table.pa { font-size: 9pt; }
}

/* ======================================================= discrepancies (Q66)
 * /attendance/discrepancies (pks/webdirmode.py): a table on a desktop, one
 * card per discrepancy on a phone (the table.grid card rule above), the
 * day's marks as chips with the decided direction (an icon of its own for
 * in, out and undecided, never colour alone), a sticky "Accept the
 * selected" bar whose count comes from a CSS counter (no script).
 */
.sr, button.dm-default { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
                         clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.dm-mode { display: block; margin: 0 0 var(--gap); color: var(--muted); }
.dm-mode svg.ic { margin-right: 4px; }
details.dm-mode > summary { cursor: pointer; }
details.dm-mode ul { margin: 8px 0; padding-left: 24px; }
.dm-mode b { color: var(--strong); }
.dm-p { display: inline-flex; align-items: center; gap: 2px; margin: 0 8px 4px 0; white-space: nowrap;
        font-variant-numeric: tabular-nums; }
.dm-p svg.ic { width: 16px; height: 16px; }
.dm-p.in svg.ic { color: var(--ok-fg); }
.dm-p.out svg.ic { color: var(--info-fg); }
.dm-p.none svg.ic { color: var(--warn-fg); }
.pill.dm-kind { display: inline-flex; align-items: center; gap: 4px; }
.pill.dm-kind i { font-style: normal; }
.pill.dm-kind svg.ic { width: 14px; height: 14px; }
.dm-sub { display: block; font-size: 11px; margin-top: 2px; }
table.grid.dm td { vertical-align: top; }
table.grid.dm tr.open td:first-child { border-left: 3px solid var(--bad); }
table.grid.dm tr.changed td:first-child { border-left: 3px solid var(--warn); }
table.grid.dm tr.done td { color: var(--muted); }
/* A desktop keeps the actions a table cell: the generic .acts row (question 65) made it a flex box,
 * which parts the rows and their borders.  The tablet and phone cards below make it a flex row. */
@media (min-width: 1101px) {
  table.grid.dm td.acts { display: table-cell; white-space: normal; }
  table.grid.dm td.acts > * { margin: 0 8px 8px 0; vertical-align: top; }
}
@media (max-width: 1100px) {
  table.grid.dm td.acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
}
table.grid.dm td.dm-sel, table.grid.dm th.dm-sel { width: 32px; }
form.dm-form { counter-reset: dmsel; }
form.dm-form input[name=sel]:checked { counter-increment: dmsel; }
.dm-bar { position: sticky; bottom: 0; z-index: 4; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
          padding: 12px 16px; margin-top: 8px; background: var(--panel); border: 1px solid var(--line);
          border-radius: var(--radius); box-shadow: var(--shadow); }
.dm-count::after { content: counter(dmsel); font-weight: bold; color: var(--strong); margin-left: 4px; }
.dm-add { display: inline-flex; gap: 8px; align-items: center; }
.dm-add input[type=time] { width: auto; min-width: 136px; }
details.dm-just { display: inline-block; }
details.dm-just > summary { list-style: none; }
details.dm-just > summary::-webkit-details-marker { display: none; }
details.dm-just[open] { display: flex; flex-direction: column; gap: 8px; flex-basis: 100%; }
details.dm-just textarea { width: 100%; min-height: 48px; }
.dm-close { padding: 8px 16px; margin: 0 0 8px; border-radius: var(--radius-sm); background: var(--warn-bg);
            color: var(--warn-fg); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dm-close a { color: inherit; font-weight: bold; }
.pill.pa-dm i { font-style: normal; margin-left: 2px; }
.dm-day .dm-item { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 0;
                   border-top: 1px solid var(--line); }
.dm-day .dm-item:first-of-type { border-top: 0; }
.dm-day form.dm-acts { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; margin: 0; }
.dm-preview { margin: var(--gap) 0; }
fieldset.dm-presets { border: 0; padding: 0; margin: 0; display: grid; gap: 8px;
                      grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
fieldset.dm-presets legend { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted);
                             margin-bottom: 8px; }
fieldset.dm-presets label.check { align-items: flex-start; }
fieldset.dm-presets label.check input { margin-top: 2px; }
fieldset.dm-presets label.check small { display: block; margin-top: 2px; }
form.dm-card-form { margin-top: var(--gap); }
.dm-steps { display: grid; gap: 8px 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dm-steps p { grid-column: 1 / -1; margin: 0; }
a.btn.dm-link .badge { vertical-align: 0; }
.pa-kpis .kpi.dm-kpi svg.kpi-ic { top: 12px; bottom: auto; }           /* its one long word needs the width */
.pa-kpis .kpi.dm-kpi .l { padding-right: 0; }
/* A tablet: the discrepancies as cards too (the table would scroll sideways past its buttons). */
@media (min-width: 701px) and (max-width: 1100px) {
  table.grid.dm, table.grid.dm tbody { display: block; width: 100%; background: transparent; border: 0; }
  table.grid.dm thead { display: none; }
  table.grid.dm tr { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 8px 16px; position: relative;
                     background: var(--panel); border: 1px solid var(--line); border-left-width: 4px;
                     border-radius: var(--radius); padding: 12px 48px 12px 16px; margin-bottom: 8px; }
  table.grid.dm tr.open { border-left-color: var(--bad); }
  table.grid.dm tr.changed { border-left-color: var(--warn); }
  table.grid.dm td { display: block; padding: 0; border: 0; min-width: 0; }
  table.grid.dm td::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: 10px;
                             text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
  table.grid.dm td[data-label=""]::before, table.grid.dm td.acts::before { content: none; }
  table.grid.dm td.dm-sel { position: absolute; top: 12px; right: 16px; width: auto; }
  table.grid.dm td.acts { grid-column: 1 / -1; padding-top: 8px; border-top: 1px solid var(--line); }
  table.grid.dm tr:hover td { background: transparent; }
  table.grid.dm tr td:first-child { border-left: 0 !important; }
}
@media (max-width: 700px) {
  table.grid.dm tr { grid-template-columns: 1fr; border-left-width: 4px; }
  table.grid.dm tr.open { border-left-color: var(--bad); }
  table.grid.dm tr.changed { border-left-color: var(--warn); }
  table.grid.dm td.dm-sel { position: absolute; right: 16px; }
  table.grid.dm tr { position: relative; }
  table.grid.dm td.acts > button, table.grid.dm td.acts > .btn, table.grid.dm td.acts > .dm-add,
  table.grid.dm td.acts > details.dm-just, .dm-day form.dm-acts > button, .dm-day form.dm-acts > .btn,
  .dm-day form.dm-acts > .dm-add, .dm-day form.dm-acts > details.dm-just { flex: 1 1 100%; }
  table.grid.dm td.acts .dm-add button, .dm-day .dm-add button { flex: 1 1 auto; }
  details.dm-just > summary { display: flex; justify-content: center; }
  .dm-bar { flex-direction: column; align-items: stretch; }
  .dm-bar button { width: 100%; }
  .dm-steps { grid-template-columns: 1fr; }
}
@media print {
  .dm-bar, table.grid.dm td.acts, table.grid.dm .dm-sel { display: none !important; }
}

/* ------------------------------------------------ work marks (question 72) */
.wm-m { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; margin: 0 12px 4px 0; }
.wm-m svg.ic { width: 14px; height: 14px; align-self: center; }
.wm-m.start svg.ic, .wm-m.break_in svg.ic, .wm-m.overtime_in svg.ic { color: var(--ok-fg); }
.wm-m.end svg.ic, .wm-m.break_out svg.ic, .wm-m.overtime_out svg.ic { color: var(--info-fg); }
.wm-m.voided { color: var(--muted); }
.wm-m .wm-obj { flex-basis: 100%; font-size: 11px; }
q.wm-label { quotes: "«" "»"; color: var(--strong); }
.pill.wm-hand { font-size: 10px; }
.pill.wm-st { display: inline-flex; align-items: center; gap: 4px; }
.pill.wm-st i { font-style: normal; }
.pill.wm-st svg.ic { width: 14px; height: 14px; }
.wm-sub { display: block; font-size: 11px; margin-top: 2px; }
.wm-seen { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; }
.wm-seen svg.ic { width: 14px; height: 14px; }
table.grid.wm td { vertical-align: top; }
table.grid.wm tr.s-not_ended td:first-child { box-shadow: inset 3px 0 0 var(--bad-fg); }
table.grid.wm tr.s-no_start td:first-child { box-shadow: inset 3px 0 0 var(--warn-fg); }
table.grid.wm tr.s-at_work td:first-child { box-shadow: inset 3px 0 0 var(--ok-fg); }
.wm-now h2 { display: flex; align-items: center; gap: 8px; }
ul.wm-now-list { list-style: none; margin: 0 0 8px; padding: 0; columns: 3 240px; column-gap: 24px; }
ul.wm-now-list li { break-inside: avoid; padding: 4px 0; border-bottom: 1px solid var(--line); }
.wm-since { font-weight: bold; }
form.wm-filters label.check { align-self: center; }
@media (max-width: 700px) {
  table.grid.wm tr.s-not_ended { border-left-color: var(--bad-fg); }
  table.grid.wm tr.s-no_start { border-left-color: var(--warn-fg); }
  table.grid.wm tr.s-at_work { border-left-color: var(--ok-fg); }
  table.grid.wm tr td:first-child { box-shadow: none; }
  table.grid.wm td.wm-ms { grid-column: 1 / -1; }
  ul.wm-now-list { columns: 1; }
}

/* ------------------------------------------------ visitor pass (map 208) */
body.passpage { background: #fff; color: #111; padding: 16px; }
.pass { width: 86mm; height: 54mm; box-sizing: border-box; border: 1px solid #999; border-radius: 3mm; padding: 3mm 4mm;
        margin: 0 0 6mm; overflow: hidden; background: #fff; color: #111; font-size: 9pt; }
.pass p { margin: 0 0 1mm; }
.pass .pass-logo { max-height: 8mm; max-width: 40mm; display: block; margin-bottom: 2mm; }
.pass .pass-row { display: flex; gap: 3mm; align-items: flex-start; }
.pass .pass-photo { width: 22mm; height: 28mm; object-fit: cover; border-radius: 1mm; background: #eee; flex: none; }
.pass .pass-kind { font-size: 7pt; letter-spacing: .12em; color: #666; }
.pass .pass-name { font-size: 12pt; font-weight: 700; }
.pass .pass-code { font-size: 18pt; font-weight: 700; letter-spacing: .1em; }
.pass canvas { width: 24mm; height: 24mm; flex: none; }
@media print {
  body.passpage { padding: 0; }
  .pass { break-after: page; margin: 0; border-color: #ccc; }
}

/* Support requests (decisions question 69): the honeypot field people never see (off the page, not
   display:none, which some programs skip), a message shown as it was typed and wrapped at phone width */
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.sr-text { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; margin: 0; }
.sr-call { font-size: 1.15em; font-weight: 600; }
.sr-call a { white-space: nowrap; }

/* Exports (decisions question 75, pks/webexports.py): one card per file, side by side where there is room,
   one under another on a phone; the columns list in two columns on a desktop */
.ex-files { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.ex-file h3 { margin-top: 0; }
.ex-file p:last-child { margin-bottom: 0; }
.ex-cols { columns: 2 320px; column-gap: 24px; padding-left: 20px; }
.ex-cols li { break-inside: avoid; }
.ex-codes .row { flex-wrap: wrap; gap: 8px; }

/* ------------------------------ the roster by object (question 76, pks/webroster.py) */
.ro-table th small { display: block; font-weight: normal; font-size: 9px; color: var(--muted); }
.ro-table td.away { background: rgba(200,16,46,.08); }
.ro-table td.warn { box-shadow: inset 0 0 0 2px var(--warn); }
.ro-table tfoot td { font-size: .85em; color: var(--muted); border-top: 2px solid var(--line); }
.ro-b { display: inline-flex; align-items: center; gap: 2px; font-size: 10px; line-height: 1.1; white-space: nowrap;
        color: var(--muted); margin-left: 2px; }
.ro-table .ro-b { display: flex; margin: 2px 0 0; }
.ro-b svg.ic { width: 11px; height: 11px; }
.ro-b.away { color: var(--bad-fg); }
.ro-b.warn { color: var(--warn-fg); }
.ro-b i { font-style: normal; }
.ro-at { display: block; font-size: 9px; color: var(--muted); white-space: nowrap; }
.ro-save { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: var(--gap) 0; }
.ro-add { margin-top: 8px; }
.ro-cards { display: none; }
.ro-lines { list-style: none; margin: 0; padding: 0; }
.ro-lines .ro-line { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; justify-content: space-between;
                     padding: 8px 0; border-bottom: 1px solid var(--line); }
.ro-lines .ro-who small { display: block; }
.ro-lines .ro-ctl { display: flex; align-items: center; gap: 8px; }
.ro-tools h3 { margin: 16px 0 8px; font-size: 14px; }
@media (max-width: 700px) {
  /* the month as a card per day: no sideways scroll on a phone; ?day= edits one day */
  .ro-grid { display: none; }
  .ro-cards { display: grid; gap: 8px; margin-bottom: var(--gap); }
  .ro-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
  .ro-card.we { border-left: 4px solid var(--warn); }
  .ro-card .ro-card-h { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
  .ro-card .ro-card-h .btn { margin-left: auto; }
  .ro-card ul { margin: 6px 0 0; padding-left: 18px; }
  .ro-card li { margin: 2px 0; }
  .ro-lines .ro-line { flex-direction: column; align-items: stretch; }
  .ro-lines .ro-ctl select { flex: 1 1 auto; }
}
/* Planning advice on the roster grids (question 77, pks/webcompliance.py): a mark on the cell, a badge with the
   article, a count per person, the list card, the panel before a save. */
.ro-table td.cp-risk, .roster td.cp-risk { background: var(--bad-bg); }
.ro-table td.cp-warning, .roster td.cp-warning { background: var(--warn-bg); }
.ro-table td.cp-info, .roster td.cp-info { background: var(--info-bg); }
.roster .ro-b.cp { display: flex; margin: 2px 0 0; }
.ro-b.cp-risk { color: var(--bad-fg); }
.ro-b.cp-warning { color: var(--warn-fg); }
.ro-b.cp-info { color: var(--info-fg); }
.cp-sum { display: inline-flex; gap: 6px; font-size: 11px; margin-left: 6px; vertical-align: middle; }
.cp-sum span { display: inline-flex; align-items: center; gap: 2px; }
.cp-sum svg.ic { width: 12px; height: 12px; }
.cp-sum .cp-risk { color: var(--bad-fg); }
.cp-sum .cp-warning { color: var(--warn-fg); }
.cp-sum .cp-info { color: var(--info-fg); }
.pill.cp-pill { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.pill.cp-pill i { font-style: normal; }
.pill.cp-pill svg.ic { width: 13px; height: 13px; }
.cp-counts { font-size: 13px; }
.cp-items { list-style: none; margin: 4px 0 8px; padding: 0; }
.cp-item { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--line); }
.cp-item.accepted { opacity: .65; }
.cp-item .cp-acc { flex-basis: 100%; display: inline-flex; align-items: center; gap: 4px; }
.cp-item .cp-acc svg.ic { width: 12px; height: 12px; }
.cp-person summary { cursor: pointer; margin-top: 8px; }
.cp-panel .cp-person { margin: 12px 0; }
.cp-confirm { display: grid; gap: 12px; margin-top: 12px; }
.cp-confirm .row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.cp-legal { margin-top: 12px; }
/* The contact card on a phone: one column, the key over its value, and a
 * number or the form's address wraps rather than runs off (the owner's walk). */
@media (max-width: 480px) {
  table.kv.stack, table.kv.stack tbody, table.kv.stack tr, table.kv.stack th, table.kv.stack td {
    display: block; width: 100%; }
  table.kv.stack th { padding: 8px 0 0; white-space: normal; }
  table.kv.stack td { padding: 0 0 4px; overflow-wrap: anywhere; }
  table.kv.stack .sr-call a { white-space: normal; }
}

/* 06.11: a face photo from the computer's camera (webcam.js) */
.webcam video { display: block; width: 100%; max-width: 360px; border-radius: 8px; background: #000; }
