/* muzix 家長 App styles. Role accent = 家長 amber gold (Master Bible §16.4),
   driven by --parent-* tokens (Dev Bible §2 — no hardcoded brand hex). Semantic
   colours (success green / error red) keep their own meaning; the amber accent is
   brand/emphasis ONLY and must never read as a warning. */

:root {
  --bg: #f8f9fa;
  --ink: #0a0a0f;
  --muted: #4b4b57;
  --faint: #9a9aa6;
  --line: #e9e9ef;

  /* 家長 role accent */
  --parent-accent: #fca92f;   /* 琥珀金 */
  --parent-panel:   #fff5e6;  /* 12% overlay — tinted chips/panels */
  --parent-surface: #fffdfa;  /* 2.5% overlay — card surfaces */
  --parent-grad: linear-gradient(135deg, color-mix(in srgb, var(--parent-accent) 86%, #fff), var(--parent-accent));
  --parent-ring: color-mix(in srgb, var(--parent-accent) 30%, transparent);

  --card: var(--parent-surface);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'DM Sans', 'Noto Sans TC', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* sections are toggled with .active */
:root { --tabbar-h: 64px; } /* tab bar content height (excl. safe-area); picker sheet + app-body padding derive from it */
#login, #onboarding, #app { display: none; min-height: 100vh; }
#login.active, #onboarding.active { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
#app.active { display: block; }

/* in-shell screens (主頁 / 我的預約 / 設定) — only the active one shows; the tab
   bar stays fixed above them. Drill-down overlays (#child-view / #booking-view)
   cover the whole shell incl. the tab bar. */
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }

.login-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.login-brand .logo { height: 22px; width: auto; display: block; }
.role-tag {
  font-size: 12px; font-weight: 600; color: var(--parent-accent);
  background: var(--parent-panel); border-radius: 999px; padding: 3px 9px;
}

.login-card {
  width: 100%; max-width: 380px; background: var(--card);
  border: 1px solid var(--line); border-radius: 22px; padding: 28px;
  box-shadow: 0 2px 10px rgba(10, 10, 15, .04);
}
.login-card h1 { font-size: 20px; margin: 0 0 6px; }
.login-card .sub { font-size: 14px; line-height: 1.6; color: var(--muted); margin: 0 0 20px; }

form label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 6px; }
form input {
  width: 100%; font: inherit; font-size: 15px; padding: 13px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--parent-surface); outline: none;
}
form input:focus { border-color: var(--parent-accent); box-shadow: 0 0 0 3px var(--parent-ring); }

.btn {
  display: inline-block; width: 100%; margin-top: 14px; font: inherit;
  font-weight: 700; font-size: 15px; padding: 14px; border-radius: 999px;
  border: 0; cursor: pointer;
}
.btn-primary { background: var(--parent-accent); color: var(--ink); } /* dark text — amber is light, white fails contrast */
.btn-primary:disabled { opacity: .6; cursor: default; }

.flash { font-size: 14px; line-height: 1.5; margin-top: 14px; display: none; }
.flash.show { display: block; }
.flash.ok { color: #2e9e7a; }   /* semantic success — unchanged */
.flash.err { color: #c8503e; }  /* semantic error — unchanged */

.note { font-size: 12px; line-height: 1.6; color: var(--faint); margin: 18px 0 0; }

/* app bar */
.app-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--line); background: var(--parent-surface);
}
.linkbtn { background: none; border: 0; color: var(--parent-accent); font: inherit; font-weight: 600; cursor: pointer; }
.app-body { padding: 18px 16px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); max-width: 480px; margin: 0 auto; }
.muted { color: var(--muted); font-size: 14px; margin: 0; }

/* wallet */
.wallet-card {
  display: flex; align-items: baseline; justify-content: space-between;
  background: var(--parent-accent); background: var(--parent-grad); /* flat fallback, then gradient */
  color: var(--ink); border-radius: 18px; padding: 18px 20px; margin-bottom: 22px;
}
.wallet-lb { font-size: 13px; opacity: .7; font-weight: 600; }
.wallet-amt { font-size: 24px; font-weight: 700; letter-spacing: .01em; }

/* section title */
.sec-title { font-size: 14px; font-weight: 700; color: var(--muted); margin: 0 2px 12px; display: flex; align-items: center; gap: 7px; }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--parent-panel); color: var(--parent-accent); font-size: 12px; }

/* child cards */
.kid-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; margin-bottom: 14px; box-shadow: 0 2px 10px rgba(10,10,15,.04); }
.kid-top { display: flex; align-items: center; gap: 12px; }
.kid-av { width: 42px; height: 42px; border-radius: 12px; background: var(--parent-accent); background: var(--parent-grad); color: var(--ink); display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.kid-name { font-size: 16px; font-weight: 700; }
.kid-grade { font-size: 13px; color: var(--muted); margin-top: 2px; }
.kid-prog { margin: 16px 0 10px; }
.kp-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.kp-pct { font-weight: 700; color: var(--parent-accent); }
.kp-bar { height: 8px; border-radius: 999px; background: #eef0f4; overflow: hidden; }
.kp-bar i { display: block; height: 100%; border-radius: 999px; background: var(--parent-accent); transition: width .4s ease; }
.kid-tutor { font-size: 13px; color: var(--muted); }
.kid-card.tap { cursor: pointer; transition: box-shadow .15s ease, transform .05s ease; }
.kid-card.tap:active { transform: scale(.995); }
.kid-arr { margin-left: auto; color: var(--faint); font-size: 22px; line-height: 1; }

.spin { text-align: center; color: var(--faint); font-size: 14px; padding: 28px 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.empty { text-align: center; color: var(--faint); font-size: 14px; padding: 10px 0; }

/* child detail view (S2/S3) */
#child-view { display: none; position: fixed; inset: 0; background: var(--bg); z-index: 50; overflow-y: auto; }
#child-view.active { display: block; }
.cv-bar { position: sticky; top: 0; display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--parent-surface); border-bottom: 1px solid var(--line); }
.cv-bar .back { background: none; border: 0; font-size: 22px; line-height: 1; color: var(--ink); cursor: pointer; padding: 0 4px; }
.cv-title { font-size: 17px; font-weight: 700; }
.cv-body { padding: 18px 16px 32px; max-width: 480px; margin: 0 auto; }

.lesson-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 12px; }
.lc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.lc-when { font-size: 14px; font-weight: 700; }
.lc-status { font-size: 12px; font-weight: 600; color: var(--parent-accent); background: var(--parent-panel); border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.lc-sum { font-size: 14px; line-height: 1.6; color: var(--ink); white-space: pre-wrap; }
.lc-cmt { font-size: 13px; line-height: 1.6; color: var(--muted); margin-top: 8px; }
.lc-cmt span { display: block; font-weight: 700; color: var(--faint); font-size: 11px; margin-bottom: 2px; }
.lc-foot { font-size: 12px; color: var(--faint); margin-top: 10px; }
.lc-noins { font-size: 13px; color: var(--faint); }

/* S4 flip card (front = student basics / back = DREAMT radar) */
.flip-card { position: relative; }
.flip-inner { transition: transform .17s ease; transform-origin: center; will-change: transform; }
.flip-front { display: flex; flex-direction: column; }
.flip-back { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.flip-card:not(.flipped) .flip-back { display: none; }
.flip-card.flipped .flip-front { display: none; }
/* both faces a FIXED equal height so the flip never resizes/jumps (#2); the radar
   on the back scales within (svg is width-driven) rather than stretching the card. */
.stu-front, .stu-back { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: 0 2px 10px rgba(10,10,15,.04); height: 336px; box-sizing: border-box; overflow: hidden; }
.stu-front { justify-content: flex-start; }
.stu-front .kid-tutor { margin-top: 4px; }
.stu-front .flip-ico { margin-top: auto; } /* pin button to bottom on the taller equal face */
.b-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.b-chip { font-size: 12px; color: var(--muted); background: rgba(10,10,15,.05); border-radius: 999px; padding: 4px 10px; }
.flip-ico { margin-top: 14px; align-self: center; border: 1px solid var(--line); background: var(--parent-panel); color: var(--parent-accent); font: inherit; font-weight: 700; font-size: 13px; padding: 7px 16px; border-radius: 999px; cursor: pointer; }
.flip-ico.back-ico { margin-top: 12px; }

[hidden] { display: none !important; }
#join-selection { line-height: 1.7; }
#join-selection select { max-width: 100%; margin: 10px 8px 10px 0; padding: 8px; }
#join-selection button, #identity-operations button, [data-reissue-code] { padding: 8px 12px; margin: 8px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--parent-panel); color: var(--text); font: inherit; }
#identity-operations small { overflow-wrap: anywhere; }
/* DREAMT radar */
.radar-svg { width: 100%; max-width: 180px; height: auto; display: block; } /* scales to fit the fixed-height flip back (#2) */
.radar-empty { font-size: 13.5px; color: var(--faint); padding: 34px 14px; line-height: 1.6; }
.rg-ring, .rg-spoke { fill: none; stroke: var(--line); stroke-width: 1; }
.rg-req { fill: none; stroke: var(--muted); stroke-width: 1.3; stroke-dasharray: 6 4; stroke-linejoin: round; stroke-linecap: round; }
.rg-area { fill: color-mix(in srgb, var(--parent-accent) 22%, transparent); stroke: var(--parent-accent); stroke-width: 1.9; stroke-linejoin: round; }
.rg-dot { fill: var(--parent-accent); }
.rg-lb { fill: var(--muted); font-size: 9px; }
.radar-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.radar-legend .rl { display: inline-flex; align-items: center; gap: 5px; }
.rl-sw { flex: none; }
.rd-caption { font-size: 10.5px; color: var(--faint); margin-top: 8px; line-height: 1.4; }

/* collapsibles (§15.2 song accordion, §15.3 lessons de-pile) */
.collapse:not(.open) .collapse-body { display: none; }
.sec-toggle { width: 100%; background: none; border: 0; cursor: pointer; font: inherit; }
.sec-toggle .arr, .song-head .arr, .lc-head .arr { margin-left: auto; color: var(--faint); font-size: 18px; transition: transform .15s ease; }
.collapse.open .sec-toggle .arr, .collapse.open .song-head .arr, .collapse.open .lc-head .arr { transform: rotate(90deg); }
.song-group-lb { font-size: 12px; font-weight: 700; color: var(--faint); margin: 14px 2px 8px; }
.song-status { font-size: 11px; color: var(--parent-accent); background: var(--parent-panel); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
/* lesson accordion (§5) */
.lesson-acc { background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; overflow: hidden; }
.lesson-acc .lc-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 14px 16px; margin: 0; background: none; border: 0; cursor: pointer; font: inherit; text-align: left; }
.lesson-acc .lc-status { margin-left: auto; }
.lesson-acc .collapse-body { padding: 0 16px 14px; }
.lc-songs { font-size: 13px; color: var(--parent-accent); font-weight: 600; margin-bottom: 8px; }
.lc-hw-lb { font-size: 11px; font-weight: 700; color: var(--faint); margin: 12px 0 8px; }

.song-acc { background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; overflow: hidden; }
.song-head { width: 100%; display: flex; align-items: center; gap: 8px; padding: 14px 16px; background: none; border: 0; cursor: pointer; font: inherit; text-align: left; }
.song-nm { font-weight: 700; font-size: 14px; }
.song-cnt { font-size: 12px; color: var(--faint); white-space: nowrap; }
.song-acc .collapse-body { padding: 0 16px 12px; }
.skill-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.sk-name { color: var(--ink); }
.sk-status { font-size: 12px; white-space: nowrap; }
.sk-status.sk-done { color: #2e9e7a; }              /* 已掌握 — semantic success green */
.sk-status.sk-learning { color: var(--parent-accent); } /* 學習中 — role accent */
.sk-status.sk-new { color: var(--faint); }          /* 未開始學習 — muted */
.song-cat { font-size: 11px; color: var(--parent-accent); background: var(--parent-panel); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
/* per-song progress bar — shown on the collapsed row (#1), learning songs only (#3) */
.song-prog { display: flex; align-items: center; gap: 8px; padding: 0 16px 14px; }
.sp-bar { flex: 1; height: 7px; border-radius: 999px; background: #eef0f4; overflow: hidden; }
.sp-bar i { display: block; height: 100%; border-radius: 999px; background: var(--parent-accent); }
.sp-pct { font-size: 11px; font-weight: 700; color: var(--parent-accent); white-space: nowrap; }

/* ── T2b-10 底部 tab bar ─────────────────────────────────────────────────────
   固定底部、4 格、line-style SVG icon（零 emoji）。Active 態沿用 app 既有的
   琥珀填色 + 深墨字型態（.btn-primary / .wallet-card 先例）——amber 作背景可讀、
   深墨字作前景，避免細字用 amber 前景色的對比度問題。零 hardcode。 */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  display: flex; background: var(--parent-surface); border-top: 1px solid var(--line);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom);
  max-width: 480px; margin: 0 auto; box-shadow: 0 -2px 14px rgba(10,10,15,.05); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 7px 2px; border: 0; background: none; cursor: pointer; font: inherit;
  color: var(--muted); border-radius: 14px; transition: color .18s ease, background .18s ease; }
.tab .tico { width: 23px; height: 23px; display: block; fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tab .tlbl { font-size: 11px; font-weight: 700; letter-spacing: .01em; }
.tab.active { background: var(--parent-accent); color: var(--ink); } /* filled amber pill + dark ink (btn-primary/wallet precedent) — readable, on-brand, no hardcode */
.tab:active { transform: scale(.97); }

/* 我的預約 tab badge — icon 右上角, upcoming count, 0 = 隱藏 */
.tico-wrap { position: relative; display: inline-flex; }
.tab-badge { position: absolute; top: -5px; right: -8px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--parent-accent); color: var(--ink); font-size: 10.5px;
  font-weight: 700; line-height: 17px; text-align: center; border: 1.5px solid var(--parent-surface); }
.tab-badge[hidden] { display: none; }

/* ── 學生 picker bottom sheet (預約 tab 快速捷徑) ─────────────────────────────
   鐵律 (Henry 真機定案): tab bar 全程完整可見。做法 = tab bar (z45) 疊喺 scrim(z40)
   同 sheet(z42) 之上, 由 tab bar 自己畫喺最面, 唔靠 pixel-match safe-area。sheet
   由 bottom:0 升起, 底部 padding 動態預留 tab bar 實際高度 (含 env(safe-area) 真值),
   多出嗰截藏喺不透明 tab bar 之後 → 視覺上 sheet 貼實 bar 頂, bar 永不被遮。250ms。 */
.pk-scrim { position: fixed; inset: 0; z-index: 40; background: rgba(10,10,15,.40);
  opacity: 0; transition: opacity .25s ease; }
.pk-scrim.open { opacity: 1; }
.pk-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 42;
  background: var(--card); border-radius: 20px 20px 0 0; border-top: 1px solid var(--line);
  padding: 12px 16px calc(18px + var(--tabbar-h) + env(safe-area-inset-bottom));
  max-width: 480px; margin: 0 auto; box-shadow: 0 -8px 30px rgba(10,10,15,.16);
  transform: translateY(100%); transition: transform .25s ease; }
.pk-sheet.open { transform: translateY(0); }
.pk-handle { width: 40px; height: 4px; border-radius: 999px; background: #dcdce2; margin: 2px auto 12px; }
.pk-title { font-size: 15px; font-weight: 700; margin: 0 2px 12px; }
.pk-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 13px;
  margin-bottom: 10px; cursor: pointer; font: inherit; transition: transform .05s ease; }
.pk-row:last-child { margin-bottom: 0; }
.pk-row:active { transform: scale(.995); }
.pk-av { width: 40px; height: 40px; border-radius: 11px; background: var(--parent-accent);
  background: var(--parent-grad); color: var(--ink); display: grid; place-items: center;
  font-weight: 700; font-size: 17px; flex: none; }
.pk-id { flex: 1; display: flex; flex-direction: column; }
.pk-nm { font-size: 15px; font-weight: 700; }
.pk-tut { font-size: 12px; color: var(--muted); margin-top: 1px; }
.pk-arr { color: var(--faint); font-size: 20px; line-height: 1; }

/* ── 設定 (帳戶) ─────────────────────────────────────────────────────────────── */
.set-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 4px 16px; margin-bottom: 20px; box-shadow: 0 2px 10px rgba(10,10,15,.04); }
.set-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 15px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.set-row:last-child { border-bottom: 0; }
.set-k { color: var(--muted); flex: none; }
.set-v { font-weight: 700; text-align: right; word-break: break-all; }
.set-logout { display: block; width: 100%; background: none; border: 1px solid var(--line);
  color: var(--parent-accent); font: inherit; font-weight: 700; font-size: 15px; padding: 14px;
  border-radius: 999px; cursor: pointer; }
.set-logout:active { transform: scale(.995); }

/* ── T2b booking flow (A′ / B′ / C′) — 1:1 approved mock ──────────────────── */
/* entry A: 「預約上堂」 on the student page (State D · plan A placement) */
.book-cta { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  background: var(--parent-accent); color: var(--ink-on, #3a2703); font: inherit; font-weight: 700;
  font-size: 15px; padding: 14px; border-radius: 999px; border: 0; cursor: pointer; margin: 14px 0 4px; }

/* booking view (fullscreen, same pattern as #child-view) */
#booking-view { display: none; position: fixed; inset: 0; background: var(--bg); z-index: 55; overflow-y: auto; }
#booking-view.active { display: block; }
.bk-body { padding: 16px; max-width: 480px; margin: 0 auto; }

/* context header — student locked, tutor derived */
.bk-ctx { display: flex; align-items: center; gap: 12px; background: var(--surface, var(--card));
  border: 1px solid var(--line); border-radius: 16px; padding: 14px 15px; margin-bottom: 16px; }
.bk-ctx .nm { font-size: 16px; font-weight: 700; }
.bk-ctx .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.bk-dur { margin-left: auto; text-align: right; font-size: 11px; color: var(--faint); }
.bk-dur b { display: block; font-size: 14px; color: var(--parent-accent); font-weight: 700; }

.bk-lbl { font-size: 12px; font-weight: 700; color: var(--muted); margin: 0 2px 9px; }

/* date nav */
.bk-dates { display: flex; gap: 7px; overflow-x: auto; padding: 2px 2px 8px; margin-bottom: 14px; }
.bk-d { flex: none; width: 48px; text-align: center; border: 1px solid var(--line); border-radius: 13px;
  padding: 8px 0; background: var(--card); cursor: pointer; }
.bk-d .wd { font-size: 10px; color: var(--faint); }
.bk-d .dd { font-size: 16px; font-weight: 700; margin-top: 2px; }
.bk-d.sel { background: var(--parent-accent); border-color: var(--parent-accent); }
.bk-d.sel .wd { color: #6b4a08; } .bk-d.sel .dd { color: var(--ink-on, #3a2703); }
.bk-d.off { opacity: .4; pointer-events: none; }
.bk-d.off .dd { color: var(--faint); font-weight: 500; }

/* slot grid */
.bk-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.bk-s { border: 1px solid var(--line); border-radius: 11px; padding: 11px 0; text-align: center;
  font-size: 14px; font-weight: 700; background: var(--card); }
.bk-s.free { background: var(--parent-panel); border-color: #f3d9a8; color: var(--accent-ink, #b5760a); cursor: pointer; }
.bk-s.busy { background: #f1f2f4; border-color: var(--line); color: #b8b8c0; text-decoration: line-through; cursor: not-allowed; }
/* loading skeleton — same cell footprint as a real slot (no layout shift on swap) */
.bk-s.bk-sk { min-height: 44px; background: #eef0f4; border-color: var(--line);
  color: transparent; pointer-events: none; animation: bk-sk-pulse 1.1s ease-in-out infinite; }
@keyframes bk-sk-pulse { 0%, 100% { opacity: .5 } 50% { opacity: .9 } }
.bk-hint { display: flex; gap: 14px; margin: 12px 2px 0; font-size: 11px; color: var(--muted); }
.bk-hint i { display: inline-block; width: 11px; height: 11px; border-radius: 4px; vertical-align: -1px; margin-right: 5px; }
.bk-hint .fh { background: var(--parent-panel); border: 1px solid #f3d9a8; }
.bk-hint .bh { background: #f1f2f4; border: 1px solid var(--line); }
.bk-empty { border: 1px dashed #d9d9e0; border-radius: 14px; padding: 24px 14px; text-align: center;
  color: var(--faint); font-size: 13px; background: #fbfbfc; line-height: 1.6; margin-top: 4px; }
.bk-spin { text-align: center; color: var(--faint); font-size: 14px; padding: 26px 0; }

/* B′ confirm sheet (bottom-sheet overlay) */
.bk-scrim { position: fixed; inset: 0; background: rgba(10,10,15,.45); z-index: 56; }
.bk-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 57; background: var(--surface, var(--card));
  border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; padding: 16px 16px 22px;
  max-width: 480px; margin: 0 auto; }
.bk-grab { width: 40px; height: 4px; border-radius: 999px; background: #dcdce2; margin: 0 auto 14px; }
.bk-sheet h3 { font-size: 17px; font-weight: 700; margin: 0 0 12px; }
.bk-kv { display: flex; justify-content: space-between; padding: 12px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.bk-kv:last-of-type { border-bottom: 0; }
.bk-kv .k { color: var(--muted); } .bk-kv .v { font-weight: 700; }
.bk-confirm { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%;
  background: var(--parent-accent); color: var(--ink-on, #3a2703); font: inherit; font-weight: 700;
  font-size: 15px; padding: 14px; border-radius: 999px; border: 0; cursor: pointer; margin-top: 16px; }
.bk-confirm:disabled { opacity: .6; cursor: default; }
.bk-ghost { display: block; width: 100%; background: none; border: 0; color: var(--muted); font: inherit;
  font-weight: 600; font-size: 14px; padding: 12px; cursor: pointer; margin-top: 6px; }

/* C′ success + 我的預約 */
.bk-tick { width: 64px; height: 64px; border-radius: 50%; background: #e5f5ee; color: #2e9e7a;
  display: grid; place-items: center; font-size: 34px; margin: 8px auto 14px; }
.bk-succ-h { text-align: center; font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.bk-succ-s { text-align: center; font-size: 13px; color: var(--muted); margin-bottom: 4px; line-height: 1.6; }
.bk-mine { background: var(--surface, var(--card)); border: 1px solid var(--line); border-radius: 16px; padding: 15px; }
.bk-mine-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.bk-mine-when { font-size: 15px; font-weight: 700; }
.bk-mine-badge { font-size: 11px; font-weight: 600; color: var(--accent-ink, #b5760a); background: var(--parent-panel);
  border-radius: 999px; padding: 2px 9px; }
.bk-mine-sub { font-size: 13px; color: var(--muted); }
.bk-cancel { display: block; width: 100%; background: none; border: 1px solid #f0997b; color: #c8503e;
  font: inherit; font-weight: 700; font-size: 14px; padding: 12px; border-radius: 999px; cursor: pointer; margin-top: 14px; }
.bk-warn { display: flex; gap: 8px; background: #faece7; border: 1px solid #f0997b; border-radius: 12px;
  padding: 11px 12px; margin-top: 12px; font-size: 11.5px; line-height: 1.55; color: #993c1d; }
.bk-warn b { font-weight: 700; }
.bk-flash { font-size: 13px; text-align: center; margin-top: 12px; line-height: 1.6; }
.bk-flash.err { color: #c8503e; } .bk-flash.ok { color: #2e9e7a; }

/* homework (S3) */
.hw-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 12px; }
.hw-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.hw-name { font-size: 15px; font-weight: 700; }
.hw-status { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.hw-skill { font-size: 13px; color: var(--parent-accent); margin-top: 8px; }
.hw-instr { font-size: 14px; line-height: 1.6; color: var(--muted); margin-top: 8px; white-space: pre-wrap; }

/* ── D19b 每週自動上課 toggle (我的預約 · Platform only) ─────────────────────── */
.bk-recur { margin-top: 12px; border: 1px solid var(--line); border-radius: 14px;
  padding: 13px 14px; background: var(--card); }
.bk-recur.on { border-color: var(--parent-accent); background: linear-gradient(180deg, #fffaf1, var(--card)); }
.bk-recur-row { display: flex; align-items: flex-start; gap: 12px; }
.bk-recur-txt { flex: 1; min-width: 0; }
.bk-recur-title { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.bk-recur-when { background: var(--parent-accent); color: var(--ink-on, #3a2703); border-radius: 999px;
  font-size: 10.5px; font-weight: 700; padding: 1px 8px; }
.bk-recur-auth { font-size: 12.5px; line-height: 1.6; color: #7a5a1e; margin-top: 7px;
  background: #fff3df; border: 1px solid #f4d79b; border-radius: 10px; padding: 8px 10px; }
.bk-recur-auth b { color: #8a5a00; }
/* switch: grey off → amber on; disabled while loading/pending */
.bk-recur-sw { flex: 0 0 auto; width: 48px; height: 28px; border-radius: 999px; background: #d7d7de;
  position: relative; border: 0; cursor: pointer; padding: 0; margin-top: 2px; transition: background .18s; }
.bk-recur-sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .18s; }
.bk-recur.on .bk-recur-sw { background: var(--parent-accent); }
.bk-recur.on .bk-recur-sw::after { transform: translateX(20px); }
.bk-recur-sw:disabled { opacity: .55; cursor: default; }

/* confirm bottom-sheet — reuses bk-sheet geometry, sits above the tab bar (z45) */
.rc-scrim { position: fixed; inset: 0; background: rgba(10,10,15,.32); z-index: 60; }
.rc-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; background: var(--surface, var(--card));
  border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; padding: 16px 16px calc(22px + env(safe-area-inset-bottom));
  max-width: 480px; margin: 0 auto; }
.rc-grab { width: 40px; height: 4px; border-radius: 999px; background: #dcdce2; margin: 0 auto 14px; }
.rc-sheet h3 { font-size: 17px; font-weight: 700; margin: 0 0 12px; }
.rc-auth { font-size: 13px; line-height: 1.65; color: #7a5a1e; background: #fff3df; border: 1px solid #f4d79b;
  border-radius: 12px; padding: 11px 13px; margin-bottom: 12px; }
.rc-auth b { color: #8a5a00; }
.rc-kv { display: flex; justify-content: space-between; padding: 11px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.rc-kv .k { color: var(--muted); } .rc-kv .v { font-weight: 700; }
.rc-confirm { display: block; width: 100%; background: var(--parent-accent); color: var(--ink-on, #3a2703);
  font: inherit; font-weight: 700; font-size: 15px; padding: 14px; border-radius: 999px; border: 0; cursor: pointer; margin-top: 16px; }
.rc-confirm:disabled { opacity: .6; cursor: default; }
.rc-cancel { display: block; width: 100%; background: none; border: 0; color: var(--muted); font: inherit;
  font-weight: 600; font-size: 14px; padding: 12px; cursor: pointer; margin-top: 4px; }
.rc-flash { font-size: 13px; margin-top: 10px; text-align: center; min-height: 18px; }
.rc-flash.err { color: #c0392b; }

/* toast */
.rc-toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px); z-index: 70; background: var(--ink); color: #fff; font-size: 13.5px; font-weight: 600;
  padding: 11px 18px; border-radius: 999px; box-shadow: 0 6px 20px rgba(10,10,15,.25); opacity: 0;
  pointer-events: none; transition: opacity .2s, transform .2s; max-width: 88vw; text-align: center; }
.rc-toast.show { opacity: 1; transform: translate(-50%, 0); }
.rc-toast.err { background: #c0392b; }

/* ── LITE-ST-01 示範模式 (只喺本機示範模式出現) ───────────────────────────────── */
/* LITE-ST-04：右上角讓位畀「切換學生」掣，示範標示移去左下 (分頁列上面)。 */
.demo-badge { position: fixed; left: 10px; bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); z-index: 80; pointer-events: none;
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 999px; }

/* Piano 成果 — 沿用 .hw-card / .hw-head / .b-chip，只補兩行文字樣式 */
.res-line { font-size: 13px; color: var(--muted); margin-top: 8px; line-height: 1.6; }
.res-score { font-size: 13px; color: var(--faint); margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }

/* 學生相片 (僅本機預覽) */
.ph-row { display: flex; align-items: center; gap: 16px; }
.ph-prev { width: 84px; height: 84px; flex: none; border-radius: 16px; border: 1px dashed var(--line);
  background: var(--parent-panel); display: grid; place-items: center; overflow: hidden; }
.ph-prev img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-none { font-size: 12px; color: var(--faint); }
.ph-side { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.ph-pick { border: 1px solid var(--line); background: var(--parent-panel); color: var(--parent-accent);
  font-weight: 700; font-size: 13px; padding: 7px 16px; border-radius: 999px; cursor: pointer; }
.ph-cancel { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; font-size: 13px; padding: 4px 2px; cursor: pointer; }
.ph-note { font-size: 12px; color: var(--faint); margin-top: 12px; }
.ph-err { font-size: 13px; color: #c0392b; margin-top: 6px; min-height: 18px; }

/* ── LITE-ST-02 學生切換 (多於一位學生先出) ────────────────────────────────── */
.cv-switch { margin: 0 0 16px; }
.cv-sw-lb { font-size: 13px; font-weight: 700; color: var(--muted); margin: 0 2px 8px; }
.cv-sw-row { display: flex; flex-wrap: wrap; gap: 8px; }
.cv-sw { border: 1px solid var(--line); background: var(--card); color: var(--muted); font: inherit;
  font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.cv-sw.on { background: var(--parent-panel); color: var(--parent-accent); border-color: var(--parent-ring); }

/* ── LITE-ST-02 我的 muzix code (設定) ─────────────────────────────────────── */
.mc-card { padding: 16px; }
.mc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mc-code { font-size: 18px; font-weight: 700; letter-spacing: .04em; word-break: break-all; }
.mc-copy { flex: none; border: 1px solid var(--line); background: var(--parent-panel); color: var(--parent-accent);
  font: inherit; font-weight: 700; font-size: 13px; padding: 7px 16px; border-radius: 999px; cursor: pointer; }
.mc-help { font-size: 13px; color: var(--muted); margin-top: 10px; line-height: 1.6; }
.mc-pending { font-size: 14px; font-weight: 700; color: var(--muted); }
.mc-note { font-size: 12px; color: var(--faint); margin-top: 10px; line-height: 1.6; }

/* ── LITE-ST-03 待確認連結申請、未有進度、單項被拒 ─────────────────────────── */
.lr-wrap { margin-bottom: 4px; }
.lr-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--card);
  border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin-bottom: 10px; }
.lr-studio { font-size: 15px; font-weight: 700; }
.lr-student { font-size: 13px; color: var(--muted); margin-top: 3px; }
.lr-acts { display: flex; gap: 8px; flex: none; }
.lr-ok, .lr-no { font: inherit; font-size: 13px; font-weight: 700; padding: 7px 14px; border-radius: 999px; cursor: pointer; }
.lr-ok { border: 1px solid var(--parent-accent); background: var(--parent-accent); color: var(--ink); }
.lr-no { border: 1px solid var(--line); background: none; color: var(--muted); }
.lr-ok:disabled, .lr-no:disabled { opacity: .6; cursor: default; }
.kp-none { font-weight: 700; color: var(--faint); }

/* ── LITE-ST-04 學生選擇 (任何頁面) ─────────────────────────────────────────── */
.ss-open { margin-left: auto; flex: none; border: 1px solid var(--line); background: var(--parent-panel); color: var(--parent-accent);
  font: inherit; font-weight: 700; font-size: 13px; padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.ss-scrim { z-index: 60; }
.ss-sheet { z-index: 61; max-height: 80vh; overflow-y: auto; }
.pk-row.on { border-color: var(--parent-ring); background: var(--parent-panel); }
.bk-recur-unk { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
/* 寫入結果未知時停用的掣要睇得出係停用 */
.bk-cancel:disabled, .bk-confirm:disabled, .set-logout:disabled { opacity: .5; cursor: default; }
.item-denied { color: #c0392b; }
