/* Meridiana Atlas · classroom app · styles
   Tokens live on :root. Light is the default; dark follows the system
   light by default (data-theme="light" on html); dark only if someone sets data-theme="dark". Borders mark surfaces; no shadows. */

:root {
  --font-sans: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "Source Code Pro", ui-monospace, Menlo, Consolas, monospace;

  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-2: #eceff1;
  --border: #d3d9dc;
  --border-strong: #858f95;
  --ink: #1a2124;
  --ink-2: #414c53;
  --ink-3: #5d6a72;

  --accent: #0a7571;
  --accent-hover: #086b67;
  --accent-ink: #ffffff;
  --accent-soft: #dff2f1;
  --accent-border: #8fd0cc;

  --red: #b42318;
  --red-soft: #fdecea;
  --red-border: #f0a8a1;
  --amber: #b54708;
  --amber-soft: #fdf1e1;
  --amber-border: #f2c48a;
  --green: #067647;
  --green-soft: #e3f5ea;
  --green-border: #9fdcb7;

  /* Chart marks (validated with dataviz/scripts/validate_palette.js) */
  --data: #079089;
  --data-muted: #7b8891;
  --critical: #b42318;

  --radius: 6px;
  --radius-sm: 4px;
  --z-sticky: 10;
  --z-toast: 20;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 160ms;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101416;
    --surface: #171c1f;
    --surface-2: #1e2529;
    --border: #2c353a;
    --border-strong: #3d494f;
    --ink: #e7ebed;
    --ink-2: #b6c0c6;
    --ink-3: #93a0a7;

    --accent: #3fc8c2;
    --accent-hover: #5dd6d0;
    --accent-ink: #08201f;
    --accent-soft: #12312f;
    --accent-border: #22615e;

    --red: #f97066;
    --red-soft: #3a1512;
    --red-border: #7a2c26;
    --amber: #f6a623;
    --amber-soft: #3a2a0f;
    --amber-border: #7a5a1c;
    --green: #4fcf8a;
    --green-soft: #0f2e1e;
    --green-border: #1f5f3d;

    --data: #1ea59f;
    --data-muted: #6f7d85;
    --critical: #e4574a;

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #101416;
  --surface: #171c1f;
  --surface-2: #1e2529;
  --border: #2c353a;
  --border-strong: #3d494f;
  --ink: #e7ebed;
  --ink-2: #b6c0c6;
  --ink-3: #93a0a7;

  --accent: #3fc8c2;
  --accent-hover: #5dd6d0;
  --accent-ink: #08201f;
  --accent-soft: #12312f;
  --accent-border: #22615e;

  --red: #f97066;
  --red-soft: #3a1512;
  --red-border: #7a2c26;
  --amber: #f6a623;
  --amber-soft: #3a2a0f;
  --amber-border: #7a5a1c;
  --green: #4fcf8a;
  --green-soft: #0f2e1e;
  --green-border: #1f5f3d;

  --data: #1ea59f;
  --data-muted: #6f7d85;
  --critical: #e4574a;

  color-scheme: dark;
}

/* Base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  line-height: 1.25;
  text-wrap: balance;
}

h1 { font-size: 1.4rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: 1rem; }

p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--accent);
}

code,
.mono {
  font-family: var(--font-mono);
  font-size: 0.93em;
}

.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--ink-3);
}

.small {
  font-size: 0.87rem;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.btn:hover {
  background: var(--surface-2);
}

.btn:active {
  background: var(--border);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-primary:active:not(:disabled) {
  background: var(--accent);
}

.btn-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--accent);
  padding-inline: 0.5rem;
}

.btn-quiet:hover {
  background: var(--accent-soft);
}

.btn-sm {
  padding: 0.28rem 0.65rem;
  font-size: 0.9rem;
}

.btn-danger {
  color: var(--red);
}

.btn-danger:hover {
  background: var(--red-soft);
  border-color: var(--red-border);
}

/* Form controls */

.input,
.textarea,
.select {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  transition: border-color var(--dur) var(--ease);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--ink-3);
}

.input:hover,
.textarea:hover,
.select:hover {
  border-color: var(--ink-3);
}

.input:focus-visible,
.textarea:focus-visible,
.select:focus-visible {
  outline-offset: 0;
  border-color: var(--accent);
}

.input:disabled,
.textarea:disabled,
.select:disabled {
  background: var(--surface-2);
  color: var(--ink-3);
  cursor: not-allowed;
}

.textarea {
  resize: vertical;
  min-height: 4.6rem;
  line-height: 1.45;
}

label.field {
  display: block;
}

label.field > span {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink-2);
}

/* Layout */

.wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.grow {
  flex: 1 1 auto;
}

/* Top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-main {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  min-height: 3.4rem;
  padding-block: 0.5rem;
}

.brand {
  color: var(--ink-2);
  font-size: 0.93rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.identity {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  text-align: center;
}

.identity .sep {
  color: var(--ink-3);
  font-weight: 400;
}

.identity .change {
  font-weight: 400;
}

.clock {
  justify-self: end;
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  color: var(--ink-2);
  white-space: nowrap;
}

.clock .num {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink);
}

.clock.is-late .num {
  color: var(--red);
}

.clock.is-waiting .num {
  color: var(--ink-3);
  font-weight: 400;
  font-size: 1rem;
}

/* Tabs */

.tabs {
  display: flex;
  gap: 0.25rem;
  border-top: 1px solid var(--border);
}

.tab {
  position: relative;
  padding: 0.7rem 1rem;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.tab:hover {
  color: var(--ink);
}

.tab[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab .badge {
  margin-left: 0.4rem;
}

.panel {
  padding-block: 1.5rem 3rem;
}

.panel[hidden] {
  display: none;
}

/* Badges, chips, pills */

.badge {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
  vertical-align: middle;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.85rem;
  line-height: 1.4;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.chip:hover {
  background: var(--surface-2);
}

.chip[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
  font-weight: 600;
}

.chip-static {
  cursor: default;
}

.chip-static:hover {
  background: var(--surface);
}

.chip-you {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
  font-weight: 600;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.4;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-2);
}

.pill-green {
  background: var(--green-soft);
  border-color: var(--green-border);
  color: var(--green);
}

.pill-amber {
  background: var(--amber-soft);
  border-color: var(--amber-border);
  color: var(--amber);
}

.pill-red {
  background: var(--red-soft);
  border-color: var(--red-border);
  color: var(--red);
}

.dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

/* Notices */

.notice {
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--amber-border);
  background: var(--amber-soft);
  color: var(--amber);
  border-radius: var(--radius);
  font-size: 0.93rem;
}

.notice-neutral {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--ink-2);
}

.empty {
  color: var(--ink-3);
  font-size: 0.93rem;
}

/* Context: sections at the same width as the other tabs */

.ctx { gap: 1rem; }

.ctx-card { padding: 1.4rem 1.6rem 1.5rem; }

.ctx-card h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  letter-spacing: -0.005em;
}

.ctx-card h3 {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 0.6rem;
}

.ctx-card p {
  line-height: 1.65;
  margin: 0 0 0.85rem;
  color: var(--ink);
  max-width: 72ch;
}

.ctx-card p:last-child { margin-bottom: 0; }

.ctx-two {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 2rem 3rem;
  align-items: start;
}

.ctx-side {
  border-left: 1px solid var(--border);
  padding-left: 1.5rem;
}

.ctx-side h3 + * { margin-top: 0; }
.ctx-side h3:not(:first-child) { margin-top: 1.4rem; }

.ctx-prose { max-width: 72ch; }

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.steps li {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
  line-height: 1.5;
}

.steps .n {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 0.05rem;
}

.tips {
  margin: 0;
  padding-left: 1.1rem;
  line-height: 1.5;
}

.tips li { margin-bottom: 0.45rem; }

.ctx-card .callout {
  display: inline-block;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--radius);
  font-weight: 600;
  margin: 1.1rem 0 0;
  max-width: none;
}

.facts {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 0.45rem 1rem;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
}

.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; color: var(--ink); }

.ctx-people {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.people {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.55rem 2rem;
}

.people li {
  display: flex;
  flex-direction: column;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
}

.people .name { font-weight: 600; color: var(--ink); }
.people .role { color: var(--ink-3); font-size: 0.92rem; }

.ctx-role { border-color: var(--accent-border); }
.ctx-role h2 { color: var(--accent); }
.ctx-actions { margin-top: 1.1rem; }

@media (max-width: 900px) {
  .ctx-two { grid-template-columns: 1fr; gap: 1.25rem; }
  .ctx-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 1.1rem; }
}

/* Selector screen */

.selector {
  max-width: 720px;
  margin: 3rem auto;
  padding: 2rem;
}

.selector h1 {
  margin-bottom: 0.4rem;
}

.selector .lead {
  color: var(--ink-2);
  margin-bottom: 1.5rem;
}

.selector h2 {
  font-size: 0.95rem;
  color: var(--ink-2);
  margin: 1.4rem 0 0.6rem;
}

.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.5rem;
}

.pick-grid.roles {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.pick {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.pick:hover {
  background: var(--surface-2);
}

.pick[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.pick strong {
  font-weight: 600;
}

.pick .small {
  color: var(--ink-3);
}

.pick[aria-pressed="true"] .small {
  color: var(--accent);
}

.selector .actions {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Who you are card */

.hero {
  padding: 1.4rem 1.6rem;
}

.hero h1 {
  margin-bottom: 0.6rem;
}

.hero .who {
  max-width: 72ch;
  color: var(--ink);
}

.hero .first {
  margin-top: 0.9rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--radius);
  font-weight: 600;
  display: inline-block;
}

.hero .grey {
  margin-top: 0.6rem;
  color: var(--ink-3);
}

/* Sections (materials) */

.section {
  padding: 1.2rem 1.4rem;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem 1rem;
  margin-bottom: 0.9rem;
}

.section-head h2 {
  flex: 1 1 auto;
}

.section-head .count {
  color: var(--ink-3);
  font-size: 0.9rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}

.toolbar .input {
  width: min(100%, 260px);
}

.chipgroup {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.chipgroup .lbl {
  font-size: 0.85rem;
  color: var(--ink-3);
  margin-right: 0.15rem;
}

/* Data tables */

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}

table.data th,
table.data td {
  padding: 0.42rem 0.65rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

table.data td.wrap-cell {
  white-space: normal;
  min-width: 18ch;
  max-width: 44ch;
}

table.data tbody tr:last-child td {
  border-bottom: 0;
}

table.data th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  color: var(--ink-2);
  font-weight: 600;
  font-size: 0.85rem;
  user-select: none;
}

table.data th button.sort {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
}

table.data th button.sort:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

table.data th .arrow {
  color: var(--ink-3);
  font-size: 0.75rem;
}

table.data th[aria-sort="ascending"] .arrow::after { content: "\2191"; }
table.data th[aria-sort="descending"] .arrow::after { content: "\2193"; }

table.data td.num,
table.data th.num {
  text-align: right;
}

table.data tr.total td {
  font-weight: 600;
  background: var(--surface-2);
}

table.data tbody tr:hover td {
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}

table.data tr.total:hover td {
  background: var(--surface-2);
}

.cell-late {
  color: var(--red);
  font-weight: 600;
}

.cell-risk {
  color: var(--amber);
  font-weight: 600;
}

.table-note {
  margin-top: 0.6rem;
  color: var(--ink-3);
  font-size: 0.88rem;
  max-width: 90ch;
}

.copy-status {
  font-size: 0.88rem;
  color: var(--green);
  min-width: 8ch;
}

/* Prompt block */

.prompt {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.prompt .prompt-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.prompt .prompt-head span {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink-2);
}

.prompt pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink);
}

/* Dashboard: stat tiles */

.dash-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}

.dash-head .dash-title {
  font-size: 0.93rem;
  color: var(--ink-2);
}

.dash-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.05rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.status-pill .icon {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--ink-3);
  flex: none;
}

.status-pill.is-off {
  border-color: var(--red-border);
  background: var(--red-soft);
  color: var(--red);
}

.status-pill.is-off .icon {
  background: var(--critical);
}

.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem;
}

.tile {
  position: relative;
  display: grid;
  grid-template-rows: auto 3.9em auto auto;
  gap: 0.45rem;
  padding: 0.8rem 0.9rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 0;
}

.tile.is-off {
  border-color: var(--red-border);
}

.tile-status {
  display: flex;
  justify-content: flex-end;
}

.tile-label {
  display: flex;
  align-items: flex-start;
  gap: 0.3rem;
  font-size: 0.85rem;
  line-height: 1.3;
  color: var(--ink-2);
}

.tile-label > span {
  flex: 1 1 auto;
  min-width: 0;
}

.info {
  all: unset;
  flex: none;
  width: 1rem;
  height: 1rem;
  margin-top: 0.05rem;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  color: var(--ink-3);
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
}

.info:hover,
.info:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.info:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tile-body {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.5rem;
}

.tile-value {
  font-size: 1.75rem;
  line-height: 1;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
  padding-bottom: 14px; /* sits on the bars' baseline */
}

.tile-value .u {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--ink-2);
  margin-left: 0.15rem;
}

.tile-target {
  font-size: 0.78rem;
  color: var(--ink-3);
  line-height: 1.3;
}

.spark {
  flex: none;
  width: 64px;
  height: 56px;
  overflow: visible;
}

.spark .bar {
  fill: var(--data-muted);
}

.spark .bar.is-current {
  fill: var(--data);
}

.tile.is-off .spark .bar.is-current {
  fill: var(--critical);
}

.spark .target {
  stroke: var(--ink-3);
  stroke-width: 1;
  stroke-dasharray: 3 2;
}

.spark .base {
  stroke: var(--border);
  stroke-width: 1;
}

.spark .lbl {
  font-family: var(--font-sans);
  font-size: 9px;
  fill: var(--ink-3);
  text-anchor: middle;
}

.spark .hit {
  fill: transparent;
  cursor: default;
}

.spark .hit:focus-visible {
  outline: none;
  fill: color-mix(in srgb, var(--accent) 12%, transparent);
}

.tip {
  position: absolute;
  z-index: 2;
  left: 0.6rem;
  right: 0.6rem;
  top: calc(100% + 4px);
  padding: 0.5rem 0.65rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--ink-2);
}

.tip[hidden] {
  display: none;
}

/* Progress */

.progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.progress .label {
  font-weight: 600;
}

.answers-title {
  margin-top: 0.5rem;
}

.progress .bar {
  flex: 1 1 220px;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
}

.progress .bar > span {
  display: block;
  height: 100%;
  background: var(--green);
  transition: width 300ms var(--ease);
}

/* Question levels */

.level {
  padding: 0;
  overflow: hidden;
}

.level-head {
  padding: 0.85rem 1.4rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.level-head h2 {
  font-size: 1.05rem;
}

.level-head .count {
  color: var(--ink-3);
  font-size: 0.9rem;
}

.question {
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  gap: 0.25rem 0.75rem;
}

.question:last-child {
  border-bottom: 0;
}

.question .qnum {
  font-family: var(--font-mono);
  color: var(--ink-3);
  font-size: 0.95rem;
  padding-top: 0.1rem;
}

.question .qbody {
  min-width: 0;
}

.question .qtext {
  font-weight: 600;
  max-width: 78ch;
}

.question .qmeta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.question .qmeta .spacer {
  flex: 1 1 auto;
}

.question .qanswer {
  margin-top: 0.75rem;
}

.question .hint-box {
  margin-top: 0.6rem;
  padding: 0.5rem 0.75rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--ink-2);
  font-size: 0.93rem;
  max-width: 78ch;
}

.answer-editor .help {
  margin-bottom: 0.4rem;
  color: var(--ink-3);
  font-size: 0.9rem;
}

.answer-editor .actions {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.answer-view {
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--green-border);
  background: var(--green-soft);
  border-radius: var(--radius);
}

.answer-view.is-partial {
  border-color: var(--amber-border);
  background: var(--amber-soft);
}

.answer-view .text {
  white-space: pre-wrap;
  max-width: 78ch;
}

.answer-view .meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.87rem;
  color: var(--ink-2);
}

.answer-view .meta .spacer {
  flex: 1 1 auto;
}

/* Editable mini tables (2.8, 3.2) */

table.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}

table.grid th,
table.grid td {
  padding: 0.35rem 0.4rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

table.grid th {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink-2);
}

table.grid tr:last-child td {
  border-bottom: 0;
}

table.grid .input,
table.grid .select {
  min-width: 8rem;
}

table.grid td.opt {
  font-family: var(--font-mono);
  color: var(--ink-2);
  width: 2rem;
}

table.grid td.cost {
  white-space: nowrap;
}

.answer-view table.grid td,
.answer-view table.grid th {
  border-bottom-color: color-mix(in srgb, var(--ink) 12%, transparent);
}

/* Decision */

.decision {
  padding: 1.2rem 1.4rem;
}

.decision h2 {
  margin-bottom: 0.3rem;
}

.decision .lead {
  color: var(--ink-2);
  margin-bottom: 1rem;
  max-width: 72ch;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.option {
  display: grid;
  grid-template-columns: auto 1.6rem 1fr;
  align-items: start;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.option:hover {
  background: var(--surface-2);
}

.option.is-checked {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.option input {
  margin: 0.25rem 0 0;
  accent-color: var(--accent);
}

.option .letter {
  font-family: var(--font-mono);
  color: var(--ink-2);
  padding-top: 0.05rem;
}

.option .other {
  margin-top: 0.4rem;
}

.decision .send {
  margin-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

/* Consequence */

.consequence {
  padding: 1.4rem 1.6rem;
  border-color: var(--accent-border);
}

.consequence h2 {
  margin-bottom: 0.25rem;
}

.consequence .chosen {
  margin-bottom: 1rem;
  color: var(--ink-2);
}

.consequence .figures {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.consequence .figure {
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.consequence .figure .lbl {
  font-size: 0.85rem;
  color: var(--ink-2);
  min-height: 2.6em;
  line-height: 1.3;
}

.consequence .figure .val {
  font-size: 1.5rem;
  margin-top: 0.3rem;
  font-weight: 500;
}

.consequence .line {
  font-size: 1.1rem;
  max-width: 70ch;
}

.consequence .diag {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--ink-2);
  white-space: pre-wrap;
  max-width: 70ch;
}

/* Documents: list and reader */

.docs {
  display: grid;
  grid-template-columns: minmax(240px, 34%) 1fr;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 320px;
}

.doclist {
  border-right: 1px solid var(--border);
  background: var(--surface);
  max-height: 560px;
  overflow-y: auto;
}

.docitem {
  all: unset;
  display: grid;
  grid-template-columns: 1rem 1fr auto;
  gap: 0.15rem 0.5rem;
  width: 100%;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  box-sizing: border-box;
}

.docitem:last-child {
  border-bottom: 0;
}

.docitem:hover {
  background: var(--surface-2);
}

.docitem:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.docitem[aria-current="true"] {
  background: var(--accent-soft);
}

.docitem .dot {
  margin-top: 0.45rem;
}

.docitem .dot.is-read {
  visibility: hidden;
}

.docitem .from {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.docitem .date {
  color: var(--ink-3);
  font-size: 0.85rem;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.docitem .subject {
  grid-column: 2 / -1;
  color: var(--ink-2);
  font-size: 0.93rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.docitem.is-new .subject::before {
  content: "New ";
  color: var(--accent);
  font-weight: 600;
}

.reader {
  padding: 1.1rem 1.4rem;
  min-width: 0;
  max-height: 560px;
  overflow-y: auto;
}

.reader .reader-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem 1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.9rem;
}

.reader .reader-head h3 {
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
}

.reader .meta-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.1rem 0.75rem;
  font-size: 0.9rem;
  color: var(--ink-2);
}

.reader .meta-list dt {
  color: var(--ink-3);
}

.reader .meta-list dd {
  margin: 0;
}

.reader .body {
  white-space: pre-wrap;
  max-width: 72ch;
  line-height: 1.55;
}

.reader .item {
  margin-bottom: 0.9rem;
  max-width: 72ch;
}

.reader .item h4 {
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.reader .item h4 .n {
  font-family: var(--font-mono);
  color: var(--ink-3);
  margin-right: 0.4rem;
}

.reader .item p {
  white-space: pre-wrap;
}

.reader .empty {
  padding: 2rem 0;
}

/* Transcript */

.transcript .line {
  display: grid;
  grid-template-columns: 5.2rem 1fr;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
  max-width: 80ch;
}

.transcript .t {
  font-family: var(--font-mono);
  color: var(--ink-3);
  font-size: 0.85rem;
  padding-top: 0.2rem;
}

.transcript .speaker {
  font-weight: 600;
  margin-right: 0.35rem;
}

/* Chat */

.chat {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 560px;
  overflow-y: auto;
  padding: 0.5rem 1.2rem 1rem;
}

.chat .day {
  position: sticky;
  top: 0;
  background: var(--surface);
  padding: 0.6rem 0 0.4rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink-3);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.4rem;
}

.chat .msg {
  display: grid;
  grid-template-columns: 3.6rem 1fr;
  gap: 0.6rem;
  padding: 0.25rem 0;
  max-width: 80ch;
}

.chat .msg .t {
  font-family: var(--font-mono);
  color: var(--ink-3);
  font-size: 0.85rem;
  padding-top: 0.15rem;
}

.chat .msg .author {
  font-weight: 600;
  margin-right: 0.35rem;
}

/* Glossary */

.glossary .toolbar .input {
  width: min(100%, 360px);
}

.glossary dl {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1.25rem;
}

.glossary dt {
  font-weight: 600;
}

.glossary dd {
  margin: 0;
  color: var(--ink-2);
  max-width: 70ch;
}

/* Control view */

.control .toolbar {
  justify-content: space-between;
}

.control .started {
  color: var(--ink-2);
  font-size: 0.93rem;
}

.b2-links {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.b2-table {
  font-weight: 600;
  min-width: 4.5rem;
}

.b2-sub {
  margin: 1.1rem 0 0.5rem;
  font-size: 0.95rem;
  color: var(--ink-2);
}

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  top: 4.5rem;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  padding: 0.5rem 0.9rem;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--radius);
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}

.toast.is-on {
  opacity: 1;
}

/* Responsive */

@media (max-width: 1100px) {
  .kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .wrap {
    padding: 0 16px;
  }

  .topbar-main {
    grid-template-columns: 1fr auto;
    grid-template-areas: "brand clock" "identity identity";
    row-gap: 0.25rem;
  }

  .brand { grid-area: brand; }
  .clock { grid-area: clock; }
  .identity {
    grid-area: identity;
    justify-content: flex-start;
    flex-wrap: wrap;
    text-align: left;
    font-size: 0.95rem;
  }

  .tabs {
    overflow-x: auto;
  }

  .tab {
    padding-inline: 0.75rem;
  }

  .hero,
  .section,
  .decision,
  .consequence {
    padding: 1rem 1rem;
  }

  .level-head,
  .question {
    padding-inline: 1rem;
  }

  .question {
    grid-template-columns: 1fr;
  }

  .docs {
    grid-template-columns: 1fr;
  }

  .doclist {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    max-height: 260px;
  }

  .reader {
    max-height: none;
    padding: 1rem;
  }

  .consequence .figures {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .glossary dl {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .glossary dd {
    margin-bottom: 0.6rem;
  }

  .transcript .line,
  .chat .msg {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }
}

@media (max-width: 600px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tile-value {
    font-size: 1.5rem;
  }

  .tile {
    grid-template-rows: auto auto auto auto;
  }
}

@media (max-width: 480px) {

  .selector {
    margin: 1rem auto;
    padding: 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.answer-editor .conflict {
  margin-bottom: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

/* Block 2: shared bits (radar.html, builder.html, project.html) */

.bar-right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.name-field {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--ink-2);
  white-space: nowrap;
}

.name-field .input {
  width: 9rem;
  padding: 0.3rem 0.55rem;
}

.help {
  color: var(--ink-3);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  max-width: 72ch;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.9rem;
  margin-top: 0.6rem;
}

.credit {
  padding: 2rem 24px 1.5rem;
  color: var(--ink-3);
  font-size: 0.82rem;
  text-align: right;
}

/* Label pills: colour carries the label's weight */

.pill-label {
  text-transform: none;
  flex: none;
  min-width: 5.6rem;
  justify-content: center;
}

.pill-risk { background: var(--amber-soft); border-color: var(--amber-border); color: var(--amber); }
.pill-escalation { background: var(--red-soft); border-color: var(--red-border); color: var(--red); }
.pill-decision,
.pill-commitment { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }

/* Fact card */

.radar {
  padding-block: 1.5rem 3rem;
}

.radar-head {
  padding: 1.3rem 1.5rem;
}

.radar-head h1 {
  margin-bottom: 0.4rem;
}

.radar-head .lead {
  font-size: 1.05rem;
  max-width: 72ch;
}

.radar-head .muted {
  margin-top: 0.5rem;
  font-size: 0.93rem;
}

.facts-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.fact {
  display: grid;
  grid-template-columns: 6.2rem minmax(0, 1fr);
  gap: 0.25rem 1rem;
  padding: 0.9rem 1.2rem;
  transition: border-color var(--dur) var(--ease);
}

.fact.is-correct { border-color: var(--green-border); }
.fact.is-wrong { border-color: var(--red-border); }

.fact-date {
  color: var(--ink-2);
  font-size: 0.9rem;
  padding-top: 0.2rem;
  white-space: nowrap;
}

.fact-main {
  min-width: 0;
}

.fact-top {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.fact-top .pill {
  margin-top: 0.15rem;
}

.fact-statement {
  font-size: 1.05rem;
  line-height: 1.45;
  max-width: 78ch;
}

.fact-source {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.5rem;
  margin-top: 0.35rem;
  color: var(--ink-3);
  font-size: 0.9rem;
}

.fact-excerpt {
  margin: 0.6rem 0 0;
  padding: 0.55rem 0.9rem;
  border-left: 3px solid var(--border-strong);
  background: var(--surface-2);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--ink-2);
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
  max-width: 78ch;
}

.fact-excerpt.is-quote::before { content: "\201C"; color: var(--ink-3); }
.fact-excerpt.is-quote::after { content: "\201D"; color: var(--ink-3); }

.fact-controls:not(:empty) {
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border);
}

.mark-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.mark[aria-pressed="true"] {
  font-weight: 600;
}

.mark-correct[aria-pressed="true"] {
  background: var(--green-soft);
  border-color: var(--green-border);
  color: var(--green);
}

.mark-wrong[aria-pressed="true"] {
  background: var(--red-soft);
  border-color: var(--red-border);
  color: var(--red);
}

.why {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.55rem;
  max-width: 64ch;
}

.why-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink-2);
}

.rules {
  margin: 0;
  padding-left: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 80ch;
}

.rules li::marker {
  color: var(--ink-3);
  font-family: var(--font-mono);
}

.rules .input[readonly] {
  background: var(--surface-2);
  border-color: var(--border);
}

.sent-line {
  color: var(--green);
  font-weight: 600;
}

@media (max-width: 760px) {
  .bar-right {
    grid-area: clock;
    gap: 0.6rem;
  }

  .name-field .input {
    width: 7rem;
  }

  .fact {
    grid-template-columns: 1fr;
    gap: 0.2rem;
    padding: 0.85rem 1rem;
  }

  .fact-date {
    padding-top: 0;
  }

  .fact-top {
    flex-direction: column;
    gap: 0.35rem;
  }

  .why {
    grid-template-columns: 1fr;
  }

  .item {
    grid-template-columns: 1fr;
  }

  .item .remove {
    margin-top: 0;
    justify-self: end;
  }

  .item-fields {
    grid-template-columns: 1fr;
  }

  .radar-head {
    padding: 1rem;
  }

  .credit {
    padding-inline: 16px;
    text-align: left;
  }

  html.project {
    font-size: 16px;
  }
}

/* ==========================================================================
   Atlas Radar, three zones: sources rail, timeline, open fact with its source.
   ========================================================================== */

.rd { gap: 1rem; max-width: 1320px; }

/* Tiles that filter the timeline */
.tile.is-selectable { cursor: pointer; }
.tile.is-selectable:hover { border-color: var(--border-strong); }
.tile.is-selectable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile.is-selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.tile-facts { margin-top: 0.45rem; padding-top: 0.45rem; border-top: 1px solid var(--border); font-size: 0.8rem; color: var(--accent); font-weight: 500; }
.tile-facts.is-none { color: var(--ink-3); font-weight: 400; }
.tile-facts.is-selected { color: var(--accent); }

.rd-pipeline {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.6rem;
  margin-top: 0.9rem; padding-top: 0.75rem; border-top: 1px solid var(--border);
  font-size: 0.9rem; color: var(--ink-2);
}
.rd-pipeline > span { padding: 0.2rem 0.65rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.rd-pipeline b { font-weight: 600; color: var(--ink); }
.rd-pipeline i { width: 14px; height: 1px; background: var(--border-strong); display: inline-block; }
.rd-pipeline .rd-pipeline-note { margin-left: auto; border: 0; padding: 0; color: var(--ink-3); font-size: 0.85rem; }

/* Grid */
.rd-grid { display: grid; grid-template-columns: 224px minmax(0, 1fr) 400px; gap: 0.9rem; align-items: start; }

/* Zone 1: rail */
.rd-rail { padding: 0.9rem 0.75rem; }
.rd-rail-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 0.5rem 0.5rem; }
.rd-rail-head h2 { font-size: 0.85rem; font-weight: 600; margin: 0; color: var(--ink-2); }
.rd-sources { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.rd-source {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  padding: 0.45rem 0.5rem; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent;
  font: inherit; font-size: 0.92rem; color: var(--ink); text-align: left; cursor: pointer;
}
.rd-source:hover { background: var(--surface-2); }
.rd-source:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.rd-source.is-selected { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); font-weight: 500; }
.rd-source-meta { display: flex; gap: 0.35rem; align-items: baseline; font-size: 0.78rem; color: var(--ink-3); white-space: nowrap; }
.rd-source-meta b { color: var(--ink); font-weight: 500; font-size: 0.9rem; min-width: 1.2em; text-align: right; }
.rd-source.is-selected .rd-source-meta, .rd-source.is-selected .rd-source-meta b { color: var(--accent); }
.rd-rail-foot { margin-top: 0.75rem; padding: 0.75rem 0.5rem 0; border-top: 1px solid var(--border); font-size: 0.85rem; }

/* Zone 2: timeline */
.rd-tl { padding: 0; overflow: hidden; }
.rd-tl-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border); }
.rd-tl-head h2 { font-size: 0.95rem; font-weight: 600; margin: 0; }
.rd-rows { display: flex; flex-direction: column; }
.rd-row {
  display: grid; grid-template-columns: 46px 88px minmax(0, 1fr) auto 14px; gap: 0.6rem; align-items: start;
  width: 100%; padding: 0.6rem 0.9rem; border: 0; border-bottom: 1px solid var(--border); background: var(--surface);
  font: inherit; font-size: 0.94rem; color: var(--ink); text-align: left; cursor: pointer; line-height: 1.4;
}
.rd-row:last-child { border-bottom: 0; }
.rd-row:hover { background: var(--surface-2); }
.rd-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.rd-row.is-open { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.rd-row-date { font-size: 0.8rem; color: var(--ink-3); padding-top: 2px; }
.rd-row-text { min-width: 0; }
.rd-row-src { font-size: 0.78rem; color: var(--ink-3); white-space: nowrap; padding-top: 2px; }
.rd-row .pill-label { justify-self: start; margin-top: 1px; }
.rd-dot { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--border-strong); margin-top: 4px; justify-self: end; }
.rd-dot.is-correct { background: var(--green); border-color: var(--green); }
.rd-dot.is-wrong { background: var(--red); border-color: var(--red); }
.rd-row.is-correct .rd-row-text { color: var(--ink-2); }

.pill-src { text-transform: none; letter-spacing: 0; padding: 1px 7px; font-size: 0.72rem; justify-self: start; margin-top: 2px; }
.pill-src-email { background: #e8eef8; color: #2f4f8a; border-color: #c4d2ec; }
.pill-src-transcript { background: #efe7f7; color: #5e3a8a; border-color: #d7c6ea; }
.pill-src-minutes { background: #f5e9e9; color: #7a3a3a; border-color: #e6c9c9; }
.pill-src-chat { background: #fbeede; color: #8a4f1a; border-color: #efd3b3; }
.pill-src-report { background: #e8f2e8; color: #2f6b3a; border-color: #c5dfc7; }
.pill-src-register, .pill-src-incidents { background: var(--surface-2); color: var(--ink-2); border-color: var(--border); }

/* Zone 3: detail */
.rd-detail { padding: 1rem 1.1rem; position: sticky; top: calc(var(--topbar-h, 56px) + 0.75rem); display: flex; flex-direction: column; gap: 0.7rem; max-height: calc(100vh - var(--topbar-h, 56px) - 1.5rem); overflow: auto; }
.rd-empty h2 { font-size: 1rem; margin: 0 0 0.35rem; }
.rd-empty p { margin: 0; color: var(--ink-3); max-width: 40ch; }
.rd-detail-top { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.rd-detail-date { margin-left: auto; font-size: 0.8rem; color: var(--ink-3); }
.rd-detail-fact { font-size: 1.05rem; font-weight: 500; line-height: 1.4; margin: 0; }
.rd-detail-from { margin: 0; font-size: 0.85rem; color: var(--ink-3); }

.rd-doc { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.rd-doc-parts { display: flex; flex-direction: column; }
.rd-doc-parts > * + * { border-top: 1px solid var(--border); }
.rd-docbox { padding: 0.85rem 0.95rem; font-size: 0.92rem; line-height: 1.55; color: var(--ink-2); }
.rd-doc-title { font-size: 0.95rem; font-weight: 600; color: var(--ink); margin: 0 0 0.35rem; }
.rd-doc-meta { display: flex; flex-wrap: wrap; gap: 0.15rem 0.9rem; font-size: 0.78rem; color: var(--ink-3); margin-bottom: 0.6rem; }
.rd-doc-meta .k { color: var(--ink-3); }
.rd-doc-body p { margin: 0 0 0.55rem; max-width: 62ch; }
.rd-doc-body p:last-child { margin-bottom: 0; }
.rd-doc mark { background: #fff1a8; color: var(--ink); padding: 0 2px; border-radius: 2px; box-decoration-break: clone; }
.rd-items { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.45rem; }
.rd-items li { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr); gap: 0.4rem; }
.rd-items li.is-cited { color: var(--ink); }
.rd-items li:not(.is-cited) { opacity: 0.75; }
.rd-item-n { color: var(--ink-3); font-size: 0.8rem; padding-top: 2px; }
.rd-line { margin: 0 0 0.35rem; }
.rd-line:not(.is-cited) { opacity: 0.75; }
.rd-line.is-cited { color: var(--ink); }
.rd-ts { font-size: 0.78rem; color: var(--ink-3); }
.rd-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.3rem 0.8rem; margin: 0; }
.rd-dl dt { color: var(--ink-3); font-size: 0.85rem; }
.rd-dl dd { margin: 0; color: var(--ink); }
.rd-table { border-collapse: collapse; width: 100%; font-size: 0.9rem; margin: 0.25rem 0 0.5rem; }
.rd-table th, .rd-table td { padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--border); text-align: right; }
.rd-table th:first-child, .rd-table td:first-child { text-align: left; }
.rd-table th { font-size: 0.78rem; color: var(--ink-3); font-weight: 600; }

.rd-review { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.6rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.rd-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.rd-actions-q { font-size: 0.85rem; color: var(--ink-3); margin-right: auto; }
.rd-why { display: flex; gap: 0.5rem; }
.rd-why .input { flex: 1; }

@media (max-width: 1180px) { .rd-grid { grid-template-columns: 200px minmax(0, 1fr) 340px; } }
@media (max-width: 960px) {
  .rd-grid { grid-template-columns: 1fr; }
  .rd-rail { padding: 0.6rem; }
  .rd-sources { flex-direction: row; flex-wrap: wrap; gap: 0.35rem; }
  .rd-source { width: auto; border-color: var(--border); }
  .rd-rail-foot { border-top: 0; padding-top: 0.5rem; }
  .rd-detail { position: static; max-height: none; }
  .rd-row { grid-template-columns: 46px 88px minmax(0, 1fr) 14px; }
  .rd-row-src { grid-column: 3; }
}
@media (max-width: 560px) {
  .rd-row { grid-template-columns: minmax(0, 1fr) 14px; }
  .rd-row-date, .pill-src { grid-column: 1; }
  .rd-pipeline .rd-pipeline-note { margin-left: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .rd-row, .rd-source, .tile.is-selectable { transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease); }
}

/* ==========================================================================
   Your radar (exercise 3): one question at a time on the left, the table's
   radar on the right, drawn with the Atlas Radar pieces.
   ========================================================================== */

.bd { gap: 1rem; max-width: 1320px; }
.bd-intro h1 { font-size: 1.35rem; font-weight: 600; margin: 0.25rem 0 0.25rem; }
.bd-intro p { margin: 0; color: var(--ink-2); max-width: 70ch; }
.bd-grid { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 1rem; align-items: start; }
.bd-status { white-space: nowrap; }

/* Step panel */
.bd-panel { padding: 1rem 1.1rem 1.1rem; position: sticky; top: calc(var(--topbar-h, 56px) + 0.75rem); display: flex; flex-direction: column; gap: 0.9rem; max-height: calc(100vh - var(--topbar-h, 56px) - 1.5rem); overflow: auto; }
.bd-steps { display: flex; flex-wrap: wrap; gap: 4px; }
.bd-steps .bd-step { flex: 1 1 auto; }
.bd-step { display: flex; align-items: center; justify-content: flex-start; gap: 0.3rem; padding: 0.45rem 0.45rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font: inherit; font-size: 0.82rem; color: var(--ink-2); cursor: pointer; min-width: 0; }
.bd-step:hover { background: var(--surface-2); }
.bd-step:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bd-step.is-current { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.bd-step-n { width: 1.25rem; height: 1.25rem; border-radius: 50%; border: 1px solid currentColor; display: inline-flex; align-items: center; justify-content: center; font-size: 0.72rem; flex: none; }
.bd-step.is-done:not(.is-current) .bd-step-n { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.bd-step-count { margin-left: auto; font-size: 0.75rem; color: var(--ink-3); }
.bd-step-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.8rem; }

.bd-q-step { margin: 0 0 0.15rem; font-size: 0.78rem; color: var(--ink-3); }
.bd-q h2 { font-size: 1.2rem; font-weight: 600; margin: 0 0 0.5rem; line-height: 1.3; }
.bd-q-example { margin: 0 0 0.35rem; font-size: 0.9rem; color: var(--ink-2); line-height: 1.45; padding: 0.5rem 0.7rem; background: var(--surface-2); border-radius: var(--radius-sm); }
.bd-q-eyebrow { font-weight: 600; color: var(--ink-3); font-size: 0.78rem; }
.bd-q-help { margin: 0; font-size: 0.85rem; color: var(--ink-3); }

.bd-items { display: flex; flex-direction: column; gap: 0.6rem; }
.bd-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.65rem 0.75rem 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }
.bd-item-head { display: flex; justify-content: space-between; align-items: center; }
.bd-item-n { font-size: 0.75rem; color: var(--ink-3); }
.bd-field { display: flex; flex-direction: column; gap: 0.2rem; }
.bd-field-label { font-size: 0.78rem; color: var(--ink-2); }
.bd-field .input { width: 100%; }
.bd-grow { resize: none; overflow: hidden; min-height: 0; line-height: 1.4; display: block; }
.bd-said { font-size: 0.78rem; color: var(--ink-3); }
.bd-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.5rem; }
.bd-item-actions { display: flex; }
.bd-finish { display: flex; flex-direction: column; gap: 0.2rem; }
.bd-finish p { margin: 0; }
.bd-finish-note { font-size: 0.85rem; color: var(--ink-3); }
.bd-show { text-decoration: none; }
.bd-nav { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.bd-nav .btn-primary { margin-left: auto; }
.bd-done { font-size: 0.88rem; color: var(--green); }

/* Radar preview */
.bd-preview { min-width: 0; }
.bd-radar { display: flex; flex-direction: column; gap: 0.9rem; }
.bd-radar-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.bd-radar-title { font-size: 1.05rem; font-weight: 600; margin: 0; }
.bd-pipeline { display: flex; align-items: center; gap: 0.45rem; font-size: 0.85rem; color: var(--ink-2); }
.bd-pipeline > span { padding: 0.15rem 0.6rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.bd-pipeline b { font-weight: 600; color: var(--ink); }
.bd-pipeline i { width: 12px; height: 1px; background: var(--border-strong); display: inline-block; }
.bd-kpis { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.bd-kpis .tile { min-height: 140px; }
.bd-placeholder { color: var(--ink-3); font-style: italic; font-weight: 400; font-size: 0.95rem; margin-right: 0.3rem; }
.bd-tile-alerts { margin-top: 0.5rem; padding-top: 0.45rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.3rem; }
.bd-alerts { padding: 0.85rem 0.9rem; }
.bd-alerts h3 { font-size: 0.82rem; font-weight: 600; color: var(--ink-3); margin: 0 0 0.5rem; }
.bd-alert-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.6rem 1.2rem; }
.bd-alert { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.9rem; color: var(--ink); line-height: 1.4; }
.bd-alert-body { display: flex; flex-direction: column; gap: 0.1rem; }
.bd-alert .k { color: var(--ink-3); }
.bd-alert-under { font-size: 0.78rem; color: var(--ink-3); }
.bd-alert-icon { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--amber); margin-top: 0.45em; }
.bd-alert-to { color: var(--ink-3); }
.bd-loose-alerts { display: flex; flex-direction: column; gap: 0.3rem; }
.bd-loose-alerts h3, .bd-rail h3, .bd-tl h3 { font-size: 0.82rem; font-weight: 600; color: var(--ink-3); margin: 0 0 0.5rem; }
.bd-ghost { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 0.9rem 1rem; color: var(--ink-3); font-size: 0.88rem; font-style: italic; background: var(--surface); }
.bd-ghost-step { display: block; margin-top: 0.2rem; font-style: normal; }
.bd-kpis .bd-ghost { grid-column: 1 / -1; }

.bd-radar-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 0.9rem; align-items: start; }
.bd-rail, .bd-tl { padding: 0.85rem 0.9rem; }
.bd-sources { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.bd-sources li { display: flex; flex-direction: column; gap: 0.1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.bd-sources li:last-child { border-bottom: 0; padding-bottom: 0; }
.bd-source-type { font-weight: 500; font-size: 0.9rem; }
.bd-source-where { font-size: 0.82rem; color: var(--ink-3); }
.bd-rows { display: flex; flex-direction: column; }
.bd-row { display: grid; grid-template-columns: 46px 88px minmax(0, 1fr); gap: 0.5rem; padding: 0.55rem 0; border-bottom: 1px solid var(--border); font-size: 0.92rem; line-height: 1.4; align-items: start; }
.bd-row:last-child { border-bottom: 0; }
.bd-row-date { font-size: 0.78rem; color: var(--ink-3); padding-top: 2px; }
.bd-row .pill-label { justify-self: start; margin-top: 1px; }
.bd-row-src { grid-column: 3; font-size: 0.78rem; color: var(--ink-3); }

/* Projection: the same radar, sized to be read from the back of the room and
   across the whole screen. Sizes are in px so they do not ride on the page
   font-size. Nothing readable goes under 22px. */
.bd-project { max-width: none; padding-inline: 40px; padding-block: 1.5rem 3rem; }
.bd-projbar .topbar-main { max-width: none; padding-inline: 40px; }
.bd-radar.is-big { gap: 1.5rem; font-size: 24px; }
.bd-radar.is-big .bd-radar-title { font-size: 44px; line-height: 1.15; }
.bd-radar.is-big .bd-pipeline { font-size: 22px; gap: 0.6rem; }
.bd-radar.is-big .bd-pipeline i { width: 20px; }
.bd-radar.is-big .bd-kpis { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 1rem; }
.bd-radar.is-big .bd-kpis .tile { min-height: 0; max-width: 620px; grid-template-rows: auto auto auto; gap: 0.6rem; padding: 1.1rem 1.25rem 1rem; }
.bd-radar.is-big .tile-label { font-size: 26px; line-height: 1.25; }
.bd-radar.is-big .tile-value { font-size: 46px; padding-bottom: 0; white-space: normal; }
.bd-radar.is-big .tile-value .u { font-size: 24px; }
.bd-radar.is-big .tile-target { font-size: 22px; }
.bd-radar.is-big .bd-placeholder { font-size: inherit; font-style: normal; color: var(--ink-3); margin-right: 0; }
.bd-radar.is-big .bd-alerts, .bd-radar.is-big .bd-rail, .bd-radar.is-big .bd-tl { padding: 1.1rem 1.25rem; }
.bd-radar.is-big .bd-alerts h3, .bd-radar.is-big .bd-rail h3, .bd-radar.is-big .bd-tl h3 { font-size: 22px; margin-bottom: 0.7rem; }
.bd-radar.is-big .bd-alert-list { grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); gap: 1rem 2rem; }
.bd-radar.is-big .bd-alert { font-size: 24px; line-height: 1.35; gap: 0.7rem; }
.bd-radar.is-big .bd-alert-icon { width: 14px; height: 14px; }
.bd-radar.is-big .bd-alert-under { font-size: 22px; }
.bd-radar.is-big .bd-radar-grid { grid-template-columns: 380px minmax(0, 1fr); gap: 1.25rem; }
.bd-radar.is-big .bd-source-type { font-size: 24px; }
.bd-radar.is-big .bd-source-where { font-size: 22px; }
.bd-radar.is-big .bd-row { font-size: 24px; grid-template-columns: 96px 156px minmax(0, 1fr); gap: 0.8rem; padding: 0.8rem 0; }
.bd-radar.is-big .bd-row-date { font-size: 22px; padding-top: 4px; }
.bd-radar.is-big .bd-row-src { font-size: 22px; }
.bd-radar.is-big .pill-label { font-size: 22px; min-width: 9rem; padding: 0.15rem 0.7rem; }
.bd-radar.is-big .bd-ghost { font-size: 22px; padding: 1.1rem 1.25rem; }

@media (max-width: 1100px) { .bd-grid { grid-template-columns: 360px minmax(0, 1fr); } }
@media (max-width: 900px) {
  .bd-grid { grid-template-columns: 1fr; }
  .bd-panel { position: static; max-height: none; }
  .bd-radar-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) { .bd-two { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: no-preference) { .bd-step { transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease); } }

/* Long words never overflow their box */
.rd-row-text, .fact-statement, .reader p, .reader li, .question p, .table-note { overflow-wrap: anywhere; }

/* The question the hero button opens */
.question.is-hilite { outline: 2px solid var(--accent); outline-offset: 4px; }

/* Radar: the task and the words */
.rd-intro { max-width: 72ch; }
.rd-intro h1 { font-size: 1.45rem; margin: 0 0 0.35rem; }
.rd-intro p { margin: 0; color: var(--ink-2); }
.rd-words { margin-top: 0.6rem; font-size: 0.93rem; }
.rd-words summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.rd-words dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; margin: 0.5rem 0 0; }
.rd-words dt { font-weight: 600; }
.rd-words dd { margin: 0; color: var(--ink-2); }
.rd-dot:not(.is-correct):not(.is-wrong) { visibility: hidden; }
.rules .textarea.rule { width: 100%; resize: vertical; min-height: 2.6rem; }
.rd-why .small { align-self: center; }
