/* The shell and the fourteen components. Every value here is a token from tokens.css.
 *
 * A literal colour in this file is a bug — it is a colour the dark theme cannot reach.
 * Screens compose these classes and never restyle them: a `.card` that a screen has
 * given its own padding is a card that no longer matches the card beside it.
 *
 * Density is `10`'s: 40px rows, sticky header, row borders, no zebra; cards 16px
 * padding, 1px border, 8px radius, NO SHADOW. It is an instrument, not a dashboard.
 */

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

html {
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
}

/* Every number in this product is read in a column against another number. */
.num,
table,
.stat__value,
.readout__value {
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
}

h1 {
  font-size: var(--t-h1);
}

h2 {
  font-size: var(--t-lead);
}

h3 {
  font-size: var(--t-body);
}

p {
  margin: 0 0 var(--s3);
}

p:last-child {
  margin-bottom: 0;
}

.muted {
  color: var(--text-muted);
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: var(--s2);
  padding: var(--s2) var(--s3);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r);
  z-index: 50;
}

.skip-link:focus {
  left: var(--s3);
}

/* --------------------------------------------------------------------------
 * Shell — 56px top bar, two tabs, no sidebar
 * ------------------------------------------------------------------------ */

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

.topbar__inner {
  height: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  gap: var(--s5);
}

.topbar__brand {
  font-weight: var(--fw-semibold);
  color: var(--text);
  letter-spacing: -0.01em;
}

.topbar__brand:hover {
  text-decoration: none;
}

.tabs {
  display: flex;
  align-items: center;
  gap: var(--s4);
  height: 100%;
}

.tab {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 var(--s1);
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  font-weight: var(--fw-medium);
}

.tab:hover {
  color: var(--text);
  text-decoration: none;
}

.tab--active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.topbar__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--s3);
  position: relative;
}

.topbar__org {
  color: var(--text-muted);
  font-size: var(--t-cell);
}

.menu {
  position: relative;
}

.menu__button {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: var(--s1) var(--s3);
  color: var(--text);
  font: inherit;
  font-size: var(--t-cell);
  cursor: pointer;
}

.menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + var(--s2));
  min-width: 180px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: var(--s1);
  z-index: 30;
}

.menu__item {
  display: block;
  padding: var(--s2) var(--s3);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: var(--t-cell);
}

.menu__item:hover {
  background: var(--bg-hover);
  text-decoration: none;
}

/* Sign out is a POST, so it is a button inside a form and not a link. It is dressed
   as the items above it because it belongs to the same list: a menu whose last row is
   drawn like a button is a menu with a stray control in it. */
.menu__form {
  margin: 0;
}

.menu__item--button {
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  font: inherit;
  font-size: var(--t-cell);
  cursor: pointer;
}

/* --------------------------------------------------------------------------
 * Sign in
 *
 * The one screen drawn without the nav, because every link in it would bounce
 * straight back here. Centred in the viewport rather than in the content column:
 * a 380px card at the top of a 1200px page reads as a page that failed to load
 * the rest of itself.
 * ------------------------------------------------------------------------ */

.signin {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.signin__card {
  width: 100%;
  max-width: 380px;
  padding: var(--s6);
}

.signin__title {
  font-size: var(--t-h1);
  font-weight: var(--fw-semibold);
  margin: 0;
}

.signin__sub {
  margin: var(--s2) 0 var(--s5);
  font-size: var(--t-cell);
  color: var(--text-muted);
}

/* Amber, not red. A mistyped password is "needs your attention" and not a verdict —
   green and red are reserved for statistical results. */
.signin__error {
  margin: 0 0 var(--s4);
  padding: var(--s3);
  border: 1px solid var(--attention-border);
  background: var(--attention-bg);
  border-radius: var(--r-sm);
  font-size: var(--t-cell);
  color: var(--text);
}

.signin__form {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

.signin__label {
  font-size: var(--t-xs);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
}

.signin__label + .signin__input {
  margin-bottom: var(--s3);
}

.signin__input {
  height: 34px;
  padding: 0 var(--s3);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--t-body);
}

/* Laid over the border rather than outside it. At a positive offset the 1px border and
   the 2px outline read as two concentric rings around an autofocused field, which looks
   like a validation state on a form nobody has typed into yet. */
.signin__input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.signin__submit {
  margin-top: var(--s3);
  height: 36px;
}

.signin__foot {
  margin: var(--s5) 0 0;
  font-size: var(--t-xs);
  color: var(--text-muted);
}

.shell {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: var(--s5) var(--gutter) var(--s8);
}

.breadcrumb {
  font-size: var(--t-cell);
  color: var(--text-muted);
  margin-bottom: var(--s2);
}

.breadcrumb a {
  color: var(--text-muted);
}

.titlerow {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s5);
}

.titlerow__actions {
  margin-left: auto;
  display: flex;
  gap: var(--s2);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--s5);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
 * Cards and buttons
 * ------------------------------------------------------------------------ */

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: var(--card-pad);
}

.card__title {
  font-size: var(--t-body);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--s3);
}

.card__note {
  margin-top: var(--s3);
  font-size: var(--t-xs);
  color: var(--text-muted);
}

/* A card title with one chip pushed to the right of it — the review's roll-up sits
   here, where a status pill sits on every other header in the product. */
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  margin-bottom: var(--s3);
}

.card__head .card__title {
  margin-bottom: 0;
}

/* For lists of identifiers — the unmapped zips — where the eye is scanning for a shape
   rather than reading words, and a proportional font makes 02101 and 92101 look alike. */
.mono {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: var(--t-xs);
  word-break: break-word;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  height: 32px;
  padding: 0 var(--s3);
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-raised);
  color: var(--text);
  font: inherit;
  font-size: var(--t-cell);
  font-weight: var(--fw-medium);
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-hover);
  text-decoration: none;
}

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

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

.btn--quiet {
  border-color: transparent;
  background: none;
  color: var(--text-muted);
}

.btn--quiet:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --------------------------------------------------------------------------
 * status_pill
 * ------------------------------------------------------------------------ */

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  height: 20px;
  padding: 0 var(--s2);
  border-radius: var(--r-pill);
  border: 1px solid var(--neutral-border);
  background: var(--neutral-bg);
  color: var(--neutral);
  font-size: var(--t-pill);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.pill--cool {
  background: var(--cool-bg);
  border-color: var(--cool-border);
  color: var(--cool);
}

.pill--blue {
  background: var(--blue-bg);
  border-color: var(--blue-border);
  color: var(--blue);
}

.pill--accent {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--accent);
}

.pill--attention {
  background: var(--attention-bg);
  border-color: var(--attention-border);
  color: var(--attention);
}

.pill--positive {
  background: var(--positive-bg);
  border-color: var(--positive-border);
  color: var(--positive);
}

.pill--negative {
  background: var(--negative-bg);
  border-color: var(--negative-border);
  color: var(--negative);
}

.pill--muted {
  background: var(--muted-bg);
  border-color: var(--muted-border);
  color: var(--muted);
}

.pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--attention-dot);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.25;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pill__dot {
    animation: none;
  }
}

/* --------------------------------------------------------------------------
 * stat_readout
 * ------------------------------------------------------------------------ */

.readout__label {
  font-size: var(--t-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--s1);
}

.readout__value {
  font-size: var(--t-stat);
  font-weight: var(--fw-semibold);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.readout--hero .readout__value {
  font-size: var(--t-hero);
}

.readout--positive .readout__value {
  color: var(--positive);
}

.readout--negative .readout__value {
  color: var(--negative);
}

/* Inconclusive is grey, and grey is a real answer. */
.readout--neutral .readout__value {
  color: var(--text);
}

.readout__sub {
  margin-top: var(--s1);
  font-size: var(--t-cell);
  color: var(--text-muted);
}

.readout__chips {
  display: flex;
  gap: var(--s2);
  margin-top: var(--s3);
  flex-wrap: wrap;
}

.readout__note {
  margin-top: var(--s3);
  font-size: var(--t-cell);
  color: var(--text-muted);
  max-width: 68ch;
}

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: var(--s1);
  padding: 2px var(--s2);
  border-radius: var(--r-sm);
  border: 1px solid var(--neutral-border);
  background: var(--neutral-bg);
  color: var(--neutral);
  font-size: var(--t-xs);
}

.chip--accent {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--accent);
}

.chip--attention {
  background: var(--attention-bg);
  border-color: var(--attention-border);
  color: var(--attention);
}

.chip--positive {
  background: var(--positive-bg);
  border-color: var(--positive-border);
  color: var(--positive);
}

.chip--negative {
  background: var(--negative-bg);
  border-color: var(--negative-border);
  color: var(--negative);
}

.chip__label {
  color: inherit;
  opacity: 0.75;
}

.chip__value {
  font-weight: var(--fw-semibold);
}

/* --------------------------------------------------------------------------
 * segment_bar — a ratio against its break-even, in CSS
 * ------------------------------------------------------------------------ */

/* No `overflow: hidden`: the break-even tick has to stand proud of the track to be
 * legible over the fill, and clipping it is what makes it disappear exactly on the rows
 * where the ratio is closest to 1.0 and the reader most needs to see where it sits. */
.bar {
  position: relative;
  width: 100%;
  min-width: 72px;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--bg-inset);
}

.bar--slim {
  height: 6px;
}

.bar--hero {
  height: 12px;
  border-radius: var(--r-sm);
}

.bar__fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--chart-counterfactual);
  border-radius: inherit;
}

.bar--over .bar__fill {
  background: var(--accent);
}

/* Drawn over the fill, with both ends marked. A translucent band alone is invisible
 * against the fill on one side and against the track on the other, which leaves the
 * interval — the thing the decision rests on — as the only part of the bar nobody sees. */
.bar__range {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--chart-band);
  border-left: 2px solid var(--chart-counterfactual);
  border-right: 2px solid var(--chart-counterfactual);
}

.bar__tick {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: var(--text);
  opacity: 0.8;
}

.bar__caption {
  display: flex;
  justify-content: space-between;
  margin-top: var(--s1);
  font-size: var(--t-xs);
  color: var(--text-muted);
}

.bar--empty {
  opacity: 0.4;
}

/* --------------------------------------------------------------------------
 * data_table
 * ------------------------------------------------------------------------ */

.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: auto;
  background: var(--bg-raised);
}

table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-cell);
}

.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--s3);
  height: 32px;
  text-align: left;
  font-size: var(--t-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  white-space: nowrap;
}

.table td {
  height: var(--row-h);
  padding: 0 var(--s3);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

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

.table .align-right {
  text-align: right;
}

.table th.align-right a {
  justify-content: flex-end;
}

.table__sort {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  color: inherit;
  width: 100%;
}

.table__sort:hover {
  color: var(--text);
  text-decoration: none;
}

.table__sort[aria-sort="ascending"],
.table__sort[aria-sort="descending"] {
  color: var(--text);
}

.table__caret {
  font-size: 9px;
  color: var(--accent);
}

/* A row that is a link is 40px of link, not a link inside 40px. */
.table__cellwrap {
  display: block;
  color: inherit;
}

.table__cellwrap:hover {
  text-decoration: none;
}

/* A cell that is a link, as against `.table__cellwrap`, which is a row that is one.
   The row's affordance is its hover background; a single cell has to read as a link
   with nothing hovering it, or it is an action nobody finds. */
.table__link {
  color: var(--accent);
}

.table__strong {
  font-weight: var(--fw-semibold);
}

.table__sub {
  display: block;
  font-size: var(--t-xs);
  color: var(--text-muted);
  line-height: 1.2;
}

.table tr.table__total td {
  background: var(--bg-sunken);
  font-weight: var(--fw-semibold);
  border-top: 1px solid var(--border-strong);
}

.table__empty td {
  height: auto;
  padding: var(--s6) var(--s3);
  text-align: center;
  color: var(--text-muted);
}

.table__note {
  margin-top: var(--s2);
  font-size: var(--t-xs);
  color: var(--text-muted);
  max-width: 90ch;
}

.table__bar {
  min-width: 96px;
  width: 120px;
}

/* --------------------------------------------------------------------------
 * dropzone
 * ------------------------------------------------------------------------ */

.dropzone {
  border: 1px dashed var(--border-strong);
  border-radius: var(--r);
  background: var(--bg-raised);
  padding: var(--s5);
  text-align: center;
}

.dropzone--over {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.dropzone__title {
  font-weight: var(--fw-semibold);
}

.dropzone__hint {
  margin-top: var(--s1);
  font-size: var(--t-cell);
  color: var(--text-muted);
}

.dropzone__schema {
  margin-top: var(--s3);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  color: var(--text-muted);
  background: var(--bg-inset);
  border-radius: var(--r-sm);
  padding: var(--s2) var(--s3);
  display: inline-block;
}

.dropzone__actions {
  margin-top: var(--s4);
  display: flex;
  gap: var(--s2);
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.dropzone__file {
  font-size: var(--t-cell);
  color: var(--text);
}

.dropzone input[type="file"] {
  display: none;
}

/* --------------------------------------------------------------------------
 * readiness_checklist
 * ------------------------------------------------------------------------ */

.checklist {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

.checklist__engine {
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}

.checklist__head {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s3) var(--card-pad);
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--border);
  font-weight: var(--fw-semibold);
}

.checklist__items {
  list-style: none;
  margin: 0;
  padding: var(--s2) var(--card-pad);
}

.checklist__item {
  display: flex;
  align-items: baseline;
  gap: var(--s2);
  padding: var(--s2) 0;
  font-size: var(--t-cell);
}

.checklist__mark {
  width: 14px;
  flex: none;
  text-align: center;
  font-weight: var(--fw-semibold);
}

.checklist__item--ok .checklist__mark {
  color: var(--positive);
}

.checklist__item--fail .checklist__mark {
  color: var(--negative);
}

.checklist__item--warn .checklist__mark {
  color: var(--attention);
}

.checklist__detail {
  margin-left: auto;
  color: var(--text-muted);
  font-size: var(--t-xs);
  text-align: right;
}

/* --------------------------------------------------------------------------
 * wizard_stepper
 * ------------------------------------------------------------------------ */

.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: var(--s5);
}

.stepper__step {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--t-cell);
  color: var(--text-faint);
}

.stepper__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--bg-raised);
  font-size: var(--t-xs);
  font-weight: var(--fw-semibold);
}

.stepper__step--current {
  color: var(--text);
  font-weight: var(--fw-semibold);
}

.stepper__step--current .stepper__num {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-on);
}

.stepper__step--done {
  color: var(--text-muted);
}

.stepper__step--done .stepper__num {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--accent);
}

.stepper__rail {
  flex: 1;
  height: 1px;
  background: var(--border);
  margin: 0 var(--s3);
  min-width: var(--s5);
}

/* --------------------------------------------------------------------------
 * Charts
 * ------------------------------------------------------------------------ */

.chart {
  position: relative;
}

.chart__head {
  display: flex;
  align-items: baseline;
  gap: var(--s2);
  margin-bottom: var(--s2);
}

.chart__title {
  font-size: var(--t-body);
  font-weight: var(--fw-semibold);
}

.chart__assumption {
  font-size: var(--t-xs);
  color: var(--text-muted);
}

.chart__ranges {
  margin-left: auto;
  display: flex;
  gap: var(--s1);
}

.chart__range {
  padding: 2px var(--s2);
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: var(--t-xs);
  cursor: pointer;
}

.chart__range--active {
  border-color: var(--border);
  background: var(--bg-inset);
  color: var(--text);
}

.chart__canvas {
  position: relative;
  width: 100%;
}

.chart__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  color: var(--text-muted);
  font-size: var(--t-cell);
  border: 1px dashed var(--border);
  border-radius: var(--r);
}

.chart__legend {
  display: flex;
  gap: var(--s4);
  margin-top: var(--s2);
  font-size: var(--t-xs);
  color: var(--text-muted);
  flex-wrap: wrap;
}

.chart__key {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
}

.chart__swatch {
  width: 14px;
  height: 0;
  border-top: 2px solid var(--chart-treatment);
}

.chart__swatch--counterfactual {
  border-top-style: dashed;
  border-top-color: var(--chart-counterfactual);
}

.chart__swatch--band {
  height: 8px;
  border: none;
  background: var(--chart-band);
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
 * confirm_dialog
 * ------------------------------------------------------------------------ */

.dialog__backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: var(--s5);
}

.dialog {
  width: 100%;
  max-width: 440px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s5);
}

.dialog__title {
  font-size: var(--t-lead);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--s2);
}

.dialog__body {
  color: var(--text-muted);
  font-size: var(--t-cell);
}

.dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--s2);
  margin-top: var(--s5);
}

/* --------------------------------------------------------------------------
 * job_progress
 * ------------------------------------------------------------------------ */

.progress__caption {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--t-cell);
  margin-bottom: var(--s2);
}

.progress__track {
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--bg-inset);
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}

.progress__track--indeterminate .progress__fill {
  width: 32%;
  animation: slide 1.4s ease-in-out infinite;
}

@keyframes slide {
  0% {
    transform: translateX(-110%);
  }

  100% {
    transform: translateX(330%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .progress__track--indeterminate .progress__fill {
    animation: none;
    width: 100%;
    opacity: 0.4;
  }
}

/* --------------------------------------------------------------------------
 * empty_state
 * ------------------------------------------------------------------------ */

.empty {
  text-align: center;
  padding: var(--s7) var(--s5);
}

.empty__title {
  font-size: var(--t-lead);
  font-weight: var(--fw-semibold);
}

.empty__body {
  margin: var(--s2) auto 0;
  max-width: 52ch;
  color: var(--text-muted);
  font-size: var(--t-cell);
}

.empty__action {
  margin-top: var(--s4);
}

/* --------------------------------------------------------------------------
 * error_card
 * ------------------------------------------------------------------------ */

.errorcard {
  border: 1px solid var(--negative-border);
  border-left-width: 3px;
  border-radius: var(--r);
  background: var(--negative-bg);
  padding: var(--card-pad);
}

.errorcard--attention {
  border-color: var(--attention-border);
  background: var(--attention-bg);
}

.errorcard--neutral {
  border-color: var(--border);
  background: var(--bg-sunken);
}

.errorcard__title {
  font-weight: var(--fw-semibold);
  margin-bottom: var(--s2);
}

.errorcard__item + .errorcard__item {
  margin-top: var(--s3);
  padding-top: var(--s3);
  border-top: 1px solid var(--border);
}

.errorcard__code {
  font-family: var(--font-mono);
  font-size: var(--t-pill);
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.errorcard__message {
  margin-top: var(--s1);
}

.errorcard__remediation,
.errorcard__detail {
  margin-top: var(--s1);
  font-size: var(--t-cell);
  color: var(--text-muted);
}

.errorcard__actions {
  margin-top: var(--s4);
  display: flex;
  gap: var(--s2);
  align-items: center;
}

.errorcard__log {
  margin-top: var(--s3);
  font-size: var(--t-cell);
}

.errorcard__log pre {
  margin: var(--s2) 0 0;
  padding: var(--s3);
  background: var(--bg-inset);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  color: var(--text-muted);
  overflow: auto;
  max-height: 240px;
  white-space: pre-wrap;
}

/* --------------------------------------------------------------------------
 * HTMX — a ~120ms fade on swaps, and nothing more
 * ------------------------------------------------------------------------ */

.htmx-swapping {
  opacity: 0;
  transition: opacity var(--swap-ms) ease-out;
}

.htmx-settling {
  opacity: 0;
}

.htmx-settling.htmx-added,
.htmx-settling {
  animation: fade-in var(--swap-ms) ease-in forwards;
}

@keyframes fade-in {
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .htmx-swapping,
  .htmx-settling {
    transition: none;
    animation: none;
    opacity: 1;
  }
}

[x-cloak] {
  display: none !important;
}

/* --------------------------------------------------------------------------
 * Screens
 *
 * Everything above is a component; everything here is the connective tissue the
 * two screens need and no component owns — a filter bar, a flash line, the header
 * facts, a definition list of provenance, a disclosure. Still tokens only, and
 * still nothing that restyles a component: a screen that gave `.card` its own
 * padding is a card that no longer matches the card beside it.
 * ------------------------------------------------------------------------ */

.filters {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
}

.filters__chip {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 var(--s3);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg-raised);
  color: var(--text-muted);
  font-size: var(--t-cell);
  font-weight: var(--fw-medium);
}

.filters__chip:hover {
  background: var(--bg-hover);
  color: var(--text);
  text-decoration: none;
}

.filters__chip--active {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--accent);
}

/* One line of confirmation after an upload. Not an error card: the two outcomes
 * that are not failures — no change, and rebase required — must not be drawn as
 * one, or the reader retries a commit that will do the same thing again. */
.notice {
  margin: 0;
  padding: var(--s3) var(--s4);
  border: 1px solid var(--neutral-border);
  border-left-width: 3px;
  border-radius: var(--r);
  background: var(--neutral-bg);
  color: var(--text);
  font-size: var(--t-cell);
}

.notice--positive {
  border-color: var(--positive-border);
  border-left-color: var(--positive);
  background: var(--positive-bg);
}

.notice--attention {
  border-color: var(--attention-border);
  border-left-color: var(--attention);
  background: var(--attention-bg);
}

.notice--negative {
  border-color: var(--negative-border);
  border-left-color: var(--negative);
  background: var(--negative-bg);
}

.meta {
  color: var(--text-muted);
  font-size: var(--t-cell);
}

.meta__item + .meta__item::before {
  content: "\00b7";
  margin: 0 var(--s2) 0 0;
  color: var(--text-faint);
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 var(--s2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-inset);
  color: var(--text-muted);
  font-size: var(--t-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card--prompt {
  border-color: var(--attention-border);
  background: var(--attention-bg);
}

/* The report's lines, and the provenance in the method panel. Two columns, the
 * label muted and the value tabular, because every one of them is read against
 * the line above it. */
.report {
  margin-top: var(--s5);
  border-top: 1px solid var(--border);
  padding-top: var(--s4);
}

.report__why {
  color: var(--text-muted);
}

.facts,
.report__lines {
  display: grid;
  grid-template-columns: minmax(140px, max-content) 1fr;
  gap: var(--s2) var(--s5);
  margin: 0;
  font-size: var(--t-cell);
}

.facts dt,
.report__lines dt {
  color: var(--text-muted);
}

.facts dd,
.report__lines dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* `report.py` lays a line out with runs of spaces, and that alignment is the report's
 * own. Collapsed, "+$484,000        Spend  $142,500" runs two figures together. */
.report__lines dd {
  white-space: pre-wrap;
}

.report__caveats {
  margin: var(--s4) 0 0;
  padding-left: var(--s4);
  color: var(--text-muted);
  font-size: var(--t-xs);
}

.panel__summary {
  cursor: pointer;
  font-size: var(--t-body);
  font-weight: var(--fw-semibold);
}

.panel__body {
  margin-top: var(--s4);
}

.panel__list {
  margin: var(--s3) 0 0;
  padding-left: var(--s4);
  color: var(--text-muted);
  font-size: var(--t-cell);
}

/* --------------------------------------------------------------------------
 * Styleguide (dev only)
 * ------------------------------------------------------------------------ */

.sg__nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-bottom: var(--s6);
}

.sg__section {
  border-top: 1px solid var(--border);
  padding-top: var(--s5);
  margin-top: var(--s6);
}

.sg__section > h2 {
  margin-bottom: var(--s1);
}

.sg__meta {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  color: var(--text-faint);
  margin-bottom: var(--s4);
}

.sg__states {
  display: flex;
  flex-direction: column;
  gap: var(--s5);
}

.sg__state {
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: var(--card-pad);
  background: var(--bg-sunken);
}

.sg__state > h3 {
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: var(--s3);
}
