/*
 * The operator console. Layered on /static/css/theme.css -- the product's own
 * tokens, type and components -- and never redefining one of them.
 *
 * The chart palette below is the one thing new here, and none of it is picked
 * by eye. BRAND.md §8 says charts are navy and cyan; those two hues were then
 * stepped along their own hue lines until they passed the data-viz checks on
 * this page's actual surfaces (#ffffff light, #16202e dark): lightness band,
 * chroma floor, colour-blind separation (deutan/protan ΔE ≥ 15), a
 * normal-vision floor, and 3:1 against the card. The ordinal ramp passes the
 * ordinal checks (one hue, monotone, ≥ 0.06 per step, light end ≥ 2:1). Dark
 * mode is its own set of steps, validated against the dark card -- not a flip.
 * Change a value here only by re-running that validation.
 */

:root {
  --viz-1: #1c5293;
  --viz-2: #299dac;
  --viz-o1: #7cb4fc;
  --viz-o2: #639be1;
  --viz-o3: #4c82c6;
  --viz-o4: #346aac;
  --viz-o5: #1c5293;
  --viz-o6: #003b7a;
  /* Sequential, navy <- cyan: zero recedes into the surface, the busiest cell is
     the darkest navy. Multi-hue on purpose (the brand ramp) and therefore
     always shown with its scale legend. */
  --viz-q0: #f1eee8;
  --viz-q1: #a9e3ec;
  --viz-q2: #6cc7d7;
  --viz-q3: #37a1b8;
  --viz-q4: #0a7ca6;
  --viz-q5: #0e5794;
  --viz-q6: #123b75;
  --viz-muted: #b3ada2;
  --viz-grid: #ece8e1;
  --viz-axis: #cdc6b9;
  --viz-hot: rgba(20, 80, 140, 0.07);
  --viz-track: #e9f0f8;
  /* Ink on the cohort grid's strong steps (q4-q6): white on the dark navies. */
  --viz-cohort-strong-ink: #ffffff;
}

:root[data-theme='dark'] {
  --viz-1: #2d6fbe;
  --viz-2: #16a4b5;
  --viz-o1: #1f5596;
  --viz-o2: #346aac;
  --viz-o3: #497fc3;
  --viz-o4: #5d94da;
  --viz-o5: #72aaf2;
  --viz-o6: #88c1ff;
  --viz-q0: #1d2837;
  --viz-q1: #1c3b63;
  --viz-q2: #1a588f;
  --viz-q3: #007bad;
  --viz-q4: #21a3bc;
  --viz-q5: #5bc6d5;
  --viz-q6: #9de2ea;
  --viz-muted: #4b5668;
  --viz-grid: #232f3f;
  --viz-axis: #3a4656;
  --viz-hot: rgba(141, 194, 242, 0.09);
  --viz-track: #12263e;
  /* Dark mode's strong steps are the light cyans: dark ink on them. */
  --viz-cohort-strong-ink: #0b1626;
}

/* -- the shell --------------------------------------------------------------------- */

body {
  min-height: 100%;
}

.boot {
  display: grid;
  place-items: center;
  min-height: 100vh;
  color: var(--text-faint);
  font-size: var(--t-sm);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: var(--s-4);
  min-height: 56px;
  padding: 0 var(--s-5);
  background: color-mix(in srgb, var(--bg-raised) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar .brand {
  gap: 10px;
  flex: 0 0 auto;
}

.brand__logo--sm {
  width: 24px;
  height: 24px;
}

.console-pill {
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: var(--t-xs);
  font-weight: 640;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav a {
  padding: 7px var(--s-3);
  border-radius: var(--r-md);
  color: var(--text-dim);
  font-size: var(--t-md);
  font-weight: 540;
  text-decoration: none;
  white-space: nowrap;
}

.nav a:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav a[aria-current='page'] {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-left: auto;
}

.operator {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding-left: var(--s-2);
  color: var(--text-faint);
  font-size: var(--t-sm);
}

.icon-btn {
  width: 36px;
  padding: 0;
}

.main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: var(--s-6) var(--s-5) var(--s-16);
  outline: none;
  transition: opacity 0.18s ease;
}

/* Refetch keeps the frame: the last render stays, dimmed, until the new one
   replaces it -- no skeleton, no jump. */
.main.is-loading {
  opacity: 0.55;
  pointer-events: none;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}

.page-head h1 {
  font-size: var(--t-2xl);
}

.page-head .hint {
  margin-top: 4px;
}

/* One filter row, above everything it scopes. */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
}

.filters .input,
.filters .select {
  width: auto;
  min-width: 150px;
}

.filters .input[type='search'] {
  min-width: 240px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: var(--r-md);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
}

.segmented button {
  padding: 5px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: var(--t-sm);
  font-weight: 560;
  cursor: pointer;
}

.segmented button[aria-pressed='true'] {
  background: var(--bg-raised);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.stamp {
  color: var(--text-faint);
  font-size: var(--t-sm);
  white-space: nowrap;
}

.notes {
  display: grid;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}

.note {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: var(--warn-soft);
  color: var(--warn-text);
  font-size: var(--t-sm);
}

.section-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-2) var(--s-3);
  margin: var(--s-8) 0 var(--s-3);
  font-size: var(--t-lg);
}

.section-title .hint {
  font-weight: 400;
}

.section-title .linkbtn {
  margin-left: auto;
  font-size: var(--t-sm);
  font-weight: 540;
}

/* -- figures: tiles --------------------------------------------------------------------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--s-3);
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--s-4) var(--s-5);
  min-width: 0;
}

.tile__label {
  color: var(--text-dim);
  font-size: var(--t-sm);
  font-weight: 540;
}

.tile__value {
  color: var(--text);
  font-size: var(--t-2xl);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.tile__sub {
  color: var(--text-faint);
  font-size: var(--t-sm);
}

.tile__foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-2);
  min-height: 28px;
}

/* The overview's figures: the hero in a 2x2 cell with six tiles beside it, so
   the block is two full rows at desktop width and never a ragged third. */
.kpis--overview {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

/* The one hero figure per view: the same sans, just larger. */
.tile--hero {
  grid-column: span 2;
  grid-row: span 2;
  justify-content: space-between;
}

.tile--hero .tile__value {
  font-size: 56px;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.tile--hero .tile__foot {
  align-items: flex-end;
}

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

  .kpis--overview .tile--hero {
    grid-column: 1 / -1;
    grid-row: auto;
  }
}

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

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

.delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--t-sm);
  font-weight: 560;
}

.delta--up-good,
.delta--down-good {
  color: var(--good-text);
}

.delta--up-bad,
.delta--down-bad {
  color: var(--bad-text);
}

.delta--flat {
  color: var(--text-faint);
}

.viz-spark__line {
  fill: none;
  stroke: var(--viz-muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.viz-spark__dot {
  fill: var(--viz-1);
  stroke: var(--bg-raised);
  stroke-width: 2;
}

/* -- figures: charts --------------------------------------------------------------------- */

.charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-4);
}

.charts .viz--wide {
  grid-column: 1 / -1;
}

.viz {
  margin: 0;
  padding: var(--s-4) var(--s-5) var(--s-5);
  min-width: 0;
}

.viz-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}

.viz-title {
  font-size: var(--t-md);
  font-weight: 620;
  color: var(--text);
}

.viz-caption {
  margin-top: 2px;
  color: var(--text-faint);
  font-size: var(--t-sm);
}

.viz-toggle {
  flex: 0 0 auto;
  font-size: var(--t-sm);
}

.viz-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  margin: -4px 0 var(--s-3);
  color: var(--text-dim);
  font-size: var(--t-sm);
}

.viz-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.viz-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.viz-plot {
  position: relative;
  min-height: 60px;
  border-radius: var(--r-sm);
}

.viz-plot:focus-visible,
.viz-heat:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.viz-svg {
  display: block;
  overflow: visible;
}

.viz-grid {
  stroke: var(--viz-grid);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.viz-axis {
  stroke: var(--viz-axis);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.viz-tick {
  fill: var(--text-faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.viz-hit {
  fill: transparent;
  cursor: default;
}

.viz-hot {
  fill: var(--viz-hot);
}

.viz-s1,
.viz-k1.viz-swatch,
.viz-bs1 {
  fill: var(--viz-1);
  background: var(--viz-1);
}

.viz-s2,
.viz-k2.viz-swatch,
.viz-bs2 {
  fill: var(--viz-2);
  background: var(--viz-2);
}

.viz-empty {
  padding: var(--s-8) 0;
  color: var(--text-faint);
  font-size: var(--t-sm);
  text-align: center;
}

.viz-table {
  max-height: 320px;
  overflow: auto;
}

.viz-datatable td,
.viz-datatable th {
  padding: 6px var(--s-3);
  font-variant-numeric: tabular-nums;
}

/* Bar lists: HTML, because the labels are long and customer-typed. */
.viz-bars {
  display: grid;
  gap: 2px;
}

.viz-bars__row {
  display: grid;
  grid-template-columns: minmax(96px, 34%) 1fr;
  align-items: center;
  gap: var(--s-3);
  padding: 5px 4px;
  border-radius: var(--r-sm);
  outline: none;
}

.viz-bars__row:hover,
.viz-bars__row:focus-visible {
  background: var(--viz-hot);
}

.viz-bars__label {
  overflow: hidden;
  color: var(--text-dim);
  font-size: var(--t-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viz-bars__cell {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-width: 0;
}

.viz-bars__track {
  display: flex;
  flex: 1 1 auto;
  gap: 2px;
  min-width: 0;
  height: 14px;
}

.viz-bars__seg {
  height: 100%;
  min-width: 2px;
}

.viz-bars__seg.is-end {
  border-radius: 0 4px 4px 0;
}

.viz-bars__value {
  flex: 0 0 auto;
  color: var(--text);
  font-size: var(--t-sm);
  font-variant-numeric: tabular-nums;
}

.viz-bo1 { background: var(--viz-o1); }
.viz-bo2 { background: var(--viz-o2); }
.viz-bo3 { background: var(--viz-o3); }
.viz-bo4 { background: var(--viz-o4); }
.viz-bo5 { background: var(--viz-o5); }
.viz-bo6 { background: var(--viz-o6); }
.viz-bo0 { background: var(--viz-muted); }

/* Heatmap. */
.viz-heat {
  display: grid;
  grid-template-columns: 34px repeat(24, minmax(0, 1fr));
  gap: 2px;
  align-items: center;
  outline: none;
  border-radius: var(--r-sm);
}

.viz-heat__col,
.viz-heat__row {
  color: var(--text-faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.viz-heat__col {
  text-align: left;
}

.viz-heat__cell {
  aspect-ratio: 1 / 1;
  min-height: 10px;
  border-radius: 3px;
}

.viz-q0 { background: var(--viz-q0); }
.viz-q1 { background: var(--viz-q1); }
.viz-q2 { background: var(--viz-q2); }
.viz-q3 { background: var(--viz-q3); }
.viz-q4 { background: var(--viz-q4); }
.viz-q5 { background: var(--viz-q5); }
.viz-q6 { background: var(--viz-q6); }

.viz-heat__cell:hover {
  outline: 2px solid var(--text);
  outline-offset: -1px;
}

.viz-scale {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: var(--s-3);
  color: var(--text-faint);
  font-size: 11px;
}

.viz-scale__step {
  width: 18px;
  height: 10px;
  border-radius: 2px;
}

/* The tooltip: the value leads, the label follows, a line key and not a box. */
.viz-tip {
  position: fixed;
  z-index: 400;
  min-width: 120px;
  max-width: 280px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  box-shadow: var(--shadow-md);
  color: var(--text);
  font-size: var(--t-sm);
  pointer-events: none;
}

.viz-tip__title {
  margin-bottom: 4px;
  color: var(--text-faint);
  font-size: var(--t-xs);
}

.viz-tip__row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}

.viz-tip__row span {
  color: var(--text-dim);
}

.viz-tip__key {
  width: 12px;
  height: 2px;
  border-radius: 1px;
}

.viz-k1.viz-tip__key { background: var(--viz-1); }
.viz-k2.viz-tip__key { background: var(--viz-2); }

/* Meters: severity in the fill, a lighter step of the same ramp as the track. */
.viz-meter {
  height: 8px;
  border-radius: var(--r-full);
  background: var(--viz-track);
  overflow: hidden;
}

.viz-meter__fill {
  display: block;
  height: 100%;
  border-radius: var(--r-full);
  background: var(--accent);
}

.viz-meter__fill.is-near { background: var(--warn); }
.viz-meter__fill.is-over { background: var(--bad); }

/* -- insights --------------------------------------------------------------------- */

.insights {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--s-3);
}

.insight {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-4) var(--s-5);
  border-left: 3px solid var(--border-strong);
}

.insight--risk { border-left-color: var(--bad); }
.insight--warn { border-left-color: var(--warn); }
.insight--good { border-left-color: var(--good); }
.insight--info { border-left-color: var(--accent); }

.insight__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.insight__tone {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--t-xs);
  font-weight: 640;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* The white strokes inside the tone icons: set here, because var() in an SVG
   presentation attribute is not something every browser resolves. */
.insight__tone .knock {
  fill: none;
  stroke: var(--bg-raised);
}

.insight--risk .insight__tone { color: var(--bad-text); }
.insight--warn .insight__tone { color: var(--warn-text); }
.insight--good .insight__tone { color: var(--good-text); }
.insight--info .insight__tone { color: var(--accent-text); }

.insight__metric {
  color: var(--text);
  font-size: var(--t-lg);
  font-weight: 650;
}

.insight__title {
  font-size: var(--t-md);
  font-weight: 620;
}

.insight__detail {
  color: var(--text-dim);
  font-size: var(--t-sm);
}

.insight__accounts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.acct-chip {
  padding: 2px 9px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--bg-sunken);
  color: var(--accent-text);
  font-size: var(--t-sm);
  text-decoration: none;
}

.acct-chip:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

/* -- tables ------------------------------------------------------------------------ */

.table-card {
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
  /* Positioned, so anything absolutely placed inside a row -- a screen-reader
     label, above all -- is clipped with the table instead of widening the page. */
  position: relative;
}

.table td,
.table th {
  vertical-align: middle;
}

.table .table__num,
.table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table--rows tbody tr {
  cursor: pointer;
}

.table--rows tbody tr:hover {
  background: var(--bg-hover);
}

.table--rows tbody tr:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.table th button.sort {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.table th button.sort[aria-sort='ascending']::after { content: ' ↑'; }
.table th button.sort[aria-sort='descending']::after { content: ' ↓'; }

.cell-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cell-main strong {
  font-weight: 600;
}

.cell-sub {
  color: var(--text-faint);
  font-size: var(--t-sm);
}

.cell-meter {
  display: grid;
  gap: 4px;
  min-width: 110px;
}

.count-line {
  margin: 0 0 var(--s-3);
  color: var(--text-faint);
  font-size: var(--t-sm);
}

/* -- one account ------------------------------------------------------------------- */

.back {
  display: inline-flex;
  margin-bottom: var(--s-3);
  color: var(--accent-text);
  font-size: var(--t-sm);
  text-decoration: none;
}

.acct-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}

.acct-head h1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
}

.acct-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
  margin-top: var(--s-2);
  color: var(--text-dim);
  font-size: var(--t-sm);
}

.suspended-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
  padding: var(--s-4) var(--s-5);
  border-radius: var(--r-lg);
  border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent);
  background: var(--bad-soft);
  color: var(--bad-text);
}

.acct-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: var(--s-5);
  align-items: start;
}

.acct-side {
  display: grid;
  gap: var(--s-4);
  position: sticky;
  top: 72px;
}

.panel {
  padding: var(--s-4) var(--s-5);
}

.panel h2 {
  margin-bottom: var(--s-3);
  font-size: var(--t-md);
}

.lever {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-top: 1px solid var(--border);
}

.lever:first-of-type {
  border-top: 0;
}

.lever__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: var(--t-sm);
}

.lever__text strong {
  font-weight: 600;
}

.lever__text span {
  color: var(--text-faint);
}

.allowance {
  display: grid;
  gap: 6px;
  padding: var(--s-3) 0;
  border-top: 1px solid var(--border);
}

.allowance:first-of-type {
  border-top: 0;
}

.allowance__line {
  display: flex;
  justify-content: space-between;
  gap: var(--s-2);
  font-size: var(--t-sm);
}

.allowance__line span:last-child {
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.feature {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s-2) var(--s-3);
  align-items: center;
  padding: var(--s-3) 0;
  border-top: 1px solid var(--border);
}

.feature:first-of-type {
  border-top: 0;
}

.feature__name {
  font-size: var(--t-sm);
  font-weight: 600;
}

.feature__state {
  grid-column: 1 / -1;
  color: var(--text-faint);
  font-size: var(--t-sm);
}

.activity {
  display: grid;
  gap: 0;
}

.activity__row {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-top: 1px solid var(--border);
  font-size: var(--t-sm);
}

.activity__row:first-child {
  border-top: 0;
}

.activity__when {
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.activity__what strong {
  font-weight: 600;
}

.activity__what span {
  display: block;
  color: var(--text-dim);
}

.badge--good {
  background: var(--good-soft);
  color: var(--good-text);
  border-color: color-mix(in srgb, var(--good) 32%, transparent);
}

.badge--warn {
  background: var(--warn-soft);
  color: var(--warn-text);
  border-color: color-mix(in srgb, var(--warn) 32%, transparent);
}

.badge--info {
  background: var(--info-soft);
  color: var(--info-text);
  border-color: color-mix(in srgb, var(--info) 32%, transparent);
}

/* -- sign-in ------------------------------------------------------------------------ */

.signin {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: var(--s-4);
}

.signin__card {
  display: grid;
  gap: var(--s-4);
  width: min(400px, 100%);
  padding: var(--s-8) var(--s-6);
}

.signin__card .brand {
  margin-bottom: var(--s-2);
}

.signin__error {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: var(--bad-soft);
  color: var(--bad-text);
  font-size: var(--t-sm);
}

.signin__or {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  color: var(--text-faint);
  font-size: var(--t-sm);
}

.signin__or::before,
.signin__or::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border);
}

/* -- dialogs -------------------------------------------------------------------------- */

/* The product's panel is a clipped flex column whose body scrolls. A console
   dialog wraps head, body and foot in a <form> so Enter submits it -- which
   puts one element between the panel and its regions, so the form has to be
   the column instead, or a tall form is cut off with its buttons below the
   fold and no way to reach them. */
.modal__panel > form {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.modal__panel > form > .modal__body {
  flex: 1 1 auto;
  min-height: 0;
}

.modal__panel > form > .modal__head,
.modal__panel > form > .modal__foot {
  flex: 0 0 auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-4);
}

.form-grid .field--wide {
  grid-column: 1 / -1;
}

.checks {
  display: grid;
  gap: var(--s-2);
}

.checkline {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  font-size: var(--t-sm);
}

.checkline input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.result-link {
  display: flex;
  gap: var(--s-2);
}

.result-link .input {
  font-family: var(--mono);
  font-size: var(--t-sm);
}

.modal__body .stack {
  display: grid;
  gap: var(--s-4);
}

.warning-line {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: var(--warn-soft);
  color: var(--warn-text);
  font-size: var(--t-sm);
}

/* -- money -------------------------------------------------------------------------------- */

.row--end {
  justify-content: flex-end;
}

.money-switch {
  justify-content: space-between;
  margin-bottom: var(--s-3);
}

.money-note {
  margin-top: var(--s-2);
}

/* A sentence, not a timestamp: it may wrap on a phone. */
.money-unattributed {
  white-space: normal;
}

.money-prices {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-4);
}

.money-more > summary {
  padding: var(--s-3) var(--s-5);
  color: var(--text-dim);
  font-size: var(--t-sm);
  cursor: pointer;
}

.money-more[open] > summary {
  border-bottom: 1px solid var(--border);
}

.money-more > .table-card {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.money-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-4);
  margin-bottom: var(--s-3);
}

.money-compare > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Usage nobody has priced is money out that the page cannot see: a warning
   boundary, in the amber that is dark enough to be one. */
.money-unpriced {
  border-color: color-mix(in srgb, var(--warn) 45%, var(--border));
}

.money-unpriced__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-3) 0 0;
  margin-top: var(--s-3);
  border-top: 1px solid var(--border);
}

/* -- shared bits for the newer pages ------------------------------------------------------- */

.nowrap {
  white-space: nowrap;
}

.row--between {
  justify-content: space-between;
  align-items: center;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}

.panel-head h2 {
  margin-bottom: 0;
}

/* A date that has come due: the text says so too ("Overdue", "today"). */
.is-due {
  color: var(--warn-text);
  font-weight: 600;
}

/* A bar-list row that opens a filtered list. */
.viz-bars__row.is-link {
  cursor: pointer;
}

.viz-bars__row.is-link:hover .viz-bars__label {
  color: var(--accent-text);
  text-decoration: underline;
}

/* -- search ---------------------------------------------------------------------------------- */

.search {
  position: relative;
}

.search__input {
  width: 220px;
  height: 34px;
  font-size: var(--t-sm);
}

.search__results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  width: min(420px, calc(100vw - 32px));
  max-height: min(70vh, 520px);
  overflow-y: auto;
  padding: var(--s-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-raised);
  box-shadow: var(--shadow-lg);
}

.search__group {
  padding: var(--s-2) var(--s-2) 4px;
  color: var(--text-faint);
  font-size: var(--t-xs);
  font-weight: 640;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.search__option {
  display: flex;
  flex-direction: column;
  padding: 6px var(--s-2);
  border-radius: var(--r-md);
  cursor: pointer;
}

.search__option:hover,
.search__option[aria-selected='true'] {
  background: var(--accent-soft);
}

.search__main {
  font-size: var(--t-sm);
  font-weight: 560;
}

.search__sub {
  color: var(--text-faint);
  font-size: var(--t-xs);
}

.search__empty {
  padding: var(--s-3);
  color: var(--text-faint);
  font-size: var(--t-sm);
}

/* -- to do ------------------------------------------------------------------------------------ */

.todo {
  padding: var(--s-3) var(--s-5) var(--s-4);
}

.todo__counts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-4);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-size: var(--t-sm);
}

.todo__count strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.todo__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.todo__item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-top: 1px solid var(--border);
}

.todo__item:first-child {
  border-top: 0;
}

.todo__tone {
  display: inline-flex;
  margin-top: 2px;
}

.todo__tone .knock {
  fill: none;
  stroke: var(--bg-raised);
}

.todo__tone--risk { color: var(--bad-text); }
.todo__tone--warn { color: var(--warn-text); }
.todo__tone--info { color: var(--accent-text); }

.todo__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  font-size: var(--t-sm);
}

.todo__line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px var(--s-2);
}

.todo__line a {
  color: var(--text);
  font-weight: 600;
}

.todo__title {
  color: var(--text-dim);
}

.todo__who {
  padding: 0 6px;
  border-radius: var(--r-full);
  background: var(--bg-sunken);
  color: var(--text-faint);
  font-size: var(--t-xs);
}

.todo__detail {
  color: var(--text-faint);
}

.todo__more {
  margin-top: var(--s-2);
  font-size: var(--t-sm);
}

/* -- health, tags and the account's record ----------------------------------------------------- */

.health {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.health__score {
  color: var(--text-dim);
  font-size: var(--t-sm);
  font-variant-numeric: tabular-nums;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.tag {
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--bg-sunken);
  color: var(--text-dim);
  font-size: var(--t-xs);
  text-decoration: none;
  white-space: nowrap;
}

a.tag:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.factor {
  display: grid;
  gap: 4px;
  padding: var(--s-3) 0;
  border-top: 1px solid var(--border);
}

.factor:first-of-type {
  border-top: 0;
}

.factor__line {
  display: flex;
  justify-content: space-between;
  gap: var(--s-2);
  font-size: var(--t-sm);
}

.factor__pts {
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.factor__bar {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: var(--r-full);
  background: var(--viz-track);
}

.factor__fill {
  display: block;
  height: 100%;
  border-radius: var(--r-full);
  background: var(--viz-1);
}

.factor__note {
  color: var(--text-faint);
  font-size: var(--t-xs);
}

.record {
  display: grid;
  gap: var(--s-3);
  font-size: var(--t-sm);
}

.record__row {
  display: grid;
  gap: 2px;
}

.record__row > span:not(.record__key):not(.tags) {
  display: flex;
  flex-direction: column;
}

.record__key {
  color: var(--text-faint);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.record__sub {
  color: var(--text-dim);
  font-weight: 400;
}

.record__none {
  color: var(--text-faint);
}

.record .tags {
  margin-top: 0;
}

.notes-form {
  display: grid;
  gap: var(--s-2);
}

.notes-input {
  min-height: 72px;
  resize: vertical;
  font: inherit;
  font-size: var(--t-sm);
}

.note-list {
  display: grid;
  margin: var(--s-4) 0 0;
  padding: 0;
  list-style: none;
}

.note-item {
  padding: var(--s-3) 0;
  border-top: 1px solid var(--border);
}

.note-item__head {
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  color: var(--text-faint);
  font-size: var(--t-xs);
}

.note-item__text {
  margin: 4px 0 0;
  font-size: var(--t-sm);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* -- live ------------------------------------------------------------------------------------ */

.checks-list {
  display: grid;
}

.check {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: var(--s-2) var(--s-3);
  align-items: start;
  padding: var(--s-2) 0;
  border-top: 1px solid var(--border);
  font-size: var(--t-sm);
}

.check:first-child {
  border-top: 0;
}

.check__icon {
  display: inline-flex;
  margin-top: 2px;
}

.check__icon .knock {
  fill: none;
  stroke: var(--bg-raised);
}

.check__icon--ok { color: var(--good-text); }
.check__icon--bad { color: var(--bad-text); }

.check__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.check__sub {
  color: var(--text-faint);
  font-size: var(--t-xs);
  overflow-wrap: anywhere;
}

.check__state {
  color: var(--text-faint);
  font-size: var(--t-xs);
  white-space: nowrap;
}

.live-side {
  position: static;
}

.live-side .section-title {
  margin-top: 0;
}

.live-notices,
.live-console-notes {
  margin-top: var(--s-3);
  color: var(--text-dim);
  font-size: var(--t-xs);
}

.live-notices summary {
  cursor: pointer;
}

.live-notices ul,
.live-console-notes {
  padding-left: var(--s-4);
}

.feed {
  margin: 0;
  padding: 0;
  list-style: none;
}

.feed__item {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: var(--s-3);
  padding: var(--s-2) 0;
  border-top: 1px solid var(--border);
  font-size: var(--t-sm);
}

.feed__item:first-child {
  border-top: 0;
}

.feed__when {
  color: var(--text-faint);
  white-space: nowrap;
}

.feed__what a {
  color: var(--text);
  font-weight: 600;
}

.feed__sub {
  display: block;
  color: var(--text-faint);
  font-size: var(--t-xs);
}

/* -- growth ---------------------------------------------------------------------------------- */

.goal {
  display: grid;
  gap: var(--s-2);
  align-content: start;
}

.goal .panel-head {
  margin-bottom: var(--s-1);
}

.goal__line {
  margin: 0;
  font-size: var(--t-sm);
}

.forecast {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-3);
}

.forecast__pt {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.forecast__value {
  font-size: var(--t-xl);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* The cohort triangle: a table first, shaded second. Ink flips on the darker
   steps (light theme) and the lighter ones (dark theme), so a number never
   sits on a fill it cannot be read against. */
.viz-cohort-wrap {
  overflow-x: auto;
  outline: none;
}

.viz-cohort {
  width: 100%;
  border-collapse: separate;
  border-spacing: 2px;
  font-size: var(--t-xs);
  font-variant-numeric: tabular-nums;
}

.viz-cohort th {
  padding: 4px 6px;
  color: var(--text-faint);
  font-weight: 560;
  text-align: right;
  white-space: nowrap;
}

.viz-cohort th[scope='row'],
.viz-cohort thead th:first-child {
  text-align: left;
}

.viz-cohort__n {
  padding: 4px 8px;
  color: var(--text-dim);
  text-align: right;
}

.viz-cohort__cell {
  min-width: 40px;
  padding: 6px 4px;
  border-radius: 4px;
  color: var(--text);
  font-weight: 560;
  text-align: center;
}

.viz-cohort__cell.is-strong {
  color: var(--viz-cohort-strong-ink);
}

.viz-cohort__cell.is-partial {
  outline: 1px dashed var(--border-strong);
  outline-offset: -2px;
}

.viz-cohort__cell.is-blank {
  background: transparent;
}

/* -- money: runway --------------------------------------------------------------------------- */

.runway {
  display: grid;
  gap: var(--s-2);
  align-content: start;
}

.runway__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 var(--s-3);
  padding: var(--s-2) 0;
  border-top: 1px solid var(--border);
  font-size: var(--t-sm);
}

.runway__row:first-of-type {
  border-top: 0;
}

.runway__value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.runway__sub {
  grid-column: 1 / -1;
  color: var(--text-faint);
  font-size: var(--t-xs);
}

.runway__verdict {
  margin: var(--s-2) 0 0;
  font-weight: 560;
}

/* -- small screens ---------------------------------------------------------------------- */

@media (max-width: 1440px) {
  .operator span {
    display: none;
  }
}

@media (max-width: 1180px) {
  .search__input {
    width: 160px;
  }
}

@media (max-width: 1080px) {
  .acct-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .acct-side {
    position: static;
  }
}

@media (max-width: 860px) {
  .charts {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar {
    flex-wrap: wrap;
    gap: var(--s-2) var(--s-3);
    padding: var(--s-2) var(--s-4);
  }

  .nav {
    order: 3;
    width: 100%;
  }

  .topbar__actions {
    flex-wrap: wrap;
  }

  .search {
    order: 4;
    flex: 1 1 100%;
  }

  .search__input {
    width: 100%;
  }

  .search__results {
    left: 0;
    right: auto;
    width: 100%;
  }

  .forecast {
    grid-template-columns: minmax(0, 1fr);
  }

  .feed__item {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .operator span {
    display: none;
  }

  .main {
    padding: var(--s-5) var(--s-4) var(--s-12);
  }

  .tile--hero .tile__value {
    font-size: 44px;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .activity__row {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .filters .input[type='search'] {
    min-width: 0;
    width: 100%;
  }

  .money-compare {
    grid-template-columns: minmax(0, 1fr);
  }

  .money-unpriced__row {
    flex-direction: column;
    align-items: flex-start;
  }
}
