/* Mano staff dashboard. Brand tokens from ManoApp/Sources/Brand/Brand.swift. */
:root {
  --blue: #2563eb;
  --blue-dark: #1e40af;
  --blue-light: #dbeafe;
  --blue-ink: #1e40af;   /* text on --blue-light */
  --ice: #bfdbfe;
  --ink: #0f172a;
  --slate: #64748b;
  --slate-strong: #475569;
  --mist: #f1f5f9;
  --border: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --stop: #b91c1c;
  --stop-bg: #fee2e2;
  --other: #93c5fd;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(30, 58, 138, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e2e8f0;
    --slate: #94a3b8;
    --slate-strong: #cbd5e1;
    --mist: #1e293b;
    --border: #334155;
    --bg: #0b1120;
    --card: #111827;
    --blue-light: #1e3a8a;
    --blue-ink: #dbeafe;
    --ice: #1e40af;
    --ok-bg: #052e16;
    --warn-bg: #451a03;
    --stop-bg: #450a0a;
    --other: #1d4ed8;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.accent { font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif; font-style: italic; color: var(--blue); font-weight: 600; }
.muted { color: var(--slate); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.hidden { display: none !important; }

/* Layout */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px 24px; flex-wrap: wrap;
  padding: 12px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: baseline; gap: 8px; font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
.brand small { font-weight: 600; font-size: 13px; color: var(--slate); letter-spacing: 0; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav button {
  border: 0; background: none; padding: 8px 12px; border-radius: 10px; cursor: pointer; white-space: nowrap;
  color: var(--slate-strong); font-weight: 600;
}
nav button[aria-current="page"] { background: var(--blue-light); color: var(--blue-ink); }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 14px; }
main { max-width: 1200px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.page-head .controls { display: grid; gap: 8px; justify-items: end; }
.hint { font-size: 13px; color: var(--slate); }
.grow { flex: 1; }

/* Cards and tiles */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
main > .card + .card, main > .grid + .card, main > .card + .grid, main > .grid + .grid { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin-bottom: 0; }
.card h2 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.tile .label { color: var(--slate); font-size: 13px; font-weight: 600; }
.tile .value { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .sub { color: var(--slate); font-size: 13px; }

/* Controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--card); font-weight: 600;
}
.btn:hover { border-color: var(--slate); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.danger { color: var(--stop); }
.btn.small { min-height: 28px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, nav button:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 2px;
}
input, select, textarea {
  min-height: 36px; padding: 6px 10px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card);
}
textarea { min-height: 84px; width: 100%; resize: vertical; }
label.field { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--slate-strong); }
label.field input, label.field select { width: 100%; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: 12px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--card); padding: 6px 12px; cursor: pointer; font-weight: 600; color: var(--slate-strong); }
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed="true"] { background: var(--blue-light); color: var(--blue-ink); }
.chip {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; padding: 3px 6px 3px 12px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 999px; background: var(--card); font-size: 13px; font-weight: 600;
}
.chip span { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 999px; background: var(--mist); color: var(--slate-strong); }
.chip:hover { border-color: var(--slate); }
.chip:focus-visible, tr.clickable:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--slate); font-weight: 700; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr:hover { background: var(--mist); }
tr.clickable { cursor: pointer; }
tr.day td { background: var(--mist); padding: 8px 12px; font-size: 14px; }
table.videos td.time { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { padding: 28px; text-align: center; color: var(--slate); }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--mist); color: var(--slate-strong); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.off { background: var(--stop-bg); color: var(--stop); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.tag { background: none; border: 1px solid var(--border); padding: 1px 7px; font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.badge.role-admin { background: var(--blue-light); color: var(--blue-ink); }
.badge.role-manager { background: var(--warn-bg); color: var(--warn); }
.badge.role-site_lead { background: var(--ok-bg); color: var(--ok); }
.badge.role-org_admin { background: var(--blue-light); color: var(--blue-ink); border: 1px solid var(--blue-ink); }
/* PRD E-13: recorded far from its site; the pin and the words carry it, not the color. */
.badge.off-site { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; }
svg.icon { fill: currentColor; flex: none; vertical-align: -1px; }
.seg button svg.icon { margin-right: 4px; }
label.field > .muted { font-weight: 400; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; letter-spacing: .06em; font-size: 15px; }

/* Bars */
.bar { height: 8px; border-radius: 4px; background: var(--mist); overflow: hidden; display: flex; min-width: 80px; }
.bar span { display: block; height: 100%; }
.bar .p { background: var(--blue); }
.bar .o { background: var(--other); }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--slate); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .p { background: var(--blue); }
.legend .o { background: var(--other); }
svg.chart { width: 100%; height: 220px; display: block; }
svg.chart .p { fill: var(--blue); }
svg.chart .o { fill: var(--other); }
svg.chart .axis { fill: var(--slate); font-size: 11px; }
svg.chart .grid-line { stroke: var(--border); }

/* Messages */
.notice { padding: 10px 14px; border-radius: 10px; font-weight: 600; margin-bottom: 16px; }
.notice.error { background: var(--stop-bg); color: var(--stop); }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.info { background: var(--mist); color: var(--slate-strong); }
.notice .btn { margin-left: 10px; }
.empty .btn { margin-top: 12px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 20; box-shadow: var(--shadow); }

/* Drawer */
.scrim { position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 10; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); z-index: 11;
  background: var(--card); border-left: 1px solid var(--border); padding: 24px; overflow-y: auto;
  display: grid; gap: 16px; align-content: start;
}
.drawer h2 { font-size: 22px; font-weight: 800; }
.drawer section { border-top: 1px solid var(--border); padding-top: 14px; display: grid; gap: 10px; }
.drawer h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--slate); }
.checks { display: grid; gap: 6px; max-height: 180px; overflow: auto; }
.checks label { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.drawer.wide { width: min(960px, 100vw); }
.drawer .notice { margin-bottom: 0; }
video.player { display: block; width: 100%; aspect-ratio: 16 / 9; max-height: 62vh; background: #000; border-radius: 10px; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 20px; margin: 0; }
.kv dt { color: var(--slate); font-size: 13px; font-weight: 600; padding-top: 1px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.ids { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.vlm-summary { font-size: 16px; line-height: 1.45; }
.vlm-run-head { display: flex; justify-content: flex-end; margin-bottom: -36px; position: relative; z-index: 1; }
.vlm-processing { display: grid; gap: 14px; padding: 16px; border: 1px solid var(--ice); border-radius: 12px; background: var(--card); }
.vlm-processing-copy { display: flex; align-items: flex-start; gap: 12px; }
.vlm-processing-copy p, .vlm-processing-meta { margin: 3px 0 0; }
.vlm-spinner { width: 18px; height: 18px; margin-top: 2px; flex: 0 0 auto; border: 3px solid #bfdbfe; border-top-color: var(--blue); border-radius: 50%; animation: vlm-spin .8s linear infinite; }
.vlm-progress { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.vlm-progress li { display: grid; justify-items: center; gap: 5px; color: var(--slate); text-align: center; font-size: 11px; }
.vlm-progress li > span { display: grid; place-items: center; width: 25px; height: 25px; border: 2px solid var(--border); border-radius: 50%; background: var(--card); font-weight: 800; }
.vlm-progress li.current { color: var(--blue-ink); }
.vlm-progress li.current > span { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(47, 123, 255, .12); }
.vlm-progress li.done > span { border-color: var(--blue); color: #fff; background: var(--blue); }
.vlm-processing-meta { font-size: 12px; }
@keyframes vlm-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .vlm-spinner { animation: none; } }
table.vlm-tasks td:first-child { white-space: nowrap; }
.vlm-issues { display: grid; gap: 6px; margin: 6px 0 0; padding-left: 20px; }
.vlm-block { display: grid; gap: 6px; }
.vlm-block > p { margin: 0; }
.vlm-compact, .vlm-event-list { display: grid; gap: 4px; margin: 2px 0 0; padding-left: 20px; }
.vlm-details { border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; }
.vlm-details > summary { cursor: pointer; font-weight: 700; }
.vlm-details[open] > summary { margin-bottom: 10px; }
.vlm-timeline { min-width: 720px; }
.vlm-timeline td:first-child { white-space: nowrap; }
.vlm-graph { display: grid; gap: 10px; }
.vlm-json {
  max-height: 420px; overflow: auto; margin: 0; padding: 12px; border-radius: 8px;
  background: var(--mist); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.4;
}

/* QC under the player (qc_player.js). The bar is a canvas that reads its colours here. */
.player-stage { position: relative; }
.qc-overlay { position: absolute; z-index: 2; pointer-events: none; }
.vlm-caption {
  position: absolute; z-index: 3; left: 7%; right: 7%; bottom: max(56px, 10%); pointer-events: none;
  display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: baseline; gap: 3px 10px;
  width: fit-content; max-width: 86%; margin: auto; padding: 10px 14px; border-radius: 10px;
  color: #fff; background: rgba(9, 14, 25, .86); box-shadow: 0 4px 20px rgba(0, 0, 0, .35);
  font-size: clamp(13px, 1.8vw, 18px); line-height: 1.25; text-shadow: 0 1px 2px #000;
}
.vlm-caption.idle { background: rgba(55, 65, 81, .88); }
.vlm-caption-time { grid-row: 1 / span 2; align-self: center; font: 700 .7em/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; color: #bfdbfe; }
.vlm-caption-target, .vlm-caption-meta { grid-column: 2; font-size: .72em; color: #dbeafe; }
.vlm-caption-meta { color: #d1d5db; }
.qc {
  display: grid; gap: 10px;
  --qc-yes: var(--ok); --qc-no: var(--stop); --qc-unknown: var(--slate);
  --qc-todo: var(--mist); --qc-todo-line: var(--border);
}
.qc p { margin: 0; }
.qc-head { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; min-height: 28px; }
.qc-head > .muted { font-size: 13px; }
.qc-usable { font-weight: 700; font-variant-numeric: tabular-nums; }
.qc-actions { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; margin-left: auto; }
.qc-actions > .btn[aria-pressed="true"] { background: var(--blue-light); border-color: var(--blue-light); color: var(--blue-ink); }
.qc-hands { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; font-size: 13px; }
.qc-hands .btn[aria-pressed="true"] { background: var(--blue-light); border-color: var(--blue-light); color: var(--blue-ink); }
.qc-legend { display: flex; gap: 10px; color: var(--slate); }
.qc-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 999px; margin-right: 5px; }
.qc-timeline { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 12px; }
.qc-labels { display: grid; font-size: 12px; line-height: 12px; font-weight: 600; color: var(--slate); white-space: nowrap; }
.qc-labels b { margin-left: 6px; color: var(--ink); font-variant-numeric: tabular-nums; }
.qc-track { position: relative; cursor: pointer; border-radius: 4px; touch-action: manipulation; }
.qc-track:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.qc-bar { display: block; width: 100%; height: 100%; }
.qc-playhead {
  position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px;
  background: var(--ink); box-shadow: 0 0 0 1px var(--card); pointer-events: none;
}
.qc-hover { position: absolute; top: -2px; bottom: -2px; min-width: 3px; border: 1px solid var(--ink); border-radius: 2px; opacity: .5; pointer-events: none; }
.qc-tip {
  position: absolute; bottom: calc(100% + 10px); z-index: 2; width: max-content; max-width: min(320px, 100%);
  display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 12px; padding: 8px 10px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
  font-size: 13px; pointer-events: none;
}
.qc-tip strong { grid-column: 1 / -1; font-variant-numeric: tabular-nums; }
.qc-tip .k { color: var(--slate); font-weight: 600; }
.qc-tip .k.on { color: var(--ink); }
.qc-tip .y { color: var(--ok); }
.qc-tip .n { color: var(--stop); font-weight: 600; }
.qc-tip .u, .qc-tip .todo { color: var(--slate); }
.qc-foot { grid-column: 2; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 12px; font-size: 12px; color: var(--slate); font-variant-numeric: tabular-nums; }
.qc-keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 12px; }
.qc-key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.qc-key.y { background: var(--qc-yes); }
.qc-key.n { background: var(--qc-no); }
.qc-key.u { background: var(--qc-unknown); }
.qc-key.todo { background: repeating-linear-gradient(-45deg, var(--qc-todo-line) 0 2px, var(--qc-todo) 2px 5px); box-shadow: inset 0 0 0 1px var(--qc-todo-line); }
.qc-cell .muted { margin-top: 2px; font-size: 12px; white-space: nowrap; }
.badge.info { background: var(--blue-light); color: var(--blue-ink); }

/* Sign-in */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.signin .card { width: min(400px, 100%); padding: 28px; display: grid; gap: 14px; }
.signin h1 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }

@media (max-width: 720px) {
  .top { flex-wrap: wrap; gap: 8px 16px; padding: 10px 16px; }
  .who { margin-left: 0; width: 100%; justify-content: space-between; }
  main { padding: 16px; }
  .grid.two { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .page-head .controls { justify-items: start; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; }
}

/* Two-step sign-in set-up (renderMfaSetup) */
.steps { display: grid; gap: 10px; padding-left: 20px; }
.steps li { line-height: 1.45; }
.code.secret { margin: 8px 0 4px; padding: 10px 12px; background: var(--bg, #f5f5f5); border: 1px solid var(--border); border-radius: 8px; word-break: break-all; user-select: all; }
