/* OrderCheck — tokens per DESIGN-DNA.md (JCI SelNav ↔ Largo) */

:root {
  --paper: #F7F9FB;
  --raised: #EDF1F5;
  --rule-line: #DEE5EC;
  --ink: #16283A;
  --ink-2: #566B7E;
  --blue: #2A6EBB;
  --tag: #B04408;        /* inspection orange — findings only */
  --pass: #2F7D62;
  --mono: "Cascadia Code", Consolas, ui-monospace, monospace;
  --ui: "Segoe UI", system-ui, sans-serif;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --r-control: 3px;
  --r-well: 4px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 13px/1.55 var(--ui);
}

::selection { background: color-mix(in srgb, var(--blue) 22%, transparent); }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 64px;
}

/* ---- masthead ---- */

.masthead {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 24px 16px;
  display: flex;
  align-items: baseline;
  gap: 16px;
  border-bottom: 1px solid var(--rule-line);
}

.wordmark {
  font: 700 15px var(--mono);
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
}
.wordmark span { color: var(--blue); }

.masthead-scope { color: var(--ink-2); font-size: 12px; }

/* ---- shared controls ---- */

button:focus-visible, a:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ---- fleet (home) ---- */

.fleet { padding-top: 32px; }

.fleet-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}

.fleet-head h1 {
  margin: 0;
  font: 700 20px/1.2 var(--mono);
  letter-spacing: -0.01em;
}

.fleet-actions { display: flex; align-items: center; gap: 20px; }

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

.upload-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-pick span {
  display: inline-block;
  font: 400 12px var(--ui);
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--rule-line);
  border-radius: var(--r-control);
  padding: 7px 12px;
  cursor: pointer;
}
.upload-pick input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }

.upload button {
  font: 700 12px var(--ui);
  color: #fff;
  background: var(--ink);
  border: 0;
  border-radius: var(--r-control);
  padding: 8px 14px;
  cursor: pointer;
  transition: background 140ms var(--ease);
}
.upload button:disabled { background: var(--rule-line); color: var(--ink-2); cursor: default; }
.upload button:not(:disabled):hover { background: #24405C; }

.rescan {
  color: var(--blue);
  font-weight: 700;
  font-size: 12px;
  text-decoration: none;
}
.rescan:hover { text-decoration: underline; }

.row-link { cursor: pointer; transition: background 140ms var(--ease); }
.row-link:hover { background: var(--raised); }
.row-link a { color: var(--blue); font-weight: 700; text-decoration: none; }

.row-waiting td { color: var(--ink-2); }

.verdict-col { white-space: nowrap; }
th.verdict-col { white-space: normal; }

.chip {
  display: inline-block;
  font: 700 11px var(--mono);
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: var(--r-control);
  border: 1px solid;
}
.chip-fail {
  color: var(--tag);
  border-color: color-mix(in srgb, var(--tag) 35%, transparent);
  background: color-mix(in srgb, var(--tag) 9%, transparent);
}
.chip-pass {
  color: var(--pass);
  border-color: color-mix(in srgb, var(--pass) 35%, transparent);
  background: color-mix(in srgb, var(--pass) 9%, transparent);
}
.chip-wait {
  color: var(--ink-2);
  border-color: var(--rule-line);
  background: none;
  font-weight: 400;
}

.chip-sub {
  margin-left: 8px;
  font-size: 11px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.fleet-foot {
  margin-top: 24px;
  font-size: 12px;
  color: var(--ink-2);
  max-width: 72ch;
}

.empty-fleet { padding-top: 64px; max-width: 60ch; }
.empty-fleet h1 { font: 700 20px var(--mono); margin: 0 0 8px; }
.empty-fleet p { color: var(--ink-2); }
.empty-fleet a { color: var(--blue); font-weight: 700; }

.error {
  margin: 0 0 24px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--tag) 40%, transparent);
  border-radius: var(--r-well);
  background: color-mix(in srgb, var(--tag) 8%, transparent);
  color: var(--tag);
}

.empty { margin-top: 40px; color: var(--ink-2); }

/* ---- verdict band ---- */

.verdict-band {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 40px;
  padding: 40px 0 32px;
}

.verdict-meta { min-width: 0; flex: 1; }

.verdict-band h1 {
  margin: 0 0 12px;
  font: 700 20px/1.2 var(--mono);
  letter-spacing: -0.01em;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 32px;
  margin: 0 0 24px;
}
.meta div { display: flex; gap: 8px; align-items: baseline; }
.meta dt {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.meta dd { margin: 0; font-family: var(--mono); font-size: 12px; }

/* funnel — the quiet half of the signature */

.funnel-bar {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--raised);
  max-width: 520px;
}
.seg { min-width: 0; }
.seg-pass { background: var(--pass); opacity: 0.55; }
.seg-fail { background: var(--tag); min-width: 24px; }

@media (prefers-reduced-motion: no-preference) {
  .funnel-bar .seg {
    transform-origin: left;
    animation: fill 600ms var(--ease);
  }
  @keyframes fill { from { transform: scaleX(0); } }
}

.funnel-caption {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.funnel-caption strong { color: var(--ink); font-size: 13px; }
.funnel-caption em { font-style: normal; font-weight: 700; }

.fail-ink { color: var(--tag); }

/* the stamp — signature, gets the whole weird budget */

.stamp {
  align-self: center;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 208px;
  padding: 20px 24px;
  border: 3px double currentColor;
  border-radius: 6px;
  transform: rotate(-1.5deg);
  text-transform: uppercase;
}
.stamp-fail { color: var(--tag); }
.stamp-pass { color: var(--pass); }

.stamp-count {
  font: 700 44px/1 var(--mono);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stamp-word {
  font: 700 11px var(--ui);
  letter-spacing: 0.09em;
}

@media (prefers-reduced-motion: no-preference) {
  .stamp {
    animation: stamp 240ms 480ms var(--ease) backwards;
  }
  @keyframes stamp {
    from { opacity: 0; transform: rotate(-1.5deg) scale(1.12); }
  }
}

/* ---- coverage notes ---- */

.coverage {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
  font-size: 12px;
}
.coverage li { padding: 2px 0; }

/* ---- findings ledger ---- */

.ledger { margin-top: 40px; overflow-x: auto; }
.ledger table { min-width: 560px; }

.ledger-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.ai-run {
  font: 700 12px var(--ui);
  color: var(--blue);
  background: none;
  border: 1px solid color-mix(in srgb, var(--blue) 40%, transparent);
  border-radius: var(--r-control);
  padding: 7px 14px;
  cursor: pointer;
  transition: background 140ms var(--ease);
}
.ai-run:hover { background: color-mix(in srgb, var(--blue) 8%, transparent); }
.ai-run:disabled { color: var(--ink-2); border-color: var(--rule-line); cursor: progress; }

.ai-badge {
  font: 700 11px var(--mono);
  letter-spacing: 0.04em;
  color: var(--blue);
}

.ai-row td {
  padding: 6px 12px 14px 24px;
  font-size: 12px;
  color: var(--ink);
  border-bottom: 1px solid var(--rule-line);
}

.ai-verdict {
  display: inline-block;
  margin-right: 8px;
  font: 700 10px var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: var(--r-control);
  border: 1px solid;
}
.ai-verdict-defect {
  color: var(--tag);
  border-color: color-mix(in srgb, var(--tag) 35%, transparent);
}
.ai-verdict-likely-equivalent {
  color: var(--pass);
  border-color: color-mix(in srgb, var(--pass) 35%, transparent);
}
.ai-verdict-needs-confirmation {
  color: var(--blue);
  border-color: color-mix(in srgb, var(--blue) 35%, transparent);
}

.ledger h2 {
  margin: 0 0 12px;
  font: 700 15px var(--mono);
  letter-spacing: -0.005em;
}

.ledger-quiet h2 { color: var(--ink-2); font-size: 13px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 0 12px 6px 0;
  border-bottom: 1px solid var(--ink);
}

td {
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid var(--rule-line);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.mono { font-family: var(--mono); font-size: 12px; }

.rule-note {
  display: block;
  font: 400 11px var(--ui);
  color: var(--ink-2);
}

.ledger th:nth-child(1) { width: 26%; }
.ledger th:nth-child(2) { width: 34%; }

.num { text-align: right; white-space: nowrap; }
th.num { text-align: right; }
td.num { color: var(--ink); font-family: var(--mono); font-size: 12px; }
.count { color: var(--ink-2); }

.ledger-quiet td, .ledger-quiet .mono { color: var(--ink-2); }

/* ---- footer ---- */

.run-foot {
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--rule-line);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.pair-names { color: var(--ink-2); font-size: 11px; overflow-wrap: anywhere; }

.again {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.again:hover { text-decoration: underline; }

/* ---- login (deployed demo gate) ---- */

.login-body { display: grid; min-height: 100dvh; place-items: center; }

.login {
  width: min(400px, calc(100vw - 48px));
  padding: 0;
}

.login-panel {
  background: #13223A;
  border-radius: 6px 6px 0 0;
  padding: 40px 36px 32px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.login-logo { display: block; margin-bottom: 12px; }

.login-wordmark {
  margin: 0;
  font: 700 22px var(--mono);
  letter-spacing: 0.04em;
  color: #fff;
}
.login-wordmark span { color: #7FB3E8; }

.login-scope {
  margin: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
}

.login-form {
  background: #fff;
  border: 1px solid var(--rule-line);
  border-top: 0;
  border-radius: 0 0 6px 6px;
  padding: 28px 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.login-input {
  font: 400 15px var(--mono);
  color: var(--ink);
  border: 1px solid var(--rule-line);
  border-radius: var(--r-well);
  padding: 10px 12px;
  min-height: 44px;
  caret-color: var(--blue);
}
.login-input:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

.run {
  margin-top: 12px;
  font: 700 14px var(--ui);
  color: #fff;
  background: var(--ink);
  border: 0;
  border-radius: var(--r-control);
  padding: 12px 28px;
  min-height: 44px;
  cursor: pointer;
  transition: background 140ms var(--ease);
}
.run:hover { background: #24405C; }

/* ---- narrow viewports ---- */

@media (max-width: 720px) {
  .pair { flex-direction: column; align-items: stretch; }
  .pair-vs { display: none; }
  .verdict-band { flex-direction: column; gap: 24px; }
  .stamp { align-self: flex-start; }
  .num { white-space: normal; }
}
