/* Coaching app: one stylesheet. Tokens first (light, then dark), then layout, then components.
   No inline styles anywhere: the Content-Security-Policy forbids them, so every look is a class here. */

:root {
  --brand: #0E6B45;          /* deep green: the app, primary actions, "present" */
  --brand-ink: #094F32;
  --brand-soft: #E3F2E9;
  --brand-line: #BFE0CC;
  --accent: #E99A1E;         /* saffron: attention, waiting, the notice bell */
  --accent-soft: #FFF2D9;
  --accent-ink: #7A4400;
  --absent: #D9502F;         /* coral: absent, stop, remove */
  --absent-soft: #FDE7DF;
  --absent-ink: #922C12;
  --bg: #F3F5F0;
  --card: #FFFFFF;
  --card-2: #F8FAF6;
  --ink: #14201A;
  --ink-2: #33443B;
  --muted: #5A6B61;
  --line: #E1E7E1;
  --focus: #1F7AE0;
  --shadow: 0 1px 2px rgba(14, 40, 26, .06), 0 6px 20px rgba(14, 40, 26, .06);
  --shadow-up: 0 -6px 24px rgba(14, 40, 26, .10);
  --r: 18px;
  --r-sm: 12px;
  --font: "Noto Sans", "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* batch colours: soft ground + ink, all pass 4.5:1 */
  --h0: #E3F2E9; --h0i: #0A5636;
  --h1: #FFF0D6; --h1i: #7A4400;
  --h2: #E6EAFB; --h2i: #2F3F9E;
  --h3: #DDF3F3; --h3i: #0D5F61;
  --h4: #FCE5EC; --h4i: #93224A;
  --h5: #EFE6F8; --h5i: #5B2E8C;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #3FBF83; --brand-ink: #7FDBAE; --brand-soft: #143426; --brand-line: #22553D;
    --accent: #F2B24C; --accent-soft: #3A2A0E; --accent-ink: #F6CE87;
    --absent: #F07A5C; --absent-soft: #3D1A12; --absent-ink: #F8AE9A;
    --bg: #0E1512; --card: #16201B; --card-2: #1B2721; --ink: #E8F0EB; --ink-2: #C9D6CE; --muted: #93A59A; --line: #263530;
    --focus: #6AB0FF;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --shadow-up: 0 -6px 24px rgba(0, 0, 0, .35);
    --h0: #143426; --h0i: #8EE0B6; --h1: #3A2A0E; --h1i: #F6CE87; --h2: #1C2350; --h2i: #B4C0FF;
    --h3: #0F3536; --h3i: #8EDCDD; --h4: #3E1726; --h4i: #F6A9C3; --h5: #2B1B40; --h5i: #D5B8F5;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); -webkit-tap-highlight-color: transparent; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--brand-ink); }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ layout */
.phone { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.page { flex: 1; padding: 18px 16px 120px; display: flex; flex-direction: column; gap: 16px; }
body.plain .page { padding-top: 40px; padding-bottom: 40px; }
body.docked .page { padding-bottom: 150px; }

.bar { position: sticky; top: 0; z-index: 20; background: var(--brand); color: #fff; padding: calc(10px + env(safe-area-inset-top)) 16px 14px; }
@media (prefers-color-scheme: dark) { .bar { background: #0F3A27; } }
.bar-row { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.bar a { color: #fff; text-decoration: none; }
.bar-back { width: 44px; height: 44px; margin-left: -12px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.bar-back:hover { background: rgba(255, 255, 255, .12); }
.bar-crumb { font-size: 13px; font-weight: 500; color: rgba(255, 255, 255, .82); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; flex: 1; min-width: 0; }
.bar-brand span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar h1 { font-size: 23px; font-weight: 700; line-height: 1.2; margin-top: 2px; letter-spacing: -.01em; }
.bar-sub { font-size: 14px; color: rgba(255, 255, 255, .82); margin-top: 2px; }
.bar-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.bar .chip { background: rgba(255, 255, 255, .16); color: #fff; }
.bar .chip-solid { background: #fff; color: var(--brand-ink); }
@media (prefers-color-scheme: dark) { .bar .chip-solid { background: var(--brand-soft); color: var(--brand-ink); } }
.bar .chip-coral { background: #FFD9CC; color: #7E2410; }

.tabs { position: fixed; z-index: 30; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--line); box-shadow: var(--shadow-up); padding-bottom: env(safe-area-inset-bottom); }
.tabs-inner { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(var(--tabs, 4), minmax(0, 1fr)); }
.tabs-inner.t3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 62px; font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none; }
.tabs a svg { width: 24px; height: 24px; }
.tabs a[aria-current="page"] { color: var(--brand); }
.tabs a[aria-current="page"] .tab-ico { background: var(--brand-soft); }
.tab-ico { width: 56px; height: 30px; border-radius: 15px; display: flex; align-items: center; justify-content: center; }

.dock { position: fixed; z-index: 25; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); box-shadow: var(--shadow-up); padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); }
.dock-inner { max-width: 528px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
.dock-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; }
.dock-note { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; line-height: 1.35; }
.dock-note .bell svg { width: 14px; height: 14px; }
.dock .btn-ghost { flex-shrink: 0; padding: 0 4px; }

/* ------------------------------------------------------------------ type */
.hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 8px 4px; }
.hero h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.section-title { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .02em; padding: 0 4px; margin-bottom: -6px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.section-title a { font-weight: 600; }
.hi { font-family: "Noto Sans Devanagari", var(--font); }

/* ------------------------------------------------------------------ brand */
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: url(/static/icon.svg) center / 100% no-repeat; flex-shrink: 0; display: inline-block; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .35); }
.brand-mark.big { width: 64px; height: 64px; border-radius: 20px; box-shadow: var(--shadow); margin-bottom: 6px; }

/* ------------------------------------------------------------------ cards and lists */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; }
.card.tight { padding: 0; overflow: hidden; }
.card h2 { font-size: 17px; font-weight: 700; }
.card p + p { margin-top: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 60px; text-decoration: none; color: inherit; }
a.row:hover { background: var(--card-2); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 13px; color: var(--muted); }
.chev { color: var(--muted); flex-shrink: 0; display: inline-flex; }
.chev svg { width: 20px; height: 20px; }
.bar-back svg { width: 26px; height: 26px; }
.avatar svg { width: 20px; height: 20px; }
svg { flex-shrink: 0; }

.avatar { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; background: var(--brand-soft); color: var(--brand-ink); }
.tile { width: 52px; height: 52px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px; flex-shrink: 0; letter-spacing: -.02em; }
.hue-0 { background: var(--h0); color: var(--h0i); } .hue-1 { background: var(--h1); color: var(--h1i); }
.hue-2 { background: var(--h2); color: var(--h2i); } .hue-3 { background: var(--h3); color: var(--h3i); }
.hue-4 { background: var(--h4); color: var(--h4i); } .hue-5 { background: var(--h5); color: var(--h5i); }

/* batch cards on the home list */
.batch { display: flex; flex-direction: column; gap: 14px; }
.batch-top { display: flex; gap: 14px; align-items: center; text-decoration: none; color: inherit; }
.batch-top h2 { font-size: 18px; line-height: 1.25; }
.batch-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.batch-actions { display: flex; gap: 10px; }
.batch-actions .btn { flex: 1; }

/* ------------------------------------------------------------------ chips */
.chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 13px; font-size: 12.5px; font-weight: 600; background: var(--card-2); color: var(--ink-2); white-space: nowrap; }
.chip svg { width: 14px; height: 14px; }
.chip-ok { background: var(--brand-soft); color: var(--brand-ink); }
.chip-warn { background: var(--accent-soft); color: var(--accent-ink); }
.chip-bad { background: var(--absent-soft); color: var(--absent-ink); }
.chip-muted { background: var(--card-2); color: var(--muted); border: 1px solid var(--line); }

/* ------------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 18px; border-radius: var(--r-sm); border: 0; font-weight: 650; font-size: 16px; text-decoration: none; cursor: pointer; transition: transform .08s ease, background-color .15s ease; }
.btn:active { transform: scale(.98); }
.btn svg { width: 20px; height: 20px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-primary { color: #06130C; } .btn-primary:hover { color: #06130C; } }
.btn-secondary { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); }
.btn-secondary:hover { border-color: var(--brand-line); color: var(--brand-ink); }
.btn-soft { background: var(--brand-soft); color: var(--brand-ink); }
.btn-ghost { background: transparent; color: var(--brand); min-height: 44px; padding: 0 10px; }
.btn-danger { background: transparent; color: var(--absent-ink); border: 1.5px solid var(--absent-soft); }
.btn-danger:hover { background: var(--absent-soft); }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; font-size: 14px; padding: 0 14px; }

/* the "Send to parents" switch: a submit button that says what it is */
.switch-card { display: flex; gap: 14px; align-items: flex-start; }
.switch-card .row-main { gap: 4px; }
.switch { position: relative; width: 56px; height: 34px; border-radius: 17px; border: 0; background: #C9D3CC; cursor: pointer; flex-shrink: 0; margin-top: 2px; transition: background-color .2s ease; }
@media (prefers-color-scheme: dark) { .switch { background: #34433B; } }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s ease; }
.switch[aria-pressed="true"] { background: var(--brand); }
.switch[aria-pressed="true"]::after { transform: translateX(22px); }
.switch-state { font-weight: 700; }
.switch-state.on { color: var(--brand); }

/* follow the batch / always / never */
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { min-height: 40px; border: 0; border-radius: 9px; background: transparent; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; padding: 0 6px; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(14, 40, 26, .15); }
.seg button[aria-pressed="true"].on { color: var(--brand-ink); }
.seg button[aria-pressed="true"].off { color: var(--absent-ink); }

/* ------------------------------------------------------------------ forms */
.form { display: flex; flex-direction: column; gap: 10px; }
.form label, .label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
input[type=text], input[type=email], input:not([type]), input[type=tel], input[type=password], textarea, select {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--card); font-size: 16px; }
textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input.code { font-size: 28px; letter-spacing: .4em; text-align: center; font-weight: 700; }
input.pin { font-size: 34px; letter-spacing: .7em; padding-left: calc(14px + .35em); }
.phone-field { display: flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--card); overflow: hidden; }
.phone-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.phone-cc { display: flex; align-items: center; padding: 0 12px 0 14px; font-weight: 700; color: var(--ink-2); background: var(--card-2); border-right: 1.5px solid var(--line); }
.phone-field input { border: 0; border-radius: 0; box-shadow: none !important; font-size: 18px; letter-spacing: .02em; }
.form .btn { margin-top: 6px; }
.hint { font-size: 13px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 4px 0; font-weight: 500; }
.check input { width: 22px; height: 22px; accent-color: var(--brand); }
details.more { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--brand); min-height: 44px; display: flex; align-items: center; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more[open] summary { margin-bottom: 8px; }
.card > details.more:first-child { border-top: 0; margin-top: -8px; padding-top: 0; margin-bottom: -8px; }
.card > details.more:first-child[open] { margin-bottom: 0; }

/* ------------------------------------------------------------------ notices from the server */
.flash { border-radius: var(--r); padding: 14px 16px; background: var(--brand-soft); color: var(--brand-ink); font-weight: 500; display: flex; flex-direction: column; gap: 6px; }
.flash.warn { background: var(--accent-soft); color: var(--accent-ink); }
.flash ul { margin: 0; padding-left: 20px; font-size: 14px; font-weight: 400; }
.error { background: var(--absent-soft); color: var(--absent-ink); border-radius: var(--r-sm); padding: 10px 12px; font-weight: 500; font-size: 14px; }
.banner { display: flex; gap: 10px; align-items: flex-start; border-radius: var(--r); padding: 14px 16px; background: var(--accent-soft); color: var(--accent-ink); font-size: 14px; }
.banner svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }

/* ------------------------------------------------------------------ attendance */
.days { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.days::-webkit-scrollbar { display: none; }
.day { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 56px; height: 64px; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); text-decoration: none; color: var(--ink-2); font-size: 12px; font-weight: 600; }
.day b { font-size: 19px; color: var(--ink); line-height: 1.1; }
.day[aria-current="date"] { background: var(--brand); color: rgba(255, 255, 255, .85); }
.day[aria-current="date"] b { color: #fff; }

.marks { list-style: none; margin: 0; padding: 0; }
.marks li + li { border-top: 1px solid var(--line); }
.mark { display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 64px; cursor: pointer; user-select: none; transition: background-color .12s ease; }
.mark:hover { background: var(--card-2); }
.mark .row-main { gap: 0; }
.mark .state { display: inline-flex; align-items: center; gap: 6px; min-width: 96px; justify-content: center; height: 36px; padding: 0 14px; border-radius: 18px; font-size: 14px; font-weight: 700; background: var(--brand-soft); color: var(--brand-ink); }
.mark .state svg { width: 16px; height: 16px; }
.mark .s-present { display: inline-flex; align-items: center; gap: 6px; }
.mark .s-absent { display: none; }
.mark input:checked ~ .state { background: var(--absent); color: #fff; }
.mark input:checked ~ .state .s-present { display: none; }
.mark input:checked ~ .state .s-absent { display: inline-flex; align-items: center; gap: 6px; }
.mark input:checked ~ .avatar { background: var(--absent-soft); color: var(--absent-ink); }
.mark:has(input:checked) { background: var(--absent-soft); }
.mark:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: -3px; }
.bell { color: var(--brand); display: inline-flex; }
.bell.off { color: var(--muted); opacity: .6; }
.bell svg { width: 14px; height: 14px; }

.summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 34px; line-height: 1.1; font-weight: 800; letter-spacing: -.02em; }
.stat.ok b { color: var(--brand); }
.stat.bad b { color: var(--absent); }
.stat span { font-size: 14px; color: var(--muted); font-weight: 600; }

.done-mark { width: 76px; height: 76px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; }
.done-mark svg { width: 40px; height: 40px; }

/* ------------------------------------------------------------------ record */
progress { appearance: none; -webkit-appearance: none; width: 100%; height: 10px; border: 0; border-radius: 5px; background: var(--line); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line); border-radius: 5px; }
progress::-webkit-progress-value { background: var(--brand); border-radius: 5px; }
progress::-moz-progress-bar { background: var(--brand); border-radius: 5px; }
.big-num { font-size: 40px; font-weight: 800; letter-spacing: -.02em; line-height: 1; color: var(--brand); }
.big-num small { font-size: 16px; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.dots { display: flex; flex-wrap: wrap; gap: 6px; }
.dot { width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; background: var(--brand-soft); color: var(--brand-ink); }
.dot.absent { background: var(--absent); color: #fff; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: var(--brand-soft); vertical-align: -1px; }
.legend span.absent::before { background: var(--absent); }

/* ------------------------------------------------------------------ messages */
.bubble { background: var(--card); border-radius: 16px 16px 16px 4px; padding: 12px 14px; box-shadow: var(--shadow); white-space: pre-line; font-size: 14.5px; line-height: 1.5; overflow-wrap: anywhere; }
.msg { display: flex; flex-direction: column; gap: 6px; }
.msg-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); padding-left: 4px; }

/* ------------------------------------------------------------------ empty states */
.empty { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px 16px; }
.empty-ico { width: 64px; height: 64px; border-radius: 20px; background: var(--accent-soft); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; }
.empty-ico svg { width: 30px; height: 30px; }
.empty h2 { font-size: 19px; }

/* ------------------------------------------------------------------ parent page */
.parent-top { background: var(--brand); color: #fff; padding: calc(18px + env(safe-area-inset-top)) 18px 22px; display: flex; flex-direction: column; gap: 6px; }
@media (prefers-color-scheme: dark) { .parent-top { background: #0F3A27; } }
.parent-top .eyebrow { color: rgba(255, 255, 255, .85); display: flex; gap: 8px; align-items: center; }
.parent-top h1 { font-size: 24px; font-weight: 700; line-height: 1.25; }
.kid-head { display: flex; align-items: center; gap: 12px; }
.class-row { display: flex; flex-direction: column; gap: 10px; padding: 14px 0; }
.class-row + .class-row { border-top: 1px solid var(--line); }
.class-row-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.ask { display: flex; flex-direction: column; gap: 12px; }
.ask-buttons { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 10px; }

.foot { text-align: center; font-size: 12.5px; color: var(--muted); padding: 8px 16px 24px; }

@media (min-width: 600px) {
  .page { padding-left: 20px; padding-right: 20px; }
  .phone { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
