/* Design tokens follow fi.treat.health (Geist, ink actions, warm-to-sky span gradient). */
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/geist-latin-wght-normal.woff2") format("woff2-variations");
  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: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/geist-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/geist-mono-latin-wght-normal.woff2") format("woff2-variations");
}

:root {
  --ink: #0f1012;
  --ink-hover: #2b2d31;
  --muted: #55585e;
  --line: #0f10121a;
  --control: #72757c;
  --surface: #fff;
  --brand: #1c63b7;
  --brand-text: #17529a;
  --brand-subtle: #d0e4ff;
  --brand-on-dark: #b0d9ff;
  --warn-bg: #ffefdc;
  --warn-ink: #8a4b0f;
  --ok-bg: #dcf3ea;
  --ok-ink: #136f63;
  --span-warm: #fec7ab;
  --span-amber: #ffefdc;
  --span-middle: #f7f3ef;
  --span-sky: #e9f6ff;
  --span-blue: #b0d9ff;
  --sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
h1:focus { outline: none; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(60% 70% at 0% 100%, var(--span-warm) 0%, transparent 70%),
    radial-gradient(55% 65% at 100% 100%, var(--span-blue) 0%, transparent 70%),
    linear-gradient(90deg, var(--span-amber) 0%, var(--span-middle) 45%, var(--span-sky) 100%);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 36px;
  padding: 22px 0 18px;
  border-bottom: 1px solid var(--line);
}
.top-logo { height: 28px; width: auto; }
.steps {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 4px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff8c;
  backdrop-filter: blur(8px);
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.steps li { padding: 9px 12px; border-radius: 999px; color: var(--muted); }
.steps li[aria-current="step"] { background: var(--brand-subtle); color: var(--ink); }
.steps li.done { color: var(--ok-ink); }

main { flex: 1; display: flex; justify-content: flex-start; padding: 48px 16px 24px; }
.panel { width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: 16px; animation: rise 0.25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

h1 { margin: 0; font-size: clamp(28px, 5vw, 38px); line-height: 1.12; font-weight: 450; letter-spacing: -0.02em; }
.lead { margin: 0; font-size: 17px; line-height: 1.5; color: var(--muted); }
.eyebrow { margin: 0; font: 500 13px/1 var(--mono); color: var(--brand-text); letter-spacing: 0.02em; }

form { display: flex; flex-direction: column; gap: 16px; margin-top: 8px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 14px; font-weight: 500; }
input, select {
  font: 400 17px/1.3 var(--sans);
  color: var(--ink);
  width: 100%;
  padding: 16px 18px;
  border: 1px solid var(--control);
  border-radius: 12px;
  background: var(--surface);
  appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 8l5 5 5-5' fill='none' stroke='%230f1012' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 18px;
  padding-right: 48px;
}
input:focus-visible, select:focus-visible, .btn:focus-visible, .link:focus-visible, .choice:focus-within {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
input[aria-invalid="true"] { border-color: #b3261e; }

.btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font: 500 15px/1 var(--sans);
  cursor: pointer;
  box-shadow: 0 8px 24px -10px #0f101266;
  transition: background 0.15s;
}
.btn:hover { background: var(--ink-hover); }
.btn svg { width: 20px; height: 20px; fill: none; stroke: var(--brand-on-dark); stroke-width: 1.6; }
.btn[aria-busy="true"] { opacity: 0.7; cursor: progress; }
.btn-ghost { justify-content: center; background: transparent; color: var(--brand-text); box-shadow: none; min-height: 44px; gap: 0.3em; }
.btn-ghost:hover { background: #ffffff80; }
.link { align-self: center; color: var(--brand-text); font-size: 15px; font-weight: 500; text-decoration: none; }
.link:hover { text-decoration: underline; }

.hint {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
}
.hint.warn { background: var(--warn-bg); color: var(--warn-ink); }
.hint.ok { background: #ffffffb3; color: var(--ink); border: 1px solid var(--line); }
.hint.err { background: #fde7e6; color: #8c1d18; }
.hint b { font-weight: 600; }

.badge { align-self: flex-start; padding: 6px 10px; border-radius: 999px; font: 500 12px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.04em; }
.badge-warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge-ok { background: var(--ok-bg); color: var(--ok-ink); }

.perks { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.perks li { position: relative; padding-left: 28px; font-size: 15px; line-height: 1.45; }
.perks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brand-subtle) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 10.5l2.5 2.5L14 7.5' fill='none' stroke='%2317529a' stroke-width='2'/%3E%3C/svg%3E") center/14px no-repeat;
}

.entity {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 12px 32px -18px #10182d40;
}
.entity-head { display: flex; gap: 14px; align-items: center; }
.monogram {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font: 600 20px/1 var(--sans);
}
.entity-name { margin: 0; font-size: 20px; font-weight: 550; line-height: 1.25; }
.entity-sub { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.mono { font-family: var(--mono); font-size: 13px; }
.conf { display: inline-flex; align-items: center; gap: 6px; }
.conf::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.conf-high { color: var(--ok-ink); }
.conf-medium { color: var(--brand); }
.conf-low { color: var(--warn-ink); }

.detected { margin: -4px 0 0; font-size: 14px; color: var(--muted); }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choices-title { margin: 4px 0 0; font-size: 14px; font-weight: 500; }
.choice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.choice input { width: 18px; height: 18px; margin: 2px 0 0; padding: 0; accent-color: var(--brand); appearance: auto; flex: none; }
.choice-name { font-weight: 500; }
.choice-meta { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }

.summary { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0; padding: 18px 20px; border-radius: 16px; background: #ffffffb3; border: 1px solid var(--line); font-size: 15px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; overflow-wrap: anywhere; }

.foot { margin: 0; padding: 16px; text-align: center; font-size: 12px; color: var(--muted); }

@media (max-width: 560px) {
  .top { margin: 0 16px; padding: 14px 0 12px; }
  .top-logo { height: 24px; }
  .steps li { padding: 8px 8px; font-size: 11px; }
  main { padding-top: 28px; }
}

main { flex-direction: column; align-items: center; }
.backbar { width: 100%; max-width: 560px; display: flex; justify-content: space-between; margin: -24px 0 16px; }
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 10px 0 6px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--brand-text);
  font: 500 14px/1 var(--sans);
  cursor: pointer;
}
.back:hover { background: #ffffff80; }
.back:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.choices-empty { margin: 0; padding: 12px 0; color: var(--muted); font-size: 14px; }
@media (max-width: 560px) { .backbar { margin: -12px 0 8px; } }
.choices-group { display: flex; flex-direction: column; gap: 8px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

/* Searchable company combobox */
.combo { position: relative; }
.field-note { color: var(--muted); font-weight: 400; }
.combo-box { position: relative; }
.combo-box input { padding-right: 52px; }
.combo-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}
.combo-toggle svg { width: 18px; height: 18px; fill: none; stroke: var(--ink); stroke-width: 1.6; }
.combo-box input[aria-expanded="true"] ~ .combo-toggle svg { transform: rotate(180deg); }
.combo-list {
  position: absolute;
  z-index: 10;
  top: 100%;
  left: 0;
  right: 0;
  margin: 6px 0 0;
  padding: 6px;
  list-style: none;
  max-height: min(360px, 50dvh);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px -16px #10182d59;
}
.combo-group { padding: 10px 10px 6px; font: 500 12px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.combo-option { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: 8px; cursor: pointer; }
.combo-option.active { background: var(--brand-subtle); }
.combo-option[aria-selected="true"] .choice-name::after { content: " ✓"; color: var(--brand); }
.combo-option .choice-meta { margin-top: 0; }
.combo-empty { padding: 12px 10px; color: var(--muted); font-size: 14px; }
#entity-selected .entity-name { font-size: 18px; }

/* Sign-in methods */
.methods { display: flex; flex-direction: column; gap: 10px; }
.method {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 64px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.method:hover { border-color: var(--control); }
.method:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.method-primary { border-color: var(--ink); box-shadow: 0 8px 24px -14px #0f101266, inset 0 0 0 1px var(--ink); }
.method-icon { flex: none; display: grid; place-items: center; width: 28px; height: 28px; color: var(--ink); }
.method-icon svg { width: 22px; height: 22px; }
.method-text { display: flex; flex-direction: column; gap: 3px; }
.method-label { font-size: 16px; font-weight: 550; }
.method-reason { font-size: 13px; color: var(--muted); }
.methods-or { margin: 4px 0; text-align: center; font: 500 12px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

.code-form { display: flex; flex-direction: column; gap: 16px; }
.code-inputs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.code-inputs input { padding: 16px 0; text-align: center; font: 500 24px/1 var(--mono); }
.method:disabled, .choice:has(input:disabled) { opacity: 0.55; cursor: not-allowed; }
