/* Components. Colours come from the theme tokens at the top of app.css (same as the prototype). */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: transparent; color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2.5px solid var(--green-2); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
p { margin: 0; }
a { color: var(--green-2); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
[hidden] { display: none !important; }

/* Background: Eric's network photo in light mode, faint green lines with gold dots in dark. */
.bgnet { position: fixed; inset: 0; z-index: -1; pointer-events: none; background: url(img/bg-light.webp) center / cover no-repeat; }
@media (min-width: 600px) { .bgnet { background-size: 540px auto; background-repeat: repeat; background-position: top center; } }
.bgdots { display: var(--dots); position: fixed; inset: 0; z-index: -1; pointer-events: none; background: var(--gold); opacity: .3;
  -webkit-mask: url(img/gold-dots.webp) top center / 540px auto repeat; mask: url(img/gold-dots.webp) top center / 540px auto repeat; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bgnet { background: var(--green); opacity: .09; -webkit-mask: url(img/network.webp) top center / 540px auto repeat; mask: url(img/network.webp) top center / 540px auto repeat; } }
:root[data-theme="dark"] .bgnet { background: var(--green); opacity: .09; -webkit-mask: url(img/network.webp) top center / 540px auto repeat; mask: url(img/network.webp) top center / 540px auto repeat; }
/* Text straight on the background gets a soft patch so lines never cross words. */
.screen > :is(h1, p, .eyebrow, .lede, .small, .link), .screen > .head :is(h1, .eyebrow) {
  width: fit-content; max-width: 100%; background: var(--bg); border-radius: 10px; box-shadow: 0 0 14px 10px var(--bg); }

.wrap { max-width: 480px; margin: 0 auto; padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px)); }
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -.02em; text-decoration: none; color: var(--ink); min-height: 44px; }
.mark { width: 21px; height: 28px; flex: none; background: var(--mark-c); -webkit-mask: url(img/mark.webp) center / contain no-repeat; mask: url(img/mark.webp) center / contain no-repeat; }
.tag { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--amber-2); background: var(--amber-3); padding: 4px 9px; border-radius: 99px; white-space: nowrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: calc(61px + env(safe-area-inset-top, 0px)); z-index: 4; }
.tabs a { flex: 1; min-height: 46px; display: grid; place-items: center; font-weight: 700; font-size: 14.5px; color: var(--ink-3); text-decoration: none; border-bottom: 2.5px solid transparent; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--tab-line); }

main.wrap { padding-top: 18px; padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }
.screen { display: grid; gap: 14px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--eyebrow-c); }
.lede { color: var(--ink-2); font-size: 16.5px; }
.small { font-size: 13.5px; color: var(--ink-3); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); display: grid; gap: 12px; }
.card h2 { font-size: 17px; }
.note { background: var(--amber-3); color: var(--ink); border-radius: var(--r-md); padding: 12px 14px; font-size: 14.5px; }
.err { background: var(--lost-2); color: var(--lost); border-radius: var(--r-md); padding: 10px 14px; font-size: 14.5px; font-weight: 600; }

.btn { min-height: 52px; border-radius: 14px; border: 0; font-weight: 800; font-size: 16px; padding: 0 18px; display: inline-grid; place-items: center; text-decoration: none; }
.btn-primary { background: var(--green); color: var(--on-green); }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-row { display: grid; gap: 10px; }
.small-btn { min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 700; font-size: 14px; }
.link { background: none; border: 0; color: var(--green-2); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; min-height: 44px; padding: 0; justify-self: start; }
label { font-weight: 700; font-size: 15px; display: grid; gap: 6px; }
.input { min-height: 54px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); padding: 0 14px; font-size: 18px; width: 100%; }
.input:focus { outline: none; border-color: var(--green-2); box-shadow: 0 0 0 3px var(--green-3); }
.code-input { letter-spacing: .4em; font-family: var(--mono); text-align: center; font-size: 24px; }

.choice { display: grid; gap: 8px; }
.opt { min-height: 56px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); text-align: left; padding: 10px 14px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.opt::after { content: "→"; color: var(--ink-3); }
.issues { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.issues li { position: relative; padding-left: 32px; font-size: 15px; }
.issues li::before { content: "!"; position: absolute; left: 0; top: 1px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--lost-2); color: var(--lost); font-weight: 800; font-size: 13px; }
.issues li.ok::before { content: "✓"; background: var(--green-3); color: var(--won); }
.issues small { display: block; color: var(--ink-3); font-size: 13px; margin-top: 2px; }

.hero { background: var(--hero-bg); color: var(--hero-ink); border: 1px solid var(--hero-border); border-radius: var(--r-lg); padding: 20px; display: grid; gap: 8px; }
.hero .big { font-size: 44px; font-weight: 800; letter-spacing: -.03em; line-height: 1; color: var(--hero-big); }
.hero p { opacity: .9; font-size: 15px; }
.head { display: flex; align-items: end; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 3px; }
.seg button { min-height: 40px; border: 0; background: none; border-radius: 9px; padding: 0 12px; font-weight: 700; font-size: 14px; color: var(--ink-3); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.did { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.did li { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; display: grid; gap: 2px; }
.tile small { color: var(--ink-3); font-size: 13px; font-weight: 600; }
.tile .num { font-size: 20px; }
.meter { height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--meter-c); border-radius: 6px; }
.row { display: grid; gap: 6px; padding-block: 12px; border-top: 1px solid var(--line); }
.row:first-of-type { border-top: 0; padding-top: 0; }
.row-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.row p { color: var(--ink-2); font-size: 14px; }
.pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pick button { min-height: 44px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 700; }
.pick .w { color: var(--won); } .pick .b { color: var(--lost); }
.chip { font-size: 12.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.chip.good { background: var(--green-3); color: var(--won); } .chip.lost { background: var(--surface-2); color: var(--ink-2); } .chip.bad { background: var(--lost-2); color: var(--lost); } .chip.todo { background: var(--amber-3); color: var(--amber-2); }
.why-text { font-size: 13.5px; color: var(--ink-2); background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.undone { opacity: .55; }
.insight { border: 1.5px solid var(--amber); background: var(--amber-3); }

/* Demo WhatsApp */
.phone { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--chat-bg); }
.phone-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--green); color: var(--on-green); display: grid; place-items: center; font-weight: 800; flex: none; }
.phone-head small { display: block; color: var(--ink-3); font-size: 12.5px; }
.log { display: grid; gap: 8px; padding: 14px 12px; min-height: 280px; max-height: 62svh; overflow-y: auto; align-content: start; overscroll-behavior: contain; }
.msg { max-width: 88%; padding: 9px 12px 6px; border-radius: 14px; font-size: 15px; box-shadow: 0 1px 1px rgba(0,0,0,.06); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.bot { background: var(--bubble-in); justify-self: start; border-top-left-radius: 4px; }
.msg.me { background: var(--bubble-out); justify-self: end; border-top-right-radius: 4px; }
.msg time { display: block; text-align: right; font-size: 11px; color: var(--ink-3); font-family: var(--mono); margin-top: 2px; }
.wa-btns { display: grid; gap: 1px; justify-self: start; width: min(88%, 340px); margin-top: -6px; border-radius: 0 0 14px 14px; overflow: hidden; }
.wa-btns button { min-height: 44px; border: 0; background: var(--bubble-in); color: var(--green-2); font-weight: 700; font-size: 15px; }
.compose { display: flex; gap: 8px; padding: 10px; background: var(--surface); border-top: 1px solid var(--line); }
.compose .input { min-height: 46px; font-size: 16px; }
.compose .btn { min-height: 46px; }
.demo-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.typing { justify-self: start; color: var(--ink-3); font-size: 13px; }
.sheet-back { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; display: grid; align-items: end; }
.sheet { background: var(--surface); border-radius: 20px 20px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 6px; max-width: 480px; width: 100%; margin: 0 auto; max-height: 80svh; overflow-y: auto; }
.sheet button.rowbtn { min-height: 52px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; font-weight: 700; display: grid; padding: 6px 4px; }
.sheet button.rowbtn small { font-weight: 500; color: var(--ink-3); }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: 14.5px; z-index: 30; max-width: calc(100% - 32px); }
