/*
 * Funding check styles. evoila corporate design: Lexend Deca, Sand/Obsidian neutrals,
 * Emerald/Skyline/Cobalt as fills, one radius family (16/8/28px).
 * No inline styles anywhere, so the Content-Security-Policy can omit 'unsafe-inline'.
 */
:root {
  color-scheme: light;
  --bg: #F6F0EB;
  --surface: #FFFFFF;
  --row: #F6F0EB;
  --text: #1F1534;
  --muted: rgba(31, 21, 52, 0.7);
  --border: rgba(31, 21, 52, 0.12);
  --border-strong: rgba(31, 21, 52, 0.22);
  --input-bg: #FFFFFF;
  --accent: #0066CC;
  --chip-on: #1F1534;
  --chip-on-text: #FFFFFF;
  --focus: #0066CC;
  --track: rgba(31, 21, 52, 0.08);
  --ok: #0BD7A1;
  --warn: #FFE66D;
  --block: #FF5E86;
  --block-soft: rgba(255, 94, 134, 0.14);
  --on-fill: #1F1534;
  --s1: #0066CC; --s2: #0BD7A1; --s3: #0000CC; --s4: #2B2754; --s5: #A99C91; --s6: #7D3CF8;
  --stripe: rgba(255, 255, 255, 0.55);
  --shadow: 0 2px 16px rgba(31, 21, 52, 0.06);
  --radius: 16px;
  --radius-sm: 8px;
  --radius-lg: 28px;
  --font: "Lexend Deca", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1F1534;
    --surface: #2B2754;
    --row: rgba(255, 255, 255, 0.05);
    --text: #FFFFFF;
    --muted: rgba(255, 255, 255, 0.72);
    --border: rgba(255, 255, 255, 0.14);
    --border-strong: rgba(255, 255, 255, 0.26);
    --input-bg: #1F1534;
    --accent: #0BD7A1;
    --chip-on: #0BD7A1;
    --chip-on-text: #1F1534;
    --focus: #0BD7A1;
    --track: rgba(255, 255, 255, 0.1);
    --block-soft: rgba(255, 94, 134, 0.2);
    --s1: #0BD7A1; --s2: #05D5EF; --s3: #9EECA0; --s4: #FFE66D; --s5: #A99C91; --s6: #FB923F;
    --stripe: rgba(31, 21, 52, 0.45);
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1F1534;
  --surface: #2B2754;
  --row: rgba(255, 255, 255, 0.05);
  --text: #FFFFFF;
  --muted: rgba(255, 255, 255, 0.72);
  --border: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.26);
  --input-bg: #1F1534;
  --accent: #0BD7A1;
  --chip-on: #0BD7A1;
  --chip-on-text: #1F1534;
  --focus: #0BD7A1;
  --track: rgba(255, 255, 255, 0.1);
  --block-soft: rgba(255, 94, 134, 0.2);
  --s1: #0BD7A1; --s2: #05D5EF; --s3: #9EECA0; --s4: #FFE66D; --s5: #A99C91; --s6: #FB923F;
  --stripe: rgba(31, 21, 52, 0.45);
  --shadow: none;
}
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
*, *::before, *::after { box-sizing: inherit; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: var(--bg);
}
img { max-width: 100%; }
.page { max-width: 1240px; margin: 0 auto; padding: 32px 24px 112px; }

/* Header */
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 32px; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; }
.logo { display: block; height: 34px; width: auto; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: block; }
}
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
h1 { font-weight: 700; font-size: clamp(2rem, 4vw, 3rem); line-height: 1.1; letter-spacing: -0.02em; margin: 0; }
.subline { font-weight: 300; font-size: 1.1875rem; line-height: 1.5; margin: 8px 0 0; max-width: 40em; }
.rates { font-weight: 400; font-size: 0.8125rem; color: var(--muted); margin: 0; max-width: 28em; }

/* Layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: 24px; align-items: start; }
.panel { background: var(--surface); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow); }
.results {
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + 24px);
  max-height: calc(100dvh - 48px - env(safe-area-inset-top, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Form */
.block + .block { margin-top: 32px; padding-top: 28px; border-top: 1px solid var(--border); }
h2 { font-weight: 700; font-size: 1.25rem; line-height: 1.3; margin: 0 0 16px; }
h3 { font-weight: 600; font-size: 1rem; line-height: 1.4; margin: 0 0 12px; }
.sub + .sub { margin-top: 24px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.field { display: grid; gap: 6px; margin-bottom: 16px; align-content: start; }
.field > label, .field-label { font-weight: 400; font-size: 0.9375rem; line-height: 1.4; }
.hint { font-size: 0.8125rem; font-weight: 400; line-height: 1.5; color: var(--muted); margin: 0; }
.err { font-size: 0.8125rem; line-height: 1.5; margin: 0; padding: 4px 10px; border-radius: var(--radius-sm); background: var(--block-soft); }
.err[hidden] { display: none; }
input[type="text"], select {
  font: inherit;
  font-weight: 400;
  color: var(--text);
  background: var(--input-bg);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-height: 44px;
  width: 100%;
  font-variant-numeric: tabular-nums;
}
input[aria-invalid="true"] { border-color: var(--block); }
.check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; font-size: 0.9375rem; line-height: 1.45; font-weight: 400; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.chip-group + .chip-group { margin-top: 16px; }
.chip-group-title { font-weight: 400; font-size: 0.875rem; color: var(--muted); margin: 0 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input, .seg input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.chip span {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; min-height: 40px;
  border-radius: 999px;
  border: 1.5px solid var(--border-strong);
  font-weight: 400; font-size: 0.9375rem; line-height: 1.3;
  cursor: pointer; user-select: none;
}
.chip input:checked + span { background: var(--chip-on); border-color: var(--chip-on); color: var(--chip-on-text); }
.chip input:checked + span::before { content: "\2713"; font-weight: 600; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 999px; border: 1.5px solid var(--border-strong); }
.seg label { position: relative; }
.seg span { display: block; padding: 8px 18px; border-radius: 999px; cursor: pointer; font-weight: 400; user-select: none; }
.seg input:checked + span { background: var(--chip-on); color: var(--chip-on-text); font-weight: 600; }
input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.chip input:focus-visible + span, .seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
[data-hidden="true"] { display: none !important; }

details.profile summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
details.profile summary::-webkit-details-marker { display: none; }
details.profile summary::after { content: "Show"; font-weight: 400; font-size: 0.875rem; color: var(--muted); }
details.profile[open] summary::after { content: "Hide"; }
.profile-body { margin-top: 20px; }
.profile-group + .profile-group { margin-top: 20px; }
.profile-group .check { margin-bottom: 8px; }

/* Buttons */
.btn {
  font: inherit; font-weight: 600; font-size: 0.9375rem;
  border-radius: 999px; padding: 0.6em 1.3em; border: none; cursor: pointer;
  background: transparent; color: var(--text);
  box-shadow: inset 0 0 0 1.5px var(--text);
  min-height: 40px;
}
.btn-primary { background: var(--accent); color: #FFFFFF; box-shadow: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { color: #1F1534; } }
:root[data-theme="dark"] .btn-primary { color: #1F1534; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 20px; }
.status { font-size: 0.875rem; color: var(--muted); margin: 0; }

/* Results */
.lede { font-weight: 300; font-size: 1.125rem; margin: 0; }
.total { font-weight: 700; font-size: clamp(2.75rem, 5.5vw, 4rem); line-height: 1; letter-spacing: -0.03em; margin: 6px 0 10px; font-variant-numeric: tabular-nums; }
.total-note { font-size: 0.9375rem; margin: 0; color: var(--muted); }
.bar { display: flex; gap: 3px; height: 22px; border-radius: 999px; overflow: hidden; background: var(--track); margin: 20px 0 4px; }
.bar span { height: 100%; min-width: 6px; }
.bar span.cond { background-image: repeating-linear-gradient(135deg, var(--stripe) 0 4px, transparent 4px 9px); }
.bar-key { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.8125rem; color: var(--muted); margin: 6px 0 0; }
.bar-key i { display: inline-block; width: 18px; height: 10px; border-radius: 999px; vertical-align: -1px; margin-right: 6px; background: var(--s1); }
.bar-key i.cond { background-image: repeating-linear-gradient(135deg, var(--stripe) 0 4px, transparent 4px 9px); }
.res-section { margin-top: 32px; }
.res-section > h2 { margin-bottom: 4px; }
.res-section > .hint { margin-bottom: 14px; }
.area-title { font-weight: 600; font-size: 0.9375rem; margin: 20px 0 8px; }
.pick { font-size: 0.8125rem; color: var(--muted); margin: -2px 0 8px; }
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 16px; border-radius: var(--radius); background: var(--row); }
.row.bonus { margin-left: 26px; }
.row.alt .row-amount, .row.alt .row-title { opacity: 0.66; }
.dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 6px; box-shadow: inset 0 0 0 2px var(--border-strong); }
.row-title { font-weight: 600; margin: 0; line-height: 1.4; }
.row-meta { margin: 3px 0 0; font-size: 0.875rem; font-weight: 400; line-height: 1.5; color: var(--muted); }
.row-why { margin: 6px 0 0; font-size: 0.875rem; line-height: 1.5; }
.row-amount { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.4; }
.row-amount small { display: block; font-weight: 300; font-size: 0.8125rem; color: var(--muted); white-space: normal; max-width: 15em; margin-left: auto; }
.tag { display: inline-block; font-size: 0.75rem; font-weight: 600; line-height: 1.5; padding: 1px 9px; border-radius: 999px; background: var(--ok); color: var(--on-fill); margin-left: 8px; vertical-align: 1px; }
.tag.alt { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--border-strong); }
.tag.need { background: var(--warn); }
details.misses summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
details.misses .rows { margin-top: 12px; }
.notes { margin: 0; padding-left: 1.1em; display: grid; gap: 8px; font-size: 0.9375rem; }
.empty { padding: 20px; border-radius: var(--radius); background: var(--row); margin-top: 24px; }
.empty p { margin: 0; }
.error-banner { padding: 12px 16px; border-radius: var(--radius); background: var(--block-soft); margin-top: 16px; }

footer.foot { margin-top: 32px; font-size: 0.8125rem; color: var(--muted); max-width: 60em; }
footer.foot p { margin: 0 0 6px; }

[hidden] { display: none !important; }
.offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }
.hint-below { margin-top: 10px; }
.hint-above { margin-bottom: 16px; }
.lede { margin: 0; }

/* Chosen-engagement colors, shared by the bar segments and the list dots */
.c1 { background-color: var(--s1); }
.c2 { background-color: var(--s2); }
.c3 { background-color: var(--s3); }
.c4 { background-color: var(--s4); }
.c5 { background-color: var(--s5); }
.c6 { background-color: var(--s6); }
.dot.filled { box-shadow: none; }

/* Free entry points */
.tag.kind { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--border-strong); }
.row-link { display: inline-block; margin-top: 8px; font-weight: 600; font-size: 0.875rem; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.row-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Session */
.top-side { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.top-side .rates { text-align: right; }
.session { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; font-weight: 400; font-size: 0.9375rem; }
.session-user { overflow-wrap: anywhere; }
.btn-small { min-height: 36px; padding: 0.45em 1.1em; font-size: 0.875rem; }

/* Sign-in screen */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 460px; display: grid; gap: 14px; justify-items: start; }
.auth-card h1 { margin-top: 12px; }
.auth-card .actions { margin-top: 8px; }
.auth-error { width: 100%; }

/* Mobile summary bar */
.mbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: none; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.mbar strong { font-weight: 700; font-variant-numeric: tabular-nums; }

@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .top-side { align-items: flex-start; }
  .top-side .rates { text-align: left; }
  .results { position: static; max-height: none; overflow: visible; }
  .mbar { display: flex; }
  .mbar[data-hidden="true"] { display: none !important; }
}
@media (max-width: 560px) {
  .page { padding: 20px 14px 112px; }
  .panel { padding: 22px 18px; border-radius: 22px; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .row { grid-template-columns: 12px minmax(0, 1fr); }
  .row-amount { grid-column: 2; text-align: left; }
  .row-amount small { margin-left: 0; }
  .row.bonus { margin-left: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
