/* =====================================================================
   Afya Kwanza app (PWA, /app/*) — direction F "Jamii"
   Mobile first. From 1024px the app gets a desktop layout (see the end).
   ===================================================================== */
:root {
  --green: #075B4B;
  --green-deep: #0B3D33;
  --green-mid: #12544A;
  --teal: #16A085;
  --teal-text: #0E7C66;
  --mint: #EAF7F3;
  --mint-strong: #CDEDE3;
  --offwhite: #F8FAFC;
  --surface: #FFFFFF;
  --ink: #172B36;
  --muted: #4B5F6B;
  --line: #DCE7E3;
  --line-strong: #7A8C96;
  --soft-on-dark: #B7E4D6;
  --edge-on-dark: #5E8F82;
  --accent-on-dark: #8FD3BF;

  --ok-bg: #E3F5EC;   --ok-ink: #0B5D3B;
  --warn-bg: #FFF4D6; --warn-ink: #7A4B00;
  --bad-bg: #FDE7E4;  --bad-ink: #A12A1C;
  --info-bg: #E6F0FA; --info-ink: #124A7C;

  --r-sm: 10px; --r-md: 16px; --r-lg: 20px; --r-xl: 28px;
  --shadow: 0 1px 2px rgba(23, 43, 54, .06), 0 8px 24px rgba(23, 43, 54, .06);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --tabbar-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --app-w: 480px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.afya {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--ink);
  background: #E4ECE9;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
img, svg { display: block; max-width: 100%; }
a { color: var(--green); text-underline-offset: 3px; }
a:hover { color: var(--green-deep); }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--teal-text); outline-offset: 2px; border-radius: 6px; }
.on-dark :focus-visible, .hero :focus-visible { outline-color: var(--accent-on-dark); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { flex-shrink: 0; }

.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font-weight: 700; }
.skip-link:focus { top: calc(12px + var(--safe-t)); }

/* ---------- App frame ---------- */
.app-shell {
  position: relative; width: 100%; max-width: var(--app-w); margin: 0 auto;
  min-height: 100vh; min-height: 100dvh; background: var(--offwhite);
  display: flex; flex-direction: column;
}
@media (min-width: 560px) {
  .app-shell { box-shadow: 0 0 0 1px rgba(23, 43, 54, .06), 0 20px 60px rgba(23, 43, 54, .12); }
}
.app-main { flex: 1; outline: none; }
.has-tabbar .app-main { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); }

/* ---------- Dark hero header (home, card, welcome) ---------- */
.hero {
  background: var(--green-deep); color: #fff;
  padding: calc(20px + var(--safe-t)) 20px 28px;
  display: flex; flex-direction: column; gap: 16px;
}
.hero-row { display: flex; align-items: center; gap: 12px; }
.hero-greeting { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hero-greeting small { font-size: 14px; color: var(--soft-on-dark); }
.hero-greeting strong { font-size: 22px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero + .sheet { margin-top: -16px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; color: #fff; text-decoration: none; }
.brand .ico { color: var(--accent-on-dark); }

.sheet {
  position: relative; background: var(--offwhite); border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 20px 20px 8px; display: flex; flex-direction: column; gap: 20px;
}
.page { padding: 16px 20px 8px; display: flex; flex-direction: column; gap: 20px; }

/* ---------- Top bar (inner pages) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + var(--safe-t)) 12px 10px;
  background: rgba(248, 250, 252, .94); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { flex: 1; min-width: 0; padding-left: 4px; }
.topbar-title h1 { font-size: 18px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-title p { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; color: var(--teal-text); }

.icon-btn {
  width: 48px; height: 48px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: var(--r-md); border: 1px solid transparent; background: transparent; color: var(--ink);
  cursor: pointer; text-decoration: none; position: relative;
}
.icon-btn:hover { background: var(--mint); color: var(--ink); }
.hero .icon-btn { border-color: var(--edge-on-dark); color: #fff; }
.hero .icon-btn:hover { background: var(--green-mid); color: #fff; }

/* ---------- Bottom tab bar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); z-index: 30;
  width: 100%; max-width: var(--app-w);
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 6px 4px calc(6px + var(--safe-b));
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar-item {
  min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none; border-radius: var(--r-sm);
  position: relative;
}
.tabbar-item:hover { color: var(--green); }
.tabbar-item[aria-current="page"] { color: var(--green); font-weight: 800; }
.tabbar-item[aria-current="page"] .ico { fill: var(--mint); }
.tabbar-item[aria-current="page"]::after {
  content: ""; position: absolute; bottom: 3px; width: 20px; height: 3px; border-radius: 2px; background: var(--green);
}

/* ---------- Buttons ---------- */
.btn {
  -webkit-appearance: none; appearance: none;
  min-height: 52px; padding: 0 20px; border-radius: var(--r-md); border: 1.5px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 700 16px/1.2 var(--font); text-decoration: none; text-align: center; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .1s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-deep); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--green); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--mint); color: var(--green-deep); }
.btn-ghost { background: transparent; color: var(--green); min-height: 48px; }
.btn-ghost:hover { background: var(--mint); }
.btn-light { background: #fff; color: var(--green-deep); }
.btn-light:hover { background: var(--mint); color: var(--green-deep); }
.btn-outline-light { background: transparent; color: #fff; border-color: var(--edge-on-dark); }
.btn-outline-light:hover { background: var(--green-mid); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 999px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn.is-loading { pointer-events: none; opacity: .8; }
.btn.is-loading::after {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-stack { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Cards & lists ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
}
a.card { color: var(--ink); text-decoration: none; }
a.card:hover { border-color: var(--teal); }
.card-mint { background: var(--mint); border-color: transparent; }
.card-title { font-size: 16px; font-weight: 800; }
.card-eyebrow { font-size: 12px; font-weight: 700; color: var(--teal-text); letter-spacing: .06em; text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.xs { font-size: 13px; }

.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-head h2 { font-size: 17px; font-weight: 800; }
.section-head a { font-size: 14px; font-weight: 700; min-height: 44px; display: inline-flex; align-items: center; }

.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.list > li + li { border-top: 1px solid var(--line); }
.list-row {
  min-height: 60px; padding: 12px 16px; display: flex; align-items: center; gap: 14px;
  color: var(--ink); text-decoration: none; width: 100%; background: none; border: 0; font: inherit; text-align: left; cursor: pointer;
}
a.list-row:hover, button.list-row:hover { background: var(--offwhite); color: var(--ink); }
.list-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.list-row .grow strong { font-weight: 700; }
.list-row .grow span { font-size: 14px; color: var(--muted); }
.list-row > .ico:last-child { color: var(--line-strong); }
.list-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--mint); color: var(--green); display: grid; place-items: center; flex-shrink: 0; }

/* ---------- Quick actions ---------- */
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.quick a {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 0;
  font-size: 12px; font-weight: 700; color: var(--ink); text-decoration: none; text-align: center; border-radius: var(--r-md);
}
.quick-ico { width: 56px; height: 56px; border-radius: 18px; background: var(--mint); color: var(--green); display: grid; place-items: center; transition: transform .15s ease; }
.quick a:first-child .quick-ico { background: var(--green); color: #fff; }
.quick a:hover .quick-ico { transform: translateY(-2px); }

/* ---------- Membership strip & card ---------- */
.member-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: var(--r-md); background: var(--green-mid);
}
.member-strip small { display: block; font-size: 12px; color: var(--soft-on-dark); }
.member-strip strong { font-size: 16px; font-weight: 800; letter-spacing: .02em; }

.member-card {
  position: relative; overflow: hidden; color: #fff; border-radius: 24px; padding: 20px;
  background: radial-gradient(120% 90% at 100% 0%, #1B7A66 0%, rgba(27, 122, 102, 0) 55%), linear-gradient(160deg, var(--green) 0%, var(--green-deep) 100%);
  box-shadow: 0 16px 40px rgba(11, 61, 51, .28);
  display: flex; flex-direction: column; gap: 16px;
}
.member-card::after {
  content: ""; position: absolute; right: -40px; bottom: -40px; width: 180px; height: 180px; border-radius: 50%;
  border: 28px solid rgba(255, 255, 255, .05);
}
.member-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.member-card .label { font-size: 12px; color: var(--soft-on-dark); }
.member-card .number { font-size: 22px; font-weight: 800; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.member-card .name { font-size: 18px; font-weight: 700; }
.member-card dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin: 0; }
.member-card dt { font-size: 12px; color: var(--soft-on-dark); }
.member-card dd { margin: 0; font-weight: 700; }
.qr-box { position: relative; z-index: 1; background: #fff; border-radius: var(--r-md); padding: 14px; display: flex; align-items: center; gap: 14px; color: var(--ink); }
.qr-box svg { width: 112px; height: 112px; flex-shrink: 0; }
.qr-box p { font-size: 14px; color: var(--muted); }
.qr-box strong { display: block; color: var(--ink); font-size: 15px; }

/* ---------- Status pills (word + colour, never colour alone) ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 700; white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-ok { background: var(--ok-bg); color: var(--ok-ink); }
.pill-warn { background: var(--warn-bg); color: var(--warn-ink); }
.pill-bad { background: var(--bad-bg); color: var(--bad-ink); }
.pill-info { background: var(--info-bg); color: var(--info-ink); }
.pill-muted { background: #EEF2F4; color: var(--muted); }
.pill-on-dark { background: rgba(255, 255, 255, .14); color: #fff; }

/* ---------- Next step / notices ---------- */
.next-step { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--teal); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.next-step h2 { font-size: 17px; font-weight: 800; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--r-md); font-size: 15px; }
.notice .ico { margin-top: 1px; }
.notice-info { background: var(--info-bg); color: var(--info-ink); }
.notice-warn { background: var(--warn-bg); color: var(--warn-ink); }
.notice-bad { background: var(--bad-bg); color: var(--bad-ink); }
.notice-ok { background: var(--ok-bg); color: var(--ok-ink); }
.notice a { color: inherit; font-weight: 700; }
.toast-inline { margin: 12px 20px 0; padding: 12px 14px; border-radius: var(--r-md); background: var(--ok-bg); color: var(--ok-ink); font-weight: 600; }

/* ---------- Journey tracker ---------- */
.journey { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; counter-reset: step; }
.journey li { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; position: relative; }
.journey li::before {
  counter-increment: step; content: counter(step);
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; z-index: 1;
  background: var(--surface); border: 2px solid var(--line-strong); color: var(--muted); font-weight: 800; font-size: 13px;
}
.journey li:not(:first-child)::after { content: ""; position: absolute; top: 14px; right: 50%; width: 100%; height: 2px; background: var(--line); }
.journey li.is-done::before { content: "✓"; background: var(--teal-text); border-color: var(--teal-text); color: #fff; }
.journey li.is-done:not(:first-child)::after, .journey li.is-current:not(:first-child)::after { background: var(--teal-text); }
.journey li.is-current { color: var(--ink); font-weight: 800; }
.journey li.is-current::before { border-color: var(--green); color: var(--green); box-shadow: 0 0 0 4px var(--mint-strong); }

/* ---------- Packages ---------- */
.pkg-scroller { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -20px; padding: 4px 20px 12px; scrollbar-width: none; }
.pkg-scroller::-webkit-scrollbar { display: none; }
.pkg {
  scroll-snap-align: start; flex: 0 0 78%; max-width: 320px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px;
  display: flex; flex-direction: column; gap: 10px; color: var(--ink); text-decoration: none;
}
.pkg:hover { border-color: var(--teal); color: var(--ink); }
.pkg.is-featured { border: 2px solid var(--green); }
.pkg-name { font-size: 20px; font-weight: 800; }
.pkg-price { font-size: 24px; font-weight: 800; color: var(--green); font-variant-numeric: tabular-nums; }
.pkg-price small { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
.pkg-tag { align-self: flex-start; }
.pkg-list .pkg { flex: none; max-width: none; }
.pkg-list { display: flex; flex-direction: column; gap: 12px; }
.tests { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tests li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.tests .ico { color: var(--teal-text); margin-top: 2px; }
.benefits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.benefits li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.benefits li:last-child { border-bottom: 0; }
.benefits li span:last-child { font-weight: 700; text-align: right; }

/* Sticky action bar above the safe area */
.action-bar {
  position: sticky; bottom: 0; z-index: 10; margin: 8px -20px 0; padding: 12px 20px calc(12px + var(--safe-b));
  background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
}
.action-bar .total { flex: 1; display: flex; flex-direction: column; }
.action-bar .total small { font-size: 12px; color: var(--muted); }
.action-bar .total strong { font-size: 18px; font-weight: 800; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 20px; }
.fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.fieldset legend { padding: 0; margin-bottom: 4px; font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--teal-text); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 15px; font-weight: 700; }
.field .hint { font-size: 13px; color: var(--muted); }
.error { font-size: 14px; color: var(--bad-ink); font-weight: 600; display: flex; gap: 6px; align-items: flex-start; }
.req { color: var(--bad-ink); }
.input, .select {
  -webkit-appearance: none; appearance: none; width: 100%; min-height: 52px; padding: 12px 14px;
  font: 500 16px/1.3 var(--font); color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line-strong); border-radius: var(--r-md);
}
.select { padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%234B5F6B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 8 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input:focus, .select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px var(--mint-strong); }
.input[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--bad-ink); }
.input::placeholder { color: #8A9AA3; }
.input-code { font-size: 28px; font-weight: 800; letter-spacing: .5em; text-align: center; padding-left: calc(14px + .5em); font-variant-numeric: tabular-nums; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 360px) { .grid-2 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; cursor: pointer; padding: 4px 0; }
.check input { width: 24px; height: 24px; margin: 0; flex-shrink: 0; accent-color: var(--green); }

.segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { min-height: 52px; display: flex; align-items: center; justify-content: center; border: 1.5px solid var(--line-strong); border-radius: var(--r-md); font-weight: 700; background: var(--surface); }
.segmented input:checked + span { border-color: var(--green); background: var(--mint); color: var(--green-deep); box-shadow: inset 0 0 0 1px var(--green); }
.segmented input:focus-visible + span { outline: 3px solid var(--teal-text); outline-offset: 2px; }

/* ---------- Key/value ---------- */
.kv { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 700; text-align: right; word-break: break-word; }
.copy-row { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.copy-btn { white-space: nowrap; flex-shrink: 0; min-height: 36px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font: 700 13px var(--font); color: var(--green); cursor: pointer; }

/* ---------- Results ---------- */
.result-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.result-row + .result-row { border-top: 1px solid var(--line); }
.result-row .grow { flex: 1; min-width: 0; }
.result-row .test { font-weight: 700; }
.result-row .range { font-size: 13px; color: var(--muted); }
.result-row .value { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.result-row .value small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.summary-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.summary-stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; text-align: center; }
.summary-stats strong { display: block; font-size: 22px; font-weight: 800; }
.summary-stats span { font-size: 13px; color: var(--muted); }
.prose { white-space: pre-line; font-size: 16px; line-height: 1.6; }
.stat-big { font-size: 32px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-big small { font-size: 15px; font-weight: 600; color: var(--muted); }
.table-scroll { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.mini-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 6px 8px; white-space: nowrap; }
.mini-table td { padding: 8px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Welcome ---------- */
.welcome { min-height: 100vh; min-height: 100dvh; background: var(--green-deep); display: flex; flex-direction: column; }
.welcome-top { padding: calc(16px + var(--safe-t)) 20px 0; display: flex; flex-direction: column; gap: 16px; }
.welcome-visual {
  position: relative; border-radius: 24px; overflow: hidden; aspect-ratio: 4 / 3; max-height: 26vh;
  background: var(--green-mid);
}
.welcome-visual img { width: 100%; height: 100%; object-fit: cover; }
.welcome-visual::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11, 61, 51, 0) 45%, rgba(11, 61, 51, .85) 100%); }
.welcome-visual .chip { position: absolute; left: 14px; bottom: 14px; z-index: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: #fff; color: var(--green-deep); font-size: 13px; font-weight: 700; }
.welcome-body {
  margin-top: 20px; flex: 1; background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 28px 24px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 16px;
}
.welcome-body h1 { font-size: clamp(24px, 7.5vw, 30px); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.welcome-body .lead { font-size: 16px; line-height: 1.55; color: var(--muted); }
.feature-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
@media (max-height: 760px) { .feature-list { display: none; } }
.feature-list li { display: flex; gap: 12px; align-items: center; font-size: 15px; font-weight: 600; }
.feature-list .list-ico { width: 36px; height: 36px; border-radius: 10px; }
.trust { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.trust .ico { color: var(--teal-text); }

/* ---------- Login ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--green-deep); }
.auth .hero { padding-bottom: 40px; }
.auth .hero h1 { font-size: 26px; font-weight: 800; }
.auth .hero p { color: var(--soft-on-dark); }
.auth .sheet { flex: 1; margin-top: -16px; padding-bottom: calc(24px + var(--safe-b)); background: var(--surface); }

/* ---------- Banners & toasts ---------- */
.net-banner {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 60; width: 100%; max-width: var(--app-w);
  padding: calc(8px + var(--safe-t)) 16px 8px; background: #3A2E05; color: #FFE8A3; font-size: 14px; font-weight: 600;
  display: flex; gap: 8px; align-items: center; justify-content: center;
}
.net-banner[hidden] { display: none; }
.update-toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px); z-index: 50;
  width: calc(100% - 32px); max-width: calc(var(--app-w) - 32px);
  background: var(--ink); color: #fff; border-radius: var(--r-md); padding: 10px 10px 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 15px; box-shadow: var(--shadow);
}
.update-toast[hidden] { display: none; }
.install-card { background: var(--mint); border-radius: var(--r-lg); padding: 16px; display: flex; gap: 14px; align-items: center; }
.install-card[hidden] { display: none; }
.install-card .grow { flex: 1; }
.install-card strong { display: block; }
.install-card p { font-size: 14px; color: var(--muted); }
.ios-steps { margin: 8px 0 0; padding-left: 20px; font-size: 14px; color: var(--muted); }

/* ---------- Empty / offline ---------- */
.empty { text-align: center; padding: 32px 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty-ico { width: 72px; height: 72px; border-radius: 24px; background: var(--mint); color: var(--green); display: grid; place-items: center; }
.empty h2 { font-size: 20px; font-weight: 800; }
.empty p { color: var(--muted); max-width: 32ch; }

/* ---------- Footer note ---------- */
.foot-note { font-size: 13px; color: var(--muted); text-align: center; padding: 8px 0 4px; }

/* ---------- Motion & print ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
  body.afya { background: #fff; }
  .tabbar, .topbar .icon-btn, .no-print, .net-banner, .update-toast, .action-bar { display: none !important; }
  .app-shell { box-shadow: none; max-width: none; }
  .topbar { position: static; }
  .card, .list { break-inside: avoid; }
}

/* ---------- FAQ (details/summary) ---------- */
.faq + .faq { border-top: 1px solid var(--line); }
.faq summary { list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .ico { transition: transform .15s ease; }
.faq[open] summary .ico { transform: rotate(90deg); }

/* ---------- Group picker (sign-up) ---------- */
.group-steps { display: flex; flex-direction: column; gap: 14px; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span {
  min-height: 56px; padding: 10px 12px; display: flex; flex-direction: column; justify-content: center;
  border: 1.5px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface);
}
.choice strong { font-size: 16px; font-weight: 700; }
.choice small { font-size: 13px; color: var(--muted); }
.choice input:checked + span { border-color: var(--green); background: var(--mint); box-shadow: inset 0 0 0 1px var(--green); }
.choice input:checked + span strong { color: var(--green-deep); }
.choice input:focus-visible + span { outline: 3px solid var(--teal-text); outline-offset: 2px; }
.group-summary { padding: 10px 14px; border-radius: var(--r-md); background: var(--ok-bg); color: var(--ok-ink); font-size: 14px; font-weight: 600; }
.group-summary.is-error { background: var(--bad-bg); color: var(--bad-ink); }

/* ---------- Payment options (registration status) ---------- */
.pay-option { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--offwhite); }
.pay-option-head { display: flex; align-items: center; gap: 12px; }
.pay-option-head strong { display: block; font-size: 16px; }
.pay-option-head span:not(.list-ico) { font-size: 13px; color: var(--muted); }
.pay-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.5; }

/* Desktop-only pieces (side menu brand/help, sign-up summary) */
.tabbar-brand, .tabbar-help, .action-summary { display: none; }

/* ---------- Install page (/app/pakua) ---------- */
.install-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--green-deep); }
.install-hero { padding: calc(20px + var(--safe-t)) 20px 32px; color: #fff; display: flex; flex-direction: column; gap: 20px; }
.install-app { display: flex; gap: 16px; align-items: center; }
.install-app img { width: 72px; height: 72px; border-radius: 20px; flex-shrink: 0; box-shadow: 0 10px 24px rgba(0, 0, 0, .25); }
.install-app h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.install-app p { margin-top: 6px; font-size: 15px; line-height: 1.5; color: var(--soft-on-dark); }
.install-points { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.install-points li { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--green-mid); font-size: 13px; font-weight: 600; color: #E6F5F0; }
.install-points .ico { color: var(--accent-on-dark); }
.install-body {
  flex: 1; background: var(--offwhite); border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 24px 20px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 16px;
}
.install-step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.install-step h2, .install-share h2 { font-size: 18px; font-weight: 800; }
.install-steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; font-size: 15px; line-height: 1.5; }
.install-steps li::marker { font-weight: 800; color: var(--green); }
.kbd { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 4px; border-radius: 8px; border: 1px solid var(--line-strong); font-weight: 800; line-height: 1; vertical-align: middle; }
.ios-share { display: inline; vertical-align: -4px; color: var(--info-ink); }
.btn-lg { min-height: 58px; font-size: 17px; }
.install-desktop { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 24px; }
.install-qr { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px; }
.install-qr svg { width: 200px; height: 200px; }
.install-desktop-text { flex: 1 1 260px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.install-share { display: flex; flex-direction: column; gap: 10px; }
.install-links { display: flex; flex-direction: column; align-items: center; }
.install-links a { min-height: 44px; display: inline-flex; align-items: center; font-weight: 700; }

/* =====================================================================
   Desktop (1024px+): wide shell, side menu instead of the tab bar,
   split welcome/login/install screens, form + summary for sign-up.
   ===================================================================== */
@media (min-width: 1024px) {
  .app-shell { max-width: 880px; }
  .page { padding: 28px 32px 32px; }
  .topbar { padding: 16px 24px; }
  .topbar-title h1 { font-size: 22px; }
  .update-toast { bottom: 24px; }

  /* Side menu */
  .has-tabbar .app-shell {
    max-width: 1240px; display: grid; grid-template-columns: 248px minmax(0, 1fr); grid-template-rows: auto 1fr;
  }
  .has-tabbar .app-shell > header { grid-column: 2; grid-row: 1; }
  .has-tabbar .app-main { grid-column: 2; grid-row: 2; padding-bottom: 40px; }
  .has-tabbar .tabbar {
    grid-column: 1; grid-row: 1 / span 2; align-self: start;
    position: sticky; top: 0; left: auto; transform: none; width: auto; max-width: none;
    height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 4px;
    padding: 24px 16px; background: var(--green-deep); border: 0;
  }
  .tabbar-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; color: #fff; font-size: 17px; font-weight: 800; text-decoration: none; }
  .tabbar-brand:hover { color: #fff; }
  .tabbar-brand img { width: 34px; height: 34px; border-radius: 9px; }
  .tabbar-item { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 48px; padding: 0 14px; font-size: 15px; color: var(--soft-on-dark); border-radius: var(--r-md); }
  .tabbar-item:hover { background: var(--green-mid); color: #fff; }
  .tabbar-item[aria-current="page"] { background: var(--green-mid); color: #fff; }
  .tabbar-item[aria-current="page"] .ico { fill: none; color: var(--accent-on-dark); }
  .tabbar-item[aria-current="page"]::after { display: none; }
  .tabbar :focus-visible { outline-color: var(--accent-on-dark); }
  .tabbar-help {
    display: flex; gap: 10px; align-items: flex-start; margin-top: auto; padding: 14px; border-radius: var(--r-md);
    background: var(--green-mid); color: #E6F5F0; font-size: 13px; text-decoration: none;
  }
  .tabbar-help:hover { color: #fff; }
  .tabbar-help strong { display: block; font-size: 15px; color: #fff; }

  .has-tabbar .hero { padding: 32px 40px 44px; }
  .has-tabbar .hero .member-strip { max-width: 560px; }
  .has-tabbar .sheet { padding: 28px 40px 24px; }
  .has-tabbar .page { padding: 28px 40px 32px; max-width: 860px; }
  .page-card .page, .page-health .page { max-width: none; }

  /* Home: two columns under the quick actions */
  .page-home .sheet { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
  .page-home .sheet > .quick, .page-home .sheet > .install-card, .page-home .sheet > .foot-note, .page-home .sheet > .empty { grid-column: 1 / -1; }
  .page-home .quick { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  .page-home .quick a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px; font-size: 15px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
  .page-home .quick a:hover { border-color: var(--teal); }
  .page-home .quick-ico { width: 44px; height: 44px; border-radius: 14px; }

  /* Card: card left, notes right */
  .page-card .page { display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: 24px; align-items: start; }
  .page-card .page > .empty { grid-column: 1 / -1; }

  /* Health: cards in a grid */
  .page-health .page { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; align-items: start; }
  .page-health .page > .notice, .page-health .page > .empty { grid-column: 1 / -1; }

  /* Sign-up: form left, summary card right */
  .page-register .app-shell { max-width: 1120px; }
  .page-register .form { display: grid; grid-template-columns: minmax(0, 1fr) 340px; column-gap: 28px; row-gap: 18px; align-items: start; }
  .page-register .form > .fieldset {
    grid-column: 1; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px;
  }
  .page-register .fieldset legend { float: left; width: 100%; margin-bottom: 4px; }
  .page-register .action-bar {
    grid-column: 2; grid-row: 1 / span 6; position: sticky; top: 96px; margin: 0;
    flex-direction: column; align-items: stretch; gap: 16px; padding: 20px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
  }
  .page-register .action-bar .total strong { font-size: 26px; }
  .action-summary { list-style: none; margin: 0; padding: 14px 0 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
  .action-summary li { display: flex; gap: 8px; align-items: flex-start; }
  .action-summary .ico { color: var(--teal-text); margin-top: 1px; }
  .page-register .action-bar .btn { width: 100%; }

  /* Packages list as a grid */
  .pkg-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Split screens: welcome, login, install */
  .is-wide .app-shell { max-width: 1280px; }
  .welcome, .auth, .install-page { flex-direction: row; }
  .welcome-top, .auth .hero, .install-hero { flex: 0 0 44%; padding: 40px 48px; }
  .welcome-top { gap: 24px; }
  .welcome-visual { flex: 1; aspect-ratio: auto; max-height: none; min-height: 360px; }
  .welcome-body, .auth .sheet, .install-body {
    flex: 1; margin: 0; border-radius: 0; padding: 64px 72px; justify-content: center;
  }
  .welcome-body > *, .auth .sheet > *, .install-body > * { width: 100%; max-width: 520px; }
  .welcome-body h1 { font-size: 46px; }
  .welcome-body .lead { font-size: 18px; }
  .feature-list { display: flex; }
  .welcome .btn-stack { margin-top: 12px !important; }
  .auth .hero { justify-content: center; gap: 20px; padding-bottom: 40px; }
  .auth .hero h1 { font-size: 36px; }
  .install-hero { justify-content: center; gap: 28px; }
  .install-app { flex-direction: column; align-items: flex-start; }
  .install-app img { width: 88px; height: 88px; border-radius: 24px; }
  .install-app h1 { font-size: 38px; }
  .install-body > .install-desktop { max-width: 620px; }
}
@media (min-width: 1024px) and (max-height: 760px) { .feature-list { display: flex; } }
