@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/static/fonts/AtkinsonHyperlegible-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/static/fonts/AtkinsonHyperlegible-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/static/fonts/BricolageGrotesque-Variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/static/fonts/JetBrainsMono-Variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
}

:root {
  --canvas: #edf0ee;
  --panel: #f7f8f6;
  --paper: #fff;
  --ink: #1c272d;
  --ink-2: #3a4850;
  --ink-3: #5f6d73;
  --line: #cdd5d2;
  --line-2: #8c989c;
  --oak: #c7a57a;
  --oak-deep: #6b4e2c;
  --oak-wash: rgb(199 165 122 / 22%);
  --accent: #1f6e86;
  --accent-hover: #175a6e;
  --accent-wash: rgb(31 110 134 / 12%);
  --on-accent: #fff;
  --ok-bg: #e2efe6;
  --ok-fg: #1f5e36;
  --warn-bg: #f6ecd9;
  --warn-fg: #6e4a0a;
  --err-bg: #f5e1de;
  --err-fg: #8e2418;
  --idle-bg: #e7eaeb;
  --idle-fg: #3e4a50;
  --dark-band: #1c272d;
  --dark-band-fg: #e3eae8;
  --dark-band-mute: #aebcba;
  --veil: rgb(237 240 238 / 86%);
  --glass-bg: rgb(250 252 252 / 62%);
  --glass-edge: rgb(255 255 255 / 85%);
  --glass-tint: rgb(220 231 234 / 50%);
  --glow-a: rgb(255 250 238 / 80%);
  --glow-b: rgb(199 220 222 / 50%);
  --shadow: 0 1px 0 rgb(28 39 45 / 5%), 0 24px 50px -32px rgb(28 39 45 / 45%);
  --display: "Bricolage Grotesque", Georgia, serif;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --bg: var(--canvas);
  --card: var(--paper);
  --muted: var(--ink-3);
  --soft: var(--idle-bg);
  --pri: var(--accent);
  --pri2: var(--accent-hover);
  --priT: var(--accent-wash);
  --good: var(--ok-fg);
  --goodT: var(--ok-bg);
  --warn: var(--warn-fg);
  --warnT: var(--warn-bg);
  --bad: var(--err-fg);
  --badT: var(--err-bg);
  --info: var(--accent);
  --infoT: var(--accent-wash);
  --r: 18px;
  --sh: var(--shadow);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #141b1f;
    --panel: #1b2429;
    --paper: #202b31;
    --ink: #e6ecea;
    --ink-2: #c2cdcb;
    --ink-3: #93a2a3;
    --line: #2e3b41;
    --line-2: #56666c;
    --oak: #d2b188;
    --oak-deep: #ddbe94;
    --oak-wash: rgb(210 177 136 / 16%);
    --accent: #4fa3bd;
    --accent-hover: #6bb6cd;
    --accent-wash: rgb(79 163 189 / 16%);
    --on-accent: #0e1a1f;
    --ok-bg: #1e3527;
    --ok-fg: #9ad3ae;
    --warn-bg: #3a2e17;
    --warn-fg: #ebc77f;
    --err-bg: #3d211d;
    --err-fg: #f0a397;
    --idle-bg: #2a3439;
    --idle-fg: #b8c4c6;
    --dark-band: #0e1417;
    --dark-band-fg: #e3eae8;
    --dark-band-mute: #9daead;
    --veil: rgb(20 27 31 / 84%);
    --glass-bg: rgb(40 54 61 / 55%);
    --glass-edge: rgb(160 190 198 / 28%);
    --glass-tint: rgb(79 163 189 / 8%);
    --glow-a: rgb(79 163 189 / 12%);
    --glow-b: rgb(210 177 136 / 8%);
    --shadow: 0 1px 0 rgb(0 0 0 / 20%), 0 24px 50px -30px rgb(0 0 0 / 70%);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 16px / 1.55 var(--body);
  -webkit-font-smoothing: antialiased;
}

body {
  position: relative;
}

body::before,
body::after {
  position: fixed;
  z-index: 0;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

body::before {
  top: -34vmax;
  right: -24vmax;
  background: radial-gradient(circle, var(--glow-a), transparent 62%);
}

body::after {
  bottom: -42vmax;
  left: -32vmax;
  background: radial-gradient(circle, var(--glow-b), transparent 60%);
}

main {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px 20px;
}

.hero {
  width: min(100%, 760px);
  padding: clamp(28px, 7vw, 64px);
  border: 0;
  border-radius: var(--r);
  background:
    linear-gradient(160deg, var(--glass-edge), transparent 22%),
    linear-gradient(var(--glass-tint), var(--glass-tint)),
    var(--glass-bg);
  box-shadow:
    inset 0 0 0 1px var(--glass-edge),
    0 30px 60px -34px rgb(28 39 45 / 55%);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--oak-deep);
  font: 500 12px / 1.5 var(--mono);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-wrap: balance;
}

h1 {
  max-width: 16ch;
  font-size: clamp(36px, 7vw, 64px);
}

.intro {
  max-width: 58ch;
  margin: 18px 0 26px;
  color: var(--ink-2);
  font-size: 18px;
}

.btn {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 10px 20px;
  background: var(--accent);
  box-shadow: 0 10px 26px -14px rgb(31 110 134 / 75%);
  color: var(--on-accent);
  font: 700 15px var(--body);
  text-decoration: none;
  transition:
    background-color 0.3s var(--ease),
    transform 0.3s var(--ease);
}

.btn:hover {
  transform: translateY(-1px);
  background: var(--accent-hover);
}

.btn.ghost {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--line-2);
  color: var(--ink);
}

.btn.ghost:hover {
  background: var(--panel);
}

.card {
  overflow: hidden;
  border-radius: var(--r);
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 0 clamp(20px, 5vw, 72px);
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font: 700 17px var(--display);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  background: var(--dark-band);
  color: var(--dark-band-fg);
  font: 700 17px var(--display);
}

.brand-light {
  color: var(--ink-3);
  font-weight: 500;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--ink-3);
  font: 12px var(--mono);
}

.environment-pill,
.count-label {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--panel);
  color: var(--ink-2);
}

main.dashboard {
  display: block;
  min-height: calc(100vh - 72px);
  padding: clamp(30px, 5vw, 64px) clamp(20px, 5vw, 72px);
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto 34px;
  max-width: 1440px;
}

.page-heading h1 {
  font-size: clamp(38px, 5vw, 58px);
}

.page-heading .intro {
  margin-bottom: 0;
  font-size: 17px;
}

.page-heading .btn {
  flex: 0 0 auto;
}

.stats-grid {
  display: grid;
  max-width: 1440px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0 auto 28px;
}

.stat-card {
  display: grid;
  min-height: 140px;
  align-content: space-between;
  gap: 8px;
  border-radius: var(--r);
  padding: 22px 24px;
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
}

.stat-card-alert {
  background: linear-gradient(135deg, var(--warn-bg), var(--paper) 75%);
}

.stat-label,
.stat-note {
  color: var(--ink-3);
  font-size: 14px;
}

.stat-value {
  font: 700 34px / 1 var(--display);
}

.panel {
  max-width: 1440px;
  margin: 0 auto;
  border-radius: var(--r);
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 28px;
}

.panel-heading .eyebrow {
  margin-bottom: 5px;
}

.panel-heading h2 {
  font-size: 28px;
}

.table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--r) var(--r);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

thead {
  background: var(--panel);
  color: var(--ink-3);
  font: 11px var(--mono);
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

th,
td {
  padding: 16px 20px;
  vertical-align: middle;
}

thead th:first-child,
tbody th:first-child {
  padding-left: 28px;
}

tbody tr + tr {
  border-top: 1px solid var(--line);
}

tbody tr:hover {
  background: var(--panel);
}

tbody th {
  min-width: 150px;
  font-weight: 400;
}

.commission-number {
  display: block;
  color: var(--ink);
  font: 500 15px var(--mono);
}

.commission-location,
.muted {
  display: block;
  margin-top: 4px;
  color: var(--ink-3);
  font-size: 13px;
}

.supplier-list {
  display: flex;
  min-width: 220px;
  flex-wrap: wrap;
  gap: 6px;
}

.supplier-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 8px;
  background: var(--panel);
  font-size: 12px;
  white-space: nowrap;
}

.supplier-status {
  color: var(--ink-3);
  text-transform: capitalize;
}

.date-cell {
  min-width: 120px;
  font: 13px var(--mono);
  white-space: nowrap;
}

.signal {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.signal-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentcolor;
}

.signal-red {
  background: var(--err-bg);
  color: var(--err-fg);
}

.signal-yellow {
  background: var(--warn-bg);
  color: var(--warn-fg);
}

.signal-green {
  background: var(--ok-bg);
  color: var(--ok-fg);
}

.signal-idle {
  background: var(--idle-bg);
  color: var(--idle-fg);
}

.reason-cell {
  min-width: 240px;
  max-width: 360px;
  color: var(--ink-2);
  font-size: 13px;
}

.empty-state {
  display: grid;
  min-height: 280px;
  align-content: center;
  justify-items: center;
  padding: 32px;
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--ok-bg);
  color: var(--ok-fg);
  font-size: 22px;
}

.empty-state h3 {
  font-size: 22px;
}

.empty-state p {
  max-width: 48ch;
  color: var(--ink-3);
}

.privacy-note {
  max-width: 1440px;
  margin: 20px auto 0;
  color: var(--ink-3);
  font-size: 12px;
}

.stat-link {
  color: var(--ink-3);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
}

.stat-link:hover {
  color: var(--accent);
  text-decoration-color: currentcolor;
}

.intake-panel,
.review-panel {
  margin-bottom: 20px;
}

.upload-form {
  padding: 0 28px 24px;
}

.upload-form > label,
.review-actions label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
}

.upload-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.upload-controls input,
.review-actions input,
.review-actions select {
  min-height: 42px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--paper);
  color: var(--ink);
  font: 14px var(--body);
}

.review-list {
  display: grid;
  gap: 1px;
  border-top: 1px solid var(--line);
}

.review-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 24px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
}

.review-card:last-child {
  border-bottom: 0;
}

.review-summary > strong {
  font-size: 16px;
}

.review-summary > p,
.evidence,
.review-empty {
  color: var(--ink-3);
  font-size: 13px;
}

.extraction-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin: 14px 0;
}

.extraction-fields div {
  min-width: 0;
}

.extraction-fields dt {
  color: var(--ink-3);
  font-size: 11px;
}

.extraction-fields dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.evidence {
  margin-bottom: 0;
  font-style: italic;
}

.review-actions {
  align-self: center;
}

.review-actions form:first-child {
  display: grid;
  gap: 10px;
}

.date-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.date-inputs label {
  margin: 0;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 400;
}

.date-inputs input {
  width: 100%;
  margin-top: 4px;
}

.review-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.review-buttons .btn {
  min-height: 38px;
  padding: 8px 14px;
  font-size: 13px;
}

.review-buttons .btn:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.review-empty {
  margin: 0;
  border-top: 1px solid var(--line);
  padding: 24px 28px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 760px) {
  .topbar {
    min-height: 64px;
  }

  .topbar-meta {
    gap: 8px;
  }

  .environment-pill {
    display: none;
  }

  main.dashboard {
    padding-top: 34px;
  }

  .page-heading {
    align-items: start;
    flex-direction: column;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .review-card {
    grid-template-columns: 1fr;
    padding: 18px 20px;
  }

  .upload-form {
    padding: 0 20px 20px;
  }

  .upload-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .extraction-fields {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .stat-card {
    min-height: 112px;
  }

  .panel-heading {
    padding: 20px;
  }

  table {
    min-width: 900px;
  }
}
