/* ===============================================================
   CanMortgage — styles
   =============================================================== */
:root {
  --bg: #f3f5f9; --panel: #fff; --panel2: #f6f8fc; --ink: #101828; --muted: #5d6b82; --line: #e1e6ef;
  --accent: #d52b1e; --accent-ink: #fff; --accent-soft: color-mix(in srgb, var(--accent) 11%, transparent);
  --good: #15803d; --good-soft: #dcfce7; --bad: #dc2626; --bad-soft: #fee2e2; --warn: #b45309; --warn-soft: #fef3c7; --info: #2563eb; --info-soft: #dbeafe;
  --navy: #0d1b33; --gold: #ffb81c;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 8px 24px rgba(16,24,40,.07);
  --r: 16px; --gap: 14px; --pad: 16px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a111e; --panel: #121b2c; --panel2: #18233a; --ink: #e8eef7; --muted: #97a6bd; --line: #26344d;
    --good: #4ade80; --good-soft: rgba(74,222,128,.13); --bad: #f87171; --bad-soft: rgba(248,113,113,.14); --warn: #fbbf24; --warn-soft: rgba(251,191,36,.13); --info: #60a5fa; --info-soft: rgba(96,165,250,.14);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a111e; --panel: #121b2c; --panel2: #18233a; --ink: #e8eef7; --muted: #97a6bd; --line: #26344d;
  --good: #4ade80; --good-soft: rgba(74,222,128,.13); --bad: #f87171; --bad-soft: rgba(248,113,113,.14); --warn: #fbbf24; --warn-soft: rgba(251,191,36,.13); --info: #60a5fa; --info-soft: rgba(96,165,250,.14);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3); color-scheme: dark;
}
:root[data-density="compact"] { --gap: 10px; --pad: 12px; --r: 12px; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font: 600 14px/1.45 var(--font); color: var(--ink); background: var(--bg); overflow: hidden; }
.screen { position: fixed; inset: 0; display: none; }
@supports (height: 100dvh) { .screen { bottom: auto; height: 100dvh; } }
.screen.active { display: flex; }
h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -.01em; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .mono { font-family: var(--mono); }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }
a { color: var(--accent); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .spacer { flex: 1; }

/* ---------- controls ---------- */
.btn { font: 800 14px var(--font); border: 1px solid var(--line); border-radius: 11px; padding: 9px 15px; cursor: pointer; background: var(--panel); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; transition: transform .1s, filter .15s, background .15s; box-shadow: 0 1px 2px rgba(0,0,0,.05); text-decoration: none; }
.btn:hover { filter: brightness(1.04); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .chip:focus-visible, .seg button:focus-visible, .navbtn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.big { font-size: 17px; padding: 13px 24px; border-radius: 14px; }
.btn.sm { font-size: 12.5px; padding: 6px 11px; border-radius: 9px; }
.btn.xs { font-size: 11.5px; padding: 3px 8px; border-radius: 7px; }
input[type=text], input[type=number], input[type=date], input[type=search], select, textarea {
  font: 700 14px var(--font); padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); width: 100%; min-width: 0; }
textarea { font: 500 12.5px/1.45 var(--mono); resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type=range] { accent-color: var(--accent); width: 100%; }
input[type=color] { width: 40px; height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--panel); }
.inp-wrap { position: relative; display: flex; align-items: center; }
.inp-wrap > .pre, .inp-wrap > .post { position: absolute; color: var(--muted); font-weight: 800; font-size: 13px; pointer-events: none; }
.inp-wrap > .pre { left: 10px; } .inp-wrap > .post { right: 10px; }
.inp-wrap.has-pre input { padding-left: 22px; } .inp-wrap.has-post input { padding-right: 34px; }
.switch { position: relative; display: inline-block; width: 44px; height: 25px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #b8c2cf; border-radius: 25px; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 19px; height: 19px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(19px); }
.chip { border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 6px 12px; border-radius: 999px; font: 800 12.5px var(--font); cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.seg { display: inline-flex; background: var(--panel2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--muted); font: 800 12.5px var(--font); padding: 6px 11px; border-radius: 8px; cursor: pointer; }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 800; padding: 2px 9px; border-radius: 999px; background: var(--panel2); color: var(--muted); white-space: nowrap; border: 1px solid var(--line); }
.pill.good, .pill.approve, .pill.pass { background: var(--good-soft); color: var(--good); border-color: transparent; }
.pill.bad, .pill.decline, .pill.fail { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.warn, .pill.refer { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.pill.acc { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.lchip.logo { background: #fff; border: 1px solid var(--line); min-width: 64px; width: 64px; height: 28px; padding: 3px 6px; }
.lchip.logo img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.lchip { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 24px; padding: 0 7px; border-radius: 7px; font: 800 11px var(--mono); letter-spacing: .02em; flex: none; }

/* ---------- title ---------- */
#screen-title { align-items: center; justify-content: center; overflow: auto; overflow-x: hidden; color: #fff;
  background: radial-gradient(1200px 600px at 20% 10%, rgba(213,43,30,.55), transparent 60%), radial-gradient(900px 500px at 90% 90%, rgba(37,99,235,.45), transparent 60%), linear-gradient(160deg, #0d1b33, #071022 70%); }
.title-wrap { position: relative; z-index: 2; text-align: center; padding: 32px 16px 60px; max-width: 720px; }
.title-badge { font-size: 40px; letter-spacing: 6px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.4)); }
.title-name { font-size: clamp(44px, 10vw, 84px); line-height: 1; margin: 10px 0 8px; letter-spacing: -.035em; }
.title-name span { color: #ff5a4d; }
.title-sub { margin: 0 auto 18px; font-size: 18px; opacity: .88; max-width: 560px; }
.title-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
.title-btns .btn:not(.primary) { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff; }
.title-meta { margin-top: 18px; font-size: 12.5px; opacity: .75; }
.title-back { display: inline-block; margin-top: 14px; color: rgba(255,255,255,.7); font-weight: 800; text-decoration: none; }
.skyline { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 190px; z-index: 1; pointer-events: none; opacity: .9; }
#leaves { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.leaf { position: absolute; top: -40px; font-size: 22px; z-index: 1; animation: fall linear infinite; opacity: .8; pointer-events: none; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }
.ticker { margin: 0 auto; max-width: 640px; background: #05080f; color: var(--gold); font: 700 13px/1 var(--mono); letter-spacing: .05em; text-transform: uppercase; display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 36px; overflow: hidden; border-radius: 9px; border: 1px solid #222; }
.ticker .lbl { color: #9aa6b6; font-size: 11px; flex: none; }
.ticker .txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.samples { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.sample { text-align: left; border: 1px solid var(--line); background: var(--panel2); border-radius: 14px; padding: 12px; cursor: pointer; color: var(--ink); font: inherit; }
.sample:hover { border-color: var(--accent); }
.sample b { display: block; font-size: 15px; } .sample small { color: var(--muted); }
.sample .ico { font-size: 26px; display: block; margin-bottom: 4px; }

/* ---------- app shell ---------- */
#screen-app { flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--navy); color: #fff; flex: none; }
.brand { display: flex; align-items: center; gap: 8px; font: 800 18px var(--font); color: #fff; background: none; border: 0; cursor: pointer; padding: 0; letter-spacing: -.02em; }
.brand b { color: #ff5a4d; }
.ws-pick { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); color: #fff; border-radius: 10px; font: 800 13px var(--font); padding: 6px 10px; cursor: pointer; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .btn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff; }
.topbar .btn.primary { background: var(--accent); border-color: var(--accent); }
.fresh { font-size: 11.5px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,.1); color: #cfd8e6; white-space: nowrap; cursor: pointer; border: 0; }
.fresh.old { background: #fbbf24; color: #3b2600; }
.body { flex: 1; display: flex; min-height: 0; }
.nav { width: 210px; flex: none; padding: 12px 10px; border-right: 1px solid var(--line); background: var(--panel); overflow: auto; display: flex; flex-direction: column; gap: 3px; }
.navbtn { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: var(--ink); font: 800 14px var(--font); padding: 9px 11px; border-radius: 11px; cursor: pointer; text-align: left; position: relative; }
.navbtn .ic { font-size: 18px; width: 24px; text-align: center; }
.navbtn:hover { background: var(--panel2); }
.navbtn.on { background: var(--accent-soft); color: var(--accent); }
.navbtn .dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.navbtn .dot.ok { background: var(--good); } .navbtn .dot.warn { background: var(--warn); } .navbtn .dot.bad { background: var(--bad); }
.nav .sep { height: 1px; background: var(--line); margin: 8px 6px; }
.main { flex: 1; overflow: auto; min-width: 0; }
.view { max-width: 1180px; margin: 0 auto; padding: 18px 18px 90px; display: grid; gap: var(--gap); }
.vhead { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.vhead h2 { font-size: 26px; display: flex; align-items: center; gap: 10px; }
.vhead p { margin: 2px 0 0; color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: var(--pad); min-width: 0; }
.card > h3 { font-size: 16px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.card > h3 small { font-weight: 700; color: var(--muted); font-size: 12px; }
.grid { display: grid; gap: var(--gap); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--gap); align-items: start; }
.sticky { position: sticky; top: 12px; }
.tip { display: flex; gap: 10px; align-items: flex-start; background: var(--info-soft); color: var(--ink); border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.tip .ic { font-size: 18px; }
.empty { text-align: center; padding: 30px 16px; color: var(--muted); }
.empty .big { font-size: 42px; display: block; margin-bottom: 6px; }

/* ---------- forms ---------- */
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 12px; }
.form .wide { grid-column: 1 / -1; }
.fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fld > label { font-size: 12px; font-weight: 800; color: var(--muted); display: flex; gap: 6px; align-items: center; }
#tipbox { position: fixed; z-index: 80; background: var(--navy); color: #fff; font: 600 12.5px/1.45 var(--font); padding: 9px 11px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.3); pointer-events: none; opacity: 0; transition: opacity .12s; text-transform: none; letter-spacing: 0; }
#tipbox.on { opacity: 1; }
.q { cursor: help; border: 1px solid var(--line); border-radius: 50%; width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; color: var(--muted); background: var(--panel); vertical-align: 1px; margin-left: 4px; text-transform: none; letter-spacing: 0; flex: none; }
.q:hover, .q:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }
.fld > label .q { cursor: help; border: 1px solid var(--line); border-radius: 50%; width: 15px; height: 15px; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; }
.fld .hint { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.fld.tog { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; }
.sec-t { grid-column: 1 / -1; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; margin-top: 6px; display: flex; align-items: center; gap: 8px; }
.sec-t::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.item { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: var(--panel2); display: grid; gap: 10px; }
.item-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item-head .ic { font-size: 22px; }
.item-head h4 { font-size: 15px; }
.lines { display: grid; gap: 8px; }
.line { display: grid; grid-template-columns: 170px 130px minmax(120px, 1fr) 130px 110px 90px auto; gap: 8px; align-items: end; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel2); }
.line .fld > label { font-size: 11px; }
.roles { display: grid; gap: 8px; }
.role-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.status-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.status-pick button { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 11px; padding: 8px 10px; font: 800 12.5px var(--font); cursor: pointer; text-align: left; display: flex; gap: 6px; align-items: center; }
.status-pick button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.credit-bar { height: 8px; border-radius: 8px; background: linear-gradient(90deg, #dc2626, #f59e0b 40%, #84cc16 65%, #15803d); position: relative; margin-top: 4px; }
.credit-bar i { position: absolute; top: -4px; width: 4px; height: 16px; background: var(--ink); border-radius: 2px; transform: translateX(-2px); }

/* ---------- KPIs and verdicts ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: var(--gap); }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.kpi small { display: block; color: var(--muted); font-weight: 800; font-size: 12px; }
.kpi b { display: block; font-size: 22px; letter-spacing: -.02em; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi span { font-size: 12px; color: var(--muted); }
.verdict { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 18px; align-items: center; border-radius: var(--r); padding: 18px; color: #fff; background: linear-gradient(135deg, #15803d, #0f766e); box-shadow: var(--shadow); }
.verdict.refer { background: linear-gradient(135deg, #b45309, #a16207); }
.verdict.decline { background: linear-gradient(135deg, #b91c1c, #9f1239); }
.verdict h3 { font-size: 26px; letter-spacing: -.02em; }
.verdict p { opacity: .92; margin: 4px 0 0; }
.verdict .vk { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; }
.verdict .vk div small { display: block; font-size: 11.5px; opacity: .8; font-weight: 800; }
.verdict .vk div b { font-size: 18px; }
.gauge text { font-family: var(--font); }
.ratio { display: grid; gap: 4px; }
.ratio .rb { height: 10px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); position: relative; overflow: hidden; }
.ratio .rb i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 10px; background: var(--good); transition: width .4s; }
.ratio .rb i.warn { background: var(--warn); } .ratio .rb i.bad { background: var(--bad); }
.ratio .rb u { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink); opacity: .55; }
.ratio .rl { display: flex; justify-content: space-between; font-size: 12px; font-weight: 800; }

/* lender cards */
.lenders { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: var(--gap); }
.lcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.lcard .lh { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.lcard .lh h4 { font-size: 15px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lcard .lb { padding: 12px 14px; display: grid; gap: 10px; }
.lcard .nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lcard .nums div small { display: block; font-size: 11px; color: var(--muted); font-weight: 800; }
.lcard .nums div b { font-size: 15px; }
.lcard.best { outline: 3px solid var(--good); outline-offset: -1px; }
.checks { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.checks li { display: grid; grid-template-columns: 22px 1fr; gap: 6px; font-size: 13px; align-items: start; }
.checks li .ci { font-size: 15px; line-height: 1.3; }
.checks li b { display: block; }
.checks li span { color: var(--muted); font-weight: 600; }
.checks li em { display: block; font-style: normal; color: var(--accent); font-weight: 800; margin-top: 2px; }
details.more { border-top: 1px solid var(--line); }
details.more > summary { padding: 9px 14px; cursor: pointer; font-weight: 800; font-size: 13px; color: var(--muted); list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary { color: var(--ink); }
.more-body { padding: 0 14px 14px; display: grid; gap: 12px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th, table.t td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.t th:first-child, table.t td:first-child { text-align: left; white-space: normal; }
table.t th { font-size: 11.5px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .04em; position: sticky; top: 0; background: var(--panel); }
table.t tr.tot td { font-weight: 800; border-top: 2px solid var(--line); }
table.t td.neg { color: var(--bad); } table.t td.pos { color: var(--good); }
.tscroll { overflow: auto; max-width: 100%; }
.whatif { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 18px; }
.whatif .fld > label { justify-content: space-between; }
.whatif .fld > label b { color: var(--ink); }

/* rates editor */
.rgrid input { width: 70px; padding: 5px 6px; font-size: 13px; text-align: right; }
.rgrid td, .rgrid th { padding: 4px; }

/* charts */
.chart { width: 100%; height: auto; display: block; }
.chart .ax { stroke: var(--line); }
.chart text { fill: var(--muted); font: 700 11px var(--font); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; font-weight: 800; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.timeline { display: grid; gap: 8px; }
.tl { display: grid; grid-template-columns: 100px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel2); font-size: 13px; }
.tl .when { font-weight: 800; }

/* steps */
.steps { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.step { display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--panel); cursor: pointer; font: 800 13px var(--font); color: var(--ink); text-align: left; }
.step .n { width: 26px; height: 26px; border-radius: 50%; background: var(--panel2); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.step.done .n { background: var(--good); color: #fff; }

/* modal, toasts, confetti */
#modal-root { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.modal-back { position: absolute; inset: 0; background: rgba(5,10,20,.55); display: flex; align-items: center; justify-content: center; padding: 16px; pointer-events: auto; animation: fade .16s; }
.modal-back.closing { opacity: 0; transition: opacity .16s; }
.modal { background: var(--panel); border-radius: 18px; width: min(560px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 18px; }
.modal-head .x { border: 0; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; }
.modal-body { padding: 16px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 60; pointer-events: none; width: min(460px, calc(100% - 32px)); }
.toast { background: var(--navy); color: #fff; padding: 11px 14px; border-radius: 12px; font-weight: 800; box-shadow: 0 10px 30px rgba(0,0,0,.3); animation: up .25s; }
.toast.good { background: #15803d; } .toast.bad { background: #b91c1c; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .35s; }
@keyframes up { from { opacity: 0; transform: translateY(10px); } }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
#confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: drop linear forwards; }
@keyframes drop { to { transform: translateY(105vh) rotate(720deg); } }
:root[data-motion="off"] *, :root[data-motion="off"] *::before { animation: none !important; transition: none !important; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.swatches button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatches button.on { border-color: var(--ink); }
.prose h3 { margin: 14px 0 6px; font-size: 16px; } .prose ul { margin: 0 0 8px; padding-left: 18px; } .prose li { margin: 3px 0; }
.gloss { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: 13px; } .gloss b { color: var(--accent); }

/* ---------- mobile ---------- */
@media (max-width: 1020px) { .split { grid-template-columns: 1fr; } .sticky { position: static; } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .nav { position: fixed; left: 0; right: 0; bottom: 0; width: auto; height: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-top: 1px solid var(--line); padding: 6px; padding-bottom: max(6px, env(safe-area-inset-bottom)); z-index: 20; gap: 2px; }
  .navbtn { flex-direction: column; gap: 1px; font-size: 10.5px; padding: 5px 8px; min-width: 64px; align-items: center; }
  .navbtn .dot { position: absolute; top: 4px; right: 10px; margin: 0; width: 7px; height: 7px; }
  .nav .sep { display: none; }
  .g3, .g2 { grid-template-columns: 1fr; }
  .line { grid-template-columns: 1fr 1fr; }
  .line .fld.wide2 { grid-column: 1 / -1; }
  .verdict { grid-template-columns: 1fr; text-align: left; }
  .verdict .gauge { max-width: 190px; margin: 0 auto; }
  .lenders { grid-template-columns: 1fr; }
  .topbar .hide-sm { display: none; }
  .view { padding: 14px 16px 110px; }
  .vhead h2 { font-size: 22px; }
}
@media (max-width: 420px) { .kpis { grid-template-columns: 1fr 1fr; } .kpi b { font-size: 18px; } .form { grid-template-columns: 1fr 1fr; } .gloss { grid-template-columns: 1fr; } .tl { grid-template-columns: 1fr; } }
@media (max-width: 860px) { .fresh { font-size: 0; padding: 4px 8px; } .fresh::before { content: '📅'; font-size: 14px; } .fresh.old::before { content: '⚠️'; } .ws-pick { max-width: 46vw; } .brand span { display: none; } }
@media print { .nav, .topbar, .whatif, #toasts { display: none !important; } body, .main { overflow: visible !important; height: auto; } .screen { position: static; height: auto; } .card, .lcard { box-shadow: none; break-inside: avoid; } }
