/*
 * SCOPE MBD staff UI: one design system for every /mbd page (start page, desk, dashboard,
 * cancellations, standby, admin, and the scan app via ./ui.css). Served from assets/public (CSP
 * style-src 'self'); no inline styles anywhere. Tokens follow design/mockup.html, plus the SCOPE
 * brand colours: primary #1c2e4b (navy), secondary #1468b2 (blue). Light and dark via
 * prefers-color-scheme, overridable with <html data-theme="light|dark">.
 */
:root {
  --ink: #16202f; --muted: #5c6b80; --ground: #eef1f5; --panel: #fff; --line: #dde3ea;
  --accent: #1468b2; --accent-ink: #fff; --brand: #1c2e4b; --brand-ink: #fff;
  --ok: #1a6e3f; --warn: #a35300; --bad: #b3261e; --info: #1468b2; --quiet: #5c6b80;
  --zebra: #f6f8fb; --hover: #eaf1fa; --field: #fff; --shadow: 0 1px 2px rgba(22, 32, 47, .06), 0 6px 18px -10px rgba(22, 32, 47, .18);
  /* Wallet-card colours (the desk's candidate cards): sand highlight, the card header, the selection line, a solid green. */
  --sand: #d8c9a8; --card-head: #1c2e4b; --card-head-ink: #d3dbe8; --sel-line: #1c2e4b; --ok-solid: #2e7a2a; --scrim: rgba(17, 24, 36, .55);
  --radius: 12px; --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e7edf5; --muted: #a3b0c2; --ground: #10151d; --panel: #181f2a; --line: #2c3746;
    --accent: #5aa2e6; --accent-ink: #0b1420; --brand: #14213a; --brand-ink: #fff;
    --ok: #5cc58a; --warn: #f0a454; --bad: #f08a80; --info: #7ab4ec; --quiet: #a3b0c2;
    --zebra: #1c2431; --hover: #22324a; --field: #121923; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 20px -12px rgba(0, 0, 0, .6);
    --card-head: #23395f; --card-head-ink: #d3dbe8; --sel-line: #d8c9a8; --scrim: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #e7edf5; --muted: #a3b0c2; --ground: #10151d; --panel: #181f2a; --line: #2c3746;
  --accent: #5aa2e6; --accent-ink: #0b1420; --brand: #14213a; --brand-ink: #fff;
  --ok: #5cc58a; --warn: #f0a454; --bad: #f08a80; --info: #7ab4ec; --quiet: #a3b0c2;
  --zebra: #1c2431; --hover: #22324a; --field: #121923; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 20px -12px rgba(0, 0, 0, .6);
  --card-head: #23395f; --card-head-ink: #d3dbe8; --sel-line: #d8c9a8; --scrim: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-width: 320px; background: var(--ground); color: var(--ink); font: 15px/1.5 var(--font); overflow-x: hidden; }
[hidden] { display: none !important; }
img { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
code, .mono { font: 13px/1.45 var(--mono); }
code { background: color-mix(in srgb, var(--accent) 9%, var(--panel)); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; overflow-wrap: anywhere; }
pre.cmd { margin: 6px 0 0; padding: 10px 12px; background: var(--ground); border: 1px solid var(--line); border-radius: var(--radius-sm); font: 13px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 50; background: var(--panel); color: var(--ink); padding: 8px 12px; border-radius: var(--radius-sm); }
.skip:focus { top: 8px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- typography ---------- */
h1 { font-size: 24px; line-height: 1.25; letter-spacing: -.015em; margin: 0 0 4px; font-weight: 700; }
h2 { font-size: 17px; line-height: 1.3; margin: 0 0 12px; font-weight: 650; }
h2.label, .section-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 650; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 16px 0 8px; font-weight: 650; }
p { margin: 0 0 10px; }
.lede { color: var(--muted); margin: 0 0 18px; max-width: 75ch; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.meta { color: var(--muted); font-size: 13.5px; margin: 0 0 6px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- app bar ---------- */
.appbar { background: var(--brand); color: var(--brand-ink); position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 0 rgba(255, 255, 255, .06), 0 4px 14px -8px rgba(0, 0, 0, .5); }
.appbar-in { max-width: 1280px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-height: 44px; margin-right: auto; }
/* The real SCOPE logo: white in the navy bar; large on light cards, navy in light theme and white in dark (the hidden one is display:none, so only one is announced). */
.brand-logo { display: block; height: 36px; width: auto; flex: none; }
.logo-large { display: block; text-align: center; margin: 2px 0 16px; }
/* Its own 48/96 px pair, drawn at its natural ratio. The theme rules below are (0,2,0) or more, so they beat
   `.logo-large img` (0,1,1); no rule on these imgs may set display or a fixed width. */
.logo-large img { height: 48px; width: auto; vertical-align: top; }
.logo-large .logo-light { display: inline-block; }
.logo-large .logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-large .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-large .logo-dark { display: inline-block; }
}
:root[data-theme="dark"] .logo-large .logo-light { display: none; }
:root[data-theme="dark"] .logo-large .logo-dark { display: inline-block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 16px; letter-spacing: .01em; }
.brand-text small { font-size: 11.5px; opacity: .75; }
.clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; margin: 0; font-size: 12px; opacity: .92; }
.clock time { font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
.who-name { max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-badge { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .16); color: #fff; border: 1px solid rgba(255, 255, 255, .3); }
.role-badge.role-admin { background: #f0a454; color: #1c1300; border-color: transparent; }
.role-badge.role-desk { background: #5aa2e6; color: #071423; border-color: transparent; }
.logout { margin: 0; }
.appbar .btn-bar { font: inherit; font-size: 13.5px; font-weight: 600; color: #fff; background: transparent; border: 1px solid rgba(255, 255, 255, .4); border-radius: var(--radius-sm); min-height: 36px; padding: 6px 12px; cursor: pointer; }
.appbar .btn-bar:hover { background: rgba(255, 255, 255, .12); }
.appbar :focus-visible { outline-color: #fff; }
.appnav { border-top: 1px solid rgba(255, 255, 255, .12); }
/* Row padding + the links' 12 px (8 px on phones) = the 16 px (12 px) gutter, so the first link's text starts at the content edge. */
.appnav-in { max-width: 1280px; margin: 0 auto; padding: 0 4px; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.appnav-in::-webkit-scrollbar { display: none; }
.appnav a { color: rgba(255, 255, 255, .82); text-decoration: none; font-weight: 600; font-size: 14px; padding: 11px 12px 9px; min-height: 44px; display: inline-flex; align-items: center; white-space: nowrap; border-bottom: 3px solid transparent; }
.appnav a:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.appnav a[aria-current="page"] { color: #fff; border-bottom-color: #5aa2e6; }
.appnav a:focus-visible { outline-offset: -3px; }

/* ---------- page ---------- */
.wrap { max-width: 1280px; margin: 0 auto; padding: 22px 16px 64px; }
.wrap.narrow { max-width: 760px; }
/* On a narrow page the bar's items share the content's left and right edges too. */
body:has(.wrap.narrow) .appbar-in, body:has(.wrap.narrow) .appnav-in { max-width: 760px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 20px; margin: 0 0 18px; }
.page-head .lede { margin: 0; }
.page-head > div { min-width: 0; }
.crumbs { font-size: 13px; margin: 0 0 6px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.subnav { display: flex; gap: 0 22px; flex-wrap: wrap; margin: 0 0 16px; border-bottom: 1px solid var(--line); }
.subnav a { display: inline-flex; align-items: center; min-height: 42px; padding: 8px 2px 6px; margin-bottom: -1px; border-bottom: 3px solid transparent; color: var(--muted); text-decoration: none; font-weight: 650; font-size: 14.5px; }
.subnav a:hover { color: var(--ink); border-bottom-color: var(--line); }
.subnav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 980px) { .grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .grid-2.wide-left { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }

/* ---------- panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 16px; margin: 0 0 16px; box-shadow: var(--shadow); min-width: 0; }
.panel > :last-child { margin-bottom: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 14px; margin: 0 0 12px; }
.panel-head h2 { margin: 0; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush > .panel-head { padding: 16px 18px 0; }
.panel.accent { border-left: 4px solid var(--accent); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.card-link { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; min-height: 44px; }
.card-link:hover { border-color: var(--accent); transform: translateY(-1px); }
.card-link strong { display: flex; align-items: center; gap: 8px; font-size: 16px; margin-bottom: 4px; color: var(--accent); }
.card-link span { color: var(--muted); font-size: 13.5px; }

.section-gap { margin-top: 24px; }
ol.steps { margin: 0; padding-left: 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
ol.steps > li { min-width: 0; }
tr.just-added td { background: color-mix(in srgb, var(--ok) 12%, var(--panel)) !important; }

/* ---------- tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 12px; margin: 0 0 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--tone, var(--line)); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.tile-n { display: block; font-size: 28px; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile-l { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; margin-top: 2px; }
.tile-s { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tile.t-ok { --tone: var(--ok); } .tile.t-warn { --tone: var(--warn); } .tile.t-bad { --tone: var(--bad); } .tile.t-info { --tone: var(--info); } .tile.t-quiet { --tone: var(--quiet); } .tile.t-brand { --tone: #5aa2e6; }
.tile.t-warn .tile-n { color: var(--warn); } .tile.t-bad .tile-n { color: var(--bad); }

/* ---------- chips ---------- */
.chip { --c: var(--quiet); display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 650; line-height: 1.3; padding: 2px 9px; border-radius: 999px; white-space: nowrap; color: var(--c); background: color-mix(in srgb, var(--c) 13%, var(--panel)); border: 1px solid color-mix(in srgb, var(--c) 38%, transparent); vertical-align: 1px; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.chip.plain::before { display: none; }
.chip.ok { --c: var(--ok); } .chip.warn { --c: var(--warn); } .chip.bad { --c: var(--bad); } .chip.info { --c: var(--info); } .chip.quiet { --c: var(--quiet); }
.chip.wrap { white-space: normal; max-width: 100%; }
.chip.solid { color: #fff; background: var(--c); border-color: transparent; }
.rank { display: inline-flex; font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); }
.count-flag { display: inline-block; min-width: 2.2em; text-align: center; font-weight: 700; padding: 0 6px; border-radius: 6px; }
.count-flag.risk { color: var(--warn); background: color-mix(in srgb, var(--warn) 15%, var(--panel)); }
.count-flag.free { color: var(--info); background: color-mix(in srgb, var(--info) 14%, var(--panel)); }
.count-flag.over { color: #fff; background: var(--bad); }

/* ---------- buttons ---------- */
.btn, button.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-size: 14.5px; font-weight: 650; line-height: 1.2; min-height: 40px; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; text-decoration: none; transition: background-color .12s, border-color .12s, box-shadow .12s; white-space: nowrap; }
.btn:hover { border-color: var(--accent); background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 86%, #000); }
.btn.danger { background: var(--panel); border-color: color-mix(in srgb, var(--bad) 55%, transparent); color: var(--bad); }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 10%, var(--panel)); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.small { min-height: 34px; padding: 5px 12px; font-size: 13.5px; }
.btn.block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"]::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 0; }
.actions .btn { white-space: normal; max-width: 100%; text-align: center; }

/* ---------- forms ---------- */
.field { display: block; margin: 0 0 14px; min-width: 0; }
.field > span, .field > label, legend { display: block; font-weight: 650; font-size: 13.5px; margin: 0 0 5px; }
.field .hint, .hint { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; margin-top: 4px; }
input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="date"], input[type="datetime-local"], input[type="number"], input:not([type]), select, textarea {
  font: inherit; font-size: 15px; color: var(--ink); background: var(--field); border: 1px solid color-mix(in srgb, var(--muted) 45%, transparent); border-radius: var(--radius-sm); padding: 9px 11px; min-height: 42px; width: 100%; max-width: 100%;
}
textarea { min-height: 76px; resize: vertical; }
::placeholder { color: var(--muted); opacity: .6; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 0; border-color: var(--accent); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--bad); }
fieldset { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-row label, .radio-card { display: flex; align-items: flex-start; gap: 9px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--field); cursor: pointer; min-height: 44px; font-weight: 500; }
.choice-row label:has(input:checked), .radio-card:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--panel)); }
.choice-row input, .radio-card input { margin-top: 3px; accent-color: var(--accent); }
.radio-list { display: grid; gap: 8px; }
.radio-card .rc-main { display: block; font-weight: 600; }
.radio-card .rc-sub { display: block; color: var(--muted); font-size: 13px; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 16px; }
@media (min-width: 700px) { .form-grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.inline-form .field { margin: 0; flex: 1 1 200px; }
.form-msg { min-height: 1.5em; margin: 8px 0 0; font-weight: 600; }
.form-msg:empty { min-height: 0; margin: 0; }
.form-msg.error { color: var(--bad); }
.form-msg.ok { color: var(--ok); }

/* ---------- notices & states ---------- */
.notice { --c: var(--info); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); border-left: 4px solid var(--c); background: color-mix(in srgb, var(--c) 8%, var(--panel)); border-radius: var(--radius-sm); padding: 10px 14px; margin: 0 0 14px; }
.notice.warn { --c: var(--warn); } .notice.bad { --c: var(--bad); } .notice.ok { --c: var(--ok); } .notice.quiet { --c: var(--quiet); }
.notice > :last-child { margin-bottom: 0; }
details.notice.rule { margin: 0 0 14px; padding: 8px 14px; }
details.notice.rule > summary { list-style: none; color: var(--ink); font-weight: 400; min-height: 0; cursor: pointer; }
details.notice.rule > summary::-webkit-details-marker { display: none; }
details.notice.rule > summary::after { content: "Why?"; margin-left: 8px; color: var(--accent); font-weight: 650; text-decoration: underline; text-underline-offset: 2px; }
details.notice.rule[open] > summary::after { content: "Less"; }
details.notice.rule > p { margin: 6px 0 0; color: var(--ink); }
.input-row { display: flex; gap: 8px; align-items: stretch; }
.input-row input { flex: 1 1 auto; min-width: 0; }
.input-row .btn { flex: none; }
.empty { text-align: center; color: var(--muted); padding: 22px 12px; border: 1px dashed var(--line); border-radius: var(--radius-sm); margin: 0; }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 2px; }
p.warn:not(.notice) { color: var(--warn); font-weight: 650; margin: 4px 0; }
.stays-empty { color: var(--muted); background: var(--zebra); border: 1px dashed var(--line); padding: 8px 12px; border-radius: var(--radius-sm); margin: 6px 0; }
.error { color: var(--bad); font-weight: 600; }
.ok-text { color: var(--ok); font-weight: 600; }

/* ---------- toolbar / filters ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 0 0 12px; }
.toolbar .field { margin: 0; flex: 1 1 180px; max-width: 360px; }
.toolbar .count { color: var(--muted); font-size: 13px; margin-left: auto; align-self: center; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); max-width: 100%; }
.table-wrap.tall { max-height: 72vh; overflow-y: auto; }
table.data { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; }
table.data th, table.data td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data td { overflow-wrap: anywhere; }
table.data td:not(.n):not(.time) { min-width: 6.5em; }
table.data thead th { position: sticky; top: 0; z-index: 1; background: color-mix(in srgb, var(--ground) 70%, var(--panel)); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; white-space: nowrap; }
table.data tbody tr:nth-child(even) td { background: var(--zebra); }
table.data tbody tr:hover td { background: var(--hover); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.n, table.data th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tfoot td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; background: var(--panel); }
table.data .sub { display: block; color: var(--muted); font-size: 12.5px; }
table.data.compact th, table.data.compact td { padding: 5px 10px; font-size: 13.5px; }
table.data td.time { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.data td.reason { min-width: 260px; max-width: 520px; font-size: 13px; }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
dl.legend { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; font-size: 13.5px; margin: 0; }
dl.legend dt { font-weight: 650; }
dl.legend dd { margin: 0; color: var(--muted); }
details { margin: 10px 0 0; }
details > summary { cursor: pointer; font-weight: 600; color: var(--accent); min-height: 32px; }
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-weight: 600; }

table.data td.zero { color: var(--muted); }
.chat-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
details.chat-room { margin: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }
details.chat-room > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 12px; color: var(--ink); list-style: none; min-height: 44px; }
details.chat-room > summary::-webkit-details-marker { display: none; }
details.chat-room > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
details.chat-room[open] > summary::before { transform: rotate(90deg); }
details.chat-room .room-name { font-weight: 650; }
details.chat-room .table-wrap { border: 0; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius-sm) var(--radius-sm); }

/* ---------- day tabs ---------- */
nav.days { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
nav.days a { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 16px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: var(--panel); text-decoration: none; font-weight: 650; }
nav.days a:hover { border-color: var(--accent); }
nav.days a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- needs attention ---------- */
.panel.attention { border-left: 4px solid var(--warn); padding-bottom: 12px; }
.panel.attention.clear { border-left-color: var(--ok); }
.panel.attention .panel-head { margin-bottom: 8px; }
ol.issues { list-style: none; margin: 0; padding: 0; display: grid; }
li.issue { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line); }
ol.issues > li.issue:first-child { border-top: 0; }
.issue-lv { flex: 0 0 46px; text-align: center; font-size: 11px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; border-radius: 6px; padding: 3px 0; margin-top: 1px; color: var(--quiet); background: var(--zebra); }
li.lv-urgent .issue-lv { color: var(--panel); background: var(--bad); }
li.lv-soon .issue-lv { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.issue-body { min-width: 0; display: grid; gap: 1px; }
.issue-body strong { font-size: 14.5px; overflow-wrap: anywhere; }
.issue-body strong a { color: var(--ink); }
.issue-body strong a:hover { color: var(--accent); }
.issue-body span { font-size: 13px; color: var(--muted); }
.panel.attention details.more > summary { font-size: 13.5px; font-weight: 650; color: var(--accent); margin-top: 6px; }

/* ---------- who is on it: the owner slot (activity page; the desk draws its own) ---------- */
.owner { display: flex; align-items: center; gap: 10px; min-width: 0; }
.owner .btn { margin-left: auto; flex: none; }
.owner-avatar { flex: 0 0 30px; box-sizing: border-box; align-self: center; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 750; color: #fff; background: var(--quiet); letter-spacing: .02em; }
.owner-avatar.vacant { background: transparent; border: 2px dashed var(--line); }
.owner-avatar.me { background: var(--ok); }
.owner-avatar.av-0 { background: #7a4fd1; } .owner-avatar.av-1 { background: #c2410c; } .owner-avatar.av-2 { background: #0f766e; }
.owner-avatar.av-3 { background: #b4235a; } .owner-avatar.av-4 { background: #1468b2; } .owner-avatar.av-5 { background: #8a6d00; }
.owner-text { min-width: 0; font-size: 14px; line-height: 1.3; }
.owner-text strong { overflow-wrap: anywhere; }
.owner-sub { display: block; font-size: 12.5px; color: var(--muted); }
.owner.o-none .owner-text { color: var(--muted); }
.owner.o-none .owner-text strong { color: var(--ink); }
.owner.o-other .owner-text strong { color: var(--warn); }
.owner.o-me .owner-text strong { color: var(--ok); }
.owner-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: 0 0 14px; padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.owner-bar .owner { flex: 1 1 320px; }
.owner-bar > p { margin: 0; flex: 1 1 240px; }
.owner.large .owner-avatar { flex-basis: 38px; width: 38px; height: 38px; font-size: 14px; }
.owner.large .owner-text { font-size: 15.5px; }

/* ---------- desk activity page: proposals ---------- */
details.more ol.proposals { counter-reset: p 10; }
ol.proposals { list-style: none; counter-reset: p; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
li.proposal { counter-increment: p; position: relative; padding: 10px 12px 10px 44px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--field); }
li.proposal::before { content: counter(p); position: absolute; left: 12px; top: 11px; width: 22px; height: 22px; border-radius: 50%; background: var(--ground); border: 1px solid var(--line); font-size: 12px; font-weight: 700; display: grid; place-items: center; color: var(--muted); }
li.needs-ok { border-left: 4px solid var(--warn); }
li.proposal .who { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
ul.reasons { list-style: none; margin: 4px 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--muted); font-size: 13px; }
ul.reasons li::before { content: "·"; margin-right: 6px; font-weight: 700; }
ul.reasons li.dup { display: none; }
.contact { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.countdown { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.result { font-weight: 600; }
.result.error-text, .contact .error { color: var(--bad); }
ul.seats, ul.offers { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
ul.seats li, ul.offers li { padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--field); }

/* ---------- people search (cancellations, standby, walk-in) ---------- */
.people { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.people button { display: block; width: 100%; text-align: left; font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; cursor: pointer; min-height: 44px; }
.people button:hover, .people button[aria-pressed="true"] { border-color: var(--accent); background: var(--hover); }
.people .p-name { font-weight: 650; display: block; }
.people .p-meta { color: var(--muted); font-size: 13px; display: block; }
.people .p-chips { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 4px; }
.people .p-name, .selected-person strong, li.proposal .who strong, ul.seats strong, ul.offers strong { overflow-wrap: anywhere; }
.contact-note { flex-basis: 100%; margin: 0; }
details.all-acts > summary { color: var(--ink); font-weight: 650; min-height: 32px; }
details.all-acts > summary .muted { font-weight: 400; }
details.all-acts .toolbar { margin-top: 12px; }
.selected-person { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1px solid var(--accent); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--accent) 7%, var(--panel)); margin: 0 0 14px; }

/* ---------- replacement desk (/desk): design/mbd-desk, its tokens mapped onto the ones above ----------
 * bg → --ground, surface → --panel / --zebra, navy → --brand / --card-head, blue/label/focus → --accent,
 * green → --ok, amber → --warn, red → --bad, sand → --sand. Tints are color-mix()es of those, so the
 * light/dark switch above is the only theme switch. Density per the power-user brief: 14 px text,
 * 32 px controls (40 px for the call's main buttons and on touch screens), no pills, no shadows but
 * the dialogs', no coloured left borders. */
.desk {
  --dk-line-strong: color-mix(in srgb, var(--muted) 38%, var(--line));
  --dk-sel-bg: color-mix(in srgb, var(--accent) 8%, var(--panel));
  --dk-warn-bg: color-mix(in srgb, var(--warn) 11%, var(--panel));
  --dk-warn-line: color-mix(in srgb, var(--warn) 40%, transparent);
  --dk-ok-bg: color-mix(in srgb, var(--ok) 12%, var(--panel));
  --dk-call-bg: color-mix(in srgb, var(--sand) 24%, var(--panel));
  display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 24px; align-items: start;
  font-size: 14px; line-height: 1.45;
  /* render() restores the scroll position itself after each refresh; the browser's scroll anchoring
     would shift it again once the replaced rows lay out. */
  overflow-anchor: none;
}
.desk p { margin: 0; }
.desk .num { font-variant-numeric: tabular-nums; }
.dk-left, .dk-right { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.dk-ic { width: 16px; height: 16px; flex: none; }
.dk-label { font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.dk-quiet { color: var(--muted); font-size: 13px; }
.dk-quiet.dk-bad { color: var(--bad); font-weight: 600; }
.desk .v-go { color: var(--ok); font-weight: 650; }
.desk .v-muted { color: var(--muted); }
.desk .v-strong { font-weight: 650; }
.desk kbd { font: 600 12px/1 var(--mono); padding: 2px 5px; border: 1px solid var(--dk-line-strong); border-radius: 4px; background: var(--zebra); color: var(--ink); white-space: nowrap; }

/* left: seats to fill */
.dk-left-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.dk-left-head h1 { font-size: 18px; margin: 0; }
.dk-left-count { color: var(--muted); font-size: 13px; }
.dk-days { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 2px; border: 1px solid var(--dk-line-strong); border-radius: var(--radius-sm); background: var(--panel); }
.dk-day { min-height: 32px; display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: 6px; color: var(--ink); text-decoration: none; font-weight: 650; font-size: 13.5px; }
.dk-day:hover { background: var(--hover); }
.dk-day[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.dk-day-n { font-size: 12px; font-weight: 700; }
.dk-day-n:empty { display: none; }
.dk-rule { margin: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); font-size: 13px; }
.dk-rule > summary { list-style: none; display: flex; gap: 8px; align-items: flex-start; color: var(--ink); font-weight: 400; min-height: 0; cursor: pointer; }
.dk-rule > summary::-webkit-details-marker { display: none; }
.dk-rule > summary .dk-ic { color: var(--accent); margin-top: 1px; }
.dk-rule > p { margin: 6px 0 0 24px; color: var(--muted); }
.dk-acts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dk-acts:empty { display: none; }
.dk-act { width: 100%; padding: 8px 10px; text-align: left; cursor: pointer; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; align-items: start; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); color: var(--ink); font: inherit; }
.dk-act:hover { border-color: var(--dk-line-strong); background: var(--hover); }
.dk-act.is-sel { border: 2px solid var(--sel-line); padding: 7px 9px; background: var(--dk-sel-bg); }
.dk-act-time, .dk-act-body, .dk-act-side { display: flex; flex-direction: column; min-width: 0; }
.dk-act-t { font-size: 15px; font-weight: 700; line-height: 1.25; }
.dk-act-in { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-act-in.is-soon { color: var(--warn); font-weight: 650; }
.dk-act-co, .dk-act-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-act-co { font-weight: 650; }
.dk-act-meta { font-size: 12.5px; color: var(--muted); }
.dk-act-side { align-items: flex-end; text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; }
.dk-act-fill { font-size: 13px; font-weight: 700; color: var(--ink); }
.dk-act-fill.is-filled { color: var(--ok); }
.dk-act.is-done .dk-act-fill, .dk-act.is-done .dk-act-co { color: var(--muted); }
.dk-left details.all-acts { margin: 4px 0 0; }

/* left: needs attention, the owner filter, who is on each activity */
.dk-attn { border: 1px solid var(--dk-warn-line); border-left: 4px solid var(--warn); border-radius: var(--radius-sm); background: var(--panel); padding: 8px 10px 6px; }
.dk-attn.is-clear { border-color: var(--line); border-left-color: var(--ok); }
.dk-attn-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.desk .dk-attn-head h2 { margin: 0; font-size: 14px; font-weight: 700; }
.dk-attn-n { font-size: 12px; color: var(--muted); }
.dk-issues { list-style: none; margin: 4px 0 0; padding: 0; }
.dk-issue { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; border-top: 1px solid var(--line); }
.dk-issues > .dk-issue:first-child { border-top: 0; }
.dk-issue-lv { flex: 0 0 40px; text-align: center; font-size: 10.5px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; border-radius: 4px; padding: 2px 0; margin-top: 1px; color: var(--quiet); background: var(--zebra); }
.dk-issue.lv-urgent .dk-issue-lv { color: var(--panel); background: var(--bad); }
.dk-issue.lv-soon .dk-issue-lv { color: var(--warn); background: var(--dk-warn-bg); }
.dk-issue-b { min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: 12.5px; color: var(--muted); }
.dk-issue-b strong { font-size: 13.5px; font-weight: 650; color: var(--ink); overflow-wrap: anywhere; }
/* Two lines of detail (the full text is the title): the work list right below must stay above the fold. */
.dk-issue-d { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.desk .dk-issue-go { min-height: 0; padding: 0; font-size: inherit; font-weight: inherit; color: var(--ink); text-align: left; text-decoration: underline; text-decoration-color: var(--dk-line-strong); text-underline-offset: 3px; }
.desk .dk-issue-go:hover { color: var(--accent); text-decoration-color: currentColor; }
.dk-issue-none { padding: 2px 0 4px; font-size: 13px; color: var(--muted); }
.dk-issue-more { padding-top: 2px; border-top: 1px solid var(--line); }
.dk-ofilter { display: flex; flex-wrap: wrap; gap: 2px; padding: 2px; border: 1px solid var(--dk-line-strong); border-radius: var(--radius-sm); background: var(--panel); }
.dk-ofilter[hidden] { display: none; }
.dk-ofbtn { flex: 1 1 auto; min-height: 30px; padding: 0 8px; border: 0; border-radius: 6px; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; white-space: nowrap; }
.dk-ofbtn:hover { background: var(--hover); color: var(--ink); }
.dk-ofbtn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.dk-ofbtn-n { font-size: 12px; font-weight: 700; margin-left: 2px; }
.dk-act-own { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 12.5px; font-weight: 650; min-width: 0; }
.dk-act-own-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-act-own.o-none { color: var(--warn); }
.dk-act-own.o-me { color: var(--ok); }
.dk-own-av { flex: none; box-sizing: border-box; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; font-weight: 750; letter-spacing: .02em; color: #fff; background: var(--quiet); }
.dk-own-av.is-me { background: var(--ok); }
.dk-own-av.is-other { background: var(--info); }
.dk-own-av.is-vacant { color: inherit; background: transparent; border: 1.5px dashed currentColor; }
.dk-owner .dk-own-av.is-vacant { color: var(--muted); }
.dk-own-av-l { width: 34px; height: 34px; font-size: 13px; }
@media (pointer: coarse) { .dk-ofbtn { min-height: 40px; } }

/* right: the selected activity */
.dk-sel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.dk-back { display: none; }
.dk-sel-top { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 8px 24px; }
.dk-sel-id { min-width: 0; flex: 1 1 320px; }
.dk-kind { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.desk .dk-sel-title { margin: 2px 0 4px; font-size: 20px; font-weight: 700; line-height: 1.25; letter-spacing: -.01em; overflow-wrap: anywhere; }
.dk-sel-meta { color: var(--muted); }
.dk-sel-meta strong { color: var(--ink); font-weight: 650; }
.dk-sel-door { margin-top: 4px; color: var(--muted); font-size: 13px; }
.dk-ask { color: var(--warn); }
.dk-counts { color: var(--muted); white-space: nowrap; }
.dk-counts strong { font-size: 18px; color: var(--ink); font-weight: 700; }
.dk-owner { padding-top: 10px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.dk-owner-t { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; }
.dk-owner-t strong { font-weight: 650; overflow-wrap: anywhere; }
.dk-owner.o-other .dk-owner-t strong { color: var(--warn); }
.dk-owner.o-me .dk-owner-t strong { color: var(--ok); }
.dk-owner-s { font-size: 12.5px; color: var(--muted); }
.dk-owner .dk-error { flex-basis: 100%; }
.dk-wish { padding-top: 10px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; }
.dk-wish-v { font-weight: 650; }
.dk-wish-src, .dk-wish-none { color: var(--muted); }
.dk-notices { display: flex; flex-direction: column; gap: 8px; }
.dk-notices:empty { display: none; }
.dk-notice { display: flex; gap: 8px; align-items: flex-start; padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--dk-line-strong); background: var(--panel); }
.dk-notice.n-warn { background: var(--dk-warn-bg); border-color: var(--dk-warn-line); }
.dk-notice .dk-ic { color: var(--warn); margin-top: 2px; }
.dk-big { padding: 20px; border: 1px solid var(--dk-line-strong); border-radius: var(--radius); background: var(--panel); display: flex; flex-direction: column; gap: 4px; }
.dk-big-t { font-size: 16px; font-weight: 700; }
.dk-big-b { color: var(--muted); max-width: 64ch; }
.dk-claimed { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--dk-ok-bg); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); display: flex; flex-direction: column; gap: 2px; }
.dk-claimed-t { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: var(--ok); }

/* tabs, search, filters */
.dk-cands { display: flex; flex-direction: column; gap: 12px; }
.dk-tabs { display: flex; flex-wrap: wrap; gap: 0 4px; border-bottom: 1px solid var(--dk-line-strong); }
.dk-tab { min-height: 40px; padding: 0 12px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font: inherit; font-weight: 650; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dk-tab:hover { color: var(--ink); }
.dk-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--sel-line); }
.dk-tab-n { font-size: 12px; font-weight: 600; color: var(--muted); }
.dk-tab-n:empty { display: none; }
.dk-filters { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.dk-search { position: relative; }
.dk-search .dk-ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.desk .dk-search input { min-height: 36px; padding: 6px 10px 6px 34px; font-size: 14px; }
.dk-selects { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.dk-fsel { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.desk .dk-fsel select { min-height: 32px; padding: 4px 8px; font-size: 13.5px; }
.dk-chiprow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dk-toggle { min-height: 32px; padding: 0 10px; border-radius: 6px; cursor: pointer; border: 1px solid var(--dk-line-strong); background: var(--panel); color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; }
.dk-toggle:hover { border-color: var(--accent); }
.dk-toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.dk-meta { margin-left: auto; color: var(--muted); font-size: 13px; }
.dk-link { min-height: 32px; padding: 0 6px; border: 0; background: none; color: var(--accent); font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.dk-keyhint { text-align: right; }

/* buttons */
.dk-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--dk-line-strong); background: var(--panel); color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 650; line-height: 1.2; text-decoration: none; white-space: nowrap; cursor: pointer; }
.dk-btn:hover { border-color: var(--accent); background: var(--hover); }
.dk-btn.dk-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.dk-btn.dk-primary:hover { background: color-mix(in srgb, var(--accent) 86%, #000); }
.dk-btn.dk-green { background: var(--ok-solid); border-color: var(--ok-solid); color: #fff; }
.dk-btn.dk-green:hover { background: color-mix(in srgb, var(--ok-solid) 88%, #000); }
.dk-btn:disabled { opacity: .55; cursor: not-allowed; }
.dk-btn[aria-busy="true"] { cursor: progress; }
.dk-big-btn { min-height: 40px; padding: 0 16px; font-size: 14px; }
@media (pointer: coarse) { .dk-btn, .dk-toggle, .dk-day, .dk-link, .dk-sort { min-height: 40px; } .desk .dk-fsel select { min-height: 40px; } }

/* candidate cards (styled like a wallet pass: navy strip, small-caps labels) */
.dk-list { min-width: 0; container: dk-list / inline-size; }
.dk-cardlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.dk-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.dk-card.is-sel, .dk-card.is-call { border-color: var(--sel-line); }
.dk-card-head { background: var(--card-head); color: #fff; display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.dk-n { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .6); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.dk-av { width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--sand); color: #1c2e4b; display: grid; place-items: center; font-weight: 700; font-size: 14px; letter-spacing: .03em; object-fit: cover; }
.dk-av-s { width: 28px; height: 28px; font-size: 11px; }
.dk-who { flex: 1; min-width: 0; }
.desk .dk-name { margin: 0; font-size: 15px; font-weight: 650; line-height: 1.3; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-track { font-size: 12.5px; color: var(--card-head-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-badge { flex: none; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.dk-badge.b-ranked { background: #fff; color: #1c2e4b; }
.dk-badge.b-strong { background: var(--sand); color: #1c2e4b; }
.dk-badge.b-some { border: 1px solid rgba(255, 255, 255, .65); color: #fff; }
.dk-badge.b-none { border: 1px dashed rgba(255, 255, 255, .5); color: var(--card-head-ink); }
.dk-card-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.dk-fields { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 16px; }
.dk-f { min-width: 0; }
.dk-f dt { font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.dk-f dd { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-reason { font-size: 13.5px; padding: 6px 10px; border-radius: 6px; background: var(--zebra); }
.dk-warn { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 6px; background: var(--dk-warn-bg); border: 1px solid var(--dk-warn-line); }
.dk-warn .dk-ic { color: var(--warn); margin-top: 1px; }
.dk-mark { font-size: 12.5px; color: var(--muted); }
.dk-error { color: var(--bad); font-weight: 600; font-size: 13.5px; }
.dk-card-acts { display: flex; flex-wrap: wrap; gap: 8px; }

/* the call state */
.dk-call { background: var(--dk-call-bg); padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.dk-call-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.dk-call-l { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.dk-holds { font-size: 13px; padding: 2px 8px; border-radius: 4px; background: var(--panel); border: 1px solid var(--dk-line-strong); }
.dk-holds strong { font-size: 15px; }
.dk-holds.is-low { background: var(--dk-warn-bg); border-color: var(--dk-warn-line); color: var(--warn); }
.dk-phone { align-self: flex-start; color: var(--ink); text-decoration: none; font-size: clamp(24px, 4vw, 34px); font-weight: 700; line-height: 1.15; letter-spacing: .01em; border-radius: 4px; overflow-wrap: anywhere; }
.dk-phone:hover { text-decoration: underline; text-underline-offset: 5px; }
.dk-nophone { display: flex; gap: 8px; align-items: flex-start; font-weight: 650; }
.dk-nophone .dk-ic { color: var(--warn); margin-top: 2px; }
.dk-call-btns, .dk-call-result { display: flex; flex-wrap: wrap; gap: 8px; }
.dk-script { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; }
.dk-script-t { margin-top: 2px; font-size: 14.5px; }
.dk-call-result { padding-top: 10px; border-top: 1px solid var(--dk-line-strong); }

/* Everyone eligible: a sortable table, rows open into the card */
.dk-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: 13.5px; }
.dk-table th { text-align: left; padding: 0 8px; height: 32px; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid var(--line); background: var(--zebra); font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.dk-table td { padding: 4px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-table tbody tr:last-child td { border-bottom: 0; }
.dk-table .n { text-align: right; }
.dk-sort { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0; border: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.dk-table th.n .dk-sort { width: 100%; justify-content: flex-end; }

.dk-sort:hover { color: var(--ink); }
.dk-sort-ar { display: inline-block; width: 1ch; }
/* The name has the first claim on width; study takes what is left, so it truncates before the name. */
.dk-table th.dk-col-name { width: 30%; }
.dk-table th.dk-col-year { width: 84px; }
.dk-table th.dk-col-match { width: 128px; }
.dk-table th.dk-col-where { width: 18%; }
.dk-table th.dk-col-seats { width: 88px; }
.dk-table th.dk-col-chev { width: 32px; }
.dk-row { cursor: pointer; }
.dk-row:hover > td { background: var(--hover); }
.dk-row.is-sel > td { background: var(--dk-sel-bg); }
.dk-row.is-open > td { border-bottom-color: transparent; }
.dk-rowbtn { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; min-height: 36px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.dk-row-main { display: flex; flex-direction: column; min-width: 0; }
.dk-row-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-row-sub { display: none; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-col-where.is-free { color: var(--ok); font-weight: 650; }
.dk-tag { font-size: 11.5px; font-weight: 700; padding: 1px 6px; border-radius: 4px; white-space: nowrap; }
.dk-tag.b-ranked { background: var(--card-head); color: #fff; }
.dk-tag.b-strong { background: var(--sand); color: #1c2e4b; }
.dk-tag.b-some { border: 1px solid var(--dk-line-strong); color: var(--ink); }
.dk-tag.b-none { border: 1px dashed var(--dk-line-strong); color: var(--muted); }
.dk-row-mark { display: block; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.dk-chev { color: var(--muted); transition: transform .15s; }
.dk-row.is-open .dk-chev { transform: rotate(180deg); }
.dk-xrow > td { padding: 0 8px 10px; white-space: normal; overflow: visible; }

/* empty state, dialogs */
.dk-empty { padding: 28px 16px; text-align: center; border: 1px dashed var(--dk-line-strong); border-radius: var(--radius); background: var(--panel); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dk-empty-t { font-size: 15px; font-weight: 700; }
.dk-empty-h { color: var(--muted); max-width: 52ch; }
.dk-modal { width: min(880px, calc(100vw - 16px)); max-width: none; max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); box-shadow: 0 20px 50px -12px rgba(0, 0, 0, .45); }
.dk-modal[open] { display: flex; flex-direction: column; }
.dk-modal::backdrop { background: var(--scrim); }
.dk-modal-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.desk .dk-modal-title { margin: 0; font-size: 17px; overflow-wrap: anywhere; }
.dk-modal-sub { color: var(--muted); font-size: 13px; }
.dk-modal-acts { display: flex; gap: 8px; }
.dk-cv-body { flex: 1; min-height: 0; overflow: auto; background: var(--ground); }
.dk-cv-frame { display: block; width: 100%; height: min(78vh, 1000px); border: 0; background: #fff; }
.dk-cv-img { display: block; max-width: 100%; margin: 0 auto; }
.dk-keys { width: min(520px, calc(100vw - 16px)); }
.dk-keylist { margin: 0; padding: 12px 16px; display: grid; gap: 6px; }
.dk-keylist > div { display: grid; grid-template-columns: 9.5em minmax(0, 1fr); gap: 12px; align-items: baseline; }
.dk-keylist dd { margin: 0; }
.dk-keys > .dk-quiet { padding: 0 16px 14px; }

@media (max-width: 900px) {
  .desk { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  /* One column: choosing an activity scrolls its detail in; this link goes back up to the list. */
  .dk-back { display: inline-flex; align-items: center; align-self: flex-start; padding: 0; }
}
/* A narrow Everyone-eligible table (phones, and 641–1200 px windows, where the list column is
   narrow too) would squeeze Study to nothing: study, year and where now move under the name. */
@container dk-list (max-width: 800px) {
  .dk-table th.dk-col-study, .dk-table td.dk-col-study, .dk-table th.dk-col-year, .dk-table td.dk-col-year,
  .dk-table th.dk-col-where, .dk-table td.dk-col-where { display: none; }
  .dk-table th.dk-col-name { width: auto; }
  .dk-row-sub { display: block; }
  /* "Seats given" on two lines over a narrower number column. */
  .dk-table th.dk-col-seats { width: 64px; white-space: normal; line-height: 1.1; overflow: visible; }
  .dk-table th.dk-col-seats .dk-sort { text-align: right; }
}
@media (max-width: 640px) {
  .dk-selects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .desk .dk-sel-title { font-size: 18px; }
  .dk-keyhint { display: none; }
}
@media (max-width: 440px) {
  .dk-act { grid-template-columns: 44px minmax(0, 1fr); }
  .dk-act-side { grid-column: 2; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; text-align: left; white-space: normal; }
  .dk-table th.dk-col-match { width: 104px; }
  .dk-table th.dk-col-seats { width: 48px; }
  .dk-card-head { flex-wrap: wrap; }
  .dk-badge { margin-left: auto; }
  .dk-call-btns .dk-btn, .dk-call-result .dk-btn { flex: 1 1 auto; }
  .dk-modal-head { padding: 10px 12px; }
}

/* ---------- rooms (/rooms): checklist, headcount, help requests; admin › rooms ---------- */
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 16px; align-items: start; }
.rooms > .panel { margin: 0; }
.room.is-ended { opacity: .72; }
.room-head { align-items: flex-start; }
.room-head h2 { margin: 0 0 2px; }
.room-head .actions { margin: 0; }
.room-kind { margin: 0 0 2px; font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.room-status { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.room-count { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 10px; }
.room-count > div { background: var(--ground); border-radius: var(--radius-sm); padding: 8px 10px; }
.room-count dt { font-size: 12px; color: var(--muted); }
.room-count dd { margin: 0; font-size: 22px; font-weight: 700; line-height: 1.2; }
.room-expected { margin: 0 0 10px; }
.room-expected summary { cursor: pointer; font-weight: 600; }
.room-expected ul { margin: 6px 0 0; padding-left: 20px; columns: 2 160px; }
.checklist { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.checklist li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.check-item { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 12px 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--field); color: var(--ink); font: inherit; cursor: pointer; text-align: left; flex: 1 1 200px; }
.check-item:hover { background: var(--hover); }
.check-box { display: inline-grid; place-items: center; width: 24px; height: 24px; flex: none; border: 2px solid var(--muted); border-radius: 6px; font-weight: 800; }
.check-item.is-done { border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 9%, var(--panel)); }
.check-item.is-done .check-box { border-color: var(--ok); background: var(--ok); color: var(--panel); }
.check-by { font-size: 12.5px; color: var(--muted); }
.asks { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 6px; }
.ask { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; padding: 8px 10px; border-radius: var(--radius-sm); border-left: 4px solid var(--bad); background: color-mix(in srgb, var(--bad) 7%, var(--panel)); overflow-wrap: anywhere; }
.ask.is-handled { border-left-color: var(--ok); background: var(--ground); }
.ask-what { flex: 1 1 200px; }
.ask-sub { flex-basis: 100%; order: 2; font-size: 12.5px; color: var(--muted); }
.ask .btn { order: 1; }
.room-ask { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.room-ask-h { margin: 0 0 6px; font-weight: 650; }
.item-list { list-style: none; margin: 0; padding: 0; }
.item-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.check-row { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.check-row .check { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
.buddy-form { padding: 10px 0; border-bottom: 1px solid var(--line); }
.buddy-form fieldset { margin: 0; }
.buddy-form .actions { margin-top: 6px; }
.room-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; text-decoration: none; }
.buddy-form summary { cursor: pointer; padding: 4px 0; }
.buddy-form summary .muted { font-weight: 400; }
.role-badge.role-buddy { background: #6fcf97; color: #06210f; border-color: transparent; }

/* ---------- one-time code ---------- */
.code-reveal { font: 700 30px/1.2 var(--mono); letter-spacing: .14em; background: var(--panel); border: 2px dashed var(--accent); border-radius: var(--radius-sm); padding: 12px 16px; display: inline-block; margin: 6px 0; user-select: all; }

/* ---------- login ---------- */
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent), var(--ground); }
.login-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px 24px 22px; box-shadow: var(--shadow); text-align: center; }
.login-card h1 { font-size: 22px; }
.login-card form { text-align: left; margin-top: 18px; }
.login-card input { font: 600 22px/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; text-align: center; }
.login-card .btn { width: 100%; min-height: 48px; font-size: 16px; margin-top: 12px; }
.login-foot { color: var(--muted); font-size: 12.5px; margin: 16px 0 0; }
/* The board's way in (a SCOPE admin login): folded away under the staff code, which volunteers use. */
.login-account { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); text-align: left; }
.login-account summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--accent); text-align: center; }
.login-account > p { font-size: 13px; margin: 10px 0 0; }
.login-account form { margin-top: 8px; }
.login-card .login-account input { font: 400 16px/1.3 var(--font); letter-spacing: normal; text-transform: none; text-align: left; }
.login-account .field + .field { margin-top: 10px; }

/* ---------- toast ---------- */
.toast-ui { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 40; max-width: min(560px, calc(100vw - 24px)); background: var(--ink); color: var(--ground); padding: 12px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow); font-weight: 600; }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  h1 { font-size: 21px; }
  .wrap { padding: 16px 12px 48px; }
  .panel { padding: 14px 14px 12px; }
  .appbar-in { padding: 6px 12px; gap: 6px 10px; }
  .brand-text small { display: none; }
  .who-name { display: none; }
  .clock time { font-size: 15px; }
  .appnav-in { padding: 0 4px; }
  .appnav a { padding: 11px 8px 9px; font-size: 13.5px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile-n { font-size: 24px; }
  table.data th, table.data td { padding: 7px 9px; }
  .hide-sm { display: none; }
}
@media (max-width: 440px) {
  /* Phone: logo, clock, role and log out on one row; the page title says which event. */
  .brand-text { display: none; }
  .appbar .btn-bar { padding: 6px 10px; }
}
@media (max-width: 640px) {
  .page-head { margin-bottom: 12px; }
  .page-head .lede { font-size: 14px; }
  /* Compact tiles: number and label on one line, the sub-line dropped. */
  .tiles.compact-sm { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
  .tiles.compact-sm .tile { display: flex; align-items: baseline; gap: 6px; flex: 1 1 auto; padding: 6px 10px; border-top-width: 1px; border-left: 4px solid var(--tone, var(--line)); box-shadow: none; }
  .tiles.compact-sm .tile-n { font-size: 18px; }
  .tiles.compact-sm .tile-l { margin: 0; font-size: 11px; letter-spacing: .04em; }
  .tiles.compact-sm .tile-s { display: none; }
  /* The board rule: one line until opened. */
  details.notice.rule:not([open]) > summary { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  details.notice.rule:not([open]) > summary::after { content: none; }
  /* No scroll box inside the page scroll on a phone. */
  .table-wrap.tall { max-height: none; overflow-y: visible; }
  /* Narrow tables as cards: one row = one card, each cell labelled. */
  .table-wrap.stack-sm, .table-wrap:has(> table.stack) { border: 0; background: transparent; overflow: visible; }
  table.data.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.data.stack, table.data.stack tbody, table.data.stack tr { display: block; width: 100%; }
  table.data.stack tr { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); padding: 8px 12px; margin: 0 0 8px; }
  table.data.stack td { display: block; border: 0; padding: 2px 0; background: transparent !important; min-width: 0; }
  table.data.stack td.n { display: inline-block; text-align: left; margin-right: 14px; }
  table.data.stack td.time { display: inline-block; margin-right: 10px; font-weight: 650; }
  table.data.stack td[data-label="Activity"] { display: inline; }
  table.data.stack td.who-cell { font-weight: 650; }
  table.data.stack td.reason { min-width: 0; max-width: none; }
  table.data.stack td.time:empty { display: none; }
  table.data.stack td.n[data-label]::before, table.data.stack td[data-label="Why"]::before, table.data.stack td[data-label="Now"]::before,
  table.data.stack td[data-label="Entrance"]::before, table.data.stack td[data-label="Cancelled"]::before { content: attr(data-label) " "; color: var(--muted); font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
  table.data.stack td.act { padding-top: 6px; }
  table.data.stack.labelled td { display: block; margin: 0; }
  table.data.stack.labelled td[data-label="Activity"]::before, table.data.stack.labelled td[data-label="Start"]::before { content: attr(data-label) " "; color: var(--muted); font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
  table.data.stack.labelled td.time { font-weight: 400; }
  table.data.stack.inline-cells td { display: inline-block; vertical-align: middle; margin: 4px 8px 0 0; }
  table.data.stack.inline-cells td:first-child { display: block; margin: 0; font-weight: 650; }
  table.data.stack.inline-cells td:empty { display: none; }
  table.data.stack td.hide-sm { display: none; }
  table.data.stack tbody tr:hover td { background: transparent; }
}
/* Phones (day crew, buddies, the desk on the floor): every control a 44 px tap target, small buttons included. */
@media (max-width: 640px) {
  .btn, button.btn, .btn.small, .appbar .btn-bar, .skip, .subnav a, nav.days a { min-height: 44px; }
  .skip { display: inline-flex; align-items: center; }
  /* 16 px: iOS Safari zooms the page into any smaller field on focus. */
  input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="date"], input[type="datetime-local"], input[type="number"], input:not([type]), select { min-height: 44px; font-size: 16px; }
  textarea { font-size: 16px; }
  details:not(.dk-rule) > summary { min-height: 44px; padding-block: 10px; } /* the desk rule: the whole bordered box is the target */
}
/* Very short viewports (landscape phone, 200 % zoom): the header scrolls away instead of covering the page. */
@media (max-height: 500px) {
  .appbar { position: static; }
}
@media print { .appbar, .appnav, .subnav, .actions, .toolbar { display: none !important; } body { background: #fff; } .panel { box-shadow: none; } }
