/* runmetal design system — "Modernist".
 *
 * Tokens verified against the design project's authoritative styles.css
 * (_ds/modernist-72adf64b/…). This file is the single source of truth for the
 * look — every island and every template consumes it; retune here, never in a
 * component. One deliberate divergence: the design system @imports Archivo
 * from Google Fonts; brand rule 2 says self-host, so we ship subsetted
 * variable WOFF2s instead. No CDN, no external request.
 *
 * Square corners everywhere (--radius-* are 0 on purpose), Archivo at
 * 400/600/800, ONE accent red. The --color-accent-2-* ramp is a machine
 * stand-in the design system readme disowns ("treat them as one role") —
 * don't reach for it as a second accent.
 */

/* — Archivo (variable weight 400–800), self-hosted — */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 800;
  font-stretch: 100%;
  font-display: swap;
  src: url("../fonts/archivo-latin.92895abae7c5.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 800;
  font-stretch: 100%;
  font-display: swap;
  src: url("../fonts/archivo-latin-ext.288d2a1c9f04.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 800;
  font-stretch: 100%;
  font-display: swap;
  src: url("../fonts/archivo-vietnamese.dbc5c2f39794.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1,
    U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329,
    U+1EA0-1EF9, U+20AB;
}

:root {
  --color-bg: #f3f2f2;
  --color-surface: #eae9e9;
  --color-text: #201e1d;
  --color-accent: #ec3013;
  --color-accent-2: #e15b47;
  --color-divider: color-mix(in srgb, #201e1d 40%, transparent);

  /* Tonal ramps — one shared lightness scale, so the same step of any role
     matches the others in visual value. */
  --color-neutral-100: #f8f4f4;
  --color-neutral-200: #eae7e7;
  --color-neutral-300: #d7d3d3;
  --color-neutral-400: #bab6b6;
  --color-neutral-500: #9b9797;
  --color-neutral-600: #7d7979;
  --color-neutral-700: #605d5d;
  --color-neutral-800: #444141;
  --color-neutral-900: #2d2b2b;

  --color-accent-100: #fff2ef;
  --color-accent-200: #ffe0d9;
  --color-accent-300: #ffc4b8;
  --color-accent-400: #ff9783;
  --color-accent-500: #ff563c;
  --color-accent-600: #dd2b0f;
  --color-accent-700: #ae1800;
  --color-accent-800: #7c1405;
  --color-accent-900: #4d170e;

  --color-accent-2-100: #fff2ef;
  --color-accent-2-200: #ffe0da;
  --color-accent-2-300: #ffc4b9;
  --color-accent-2-400: #ff9784;
  --color-accent-2-500: #ef6853;
  --color-accent-2-600: #c94b39;
  --color-accent-2-700: #9e3526;
  --color-accent-2-800: #71261b;
  --color-accent-2-900: #471d16;

  --font-heading: "Archivo", system-ui, sans-serif;
  --font-heading-weight: 800;
  --font-body: "Archivo", system-ui, sans-serif;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;

  --radius-sm: 0px;
  --radius-md: 0px;
  --radius-lg: 0px;

  --shadow-sm: 0 1px 2px color-mix(in srgb, #2d2b2b 14%, transparent);
  --shadow-md: 0 3px 10px color-mix(in srgb, #2d2b2b 16%, transparent);
  --shadow-lg: 0 12px 32px color-mix(in srgb, #2d2b2b 22%, transparent);
}

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 400;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 var(--space-2);
}
h1 { font-size: 42px; }
h2 { font-size: 32px; }
h3 { font-size: 25px; }
h4 { font-size: 20px; }
h5 { font-size: 16px; }
h6 { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }

p { margin: 0 0 var(--space-3); }
a { color: var(--color-accent); text-underline-offset: 3px; }
a:hover { color: var(--color-accent-700); }
img { display: block; max-width: 100%; }

input[type="number"] { -moz-appearance: textfield; }
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.text-muted { color: color-mix(in srgb, var(--color-text) 55%, transparent); }
.tabular { font-variant-numeric: tabular-nums; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }

.hr {
  height: 2px;
  border: 0;
  margin: var(--space-4) 0;
  background: var(--color-divider);
}

/* — buttons — */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 14px;
  line-height: 1.2;
  color: var(--color-text);
  background: transparent;
  border: 1px solid transparent;
  padding: var(--space-2) calc(var(--space-3) * 1.2);
  border-radius: var(--radius-md);
}
.btn svg { display: block; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--color-accent); color: var(--color-bg); }
.btn-primary:hover:not(:disabled) { background: var(--color-accent-600); }
.btn-primary:active:not(:disabled) { background: var(--color-accent-700); }
/* Every button reads as a button: a filled ground and a visible edge, never
   a bare word floating in the page. */
.btn-secondary {
  background: var(--color-surface);
  border-color: var(--color-text);
  box-shadow: 2px 2px 0 color-mix(in srgb, var(--color-text) 14%, transparent);
}
.btn-secondary:hover { background: color-mix(in srgb, var(--color-text) 7%, var(--color-surface)); }
.btn-secondary:active {
  background: color-mix(in srgb, var(--color-text) 14%, var(--color-surface));
  box-shadow: none;
  transform: translate(1px, 1px);
}
/* Ghost is the quiet action — still a filled chip, just lighter than the rest. */
.btn-ghost {
  color: var(--color-accent-700);
  background: var(--color-accent-100);
  border-color: color-mix(in srgb, var(--color-accent) 35%, transparent);
}
.btn-ghost:hover { background: color-mix(in srgb, var(--color-accent) 18%, var(--color-bg)); }
.btn-ghost:active { background: color-mix(in srgb, var(--color-accent) 26%, var(--color-bg)); }
.btn-sm { font-size: 12px; padding: 5px 10px; }
.btn-icon { width: 36px; height: 36px; padding: 0; }
/* Modernist sets labels flush left — even inside a full-width button. */
.btn-block {
  width: 100%;
  margin-top: var(--space-2);
  justify-content: flex-start;
  text-align: left;
}
/* The mock's signature: a chamfered top-right corner on forward actions. */
.btn-notch { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%); }
.btn-notch-sm { clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%); }

/* ── review screen: raw email beside the entry form ────────────────────────
 * The table's inputs used to overflow their module because the cells had no
 * declared widths; fixed layout + full-width inputs keep everything inside
 * the 2px edge at any zoom.
 */
.review-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(420px, 1.15fr);
  gap: var(--space-6);
  align-items: start;
}
@media (max-width: 1000px) { .review-grid { grid-template-columns: 1fr; } }

.section-label {
  text-transform: lowercase;
  margin: 0 0 var(--space-3);
}
.module {
  border: 2px solid var(--color-text);
  background: var(--color-surface);
}
.module-pad { padding: var(--space-4); }
.module-head {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-divider);
  font-size: 11.5px;
  color: var(--color-neutral-700);
}
.module-foot {
  padding: 10px 12px;
  border-top: 1px solid var(--color-divider);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.raw-email {
  margin: 0;
  padding: 12px;
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  font-family: var(--font-body);
  max-height: 380px;
  overflow-y: auto;
}
.entry-table { table-layout: fixed; min-width: 520px; }
.entry-table th,
.entry-table td { padding: 6px 8px; vertical-align: middle; }
.entry-table .col-check { width: 62px; text-align: center; }
.entry-table .col-money { width: 96px; }
.entry-table .col-note { width: 130px; }
.entry-table .input { width: 100%; min-width: 0; font-size: 12.5px; padding: 5px 7px; }
.entry-table input:not([type="checkbox"]) { width: 100%; min-width: 0; }
.line-name { font-size: 12.5px; font-weight: 600; line-height: 1.3; }
.line-meta { font-size: 11px; }
.check-center { justify-content: center; }
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-top: var(--space-4);
}
.field-grid .input,
.module-pad textarea.input { width: 100%; }
.action-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: var(--space-4) 0 var(--space-3);
}

/* — forms — */
.field > label {
  display: block;
  font-size: 12px;
  margin-bottom: 5px;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
}
.input,
select.input {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  font: inherit;
  font-size: 14px;
  color: var(--color-text);
  caret-color: var(--color-accent);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
}
.input:hover { border-color: color-mix(in srgb, var(--color-text) 45%, transparent); }
.input:focus-visible { border-color: var(--color-accent); outline-offset: 0; }
.input[aria-invalid="true"] { border-color: var(--color-accent); }
textarea.input { min-height: 90px; resize: vertical; }
/* Repaint the browser's yellow autofill with the field's own ground. */
.input:-webkit-autofill,
.input:-webkit-autofill:hover,
.input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--color-surface) inset;
  -webkit-text-fill-color: var(--color-text);
  caret-color: var(--color-accent);
}

.seg {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
}
.seg-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
}
.seg-opt input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.seg-opt + .seg-opt { border-left: 1px solid var(--color-divider); }
.seg-opt:has(input:checked) { background: var(--color-accent); color: var(--color-bg); }
.seg-opt:not(:has(input:checked)):hover {
  background: color-mix(in srgb, var(--color-text) 7%, transparent);
}
.seg-opt:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: -2px; }

/* — cards — */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-3);
}
.card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}
.card-kicker {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
}
.card-title {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 17px;
  line-height: 1.2;
}
.card-body { font-size: 13px; opacity: 0.8; flex: 1; }
.card-meta { font-size: 11px; color: color-mix(in srgb, var(--color-text) 50%, transparent); }
.elev-sm { box-shadow: var(--shadow-sm); }
.elev-md { box-shadow: var(--shadow-md); }
.elev-lg { box-shadow: var(--shadow-lg); }

/* — tags — */
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.02em;
  padding: 3px 10px;
  border-radius: calc(var(--radius-md) * 0.75);
}
.tag-accent { background: var(--color-accent-100); color: var(--color-accent-800); }
.tag-accent-2 { background: var(--color-accent-2-100); color: var(--color-accent-2-800); }
.tag-neutral { background: var(--color-neutral-100); color: var(--color-neutral-800); }
.tag-outline { border: 1px solid var(--color-accent); color: var(--color-accent); }

/* — radios — */
.radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
}
.radio input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.radio .dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--color-divider);
  flex: none;
}
.radio:has(input:checked) .dot {
  background: var(--color-accent);
  border-color: var(--color-accent);
  box-shadow: inset 0 0 0 4px var(--color-bg);
}
.radio:has(input:focus-visible) .dot { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* — dialog (the manual-review modal) — */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: var(--space-4);
  background: color-mix(in srgb, var(--color-neutral-900) 50%, transparent);
}
.dialog {
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-surface);
  border: 2px solid var(--color-text);
  box-shadow: var(--shadow-lg);
}
.dialog-title {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 20px;
}
.dialog-body { font-size: 14px; opacity: 0.85; }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-2); }

/* — selection ring — the design's one selection affordance. Absolutely
   positioned inside a position:relative parent; reused for sort segments,
   filter chips, flagged rows, the winning compare card and invalid inputs,
   so nobody invents a second idiom per screen. */
.ring-selected {
  position: absolute;
  inset: 0;
  border: 2px solid var(--color-accent);
  pointer-events: none;
}

/* — empty states — §9: the waiting state is the common case; make it
   informative, never blank. Pair with an icon and real copy. */
.empty {
  border: 1px dashed var(--color-neutral-500);
  padding: 56px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
}
.empty h2,
.empty h3 {
  font-size: 20px;
  text-transform: lowercase;
  margin: 0;
}
.empty p { max-width: 44ch; color: var(--color-neutral-700); font-size: 13px; margin: 0; }

/* Photography prints in pure black and white. */
.grayscale { filter: grayscale(1) contrast(1.08); }

/* — navigation — */
.nav {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 0 var(--space-8);
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--color-bg);
  border-bottom: 2px solid var(--color-divider);
}
.nav-brand {
  display: flex;
  align-items: center;
  margin-right: 8px;
  text-decoration: none;
}
/* The lockup is one asset at a fixed 139 x 28 — symbol 28, gap 14, wordmark 22
   outlined. Height drives it; width follows so the ratio can't be squashed. */
.nav-brand img {
  height: 28px;
  width: auto;
  display: block;
}
.nav-links { display: flex; align-items: center; gap: 26px; margin-right: auto; }
.nav-brand,
.nav-avatar,
.nav form { flex: none; }
.nav a { color: inherit; text-decoration: none; font-size: 13px; font-weight: 600; }
.nav a:hover,
.nav a[aria-current="page"] { color: var(--color-accent); }
.nav-count {
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 0 5px;
}
.nav-avatar {
  width: 30px;
  height: 30px;
  background: var(--color-text);
  color: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 13px;
}

/* — account menu: the avatar discloses Settings / Sign out — */
.nav-account { position: relative; }
.nav-account > summary {
  list-style: none;
  cursor: pointer;
}
.nav-account > summary::-webkit-details-marker { display: none; }
.nav-account > summary:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
.nav-account[open] > summary { background: var(--color-accent); }
.nav-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 210px;
  z-index: 50;
  border: 2px solid var(--color-text);
  background: var(--color-bg);
  box-shadow: var(--shadow-md);
  animation: nav-menu-in 120ms ease-out;
}
@keyframes nav-menu-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .nav-menu { animation: none; }
}
.nav-menu-who {
  padding: 10px 14px;
  font-size: 11.5px;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
  border-bottom: 1px solid var(--color-divider);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-menu-item,
.nav .nav-menu-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  background: none;
  text-align: left;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  cursor: pointer;
}
.nav-menu-item:hover,
.nav .nav-menu-item:hover {
  background: var(--color-surface);
  color: var(--color-accent);
}

/* — tables — */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
  padding: var(--space-2);
  border-bottom: 2px solid var(--color-divider);
}
.table td { padding: var(--space-2); border-bottom: 1px solid var(--color-divider); }
.table tbody tr:hover { background: color-mix(in srgb, var(--color-text) 4%, transparent); }

/* Wide content scrolls inside its own box; the page body never scrolls sideways. */
.table-scroll { overflow-x: auto; }

/* — page scaffolding — */
.page { max-width: 1160px; margin: 0 auto; padding: 44px var(--space-8) 90px; }

@media (max-width: 720px) {
  .page { padding: 28px var(--space-4) 60px; }
  .page-title { font-size: 26px; }
  /* The nav has more in it than fits a phone: let it wrap onto a second line
     instead of pushing the avatar off the right edge of the document. */
  .nav {
    gap: 12px 16px;
    padding: 10px var(--space-4);
    height: auto;
    flex-wrap: wrap;
  }
  .nav-links { gap: 16px; order: 3; width: 100%; }
  .nav-brand { margin-right: auto; }
}
.page-kicker {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-accent);
  font-weight: 800;
  margin-bottom: 14px;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
  flex-wrap: wrap;
  /* Every screen needs air under the heading block. Older screens faked it
     with an <hr>; without this the first module collides with the CTA. */
  margin-bottom: var(--space-6);
}
.page-head + .hr { margin-top: 0; }
/* The mock sets its screen headings lowercase at 34px. */
.page-title {
  font-size: 34px;
  letter-spacing: -0.02em;
  text-transform: lowercase;
  margin: 0 0 6px;
}
.page-sub { font-size: 13px; color: var(--color-neutral-700); }

.notice {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-4);
  font-size: 13px;
  max-width: 70ch;
}
/* Brand rule 4: raw accent on the page ground is ~4.3:1 — fine for large or
   bold type, not 13px body copy. Warnings follow the design's banner idiom:
   deep accent ink on the accent-100 tint, with room for an icon (rule 5:
   never colour alone). */
.notice-warn {
  color: var(--color-accent-700);
  background: var(--color-accent-100);
  border: 1px solid var(--color-accent);
  padding: var(--space-2) var(--space-3);
  font-weight: 600;
}
.notice-ok {
  color: var(--color-neutral-700);
  border: 1px solid var(--color-divider);
  padding: var(--space-2) var(--space-3);
}

/* ── account pages ────────────────────────────────────────────────────────────
 * The entrance layout: the product's pitch on the left, the form on the right.
 * allauth renders most screens from its own templates, so form controls are
 * styled by element rather than by class. Scoped to .auth-card so nothing here
 * can leak into the app's own screens.
 */
.entrance {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  min-height: calc(100vh - 60px); /* the sticky nav */
}
.entrance-brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: 72px 56px 56px;
  background: var(--color-surface);
  border-right: 2px solid var(--color-divider);
}
.entrance-brand img { width: 64px; height: 64px; display: block; margin-bottom: var(--space-2); }
.entrance-brand h2 {
  font-size: 34px;
  letter-spacing: -0.025em;
  text-transform: lowercase;
  line-height: 1.12;
  max-width: 15ch;
  margin: 0;
}
.entrance-brand p {
  max-width: 44ch;
  font-size: 14px;
  color: var(--color-neutral-700);
  margin: 0;
}
.entrance-footnote { margin-top: auto; font-size: 12.5px; }
.entrance-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px var(--space-6);
}
.entrance-panel .auth-card { width: min(440px, 100%); }
@media (max-width: 880px) {
  .entrance { grid-template-columns: 1fr; min-height: 0; }
  /* The nav already carries the brand; the pitch panel is a desktop luxury. */
  .entrance-brand { display: none; }
  .entrance-panel { padding: 28px var(--space-4) 60px; align-items: flex-start; }
}

.auth-card {
  background: var(--color-surface);
  border: 2px solid var(--color-text);
  padding: var(--space-8) var(--space-6);
}
.check,
.auth-card .auth-check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
}
.auth-card .auth-check { margin-bottom: var(--space-3); }
/* A square checkbox — the platform default renders round on macOS and reads
   as a radio. Zero radius, accent when checked, check drawn as a clipped L.
   `.check` is the shared primitive (§8: primitives exist once); .auth-check
   keeps its name for the entrance card. */
.check input,
.auth-card .auth-check input {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  flex: none;
  display: inline-grid;
  place-content: center;
  border: 1.5px solid var(--color-divider);
  background: var(--color-bg);
  border-radius: 0;
  cursor: pointer;
}
.check input:checked,
.auth-card .auth-check input:checked {
  background: var(--color-accent);
  border-color: var(--color-accent);
}
.check input:checked::before,
.auth-card .auth-check input:checked::before {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid var(--color-bg);
  border-bottom: 2px solid var(--color-bg);
  transform: translateY(-1.5px) rotate(-45deg);
}
.check input:focus-visible,
.auth-card .auth-check input:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-color: var(--color-accent);
}
.auth-card h1 {
  font-size: 28px;
  text-transform: lowercase;
  margin-bottom: var(--space-2);
}
.auth-card h2 { font-size: 20px; }
.auth-card p { font-size: 14px; }
.auth-card > p:first-of-type { color: color-mix(in srgb, var(--color-text) 65%, transparent); }

.auth-card label {
  display: block;
  font-size: 12px;
  margin-bottom: 5px;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
}
.auth-card input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
.auth-card select,
.auth-card textarea {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  font: inherit;
  font-size: 14px;
  color: var(--color-text);
  caret-color: var(--color-accent);
  background: var(--color-bg);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
}
.auth-card input:focus-visible,
.auth-card select:focus-visible,
.auth-card textarea:focus-visible {
  border-color: var(--color-accent);
  outline-offset: 0;
}
.auth-card input[type="checkbox"] { accent-color: var(--color-accent); }

/* The browser's autofill paint (that yellow) fights the system — repaint it
   with our own ground. The 1000px inset shadow is the standard override. */
.auth-card input:-webkit-autofill,
.auth-card input:-webkit-autofill:hover,
.auth-card input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--color-bg) inset;
  -webkit-text-fill-color: var(--color-text);
  caret-color: var(--color-accent);
}

/* Entrance CTAs are block buttons: full width, label flush left — the
   readme is explicit that labels sit flush left even inside buttons. */
.auth-card button,
.auth-card input[type="submit"],
.auth-card a.button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 14px;
  line-height: 1.2;
  margin-top: var(--space-2);
  padding: 11px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: var(--color-accent);
  color: var(--color-bg);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
}
.auth-card button:hover,
.auth-card input[type="submit"]:hover { background: var(--color-accent-600); }
.auth-card button:active,
.auth-card input[type="submit"]:active { background: var(--color-accent-700); }
/* Secondary and link-style actions allauth marks with its own tags. */
.auth-card a:not(.button) {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 13px;
}

/* allauth renders field errors as a list above the input. */
.auth-card .errorlist,
.auth-card ul.errorlist {
  list-style: none;
  margin: 0 0 var(--space-2);
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-accent);
}
.auth-card form > p,
.auth-card .field { margin-bottom: var(--space-3); }
/* Inside a module, rules are 1px — 2px is for module edges. */
.auth-card .hr { height: 1px; margin: var(--space-6) 0 var(--space-4); }

@keyframes rm-fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.rm-screen { animation: rm-fade 0.28s ease both; }

/* A reply row landing in the inbox: drops in with an accent flash that decays. */
@keyframes rm-land {
  0% { opacity: 0; transform: translateY(-6px); background: var(--color-accent-100); }
  60% { background: var(--color-accent-100); }
  100% { opacity: 1; transform: none; background: transparent; }
}
.rm-land { animation: rm-land 0.5s ease both; }

/* The waiting dots on "sent — nothing back yet". */
@keyframes rm-pulse {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 1; }
}
.rm-pulse { animation: rm-pulse 1.2s ease-in-out infinite; }

@keyframes rm-bar {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(240%); }
}
.rm-progress {
  width: 190px;
  height: 3px;
  background: var(--color-neutral-300);
  overflow: hidden;
}
.rm-progress > div {
  height: 100%;
  width: 38%;
  background: var(--color-accent);
  animation: rm-bar 1.05s ease-in-out infinite;
}

/* ── the loading screen ───────────────────────────────────────────────────────
 * The design's signature: an end mill machines the runmetal lockup — the
 * cutter drops down the r's stem, traverses the arm, then wipes right to
 * reveal the wordmark, throwing chips as it cuts. Shown only over genuine
 * async work (fetching a list, sending an RFQ) — never on navigation.
 * Loops every 1.4s; markup lives in frontend/src/feedback.jsx, mirrored on
 * the staff /brand/ sheet (drift-tested in tests/test_brand.py).
 */
.rm-loader {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: rm-fade 0.2s ease both;
}
.rm-loader-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 22px;
  width: min(380px, 72vw);
}
.rm-loader-label {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-neutral-700);
  font-weight: 700;
}
.rm-loader .rm-progress { width: 100%; }

.rm-billet { fill: var(--color-accent); }
.rm-glyph { fill: #f3f2f2; } /* fixed light knock-out so it reads on red */
.rm-word { fill: var(--color-text); }
.rm-chip { fill: var(--color-neutral-500); }
.rm-stem { animation: rm-cut-stem 1.4s linear infinite; }
.rm-arm { animation: rm-cut-arm 1.4s linear infinite; }
.rm-wipe { animation: rm-cut-wipe 1.4s linear infinite; }
.rm-tool { animation: rm-cut-tool 1.4s linear infinite; }
.rm-flutes {
  transform-box: fill-box;
  transform-origin: center;
  animation: rm-spin 0.45s linear infinite;
}
.rm-chips .rm-chip { animation: rm-chip 0.5s linear infinite; }
.rm-chips .rm-chip:nth-child(2) { animation-delay: 0.1s; }
.rm-chips .rm-chip:nth-child(3) { animation-delay: 0.2s; }
.rm-chips .rm-chip:nth-child(4) { animation-delay: 0.3s; }
.rm-chips .rm-chip:nth-child(5) { animation-delay: 0.4s; }

@keyframes rm-cut-stem { 0%, 4% { height: 0px; } 26%, 100% { height: 52px; } }
@keyframes rm-cut-arm { 0%, 26% { width: 0px; } 48%, 100% { width: 32px; } }
@keyframes rm-cut-wipe { 0%, 52% { width: 0px; } 88%, 100% { width: 367px; } }
@keyframes rm-spin { to { transform: rotate(360deg); } }
@keyframes rm-chip {
  0% { opacity: 0; transform: translate(0, 0); }
  12% { opacity: 0.9; }
  100% { opacity: 0; transform: translate(var(--cx), var(--cy)); }
}
@keyframes rm-cut-tool {
  0% { transform: translate(34px, 4px); opacity: 0; }
  4% { transform: translate(34px, 20px); opacity: 1; }
  26% { transform: translate(34px, 86px); opacity: 1; }
  29% { transform: translate(34px, 86px); opacity: 0; }
  30% { transform: translate(46px, 34px); opacity: 0; }
  33% { transform: translate(50px, 34px); opacity: 1; }
  48% { transform: translate(84px, 34px); opacity: 1; }
  51% { transform: translate(84px, 34px); opacity: 0; }
  52% { transform: translate(140px, 50px); opacity: 0; }
  55% { transform: translate(150px, 50px); opacity: 1; }
  88% { transform: translate(505px, 50px); opacity: 1; }
  92%, 100% { transform: translate(505px, 50px); opacity: 0; }
}

/* ── toast ── the design's bottom-center confirmation, auto-dismissed. */
.rm-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 60;
  background: var(--color-text);
  color: var(--color-bg);
  padding: 12px 20px;
  font-size: 12.5px;
  font-weight: 600;
  animation: rm-fade 0.2s ease both;
}

@media (prefers-reduced-motion: reduce) {
  .rm-screen,
  .rm-land,
  .rm-pulse,
  .rm-toast,
  .rm-loader,
  .rm-progress > div,
  .rm-flutes,
  .rm-chips .rm-chip { animation: none; }
  /* With the cut animations off, show the finished mark, not a blank billet. */
  .rm-stem { animation: none; height: 52px; }
  .rm-arm { animation: none; width: 32px; }
  .rm-wipe { animation: none; width: 367px; }
  .rm-tool { display: none; }
}

/* ═════════════════════════════════════════════════════════════════════════
 * Screen components — the delivered prototype's layouts, built once here so
 * every screen inherits the same treatment (§8: primitives exist once).
 * ═════════════════════════════════════════════════════════════════════════ */

/* — stat tiles: the four-across strip above an RFQ — */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  border: 2px solid var(--color-text);
  background: var(--color-divider);
  gap: 1px;
  margin-bottom: var(--space-6);
}
.stat { background: var(--color-surface); padding: var(--space-4) var(--space-4); }
.stat-value {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 30px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-neutral-700);
  margin-top: 6px;
}

/* — a bordered data table whose cells hold boxed inputs (material list) — */
.grid-table {
  width: 100%;
  border-collapse: collapse;
  border: 2px solid var(--color-text);
  background: var(--color-surface);
}
.grid-table th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-neutral-700);
  font-weight: 700;
  padding: 12px 10px;
  border-bottom: 2px solid var(--color-text);
  white-space: nowrap;
}
.grid-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-divider);
  vertical-align: middle;
}
.grid-table tbody tr:last-child td { border-bottom: none; }
.grid-table .row-num {
  width: 42px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--color-neutral-700);
  font-size: 12.5px;
}
.grid-table .cell-input,
.grid-table .input,
.grid-table select.cell-input,
.grid-table select.input {
  width: 100%;
  min-width: 0;
  font-family: var(--font-body);
  font-size: 13px;
  padding: 9px 11px;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-neutral-400);
  border-radius: 0;
}
.grid-table .cell-input:focus-visible,
.grid-table .input:focus-visible {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: inset 0 0 0 1px var(--color-accent);
}
.grid-table .cell-input.is-missing { border-color: var(--color-accent); border-width: 2px; }
.grid-table .num-cell { text-align: right; }
.grid-table .num-cell .cell-input,
.grid-table .num-cell .input { text-align: right; font-variant-numeric: tabular-nums; }

/* — a selectable row list (vendors on the send screen) — */
.pick-table { width: 100%; border-collapse: collapse; border: 2px solid var(--color-text); }
.pick-table th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-neutral-700);
  padding: 12px 14px;
  background: var(--color-surface);
  border-bottom: 2px solid var(--color-text);
}
.pick-table td {
  padding: 14px;
  border-bottom: 1px solid var(--color-divider);
  vertical-align: middle;
}
.pick-table tbody tr:last-child td { border-bottom: none; }
.pick-table tbody tr.is-picked { background: var(--color-surface); }
.pick-name { font-weight: 700; font-size: 14px; }
.pick-meta { font-size: 12px; color: var(--color-neutral-700); margin-top: 2px; }
.pick-materials { font-size: 12.5px; color: var(--color-neutral-700); }

/* — the outbound email panel — */
.mail-panel { border: 2px solid var(--color-text); background: var(--color-surface); }
.mail-panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 2px solid var(--color-text);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
}
.mail-body {
  margin: 0;
  padding: 16px;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  max-height: 460px;
  overflow-y: auto;
  color: var(--color-text);
}
textarea.mail-body {
  width: 100%;
  background: var(--color-bg);
  border: none;
  border-top: 1px solid var(--color-divider);
  resize: vertical;
  min-height: 320px;
}
textarea.mail-body:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }

/* — per-vendor response cards on the RFQ screen — */
.vendor-card {
  border: 2px solid var(--color-text);
  background: var(--color-surface);
  margin-bottom: var(--space-3);
}
.vendor-card.is-flagged { border-color: var(--color-accent); }
.vendor-card-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 14px 16px;
  flex-wrap: wrap;
}
.vendor-card-name { font-family: var(--font-heading); font-weight: 800; font-size: 17px; }
.vendor-card-sub { font-size: 12px; color: var(--color-neutral-700); margin-top: 2px; }
.vendor-card-figures {
  display: flex;
  gap: var(--space-6);
  margin-left: auto;
  align-items: flex-end;
  flex-wrap: wrap;
}
.figure-label {
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--color-neutral-700);
}
.figure-value {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  margin-top: 3px;
}
.figure-value.is-absent {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 13px;
  color: var(--color-neutral-700);
}
.vendor-card-raw {
  border-top: 1px solid var(--color-divider);
  background: var(--color-accent-100);
  padding: 14px 16px;
}
.raw-label {
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--color-accent-700);
  font-weight: 700;
  margin-bottom: 8px;
}

/* — the mail view: list beside a reading pane — */
.mail-view {
  display: grid;
  grid-template-columns: minmax(280px, 0.42fr) 1fr;
  border: 2px solid var(--color-text);
  min-height: 540px;
}
@media (max-width: 900px) { .mail-view { grid-template-columns: 1fr; } }
.mail-list { border-right: 2px solid var(--color-text); max-height: 720px; overflow-y: auto; }
.mail-item {
  display: block;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-divider);
  text-decoration: none;
  color: inherit;
}
.mail-item:hover { background: var(--color-surface); }
.mail-item.is-current { background: var(--color-accent-100); border-left: 3px solid var(--color-accent); }
.mail-dir {
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--color-accent-700);
}
.mail-item-subject { font-size: 13px; margin: 3px 0; }
.mail-item-snip {
  font-size: 12px;
  color: var(--color-neutral-700);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.mail-read { background: var(--color-surface); }
.mail-read-head { padding: var(--space-4); border-bottom: 2px solid var(--color-text); }
.mail-headers {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 4px 12px;
  font-size: 12.5px;
  margin-top: var(--space-3);
}
.mail-headers dt { color: var(--color-neutral-700); }
.mail-headers dd { margin: 0; font-variant-numeric: tabular-nums; }

/* — segmented control (All / Sent / Received · sort) — */
.segmented { display: inline-flex; border: 2px solid var(--color-text); }
.segmented > * {
  padding: 8px 16px;
  font-size: 12.5px;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  background: var(--color-surface);
  color: var(--color-text);
  border: none;
  border-right: 1px solid var(--color-divider);
  cursor: pointer;
  text-decoration: none;
}
.segmented > *:last-child { border-right: none; }
.segmented > .is-on { background: var(--color-accent); color: var(--color-bg); }

/* — quote cards on Compare — */
.quote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: var(--space-4);
  align-items: start;
}
.quote-card { border: 2px solid var(--color-text); background: var(--color-surface); }
.quote-card.is-best { border-color: var(--color-accent); }
.quote-banner {
  background: var(--color-accent);
  color: var(--color-bg);
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 8px 14px;
}
.quote-banner.is-quiet { background: var(--color-neutral-900); }
.quote-head { padding: 14px 16px; border-bottom: 1px solid var(--color-divider); }
.quote-total-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-divider);
}
.quote-total {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 30px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.quote-caveat {
  background: var(--color-accent-100);
  color: var(--color-accent-700);
  font-size: 12.5px;
  line-height: 1.5;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-divider);
}
.quote-line {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-divider);
  font-size: 13px;
}
.quote-line-meta { font-size: 11.5px; color: var(--color-neutral-700); margin-top: 2px; }
.quote-line-amount { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.quote-line-amount.is-absent { font-weight: 400; color: var(--color-neutral-700); }
.quote-sums { padding: 10px 16px; border-bottom: 1px solid var(--color-divider); font-size: 13px; }
.quote-sum-row { display: flex; justify-content: space-between; padding: 3px 0; }
.quote-sum-row span:last-child { font-variant-numeric: tabular-nums; }
.quote-note {
  padding: 12px 16px;
  font-size: 12.5px;
  font-style: italic;
  color: var(--color-neutral-800);
  border-bottom: 1px solid var(--color-divider);
}
.quote-action { padding: var(--space-3); }
.quote-action .btn { width: 100%; justify-content: center; }

/* — the PO document sheet on screen — */
.doc-sheet {
  border: 2px solid var(--color-text);
  background: var(--color-surface);
  padding: var(--space-6);
  /* the design's folded corner */
  clip-path: polygon(0 0, calc(100% - 26px) 0, 100% 26px, 100% 100%, 0 100%);
}
.doc-frame { width: 100%; border: 2px solid var(--color-text); background: #fff; }
/* A vendor's PDF inside a .module (review screen): the module already owns
   the outer border, so the frame only draws its divider. */
.pdf-frame {
  display: block;
  width: 100%;
  height: 560px;
  border: 0;
  border-top: 1px solid var(--color-divider);
  background: #fff;
}

/* — send RFQ: the vendor list beside what the vendor receives — */
.send-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  gap: var(--space-6);
  align-items: start;
}
@media (max-width: 1000px) { .send-grid { grid-template-columns: 1fr; } }

/* The figures block wraps as a unit on narrow cards, so labels can never
   ride on top of the number below them. */
.vendor-card-figures > div { min-width: 104px; }
.vendor-card-head { row-gap: var(--space-3); }

/* An icon beside text inside a plain link — buttons get their gap from .btn,
   bare links had none, so the glyph jammed against the first letter. */
.link-icon {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.link-icon svg { flex: none; }
/* Any stray inline icon in body copy still keeps its distance. */
.page-sub svg,
.stat svg { vertical-align: -2px; margin-right: 6px; }

/* Consistent vertical rhythm between a screen's stacked blocks, so no
   template has to hand-roll a margin to avoid a collision. */
.page > .empty,
.page > .table-scroll,
.page > .module,
.page > .stats,
.page > .review-grid,
.page > .send-grid,
.page > .quote-grid,
.page > .mail-view,
.page > form,
.page > iframe { margin-bottom: var(--space-6); }
.page > *:last-child { margin-bottom: 0; }
/* The stat strip is a header element: it hugs what it describes. */
.stats + .vendor-card,
.stats + #rfq-inbox { margin-top: 0; }

/* Name and status badge as one flex row: a single controlled gap, instead
   of collapsed whitespace plus an inline margin (which stacked into a
   ragged space that changed with the font). */
.vendor-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
