/* Tive queue board. Follows the Tive UX/UI refresh (concept C, approved October 8, 2026) as drawn on the Staff
   console board: system font, Midnight top bar, grouped white cards, rounded-rectangle buttons, status as a dot
   plus a word, stroke icons. Sources: ~/Code/Tive/work/design-boards/split/staff (ui.js, lib.js) and
   ~/Code/Tive/work/design-boards/build/BRIEF.md. */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Segoe UI", Roboto, sans-serif;
  --ink: #141a26;           /* Midnight: text, primary actions, top bar */
  --deep: #0369a1;          /* Sky Deeper: selected, links, count badges */
  --ground: #eef3f8;        /* page */
  --grouped: #f2f5f9;       /* grouped and table header background */
  --card: #ffffff;
  --line: #d5dde8;          /* card borders */
  --sep: #e6ecf3;           /* row separators */
  --field: #b6c3d4;         /* field and secondary button borders */
  --chip-line: #c3cedb;
  --sub: #465568;
  --mute: #566379;
  --body: #324154;
  --hi: #eaf6fe;            /* highlighted row */
  --good-bg: #dff5e7; --good-fg: #0a5c33;
  --blue-bg: #e1f0fb; --blue-fg: #0369a1;
  --amber-bg: #fdf0d5; --amber-fg: #8a4b00;
  --grey-bg: #e1e8f0; --grey-fg: #324154;
  --red-bg: #fbe4e2; --red-fg: #8f1d17;
  --dot-ready: #0a7a42; --dot-call: #0369a1; --dot-zoom: #6b3fa0; --dot-break: #8a4b00; --dot-away: #8795ab;
  --radius-card: 14px; --radius-btn: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #ffffff; --ground: #0f141e; --grouped: #1b2232; --card: #141a26; --line: #324154; --sep: #232c3e;
    --field: #5f6f88; --chip-line: #5f6f88; --sub: #cbd5e1; --mute: #a3b1c6; --body: #e1e8f0; --hi: #1e3a52;
    --deep: #50c9ff;
    --good-bg: #13321f; --good-fg: #86efac; --blue-bg: #1e3a52; --blue-fg: #c5e9fe; --amber-bg: #3b2a0c; --amber-fg: #fcd34d;
    --grey-bg: #232c3e; --grey-fg: #e1e8f0; --red-bg: #3f1d1d; --red-fg: #fca5a5;
    --dot-ready: #4ade80; --dot-call: #50c9ff; --dot-zoom: #c4a5f5; --dot-break: #fbbf24; --dot-away: #93a2b9;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--ground); color: var(--ink); font: 15px/1.4 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
button, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--deep); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 18px; height: 18px; flex: none; }

/* ---------- top bar (Midnight, as the Staff console) ---------- */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; flex-wrap: wrap; gap: 14px;
  padding: 10px 24px; min-height: 60px; background: #141a26; color: #ffffff; }
.topbar .logo { height: 28px; width: auto; flex: none; }
.topbar .title { font-size: 17px; font-weight: 700; }
.topbar .spacer { flex: 1; }
.bar-pill { height: 30px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.bar-pill .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.bar-live { background: rgba(74, 222, 128, 0.16); color: #86efac; }
.bar-delayed { background: rgba(251, 191, 36, 0.18); color: #fcd34d; }
.bar-down { background: rgba(248, 113, 113, 0.2); color: #fca5a5; }
.bar-alert { background: #fdf0d5; color: #6b3a00; }
@media (prefers-reduced-motion: no-preference) { .bar-alert.pulse { animation: qb-pulse 2s ease-in-out infinite; } }
@keyframes qb-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(253, 240, 213, 0); } 50% { box-shadow: 0 0 0 6px rgba(253, 240, 213, 0.35); } }
.who { height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.35); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; }
.btn-glass { height: 38px; padding: 0 14px; border-radius: var(--radius-btn); background: rgba(255, 255, 255, 0.18); color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35); font-weight: 600; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.topbar form { margin: 0; }

/* ---------- page ---------- */
main.page { padding: 22px 32px 40px; display: flex; flex-direction: column; gap: 16px; max-width: 1920px; margin: 0 auto; }
.head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.head-text { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 4px; }
.head h1 { font-size: 26px; }
.head p { margin: 0; font-size: 14px; color: var(--sub); }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.stat { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; border-radius: var(--radius-card); background: var(--card); border: 1px solid var(--line); min-width: 0; }
.stat .k { font-size: 13px; color: var(--mute); display: flex; align-items: center; gap: 6px; }
.stat .k .dot { width: 9px; height: 9px; border-radius: 50%; }
.stat strong { font-size: 30px; line-height: 1.05; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 13px; color: var(--mute); }
.stat.warn { background: var(--amber-bg); border-color: var(--amber-fg); }
.stat.warn .s, .stat.warn .k { color: var(--amber-fg); font-weight: 600; }

/* Buttons, chips, fields (Staff console kit) */
.btn { height: 38px; padding: 0 14px; border-radius: var(--radius-btn); font-size: 14px; font-weight: 600; display: inline-flex; align-items: center;
  justify-content: center; gap: 7px; white-space: nowrap; cursor: pointer; background: var(--card); color: var(--ink); border: 1px solid var(--field); }
.btn:hover { filter: brightness(0.97); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.chips, .tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { height: 32px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; background: var(--card); color: var(--ink); border: 1px solid var(--chip-line); white-space: nowrap; }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; }
.chip[aria-pressed="true"] { background: #141a26; color: #ffffff; border-color: #141a26; }
.chip .n { font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; border: 1px solid var(--field); border-radius: var(--radius-btn); overflow: hidden; background: var(--card); }
.seg button { height: 36px; padding: 0 12px; border: none; background: transparent; font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--body); }
.seg button + button { border-left: 1px solid var(--field); }
.seg button[aria-pressed="true"] { background: #141a26; color: #ffffff; }
.field { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--body); }
.field select { height: 38px; padding: 0 10px; border-radius: var(--radius-btn); border: 1px solid var(--field); background: var(--card); color: var(--ink); font-size: 14px; }

/* Pills and status */
.pill { height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; flex: none; }
.t-blue { background: var(--blue-bg); color: var(--blue-fg); }
.t-amber { background: var(--amber-bg); color: var(--amber-fg); }
.t-grey { background: var(--grey-bg); color: var(--grey-fg); }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; color: var(--body); white-space: nowrap; }
.status .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.d-ready { background: var(--dot-ready); } .d-call { background: var(--dot-call); } .d-zoom { background: var(--dot-zoom); }
.d-break { background: var(--dot-break); } .d-away { background: var(--dot-away); }

/* ---------- panels ---------- */
.panels { display: grid; grid-template-columns: minmax(0, 3fr) minmax(340px, 2fr); gap: 16px; align-items: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-card); display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.card > header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--sep); }
.card > header h2 { font-size: 17px; font-weight: 700; flex: 1; }
.card > header .meta { font-size: 13px; color: var(--mute); font-weight: 600; }

/* Roster: grouped sections */
.group-h { display: flex; align-items: center; gap: 8px; padding: 9px 16px; background: var(--grouped); border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 700; color: var(--mute); text-transform: uppercase; letter-spacing: 0.03em; }
.group-h .dot { width: 9px; height: 9px; border-radius: 50%; }
ul.rows { list-style: none; margin: 0; padding: 0; }
.row, .cols-h { display: grid; grid-template-columns: 36px minmax(0, 1.6fr) minmax(0, 1.3fr) 92px 112px; gap: 12px; align-items: center; padding: 8px 16px; }
.row { min-height: 60px; border-bottom: 1px solid var(--sep); }
ul.rows > li:last-child { border-bottom: none; }
.cols-h { font-size: 12px; font-weight: 700; color: var(--mute); text-transform: uppercase; letter-spacing: 0.03em; border-bottom: 1px solid var(--line); }
.cols-h span:nth-child(4), .cols-h span:nth-child(5) { text-align: right; }
.av { width: 36px; height: 36px; border-radius: 10px; background: var(--blue-bg); color: var(--blue-fg); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; }
.two { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.two .a { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.two .b { font-size: 12px; color: var(--mute); display: flex; gap: 4px 8px; align-items: center; flex-wrap: wrap; }
.doing { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.doing .q { font-size: 13px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-big { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.since { font-size: 13px; color: var(--mute); text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 28px 16px; text-align: center; color: var(--mute); font-weight: 600; }
.q-inline { display: none; }

/* Queues table */
.qhead, .qrow { display: grid; grid-template-columns: minmax(0, 1fr) 76px 120px; gap: 12px; align-items: center; padding: 9px 16px; }
.qhead { background: var(--grouped); border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--mute); text-transform: uppercase; letter-spacing: 0.03em; }
.qhead span:nth-child(n+2) { text-align: right; }
.qrow { min-height: 52px; border-bottom: 1px solid var(--sep); font-size: 15px; }
.qrow:last-child { border-bottom: none; }
.qrow .name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.qrow .cnt { justify-self: end; }
.qrow .wait { justify-self: end; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.count { min-width: 30px; height: 26px; padding: 0 9px; border-radius: 999px; font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.count-on { background: #0369a1; color: #ffffff; }
.count-zero { color: var(--mute); border: 1px solid var(--line); }
.qrow.waiting { background: var(--hi); }
.qrow.long { background: var(--amber-bg); box-shadow: inset 4px 0 0 var(--amber-fg); }
.qrow .tm { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Compact: many people at once, multi-column, one line each */
[data-density="compact"] .cols-h { display: none; }
[data-density="compact"] #roster ul.rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
[data-density="compact"] .row { grid-template-columns: 28px minmax(0, 1fr) auto; min-height: 48px; padding: 6px 12px; gap: 8px; }
[data-density="compact"] .av { width: 28px; height: 28px; font-size: 11px; border-radius: 8px; }
[data-density="compact"] .row .doing, [data-density="compact"] .row .since { display: none; }
[data-density="compact"] .two .a { font-size: 14px; }
[data-density="compact"] .q-inline { display: flex; flex-basis: 100%; gap: 6px; align-items: center; flex-wrap: wrap; }
[data-density="compact"] .t-big { font-size: 16px; }
[data-density="compact"] .stat strong { font-size: 24px; }

@media (max-width: 1200px) { .panels { grid-template-columns: 1fr; } .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .topbar { padding: 10px 16px; gap: 10px; }
  .topbar .who { display: none; }
  main.page { padding: 16px 16px 32px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panels > .card:last-child { order: -1; }
  .chips { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 4px; }
  .chip { flex: none; }
  #mini-btn, #full-btn { display: none; }
  .cols-h { display: none; }
  .row, [data-density="compact"] .row { grid-template-columns: 36px minmax(0, 1fr) auto; }
  .row .doing { display: flex !important; grid-column: 2 / -1; grid-row: 2; }
  .row .since { display: none; }
  .qhead, .qrow { grid-template-columns: minmax(0, 1fr) 56px 92px; }
}

/* ---------- sign-in ---------- */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--ground); }
.signin-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.signin-card .logo { height: 32px; width: auto; align-self: flex-start; }
.signin-card h1 { font-size: 26px; }
.signin-card p { margin: 0; color: var(--sub); font-size: 15px; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-light { display: none; } :root:not([data-theme="light"]) .logo-dark { display: block; } }
.note { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: 12px; font-size: 14px; line-height: 1.4; }
.note-good { background: var(--good-bg); color: var(--good-fg); }
.note-amber { background: var(--amber-bg); color: var(--amber-fg); }
.note-red { background: var(--red-bg); color: var(--red-fg); }
/* Google's "Sign in with Google" button, light theme, per Google's sign-in branding guidelines. */
.gsi { height: 40px; padding: 0 12px; border-radius: 4px; background: #ffffff; border: 1px solid #747775; color: #1f1f1f;
  font: 500 14px/20px Roboto, var(--font); letter-spacing: 0.25px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; }
.gsi svg { width: 20px; height: 20px; }
.gsi:hover { background: #f8fafd; }

/* ---------- mini view ---------- */
.mini { padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--ground); min-height: 100vh; }
.mini-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mini-age { font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; color: var(--mute); }
.mini-age .dot { width: 8px; height: 8px; border-radius: 50%; }
.mini-wait { font-size: 22px; font-weight: 700; }
.mini ul { list-style: none; margin: 0; padding: 0; }
.mini .mq, .mini .mp { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-bottom: 1px solid var(--sep); font-size: 13px; }
.mini .mq:last-child, .mini .mp:last-child { border-bottom: none; }
.mini .mq.long { background: var(--amber-bg); color: var(--amber-fg); font-weight: 700; }
.mini .mp .nm { display: flex; align-items: center; gap: 7px; min-width: 0; font-weight: 600; }
.mini .mp .nm .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.mini .mp .nm span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .mp .st { font-size: 12px; color: var(--mute); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mini .group-h { padding: 6px 10px; }
body.mini-only .topbar, body.mini-only main.page { display: none; }
.signin-card p.fine { font-size: 13px; color: var(--mute); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chip[aria-pressed="true"], :root:not([data-theme="light"]) .seg button[aria-pressed="true"] { background: #50c9ff; color: #141a26; border-color: #50c9ff; }
}

/* Wall view: a shared screen nobody touches. Controls hidden, type larger. */
.wall .head .tools, .wall .toolbar, .wall .topbar form, .wall .topbar .who { display: none; }
.wall .head p { display: none; }
.wall body { font-size: 17px; }
.wall .stat strong { font-size: 40px; }
.wall .two .a { font-size: 18px; }
.wall .t-big { font-size: 24px; }
.wall .qrow { font-size: 18px; min-height: 60px; }
.wall .qrow .tm { font-size: 20px; }

/* The long-wait setting for people who are not leads: visibly read-only, with the reason in words. */
.field select:disabled { background: var(--grouped); color: var(--mute); border-style: dashed; cursor: not-allowed; }
.field .lead-only { font-size: 12px; font-weight: 600; color: var(--mute); }

@media (max-width: 700px) {
  .topbar { position: static; }
  .bar-pill { height: 26px; font-size: 12px; padding: 0 10px; }
}

/* Location chip: place and time zone. */
.pill.loc { font-weight: 600; }
.ico-sm { width: 12px; height: 12px; }
