/* August Operations (D56): the ops dashboard. Colours are the iOS semantic colours and the site's Iris accent, from the
   Figma "Episodic · iOS semantic colors" and web/* variables (Admin page, OPS-01 to OPS-19b); light and dark like the
   app. System fonts. Sizes in rem so large text scales. */
:root {
  --bg: #f2f2f7;
  --surface: #ffffff;
  --bar: #ffffff;
  --fg: #000000;
  --secondary: rgba(60, 60, 67, 0.6);
  --tertiary: rgba(60, 60, 67, 0.3);
  --rule: rgba(60, 60, 67, 0.16);
  --rule-strong: rgba(60, 60, 67, 0.29);
  --fill: rgba(118, 118, 128, 0.12);
  --fill-strong: rgba(118, 118, 128, 0.2);
  --skeleton: rgba(118, 118, 128, 0.14);
  --accent: #4433ff;
  --accent-fill: #4433ff;
  --accent-soft: #eceaff;
  --on-accent: #ffffff;
  --success: #248a3d;
  --warning: #b25000;
  --warning-soft: #fff4e5;
  --critical: #d70015;
  --critical-soft: #ffecec;
  --s1: #4433ff;
  --s2: #0e9f8e;
  --s3: #e08a00;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.14), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
  --radius: 14px;
  --sidebar: 13.75rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --bar: #1c1c1e;
    --fg: #ffffff;
    --secondary: rgba(235, 235, 245, 0.6);
    --tertiary: rgba(235, 235, 245, 0.3);
    --rule: rgba(84, 84, 88, 0.45);
    --rule-strong: rgba(84, 84, 88, 0.65);
    --fill: rgba(118, 118, 128, 0.24);
    --fill-strong: rgba(118, 118, 128, 0.32);
    --skeleton: rgba(118, 118, 128, 0.22);
    --accent: #a39bff;
    --accent-fill: #6a5cff;
    --accent-soft: #1d1940;
    --success: #30d158;
    --warning: #ffb340;
    --warning-soft: #3a2a10;
    --critical: #ff6961;
    --critical-soft: #3b1518;
    --s1: #8077ff;
    --s2: #3cc7b5;
    --s3: #ffb340;
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.6), 0 0 0 0.5px rgba(255, 255, 255, 0.12);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 0.875rem/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.noscript { padding: 24px; }

/* Buttons */
.button {
  border: 0; border-radius: 8px; background: var(--fill); padding: 0.4rem 0.8rem; font-weight: 600; font-size: 0.8125rem;
  cursor: pointer; white-space: nowrap;
}
.button:hover { background: var(--fill-strong); }
.button.primary { background: var(--accent-fill); color: var(--on-accent); }
.button.soft { background: var(--accent-soft); color: var(--accent); font-size: 1rem; padding: 0.6rem 1.2rem; border-radius: 10px; }
.button.outline { background: transparent; border: 1px solid var(--rule-strong); border-radius: 999px; }
.button.outline:hover { background: var(--fill); }
.link-button { border: 0; background: none; padding: 0.4rem 0.6rem; color: var(--accent); font-weight: 600; font-size: 0.8125rem; cursor: pointer; }
.mark {
  display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 0.45rem; background: var(--accent-fill);
  color: #fff; font-weight: 600; font-size: 1.05rem; line-height: 1; padding-bottom: 0.12rem; flex: none;
}
.mark-large { width: 3.25rem; height: 3.25rem; border-radius: 0.8rem; font-size: 1.9rem; }

/* Gate: sign in, signing in, couldn't sign in, not an operator */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.gate-card {
  width: min(100%, 25.75rem); background: var(--surface); border-radius: 18px; padding: 2.25rem 2.25rem 2rem;
  display: flex; flex-direction: column; align-items: center; gap: 1rem; text-align: center;
}
.gate-card > div { display: flex; flex-direction: column; align-items: center; gap: 1rem; width: 100%; }
.gate h1 { font-size: 1.5rem; line-height: 1.2; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
.gate-lede { margin: 0; color: var(--secondary); font-size: 1rem; line-height: 1.4; }
.gate-error { margin: 0; color: var(--critical); font-size: 0.8125rem; }
.gate-hint { margin: 0; color: var(--secondary); font-size: 0.75rem; }
.gate-actions { display: flex; gap: 1.5rem; align-items: center; justify-content: center; }
.gate-actions .button { font-size: 1rem; padding: 0.6rem 1.2rem; border-radius: 10px; }
.gate-actions .link-button { font-size: 1rem; }
.apple {
  width: 100%; height: 2.8rem; border: 0; border-radius: 10px; background: #000; color: #fff; font-size: 1.05rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem; cursor: pointer;
}
.apple svg { width: 0.9rem; fill: currentColor; }
.apple[aria-busy="true"] { background: #262628; cursor: progress; }
.apple[aria-busy="true"] svg { display: none; }
.apple[aria-busy="true"]::before {
  content: ""; width: 0.9rem; height: 0.9rem; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff; animation: spin 0.9s linear infinite;
}
@media (prefers-color-scheme: dark) {
  .apple { background: #fff; color: #000; }
  .apple[aria-busy="true"] { background: #d8d8dc; }
  .apple[aria-busy="true"]::before { border-color: rgba(0, 0, 0, 0.25); border-top-color: #000; }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Shell */
.shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "top top" "side main";
}
.topbar {
  grid-area: top; position: sticky; top: 0; z-index: 20; background: var(--bar); border-bottom: 0.5px solid var(--rule-strong);
  display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 1.5rem; min-height: 3.5rem;
}
.brand { display: flex; align-items: center; gap: 0.6rem; color: var(--fg); margin-right: auto; font-size: 1.0625rem; }
.brand:hover { text-decoration: none; }
.brand-name { font-weight: 600; }
.brand-sub { color: var(--secondary); }
.updated { color: var(--secondary); font-size: 0.8125rem; white-space: nowrap; }
.topbar .link-button { margin-left: 0.4rem; }
.chips { display: none; }
.sidebar { grid-area: side; padding: 1.5rem 0.75rem; position: sticky; top: 3.55rem; align-self: start; max-height: calc(100dvh - 3.55rem); overflow: auto; }
.sidebar a {
  display: block; padding: 0.5rem 0.75rem; border-radius: 8px; color: var(--fg); font-size: 0.8125rem; line-height: 1.2;
}
.sidebar a:hover { text-decoration: none; background: var(--fill); }
.sidebar a[aria-current="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar .group { color: var(--tertiary); font-size: 0.8125rem; padding: 1.4rem 0.75rem 0.5rem; }
.content { grid-area: main; padding: 1.75rem 2rem 4rem 1.75rem; min-width: 0; outline: none; position: relative; }
.overview { max-width: 62.5rem; }

/* Page and section headings */
.page-head { display: flex; flex-direction: column; gap: 0.15rem; margin-bottom: 1rem; }
.page-head h1, .section > header h1 { font-size: 1.375rem; line-height: 1.3; margin: 0; letter-spacing: -0.01em; }
.lede { color: var(--secondary); font-size: 0.8125rem; margin: 0; }
.back { font-size: 0.8125rem; margin-bottom: 0.15rem; }
.section { display: flex; flex-direction: column; gap: 1rem; }
.section > header { display: flex; flex-direction: column; gap: 0.15rem; margin-bottom: 0.1rem; }
.group-title { color: var(--secondary); font-size: 0.8125rem; font-weight: 600; margin: 0.25rem 0 -0.35rem; }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(13.75rem, 1fr)); gap: 0.75rem; }
.tile {
  background: var(--surface); border-radius: var(--radius); padding: 0.9rem 1rem 1rem; display: flex; flex-direction: column;
  gap: 0.15rem; min-width: 0; color: var(--fg);
}
a.tile:hover { text-decoration: none; box-shadow: inset 0 0 0 1.5px var(--accent-soft); }
.tile-label { color: var(--secondary); font-size: 0.8125rem; }
.tile-value { font-size: 1.75rem; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.tile-note { color: var(--secondary); font-size: 0.8125rem; line-height: 1.35; }
.tile.success .tile-value { color: var(--success); }
.tile.warning { background: var(--warning-soft); }
.tile.warning .tile-label, .tile.warning .tile-value { color: var(--warning); }
.tile.critical { background: var(--critical-soft); }
.tile.critical .tile-label, .tile.critical .tile-value { color: var(--critical); }
.tile.accent .tile-value { color: var(--accent); }
.tile.attention .tile-value { color: var(--warning); }
.tile.skeleton { min-height: 6rem; background: var(--skeleton); }

/* Cards, tables */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); gap: 1rem; align-items: start; }
.card { background: var(--surface); border-radius: var(--radius); padding: 1.1rem 1.25rem 1.25rem; min-width: 0; }
.card.half { align-self: stretch; }
.card-head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 0.65rem; }
.card-head h2, .card-head h3 { font-size: 1.0625rem; font-weight: 600; margin: 0; margin-right: auto; }
.card-note { color: var(--secondary); font-size: 0.8125rem; text-align: right; }
.empty { color: var(--secondary); font-size: 0.8125rem; margin: 0.25rem 0 0; }
.more { display: flex; justify-content: flex-end; margin-top: 0.75rem; }
.more a, .more button { font-size: 0.8125rem; border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; }

table.data { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
table.data th {
  text-align: left; color: var(--secondary); font-weight: 600; padding: 0.5rem 0.6rem 0.6rem; border-bottom: 0.5px solid var(--rule-strong);
  white-space: nowrap; vertical-align: bottom;
}
table.data td { padding: 0.7rem 0.6rem; border-bottom: 0.5px solid var(--rule); vertical-align: middle; }
table.data th:first-child, table.data td:first-child { padding-left: 0; }
table.data th:last-child, table.data td:last-child { padding-right: 0; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .num, table.data .end { text-align: right; white-space: nowrap; }
table.data .muted { color: var(--secondary); }
table.data tr.total td { font-weight: 700; border-top: 0.5px solid var(--rule-strong); border-bottom: 0; }
table.data td a { color: var(--fg); }
table.data td a:hover { color: var(--accent); }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: var(--fill); }
.pill {
  display: inline-block; border-radius: 999px; padding: 0.05rem 0.5rem; font-size: 0.6875rem; font-weight: 600;
  background: var(--fill); color: var(--secondary); white-space: nowrap;
}
.pill.warning { background: var(--warning-soft); color: var(--warning); }
.pill.critical { background: var(--critical-soft); color: var(--critical); }
.pill.success { color: var(--success); }
.status { white-space: nowrap; }
.status::before { content: ""; display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%; margin-right: 0.4rem; vertical-align: 0.02rem; background: currentColor; }
.status.success { color: var(--success); }
.status.warning { color: var(--warning); }
.status.critical { color: var(--critical); }
.status.accent { color: var(--accent); }
.status.neutral { color: var(--secondary); }
.status.neutral::before { background: var(--secondary); }
.status.muted, .status.plain { color: var(--secondary); }
.status.muted::before, .status.plain::before { display: none; }

/* Notes and banners */
.note-text { color: var(--secondary); font-size: 0.8125rem; margin: 0; }
.banner { border-radius: 12px; padding: 0.8rem 1rem; font-size: 0.8125rem; }
.banner.accent { background: var(--accent-soft); color: var(--accent); }
.banner.critical { background: var(--critical-soft); }
.banner.critical strong { color: var(--critical); display: block; font-size: 1.0625rem; margin-bottom: 0.2rem; }
.banner.warning { background: var(--warning-soft); }
.banner.warning strong { color: var(--warning); display: block; font-size: 1.0625rem; }

/* Charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: 12rem; overflow: visible; }
.chart .grid line { stroke: var(--rule-strong); stroke-width: 0.5; }
.chart .axis text { fill: var(--tertiary); font-size: 10px; }
.chart .bars rect { transition: opacity 0.12s; }
.chart.has-focus .bars g:not(.focus) { opacity: 0.35; }
.chart .hit { fill: transparent; cursor: pointer; }
.legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; margin-top: 0.75rem; color: var(--secondary); font-size: 0.8125rem; }
.legend span::before { content: ""; display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%; margin-right: 0.4rem; background: var(--c); }
.k0 { --c: var(--s1); } .k1 { --c: var(--s2); } .k2 { --c: var(--s3); }
.chart rect.k0, .chart rect.k1, .chart rect.k2 { fill: var(--c); }
.tone-success { color: var(--success); } .tone-warning { color: var(--warning); } .tone-critical { color: var(--critical); }
table.data td.sub { display: none; }
.v-narrow { display: none; }
.narrow-inline { display: none; }
.tile-note.v-wide { display: block; }
.tip {
  position: absolute; z-index: 5; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); padding: 0.6rem 0.8rem;
  font-size: 0.8125rem; min-width: 11rem; pointer-events: none;
}
.tip .tip-day { color: var(--secondary); }
.tip .tip-total { font-size: 1.0625rem; font-weight: 700; margin-bottom: 0.2rem; }
.tip .tip-row { display: flex; gap: 0.75rem; align-items: center; }
.tip .tip-row span:first-child { margin-right: auto; }
.tip .tip-row span:first-child::before { content: ""; display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%; margin-right: 0.35rem; background: var(--c); }

/* Timeline (OPS-18) */
.timeline { list-style: none; margin: 0.25rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 1.1rem; }
.timeline li { display: grid; grid-template-columns: 5.5rem 1rem minmax(0, 1fr); gap: 0.25rem 0.75rem; align-items: baseline; }
.timeline time { color: var(--secondary); font-size: 0.8125rem; }
.timeline .dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--success); align-self: center; }
.timeline .dot.neutral { background: var(--secondary); }
.timeline .dot.critical { background: var(--critical); }
.timeline .dot.warning { background: var(--warning); }
.timeline .dot.accent { background: var(--accent); }
.timeline strong { font-size: 0.8125rem; }
.timeline p { grid-column: 3; margin: 0.1rem 0 0; color: var(--secondary); font-size: 0.8125rem; }
.recap { margin: 0.25rem 0 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 0.7rem; font-size: 1.0625rem; line-height: 1.45; }
.recap li::marker { color: var(--tertiary); }

/* The fixed-cost editor (OPS-08b wide, OPS-08c phone) */
.card-head .button { align-self: center; }
dialog.editor {
  width: min(40rem, calc(100vw - 2rem)); max-height: calc(100dvh - 4rem); padding: 1.4rem 1.5rem 1.25rem; border: 0;
  border-radius: 16px; background: var(--surface); color: var(--fg); box-shadow: var(--shadow); overflow: auto;
}
dialog.editor::backdrop { background: rgba(0, 0, 0, 0.28); }
.editor form { display: flex; flex-direction: column; gap: 0.75rem; }
.editor .ed-bar { display: none; }
.editor .ed-head { display: flex; align-items: center; gap: 1rem; }
.editor h2 { font-size: 1.375rem; margin: 0; margin-right: auto; }
.editor .ed-month { display: flex; align-items: center; gap: 0.75rem; font-weight: 600; font-size: 0.8125rem; }
.editor .ed-step {
  width: 1.75rem; height: 1.75rem; border: 0; border-radius: 8px; background: var(--fill); color: var(--accent); cursor: pointer;
  font-size: 1rem; line-height: 1;
}
.editor .ed-step:disabled { color: var(--tertiary); cursor: not-allowed; }
.editor .ed-lede { margin: 0; color: var(--secondary); font-size: 0.8125rem; }
.editor .ed-copy { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; background: var(--accent-soft); border-radius: 10px;
  padding: 0.6rem 0.75rem; font-size: 0.8125rem; }
.editor .ed-copy span { margin-right: auto; }
.editor .ed-cols, .editor .ed-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.95fr) minmax(0, 1.6fr) 1.75rem;
  gap: 0.5rem; align-items: center; }
.editor .ed-cols { color: var(--secondary); font-size: 0.8125rem; font-weight: 600; margin-bottom: -0.35rem; }
.editor .ed-rows { display: flex; flex-direction: column; gap: 0.5rem; }
.editor .ed-field > span:first-child { display: none; }
.editor input {
  width: 100%; border: 0; border-radius: 8px; background: var(--fill); padding: 0.45rem 0.6rem; font-size: 0.8125rem; color: var(--fg);
  outline: none; box-shadow: inset 0 0 0 1.5px transparent;
}
.editor input:focus { box-shadow: inset 0 0 0 1.5px var(--accent); }
.editor input[aria-invalid="true"] { box-shadow: inset 0 0 0 1.5px var(--critical); }
.editor .ed-money { position: relative; display: block; }
.editor .ed-money > span { position: absolute; left: 0.6rem; top: 50%; transform: translateY(-50%); color: var(--tertiary);
  font-size: 0.8125rem; pointer-events: none; }
.editor .ed-money input { padding-left: 1.4rem; text-align: right; font-variant-numeric: tabular-nums; }
.editor .ed-remove { border: 0; background: none; color: var(--secondary); cursor: pointer; font-size: 1.15rem; padding: 0; }
.editor .ed-remove-text { display: none; }
.editor .ed-add { align-self: flex-start; border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 0.8125rem;
  cursor: pointer; padding: 0.25rem 0; }
.editor .ed-loading { color: var(--secondary); font-size: 0.8125rem; margin: 0; }
.editor .ed-synced { font-size: 0.8125rem; color: var(--secondary); }
.editor .ed-synced p { display: flex; justify-content: space-between; margin: 0.2rem 0; }
.editor .ed-synced-title { font-weight: 600; }
.editor .ed-foot { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; border-top: 0.5px solid var(--rule-strong);
  padding-top: 0.9rem; margin-top: 0.15rem; font-size: 0.8125rem; }
.editor .ed-foot strong { margin-right: auto; }
.editor .ed-error { flex: 1 0 100%; order: 3; margin: 0; color: var(--critical); }
.editor .ed-buttons { display: flex; gap: 0.5rem; }
.editor .ed-buttons .button { font-size: 0.875rem; padding: 0.5rem 1rem; border-radius: 10px; }
.editor .button:disabled { opacity: 0.6; cursor: progress; }

/* Budgets, transcripts and recaps (OPS-27a–c, OPS-28) */
.card-foot { margin: 0.75rem 0 0; color: var(--secondary); font-size: 0.8125rem; }
.tone-muted { color: var(--secondary); }
.facts p { margin: 0; }
.facts .facts-label { color: var(--secondary); font-size: 0.8125rem; }
.facts .facts-value { font-size: 1.0625rem; font-weight: 600; margin: 0.15rem 0 0.4rem; }
.facts .facts-text { color: var(--secondary); font-size: 0.8125rem; }
.facts .facts-line { font-size: 0.8125rem; margin-top: 0.5rem; }
.facts .card-foot { margin-top: 0.75rem; }
.editor [data-body] { display: flex; flex-direction: column; gap: 0.75rem; }
.switch { position: relative; display: inline-block; width: 2.125rem; height: 1.25rem; flex: none; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer; }
.switch > span { position: absolute; inset: 0; border-radius: 999px; background: rgba(120, 120, 128, 0.32); pointer-events: none;
  transition: background 0.15s; }
.switch > span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 1rem; height: 1rem; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.15s; }
.switch input:checked + span { background: var(--accent-fill); }
.switch input:checked + span::after { transform: translateX(0.875rem); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.editor .ed-month-label { font-weight: 600; font-size: 0.8125rem; }
.editor .ed-foot-text { margin-right: auto; color: var(--secondary); }
.editor .bg-cols, .editor .bg-row { display: grid; grid-template-columns: 2.125rem minmax(0, 0.9fr) minmax(0, 0.9fr) minmax(0, 1.7fr);
  gap: 0.5rem 0.75rem; align-items: center; }
.editor .bg-cols { color: var(--secondary); font-size: 0.8125rem; font-weight: 600; margin-bottom: -0.35rem; }
.editor .bg-name { font-size: 0.875rem; }
.editor .bg-month { color: var(--secondary); font-size: 0.8125rem; }
.editor .bg-month-label { display: none; }
.editor .bg-row-error { grid-column: 2 / -1; margin: 0; color: var(--critical); font-size: 0.8125rem; }
.editor .ct-heading { margin: 0.25rem 0 -0.3rem; color: var(--secondary); font-size: 0.8125rem; font-weight: 600; }
.editor .ct-list { display: flex; flex-direction: column; gap: 0.5rem; }
.editor .ct-row, .editor .ct-option { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 0.875rem; border-radius: 10px;
  box-shadow: inset 0 0 0 1px var(--rule-strong); cursor: pointer; }
.editor .ct-option { align-items: flex-start; }
.editor .ct-option:has(input:checked) { box-shadow: inset 0 0 0 2px var(--accent); }
.editor .ct-text { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; min-width: 0; }
.editor .ct-text strong { font-size: 0.9375rem; }
.editor .ct-text span { color: var(--secondary); font-size: 0.8125rem; }
.editor .ct-text .ct-stat { color: var(--fg); margin-top: 0.15rem; }
.editor .ct-note { margin: 0; color: var(--secondary); font-size: 0.8125rem; }
.editor input[type="radio"] { width: 1.1rem; height: 1.1rem; margin: 0.15rem 0 0; padding: 0; background: none; box-shadow: none;
  accent-color: var(--accent); flex: none; }

/* Skeleton and states */
.stack { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
.narrow-only { display: none; }
.sk-title { width: 9rem; height: 1.4rem; }
.sk-lede { width: 14rem; margin-top: 0.6rem; }
.sk-chart { height: 11rem; margin-top: 0.75rem; }
.skeleton-block { background: var(--skeleton); border-radius: var(--radius); }
.skeleton-line { display: block; height: 0.65rem; border-radius: 6px; background: var(--skeleton); }
.state { min-height: 50vh; display: grid; place-items: center; text-align: center; padding: 2rem 1rem; }
.state > div { display: flex; flex-direction: column; align-items: center; gap: 0.65rem; max-width: 22rem; }
.state h2 { margin: 0; font-size: 1.0625rem; }
.state p { margin: 0; color: var(--secondary); font-size: 0.8125rem; }
.state .button { font-size: 1.0625rem; padding: 0.6rem 1.3rem; border-radius: 10px; margin-top: 0.2rem; }

/* Grids (OPS-15a to OPS-19a) */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.search {
  position: relative; flex: 0 1 17.5rem; min-width: 12rem;
}
.search input {
  width: 100%; border: 0; border-radius: 8px; background: var(--fill); padding: 0.45rem 0.7rem 0.45rem 2rem; font-size: 0.8125rem;
}
.search input::placeholder { color: var(--tertiary); }
.search svg { position: absolute; left: 0.65rem; top: 50%; transform: translateY(-50%); width: 0.85rem; height: 0.85rem; stroke: var(--secondary); fill: none; stroke-width: 2; }
.views { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.view {
  border: 0; border-radius: 999px; background: var(--fill); padding: 0.4rem 0.8rem; font-size: 0.8125rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.view:hover { background: var(--fill-strong); }
.view[aria-pressed="true"] { background: var(--accent-fill); color: var(--on-accent); }
.tools { display: flex; gap: 0.5rem; margin-left: auto; }
.filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0.75rem 0 1rem; position: relative; }
.add-filter {
  display: inline-flex; align-items: center; gap: 0.35rem; border: 1px dashed var(--tertiary); background: transparent; border-radius: 999px;
  padding: 0.3rem 0.75rem; font-size: 0.8125rem; font-weight: 600; cursor: pointer;
}
.add-filter svg, .filters-button svg { width: 0.75rem; height: 0.75rem; stroke: currentColor; fill: none; stroke-width: 2; }
.chip {
  display: inline-flex; align-items: center; gap: 0.1rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  font-size: 0.8125rem; border: 1px solid transparent; overflow: hidden;
}
.chip.open { border-color: var(--accent); }
.chip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0.3rem 0.3rem 0.3rem 0.75rem; font-size: inherit; }
.chip .chip-name { color: var(--secondary); }
.chip .chip-value { font-weight: 600; }
.chip .chip-x { padding: 0.3rem 0.65rem 0.3rem 0.25rem; font-weight: 700; }
.clear-all { border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 0.8125rem; cursor: pointer; }
.filters-button { display: none; }
.popover {
  position: absolute; z-index: 30; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); padding: 0.75rem;
  min-width: 15rem; max-width: min(19rem, calc(100vw - 2rem)); font-size: 0.8125rem;
}
.popover .pop-head { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.5rem; font-weight: 600; }
.popover .pop-head span { margin-left: auto; color: var(--accent); font-weight: 400; }
.popover input[type="search"], .popover input[type="number"], .popover input[type="date"] {
  width: 100%; border: 0; border-radius: 8px; background: var(--fill); padding: 0.4rem 0.6rem; font-size: 0.8125rem;
}
.popover .options { max-height: 18rem; overflow: auto; margin: 0.4rem -0.25rem 0; padding: 0 0.25rem; }
.popover label.option { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0; cursor: pointer; }
.popover label.option.selected { border-bottom: 0.5px solid var(--rule); padding-bottom: 0.45rem; margin-bottom: 0.15rem; }
.popover label.option span:last-child { margin-left: auto; color: var(--tertiary); }
.popover input[type="checkbox"] { accent-color: var(--accent-fill); width: 1rem; height: 1rem; margin: 0; }
.popover .pop-foot { color: var(--tertiary); font-size: 0.75rem; margin-top: 0.5rem; }
.popover .fields button {
  display: block; width: 100%; text-align: left; border: 0; background: none; padding: 0.45rem 0.5rem; border-radius: 6px; cursor: pointer;
}
.popover .fields button:hover { background: var(--fill); }
.popover .presets { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.popover .presets button { border: 0; border-radius: 999px; background: var(--fill); padding: 0.3rem 0.7rem; cursor: pointer; font-size: 0.8125rem; }
.popover .presets button[aria-pressed="true"] { background: var(--accent-fill); color: var(--on-accent); }
.popover .range { display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 0.6rem; align-items: center; color: var(--secondary); }
.popover .columns label { display: flex; gap: 0.5rem; align-items: center; padding: 0.3rem 0; cursor: pointer; }

.grid-card { background: var(--surface); border-radius: var(--radius); padding: 1.1rem 1.25rem 0.9rem; margin-top: 1rem; min-width: 0; }
.jump { display: flex; flex-wrap: wrap; gap: 0.15rem 0.2rem; align-items: center; margin: -0.1rem 0 0.4rem; font-size: 0.8125rem; color: var(--secondary); }
.jump span { margin-right: 0.6rem; }
.jump button {
  border: 0; background: none; color: var(--secondary); cursor: pointer; min-width: 1.45rem; height: 1.45rem; border-radius: 6px; padding: 0;
}
.jump button:hover { background: var(--fill); }
.jump button[aria-current="true"] { background: var(--accent-soft); color: var(--accent); }
.scroller { overflow: auto; position: relative; height: clamp(22rem, calc(100dvh - 21rem), 60rem); overscroll-behavior: contain; }
table.grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 0.8125rem; }
table.grid th {
  position: sticky; top: 0; z-index: 2; background: var(--surface); text-align: left; color: var(--fg); font-weight: 600;
  padding: 0.5rem 0.6rem 0.6rem; border-bottom: 0.5px solid var(--rule-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  user-select: none;
}
table.grid th.sortable { cursor: pointer; }
table.grid th .sort { color: var(--fg); margin-left: 0.2rem; }
table.grid th .dot { display: inline-block; width: 0.3rem; height: 0.3rem; border-radius: 50%; background: var(--accent); margin-left: 0.3rem; vertical-align: middle; }
table.grid td {
  padding: 0 0.6rem; height: 2.45rem; border-bottom: 0.5px solid var(--rule); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--surface);
}
table.grid th:first-child, table.grid td:first-child { padding-left: 0; }
table.grid .num { text-align: right; }
table.grid .pinned { position: sticky; left: 0; z-index: 1; }
table.grid th.pinned { z-index: 3; }
table.grid .pinned.edge { box-shadow: 6px 0 6px -6px rgba(0, 0, 0, 0.18); }
table.grid tr.row { cursor: pointer; }
table.grid td a { color: var(--fg); }
table.grid td a:hover { color: var(--accent); text-decoration: none; }
table.grid tr.row:hover td { background: color-mix(in srgb, var(--fill) 60%, var(--surface)); }
table.grid tr.spacer td { height: auto; padding: 0; border: 0; }
table.grid td .skeleton-line { width: 70%; }
table.grid td.num .skeleton-line { margin-left: auto; width: 40%; }
table.grid .muted { color: var(--secondary); }
table.grid td.wrap { white-space: normal; line-height: 1.3; padding-top: 0.45rem; padding-bottom: 0.45rem; }
.resize {
  position: absolute; top: 0.3rem; bottom: 0.3rem; right: 0; width: 0.5rem; cursor: col-resize; touch-action: none;
}
.resize::after { content: ""; position: absolute; right: 0.15rem; top: 20%; bottom: 20%; width: 1px; background: var(--rule-strong); opacity: 0; }
th:hover .resize::after, .resize.active::after { opacity: 1; }
table.grid th { position: sticky; }
.grid-foot { display: flex; justify-content: space-between; gap: 1rem; padding-top: 0.75rem; color: var(--fg); font-size: 0.8125rem; }
.grid-foot .muted { color: var(--secondary); }
.grid-error { color: var(--critical); }

/* Narrow windows: chips under the header, tiles two to a row, stacked table rows (OPS-07, OPS-12, OPS-13). */
@media (max-width: 47.99rem) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main"; }
  .sidebar { display: none; }
  .topbar { flex-wrap: wrap; padding: 0.75rem 1rem 0.65rem; gap: 0.5rem; row-gap: 0.65rem; }
  .brand-name, .updated { display: none; }
  .brand-sub { color: var(--fg); font-weight: 600; }
  .topbar .link-button { margin-left: 0.25rem; }
  .chips {
    display: flex; flex: 1 0 100%; gap: 0.5rem; overflow-x: auto; scrollbar-width: none; margin: 0 -1rem; padding: 0 1rem 0.1rem;
    scroll-padding: 0 1rem;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chips a {
    flex: none; border-radius: 999px; background: var(--fill); color: var(--fg); padding: 0.4rem 0.8rem; font-weight: 600; font-size: 0.8125rem;
  }
  .chips a:hover { text-decoration: none; }
  .chips a[aria-current="true"] { background: var(--accent-fill); color: var(--on-accent); }
  .content { padding: 1.25rem 1rem 3rem; }
  .narrow-only { display: block; }
  .wide-only { display: none; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
  .tile { padding: 0.75rem 0.9rem 0.85rem; }
  .tile-value { font-size: 1.375rem; }
  .card { padding: 1rem 1rem 0.5rem; }
  .card-head { flex-direction: row; }
  .card-note { display: none; }
  /* Stacked rows: the first column and the main value on one line, the rest as muted lines under it. */
  table.data.stackable thead { display: none; }
  table.data.stackable, table.data.stackable tbody, table.data.stackable tr { display: block; width: 100%; }
  table.data.stackable tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.15rem 0.75rem; padding: 0.7rem 0; border-bottom: 0.5px solid var(--rule); }
  table.data.stackable tr:last-child { border-bottom: 0; }
  table.data.stackable td { display: none; padding: 0; border: 0; }
  table.data.stackable td.first, table.data.stackable td.main { display: block; font-weight: 600; }
  table.data.stackable td.main { text-align: right; }
  table.data.stackable td.sub { display: block; grid-column: 1 / -1; color: var(--secondary); white-space: pre-line; }
  .v-wide, .tile-note.v-wide { display: none; }
  .v-narrow { display: inline; }
  .tile-note.v-narrow { display: block; }
  .narrow-inline { display: inline; font-weight: 600; }
  table.data.stackable tr.total { border-top: 0.5px solid var(--rule-strong); }
  table.data.stackable tr.total td { border: 0; }
  table.data.stackable tr.total td.first, table.data.stackable tr.total td.main { font-weight: 700; }
  .toolbar .search { flex: 1 1 100%; }
  .tools { margin-left: 0; }
  .filterbar .chip, .filterbar .add-filter, .filterbar .clear-all { display: none; }
  .filterbar.sheet-open .chip, .filterbar.sheet-open .add-filter, .filterbar.sheet-open .clear-all { display: inline-flex; }
  .filters-button {
    display: inline-flex; align-items: center; gap: 0.35rem; border: 1px solid var(--rule-strong); background: transparent; border-radius: 999px;
    padding: 0.3rem 0.75rem; font-size: 0.8125rem; font-weight: 600; cursor: pointer;
  }
  .grid-card { padding: 0.9rem 1rem 0.75rem; }
  .grid-foot { flex-direction: column-reverse; gap: 0.15rem; }
  .grid-foot .muted:empty { display: none; }
  .scroller { height: clamp(22rem, calc(100dvh - 19rem), 60rem); }
  table.grid.stacked { table-layout: auto; width: 100% !important; }
  table.grid.stacked thead { display: none; }
  table.grid.stacked colgroup { display: none; }
  table.grid.stacked tr.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.1rem 0.75rem; padding: 0.6rem 0; border-bottom: 0.5px solid var(--rule); }
  table.grid.stacked tr.row td { display: none; height: auto; padding: 0; border: 0; background: none; }
  table.grid.stacked tr.row td.first, table.grid.stacked tr.row td.main { display: block; font-weight: 600; position: static; }
  table.grid.stacked tr.row td.main { text-align: right; }
  table.grid.stacked tr.row td.sub { display: block; grid-column: 1 / -1; color: var(--secondary); white-space: normal; }
  table.grid.stacked tr.spacer { display: block; }
  table.grid.stacked tr.spacer td { display: block; }
  .timeline li { grid-template-columns: 4.25rem 0.75rem minmax(0, 1fr); }
  dialog.editor { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; border-radius: 0; padding: 0;
    background: var(--bg); box-shadow: none; }
  .editor form { padding: 0 1rem 2rem; gap: 0.85rem; }
  .editor .ed-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; position: sticky; top: 0; z-index: 1;
    margin: 0 -1rem; padding: 0.75rem 1rem; background: var(--bar); border-bottom: 0.5px solid var(--rule-strong); }
  .editor .ed-bar h2 { margin: 0; font-size: 1.0625rem; }
  .editor .ed-bar .link-button { justify-self: start; padding: 0; font-size: 1rem; font-weight: 400; }
  .editor .ed-bar .ed-save-link { justify-self: end; font-weight: 600; }
  .editor .ed-head { justify-content: center; }
  .editor .ed-head h2 { display: none; }
  .editor .ed-month { font-size: 0.9375rem; gap: 1rem; }
  .editor .ed-cols { display: none; }
  .editor .ed-rows { gap: 0.75rem; }
  .editor .ed-row { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr); background: var(--surface); border-radius: 14px;
    padding: 0.75rem 0.75rem 0.6rem; gap: 0.5rem 0.5rem; }
  .editor .ed-vendor { grid-column: 1 / -1; }
  .editor .ed-field > span:first-child { display: block; color: var(--secondary); font-size: 0.75rem; font-weight: 600; margin-bottom: 0.25rem; }
  .editor input { font-size: 1rem; padding: 0.55rem 0.7rem; }
  .editor .ed-remove { grid-column: 1 / -1; justify-self: start; color: var(--critical); font-size: 0.875rem; padding: 0.15rem 0; }
  .editor .ed-x { display: none; }
  .editor .ed-remove-text { display: inline; }
  .editor .ed-foot { border-top: 0; padding-top: 0; }
  .editor .ed-buttons { display: none; }
  .editor .bg-cols { display: none; }
  .editor .bg-row { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr); grid-template-areas: "name sw" "limit month" "err err";
    background: var(--surface); border-radius: 14px; padding: 0.85rem 0.75rem 0.75rem; gap: 0.5rem; }
  .editor .bg-row .switch { grid-area: sw; justify-self: end; }
  .editor .bg-name { grid-area: name; font-weight: 600; font-size: 1rem; }
  .editor .bg-limit { grid-area: limit; }
  .editor .bg-month { grid-area: month; align-self: stretch; display: flex; flex-direction: column; font-size: 0.875rem; }
  .editor .bg-month [data-month-text] { margin-top: auto; padding-bottom: 0.55rem; }
  .editor .bg-month-label { display: block; color: var(--secondary); font-size: 0.75rem; font-weight: 600; margin-bottom: 0.25rem; }
  .editor .bg-row-error { grid-area: err; }
  .editor .ct-row, .editor .ct-option { background: var(--surface); box-shadow: none; }
  .editor .ct-option:has(input:checked) { box-shadow: inset 0 0 0 2px var(--accent); }
  .recap { font-size: 1rem; }
  .jump { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Alerts (OPS-29): what's waiting, and one alert. */
.sidebar a[data-nav-id="alerts"] { display: flex; align-items: center; justify-content: space-between; }
.nav-count { background: var(--critical); color: var(--on-accent); border-radius: 999px; font-size: 0.75rem; font-weight: 600; line-height: 1.15rem; padding: 0 0.42rem; }
.alert-row { display: flex; align-items: center; gap: 1rem; padding: 0.75rem 0; color: inherit; border-bottom: 1px solid var(--rule); }
.alert-row:last-child { border-bottom: 0; padding-bottom: 0.2rem; }
.alert-row:hover { text-decoration: none; }
.alert-row:hover strong { color: var(--accent); }
.alert-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.alert-main strong { font-size: 1.0625rem; font-weight: 600; }
.alert-main span { color: var(--secondary); font-size: 0.8125rem; }
.alert-meta { display: flex; align-items: center; gap: 1rem; flex: none; }
.alert-when { color: var(--secondary); font-size: 0.8125rem; min-width: 11rem; text-align: right; }
.alert-chev { color: var(--secondary); }
.alert-head { display: flex; align-items: center; gap: 0.75rem; }
.alert-title { flex: 1; min-width: 0; }
.alert-cols { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 1rem; align-items: start; margin-top: 1rem; }
.alert-col { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.alert-text { font-size: 0.8125rem; margin: 0; }
.alert-numbers { margin-top: 0.45rem; }
.alert-kv { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.8125rem; padding: 0.55rem 0; border-bottom: 1px solid var(--rule); }
.alert-kv:last-child { border-bottom: 0; padding-bottom: 0; }
.alert-kv > span:first-child { color: var(--secondary); flex: none; }
.alert-kv > a, .alert-value { text-align: right; min-width: 0; }
.alert-steps { font-size: 0.8125rem; margin: 0; padding-left: 1.25rem; display: flex; flex-direction: column; gap: 0.45rem; }
.alert-steps li::marker { color: var(--secondary); }
.alert-link { display: inline-block; font-size: 0.8125rem; margin-top: 0.6rem; }
.alert-time { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.5rem; font-size: 0.8125rem; padding: 0.2rem 0; }
.alert-time > span:first-child { color: var(--secondary); }
.alert-cta { width: 100%; padding: 0.75rem 1rem; border-radius: 10px; margin-top: 1rem; font-size: 0.9375rem; }
.alert-note { margin: 0; }
.alert-error { margin: 0.75rem 0 0; color: var(--critical); font-size: 0.8125rem; }
.alert-error[hidden] { display: none; }
@media (max-width: 47.99rem) {
  .alert-row { flex-wrap: wrap; gap: 0.35rem 0; }
  .alert-main { flex: 1 0 100%; }
  .alert-main strong { font-size: 0.8125rem; }
  .alert-meta { flex: 1 0 100%; justify-content: space-between; }
  .alert-when { min-width: 0; }
  .alert-chev { display: none; }
  .alert-head { flex-direction: column; align-items: flex-start; gap: 0.35rem; }
  .alert-cols { grid-template-columns: minmax(0, 1fr); }
}

/* Limits (OPS-30b, d). */
@media (min-width: 48rem) { dialog.editor.lm-dialog { width: min(45rem, calc(100vw - 2rem)); } }
.editor .lm-cols, .editor .lm-row { display: grid; grid-template-columns: 2.125rem minmax(0, 1.25fr) 5.6rem 5.6rem minmax(0, 1.5fr); gap: 0.5rem; align-items: center; }
.editor .lm-cols { color: var(--secondary); font-size: 0.8125rem; font-weight: 600; margin-bottom: -0.35rem; }
.editor .lm-name { font-size: 0.875rem; }
.editor .lm-row input[name="minute"], .editor .lm-row input[name="day"] { text-align: right; font-variant-numeric: tabular-nums; }
.editor .lm-busiest { color: var(--secondary); font-size: 0.8125rem; }
.editor .lm-row.hot .lm-busiest { color: var(--warning); }
.editor .lm-busiest-label { display: none; }
.editor .lm-warn { grid-column: 2 / -1; margin: 0; color: var(--warning); font-size: 0.8125rem; }
.editor .lm-warn[hidden], .editor .lm-error[hidden] { display: none; }
@media (max-width: 47.99rem) {
  .editor .lm-cols { display: none; }
  .editor .lm-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "name sw" "minute day" "busiest busiest";
    background: var(--surface); border-radius: 14px; padding: 0.85rem 0.75rem 0.75rem; gap: 0.5rem; }
  .editor .lm-row .switch { grid-area: sw; justify-self: end; }
  .editor .lm-name { grid-area: name; font-weight: 600; font-size: 1rem; }
  .editor .lm-row .ed-field:nth-of-type(1) { grid-area: minute; }
  .editor .lm-row .ed-field:nth-of-type(2) { grid-area: day; }
  .editor .lm-row .ed-field > span:first-child { display: block; color: var(--secondary); font-size: 0.75rem; font-weight: 600; margin-bottom: 0.25rem; }
  .editor .lm-busiest { grid-area: busiest; }
  .editor .lm-busiest-label { display: inline; }
  .editor .lm-warn, .editor .lm-error { grid-column: 1 / -1; grid-area: auto / 1 / auto / -1; }
}


/* Public pages dialog (#50): the list of pages taken down, and the row that adds one. */
.editor .pp-row .link-button { flex: none; }
.editor .pp-row-error, .editor .pp-add-error { color: var(--critical); }
.editor .pp-row-error[hidden], .editor .pp-add-error[hidden] { display: none; }
.editor .pp-add { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.editor .pp-add .pp-link { flex: 1 1 14rem; min-width: 0; }
.editor .pp-add .pp-link input { width: 100%; }
.editor .pp-add select { font: inherit; font-size: 0.875rem; padding: 0.45rem 0.6rem; border-radius: 8px; border: 1px solid var(--rule-strong);
  background: var(--surface); color: var(--fg); }
.editor .pp-add-error { flex-basis: 100%; margin: 0; font-size: 0.8125rem; }
