/* Colours from the ESCTL website (website/_includes/head_custom.html) and
   logo (website/assets/images/logo.svg, served from there at /ui/branding/):
   green #0f6e56, dark green #084a3b, amber #ef9f27, sage #b3c7b3. */
:root {
  --brand: #0f6e56; --brand-dark: #084a3b; --amber: #ef9f27; --sage: #b3c7b3;
  --bg: #f5f7f6; --panel: #ffffff; --text: #1d2a26; --muted: #5a6763; --line: #dbe3e0;
  /* an organisation's own colour (branding.py), set by app.js as --org-accent* */
  --accent: var(--org-accent, var(--brand)); --accent-hover: var(--org-accent-hover, var(--brand-dark)); --accent-text: #ffffff;
  --head: var(--panel); --head-text: var(--text); --nav-w: 217px;
  --ok: #0f6e56; --bad: #b42318; --warn: #94570a; --tint: rgba(15, 110, 86, 0.08); --zebra: rgba(15, 60, 45, 0.035);
  --chip: rgba(15, 60, 45, 0.06); --danger-bg: #b42318; --header-h: 56px;  /* measured by app.js */
  /* control edges (inputs, secondary buttons): 3:1 against the panel; a
     field's own background */
  --line-strong: #9fb0aa; --field: #ffffff;
  /* the scale (docs/development/ui-patterns.md, Look): sizes, spacing, radii, shadows
     come from here; no new literal values */
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 20px; --fs-2xl: 24px; --fs-stat: 28px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --r-sm: 4px; --r-md: 6px; --r-lg: 10px; --r-full: 999px;
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, .16); --shadow-dlg: 0 16px 48px rgba(0, 0, 0, .28);
  --ctl-h: 34px; --ease: .12s ease;
  --signin-tint: rgba(10, 20, 17, .10);  /* over the sign-in photo (#222) */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1513; --panel: #16201d; --text: #e3ebe8; --muted: #9aaba5; --line: #263530;
    --accent: var(--org-accent-dark, #3fae8c); --accent-hover: var(--org-accent-dark-hover, #5cc4a3); --accent-text: #06120e;
    --ok: #5fcf9f; --bad: #ff8a80; --warn: var(--amber);
    --tint: rgba(63, 174, 140, 0.12); --zebra: rgba(255, 255, 255, 0.03); --chip: rgba(255, 255, 255, 0.07);
    --line-strong: #4a6158; --field: #0e1513;
    --shadow-pop: 0 8px 24px rgba(0, 0, 0, .5); --shadow-dlg: 0 16px 48px rgba(0, 0, 0, .6);
    --signin-tint: rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
/* the typeface (docs/development/ui-patterns.md, Look): Inter, served with the UI
   (fonts/, made by tools/make-font.sh); the system's font until it loads */
@font-face { font-family: "Inter"; src: url("fonts/inter-4.1-latin.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: var(--fs-md)/1.45 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); }
header { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding: 8px 20px;
  background: var(--head); color: var(--head-text); position: sticky; top: 0; z-index: 1;
  border-bottom: 1px solid var(--line); }
button, input, select, textarea { font-family: inherit; }
.brand { display: flex; align-items: center; }
.brand img { display: block; height: 36px; width: auto; border-radius: 4px; }
.spacer { flex: 1; }
/* layout: the menu down the left, the page beside it */
.shell { display: flex; align-items: flex-start; min-height: calc(100vh - var(--header-h));
  background: linear-gradient(to right, var(--panel) calc(var(--nav-w) - 1px), var(--line) calc(var(--nav-w) - 1px), var(--line) var(--nav-w), transparent var(--nav-w)); }
#nav { flex: 0 0 var(--nav-w); position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); display: flex; flex-direction: column; }
/* the items scroll in a short window; the foot (Fold the menu) stays at the window's bottom, below them */
.nav-scroll { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.nav-items { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 10px; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: transparent transparent; }
.nav-items:hover { scrollbar-color: var(--line-strong) transparent; }  /* thin, and only on hover */
body.nav-rail .nav-items { scrollbar-width: none; }  /* the rail: the fades and arrows say there's more */
/* browsers without scrollbar-width (older Safari): the same, by their own rules */
.nav-items::-webkit-scrollbar { width: 6px; }
.nav-items::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; }
.nav-items:hover::-webkit-scrollbar-thumb { background: var(--line-strong); }
body.nav-rail .nav-items::-webkit-scrollbar { display: none; }
/* more above or below (navScroll): a fade, and an arrow that scrolls to it */
.nav-more { position: absolute; left: 0; right: 1px; height: 30px; display: flex; justify-content: center; cursor: pointer; color: var(--muted); z-index: 1; }
.nav-more.up { top: 0; align-items: flex-start; padding-top: 2px; background: linear-gradient(var(--panel) 40%, transparent); }
.nav-more.down { bottom: 0; align-items: flex-end; padding-bottom: 2px; background: linear-gradient(transparent, var(--panel) 60%); }
.nav-more.up .icon { transform: rotate(180deg); }
.nav-more .icon { width: 16px; height: 16px; stroke-width: 2; }
.nav-more:hover { color: var(--accent); }
.nav-foot { flex: none; padding: 6px 10px; border-top: 1px solid var(--line); }
.nav-section { margin-bottom: 14px; }
.nav-head { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0 10px 4px; }
#nav a { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--text);
  text-decoration: none; padding: 6px 10px; border-radius: var(--r-md); transition: background-color var(--ease); }
#nav a > .icon { flex: none; width: 18px; height: 18px; stroke-width: 1.5; color: var(--muted); }
#nav a:hover > .icon, #nav a.active > .icon { color: var(--accent); }
#nav a > .nav-label { flex: 1; min-width: 0; }
/* the menu's foot: fold it to its icons (wide screens) */
.nav-fold { display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 10px;
  background: none; border: 0; border-radius: var(--r-md); color: var(--muted); font-weight: 400; justify-content: flex-start; height: auto; }
.nav-fold:hover:not(:disabled) { color: var(--text); background: var(--tint); }
.nav-fold .icon { flex: none; width: 18px; height: 18px; stroke-width: 1.5; transition: transform var(--ease); }
/* the menu's right edge: a handle to click or drag (navEdge) */
.nav-edge { position: absolute; top: 0; bottom: 0; right: -4px; width: 8px; z-index: 2; cursor: col-resize; touch-action: none; }
.nav-edge::after { content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; background: transparent; transition: background-color var(--ease); }
.nav-edge:hover::after, .nav-edge.dragging::after { background: var(--accent); }
/* the rail: the menu as its icons, each named in a tip beside it (navTip) */
body.nav-rail { --nav-w: 57px; }
body.nav-rail .nav-items, body.nav-rail .nav-foot { padding-left: 8px; padding-right: 8px; }
body.nav-rail #nav .nav-head { display: none; }
body.nav-rail #nav .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body.nav-rail #nav .nav-section { margin-bottom: 0; }
body.nav-rail #nav .nav-section + .nav-section { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
body.nav-rail #nav a, body.nav-rail .nav-fold { justify-content: center; padding: 8px 0; }
body.nav-rail .nav-fold .icon { transform: rotate(180deg); }
body.nav-rail #nav a .nav-badge { position: absolute; top: 1px; right: 1px; min-width: 15px; padding: 0 3px; font-size: 10px; line-height: 15px; }
body.nav-rail #nav a .nav-badge:not(.total) { background: var(--panel); }
.nav-tip { position: fixed; z-index: 60; padding: 4px 8px; border-radius: var(--r-sm); background: var(--text); color: var(--bg);
  font-size: var(--fs-sm); white-space: nowrap; pointer-events: none; transform: translateY(-50%); box-shadow: var(--shadow-pop); }
#nav a:hover { background: var(--tint); }
#nav a.active { background: var(--tint); color: var(--accent); font-weight: 600; }
#nav a.active::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 2px; background: var(--accent); }
.nav-signout { display: none; }
.menu-btn { display: none; background: transparent; border-color: var(--line-strong); color: var(--head-text); padding: 5px 7px; line-height: 0; }
.menu-btn .icon { width: 20px; height: 20px; stroke-width: 1.8; }
@media (max-width: 820px) {
  .menu-btn { display: inline-block; }
  .shell { display: block; background: none; }
  /* fixed under the bar, so it opens where the button is however far the page is scrolled */
  #nav { display: none; position: fixed; top: var(--header-h); left: 0; right: 0; z-index: 2; height: auto;
    max-height: calc(100dvh - var(--header-h)); overflow-y: auto; overscroll-behavior: contain;
    background: var(--panel); border-bottom: 1px solid var(--line); box-shadow: 0 8px 16px rgb(0 0 0 / .15); }
  .nav-foot, .nav-edge, .nav-more { display: none; }
  .nav-scroll { display: block; }  /* the menu opens under the bar, named in full (navRail) */
  body.menu-open #nav { display: block; }
  .who-roles { display: none; }
}
@media (max-width: 480px) {
  header { flex-wrap: nowrap; gap: 10px; padding: 8px 14px; }
  .brand img { height: 30px; }
  .who { gap: 8px; min-width: 0; }
  #who { min-width: 0; }
  .who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* Sign out moves into the menu: room for the site's and operator's names */
  #logout { display: none; }
  .nav-signout { display: block; padding: var(--sp-2) 10px 0; border-top: 1px solid var(--line); }
  .nav-signout button { width: 100%; }
}
.who { display: flex; align-items: center; gap: 14px; }
#who { display: flex; flex-direction: column; line-height: 1.2; color: var(--head-text); text-decoration: none;
  padding: 4px 8px; border-radius: 6px; text-align: right; }
#who:hover, #who.active { background: var(--tint); }
#who.active { box-shadow: inset 0 -2px 0 var(--accent); }
.who-name { font-weight: 600; }
.who-roles { font-size: 12px; color: var(--muted); }
header button.link { color: var(--accent); text-decoration: underline; }
.login-logo { text-align: center; margin: 4px 0 14px; }
.login-logo img { height: 64px; width: auto; border-radius: 6px; }
a { color: var(--accent); }
main { padding: 20px; max-width: 1200px; margin: 0 auto; }
.shell main { flex: 1; min-width: 0; margin: 0; }
@media (max-width: 820px) { main { padding: 14px; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-4) 20px;
  margin-bottom: var(--sp-4); }
.narrow { max-width: 380px; margin-top: 10vh; }
/* the sign-in background (#222; app.js applyBrand sets --signin-bg): wider
   screens only, so phones don't fetch it; a tint keeps it quiet, darker in
   the dark theme; the card keeps its own solid panel */
@media (min-width: 821px) {
  body.signin-photo:has(> #login:not([hidden])) {
    /* the body's background fills the whole window: no height of its own
       (with the card's top margin it would scroll into nothing) */
    background: linear-gradient(var(--signin-tint), var(--signin-tint)), var(--signin-bg) center / cover no-repeat fixed, var(--bg); }
  body.signin-photo #login { box-shadow: var(--shadow-dlg); border-color: transparent; }
}
/* the sign-in background picker (Organisation settings): thumbnails as radios */
.bg-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--sp-2); margin-top: var(--sp-1); }
.bg-choice { display: grid; gap: var(--sp-1); cursor: pointer; font-weight: 400; position: relative; }
.bg-choice input { position: absolute; opacity: 0; }
.bg-choice img, .bg-plain { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--r-md);
  border: 2px solid var(--line); background: var(--bg); display: block; box-sizing: border-box; }
.bg-choice:hover img, .bg-choice:hover .bg-plain { border-color: var(--line-strong); }
.bg-choice input:checked ~ img, .bg-choice input:checked ~ .bg-plain { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.bg-choice input:focus-visible ~ img, .bg-choice input:focus-visible ~ .bg-plain { outline: 2px solid var(--accent); outline-offset: 2px; }
.bg-name { font-size: var(--fs-sm); }
.bg-choice input:checked ~ .bg-name { font-weight: 600; }
.bg-preview { height: 40px; width: 64px; object-fit: cover; border-radius: var(--r-sm); vertical-align: middle; border: 1px solid var(--line); }
h1 { font-size: var(--fs-2xl); font-weight: 650; letter-spacing: -.01em; margin: 0 0 var(--sp-4); }
h2 { font-size: var(--fs-lg); font-weight: 600; margin: 0 0 10px; }
h3 { font-size: var(--fs-md); font-weight: 600; }
/* a field's label is text, its hint muted (forms and dialogs) */
label { display: block; margin: var(--sp-2) 0; color: var(--text); font-size: var(--fs-sm); font-weight: 600; }
label.inline, .row label.inline, label:has(> input[type=checkbox]), label:has(> input[type=radio]) { font-size: var(--fs-md); font-weight: 400; }
input, select, textarea { display: block; width: 100%; margin-top: var(--sp-1); padding: 7px 9px; border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background: var(--field); color: var(--text); font: inherit; font-size: var(--fs-md); font-weight: 400;
  transition: border-color var(--ease); }
input:hover:not(:disabled):not(:focus), select:hover:not(:disabled):not(:focus) { border-color: var(--muted); }
input:disabled, select:disabled { background: var(--bg); color: var(--muted); }
input:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.factor-row { align-items: center; }
.row label { flex: 1 1 150px; margin: 0; }
/* a field with a natural size (a date and time): never stretched to fill a
   line it has wrapped onto by itself */
.row label.fixed, .row label:has(> input[type="date"]), .row label:has(> input[type="datetime-local"]) { flex: 0 1 240px; }
button { padding: 7px 14px; border-radius: var(--r-md); border: 1px solid var(--accent); background: var(--accent);
  color: var(--accent-text); font: inherit; cursor: pointer;
  transition: background-color var(--ease), border-color var(--ease), color var(--ease); }
button:active:not(:disabled) { transform: translateY(1px); }
button:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
button.link:hover { background: var(--tint); }
button.secondary { background: transparent; color: var(--text); border-color: var(--line-strong); }
button.secondary:hover:not(:disabled) { background: var(--tint); border-color: var(--accent); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }
button.link:active { transform: none; }
button:disabled { opacity: .5; cursor: default; }
/* lists: lined up with the card's heading (the hover tint keeps its padding) */
.table-wrap { overflow-x: auto; margin-inline: -10px; container: tbl / inline-size; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: var(--fs-xs);
  border-bottom-color: color-mix(in srgb, var(--muted) 45%, transparent); }
/* a name in a list is semibold in the accent colour, underlined on hover
   or focus; a link in a sentence stays underlined (docs/development/ui-patterns.md) */
td a:not(.btn):not(.port-tag), .tag a { text-decoration: none; }
td a:not(.btn):not(.port-tag) { font-weight: 600; }
td .small a, td p a, td .hint a { font-weight: inherit; text-decoration: underline; }
td a:not(.btn):hover, td a:not(.btn):focus-visible, .tag a:hover, .tag a:focus-visible { text-decoration: underline; }
td.num { font-variant-numeric: tabular-nums; }
.tag { display: inline-block; padding: 1px 7px; border-radius: var(--r-sm); font-size: var(--fs-xs);
  border: 1px solid transparent; background: var(--chip); margin: 0 4px 2px 0; }
.tag.src { font-size: 11px; color: var(--muted); margin: 0; vertical-align: 1px; }
tbody tr:hover { background: var(--tint); }
tbody tr { transition: background-color var(--ease); }
.ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.muted, .hint { color: var(--muted); }
.error { color: var(--bad); min-height: 1.2em; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(max(170px, calc((100% - 3 * var(--sp-3)) / 4)), 1fr)); gap: var(--sp-3); }
.stat { font-size: var(--fs-stat); font-weight: 650; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--accent); margin-top: 2px; }
.stat.zero { color: var(--muted); font-weight: 500; }
.grid .card { margin: 0; }
/* the overview's tiles in groups named as the menu's: side by side while
   they fit, each as wide as its tiles; a group's heading folds it, and
   folded it says its numbers in a line */
.stat-groups { display: flex; flex-wrap: wrap; gap: 14px 20px; margin-bottom: 16px; }
.stat-group { flex: 2 1 352px; min-width: 0; }
.stat-group.tiles-1 { flex: 1 1 170px; } .stat-group.tiles-3 { flex: 3 1 534px; }
.stat-group > summary { display: flex; align-items: baseline; gap: 10px; padding: 0 2px 6px; margin-bottom: 8px; border-bottom: 2px solid var(--line);
  cursor: pointer; list-style: none; }
.stat-group > summary::-webkit-details-marker { display: none; }
.stat-group > summary::before { content: ""; width: 7px; height: 7px; border: solid var(--muted); border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-2px, -2px); align-self: center; transition: transform .15s; }
.stat-group:not([open]) > summary::before { transform: rotate(-45deg); }
.stat-group:not([open]) > summary { margin-bottom: 0; }
.stat-group-title { font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.stat-brief { font-size: 13px; color: var(--muted); }
.stat-group[open] .stat-brief { display: none; }
.stat-group .grid { margin: 0; }
/* a group with a problem: its heading in the worst tile's colour, and its
   line of numbers when folded, so folding hides nothing */
.stat-group.worst-bad > summary { border-bottom-color: var(--bad); }
.stat-group.worst-bad .stat-group-title, .stat-group.worst-bad:not([open]) .stat-brief { color: var(--bad); }
.stat-group.worst-warn > summary { border-bottom-color: var(--warn); }
.stat-group.worst-warn .stat-group-title, .stat-group.worst-warn:not([open]) .stat-brief { color: var(--warn); }
code, .mono { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 0.9em; }
#toast { position: fixed; right: 16px; bottom: 16px; background: var(--text); color: var(--bg);
  padding: 10px 14px; border-radius: 8px; max-width: 90vw; }
pre.secret { white-space: pre-wrap; word-break: break-all; background: var(--bg); padding: 10px;
  border-radius: 6px; border: 1px dashed var(--amber); }

/* credential chips and icons */
.icon { vertical-align: -2px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.cred-keypad .icon circle { fill: currentColor; stroke: none; }
.cred { display: inline-flex; align-items: center; gap: 2px; }
.cred-card { color: var(--accent); }
.cred-ibutton { color: var(--muted); }
.cred-keypad { color: var(--warn); }
.cred .mono { color: var(--text); }
.cred .reveal { padding: 0 2px; color: var(--muted, #6b7d76); line-height: 1; }
.cred .reveal:hover { color: var(--accent); }
.cred .mono.revealed { background: var(--tint); border-radius: 3px; padding: 0 3px; }
button.link.add { font-size: 12px; margin-left: 4px; }
label.inline { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
label.inline input { width: auto; margin: 0; }
.secret-once { margin-top: 12px; padding: 12px 16px; border: 1px dashed var(--accent); border-radius: 8px; background: var(--tint); }
.secret-once .pin { font: 600 28px/1.2 ui-monospace, "SFMono-Regular", Menlo, monospace; letter-spacing: .2em; margin: 4px 0; }
td button + button { margin-left: 4px; }
.table-wrap + form.row, .table-wrap + .row { margin-top: 10px; }
.small { font-size: var(--fs-xs); }
/* a cell's notes wrap rather than widen the table (a narrow screen scrolls
   no list sideways); a short value that mustn't break says .nowrap */
td .small { white-space: normal; overflow-wrap: anywhere; }
td .small.nowrap, td .nowrap { white-space: nowrap; }
.mono.break { overflow-wrap: anywhere; }  /* a key fingerprint, an ID: breaks anywhere rather than widen a list */
td .pill { white-space: normal; }  /* a long state ("Unlocked at first card"): wraps in a narrow table */
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
/* a row has at most one labelled action; the rest are in its "⋯" menu */
td:has(> .actions) { width: 1%; padding-top: 5px; padding-bottom: 5px; }
td .actions { display: flex; flex-wrap: nowrap; justify-content: flex-end; align-items: center; gap: var(--sp-1); white-space: nowrap; }
td .actions button, td .actions a.btn { height: 30px; padding: 0 10px; display: inline-flex; align-items: center; }
@media (hover: hover) {
  tbody tr:not(:hover):not(:focus-within) td .actions :is(button.secondary, a.btn.secondary, .more-btn) { border-color: transparent; }
}
td .actions button + button { margin-left: 0; }
button.danger { background: var(--danger-bg); border-color: var(--danger-bg); color: #fff; }
button.danger:hover:not(:disabled) { background: var(--danger-bg); border-color: var(--danger-bg); filter: brightness(1.15); }

/* fields shared by page forms and dialogs */
.field { display: block; margin: 8px 0; color: var(--muted); }
.row .field { flex: 1 1 220px; margin: 0; }
.field-label { display: block; margin-bottom: 4px; }
.combo > input { width: 100%; }
.region-picker > div { margin: 8px 0; }
.recovery-codes { font-size: 15px; line-height: 1.7; padding: 10px 14px; background: var(--tint); border-radius: 6px; user-select: all; }
.totp-qr svg { width: 196px; height: 196px; background: #fff; padding: 6px; border-radius: 6px; }
.totp-qr.pair-qr svg { width: min(300px, 100%); height: auto; }  /* the app's pairing link: a denser code */
.pair-url { overflow-wrap: anywhere; word-break: break-all; }
.mfa-step { display: grid; gap: 10px; }
.page-scope { margin: calc(-1 * var(--sp-3)) 0 var(--sp-4); color: var(--muted); font-size: var(--fs-sm); }
@media (max-width: 480px) { .site-pick { max-width: 9em; min-width: 0; text-overflow: ellipsis; margin-right: 6px; } }
.retired-note { padding: 8px 12px; border-radius: 6px; background: var(--tint); color: var(--text); }
.menu-note { max-width: 18em; margin: 4px 8px; font-size: 12px; color: var(--muted); white-space: normal; }
.site-pick { width: auto; max-width: 14em; margin: 0 12px 0 0; padding: 4px 8px; font-weight: 600; }
header .site-pick:hover:not(:disabled) { border-color: var(--accent); }
.region-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 12px; }
.field-hint { display: block; font-size: var(--fs-xs); font-weight: 400; margin-top: 3px; color: var(--muted); }
.pw { position: relative; display: block; }
.pw input { padding-right: 34px; }
.pw .pw-eye { position: absolute; right: 8px; top: 50%; transform: translateY(calc(-50% + 2px)); color: var(--muted); line-height: 1; }
.pw .pw-eye:hover { color: var(--accent); background: none; }
.pw .pw-eye .icon { width: 16px; height: 16px; }

/* dialogs (native <dialog>) */
dialog.modal { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0; width: min(480px, calc(100vw - 32px));
  background: var(--panel); color: var(--text); box-shadow: var(--shadow-dlg); }
dialog.modal.wide { width: min(640px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(8, 20, 16, 0.45); }
.dialog-form { padding: 18px 22px 0; max-height: calc(100vh - 64px); overflow-y: auto; }
.dialog-form h2 { font-size: var(--fs-xl); font-weight: 650; }
.dialog-intro { color: var(--muted); margin-top: calc(-1 * var(--sp-1)); }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); margin: var(--sp-4) -22px 0; padding: var(--sp-3) 22px;
  position: sticky; bottom: 0; background: var(--panel); border-top: 1px solid var(--line); }
.dialog-form .error:empty { display: none; }

/* in-place edit */
.inline-edit { display: inline-flex; align-items: center; gap: 4px; }
.inline-edit input { margin: 0; padding: 3px 6px; min-width: 12em; }
.pencil { color: var(--muted); padding: 0 2px; opacity: 0; transition: opacity .1s; }
tr:hover .pencil, .pencil:focus-visible, .cred-wrap .pencil { opacity: 1; }
.pencil:hover { color: var(--accent); }
@media (hover: none) { .pencil { opacity: 1; } }

/* days of the week */
.days { display: flex; gap: 4px; flex-wrap: wrap; }
button.day { padding: 5px 0; width: 3.2em; background: transparent; color: var(--muted); border-color: var(--line); }
button.day.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.day:hover:not(:disabled) { border-color: var(--accent); }
button.day.on:hover:not(:disabled) { background: var(--accent-hover); }
.presets { display: flex; gap: 12px; align-items: baseline; margin-top: 6px; font-size: 13px; flex-wrap: wrap; }
.days-summary { margin-left: auto; }
.days-badges { display: inline-flex; gap: 2px; vertical-align: middle; }
.dbadge { display: inline-block; width: 1.5em; text-align: center; font-size: 11px; line-height: 1.6; border-radius: 4px;
  border: 1px solid var(--line); color: var(--muted); opacity: .55; }
.dbadge.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); opacity: 1; }
.when { white-space: normal; }  /* its text uses no-break spaces where it mustn't wrap */
.sched-summary { margin: 10px 0 0; padding: 8px 10px; background: var(--tint); border-radius: 6px; }

/* multi-value chips */
.chips-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--line-strong);
  border-radius: var(--r-md); background: var(--field); }
.chips-picker:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.chips-picker input { flex: 1 1 8em; border: 0; margin: 0; padding: 3px 4px; background: transparent; outline: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-size: 13px; }
.chip button { color: var(--muted); padding: 0 2px; line-height: 1; }
.who-field { display: flex; gap: 8px; flex-wrap: wrap; }
.who-field select, .who-field input { flex: 1 1 12em; width: auto; margin: 0; }

/* doors: readers and node ports */
.reader-rows { display: grid; gap: 6px; }
.reader-row { display: grid; grid-template-columns: minmax(10em, 1.2fr) 1fr minmax(8em, .8fr) auto; align-items: center; gap: 8px; }
.reader-row select, .reader-row input { margin: 0; }
.ports { min-width: 10em; display: flex; flex-direction: column; gap: 4px; }
.ports > div { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ports .tag { margin: 0; }
.ports .muted { min-width: 4.5em; }
.port-tag { display: inline-flex; align-items: center; gap: 5px; }
.port-tag .port-no { font: 600 11px/1.4 ui-monospace, "SFMono-Regular", Menlo, monospace; color: var(--muted);
  border-right: 1px solid var(--line); padding-right: 5px; }
.port-tag.unused { color: var(--muted); font-style: italic; background: transparent; }

/* profile */
dl.props { display: grid; grid-template-columns: minmax(8em, max-content) 1fr; gap: var(--sp-2) 18px; margin: 0; }
dl.props dt { max-width: 16em; }
/* a settings card: each setting on its own ruled line, its Change… at the
   right of its value rather than under it */
.card > dl.props > dt, .card > dl.props > dd { padding-top: 10px; border-top: 1px solid var(--line); }
.card > dl.props > dt:first-of-type, .card > dl.props > dd:first-of-type { padding-top: 0; border-top: 0; }
.card > dl.props > dd:has(> button) { display: grid; grid-template-columns: 1fr auto; column-gap: var(--sp-4); align-items: start; }
.card > dl.props > dd:has(> button) > * { grid-column: 1; }
.card > dl.props > dd:has(> button) > button { grid-column: 2; grid-row: 1 / span 4; align-self: start; padding: 4px 10px; }
@media (max-width: 600px) { .card > dl.props > dd:has(> button) { display: block; } .card > dl.props > dd:has(> button) > button { margin-top: 6px; }
  .card > dl.props > dd { border-top: 0; padding-top: 0; } }
dl.props dt { color: var(--muted); }
dl.props dd { margin: 0; }

/* simulate */
.sim-result { transition: opacity .15s; }
.sim-result.stale { opacity: .4; }
.sim-result.fresh { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--tint); } to { background: transparent; } }
.sim-head { margin-top: 12px; }

/* person picker: search-as-you-type dropdown */
.person-picker { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 14em; }
.person-picker > input { flex: 1 1 12em; margin: 0; }
.person-picker .chips:empty { display: none; }
.pp-list { position: absolute; top: 100%; left: 0; right: 0; z-index: 30; margin: 2px 0 0; padding: 4px 0; list-style: none;
  max-height: 16em; overflow-y: auto; background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18); }
.pp-list li { padding: 5px 10px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-list li.active { background: var(--tint); }
.pp-list li.pp-empty { cursor: default; }

/* paged lists */
.list-tools input[type=search] { min-width: 12em; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pager:empty { display: none; }
/* its width comes from the line it is in, not its contents: the NFC button's
   label changes while it reads, and the hint under it mustn't rewrap */
.token-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex: 1 1 18em; min-width: 0; }
.token-input .nfc { white-space: normal; text-align: left; }
.token-input select { flex: 0 1 auto; width: auto; margin: 0; }
.token-input input { flex: 1 1 10em; margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.nfc { white-space: nowrap; }
.group-members .list-tools { align-items: center; }
.member-list { list-style: none; margin: 4px 0 0; padding: 0; max-height: 22em; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; }
.member-list li { display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-bottom: 1px solid var(--line); }
.member-list li:last-child { border-bottom: 0; }
.member-list li > span:first-child { flex: 1 1 auto; }
.pager select { width: auto; margin: 0; }
.pager > button { min-width: 2.4em; }
.pager .page-of { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pager .page-box { display: inline-block; flex: 0 0 auto; width: 5.5em; margin: 0; padding: 4px 6px; text-align: right; }
.pager .jump { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; flex-wrap: wrap; }
.pager .jump label { display: inline-flex; align-items: center; gap: 6px; margin: 0; white-space: nowrap; }
.pager .jump-input { width: 11em; margin: 0; }
.pager .jump-input[type=datetime-local] { width: auto; }
.log-goto { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.log-goto[hidden] { display: none; }
@keyframes jump-hit { from { background: var(--tint); box-shadow: inset 3px 0 0 var(--accent); } to { background: transparent; box-shadow: none; } }
.jump-hit, .jump-hit > td { animation: jump-hit 3s ease-out; }

/* IDs */
td.id-col { width: 1%; white-space: nowrap; }
.id { font-size: 12px; }
.long-id { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.copy-id { padding: 0 2px; color: var(--muted); }
/* a record this operator can't change here (ownerLock in app.js) */
.owner-lock { display: inline-flex; margin-left: 6px; color: var(--muted); vertical-align: -1px; cursor: help; }
.owner-lock .icon { width: 13px; height: 13px; }

/* page furniture */
.head-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.person-actions { margin-bottom: 8px; }
a.btn { display: inline-block; padding: 7px 14px; border-radius: var(--r-md); border: 1px solid var(--accent); text-decoration: none;
  background: var(--accent); color: var(--accent-text); white-space: nowrap; }
a.btn.secondary { background: transparent; color: var(--text); border-color: var(--line-strong); }
a.btn:hover { background: var(--accent-hover); color: var(--accent-text); }
a.btn.secondary:hover { background: var(--tint); color: var(--text); border-color: var(--accent); }
td .actions a.btn { padding: 5px 10px; }
/* the "⋯" menu: a popover (top layer, placed by moreMenu() in app.js) */
.more-btn { display: inline-flex; align-items: center; gap: 6px; }
.more-btn .icon circle { fill: currentColor; stroke: none; }
td .more-btn { padding: 0 8px; }
.more-label { display: none; }
.card-head .more-label { display: inline; }
.more-menu[popover] { position: fixed; inset: auto; margin: 0; min-width: 12em; padding: 4px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
  max-height: calc(100vh - 16px); overflow-y: auto; }
.more-menu:popover-open { display: flex; flex-direction: column; gap: 1px; }
.more-menu button, .more-menu a.btn { width: 100%; text-align: left; margin: 0; padding: 7px 10px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text); white-space: nowrap; }
.more-menu button:hover:not(:disabled), .more-menu a.btn:hover { background: var(--tint); color: var(--text); }
.danger-text { color: var(--bad) !important; border-color: var(--bad) !important; }
.empty { padding: var(--sp-5) var(--sp-4); border-radius: var(--r-lg); background: var(--zebra); color: var(--muted); text-align: center; }
.empty .row, .empty .head-actions { justify-content: center; }
.all-clear { display: flex; align-items: center; gap: var(--sp-2); color: var(--muted); margin: var(--sp-1) 0; }
.all-clear .icon { color: var(--ok); width: 18px; height: 18px; stroke-width: 2.2; }
.empty p { margin: 0 0 8px; }
.empty p:last-child { margin: 0; }
.crumbs { margin: 0 0 8px; font-size: 13px; }
.filter-note { padding: 6px 10px; background: var(--tint); border-radius: 6px; }
.card.attention { border-left: 4px solid var(--amber); }
.sync-line { margin: 0 0 10px; padding: 6px 10px; border-radius: 6px; color: var(--warn);
  background: color-mix(in srgb, var(--amber) 12%, transparent); }
a.stat-card { display: block; color: inherit; text-decoration: none; }
a.stat-card:hover { border-color: var(--accent); }
.stat.warn { color: var(--warn); } .stat.bad { color: var(--bad); }
.getting-started ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.getting-started li { display: flex; gap: 10px; align-items: flex-start; }
.step-mark { flex: 0 0 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: inline-flex;
  align-items: center; justify-content: center; font-size: 13px; color: var(--accent-text); }
.step-mark .icon { stroke-width: 2.2; }
.getting-started li.done .step-mark { background: var(--accent); border-color: var(--accent); }
.getting-started li.done a { color: var(--muted); }
nav.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
nav.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
nav.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
ul.perm-list { margin: 0; padding-left: 18px; }
ul.perm-list li { margin: 1px 0; }
td.nowrap { white-space: nowrap; }
dl.glossary { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
dl.glossary dt { font-weight: 600; }
dl.glossary dd { margin: 0; }
@media (max-width: 600px) { dl.glossary, dl.props { grid-template-columns: 1fr; } dl.glossary dd, dl.props dd { margin-bottom: 6px; } }
ul.cred-list { list-style: none; margin: 0; padding: 0; }
ul.cred-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--line); }
ul.cred-list li:last-child { border-bottom: 0; }
.cred-actions { margin-left: auto; display: flex; gap: 12px; }
details.card-finder { margin: 4px 0 10px; }
details.card-finder > summary { cursor: pointer; color: var(--accent); margin-bottom: 6px; }
p.pin { font: 600 28px/1.2 ui-monospace, "SFMono-Regular", Menlo, monospace; letter-spacing: .2em; margin: 4px 0; }
.import-result:empty { display: none; }
label.inline select { width: auto; margin: 0; }
.dialog-intro ul { margin: 6px 0 4px; padding-left: 20px; }
.dialog-intro p { margin: 0 0 6px; }
#offline { position: fixed; left: 50%; transform: translateX(-50%); top: calc(var(--header-h) + 10px); z-index: 50; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 8px; background: var(--panel); border: 1px solid var(--amber); box-shadow: 0 6px 20px rgba(0, 0, 0, .2); max-width: calc(100vw - 24px); }
.login-note { padding: 8px 10px; border-radius: 6px; background: var(--tint); }
.login-alt { text-align: center; margin: 14px 0 4px; }
#invite-box .card { margin: 0 0 14px; box-shadow: none; }
.org-switch { margin-right: 12px; }
header .org-btn { color: var(--head-text); background: transparent; border: 1px solid var(--line-strong); padding: 4px 10px; }
header .org-btn:hover { background: var(--tint); color: var(--head-text); }
.org-btn { font-weight: 600; max-width: 16em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 480px) { .org-btn { max-width: 8em; } }

/* status pills: the state at a glance, in a column that lines up */
.pill { display: inline-block; padding: 1px 9px; border-radius: var(--r-full); font-size: var(--fs-xs); line-height: 1.6; white-space: nowrap;
  border: 1px solid transparent; }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.bad { color: var(--bad); }
.pill.muted { color: var(--muted); }
.pill.warn, .pill.bad, .pill.muted { background: color-mix(in srgb, currentColor 10%, transparent);
  border-color: color-mix(in srgb, currentColor 30%, transparent); }
/* a state that needs no attention: a dot and its word, in the text colour
   (docs/development/ui-patterns.md, Look); the tinted pill is for what stands out */
.pill.ok { color: var(--text); padding-left: 0; padding-right: 0; display: inline-flex; align-items: center; gap: 6px; }
.pill.ok::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.ctl-name { font-weight: 600; white-space: nowrap; }
.ctl-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-top: 3px; font-size: 12px; color: var(--muted); }
.ctl-meta .tag { margin: 0; }
.ctl-table th { white-space: nowrap; }
.nfc-note { flex-basis: 100%; }
.tag.unwired { color: var(--warn); border-color: rgba(239, 159, 39, 0.45); }

/* time plans: period rows; door modes */
.period-rows { display: flex; flex-direction: column; gap: 10px; }
.period-row { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.period-row .row { align-items: flex-end; margin-top: 6px; }
.mode-rows { display: flex; flex-direction: column; gap: 6px; }
.mode-row { align-items: center; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li + li { margin-top: 2px; }

/* introductions: one sentence, the rest behind "More about this" */
/* running text (an introduction, its "More about this", a setting's note)
   wraps at a readable length; lists, forms and hints in them use the width
   they have (docs/development/ui-patterns.md, Look) */
.intro > p, details.learn > :not(summary), .card > dl.props > dd > .small, .card > dl.props > dd > p { max-width: 75ch; }
.intro { margin-bottom: 12px; }
.intro > p { margin: 0; }
details.learn > summary { cursor: pointer; color: var(--accent); font-size: 13px; margin-top: 2px; width: max-content; }
details.learn > p { margin: 6px 0 0; }
/* rarely needed settings in a form, folded away */
details.advanced { margin: 10px 0 4px; border-top: 1px solid var(--line, #ddd); padding-top: 8px; }
details.advanced > summary { cursor: pointer; color: var(--accent); margin-bottom: 8px; width: max-content; }
details.advanced .checks { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; margin: 4px 0 12px; }
input.num-short { width: 5.5em; }
.output-row { margin: 4px 0 8px; }
.input-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 8px; }
.input-row .port-no { min-width: 1.4em; font-weight: 600; color: var(--muted); }
.input-row select, .input-row input:not([type=checkbox]) { width: auto; }
.input-row .fire-doors { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; }
.output-body { margin: 4px 0 0 22px; display: flex; flex-direction: column; gap: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* responsive lists (table() in app.js): columns have priorities. Short of
   width, priority 3 columns hide below 900px of table and priority 2 below
   600px, where rows stack as cards; a row's › button shows what's hidden. */
.xp { display: none; width: 1%; padding-right: 0; }
.xp-btn { color: var(--muted); padding: 3px; border-radius: 4px; line-height: 0; }
.xp-btn .icon { transition: transform .15s; }
.xp-btn[aria-expanded="true"] .icon { transform: rotate(90deg); }
tr.detail > td { background: var(--zebra); padding: 8px 10px 12px 36px; }
.row-more { gap: 6px 16px; }
.row-more dt.p2, .row-more dd.p2 { display: none; }
@media (pointer: coarse) { .xp-btn { padding: 10px; margin: -7px -4px; } }
@container tbl (min-width: 900px) { tr.detail { display: none; } }
@container tbl (min-width: 600px) { .table-wrap:not(.folds3) tr.detail { display: none; } }  /* opened when narrower; nothing folded now */
@container tbl (max-width: 899px) {
  th.p3, td.p3 { display: none; }
  .folds3 .xp { display: table-cell; }  /* only a list with something to fold here: no › opening an empty row */
}
@container tbl (max-width: 599px) {
  .xp { display: table-cell; }
  th.p2, td.p2 { display: none; }
  .row-more dt.p2, .row-more dd.p2 { display: block; }
  .row-more { grid-template-columns: 1fr; gap: 2px; }
  .row-more dd { margin-bottom: 6px; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .folds table, .folds tbody { display: block; }
  .folds tbody tr:not(.detail) { position: relative; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 12px; padding: 10px; border-bottom: 1px solid var(--line); }
  .folds tbody tr:not(.detail):has(> td.xp) { padding-left: 34px; }
  .folds tbody tr:not(.detail) > td.xp { position: absolute; left: 6px; top: 9px; }
  .folds tbody tr:not(.detail) > td { display: block; border: 0; padding: 0; }
  .folds tbody tr:not(.detail) > td.p2, .folds tbody tr:not(.detail) > td.p3 { display: none; }
  .folds tbody tr:not(.detail) > td:has(> .actions) { margin-left: auto; width: auto; }
  .folds tr.detail { display: block; }
  .folds tr.detail[hidden] { display: none !important; }
  .folds tr.detail > td { display: block; padding: 8px 10px 12px 10px; }
}

/* live updates (app.js liveRegion): wrappers that don't affect layout */
.live-region { display: contents; }
.new-rows { margin: 0 0 8px; }
.new-rows button { width: 100%; }
#nav a .nav-badge { flex: none; min-width: 1.6em; padding: 0 6px; border-radius: 999px; text-align: center;
  font-size: 12px; font-weight: 600; line-height: 1.6; background: var(--amber); color: #1d1300; }
#nav a .nav-badge.bad { background: var(--danger-bg); color: #fff; }
.changed-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; padding: 8px 12px;
  border: 1px solid var(--line); border-left: 3px solid var(--amber); border-radius: 8px; background: var(--panel); }
/* notices: something started here, followed to its end (app.js follow()) */
#notices { position: fixed; right: 16px; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); z-index: 50;
  display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.notice { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 8px; background: var(--panel);
  color: var(--text); border: 1px solid var(--line); border-left: 4px solid var(--muted); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15); }
.notice.ok { border-left-color: var(--ok); }
.notice.warn { border-left-color: var(--amber); }
.notice.bad { border-left-color: var(--bad); }
.notice-text { flex: 1 1 auto; }
.notice button.link { font-size: 18px; line-height: 1; padding: 0 2px; }
.operate-btn { display: inline-flex; align-items: center; gap: 4px; }
.mode-item + .mode-item { margin-top: 8px; }
.mode-when { margin: 2px 0 0; }
.holiday-hours { margin: 8px 0; }
/* Needs attention: each item with its response (Acknowledge…, Dismiss,
   Don't warn about this…); acknowledged ones stay, quietly; dismissed and
   not-warned-about ones folded away */
.alert-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.alert-item > :first-child { flex: 1 1 24em; margin: 6px 0; }
.alert-item .respond { white-space: nowrap; }
.alert-item.acked > :first-child { color: var(--muted); margin-bottom: 0; }
.alert-item .ack-line { flex-basis: 100%; margin-bottom: 6px; }
details.put-aside { margin-top: 8px; }
.put-aside-item { padding: 6px 0; border-top: 1px solid var(--line); }
.put-aside-item p { margin: 0 0 2px; }
/* The menu's counts: the Overview's is the total, filled and bold; each
   page's own count (and the Overview's per-page headings) is a hollow ring,
   so the parts don't read as more of the same */
#nav a .nav-badge:not(.total), .alert-group h3 .nav-badge { font-weight: 400; background: transparent;
  color: var(--warn); box-shadow: inset 0 0 0 1.5px var(--amber); }
#nav a .nav-badge.bad:not(.total), .alert-group h3 .nav-badge.bad { background: transparent; color: var(--bad);
  box-shadow: inset 0 0 0 1.5px var(--danger-bg); }
#nav a .nav-badge.total { font-weight: 800; }
/* Needs attention on the overview: one group per page */
.alert-group + .alert-group { margin-top: 10px; padding-top: 6px; border-top: 1px solid var(--line); }
.alert-group h3 { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 14px; }
.alert-group h3 .nav-badge { min-width: 1.6em; padding: 0 6px; border-radius: 999px; text-align: center; font-size: 12px;
  line-height: 1.6; }
/* a list searched and filtered here (filteredList): one slim line above it,
   each filter behind a funnel in its column's heading */
.filtered-list { container: flist / inline-size; }
.list-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 4px; font-size: 13px; }
.list-search { position: relative; flex: 0 1 18em; margin: 0; }
.list-search .icon { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.list-search input { margin: 0; padding: 4px 8px 4px 28px; font-size: 13px; }
.list-person .pp-list { font-size: 14px; }
.filter-chips { display: contents; }
.filter-chip { display: inline-flex; align-items: center; gap: 2px; padding: 1px 2px 1px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--text); white-space: nowrap; }
.filter-chip button { padding: 0 6px; color: var(--muted); font-size: 15px; line-height: 1; }
.filter-chip button:hover { color: var(--text); }
.filter-count { margin-left: auto; color: var(--muted); white-space: nowrap; }
.filter-count button { font-size: inherit; }
th .more { display: inline; }
th:has(.filter-btn) { white-space: nowrap; }
/* a heading that sorts: click it (the arrow shows on hover, and stays when sorted) */
/* a heading wraps between its words rather than widen a narrow table (its
   sort arrow and filter mark stay with the last word) */
th:has(.th-sort) { white-space: normal; }
.th-sort { text-align: left; }
.th-sort { display: inline; margin: 0; padding: 0; border: 0; background: none; text-align: left;
  color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.th-sort .sort-arrow { margin-left: 3px; vertical-align: -1px; }
.th-in { white-space: nowrap; }
.th-in .th-sort { white-space: normal; }
.th-sort .nowrap { white-space: nowrap; }
/* a link in a tag (a group): the accent colour is enough */
td .tag a { font-weight: 500; }
.th-sort:hover, .th-sort.on { color: var(--text); }
.th-sort .sort-arrow { display: inline-flex; opacity: 0; }
.th-sort .sort-arrow .icon { width: 11px; height: 11px; stroke-width: 2; }
.th-sort .sort-arrow.up { transform: rotate(180deg); }
.th-sort:hover .sort-arrow, .th-sort:focus-visible .sort-arrow { opacity: .45; }
.th-sort.on .sort-arrow { opacity: 1; color: var(--accent); }
th .more-menu { font-size: 13px; }
.filter-btn { display: inline-flex; align-items: center; gap: 4px; margin-left: 2px; padding: 2px 3px; border-radius: var(--r-sm);
  color: var(--muted); vertical-align: -1px; opacity: .3; transition: opacity var(--ease); }
thead:hover .filter-btn, thead:focus-within .filter-btn { opacity: .75; }
@media (hover: none) { .filter-btn { opacity: .7; } }
.filter-btn:hover, .filter-btn:focus-visible { opacity: 1; background: var(--tint); }
.filter-btn.on { opacity: 1; color: var(--accent); }
.filter-btn.on .icon path { fill: currentColor; }
/* the Filter button for all of them: only where the headings are hidden */
.filter-all-wrap { display: none; }
@container flist (max-width: 879px) {
  .list-tools.fold-p3 .filter-all-wrap { display: inline-flex; gap: 6px; }
  .list-tools.fold-p3 .filter-btn.filter-all { margin: 0; padding: 4px 8px; opacity: 1; border: 1px solid var(--line); text-transform: none; font-size: 13px; }
}
@container flist (max-width: 579px) {
  .filter-all-wrap { display: inline-flex; gap: 6px; }
  .filter-btn.filter-all { margin: 0; padding: 4px 8px; opacity: 1; border: 1px solid var(--line); text-transform: none; font-size: 13px; }
}
.more-menu .menu-title { padding: 6px 10px 2px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.more-menu .menu-title:not(:first-child) { margin-top: 4px; border-top: 1px solid var(--line); padding-top: 8px; }
.more-menu :is([role=menuitemradio], [role=menuitemcheckbox]) { display: flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: normal; font-weight: normal; }
.more-menu :is([role=menuitemradio], [role=menuitemcheckbox]) .icon { visibility: hidden; }
.more-menu :is([role=menuitemradio], [role=menuitemcheckbox])[aria-checked=true] { font-weight: 600; }
.more-menu :is([role=menuitemradio], [role=menuitemcheckbox])[aria-checked=true] .icon { visibility: visible; color: var(--accent); }
/* headings among one filter's choices (Events' Result: Kinds, Exactly) */
.more-menu .menu-title.menu-sub { padding-left: 32px; text-transform: none; letter-spacing: 0; font-size: 12px; }

/* Site time in the top bar (siteClock in app.js) */
.site-clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; margin-right: 12px;
  color: var(--head-text); font-variant-numeric: tabular-nums; white-space: nowrap; cursor: default; }
.site-clock .clock-time { font-weight: 600; }
.site-clock small { font-size: 12px; color: var(--muted); }
.site-clock.warn small { color: var(--warn); }
@media (max-width: 600px) { .site-clock small { display: none; } .site-clock { margin-right: 6px; } }
/* Firmware: the controllers a rollout goes to */
.checklist { max-height: 40vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
.checklist label.inline { margin: 4px 0; }

/* controllers: a free port starts a door there; doors: their areas */
button.port-tag.add-door { padding: 1px 7px; border-radius: 4px; border: 1px dashed var(--line); background: transparent; color: var(--muted);
  cursor: pointer; font: inherit; font-size: 12px; font-style: italic; }
button.port-tag.add-door:hover:not(:disabled) { background: var(--tint); border-color: var(--accent); }
button.port-tag.add-door .add-hint { display: none; font-style: normal; color: var(--accent); }
button.port-tag.add-door:hover .add-hint, button.port-tag.add-door:focus-visible .add-hint { display: inline; }
a.port-tag { text-decoration: none; color: inherit; }
a.port-tag:hover { text-decoration: underline; }
.door-areas { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.door-areas .tag { margin: 0; }

/* an organisation's logo (branding.py) */
.brand, .login-logo { display: inline-flex; align-items: center; gap: 10px; }
.login-logo { display: flex; justify-content: center; }
img.org-logo { width: auto; max-width: 180px; object-fit: contain; border-radius: 6px; }
.brand img.org-logo { max-height: 36px; background: #fff; padding: 2px; }
.logo-preview { max-height: 40px; max-width: 160px; vertical-align: middle; border: 1px solid var(--line); border-radius: 4px; }
.swatch { display: inline-block; width: 1em; height: 1em; border-radius: 3px; vertical-align: -2px; border: 1px solid var(--line); }
.bg-banner { background: var(--danger-bg); color: #fff; padding: 8px 20px; font-weight: 600; }
.bg-banner a { color: #fff; }
/* lockdown (lockdown.py): the header's button, and the banner on every page while one is on */
.lockdown-btn { background: transparent; color: var(--head-text); border: 1px solid var(--line-strong);
  font-weight: 600; margin-right: 8px; white-space: nowrap; padding: 5px 10px; display: inline-flex; align-items: center; gap: 6px; position: relative; }
.lockdown-btn .icon { width: 15px; height: 15px; stroke: var(--bad); }
.lockdown-btn:hover:not(:disabled) { background: var(--tint); border-color: var(--bad); }
.lockdown-btn.some::after { content: ""; position: absolute; top: -3px; right: -3px; width: 9px; height: 9px;
  border-radius: 50%; background: #ff5a4f; box-shadow: 0 0 0 2px var(--head); }
.lockdown-btn.on, .lockdown-btn.on:hover:not(:disabled) { background: var(--danger-bg); border-color: var(--danger-bg); color: #fff; }
.lockdown-btn.on .icon { stroke: #fff; }
.lockdown-btn:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 820px) { .lockdown-btn:not(.on) .lockdown-label { display: none; } .lockdown-btn { padding: 5px 7px; } }
#lockdown-slot .more-menu { min-width: 15em; }
#lockdown-slot .menu-title .small { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 12px; }
.lockdown-banner { background: var(--danger-bg); color: #fff; padding: 10px 20px; font-size: 1.05em; }
.lockdown-banner.drill { background: #8a5a00; }
.lockdown-banner strong { letter-spacing: .05em; margin-right: 4px; }
.lockdown-banner .link { color: #fff; text-decoration: underline; margin-left: 10px; font-weight: 600; }
.lockdown-count { white-space: nowrap; }
.lockdown-timeline { margin: 6px 0 10px; padding-left: 1.2em; }
.lockdown-timeline li { margin: 2px 0; }
/* a phone: the padlock alone (solid red when the site is locked down; the
   banner below says what), in the site clock's place */
@media (max-width: 480px) {
  .lockdown-btn { margin-right: 0; }
  .lockdown-btn .lockdown-label { display: none; }
  body.has-lockdown-btn .site-clock { display: none; }
}

/* multi-line fields in dialogs (a certificate, metadata, a handover): full width */
.dialog-form textarea { resize: vertical; }

/* Check access (checkPage): the question as a sentence, the answer first */
.check-form { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 14px; }
.check-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.check-word { font-weight: 600; min-width: 4.5em; }
.check-line select, .check-line .pp, .check-line input { width: auto; min-width: 12em; margin: 0; }
.check-again { align-self: flex-start; }
.chip-btn { background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; }
.chip-btn:hover:not(:disabled) { background: var(--tint); border-color: var(--accent); }
.chip-btn.on, .chip-btn.on:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: #fff; }
.when-chooser, .when-chips, .seg, .when-pick { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.when-pick input { min-width: 0; width: auto; }
.check-answer.stale, [aria-live].stale { opacity: .55; }
.verdict-card { border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: 8px; padding: 12px 16px; margin-top: 6px; }
.verdict-card.yes { border-left-color: var(--ok, #1d7a46); }
.verdict-card.no { border-left-color: var(--danger-bg); }
.verdict-card .actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-top: var(--sp-2); }
.verdict { font-size: 1.15em; margin: 0 0 8px; }
.verdict-mark { margin-right: 8px; vertical-align: -2px; }
.verdict-mark .icon { width: 18px; height: 18px; stroke-width: 2.5; }
.verdict-card.yes .verdict-mark .icon { stroke: var(--ok, #1d7a46); }
.verdict-card.no .verdict-mark .icon { stroke: var(--danger-bg); }
.check-weeks { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 10px 0; }
.week-strip { font-size: 11px; margin-top: 4px; }
.ws-row { display: flex; align-items: center; gap: 6px; height: 14px; }
.ws-day { width: 4.5em; color: var(--muted); white-space: nowrap; }
.ws-cells { display: grid; grid-template-columns: repeat(96, 3px); gap: 0; }
.ws-cell { height: 10px; background: var(--tint); }
.ws-cell.on { background: var(--accent); }
.ws-cell.here { outline: 2px solid var(--danger-bg); outline-offset: 0; position: relative; z-index: 1; }
.ws-ticks { display: flex; justify-content: space-between; width: 288px; color: var(--muted); }
@media (max-width: 480px) { .ws-cells { grid-template-columns: repeat(96, 2px); } .ws-ticks { width: 192px; } .check-word { min-width: 0; width: 100%; } }
.door-note { flex-basis: 100%; padding-left: 5.2em; margin-top: -4px; }
@media (max-width: 480px) { .door-note { padding-left: 0; } }
.check-line select.door-pick { max-width: 20em; text-overflow: ellipsis; }
@media (max-width: 480px) { .check-line select.door-pick { max-width: 100%; } }
.check-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.check-auto { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin: 0; }
.check-auto input { width: auto; margin: 0; }

/* a list's row that needs attention (attnFlag; docs/development/ui-patterns.md): a
   marker by its name, which scrolls to the page's Needs attention card,
   and a coloured edge on the row */
.attn-flag { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 0 7px; border: 1px solid currentColor;
  border-radius: 10px; background: none; font: inherit; font-size: 11px; line-height: 1.6; cursor: pointer; white-space: nowrap; vertical-align: 1px; }
.attn-flag .attn-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.attn-flag.bad { color: var(--bad); } .attn-flag.warn { color: var(--warn); } .attn-flag.answered { color: var(--muted); }
tr:has(.attn-flag.bad) > td:first-child { box-shadow: inset 3px 0 var(--bad); }
tr:has(.attn-flag.warn) > td:first-child { box-shadow: inset 3px 0 var(--warn); }

/* a negative filter (docs/development/ui-patterns.md): the chip's "is"/"is not" switch */
.filter-chip .chip-not { padding: 0 2px; font: inherit; text-decoration: underline dotted; }
.filter-chip.not { background: color-mix(in srgb, var(--bad) 12%, transparent); }
.filter-chip.not .chip-not { color: var(--bad); font-weight: 600; }
/* the Events person picker: its label, is / is not and the box on one line,
   the box the same height as the search beside it */
.list-person-wrap { display: inline-flex; align-items: center; gap: 4px; flex: 0 1 22em; min-width: 0; }
.list-person-wrap .list-person { flex: 1 1 auto; min-width: 8em; }
.list-person input { margin: 0; padding: 4px 8px; font-size: 13px; }
.person-not { font-size: 13px; }
.person-not[aria-pressed="true"] { color: var(--bad); font-weight: 600; }

/* a credential with a description (credChip; docs/development/ui-patterns.md, Tokens):
   the description first; the masked number and Reveal beside it on a wide
   screen, a smaller line under it on a phone */
.cred-labelled { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.cred-desc { font-weight: 600; }
@media (max-width: 600px) {
  .cred-labelled { flex-direction: column; align-items: flex-start; }
  .cred-labelled .cred { font-size: 11px; opacity: .85; padding-top: 0; padding-bottom: 0; }
}
.cred-lost .cred { text-decoration: line-through; opacity: .75; }  /* a lost card: suspended */

/* Notifications: the condition builder (groups of rows, nested), the
   message preview, a webhook's secret, and the pages a message's links open */
.cond-builder { display: flex; flex-direction: column; gap: 8px; }
.cond-group { display: flex; flex-direction: column; gap: 8px; }
.cond-group.nested { border-left: 3px solid var(--line); padding-left: 10px; margin-left: 2px; }
.cond-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cond-rows { display: flex; flex-direction: column; gap: 8px; }
.cond-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.cond-builder select, .cond-builder input[type=time] { width: auto; max-width: 100%; display: inline-block; margin-top: 0; }
.cond-row > select { flex: 0 1 auto; }
.cond-value { flex: 1 1 14em; min-width: 0; }
.cond-value select, .cond-value input { max-width: 100%; }
.cond-add { display: flex; flex-wrap: wrap; gap: 12px; }
.cond-when .row { align-items: flex-end; margin-top: 6px; flex-wrap: wrap; }
.cond-when > select { margin-bottom: 6px; }
.notify-preview { margin-top: 6px; }
.notify-preview .sample { white-space: pre-wrap; border-left: 3px solid var(--line); padding-left: 8px; }
.notify-preview li { overflow-wrap: anywhere; margin-bottom: 4px; }
code.secret { overflow-wrap: anywhere; user-select: all; }
main.standalone { max-width: 34rem; margin: 3rem auto; padding: 0 16px; }
.quiet-box .row, .delay-min { align-items: flex-end; }
.delay-min input { width: 6em; display: inline-block; }

/* A readings chart (app.js readingsChart): one line, recessive grid and
   axes, dashed reference lines, a readout on hover */
.chart-box { position: relative; }
.chart { width: 100%; height: auto; display: block; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-ref { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 4 3; }
.chart-axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: var(--accent); stroke: var(--panel); stroke-width: 2; }
.chart-cross { stroke: var(--line-strong); stroke-width: 1; }
.chart-tip { position: absolute; transform: translate(-50%, calc(-100% - 10px)); pointer-events: none; white-space: nowrap;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-sm);
  box-shadow: var(--shadow-pop); padding: 2px 8px; font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.chart-table { margin-top: var(--sp-3); }

/* What's changed in a recommended notification (presetChangesDialog) */
.preset-part { border-top: 1px solid var(--line); padding-top: .6rem; }
.preset-sides { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: .3rem; }
.preset-text { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 600px) { .preset-sides { grid-template-columns: 1fr; } }
mark.diff-del { background: color-mix(in srgb, var(--bad) 22%, transparent); color: inherit; text-decoration: line-through; }
mark.diff-ins { background: color-mix(in srgb, var(--ok) 25%, transparent); color: inherit; }

/* Approving on the phone (phoneApproval): the number to choose there */
.phone-number { margin: .5rem 0; }
.phone-number strong { font-size: 1.6rem; letter-spacing: .05em; margin: 0 .15rem; }
