/* The shell uses the Portal's warm paper tokens and IBM Plex, so the two feel like one product
   (10-candidate-experience.md §9). Text tokens are at least 4.5:1 on what they sit on, and nothing
   relies on colour alone. It follows the system's dark mode and the Portal's stored choice. */
@import url("./fonts/plex.css");

:root {
  color-scheme: light;
  --bg: #f0eee6; --surface: #fbfaf6; --surface-2: #f4f2ea; --surface-3: #e9e6da;
  --border: #e3ddce; --border-strong: #8d8775;
  --text: #2a2823; --text-2: #5c584d; --muted: #69655b;
  --accent: #a14f32; --accent-ink: #ffffff; --accent-soft: #f4e5da;
  --warn: #7f4f12; --warn-soft: #f6e9d0;
  --crit: #a93a2c; --crit-soft: #f5e0d9;
  --good: #2f6541;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 12px; --radius-sm: 8px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #211f1b; --surface: #2a2822; --surface-2: #302d27; --surface-3: #37332c;
    --border: #3d382f; --border-strong: #7d766a;
    --text: #f2efe6; --text-2: #c4bfb2; --muted: #a29d91;
    --accent: #d77f5c; --accent-ink: #231a13; --accent-soft: #3a2418;
    --warn: #e0aa5a; --warn-soft: #332711;
    --crit: #e88a78; --crit-soft: #3a201b;
    --good: #6dbb8a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #211f1b; --surface: #2a2822; --surface-2: #302d27; --surface-3: #37332c;
  --border: #3d382f; --border-strong: #7d766a;
  --text: #f2efe6; --text-2: #c4bfb2; --muted: #a29d91;
  --accent: #d77f5c; --accent-ink: #231a13; --accent-soft: #3a2418;
  --warn: #e0aa5a; --warn-soft: #332711;
  --crit: #e88a78; --crit-soft: #3a201b;
  --good: #6dbb8a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; display: flex; flex-direction: column; min-height: 100%; background: var(--bg); color: var(--text); font: 15px/1.55 var(--sans); }
h1, h2, h3 { margin: 0 0 8px; letter-spacing: -.01em; line-height: 1.25; }
h1 { font-size: 24px; }
h2 { font-size: 17px; margin-top: 20px; }
h3 { font-size: 15px; margin-top: 18px; }
h1:focus, h2:focus { outline: none; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
ul, ol { padding-left: 22px; }
dl { margin: 0; }
fieldset { margin: 14px 0; padding: 10px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -9999px; top: 0; z-index: 90; padding: 6px 10px; background: var(--surface); color: var(--accent); }
.skip:focus { left: 8px; top: 8px; }
.muted { color: var(--muted); }

button { padding: 8px 16px; font: inherit; font-weight: 500; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; }
button:hover:not([disabled]) { background: var(--surface-3); }
button[disabled] { opacity: .55; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover:not([disabled]) { background: var(--accent); filter: brightness(.94); }
button.small { padding: 3px 10px; font-size: 13px; }
button.link { padding: 0; border: 0; background: none; color: var(--accent); text-decoration: underline; font-weight: 400; }
button.link:hover:not([disabled]) { background: none; }
button.end-shift { background: var(--surface); border-color: var(--accent); color: var(--accent); font-weight: 600; padding: 4px 12px; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex-shrink: 0; }
select, textarea { padding: 6px 8px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 6px; max-width: 100%; }
textarea { width: 100%; }
meter { width: 180px; height: 12px; }
progress { width: 100%; height: 12px; accent-color: var(--accent); }

/* ---------- the bar ---------- */
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; padding: 8px 18px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar:focus { outline: none; }
.steps { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--text-2); }
.steps .current { color: var(--text); font-weight: 600; border-bottom: 2px solid var(--accent); }
.steps .done { color: var(--good); }
.topbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13px; }
.pill.recording { color: var(--crit); font-weight: 600; }
.az-clock { color: var(--text-2); font-variant-numeric: tabular-nums; }
.timer { display: inline-flex; align-items: center; gap: 8px; }
.time { font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.time[data-level="amber"] { color: var(--warn); }
.time[data-level="red"] { color: var(--crit); }

/* ---------- screens ---------- */
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.screen:focus { outline: none; }
.page { width: 100%; max-width: 760px; margin: 0 auto; padding: 24px 20px 56px; }
.page.narrow { max-width: 560px; padding-top: 12vh; }
.page > h1 { margin-bottom: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.links { margin-top: 18px; color: var(--muted); }
.tick { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; cursor: pointer; }
.stack { display: block; margin-top: 10px; }
.stepper { padding-left: 22px; }
.problem { padding: 10px 12px; color: var(--crit); background: var(--crit-soft); border-radius: var(--radius-sm); font-weight: 500; }
.note { padding: 10px 12px; background: var(--warn-soft); border-radius: var(--radius-sm); }
.draft { padding: 6px 10px; font-size: 13px; font-weight: 600; color: var(--warn); background: var(--warn-soft); border: 1px dashed var(--warn); border-radius: var(--radius-sm); }
.ribbon { padding: 8px 12px; background: var(--surface-3); border-radius: var(--radius-sm); }
.card { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.card dt { color: var(--muted); }
.card dd { margin: 0; font-weight: 500; }
.card-line { color: var(--text-2); font-weight: 500; }

.checks { list-style: none; padding: 0; }
.check { padding: 12px 14px; margin: 10px 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.check-head { display: flex; justify-content: space-between; gap: 12px; }
.check-body:not(:empty) { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.check-body > p { flex-basis: 100%; margin: 0; }
.check-body > .tick { flex-basis: 100%; margin: 2px 0; }
.detail { margin: 6px 0 0; }
.mark { color: var(--muted); white-space: nowrap; }
.mark[data-result="pass"] { color: var(--good); font-weight: 600; }
.mark[data-result="warn"] { color: var(--warn); font-weight: 600; }
.mark[data-result="fail"] { color: var(--crit); font-weight: 600; }
.thumb { flex-basis: 100%; max-width: 240px; border: 1px solid var(--border-strong); border-radius: 6px; }

/* ---------- a call ---------- */
.call { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 22px 14px; margin: 14px 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.bubble { width: 92px; height: 92px; border-radius: 50%; background: var(--accent-soft); border: 2px solid var(--accent); }
.bubble[data-speaking="true"] { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.12); } }
.call-status { min-height: 1.5em; margin: 0; font-weight: 500; text-align: center; }
.call-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 18px; }
.level { display: inline-flex; align-items: center; gap: 8px; }
.captions { width: 100%; max-width: 620px; min-height: 3.2em; padding: 8px 12px; text-align: center; background: var(--surface-3); border-radius: var(--radius-sm); }
.mic-alert { padding: 12px 14px; background: var(--crit-soft); border-radius: var(--radius-sm); }
.mic-alert p { margin: 0 0 8px; }

/* ---------- the break ---------- */
.rules { padding: 2px 16px 10px; margin: 16px 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.layout { margin: 16px 0; }
.mock { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; font-size: 12px; background: var(--surface); }
.mock-top { display: flex; gap: 12px; padding: 6px 10px; background: var(--surface-3); }
.mock-end { margin-left: auto; font-weight: 600; color: var(--accent); }
.mock-tabs { display: flex; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.mock-tabs .on { font-weight: 600; border-bottom: 2px solid var(--accent); }
.mock-body { display: grid; grid-template-columns: minmax(0, 1fr) 130px; min-height: 96px; }
.mock-app { padding: 10px; color: var(--muted); }
.mock-drawer { padding: 10px; border-left: 1px solid var(--border); background: var(--surface-2); }
figcaption { margin-top: 6px; font-size: 13px; color: var(--text-2); }

/* ---------- the shift ---------- */
body[data-screen="E1"] { height: 100%; overflow: hidden; }
.banners:not(:empty) { padding: 6px 12px 0; }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: 6px; background: var(--warn-soft); border-radius: var(--radius-sm); }
.shift { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: minmax(0, 1fr); }
.shift-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.strip-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 10px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; }
.tabs [role="tab"] { padding: 8px 12px; font-size: 13.5px; background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--text-2); }
.tabs [role="tab"][aria-selected="true"] { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.badge { display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 5px; font-size: 12px; font-weight: 600; text-align: center; color: var(--accent-ink); background: var(--accent); border-radius: 9px; }
.saving { margin: 0; padding: 8px 12px; font-weight: 600; background: var(--warn-soft); }
.stage { flex: 1; min-height: 0; position: relative; }
.app-panel { position: absolute; inset: 0; }
.app-frame { display: block; width: 100%; height: 100%; border: 0; background: var(--surface); }
.drawer { padding: 10px 12px; overflow-y: auto; background: var(--surface); border-left: 1px solid var(--border); font-size: 13.5px; }
.drawer:focus { outline: none; }
.drawer details { padding: 6px 0; border-bottom: 1px solid var(--border); }
.drawer summary { font-weight: 600; cursor: pointer; }
.drawer .rules { padding: 0; margin: 6px 0; border: 0; background: none; }
.drawer .rules h2 { font-size: 14px; margin-top: 4px; }
.drawer-toggle, .drawer-close { display: none; }

/* ---------- help ---------- */
.help { position: fixed; top: 0; right: 0; bottom: 0; z-index: 60; width: min(420px, 100%); padding: 14px 18px 40px; overflow-y: auto; background: var(--surface); border-left: 1px solid var(--border-strong); box-shadow: -8px 0 28px rgba(40, 30, 15, .16); }
.help:focus { outline: none; }
.help-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.help-head h2 { margin: 0; }
.help details { padding: 4px 0; }
.help summary { cursor: pointer; }
.help p { margin: 6px 0; }

.toasts { position: fixed; left: 50%; bottom: 20px; z-index: 70; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { padding: 10px 16px; font-weight: 600; color: var(--surface); background: var(--text); border-radius: var(--radius-sm); }
.dialog { max-width: 480px; padding: 18px 20px; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); }
.dialog::backdrop { background: rgba(30, 25, 15, .45); }
.dialog h2 { margin-top: 0; }
.scale label { display: inline-flex; gap: 6px; align-items: center; margin-right: 16px; }

/* 200% zoom on a laptop lands here: the drawer folds away behind its button (§4.1). */
@media (max-width: 999.98px) {
  .shift { grid-template-columns: minmax(0, 1fr); position: relative; }
  .drawer-toggle, .drawer-close { display: inline-block; }
  .drawer { display: none; }
  .drawer.open { display: block; position: absolute; top: 0; right: 0; bottom: 0; z-index: 20; width: min(340px, 100%); box-shadow: -6px 0 22px rgba(40, 30, 15, .18); }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
  .bubble[data-speaking="true"] { animation: none; border-width: 6px; }
}

