/* AirLoom — Airbnb-palette identity.
   Tokens first (light default, dark via media query, both overridable by
   the data-theme attribute); every component below styles through tokens
   only. Class names here must stay in sync with what app.js renders. */

:root {
  color-scheme: light dark;

  --ground: #ffffff;
  --panel: #ffffff;
  --panel-raised: #f7f7f7;
  --panel-line: rgba(34, 34, 34, 0.09);
  --panel-line-strong: rgba(34, 34, 34, 0.17);
  --ink: #222222;
  --ink-muted: #717171;

  --rausch: #ff385c;
  --rausch-glow: rgba(255, 56, 92, 0.26);
  --grad: linear-gradient(to right, #e61e4d 0%, #e31c5f 50%, #d70466 100%);
  --babu: #00a699;

  /* Contrasted input wells inside the pill search bar */
  --field: #efefef;
  --field-hover: #e7e7e7;
  --field-line: rgba(34, 34, 34, 0.12);

  --pill-ink: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 6px 16px rgba(0, 0, 0, 0.10);
  --shadow-pill: 0 3px 12px rgba(0, 0, 0, 0.10), 0 1px 2px rgba(0, 0, 0, 0.08);
  --shadow-drawer: -12px 0 40px rgba(0, 0, 0, 0.18);

  /* Deal-score bands (referenced by name from app.js inline styles) */
  --avoid: #c13515;
  --high-risk: #e8590c;
  --possible-weak: #b58800;
  --worth-reviewing: #55958b;
  --strong-target: #00a699;
  --priority-deal: #ff385c;

  --sans: -apple-system, "SF Pro Display", BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #161616;
    --panel: #1f1f1f;
    --panel-raised: #282828;
    --panel-line: rgba(255, 255, 255, 0.09);
    --panel-line-strong: rgba(255, 255, 255, 0.16);
    --ink: #f7f7f7;
    --ink-muted: #a8a8a8;
    --rausch: #ff5a7a;
    --rausch-glow: rgba(255, 90, 122, 0.30);
    --babu: #2cbfb3;
    --field: #2a2a2a;
    --field-hover: #313131;
    --field-line: rgba(255, 255, 255, 0.13);
    --pill-ink: #161616;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-pill: 0 3px 14px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-drawer: -12px 0 40px rgba(0, 0, 0, 0.6);
    --avoid: #e4674c;
    --high-risk: #f0824a;
    --possible-weak: #d9ac3a;
    --worth-reviewing: #7db8ae;
    --strong-target: #2cbfb3;
    --priority-deal: #ff5a7a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #161616; --panel: #1f1f1f; --panel-raised: #282828;
  --panel-line: rgba(255, 255, 255, 0.09); --panel-line-strong: rgba(255, 255, 255, 0.16);
  --ink: #f7f7f7; --ink-muted: #a8a8a8;
  --rausch: #ff5a7a; --rausch-glow: rgba(255, 90, 122, 0.30); --babu: #2cbfb3;
  --field: #2a2a2a; --field-hover: #313131; --field-line: rgba(255, 255, 255, 0.13);
  --pill-ink: #161616;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-pill: 0 3px 14px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-drawer: -12px 0 40px rgba(0, 0, 0, 0.6);
  --avoid: #e4674c; --high-risk: #f0824a; --possible-weak: #d9ac3a;
  --worth-reviewing: #7db8ae; --strong-target: #2cbfb3; --priority-deal: #ff5a7a;
}
:root[data-theme="light"] {
  color-scheme: light;
  --ground: #ffffff; --panel: #ffffff; --panel-raised: #f7f7f7;
  --panel-line: rgba(34, 34, 34, 0.09); --panel-line-strong: rgba(34, 34, 34, 0.17);
  --ink: #222222; --ink-muted: #717171;
  --rausch: #ff385c; --rausch-glow: rgba(255, 56, 92, 0.26); --babu: #00a699;
  --field: #efefef; --field-hover: #e7e7e7; --field-line: rgba(34, 34, 34, 0.12);
  --pill-ink: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 6px 16px rgba(0, 0, 0, 0.10);
  --shadow-pill: 0 3px 12px rgba(0, 0, 0, 0.10), 0 1px 2px rgba(0, 0, 0, 0.08);
  --shadow-drawer: -12px 0 40px rgba(0, 0, 0, 0.18);
  --avoid: #c13515; --high-risk: #e8590c; --possible-weak: #b58800;
  --worth-reviewing: #55958b; --strong-target: #00a699; --priority-deal: #ff385c;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--ground); color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
body { min-height: 100vh; }
a { color: var(--rausch); }
::selection { background: var(--rausch); color: #fff; }
button { font-family: var(--sans); }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 26px 90px; }

/* ---------- Hero: the living loom ---------- */
.hero { position: relative; overflow: hidden; }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 0%, var(--ground) 94%);
}
/* padding-block (not the padding shorthand) so this never clobbers
   .wrap's horizontal padding when both classes land on the same element -
   that collision was invisible on desktop (wrap's max-width auto-centers
   regardless) but zeroed the side margins flush on mobile. */
.hero-inner { position: relative; z-index: 2; padding-block: 34px 30px; }

.top-nav {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 20px; flex-wrap: wrap; margin-bottom: 44px;
}
.wordmark {
  font-size: 21px; font-weight: 800; letter-spacing: -0.02em; margin: 0;
  display: flex; align-items: center; gap: 9px; color: var(--rausch);
}
.wordmark svg { display: block; }
.nav-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.run-meta { font-size: 12.5px; color: var(--ink-muted); }
.run-meta strong { color: var(--ink); font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; }

.account-bar { display: flex; align-items: center; gap: 10px; font-size: 13px; flex-wrap: wrap; }
.account-bar .credits { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.account-bar .credits.low { color: var(--avoid); }
.account-bar button {
  font-family: var(--sans); font-size: 12.5px; font-weight: 500; padding: 7px 14px;
  border-radius: 20px; border: 1px solid var(--panel-line-strong);
  background: var(--panel); color: var(--ink); cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.account-bar button:hover { border-color: var(--ink); box-shadow: var(--shadow-pill); }
.account-bar button.primary { background: var(--grad); color: #fff; border: none; }

.hero-headline { max-width: 640px; }
.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--rausch); margin: 0 0 12px; display: flex; align-items: center; gap: 8px;
}
.eyebrow::before { content: ""; width: 16px; height: 2px; border-radius: 1px; background: var(--rausch); }
.hero-title {
  font-size: clamp(28px, 4vw, 44px); font-weight: 800; letter-spacing: -0.03em;
  line-height: 1.07; margin: 0 0 12px; text-wrap: balance;
}
.hero-title em { font-style: normal; color: var(--rausch); }
.hero-sub { font-size: 15px; color: var(--ink-muted); line-height: 1.5; margin: 0; max-width: 500px; }

/* ---------- Run form: segmented pill search bar ---------- */
.run-form {
  display: flex; flex-wrap: wrap; align-items: stretch; gap: 6px;
  background: var(--panel); border: 1px solid var(--panel-line);
  border-radius: 36px; box-shadow: var(--shadow-pill);
  padding: 8px; margin-top: 28px;
  transition: box-shadow 0.2s ease;
}
.run-form:focus-within { box-shadow: 0 5px 20px rgba(0, 0, 0, 0.16), 0 1px 2px rgba(0, 0, 0, 0.08); }

.field {
  display: flex; flex-direction: column; justify-content: center; gap: 3px;
  padding: 8px 16px; border-radius: 28px;
  background: var(--field); border: 1px solid var(--field-line);
  transition: background 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  flex: 1 1 104px; min-width: 0;
}
.field:hover { background: var(--field-hover); }
.field:focus-within {
  background: var(--panel);
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--rausch);
}
.field.mode { flex: 0 1 128px; }
.field.grow { flex: 1.5 1 150px; }
.field.state { flex: 0 1 84px; }
.field label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em; color: var(--ink);
  white-space: nowrap; cursor: inherit;
}
.field input, .field select {
  font-family: var(--sans); font-size: 14px; padding: 0; border: none;
  background: none; color: var(--ink); width: 100%; min-width: 0;
}
.field input::placeholder { color: var(--ink-muted); }
.field input:focus, .field select:focus { outline: none; }

.run-btn {
  width: 50px; height: 50px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  align-self: center; margin-left: 4px; flex-shrink: 0;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.run-btn svg { display: block; }
.run-btn:hover { transform: scale(1.05); box-shadow: 0 4px 14px var(--rausch-glow); }
.run-btn:disabled { opacity: 0.55; cursor: progress; transform: none; box-shadow: none; }

.run-btn:focus-visible, .account-bar button:focus-visible, .cta-btn:focus-visible,
.plan-card:focus-visible, tr:focus-visible, .search:focus, select:focus, .drawer-close:focus-visible {
  outline: 2px solid var(--rausch); outline-offset: 2px;
}

.run-status-row { min-height: 22px; margin-top: 12px; }
.run-status { font-size: 13px; color: var(--ink-muted); }
.run-status.err { color: var(--avoid); }

/* ---------- Stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 6px 0 26px; }
.stat {
  background: var(--panel); border: 1px solid var(--panel-line);
  border-radius: 16px; padding: 18px 20px; box-shadow: var(--shadow);
}
.stat-label {
  font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--ink-muted); margin-bottom: 9px;
}
.stat-value {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 27px; font-weight: 600; letter-spacing: -0.01em;
}
.stat-value.warn { color: var(--avoid); }
.stat-value.ok { color: var(--babu); }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search {
  flex: 1 1 220px; font-family: var(--sans); font-size: 14px; padding: 10px 18px;
  border: 1px solid var(--field-line); border-radius: 24px;
  background: var(--field); color: var(--ink);
}
.search:focus { background: var(--panel); }
select {
  font-family: var(--sans); font-size: 13px; padding: 9px 14px;
  border: 1px solid var(--field-line); border-radius: 24px;
  background: var(--field); color: var(--ink);
}

.legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-muted); margin-bottom: 16px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---------- Table ---------- */
.table-scroll {
  overflow-x: auto; background: var(--panel);
  border: 1px solid var(--panel-line); border-radius: 16px; box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 880px; }
thead th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--ink-muted); font-weight: 600; padding: 13px 16px 11px;
  border-bottom: 1px solid var(--panel-line); white-space: nowrap; user-select: none;
}
tbody tr {
  border-bottom: 1px solid var(--panel-line); cursor: pointer;
  transition: background 0.12s ease;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover, tbody tr:focus-visible { background: var(--panel-raised); }
tbody td { padding: 12px 16px; vertical-align: middle; white-space: nowrap; }
td.addr { white-space: normal; max-width: 240px; font-weight: 500; }
td.addr .nb { display: block; font-size: 11.5px; color: var(--ink-muted); margin-top: 2px; font-weight: 400; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono);
  font-variant-numeric: tabular-nums; font-size: 12.5px; font-weight: 700;
  padding: 3px 10px; border-radius: 20px; color: var(--pill-ink);
}
.chip {
  display: inline-block; font-size: 11px; font-weight: 500; padding: 3px 10px;
  border-radius: 20px; border: 1px solid var(--panel-line-strong); color: var(--ink-muted);
}
.chip.rejected { color: var(--avoid); border-color: var(--avoid); }
.chip.scored { color: var(--babu); border-color: var(--babu); }

.empty, .placeholder {
  padding: 44px 28px; text-align: center; color: var(--ink-muted); font-size: 14px;
  border: 1px dashed var(--panel-line-strong); border-radius: 16px; line-height: 1.6;
}

.note {
  font-size: 12.5px; color: var(--ink-muted);
  border-top: 1px dashed var(--panel-line-strong);
  padding-top: 16px; margin-top: 24px; line-height: 1.55;
}

/* ---------- Detail drawer ---------- */
.scrim {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4);
  opacity: 0; pointer-events: none; transition: opacity 0.18s ease; z-index: 10;
}
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 94vw);
  background: var(--panel); border-left: 1px solid var(--panel-line);
  border-radius: 20px 0 0 20px; box-shadow: var(--shadow-drawer);
  transform: translateX(102%); transition: transform 0.22s ease; z-index: 11;
  overflow-y: auto; padding: 28px 28px 60px;
}
.drawer.open { transform: translateX(0); }
.drawer-close {
  position: absolute; top: 18px; right: 20px; width: 34px; height: 34px;
  border-radius: 50%; background: var(--field); border: none;
  color: var(--ink); font-size: 19px; line-height: 1; cursor: pointer;
}
.drawer-close:hover { background: var(--field-hover); }
.drawer h2 {
  font-size: 21px; font-weight: 700; letter-spacing: -0.01em;
  margin: 0 34px 3px 0; text-wrap: balance;
}
.drawer .drawer-nb { color: var(--ink-muted); font-size: 13px; margin-bottom: 18px; }
.drawer-score-row { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
.drawer-score-row .pill { font-size: 15px; padding: 5px 14px; }

.section-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-muted); margin: 22px 0 10px; font-weight: 700;
}
.kv { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; font-size: 13.5px; }
.kv div:nth-child(odd) { color: var(--ink-muted); }
.kv div:nth-child(even) {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  text-align: right; font-weight: 500;
}

.bar-row {
  display: grid; grid-template-columns: 130px 1fr 34px; align-items: center;
  gap: 8px; margin-bottom: 7px; font-size: 12.5px;
}
.bar-row .lbl { color: var(--ink-muted); text-transform: capitalize; }
/* app.js emits these as <span>s - explicit display:block, or the fill's
   height collapses and the bar renders as an empty track */
.bar-track { display: block; height: 5px; border-radius: 3px; background: var(--panel-line); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 3px; }
.bar-row .val { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }

.reason-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.reason-list li {
  padding: 9px 12px; margin-bottom: 6px;
  border-left: 3px solid var(--avoid); border-radius: 0 8px 8px 0;
  background: var(--panel-raised);
}
.reason-list li strong { display: block; font-size: 13px; }
.reason-list li span { color: var(--ink-muted); font-size: 12px; }

/* ---------- Auth / billing modals ---------- */
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.97);
  width: min(400px, 92vw); background: var(--panel); border: 1px solid var(--panel-line);
  border-radius: 20px; box-shadow: var(--shadow-pill); padding: 28px;
  z-index: 21; opacity: 0; pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.modal.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.modal.modal-wide { width: min(660px, 94vw); }
.modal h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 4px; }
.modal h3 { font-size: 14px; font-weight: 700; margin: 22px 0 10px; }
.modal-sub { color: var(--ink-muted); font-size: 13px; line-height: 1.5; margin: 0 0 16px; }
.modal-status { font-size: 12.5px; color: var(--ink-muted); min-height: 1.2em; margin-top: 10px; }
.modal-status.err { color: var(--avoid); }

#loginForm { display: flex; gap: 8px; }
#loginForm input {
  flex: 1; font-family: var(--sans); font-size: 14px; padding: 10px 16px;
  border: 1px solid var(--field-line); border-radius: 24px;
  background: var(--field); color: var(--ink); min-width: 0;
}
#loginForm input:focus { outline: none; background: var(--panel); box-shadow: 0 0 0 2px var(--rausch); border-color: transparent; }
.cta-btn {
  font-size: 14px; font-weight: 600; padding: 10px 20px; border-radius: 24px;
  border: none; background: var(--grad); color: #fff; cursor: pointer; white-space: nowrap;
}
.cta-btn:hover { filter: brightness(1.06); }

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.plan-card {
  border: 1px solid var(--panel-line-strong); border-radius: 16px; padding: 18px 16px;
  display: flex; flex-direction: column; gap: 5px; text-align: left;
  background: none; cursor: pointer; font-family: var(--sans); color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.plan-card:hover { border-color: var(--rausch); box-shadow: var(--shadow); transform: translateY(-2px); }
.plan-card .plan-name { font-weight: 600; font-size: 14px; }
.plan-card .plan-price {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 23px; font-weight: 600; letter-spacing: -0.01em;
}
.plan-card .plan-detail { font-size: 12px; color: var(--ink-muted); }
.plan-card.featured { border-color: var(--rausch); box-shadow: 0 0 0 1px var(--rausch); }
.plan-card.featured:hover { box-shadow: 0 0 0 1px var(--rausch), var(--shadow); }
.plan-flag {
  align-self: flex-start; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: #fff; background: var(--grad);
  padding: 3px 9px; border-radius: 10px; margin-bottom: 3px;
}

.spinner {
  display: inline-block; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--panel-line-strong); border-top-color: var(--rausch);
  animation: spin 0.7s linear infinite; vertical-align: -2px; margin-right: 7px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- OAuth sign-in buttons ---------- */
.oauth-row { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.oauth-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--sans); font-size: 14px; font-weight: 600; padding: 10px 16px;
  border-radius: 24px; border: 1px solid var(--panel-line-strong);
  background: var(--panel); color: var(--ink); cursor: pointer; width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.oauth-btn:hover { border-color: var(--ink); box-shadow: var(--shadow-pill); }
.oauth-btn svg { flex-shrink: 0; }
.or-divider {
  display: flex; align-items: center; gap: 12px; margin: 14px 0;
  font-size: 11.5px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.06em;
}
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1px; background: var(--panel-line); }

/* ---------- MFA modals (verify gate + code inputs) ---------- */
.mfa-form { display: flex; gap: 8px; }
.mfa-form input {
  flex: 1; font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 17px; letter-spacing: 0.2em; text-align: center; padding: 10px 14px;
  border: 1px solid var(--field-line); border-radius: 24px;
  background: var(--field); color: var(--ink); min-width: 0;
}
.mfa-form input:focus { outline: none; background: var(--panel); box-shadow: 0 0 0 2px var(--rausch); border-color: transparent; }

/* ---------- Members portal ---------- */
.portal { max-width: 900px; margin: 0 auto; padding: 34px 26px 90px; }
.portal-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.portal-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.portal-nav { display: flex; gap: 10px; align-items: center; }
.pcard {
  background: var(--panel); border: 1px solid var(--panel-line); border-radius: 16px;
  box-shadow: var(--shadow); padding: 24px; margin-bottom: 16px;
}
.pcard h2 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 4px; }
.pcard .pcard-sub { font-size: 13px; color: var(--ink-muted); margin: 0 0 16px; line-height: 1.5; }
.pcard-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.pstats { display: flex; gap: 34px; flex-wrap: wrap; }
.pstat .stat-label { margin-bottom: 5px; }
.pstat .stat-value { font-size: 22px; }
.factor-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--panel-line); border-radius: 12px; margin-bottom: 8px;
}
.factor-row .f-name { font-size: 13.5px; font-weight: 600; }
.factor-row .f-meta { font-size: 12px; color: var(--ink-muted); }
.factor-row button { flex-shrink: 0; }
.qr-box {
  display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap;
  padding: 16px; border: 1px dashed var(--panel-line-strong); border-radius: 12px; margin: 14px 0;
}
.qr-box .qr-svg { width: 148px; height: 148px; background: #fff; border-radius: 8px; padding: 8px; }
.qr-box .qr-svg svg { width: 100%; height: 100%; display: block; }
.qr-steps { flex: 1; min-width: 220px; font-size: 13px; color: var(--ink-muted); line-height: 1.6; }
.qr-steps code {
  font-family: var(--mono); font-size: 12px; background: var(--field);
  padding: 2px 7px; border-radius: 6px; word-break: break-all; color: var(--ink);
}
.portal .table-scroll table { min-width: 620px; }
.pill-btn {
  font-family: var(--sans); font-size: 12.5px; font-weight: 500; padding: 7px 14px;
  border-radius: 20px; border: 1px solid var(--panel-line-strong);
  background: var(--panel); color: var(--ink); cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.pill-btn:hover { border-color: var(--ink); box-shadow: var(--shadow-pill); }
.pill-btn.danger { color: var(--avoid); border-color: var(--avoid); }
.pill-btn.primary { background: var(--grad); color: #fff; border: none; }
.phone-form { display: flex; gap: 8px; flex-wrap: wrap; }
.phone-form input {
  flex: 1; font-family: var(--sans); font-size: 14px; padding: 10px 16px;
  border: 1px solid var(--field-line); border-radius: 24px;
  background: var(--field); color: var(--ink); min-width: 180px;
}
.phone-form input:focus { outline: none; background: var(--panel); box-shadow: 0 0 0 2px var(--rausch); border-color: transparent; }
.inline-status { font-size: 12.5px; color: var(--ink-muted); min-height: 1.2em; margin-top: 8px; }
.inline-status.err { color: var(--avoid); }
.inline-status.ok { color: var(--babu); }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .run-form { border-radius: 24px; }
  .field, .field.mode, .field.grow, .field.state { flex: 1 1 44%; }
  .run-btn { width: 100%; border-radius: 24px; height: 48px; margin-left: 0; flex-basis: 100%; }
  .top-nav { align-items: flex-start; }
  .nav-right { align-items: flex-start; }
}

/* ---------- Mobile: results table becomes lead cards ----------
   app.js emits a fixed column order - Property(1) Type(2) Rent(3) Score(4)
   Compliance(5) Demand(6) ROI(7) Status(8) - which lets the same markup
   re-flow into a card grid without touching the render code. */
@media (max-width: 720px) {
  #results .table-scroll { overflow: visible; border: none; border-radius: 0; background: none; box-shadow: none; }
  #results table, #results tbody { display: block; width: 100%; min-width: 0; }
  #results thead { display: none; }
  #results tbody { display: flex; flex-direction: column; gap: 10px; }
  #results tbody tr {
    display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 12px;
    background: var(--panel); border: 1px solid var(--panel-line); border-radius: 16px;
    box-shadow: var(--shadow); padding: 14px 16px;
  }
  #results tbody td { display: block; padding: 0; white-space: normal; }
  #results td.addr { grid-area: 1 / 1; max-width: none; }
  #results tbody td:nth-child(4) { grid-area: 1 / 2; justify-self: end; }   /* score pill */
  #results tbody td:nth-child(2) { grid-area: 2 / 1; font-size: 12.5px; color: var(--ink-muted); }
  #results tbody td:nth-child(3) { grid-area: 2 / 2; justify-self: end; }   /* rent */
  #results tbody td:nth-child(6) { grid-area: 3 / 1; text-align: left; font-size: 12.5px; }
  #results tbody td:nth-child(7) { grid-area: 3 / 2; font-size: 12.5px; }
  #results tbody td:nth-child(5) { grid-area: 4 / 1; justify-self: start; } /* compliance chip */
  #results tbody td:nth-child(8) { grid-area: 4 / 2; justify-self: end; }   /* status chip */
  #results tbody td:nth-child(6)::before, #results tbody td:nth-child(7)::before {
    font-family: var(--sans); font-size: 10.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--ink-muted); margin-right: 6px;
  }
  #results tbody td:nth-child(6)::before { content: "Demand"; }
  #results tbody td:nth-child(7)::before { content: "Ann. ROI"; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
