/* 0X9 campaign app. Colors, type and radii come from /tokens.css. */

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); letter-spacing: var(--tracking-display); margin: 0; }
h1 { font-size: clamp(1.5rem, 1.2rem + 1vw, 1.875rem); line-height: 1.2; font-weight: 700; }
h2 { font-size: 1.0625rem; font-weight: 700; }
h3 { font-size: 0.9375rem; font-weight: 700; }
p { margin: 0; }
a { color: inherit; }
img, svg { display: block; }
:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; border-radius: 6px; }
.skip-link {
  position: absolute; left: var(--space-sm); top: 0; z-index: 50;
  padding: var(--space-xs) var(--space-md);
  background: var(--color-ink); color: var(--color-paper);
  border-radius: var(--radius-input);
  transform: translateY(-120%);
}
.skip-link:focus { transform: translateY(var(--space-sm)); }

.icon { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: -0.2em; }
.icon-link { display: inline-flex; align-items: center; gap: 0.3rem; white-space: nowrap; }
.icon-link .icon { width: 15px; height: 15px; }
.muted { color: var(--color-muted); }
.small { font-size: 0.8125rem; }
.mono { font-family: var(--font-mono); font-size: 0.8125rem; }
.nowrap { white-space: nowrap; }
.stack { display: grid; gap: var(--space-md); }
.stack-lg { display: grid; gap: var(--space-lg); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs); }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.prose { white-space: pre-line; overflow-wrap: break-word; max-width: 70ch; }
.plain-list { list-style: none; margin: 0; padding: 0; }
hr.rule { border: 0; border-top: 1px solid var(--color-rule); margin: var(--space-xs) 0; width: 100%; }
.plain-list.stack > li { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: baseline; }
code { font-family: var(--font-mono); font-size: 0.85em; background: var(--color-paper-3); border-radius: 6px; padding: 0.05rem 0.35rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Wordmark */
a.wordmark {
  display: inline-flex; align-items: center;
  color: var(--color-ink); text-decoration: none;
  font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; letter-spacing: -0.02em;
}
.wordmark-x {
  display: inline-grid; place-items: center;
  width: 1.45em; height: 1.45em; margin-inline: 0.1em;
  border-radius: 0.45em;
  background: var(--color-accent); color: var(--color-ink);
  box-shadow: 0 3px 0 -1px var(--color-accent-deep);
  font-size: 0.82em; transform: rotate(-6deg);
}

/* App shell */
.app-body { background: var(--color-paper-2); }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; }
.sidebar {
  background: var(--color-paper);
  border-bottom: 1px solid var(--color-rule);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-md);
  padding: var(--space-sm) var(--page-gutter);
  position: sticky; top: 0; z-index: 10;
}
.sidebar-top { display: flex; align-items: center; }
.side-nav {
  display: flex; flex-wrap: nowrap; gap: 2px;
  overflow-x: auto; scrollbar-width: none;
  order: 3; width: 100%;
}
.side-nav::-webkit-scrollbar { display: none; }
.side-nav a {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.8rem; border-radius: 12px;
  color: var(--color-ink-2); text-decoration: none; font-weight: 500; white-space: nowrap;
  min-height: 2.5rem;
}
.side-nav a:hover { background: var(--color-paper-2); color: var(--color-ink); }
.side-nav a[aria-current="page"] { background: var(--tint-mint); color: var(--color-ink); font-weight: 650; }
.side-nav a[aria-current="page"] .icon { color: var(--color-mint-deep); }
.sidebar-foot { margin-left: auto; display: flex; align-items: center; gap: var(--space-sm); }
.who { display: none; }
.who-name { font-weight: 600; font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-role { font-size: 0.75rem; color: var(--color-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-main {
  width: 100%; max-width: 80rem; margin-inline: auto;
  padding: var(--space-lg) var(--page-gutter) var(--space-2xl);
  display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-lg); align-content: start;
  min-width: 0;
}

@media (min-width: 1024px) {
  .app-shell { grid-template-columns: 15.5rem minmax(0, 1fr); }
  /* The sidebar scrolls on its own when the window is short, so Sign out is always reachable. */
  .sidebar {
    position: sticky; top: 0; height: 100vh; height: 100dvh;
    overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
    flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: var(--space-lg);
    padding: var(--space-lg) var(--space-md);
    border-bottom: 0; border-right: 1px solid var(--color-rule);
  }
  .side-nav, .sidebar-top, .sidebar-foot { flex-shrink: 0; }
  .sidebar-top { padding: 0 var(--space-xs); }
  .side-nav { order: 0; flex-direction: column; overflow: visible; width: auto; }
  .sidebar-foot {
    margin-top: auto; margin-left: 0;
    flex-direction: column; align-items: stretch; gap: var(--space-xs);
    border-top: 1px solid var(--color-rule); padding-top: var(--space-md);
  }
  .who { display: block; padding: 0 var(--space-xs); min-width: 0; }
  .signout { justify-content: flex-start; }
  .app-main { padding-top: var(--space-xl); }
}
@media (min-width: 1024px) and (max-height: 800px) {
  .sidebar { gap: var(--space-sm); padding-block: var(--space-md); }
  .side-nav a { min-height: 2.15rem; padding-block: 0.4rem; }
  .sidebar-foot { padding-top: var(--space-sm); }
}

/* Page header */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-md); }
.page-heading { display: grid; gap: 0.35rem; min-width: 0; }
.page-heading h1 { overflow-wrap: anywhere; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--space-xs); align-items: center; }
.eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs); color: var(--color-muted); font-size: 0.875rem; }
.subtitle { color: var(--color-neutral); max-width: 70ch; text-wrap: pretty; }
.crumbs { display: flex; flex-wrap: wrap; gap: 0.4rem; font-size: 0.8125rem; color: var(--color-muted); }
.crumbs a { color: var(--color-muted); text-decoration: none; }
.crumbs a:hover { color: var(--color-ink); text-decoration: underline; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-height: 2.5rem; padding: 0.5rem 1rem;
  font: inherit; font-weight: 600; font-size: 0.875rem; line-height: 1.2;
  border-radius: var(--radius-pill); border: 1.5px solid transparent;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--dur-micro) var(--ease-soft), border-color var(--dur-micro) var(--ease-soft), transform var(--dur-micro) var(--ease-press);
}
.btn .icon { width: 16px; height: 16px; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-sm { min-height: 2.125rem; padding: 0.35rem 0.8rem; font-size: 0.8125rem; }
.btn-lg { min-height: 3rem; padding: 0.7rem 1.4rem; font-size: 0.9375rem; }
.btn-primary { background: var(--color-ink); color: var(--color-paper); }
.btn-primary:hover { background: var(--color-ink-2); }
.btn-accent { background: var(--color-mint); color: var(--color-ink); box-shadow: 0 3px 0 0 var(--color-mint-deep); }
.btn-accent:hover { background: oklch(83% 0.16 150); }
.btn-secondary { background: var(--color-paper); color: var(--color-ink); border-color: var(--color-rule); }
.btn-secondary:hover { border-color: var(--color-rule-2); background: var(--color-paper-2); }
.btn-ghost { background: transparent; color: var(--color-ink-2); }
.btn-ghost:hover { background: var(--color-paper-2); color: var(--color-ink); }
.btn-danger { background: var(--color-paper); color: oklch(50% 0.2 18); border-color: oklch(85% 0.06 18); }
.btn-danger:hover { background: var(--tint-coral); }
form[action$="/decline"] button { background: var(--color-paper); color: oklch(50% 0.2 18); border-color: oklch(85% 0.06 18); }
form[action="/logout"] button { background: transparent; box-shadow: none; }
.btn-block { width: 100%; }
.inline-form { display: inline-flex; margin: 0; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.2rem 0.6rem; border-radius: var(--radius-pill);
  font-size: 0.75rem; font-weight: 600; line-height: 1.4; white-space: nowrap;
  background: var(--color-paper-3); color: var(--color-neutral);
}
.badge::before { content: ""; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: currentColor; opacity: 0.85; }
.badge-green { background: var(--tint-mint); color: oklch(42% 0.12 150); }
.badge-blue { background: var(--tint-cyan); color: oklch(45% 0.15 235); }
.badge-amber { background: var(--tint-pear); color: oklch(45% 0.1 75); }
.badge-red { background: var(--tint-coral); color: oklch(48% 0.19 18); }
.badge-violet { background: var(--tint-lavender); color: oklch(45% 0.15 305); }
.badge-dark { background: var(--color-ink); color: var(--color-paper); }
.badge-dark::before { background: var(--color-rule-2); }
.badge-gray::before { background: var(--color-rule-2); }

/* Cards */
.card {
  background: var(--color-paper);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-card);
  box-shadow: 0 1px 2px oklch(20% 0.012 250 / 0.04);
  min-width: 0;
}
.card-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-rule);
}
.card-sub { color: var(--color-muted); font-size: 0.8125rem; margin-top: 0.15rem; }
.card-actions { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.card-body { padding: var(--space-lg); display: grid; gap: var(--space-md); }
.card-body.flush { padding: 0; }
.card-body.flush > .empty { padding: var(--space-xl) var(--space-lg); }

/* Layout grids */
.grid-2, .split { display: grid; gap: var(--space-lg); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1024px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
}

/* Stats sit in 2 then 3 columns. auto-fit was leaving a sixth card alone on the next
   row because it sized against the viewport, not the narrower column beside the sidebar. */
dl.stats { display: grid; gap: var(--space-sm); grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
@media (min-width: 720px) { dl.stats, dl.stats-even { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stat {
  background: var(--color-paper); border: 1px solid var(--color-rule); border-radius: 16px;
  padding: var(--space-md) var(--space-md) 0.9rem; display: grid; gap: 0.2rem; align-content: start;
}
.stat dt {
  display: flex; align-items: center; gap: 0.4rem;
  font-family: var(--font-label); font-size: 0.6875rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--color-muted);
}
.stat dt .icon { width: 15px; height: 15px; }
.stat dd { margin: 0; }
.stat-value { font-family: var(--font-display); font-size: 1.625rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; overflow-wrap: break-word; }
.stat-hint { font-size: 0.8125rem; color: var(--color-muted); }
.stat-green dt .icon { color: var(--color-mint-deep); }
.stat-blue dt .icon { color: var(--color-accent-2); }
.stat-amber dt .icon { color: var(--color-accent-deep); }
.stat-red dt .icon { color: var(--color-accent-3); }
.stat-violet dt .icon { color: var(--color-lavender-deep); }
.stat-highlight { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-paper); }
.stat-highlight dt, .stat-highlight .stat-hint { color: oklch(80% 0 0); }

/* Tables */
.table-wrap, .table-scroll { overflow-x: auto; max-width: 100%; width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
caption { text-align: left; padding: var(--space-sm) var(--space-md); font-weight: 600; }
th {
  text-align: left; white-space: nowrap;
  font-family: var(--font-label); font-size: 0.6875rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--color-muted);
  padding: 0.65rem var(--space-md); background: var(--color-paper-2);
  border-bottom: 1px solid var(--color-rule);
}
td { padding: 0.8rem var(--space-md); border-bottom: 1px solid var(--color-rule); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: oklch(98.8% 0 0); }
td.num, th.num { text-align: right; white-space: nowrap; }
td.actions, th.actions { text-align: right; white-space: nowrap; }
td.actions .row, td .row-end { justify-content: flex-end; }
td a { text-decoration: none; font-weight: 600; }
td a:hover { text-decoration: underline; }
.cell-sub { color: var(--color-muted); font-size: 0.8125rem; font-weight: 400; margin-top: 0.15rem; }
th.col-person { min-width: 12rem; }
th.col-status { min-width: 10rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: 0.25rem 0.9rem; margin: 0.35rem 0 0 2.95rem; }
.text-btn {
  font: inherit; font-size: 0.8125rem; font-weight: 600; color: var(--color-neutral);
  background: none; border: 0; padding: 0.2rem 0; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--color-rule-2); text-underline-offset: 3px;
}
.text-btn:hover { color: var(--color-ink); text-decoration-color: currentColor; }
.text-btn-danger { color: oklch(50% 0.2 18); }
.text-btn-danger:hover { color: oklch(42% 0.2 18); }
td { overflow-wrap: break-word; }

/* Fee and payment cell */
.pay-cell { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs); min-width: 13rem; }
.pay-done { display: grid; gap: 0.15rem; justify-items: start; }
.fee-form { display: flex; align-items: center; gap: var(--space-xs); margin: 0; }
.fee-input {
  display: inline-flex; align-items: center; width: 7.5rem;
  border: 1.5px solid var(--color-rule); border-radius: var(--radius-input); background: var(--color-paper);
}
.fee-input:focus-within { border-color: var(--color-accent-2); box-shadow: 0 0 0 3px var(--tint-cyan); }
.fee-currency { padding-left: 0.6rem; font-family: var(--font-mono); font-size: 0.6875rem; color: var(--color-muted); }
.fee-input input { border: 0; min-height: 2.125rem; padding: 0.3rem 0.5rem; font-size: 0.875rem; box-shadow: none; background: transparent; }
.fee-input input:focus { box-shadow: none; }
tr[hidden] { display: none; }

/* Tabs and toolbars */
.tabs { display: flex; gap: 0.25rem; overflow-x: auto; border-bottom: 1px solid var(--color-rule); scrollbar-width: none; }
.tabs a {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 0.8rem; margin-bottom: -1px;
  color: var(--color-muted); text-decoration: none; font-weight: 600; white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.tabs a:hover { color: var(--color-ink); }
.tabs a[aria-current="page"] { color: var(--color-ink); border-bottom-color: var(--color-ink); }
.tab-count { font-size: 0.75rem; padding: 0 0.45rem; border-radius: var(--radius-pill); background: var(--color-paper-3); color: var(--color-neutral); }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--space-xs); align-items: end; }
.toolbar .field { flex: 1 1 14rem; }
.toolbar .field-narrow { flex: 0 1 12rem; }
.search-field { position: relative; }

/* Forms */
.form { display: grid; gap: var(--space-md); }
.form-grid { display: grid; gap: var(--space-md); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid .span-2 { grid-column: 1 / -1; }
}
.form-actions { display: flex; flex-wrap: wrap; gap: var(--space-xs); align-items: center; }
.field { display: grid; gap: 0.35rem; min-width: 0; }
.field label { font-weight: 600; font-size: 0.875rem; }
.optional { font-weight: 400; color: var(--color-muted); font-size: 0.8125rem; }
.hint { font-size: 0.8125rem; color: var(--color-muted); }
input, select, textarea {
  width: 100%; font: inherit; color: inherit;
  background: var(--color-paper);
  border: 1.5px solid var(--color-rule); border-radius: var(--radius-input);
  padding: 0.6rem 0.8rem; min-height: 2.75rem;
  transition: border-color var(--dur-micro) var(--ease-soft), box-shadow var(--dur-micro) var(--ease-soft);
}
textarea { resize: vertical; min-height: 6rem; }
input:hover, select:hover, textarea:hover { border-color: var(--color-rule-2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--color-accent-2); box-shadow: 0 0 0 3px var(--tint-cyan); }
input[readonly] { background: var(--color-paper-2); }
input[type="checkbox"] { width: 1.15rem; height: 1.15rem; min-height: 0; padding: 0; accent-color: var(--color-ink); }
.input-sm { min-height: 2.125rem; padding: 0.3rem 0.6rem; font-size: 0.8125rem; width: 7rem; }
.check-cell { width: 2.5rem; }

/* Flash messages */
.flash {
  display: flex; gap: var(--space-sm); align-items: flex-start;
  padding: var(--space-md) var(--space-md);
  border-radius: 14px; border: 1px solid oklch(80% 0.1 150);
  background: oklch(97% 0.04 150);
}
.flash > .icon { color: oklch(48% 0.13 150); margin-top: 2px; }
.flash > div { display: grid; gap: var(--space-sm); min-width: 0; flex: 1; }
.flash-error { border-color: oklch(85% 0.08 18); background: oklch(97% 0.025 18); }
.flash-error > .icon { color: oklch(52% 0.2 18); }
.flash-info { border-color: oklch(85% 0.06 235); background: oklch(97.5% 0.02 235); }
.flash-info > .icon { color: var(--color-accent-2); }
.copy-list { display: grid; gap: var(--space-sm); }
.copy-row { display: grid; gap: 0.3rem; }
.copy-row label { font-size: 0.8125rem; font-weight: 600; }
.copy-controls { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.copy-controls input { flex: 1 1 16rem; font-family: var(--font-mono); font-size: 0.8125rem; min-height: 2.125rem; padding: 0.3rem 0.6rem; }

/* Empty states */
.empty { display: grid; justify-items: center; text-align: center; gap: 0.5rem; padding: var(--space-xl) var(--space-md); }
.empty-icon { width: 44px; height: 44px; padding: 10px; border-radius: 50%; background: var(--color-paper-2); color: var(--color-muted); }
.empty-title { font-weight: 650; max-width: 46ch; }
.empty-text { color: var(--color-muted); max-width: 52ch; font-size: 0.875rem; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-xs); margin-top: 0.35rem; }

/* People */
.person { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.person > div { min-width: 0; }
td .person { min-width: 13rem; }
.person-name { font-weight: 600; overflow-wrap: break-word; }
.person-name a { text-decoration: none; }
.person-name a:hover { text-decoration: underline; }
.person-sub { color: var(--color-muted); font-size: 0.8125rem; overflow-wrap: break-word; }
.handle { color: var(--color-muted); text-decoration: none; font-weight: 400; }
.handle:hover { color: var(--color-ink); text-decoration: underline; }
.avatar {
  width: 2.25rem; height: 2.25rem; flex: none; border-radius: 50%;
  display: inline-grid; place-items: center;
  font-size: 0.75rem; font-weight: 700; color: var(--color-ink);
}
.avatar-mint { background: var(--tint-mint); }
.avatar-cyan { background: var(--tint-cyan); }
.avatar-pear { background: var(--tint-pear); }
.avatar-coral { background: var(--tint-coral); }
.avatar-lavender { background: var(--tint-lavender); }

/* Progress */
.progress-wrap { display: flex; align-items: center; gap: 0.5rem; min-width: 7rem; }
.progress { appearance: none; -webkit-appearance: none; width: 4.5rem; height: 0.45rem; border: 0; border-radius: 99px; background: var(--color-paper-3); overflow: hidden; }
.progress::-webkit-progress-bar { background: var(--color-paper-3); border-radius: 99px; }
.progress::-webkit-progress-value { background: var(--color-mint-deep); border-radius: 99px; }
.progress::-moz-progress-bar { background: var(--color-mint-deep); border-radius: 99px; }
.progress-label { font-size: 0.8125rem; color: var(--color-neutral); white-space: nowrap; }

/* Chart */
.chart { margin: 0; display: grid; gap: 0.5rem; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart-grid { stroke: var(--color-rule); stroke-dasharray: 3 5; }
.chart-area { fill: var(--tint-mint); }
.chart-line { fill: none; stroke: var(--color-mint-deep); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart-dot { fill: var(--color-paper); stroke: var(--color-mint-deep); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.chart figcaption { display: flex; justify-content: space-between; gap: var(--space-sm); font-size: 0.75rem; color: var(--color-muted); }

/* Disclosure */
details.disclosure > summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 0.35rem;
  font-weight: 600; font-size: 0.8125rem; color: var(--color-neutral);
}
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: "▸"; font-size: 0.7rem; transition: transform var(--dur-micro); }
details.disclosure[open] > summary::before { transform: rotate(90deg); }
details.disclosure > summary:hover { color: var(--color-ink); }
details.disclosure > .disclosure-body { margin-top: var(--space-sm); }

/* Key-value list */
dl.facts { display: grid; gap: 0.6rem; margin: 0; }
dl.facts > div { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: var(--space-sm); }
dl.facts dt { color: var(--color-muted); font-size: 0.8125rem; }
dl.facts dd { margin: 0; overflow-wrap: break-word; }

/* Queue */
.queue-group { display: grid; gap: 0; }
.queue-item {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-sm);
  padding: 0.8rem var(--space-lg); border-bottom: 1px solid var(--color-rule);
}
.queue-item:last-child { border-bottom: 0; }
.queue-main { display: grid; gap: 0.15rem; min-width: 0; flex: 1 1 18rem; }
.queue-title { font-weight: 600; }
.queue-title a { text-decoration: none; }
.queue-title a:hover { text-decoration: underline; }
.queue-meta { color: var(--color-muted); font-size: 0.8125rem; }
.queue-actions { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.queue-more { padding: 0.7rem var(--space-lg); color: var(--color-muted); font-size: 0.8125rem; }

/* Invite picker */
.picker { display: grid; gap: var(--space-sm); }
.picker-list { max-height: 26rem; overflow: auto; border: 1px solid var(--color-rule); border-radius: 14px; }
.picker-list table td { padding: 0.55rem var(--space-sm); }
.picker-list label { display: contents; cursor: pointer; }

/* Creator task cards */
.task { border: 1px solid var(--color-rule); border-radius: var(--radius-card); background: var(--color-paper); padding: var(--space-lg); display: grid; gap: var(--space-md); color: inherit; text-decoration: none; }
a.task { transition: border-color var(--dur-micro) var(--ease-soft), background-color var(--dur-micro) var(--ease-soft); }
a.task:hover { border-color: var(--color-rule-2); background: var(--color-paper-2); }
.task-attention { border-color: oklch(80% 0.1 18); box-shadow: 0 0 0 3px var(--tint-coral); }
.task-new { border-color: oklch(82% 0.08 235); box-shadow: 0 0 0 3px var(--tint-cyan); }
.task-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-sm); align-items: flex-start; }
.task-title { font-size: 1.125rem; }
.task-title a { text-decoration: none; }
.task-title a:hover { text-decoration: underline; }
.task-meta { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; color: var(--color-muted); font-size: 0.8125rem; }
.task-meta span { display: inline-flex; align-items: center; gap: 0.35rem; }
.task-meta .icon { width: 15px; height: 15px; }
.fee { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; counter-reset: step; }
.steps li { display: grid; grid-template-columns: 1.75rem minmax(0, 1fr); gap: 0.6rem; align-items: center; counter-increment: step; }
.steps li::before {
  content: counter(step); width: 1.75rem; height: 1.75rem; border-radius: 50%;
  display: grid; place-items: center; font-size: 0.8125rem; font-weight: 700;
  background: var(--color-paper-3); color: var(--color-ink);
}
.steps li.done::before { content: "✓"; background: var(--color-mint); }
.steps code, .req {
  font-family: var(--font-mono); font-size: 0.8125rem;
  background: var(--color-paper-2); border: 1px solid var(--color-rule); border-radius: 8px;
  padding: 0.05rem 0.4rem; overflow-wrap: break-word;
}
.paste-form { display: flex; flex-wrap: wrap; gap: var(--space-xs); align-items: end; }
.paste-form .field { flex: 1 1 18rem; }
.mini-stats { display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; font-size: 0.875rem; }
.mini-stats span { display: inline-flex; gap: 0.3rem; align-items: baseline; }
.mini-stats b { font-weight: 700; }
.section-title { font-size: 1.0625rem; display: flex; align-items: center; gap: var(--space-xs); }

/* Post cards (client) */
.posts-grid { display: grid; gap: var(--space-md); grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
.post-card { border: 1px solid var(--color-rule); border-radius: 16px; padding: var(--space-md); display: grid; gap: var(--space-sm); background: var(--color-paper); align-content: start; }
.post-text { font-size: 0.875rem; color: var(--color-ink-2); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: break-word; }
.post-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--space-sm); flex-wrap: wrap; }

/* Signed-out pages */
.auth-body {
  min-height: 100vh;
  background: var(--color-paper-2);
}
.auth-shell { min-height: 100vh; display: grid; align-content: center; justify-items: center; gap: var(--space-lg); padding: var(--space-xl) var(--page-gutter); }
.auth-main {
  width: min(100%, 28rem);
  background: var(--color-paper); border: 1px solid var(--color-rule); border-radius: 24px;
  box-shadow: var(--shadow-card); padding: clamp(1.5rem, 4vw, 2.25rem);
  display: grid; gap: var(--space-lg);
}
.auth-main.wide { width: min(100%, 34rem); }
.auth-intro { display: grid; gap: 0.4rem; }
.auth-intro p { color: var(--color-neutral); }
.auth-alt { text-align: center; font-size: 0.875rem; color: var(--color-muted); }
.auth-alt a { color: var(--color-ink); font-weight: 600; }
.auth-foot { font-size: 0.75rem; color: var(--color-muted); }
.who-chip { display: inline-flex; gap: 0.4rem; align-items: center; padding: 0.35rem 0.75rem; border-radius: var(--radius-pill); background: var(--color-paper-2); font-size: 0.8125rem; }

.error-page { display: grid; gap: var(--space-md); }

/* Google button and "or" divider */
.btn-google { gap: 0.6rem; border-color: var(--color-rule-2); }
.btn-google .icon { width: 18px; height: 18px; }
.divider { display: flex; align-items: center; gap: var(--space-sm); color: var(--color-muted); font-size: 0.8125rem; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--color-rule); }
.hint.center { text-align: center; }
.field-label { font-weight: 600; font-size: 0.875rem; }
.auth-foot a { color: inherit; }
.auth-header .wordmark { font-size: 1.5rem; }

/* Lists */
ul.bullets { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.35rem; }
.stack-tight { display: grid; gap: 0.3rem; }
.notes-list li { display: grid; grid-template-columns: 1.25rem minmax(0, 1fr); gap: 0.6rem; align-items: start; }
.notes-list li > .icon { color: var(--color-muted); margin-top: 2px; }
.notes-list li.is-unread > .icon { color: var(--color-accent-2); }
details.insight { margin-top: 0.35rem; }

/* Operator */
.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 2.25rem; height: 2.25rem; padding: 0; border: 0; border-radius: 10px;
  background: transparent; color: var(--color-muted); cursor: pointer;
}
.icon-btn:hover { background: var(--color-paper-2); color: var(--color-ink); }
.icon-btn .icon { width: 18px; height: 18px; }
.op-page { display: grid; gap: var(--space-md); }
.op-layout { display: grid; gap: var(--space-lg); grid-template-columns: minmax(0, 1fr); align-items: start; }

/* Chat list: a drawer below 1100px, a column beside the chat above it. */
.op-side {
  background: var(--color-paper); display: grid; gap: var(--space-md); align-content: start;
  padding: var(--space-md); overflow-y: auto; overscroll-behavior: contain;
}
.op-side-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.op-side-head h2 { font-size: 1rem; }
.op-side-list { min-height: 0; }
.op-scrim { position: fixed; inset: 0; z-index: 39; background: oklch(20% 0.01 250 / 0.38); }
.op-scrim[hidden] { display: none; }
@media (max-width: 1099px) {
  .op-side {
    position: fixed; z-index: 40; top: 0; bottom: 0; left: 0;
    width: min(88vw, 22rem); border-right: 1px solid var(--color-rule);
    padding-top: calc(var(--space-md) + env(safe-area-inset-top));
    padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom));
    transform: translateX(-104%); visibility: hidden;
    transition: transform 240ms var(--ease-out, ease-out), visibility 0s linear 240ms;
    box-shadow: 12px 0 40px oklch(20% 0.01 250 / 0.14);
  }
  .op-page.drawer-open .op-side { transform: none; visibility: visible; transition: transform 240ms var(--ease-out, ease-out); }
}
@media (min-width: 1100px) {
  .op-layout { grid-template-columns: 18.5rem minmax(0, 1fr); }
  .op-side {
    position: sticky; top: var(--space-lg); max-height: calc(100dvh - 2 * var(--space-lg));
    border: 1px solid var(--color-rule); border-radius: var(--radius-card);
  }
  .op-drawer-open, .op-drawer-close, .op-scrim { display: none !important; }
}
.op-sessions { display: grid; gap: 2px; }
.op-session { position: relative; }
.op-sessions a { display: grid; gap: 0.1rem; padding: 0.6rem 2.6rem 0.6rem 0.7rem; border-radius: 12px; text-decoration: none; }
.op-sessions a:hover { background: var(--color-paper-2); }
.op-sessions a[aria-current="page"] { background: var(--tint-mint); }
.op-session-title { font-weight: 600; font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-session-meta { font-size: 0.75rem; color: var(--color-muted); display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }
.op-session-delete { position: absolute; right: 0.25rem; top: 50%; transform: translateY(-50%); margin: 0; opacity: 0; transition: opacity var(--dur-micro) var(--ease-soft); }
.op-session:hover .op-session-delete, .op-session:focus-within .op-session-delete, .op-session a[aria-current="page"] + .op-session-delete { opacity: 1; }
.op-session-delete .icon-btn:hover { color: oklch(50% 0.2 18); background: var(--tint-coral); }
@media (hover: none) { .op-session-delete { opacity: 1; } }

/* Memory */
details.op-memory { border-top: 1px solid var(--color-rule); padding-top: var(--space-sm); }
details.op-memory > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.5rem;
  font-weight: 600; font-size: 0.875rem; padding: 0.4rem 0.2rem;
}
details.op-memory > summary::-webkit-details-marker { display: none; }
details.op-memory > summary .tab-count { margin-left: auto; }
.op-memory-body { display: grid; gap: var(--space-md); padding-top: var(--space-sm); }
.plain-list.stack > li.op-note { display: grid; gap: 0.35rem; padding-bottom: var(--space-sm); border-bottom: 1px solid var(--color-rule); }
.op-note .inline-form { justify-self: start; }
.op-note-off textarea { opacity: 0.6; }

/* Chat */
.op-chat { display: flex; flex-direction: column; height: 75vh; min-height: 22rem; overflow: hidden; }
.op-chat-head {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: 0.6rem var(--space-md); border-bottom: 1px solid var(--color-rule); flex: none;
}
.op-chat-title { flex: 1; min-width: 0; display: grid; }
.op-chat-title h1 { font-size: 1.0625rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-chat-title .hint { font-size: 0.75rem; }
.op-chat-actions { flex-wrap: nowrap; }
.op-transcript {
  position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; overflow-anchor: none;
  display: grid; gap: var(--space-md); align-content: start;
  padding: var(--space-lg); scroll-padding-bottom: var(--space-lg);
  -webkit-overflow-scrolling: touch;
}
.op-msg { display: grid; gap: 0.35rem; max-width: min(46rem, 100%); min-width: 0; }
.op-msg-user { justify-self: end; max-width: min(36rem, 88%); }
.op-msg-system { justify-self: center; max-width: 40rem; }
.op-msg-new, .op-typing { animation: op-in 260ms var(--ease-out, ease-out) both; }
@keyframes op-in { from { opacity: 0; transform: translateY(8px); } }
.op-who { display: flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; font-weight: 600; color: var(--color-muted); }
.op-who span { font-weight: 400; }
.op-who .icon { width: 14px; height: 14px; }
.op-msg-user .op-who { justify-content: flex-end; }
.op-bubble { padding: 0.75rem 1rem; border-radius: 16px; background: var(--color-paper-2); border: 1px solid var(--color-rule); min-width: 0; }
.op-bubble .prose { max-width: none; }
.op-msg-user .op-bubble { background: var(--color-ink); color: var(--color-paper); border-color: var(--color-ink); border-bottom-right-radius: 6px; }
.op-msg-assistant .op-bubble { border-bottom-left-radius: 6px; }
.op-msg-system .op-bubble { background: transparent; border-style: dashed; font-size: 0.8125rem; color: var(--color-neutral); }

/* Thinking indicator: bouncing dots and a flowing shimmer line */
.op-typing[hidden] { display: none; }
.op-typing .op-bubble { display: grid; gap: 0.55rem; width: min(18rem, 70vw); }
.op-dots { display: inline-flex; gap: 0.3rem; align-items: center; height: 0.75rem; }
.op-dots i { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--color-mint-deep); animation: op-bounce 1.1s ease-in-out infinite; }
.op-dots i:nth-child(2) { animation-delay: 0.15s; }
.op-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes op-bounce { 0%, 70%, 100% { transform: translateY(0); opacity: 0.45; } 35% { transform: translateY(-5px); opacity: 1; } }
.op-shimmer { display: grid; gap: 0.4rem; }
.op-shimmer::before, .op-shimmer::after {
  content: ""; height: 0.55rem; border-radius: 99px;
  background: linear-gradient(90deg, var(--color-paper-3) 0%, var(--tint-mint) 40%, var(--color-paper-3) 80%);
  background-size: 250% 100%; animation: op-flow 1.4s linear infinite;
}
.op-shimmer::after { width: 62%; animation-delay: 0.2s; }
@keyframes op-flow { from { background-position: 100% 0; } to { background-position: -150% 0; } }
.op-typing [data-op-typing-label] {
  background: linear-gradient(90deg, var(--color-muted) 0%, var(--color-ink) 50%, var(--color-muted) 100%);
  background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: op-flow 1.8s linear infinite;
}

/* Plans */
.op-proposal { border: 1.5px solid var(--color-rule-2); border-radius: 16px; padding: var(--space-md); display: grid; gap: var(--space-sm); background: var(--color-paper); min-width: 0; }
.op-proposal-pending { border-color: oklch(80% 0.12 85); box-shadow: 0 0 0 3px var(--tint-pear); }
.op-proposal-applied { border-color: oklch(80% 0.1 150); }
.op-proposal-failed { border-color: oklch(82% 0.08 18); }
.op-proposal-title { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 700; }
.op-steps { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.35rem; font-size: 0.875rem; overflow-wrap: anywhere; }
.op-results li { display: flex; gap: 0.4rem; align-items: flex-start; }
.op-results .icon { color: var(--color-mint-deep); width: 16px; height: 16px; margin-top: 2px; }
.op-error { color: oklch(48% 0.19 18); }
.op-retry { justify-self: center; }
/* Approve stays pinned to the bottom of the chat while any part of the plan is on screen. */
.op-proposal-actions {
  position: sticky; bottom: calc(-1 * var(--space-lg)); z-index: 2;
  display: grid; gap: 0.35rem;
  margin: 0 calc(-1 * var(--space-md)) calc(-1 * var(--space-md));
  padding: var(--space-sm) var(--space-md) var(--space-md);
  background: var(--color-paper); border-top: 1px solid var(--color-rule);
  border-radius: 0 0 14px 14px;
  box-shadow: 0 -10px 18px -14px oklch(20% 0.01 250 / 0.35);
}
.btn.is-busy { pointer-events: none; opacity: 0.85; }
.btn.is-busy .icon { animation: op-spin 0.9s linear infinite; }
@keyframes op-spin { to { transform: rotate(360deg); } }

/* Empty chat */
.op-empty { display: grid; justify-items: center; text-align: center; gap: 0.5rem; padding: var(--space-lg) 0; }
.op-examples { display: grid; gap: var(--space-xs); width: 100%; max-width: 34rem; margin-top: var(--space-sm); }
.op-example {
  width: 100%; text-align: left; font: inherit; font-size: 0.875rem; color: var(--color-ink-2);
  padding: 0.65rem 0.85rem; border-radius: 12px; cursor: pointer;
  background: var(--color-paper); border: 1px solid var(--color-rule);
}
.op-example:hover { border-color: var(--color-rule-2); background: var(--color-paper-2); color: var(--color-ink); }

/* Composer */
.op-composer {
  flex: none; display: grid; gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md) var(--space-md); border-top: 1px solid var(--color-rule);
  background: var(--color-paper);
}
.op-composer textarea { min-height: 3rem; max-height: 14rem; resize: none; line-height: 1.45; }
.op-composer.is-waiting textarea { opacity: 0.6; }
.op-composer.is-recording textarea, .op-composer.is-transcribing textarea { display: none; }
.op-composer-bar { display: flex; align-items: center; gap: var(--space-sm); }
.op-status { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-mic[aria-pressed="true"] { background: oklch(58% 0.21 22); border-color: oklch(58% 0.21 22); color: #fff; }
.op-mic[aria-pressed="true"] .icon { animation: op-pulse 1.1s var(--ease-soft) infinite; }
@keyframes op-pulse { 50% { opacity: 0.35; } }

/* Live voice waveform */
.op-wave {
  display: flex; align-items: center; gap: var(--space-sm);
  min-height: 3rem; padding: 0.4rem 0.9rem; border-radius: var(--radius-input);
  background: var(--tint-coral); border: 1.5px solid oklch(80% 0.1 18);
}
.op-wave[hidden] { display: none; }
.op-wave-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: oklch(58% 0.21 22); flex: none; animation: op-pulse 1.1s ease-in-out infinite; }
.op-wave-bars { flex: 1; min-width: 0; height: 2.25rem; display: flex; align-items: center; justify-content: space-between; gap: 3px; }
.op-wave-bars i {
  flex: 1 1 0; max-width: 5px; height: 100%; border-radius: 99px;
  background: oklch(55% 0.2 22); transform: scaleY(0.08); transform-origin: center;
  transition: transform 90ms linear;
}
.op-wave-time { font-family: var(--font-mono); font-size: 0.8125rem; color: oklch(45% 0.18 22); white-space: nowrap; flex: none; }
.op-wave.is-idle .op-wave-bars i, .is-transcribing .op-wave-bars i { animation: op-beat 1s ease-in-out infinite; transition: none; }
.op-wave-bars i:nth-child(3n+1) { animation-delay: -0.2s; }
.op-wave-bars i:nth-child(3n+2) { animation-delay: -0.45s; }
.op-wave-bars i:nth-child(4n) { animation-delay: -0.7s; }
@keyframes op-beat { 0%, 100% { transform: scaleY(0.15); } 50% { transform: scaleY(0.75); } }
.is-transcribing .op-wave { background: var(--tint-cyan); border-color: oklch(82% 0.08 235); }
.is-transcribing .op-wave-bars i { background: var(--color-accent-2); }
.is-transcribing .op-wave-dot { background: var(--color-accent-2); }
.is-transcribing .op-wave-time { color: var(--color-accent-2); }

/* Client payments */
dl.pay-summary { margin: 0; display: grid; gap: var(--space-xs); grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); }
dl.pay-summary > div { background: var(--color-paper-2); border: 1px solid var(--color-rule); border-radius: 12px; padding: 0.55rem 0.8rem; display: grid; gap: 0.1rem; }
dl.pay-summary dt { font-family: var(--font-label); font-size: 0.6875rem; text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--color-muted); }
dl.pay-summary dd { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.0625rem; }
tr.row-muted td { opacity: 0.55; }
.mark-paid { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs); margin: 0; }
.mark-paid .input-sm { width: 11rem; }
td.actions .mark-paid, td.actions .inline-form { vertical-align: middle; }
td.actions > .btn, td.actions > form { margin: 0.15rem 0 0.15rem 0.35rem; }

/* Review a failed post on the dashboard */
.queue-item-review { align-items: flex-start; }
details.review { flex: 1 1 100%; border: 1px solid var(--color-rule); border-radius: 14px; background: var(--color-paper-2); }
details.review > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.45rem;
  padding: 0.55rem 0.8rem; font-weight: 600; font-size: 0.8125rem; color: var(--color-ink-2);
}
details.review > summary::-webkit-details-marker { display: none; }
details.review > summary::after { content: "▾"; margin-left: auto; font-size: 0.75rem; transition: transform var(--dur-micro); }
details.review[open] > summary::after { transform: rotate(180deg); }
details.review > summary .icon { width: 16px; height: 16px; }
.review-body { display: grid; gap: var(--space-sm); padding: 0 0.8rem 0.8rem; }
.review-text {
  margin: 0; padding: 0.7rem 0.9rem; border-left: 3px solid var(--color-rule-2); border-radius: 0 10px 10px 0;
  background: var(--color-paper); font-size: 0.875rem; white-space: pre-line; overflow-wrap: anywhere;
  max-height: 14rem; overflow-y: auto;
}
.review-actions { display: flex; flex-wrap: wrap; gap: var(--space-xs); }

/* Campaign report */
.report { display: grid; gap: var(--space-lg); min-width: 0; }
.rhero { display: grid; gap: 0.45rem; padding: var(--space-lg); border-radius: var(--radius-card); background: var(--color-ink); color: var(--color-paper); }
.rhero-eyebrow { font-family: var(--font-label); font-size: 0.75rem; text-transform: uppercase; letter-spacing: var(--tracking-label); color: oklch(80% 0 0); }
.rhero-title { font-size: clamp(1.6rem, 1.1rem + 2vw, 2.5rem); line-height: 1.1; overflow-wrap: anywhere; }
.rhero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: oklch(85% 0 0); }
.rhero-meta .badge { background: var(--color-paper); }
dl.rkpis { margin: 0; display: grid; gap: var(--space-sm); grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
.rkpi { background: var(--color-paper); border: 1px solid var(--color-rule); border-radius: 16px; padding: var(--space-md); display: grid; gap: 0.2rem; align-content: start; }
.rkpi dt { font-family: var(--font-label); font-size: 0.6875rem; text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--color-muted); }
.rkpi dd { margin: 0; }
.rkpi-value { font-family: var(--font-display); font-weight: 700; font-size: 1.75rem; letter-spacing: -0.02em; line-height: 1.15; overflow-wrap: anywhere; }
.rkpis-hero .rkpi-value { font-size: clamp(1.75rem, 1.3rem + 1.5vw, 2.4rem); }
.rkpi-hint { font-size: 0.8125rem; color: var(--color-muted); }
.rkpi-mint { background: var(--tint-mint); border-color: oklch(85% 0.08 150); }
.rkpi-dark { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-paper); }
.rkpi-dark dt, .rkpi-dark .rkpi-hint { color: oklch(80% 0 0); }
.rkpi-green .rkpi-value { color: oklch(45% 0.13 150); }
.rkpi-red .rkpi-value { color: oklch(50% 0.2 18); }
.rchips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.rchips li { padding: 0.35rem 0.8rem; border-radius: var(--radius-pill); background: var(--color-paper); border: 1px solid var(--color-rule); font-size: 0.875rem; color: var(--color-ink-2); }
.rsection { display: grid; gap: var(--space-md); }
.rsection-title { font-size: 1.125rem; }
.rprivate { padding: var(--space-md); border: 1.5px dashed var(--color-rule-2); border-radius: var(--radius-card); background: var(--color-paper-2); }
.rgrid { display: grid; gap: var(--space-lg); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1024px) { .rgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rbars { display: grid; gap: 0.5rem; }
.rbar { display: grid; grid-template-columns: minmax(6rem, 9.5rem) minmax(0, 1fr) 3.75rem; gap: var(--space-sm); align-items: center; font-size: 0.8125rem; }
.rbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.rbar-track { height: 0.7rem; border-radius: 99px; background: var(--color-paper-3); overflow: hidden; }
.rbar-track i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--color-mint-deep), var(--color-mint)); }
.rbar-value { text-align: right; font-family: var(--font-mono); font-size: 0.75rem; color: var(--color-ink-2); }
.rtop { display: grid; gap: var(--space-md); grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
.rtop-card { background: var(--color-paper); border: 1px solid var(--color-rule); border-radius: var(--radius-card); padding: var(--space-md); display: grid; gap: var(--space-sm); align-content: start; }
.rrank { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; color: var(--color-mint-deep); }
.rtop-text { font-size: 0.875rem; color: var(--color-ink-2); white-space: pre-line; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden; }
dl.rtop-stats { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-xs); }
dl.rtop-stats dt { font-size: 0.6875rem; color: var(--color-muted); text-transform: uppercase; letter-spacing: var(--tracking-label); font-family: var(--font-label); }
dl.rtop-stats dd { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.125rem; }
.rtop-insight { display: flex; gap: 0.4rem; align-items: flex-start; font-size: 0.8125rem; color: var(--color-ink-2); background: var(--tint-mint); border-radius: 10px; padding: 0.55rem 0.7rem; }
.rtop-insight .icon { width: 15px; height: 15px; margin-top: 2px; color: var(--color-mint-deep); }
dl.rfunnel { margin: 0; display: grid; gap: 0.5rem; }
dl.rfunnel > div { display: flex; justify-content: space-between; gap: var(--space-sm); padding-bottom: 0.45rem; border-bottom: 1px solid var(--color-rule); }
dl.rfunnel > div:last-child { border-bottom: 0; }
dl.rfunnel dt { color: var(--color-ink-2); }
dl.rfunnel dd { margin: 0; font-weight: 700; font-family: var(--font-display); }
.rfoot { font-size: 0.8125rem; color: var(--color-muted); max-width: 70ch; }
.report-body { min-height: 100vh; }
.report-top, .report-bottom { max-width: 80rem; margin-inline: auto; padding: var(--space-md) var(--page-gutter); display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.report-bottom { justify-content: center; font-size: 0.8125rem; color: var(--color-muted); padding-bottom: var(--space-xl); }
.report-main { max-width: 80rem; margin-inline: auto; padding: 0 var(--page-gutter) var(--space-xl); }
@media print {
  .sidebar, #share, .crumbs, .report-top { display: none !important; }
  .app-shell { display: block; }
  .rhero { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Tablets */
@media (min-width: 720px) and (max-width: 1199px) {
  th.col-person { min-width: 9.5rem; }
  th.col-status { min-width: 8rem; }
  td .person { min-width: 0; }
  .pay-cell { min-width: 0; }
  .fee-form { flex-wrap: wrap; }
  td, th { padding-inline: var(--space-sm); }
}

/* Phones */
@media (max-width: 719px) {
  .page-actions { width: 100%; }
  .page-actions .btn, .page-actions .inline-form { flex: 1 1 auto; }
  .page-actions .inline-form .btn { width: 100%; }
  .card-head, .card-body { padding-inline: var(--space-md); }
  .queue-item { padding-inline: var(--space-md); }
  td, th { padding-inline: var(--space-sm); }
  dl.facts > div { grid-template-columns: minmax(0, 1fr); gap: 0.1rem; }
  .stat-value { font-size: 1.375rem; }
  .btn { min-height: 2.75rem; }
  .btn-sm { min-height: 2.5rem; }

  /* Each table row becomes a small card, with the column name above each value. */
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table-wrap tr { padding: var(--space-sm) var(--space-md); border-bottom: 1px solid var(--color-rule); }
  .table-wrap tbody tr:last-child { border-bottom: 0; }
  .table-wrap tbody tr:hover td { background: none; }
  .table-wrap td { border: 0; padding: 0.35rem 0; text-align: left; white-space: normal; }
  .table-wrap td[data-label]:not(:first-child)::before {
    content: attr(data-label); display: block; margin-bottom: 0.15rem;
    font-family: var(--font-label); font-size: 0.6875rem; text-transform: uppercase;
    letter-spacing: var(--tracking-label); color: var(--color-muted);
  }
  .table-wrap td.actions .row, .table-wrap td .row-end { justify-content: flex-start; }
  td .person, .pay-cell { min-width: 0; }
  .row-actions { margin-left: 0; }

  /* Phone navigation: a bottom tab bar. With a single link the wordmark already goes home. */
  .side-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    width: auto; overflow: visible; justify-content: space-around; gap: 0;
    background: var(--color-paper); border-top: 1px solid var(--color-rule);
    padding: 0.25rem 0.25rem calc(0.25rem + env(safe-area-inset-bottom));
  }
  .side-nav:has(> a:only-child) { display: none; }
  .side-nav a {
    flex: 1 1 0; min-width: 0; flex-direction: column; gap: 0.15rem;
    padding: 0.4rem 0.2rem; min-height: 3.25rem; border-radius: 10px;
    font-size: 0.6875rem; font-weight: 600; white-space: nowrap;
  }
  /* The admin has more sections than fit; the bar scrolls sideways instead of squeezing them. */
  .side-nav:has(> a:nth-child(6)) { justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .side-nav:has(> a:nth-child(6)) a { flex: 0 0 4.5rem; }
  /* Operator on a phone: the chat runs edge to edge like a messaging app; buttons become round icons. */
  .app-body:has(.op-page):has(.side-nav) .app-main { padding-top: var(--space-sm); padding-bottom: 0; }
  .op-page { margin-inline: calc(-1 * var(--page-gutter)); gap: var(--space-sm); }
  .op-page > .flash { margin-inline: var(--space-sm); }
  .op-chat { border-radius: 0; border-inline: 0; box-shadow: none; }
  .op-chat-head { padding: 0.4rem var(--space-sm); }
  .op-chat-title .hint, .op-chat-actions form[action="/operator/sessions"] .btn span { display: none; }
  .op-chat-actions form[action="/operator/sessions"] .btn { width: 2.5rem; padding: 0; }
  .op-transcript { padding: var(--space-md) var(--space-sm); gap: var(--space-sm); }
  .op-msg-user { max-width: 90%; }
  .op-bubble { padding: 0.6rem 0.8rem; }
  .op-proposal { padding: var(--space-sm); }
  .op-proposal-actions { margin: 0 calc(-1 * var(--space-sm)) calc(-1 * var(--space-sm)); padding: var(--space-sm); bottom: calc(-1 * var(--space-md)); }
  .op-proposal-actions .row { flex-wrap: nowrap; }
  .op-proposal-actions .inline-form:first-child { flex: 1; }
  .op-proposal-actions .inline-form:first-child .btn { width: 100%; }
  .op-composer { padding: var(--space-xs) var(--space-sm) calc(var(--space-xs) + env(safe-area-inset-bottom)); }
  .op-composer textarea { font-size: 16px; min-height: 2.75rem; }
  .op-mic, .op-send {
    width: 2.75rem; min-width: 2.75rem; min-height: 2.75rem; padding: 0; border-radius: 50%;
    touch-action: manipulation;
  }
  .op-mic span, .op-send span { display: none; }
  .op-mic .icon, .op-send .icon { width: 20px; height: 20px; }
  .op-status { font-size: 0.75rem; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  body.op-keyboard .side-nav { display: none; }

  /* Report */
  .rhero { padding: var(--space-md); }
  .rbar { grid-template-columns: minmax(5rem, 7rem) minmax(0, 1fr) 3.25rem; }
  .rprivate { padding: var(--space-sm); }
  .mark-paid .input-sm { width: 100%; }

  .side-nav a span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .side-nav a .icon { width: 20px; height: 20px; }
  .app-body:has(.side-nav > a + a) .app-main { padding-bottom: calc(5rem + env(safe-area-inset-bottom)); }
}

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