:root {
  --bg: #F4F5F2; --card: #fff; --ink: #14201C; --muted: #5B6661; --soft: #4A524E;
  --line: #E3E6E1; --line2: #D5DAD3;
  --pri: #0E6B5C; --pri-d: #0A5246; --pri-bg: #E2F0EC;
  --wa: #157347; --wa-d: #115C39; --wa-bg: #E3F4EA;
  --red: #B42318; --red-bg: #FDECEA; --amber: #8A5100; --amber-bg: #FFF4E0;
  --blue: #2747A8; --blue-bg: #E8EEFB; --grey-bg: #EFEFEC;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--pri); text-decoration: none; }
h1 { font-size: 24px; margin: 0; font-weight: 700; }
h2 { font-size: 18px; margin: 0 0 12px; }
p { margin: 0; }
button { font: inherit; cursor: pointer; }
fieldset { border: 0; margin: 0 0 16px; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; }
.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding: 16px 16px 32px; }
.app.has-nav { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
.app.has-bar { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
.app > * + * { margin-top: 16px; }

.small { font-size: 13px; }
.muted { color: var(--muted); }
.soft { color: var(--soft); }
.b { font-weight: 600; }
.grow { flex: 1 1 auto; min-width: 0; }
.mt6 { margin-top: 6px; } .mt8 { margin-top: 8px; } .mt14 { margin-top: 14px; } .mt20 { margin-top: 20px; } .mb12 { margin-bottom: 12px; }
.top.start { justify-content: flex-start; }
.over { color: var(--red); }
.today { color: var(--amber); }
.empty { color: var(--muted); text-align: center; padding: 32px 0; }
.label { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 8px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; }
.bar-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin: -8px -8px 0; }
.bar-top h1 { flex: 1; font-size: 20px; }
.ib-plain { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); border: 0; background: none; }

.avatar { width: 44px; height: 44px; border-radius: 22px; background: var(--pri); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; flex-shrink: 0; }
.avatar.sq { border-radius: 12px; background: var(--ink); }
.avatar.s { width: 36px; height: 36px; font-size: 14px; }

.card { background: var(--card); border-radius: 14px; padding: 14px; }
.list { background: var(--card); border-radius: 14px; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--ink); }
.row:last-child { border-bottom: 0; }
.row > a.grow, .stack { display: flex; flex-direction: column; gap: 3px; color: var(--ink); }
a.row { min-height: 52px; }
a.row .i { color: var(--muted); width: 18px; height: 18px; }

.msg, .err { padding: 12px 14px; border-radius: 12px; font-weight: 500; }
.msg { background: var(--pri-bg); color: var(--pri-d); }
.err { background: var(--red-bg); color: var(--red); }
.err a { color: var(--red); text-decoration: underline; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 50px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line2); background: #fff; color: var(--ink); font-weight: 600; font-size: 16px; }
.btn.pri { background: var(--pri); border-color: var(--pri); color: #fff; }
.btn.danger { color: var(--red); }
.btn.block { width: 100%; }
.ib { width: 44px; height: 44px; border-radius: 22px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border: 0; }
.ib .i { width: 20px; height: 20px; }
.ib-call { background: var(--pri-bg); color: var(--pri); }
.ib-wa { background: var(--wa-bg); color: var(--wa); }
.ib-done { background: #fff; color: var(--ink); border: 1px solid var(--line2); }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > span, fieldset.field > legend { font-size: 14px; font-weight: 600; }
.field i { font-style: normal; font-weight: 400; color: var(--muted); }
input, select, textarea { width: 100%; height: 50px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line2); background: #fff; font: inherit; font-size: 16px; color: var(--ink); }
textarea { height: auto; padding: 12px 14px; resize: vertical; }
input[type=file] { height: auto; padding: 10px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--pri); outline-offset: 0; border-color: var(--pri); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; }
.check input { width: 22px; height: 22px; accent-color: var(--pri); }

/* chips (radio) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; }
.chip { position: relative; }
.chip input, .opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span, .chip-link { display: inline-flex; align-items: center; height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line2); background: #fff; color: var(--ink); font-size: 14px; font-weight: 500; white-space: nowrap; }
.chip input:checked + span, .chip-link.on { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.chip input:focus-visible + span, .opt input:focus-visible + span { outline: 2px solid var(--pri); outline-offset: 2px; }

.opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.opts-fu { grid-template-columns: repeat(auto-fit, minmax(58px, 1fr)); gap: 6px; }
.opt { position: relative; }
.opt span { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 48px; padding: 4px 8px; text-align: center; border-radius: 12px; border: 1px solid var(--line2); background: #fff; font-size: 14px; font-weight: 500; }
.opt small { font-size: 12px; color: var(--muted); }
.opt input:checked + span { border: 2px solid var(--pri); background: var(--pri-bg); color: var(--pri-d); font-weight: 600; }
.fu-at { display: none; margin-top: 8px; }
.opts-fu:has(input[value=custom]:checked) + .fu-at { display: block; }

/* stage badges */
.st { display: inline-flex; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--grey-bg); color: var(--soft); white-space: nowrap; }
.st-new { background: var(--blue-bg); color: var(--blue); }
.st-interested, .st-negotiation { background: var(--amber-bg); color: var(--amber); }
.st-site-visit, .st-booked { background: var(--pri-bg); color: var(--pri-d); }
.st-lost { background: var(--grey-bg); color: var(--muted); }

/* bottom nav */
.tabs { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; display: grid; grid-template-columns: repeat(4, 1fr); background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.tabs a { position: relative; height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; font-weight: 500; color: var(--muted); }
.tabs a.on { color: var(--pri); font-weight: 600; }
.badge { position: absolute; top: 6px; left: 54%; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center; }
.fab { position: fixed; right: max(16px, calc(50% - 224px)); bottom: calc(80px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 28px; background: var(--pri); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 16px rgba(14,107,92,.35); z-index: 11; }
.fab .i { width: 26px; height: 26px; stroke-width: 2.4; }

/* home */
.overdue { background: var(--red); color: #fff; border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.overdue a { color: #fff; }
.ov-head { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.ov-foot { display: flex; justify-content: space-between; align-items: flex-end; }
.ov-foot b { font-size: 44px; line-height: 1; }
.ov-btn { padding: 10px 16px; border-radius: 10px; background: #fff; color: var(--red) !important; font-weight: 600; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { background: #fff; border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 6px; color: var(--ink); }
.stat span { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat b { font-size: 30px; }
.shortcuts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 6px; }
.sc { height: 84px; border-radius: 14px; background: #fff; color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-size: 13px; font-weight: 600; text-align: center; }
.sc.pri { background: var(--pri); color: #fff; }

/* leads */
.search { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px; border-radius: 12px; background: #fff; border: 1px solid var(--line); color: var(--muted); }
.search input { border: 0; height: 44px; padding: 0; outline: none; }
.cards > * + * { margin-top: 10px; }
.lead-card { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 14px; background: #fff; }
.lead-card > a.grow { display: flex; flex-direction: column; gap: 4px; color: var(--ink); }
.lc-top { display: flex; align-items: center; gap: 8px; }
.lc-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter { font-size: 14px; color: var(--soft); }

/* lead detail */
.pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill { height: 36px; padding: 0 12px; border-radius: 10px; background: #fff; border: 1px solid var(--line); color: var(--soft); font-size: 14px; display: inline-flex; align-items: center; }
.st-select { width: auto; height: 36px; padding: 0 10px; border-radius: 10px; font-size: 14px; font-weight: 600; border: 1px solid var(--line2); }
.fu-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: #fff; border: 1px solid var(--line); color: var(--ink); }
.fu-card .fu-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; color: var(--ink); }
.fu-card .fu-main > span { display: flex; flex-direction: column; gap: 2px; }
.fu-card.over { background: var(--red-bg); border-color: #F5C7C2; }
.fu-card.over .i:first-child { color: var(--red); }
.fu-card.today { background: var(--amber-bg); border-color: #F2DDB4; }
.fu-card.none { color: var(--muted); }
.kv { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: 9px 12px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.adline { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.hist .row { align-items: flex-start; }
.hi { width: 32px; height: 32px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; background: var(--grey-bg); color: var(--soft); flex-shrink: 0; }
.hi .i { width: 16px; height: 16px; }
.hi-call { background: var(--pri-bg); color: var(--pri); }
.hi-whatsapp { background: var(--wa-bg); color: var(--wa); }
.hi-created { background: var(--blue-bg); color: var(--blue); }
.hi-followup_set, .hi-stage { background: var(--amber-bg); color: var(--amber); }
.note { white-space: pre-line; font-size: 15px; margin: 2px 0; }
.actionbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); z-index: 10; }
.ab { height: 60px; border-radius: 12px; border: 1px solid var(--line2); background: #fff; color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 13px; font-weight: 600; }
.ab .i { width: 20px; height: 20px; }
.ab.pri { background: var(--pri); border-color: var(--pri); color: #fff; }
.ab.wa { background: var(--wa); border-color: var(--wa); color: #fff; }

/* bottom sheets (open with #id, close with any other hash) */
.app > .sheet { margin: 0; }
.sheet { display: none; position: fixed; inset: 0; z-index: 30; flex-direction: column; justify-content: flex-end; }
.sheet:target { display: flex; }
.sheet-bg { position: absolute; inset: 0; background: rgba(20,32,28,.55); }
.panel { position: relative; width: 100%; max-width: 480px; margin: 0 auto; background: #fff; border-radius: 22px 22px 0 0; padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); }
.row-btns { display: flex; gap: 10px; margin-top: 16px; }
.row-btns .btn.pri { flex: 1; }

/* outcome */
.oc-head { display: flex; gap: 4px; align-items: flex-start; margin: -8px 0 0 -8px; }
.oc-head h1 { font-size: 20px; margin-top: 10px; }

/* follow-ups */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: #E6E9E4; }
.seg a { height: 40px; border-radius: 9px; display: flex; align-items: center; justify-content: center; color: var(--ink); font-size: 14px; font-weight: 500; }
.seg a.on { background: #fff; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg a.on.red { background: var(--red); color: #fff; }
.fu-item > a { display: flex; flex-direction: column; gap: 4px; color: var(--ink); }
.fu-acts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.fu-acts form { display: contents; }
.btn-s { height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 14px; font-weight: 600; border: 1px solid var(--line2); background: #fff; color: var(--ink); }
.btn-s .i { width: 18px; height: 18px; }
.btn-s.call { background: var(--pri-bg); color: var(--pri-d); border-color: transparent; }
.btn-s.wa { background: var(--wa-bg); color: var(--wa-d); border-color: transparent; }

/* collapsible */
details.more, details.card { background: #fff; border-radius: 14px; border: 1px solid var(--line); }
details.card { padding: 0; }
summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 14px; }
summary::-webkit-details-marker { display: none; }
summary > span:not(.avatar):not(.st) { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
summary small { font-size: 13px; color: var(--muted); }
summary .i { color: var(--muted); transition: transform .15s; }
details[open] > summary .i:last-child { transform: rotate(180deg); }
.more-body, details.card > form, details.card > div { padding: 12px 14px 4px; border-top: 1px solid var(--line); }

/* report */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats3 .stat { padding: 12px; }
.stats3 .stat b { font-size: 22px; }
.bars { display: grid; grid-template-columns: 86px 1fr 34px; gap: 8px 10px; align-items: center; font-size: 14px; }
.bars span { color: var(--soft); }
.bars b { text-align: right; }
meter { width: 100%; height: 14px; }
meter::-webkit-meter-bar { background: var(--grey-bg); border: 0; border-radius: 4px; height: 14px; }
meter::-webkit-meter-optimum-value { background: var(--pri); border-radius: 4px; }
meter::-moz-meter-bar { background: var(--pri); border-radius: 4px; }
.scroll-x { overflow-x: auto; margin: 0 -14px; padding: 0 14px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; white-space: nowrap; }
.tbl th { font-size: 12px; color: var(--muted); font-weight: 600; text-align: right; padding: 0 6px 8px; }
.tbl td { text-align: right; padding: 10px 6px; border-top: 1px solid var(--line); }
.tbl th:first-child, .tbl td:first-child { text-align: left; padding-left: 0; }
.wa-btn { flex: 1; }
.map-select { width: 46%; height: 44px; font-size: 14px; padding: 0 8px; }
.notice { background: var(--amber-bg); color: var(--amber); padding: 12px 14px; border-radius: 12px; font-size: 14px; }

/* login */
.login { padding-top: 12vh; }
.login h1 { font-size: 30px; margin-bottom: 6px; }
.login form { margin-top: 24px; }
.login .err { margin-top: 16px; }

/* ===== polish & motion ===== */
:root {
  --ease: cubic-bezier(.2,.8,.2,1); --spring: cubic-bezier(.34,1.56,.64,1);
  --sh1: 0 1px 2px rgba(20,32,28,.05), 0 1px 4px rgba(20,32,28,.04);
  --sh2: 0 6px 18px rgba(20,32,28,.09), 0 2px 4px rgba(20,32,28,.05);
  --ring: 0 0 0 3px rgba(14,107,92,.18);
  interpolate-size: allow-keywords;
}
html { -webkit-tap-highlight-color: transparent; }
body { -webkit-font-smoothing: antialiased; }
b, .stat b, .badge, .tbl td { font-variant-numeric: tabular-nums; }

/* page-to-page: native cross-document transitions; nav bars stay put */
@media (prefers-reduced-motion: no-preference) { @view-transition { navigation: auto; } }
::view-transition-old(root) { animation: vt-out .12s ease both; }
::view-transition-new(root) { animation: vt-in .2s var(--ease) both; }
::view-transition-group(seg), ::view-transition-group(chip) { animation-duration: .32s; animation-timing-function: var(--ease); }
.tabs { view-transition-name: tabs; }
.fab { view-transition-name: fab; }
.actionbar { view-transition-name: actionbar; }
.seg a.on { view-transition-name: seg; }
.chip-link.on { view-transition-name: chip; }

/* content rises in, staggered */
.app > :not(.sheet, .actionbar), .cards > *, .list > .row { animation: rise .34s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 28ms); }
:is(.app, .cards, .list) > :nth-child(2) { --i: 1 } :is(.app, .cards, .list) > :nth-child(3) { --i: 2 }
:is(.app, .cards, .list) > :nth-child(4) { --i: 3 } :is(.app, .cards, .list) > :nth-child(5) { --i: 4 }
:is(.app, .cards, .list) > :nth-child(6) { --i: 5 } :is(.app, .cards, .list) > :nth-child(7) { --i: 6 }
:is(.app, .cards, .list) > :nth-child(8) { --i: 7 } :is(.app, .cards, .list) > :nth-child(n+9) { --i: 8 }
.actionbar { animation: bar-up .4s var(--ease) both; }
.fab { animation: pop .45s var(--spring) .12s backwards; }
@keyframes rise { from { opacity: 0; translate: 0 8px; } }
@keyframes bar-up { from { translate: 0 100%; } }
@keyframes pop { from { opacity: 0; scale: .5; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; } }

/* surfaces */
.card, .list, .lead-card, .stat, .sc, .search, details.more, details.card { box-shadow: var(--sh1); }
.list { overflow: hidden; }
.avatar { background: linear-gradient(135deg, #14826F, var(--pri-d)); }
.avatar.sq { background: linear-gradient(135deg, #2A3A35, var(--ink)); }
.sc.pri, .btn.pri, .ab.pri { background: linear-gradient(180deg, #11786A, var(--pri)); box-shadow: 0 2px 8px rgba(14,107,92,.28); }
.ab.wa { background: linear-gradient(180deg, #1A8352, var(--wa)); box-shadow: 0 2px 8px rgba(21,115,71,.28); }
.overdue { background: linear-gradient(135deg, #C9301F, #9C1C12); box-shadow: 0 10px 24px -8px rgba(180,35,24,.55); }
.ov-head .i { animation: wiggle .6s ease .5s 2; transform-origin: 50% 20%; }
@keyframes wiggle { 25% { rotate: -12deg; } 75% { rotate: 12deg; } }
.tabs, .actionbar { background: rgba(255,255,255,.86); -webkit-backdrop-filter: saturate(1.8) blur(14px); backdrop-filter: saturate(1.8) blur(14px); }
.empty { border: 1px dashed var(--line2); border-radius: 14px; }
body:has(.login) { background: radial-gradient(120% 60% at 50% -10%, var(--pri-bg), var(--bg) 70%); }

/* everything you can tap gives feedback */
:is(.btn, .btn-s, .ib, .ib-plain, .ab, .sc, .stat, .chip-link, .chip span, .opt span, .ov-btn, .fab, .tabs a, .seg a, .lead-card, .fu-card, a.row, .avatar, summary, .search, input, select, textarea) {
  transition: scale .18s var(--ease), translate .2s var(--ease), background-color .2s, border-color .2s, color .2s, box-shadow .2s, filter .2s;
}
:is(.btn, .btn-s, .ib, .ib-plain, .ab, .chip-link, .ov-btn, .fab, .seg a, .avatar):active, .chip:active span, .opt:active span { scale: .95; }
.lead-card:has(> a.grow:active), a.fu-card:active, .fu-card:has(.fu-main:active), .stat:active, .sc:active { scale: .98; }
a.row:active, summary:active { background: var(--grey-bg); }
.tabs a:active .i { scale: .85; }
.tabs a .i { transition: scale .2s var(--spring); }
@media (hover: hover) {
  .lead-card:hover, .stat:hover, .sc:hover, a.fu-card:hover { box-shadow: var(--sh2); translate: 0 -1px; }
  a.row:hover, summary:hover { background: #FAFBF9; }
  a.row:hover .i { translate: 3px 0; }
  .btn:hover, .btn-s:hover, .ab:hover { border-color: var(--muted); }
  .btn.pri:hover, .sc.pri:hover, .ab.pri:hover, .ab.wa:hover { filter: brightness(.92); }
  .chip-link:not(.on):hover, .chip:hover input:not(:checked) + span, .opt:hover input:not(:checked) + span { border-color: var(--pri); color: var(--pri-d); }
  .ib-call:hover { background: var(--pri); color: #fff; }
  .ib-wa:hover { background: var(--wa); color: #fff; }
  .fab:hover { box-shadow: 0 10px 24px rgba(14,107,92,.45); }
  .fab:hover .i { rotate: 90deg; }
  .tabs a:not(.on):hover { color: var(--ink); }
}
a.row .i, .fab .i { transition: translate .2s var(--ease), rotate .3s var(--spring); }

/* active tab gets a pill behind its icon */
.tabs a { isolation: isolate; }
.tabs a.on::before { content: ""; position: absolute; z-index: -1; top: 9px; left: 50%; width: 56px; height: 30px; margin-left: -28px; border-radius: 15px; background: var(--pri-bg); animation: pill .4s var(--spring) both; }
@keyframes pill { from { scale: .3 1; opacity: 0; } }
.badge { animation: pop .4s var(--spring) .25s backwards; box-shadow: 0 0 0 2px #fff; }
.badge::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--red); z-index: -1; animation: ping 1.6s ease-out .8s 3; }
@keyframes ping { 70%, 100% { scale: 2; opacity: 0; } }

/* selections pop */
.chip input:checked + span, .chip-link.on { box-shadow: 0 2px 6px rgba(20,32,28,.18); }
.opt input:checked + span { border: 1px solid var(--pri); box-shadow: inset 0 0 0 1px var(--pri); }
.chip input:checked + span, .opt input:checked + span { animation: sel .3s var(--spring); }
@keyframes sel { 40% { scale: 1.06; } }
.seg a.on { box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.seg a.on.red { box-shadow: 0 2px 8px rgba(180,35,24,.35); }
.opts-fu:has(input[value=custom]:checked) + .fu-at { animation: rise .25s var(--ease); }

/* focus ring */
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pri); box-shadow: var(--ring); }
.search input:focus { box-shadow: none; }
.search:focus-within { border-color: var(--pri); box-shadow: var(--ring); color: var(--pri); }

/* collapsibles open smoothly (where supported) */
details::details-content { block-size: 0; overflow: hidden; transition: block-size .3s var(--ease), content-visibility .3s allow-discrete; }
details[open]::details-content { block-size: auto; }
summary .i { transition: rotate .25s var(--ease), transform .25s var(--ease); }

/* bottom sheets: slide up, slide down on close, drag handle */
.sheet-bg { -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.sheet:target .sheet-bg { animation: fade-in .25s ease; }
.sheet:target .panel { animation: sheet-up .4s var(--ease); }
.sheet.closing .sheet-bg { animation: fade-out .22s ease forwards; }
.sheet.closing .panel { animation: sheet-down .22s cubic-bezier(.4,0,1,1) forwards; }
.panel { box-shadow: 0 -10px 40px rgba(20,32,28,.18); touch-action: none; transition: translate .25s var(--ease); }
.panel::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line2); margin: -8px auto 14px; cursor: grab; }
@keyframes sheet-up { from { translate: 0 100%; } }
@keyframes sheet-down { to { translate: 0 100%; } }
@keyframes fade-out { to { opacity: 0; } }

/* loading: thin bar at the top, spinner on the pressed button */
body.loading::before { content: ""; position: fixed; z-index: 100; top: 0; left: 0; height: 3px; width: 0; border-radius: 0 2px 2px 0; background: linear-gradient(90deg, var(--pri), #3FB59E); box-shadow: 0 0 8px rgba(14,107,92,.5); animation: load 6s cubic-bezier(.08,.7,.2,1) .12s forwards; }
@keyframes load { to { width: 92%; } }
.busy { pointer-events: none; opacity: .8; }
.busy::before { content: ""; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .6s linear infinite; flex-shrink: 0; }
.ib.busy .i, .btn-s.busy .i { display: none; }
@keyframes spin { to { rotate: 360deg; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .busy::before { animation-duration: 1s !important; animation-iteration-count: infinite !important; }
}

/* long-form text pages (privacy policy) */
.doc h2 { font-size: 17px; }
.doc p, .doc li { line-height: 1.55; color: var(--soft); }
.doc p + p, .doc ul + p { margin-top: 10px; }
.doc ul { margin: 0; padding-left: 20px; }
.doc li + li { margin-top: 6px; }
.doc a { text-decoration: underline; }
