/* 1) Keep this first: anything marked hidden is really hidden,
      so a closed panel can never sit on top of buttons (the Padhai Timer fix). */
[hidden] { display: none !important; }

/* 2) Colours (light + dark) */
:root {
  --bg: #F3F6F4; --surface: #FFFFFF; --ink: #16201C; --muted: #53605A; --line: #D7DFDA;
  --brand: #0E5A4C; --on-brand: #FFFFFF; --brand-soft: #DCEEE6; --brand-ink: #0E5A4C;
  --warn: #9C5208; --warn-soft: #FBE8D0; --warn-ink: #7E4206; --warn-line: #E8B57A;
  --info: #2B5596; --info-soft: #E1E9F7; --info-ink: #244C8A; --info-line: #A9BFE3;
  --alert-soft: #FBE6E0; --alert-ink: #8E2A17; --alert-line: #E4A797;
  --chip: #EEF1EC;
  --radius: 16px;
  --f-body: 'Noto Sans', 'Noto Sans Devanagari', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-display: 'Bricolage Grotesque', 'Noto Sans', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1412; --surface: #16201C; --ink: #E6EDE9; --muted: #9AA9A2; --line: #2A3732;
    --brand: #1F7A60; --on-brand: #FFFFFF; --brand-soft: #16382E; --brand-ink: #7FD3B6;
    --warn: #A55E14; --warn-soft: #352614; --warn-ink: #F0B877; --warn-line: #6A4720;
    --info: #3B67AE; --info-soft: #18253A; --info-ink: #9DBBEE; --info-line: #2F4770;
    --alert-soft: #371B15; --alert-ink: #F4A493; --alert-line: #6E3326;
    --chip: #1F2A26;
    color-scheme: dark;
  }
}

/* 3) Base: sized for thumbs on phones */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--f-body); font-size: 17px; line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand-ink); }
:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }

.wrap { max-width: 560px; margin: 0 auto; padding: 20px 16px 120px; display: flex; flex-direction: column; gap: 18px; }

.brand { display: flex; align-items: center; gap: 10px; }
.mark { width: 40px; height: 40px; border-radius: 20px; background: var(--brand); display: grid; place-items: center; flex-shrink: 0; }
.brand b { font-family: var(--f-display); font-size: 22px; font-weight: 800; }
h1, h2 { margin: 0; font-family: var(--f-display); font-weight: 800; line-height: 1.15; text-wrap: balance; }
h1 { font-size: 30px; }
h2 { font-size: 24px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }

/* Buttons: at least 52px tall */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 10px 16px; border-radius: 14px; border: 0;
  font-weight: 700; font-size: 17px; text-decoration: none; text-align: center; width: 100%;
}
.btn.primary { background: var(--brand); color: var(--on-brand); }
.btn.ghost { background: var(--surface); color: var(--brand-ink); border: 2px solid var(--brand); }
.btn.warn { background: var(--warn); color: #fff; }
.btn.info { background: var(--info); color: #fff; }
.btn.danger { background: var(--surface); color: var(--alert-ink); border: 2px solid var(--alert-line); }
.btn.quiet { background: var(--chip); color: var(--ink); }
.btn:disabled { opacity: .6; }
.row { display: flex; gap: 10px; align-items: center; }
.row > .btn { flex: 1; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .lbl { font-weight: 700; font-size: 15px; }
.input, select.input, textarea.input {
  min-height: 52px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface);
  padding: 10px 14px; font-size: 17px; width: 100%; min-width: 0;
}
textarea.input { min-height: 84px; resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 16px; border-radius: 22px; border: 2px solid var(--line); background: var(--surface); font-weight: 600; }
.chip[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.err { color: var(--alert-ink); font-size: 14px; font-weight: 600; }

/* Boxes */
.box { border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.box.brand { background: var(--brand); color: var(--on-brand); }
.box.plain { background: var(--surface); border: 2px solid var(--line); }
.box.soft { background: var(--chip); }
.box.warn { background: var(--warn-soft); border: 2px solid var(--warn-line); }
.step { display: flex; gap: 12px; align-items: flex-start; }
.num { width: 32px; height: 32px; border-radius: 16px; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }

/* Family cards */
.member { border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; border: 2px solid var(--line); background: var(--surface); }
.member.ok { border-color: var(--brand-soft); }
.member.unwell { background: var(--warn-soft); border-color: var(--warn-line); }
.member.contact { background: var(--info-soft); border-color: var(--info-line); }
.member.noreply { background: var(--alert-soft); border-color: var(--alert-line); }
.member.wait { background: var(--chip); border-style: dashed; }
.member.wait .btn.quiet { background: var(--surface); border: 2px solid var(--line); }
.mhead { display: flex; gap: 12px; align-items: center; }
.av { width: 46px; height: 46px; border-radius: 23px; background: var(--surface); display: grid; place-items: center; flex-shrink: 0; font-weight: 800; color: var(--brand-ink); }
.ok .av { background: var(--brand-soft); }
.mname { font-weight: 800; font-size: 19px; }
.mstate { font-weight: 600; font-size: 15px; }
.ok .mstate { color: var(--brand-ink); }
.unwell .mstate { color: var(--warn-ink); }
.contact .mstate { color: var(--info-ink); }
.noreply .mstate { color: var(--alert-ink); }
.wait .mstate { color: var(--muted); }
.notebox { padding: 10px 12px; border-radius: 12px; background: var(--surface); font-size: 15px; }
.dots { display: flex; gap: 6px; align-items: center; }
.dot { width: 14px; height: 14px; border-radius: 7px; background: var(--line); }
.dot.ok { background: var(--brand); }
.dot.unwell { background: var(--warn); }
.dot.contact { background: var(--info); }
.dot.off { background: transparent; border: 2px dashed var(--line); }

.freepar { margin: 0; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px;
  background: var(--brand-soft); color: var(--brand-ink); font-weight: 800; font-size: 18px; }
.freepar svg { flex-shrink: 0; }

.langgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.langgrid button { min-height: 44px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font-size: 15px; font-weight: 600; padding: 4px; line-height: 1.2; color: var(--ink); }
.langgrid button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand); color: var(--on-brand); font-weight: 800; }
.seg.seg2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pausebox { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; background: var(--info-soft); color: var(--info-ink); }

.pricebox { display: flex; flex-direction: column; gap: 0; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); text-align: center; line-height: 1.4; }
.pricebox b { font-size: 14px; color: var(--brand-ink); }
.pricebox span { font-size: 12px; color: var(--muted); }
.langgrid:has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.cal { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); }
.cal-top { display: flex; align-items: center; justify-content: space-between; }
.cal-nav { width: 44px; height: 44px; border-radius: 22px; border: 0; background: var(--chip); font-size: 24px; line-height: 1; color: var(--ink); }
.cal-nav:disabled { opacity: .3; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; text-align: center; }
.cal-head span { font-size: 12px; color: var(--muted); font-weight: 700; padding: 4px 0; }
.cal-d { height: 40px; border: 0; border-radius: 10px; background: transparent; font-size: 15px; font-weight: 600; color: var(--ink); }
.cal-d:disabled { color: var(--line); }
.cal-d.today { box-shadow: inset 0 0 0 2px var(--line); }
.cal-d.in { background: var(--info-soft); color: var(--info-ink); border-radius: 0; }
.cal-d.edge { background: var(--info); color: #fff; border-radius: 10px; }
.cal-sum { margin: 0; text-align: center; font-weight: 700; color: var(--info-ink); }

.notebox2 { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--chip); color: var(--muted); font-size: 13px; line-height: 1.4; }
.notebox2 svg { flex-shrink: 0; color: var(--alert-ink); }
.aboutbox { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--chip); font-size: 13px; line-height: 1.4; }
.mark.mini { width: 32px; height: 32px; border-radius: 16px; }
.mark.mini svg { width: 16px; height: 16px; }

.medialist { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.playbtn { min-height: 44px; }

/* "How it works" picture */
.flow { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 18px; background: var(--surface); border: 2px solid var(--line); }
.fl-title { font-size: 20px; margin: 0; }
.fl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.fl-step { position: relative; display: flex; gap: 12px; padding: 0 0 16px; }
.fl-step:last-child { padding-bottom: 0; }
.fl-step:not(:last-child)::before { content: ""; position: absolute; left: 17px; top: 36px; bottom: 0; width: 3px; border-radius: 2px; background: var(--line); }
.fl-num { width: 36px; height: 36px; border-radius: 18px; display: grid; place-items: center; font-weight: 800; color: #fff; flex-shrink: 0; position: relative; z-index: 1; }
.fl-step.you .fl-num { background: var(--brand); }
.fl-step.maa .fl-num { background: var(--warn); }
.fl-body { display: flex; flex-direction: column; gap: 2px; padding-top: 2px; min-width: 0; }
.fl-tags { display: flex; gap: 6px; align-items: center; }
.fl-wa { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; padding: 1px 8px; border-radius: 10px; background: #25D366; color: #fff; }
.fl-who { align-self: flex-start; font-size: 12px; font-weight: 800; padding: 1px 8px; border-radius: 10px; letter-spacing: .02em; }
.fl-step.you .fl-who { background: var(--brand-soft); color: var(--brand-ink); }
.fl-step.maa .fl-who { background: var(--warn-soft); color: var(--warn-ink); }
.fl-body b { font-size: 17px; line-height: 1.3; }
.fl-sub { font-size: 14px; color: var(--muted); }
.fl-step.maa .fl-body { background: var(--warn-soft); border-radius: 12px; padding: 8px 10px; margin-top: -2px; }
.fl-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.fl-pills i { font-style: normal; font-size: 13px; font-weight: 700; color: #fff; padding: 4px 10px; border-radius: 12px; }
.fl-pills .p-ok { background: var(--brand); } .fl-pills .p-un { background: var(--warn); } .fl-pills .p-ca { background: var(--info); }
.flowfold { border-radius: 14px; border: 2px solid var(--line); background: var(--surface); }
.flowfold summary { min-height: 52px; display: flex; align-items: center; padding: 0 14px; font-weight: 700; cursor: pointer; }
.flowfold .flow { border: 0; padding-top: 0; }

.fl-extra { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--warn-line); }
.fl-chips { display: flex; gap: 6px; }
.fl-chips i { font-style: normal; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 12px; background: var(--surface); color: var(--warn-ink); border: 1px solid var(--warn-line); }
.infobox { border-radius: 12px; background: var(--chip); overflow: hidden; }
.notebox2.flat { border-radius: 0; background: transparent; }
.infolinks { display: flex; justify-content: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.infolinks a { color: var(--brand-ink); }

/* Lists (settings) */
.list { border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); display: flex; flex-direction: column; }
.li { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-top: 1px solid var(--line); }
.li:first-child { border-top: 0; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.seg button { min-height: 48px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 600; padding: 4px; line-height: 1.2; }
.seg button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.confirm { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 12px; background: var(--alert-soft); }

/* Bottom tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabbar button { border: 0; background: transparent; min-height: 60px; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.tabbar button[aria-current="true"] { color: var(--brand-ink); font-weight: 800; }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 20;
  max-width: 528px; margin: 0 auto; padding: 12px 16px; border-radius: 12px;
  background: var(--ink); color: var(--bg); font-size: 15px; text-align: center;
}
.banner { padding: 10px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn-ink); font-size: 14px; }
.footer { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; color: var(--muted); }

/* Family check-in page */
.ci { max-width: 520px; margin: 0 auto; padding: 20px 16px 40px; display: flex; flex-direction: column; gap: 18px; }
.ci .q { font-size: 28px; font-weight: 800; line-height: 1.35; margin: 0; }
.ci .big { min-height: 76px; font-size: 24px; border-radius: 18px; }
.ci .answers { display: flex; flex-direction: column; gap: 12px; }
.ci .answers .btn[aria-pressed="true"] { outline: 4px solid var(--ink); outline-offset: 3px; }
.ci .thanks { font-size: 22px; font-weight: 700; color: var(--brand-ink); }
.langpick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.langpick button { min-height: 56px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; font-size: 18px; line-height: 1.2; }
.langpick button small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.langpick button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }

.ci-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.langbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 22px;
  border: 2px solid var(--line); background: var(--surface); font-weight: 700; font-size: 16px; color: var(--ink); }
.langbtn[aria-expanded="true"] { border-color: var(--brand); color: var(--brand-ink); }
.ci-foot { margin: 8px 0 0; text-align: center; font-size: 13px; color: var(--muted); line-height: 1.8; }
.linkbtn { border: 0; background: none; padding: 0; font-size: 13px; color: var(--muted); text-decoration: underline; min-height: 0; }

.ci .answers .btn.pick[aria-pressed="true"] { outline: 5px solid var(--ink); outline-offset: 3px; }
.ci .answers:has(.pick[aria-pressed="true"]) .pick[aria-pressed="false"] { opacity: .45; }
.recbtn { gap: 8px; }
.recbox { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 14px; background: var(--chip); }
.recbox audio { width: 100%; padding-right: 40px; }
.recbox video { width: 100%; max-height: 260px; border-radius: 10px; background: #000; }
.recbox .iconbtn { position: absolute; top: 6px; right: 6px; width: 40px; height: 40px; border-radius: 20px; border: 0; background: var(--surface); color: var(--alert-ink); display: grid; place-items: center; }
.recbox.live { background: var(--alert-soft); }
.recdot { width: 14px; height: 14px; border-radius: 7px; background: #D33; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.sendbtn:disabled { opacity: .35; }
.sentnote { margin: 0; text-align: center; padding: 14px; border-radius: 14px; background: var(--brand-soft); }

.msgbox { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 16px; background: var(--surface); border: 2px solid var(--line); }
.msglbl { font-weight: 700; font-size: 18px; }
.msgbox textarea.input { min-height: 64px; }
.recbtn { min-height: 60px; font-size: 18px; }
.recbtn.recording { background: #C62828; color: #fff; border: 0; justify-content: space-between; padding: 10px 16px; }
.recbtn.recording .reclbl { flex: 1; text-align: left; font-size: 16px; }
.recbtn.recording .recdot { background: #fff; }
.vplayer { display: flex; align-items: center; gap: 12px; padding-right: 44px; }
.vp-btn { width: 52px; height: 52px; border-radius: 26px; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.vp-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.vp-bar span { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s linear; }
.vp-time { font-size: 14px; font-variant-numeric: tabular-nums; color: var(--muted); min-width: 78px; text-align: right; }

/* Legal pages */
.doc { max-width: 720px; margin: 0 auto; padding: 24px 16px 60px; }
.doc h1 { font-size: 28px; margin-bottom: 4px; }
.doc h2 { font-size: 20px; margin-top: 28px; }
.doc p, .doc li { max-width: 68ch; }

@media (prefers-reduced-motion: no-preference) {
  .member, .box { animation: rise .2s ease both; }
  @keyframes rise { from { transform: translateY(4px); } to { transform: none; } }
}

/* country code box: leave room for the phone number */
#f-cc { max-width: 38%; flex: 0 0 38% !important; }
#f-phone { flex: 1 1 auto; }

.finebox { margin-top: 18px; }
.finebox .notebox2 svg { color: var(--brand-ink); }
