/* ============================================================
   團體班點數：樣式（手機優先，支援淺色與深色）
   ============================================================ */

:root {
  /* iOS 風格：系統色、灰底分組清單、毛玻璃 */
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --fill: rgba(118, 118, 128, .12);
  --text: #1c1c1e;
  --muted: #6c6c70;
  --border: #d1d1d6;
  --separator: rgba(60, 60, 67, .18);
  --ink: #1c1c1e;
  --ink-ink: #ffffff;
  --accent: #0b4ea2;
  --accent-ink: #ffffff;
  --accent-soft: rgba(11, 78, 162, .1);
  --gold: #ff9500;
  --gold-soft: rgba(255, 149, 0, .14);
  --sun: #ff9500;
  --sun-soft: rgba(255, 149, 0, .14);
  --good: #248a3d;
  --good-soft: rgba(52, 199, 89, .15);
  --warn: #c93400;
  --warn-soft: rgba(255, 149, 0, .15);
  --danger: #d70015;
  --danger-ink: #ffffff;
  --danger-soft: rgba(255, 59, 48, .12);
  --focus: #0b4ea2;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .18);
  --bar-bg: rgba(249, 249, 249, .82);
  --radius: 12px;
  --radius-sm: 10px;
  /* 字體：微軟正黑體（Windows）；iPhone/Mac 沒有微軟正黑體，用最接近的蘋方；Android 用思源黑體 */
  --font-ui: "Microsoft JhengHei", "微軟正黑體", "PingFang TC", -apple-system, BlinkMacSystemFont, "Noto Sans TC", "Heiti TC", system-ui, sans-serif;
  --font-brand: "Microsoft JhengHei", "微軟正黑體", "PingFang TC", -apple-system, BlinkMacSystemFont, "Noto Sans TC", "Heiti TC", system-ui, sans-serif;
  --tabbar-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --fill: rgba(118, 118, 128, .24);
    --text: #ffffff;
    --muted: #98989f;
    --border: #38383a;
    --separator: rgba(84, 84, 88, .6);
    --ink: #ffffff;
    --ink-ink: #000000;
    --accent: #5b9bf0;
    --accent-ink: #ffffff;
    --accent-soft: rgba(91, 155, 240, .22);
    --gold: #ff9f0a;
    --gold-soft: rgba(255, 159, 10, .2);
    --sun: #ff9f0a;
    --sun-soft: rgba(255, 159, 10, .2);
    --good: #30d158;
    --good-soft: rgba(48, 209, 88, .18);
    --warn: #ff9f0a;
    --warn-soft: rgba(255, 159, 10, .18);
    --danger: #ff453a;
    --danger-ink: #ffffff;
    --danger-soft: rgba(255, 69, 58, .18);
    --focus: #5b9bf0;
    --shadow: none;
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, .6);
    --bar-bg: rgba(22, 22, 24, .8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --fill: rgba(118, 118, 128, .24);
  --text: #ffffff;
  --muted: #98989f;
  --border: #38383a;
  --separator: rgba(84, 84, 88, .6);
  --ink: #ffffff;
  --ink-ink: #000000;
  --accent: #5b9bf0;
  --accent-ink: #ffffff;
  --accent-soft: rgba(91, 155, 240, .22);
  --gold: #ff9f0a;
  --gold-soft: rgba(255, 159, 10, .2);
  --sun: #ff9f0a;
  --sun-soft: rgba(255, 159, 10, .2);
  --good: #30d158;
  --good-soft: rgba(48, 209, 88, .18);
  --warn: #ff9f0a;
  --warn-soft: rgba(255, 159, 10, .18);
  --danger: #ff453a;
  --danger-ink: #ffffff;
  --danger-soft: rgba(255, 69, 58, .18);
  --focus: #5b9bf0;
  --shadow: none;
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .6);
  --bar-bg: rgba(22, 22, 24, .8);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

[hidden] { display: none !important; }

h1, h2, h3 { line-height: 1.3; margin: 0 0 .6em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .8em; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: .1em .35em; border-radius: 6px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- 版面 ---------- */

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top, 0px));
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 1.1rem; margin: 0; }

main {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 32px;
}
body[data-view="admin"] main { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 24px); }
body[data-view="admin"][data-tab="attend"] main { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 96px); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.card.flush { padding: 0; overflow: hidden; }

.public-footer { text-align: center; padding: 8px 16px calc(24px + var(--safe-b)); }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hint { color: var(--muted); font-size: .9rem; margin: 12px 0 0; }

/* ---------- 表單 ---------- */

.form .field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 600; margin-bottom: 6px; font-size: .95rem; }
.field .req { color: var(--danger); font-weight: 400; }
.field .sub { display: block; color: var(--muted); font-size: .85rem; font-weight: 400; margin-top: 4px; }

input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
input[type="number"], input[type="date"], input[type="time"], input[type="search"], textarea, select {
  width: 100%;
  min-height: 44px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
}
input[type="date"], input[type="time"] { -webkit-appearance: none; appearance: none; display: block; }
textarea { min-height: 80px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent); }

#code-input { font-size: 1.35rem; letter-spacing: .12em; text-transform: uppercase; text-align: center; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
#code-input::placeholder { letter-spacing: .04em; font-size: 1rem; text-transform: none; }

.form-error { color: var(--danger); font-weight: 600; margin: 0 0 12px; }
.form-error:empty { display: none; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.grid-2 .field { margin-bottom: 14px; }

.check-line { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; flex: none; }

/* ---------- 按鈕 ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px;
  padding: 8px 16px;
  font: inherit; font-size: 16px; font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: var(--danger-ink); }
.btn.danger-outline { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { min-height: 44px; padding: 6px 12px; font-size: .95rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn[aria-busy="true"] { opacity: .75; cursor: progress; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.linklike {
  background: none; border: none; padding: 10px 8px; min-height: 44px;
  color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer;
}

.icon-btn {
  width: 44px; height: 44px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-radius: 10px;
  font-size: 1.6rem; line-height: 1; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }

/* ---------- 點數標籤 ---------- */

.badge {
  display: inline-block; flex: none;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .875rem; font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge.ok { background: var(--accent-soft); color: var(--accent); }
.badge.low { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.badge.zero, .badge.neg { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 6px;
  font-size: .8rem; font-weight: 600;
  background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.tag.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- 列表 ---------- */

.list { list-style: none; margin: 0 0 16px; padding: 0; }
.list > li + li { border-top: 1px solid var(--border); }
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 56px;
  padding: 10px 16px;
  background: none; border: none; text-align: left;
  font: inherit; color: inherit;
}
button.row { cursor: pointer; }
button.row:hover, label.row:hover { background: var(--surface-2); }
.row .main { min-width: 0; flex: 1; }
.row .title { font-weight: 600; display: block; }
.row .meta { color: var(--muted); font-size: .875rem; display: block; }
.row .side { flex: none; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.row .num { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.num.plus { color: var(--accent); }
.num.minus { color: var(--danger); }
.list .empty-row { padding: 16px; color: var(--muted); }

label.row { cursor: pointer; }
label.row.checked { background: var(--accent-soft); }
.attend-name { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 8px; flex-wrap: wrap; }
.list-head h3 { margin: 0; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 20px 0 8px; }
.section-title h3 { margin: 0; }

.toolbar { display: flex; gap: 8px; margin-bottom: 4px; }
.toolbar input { flex: 1; min-width: 0; }

/* ---------- 總覽數字 ---------- */

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.stat .label { color: var(--muted); font-size: .875rem; display: block; }
.stat .value { font-size: 1.8rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat .unit { font-size: .9rem; font-weight: 600; color: var(--muted); margin-left: 2px; }
.stat.alert .value { color: var(--warn); }

.empty { text-align: center; padding: 28px 16px; }
.empty p { color: var(--muted); }

/* ---------- 學員點數卡 ---------- */

.points-card { text-align: center; }
.points-card .who { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.points-card .big { font-size: 2.2rem; font-weight: 800; line-height: 1.25; margin: 4px 0 14px; }
.points-card .big.neg, .points-card .big.zero { color: var(--danger); }
.points-card .code-line { color: var(--muted); font-size: .9rem; margin: 12px 0 0; }

.stamps {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px;
  max-width: 330px; margin: 0 auto;
}
.stamp {
  aspect-ratio: 1; border-radius: 50%;
  border: 2px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; font-weight: 800;
}
.stamp.on { border: 2px solid var(--accent); background: var(--accent); color: var(--accent-ink); }
.stamps-more { margin: 10px 0 0; font-weight: 700; }

.notice {
  border-radius: 10px; padding: 10px 14px; margin: 14px 0 0;
  background: var(--warn-soft); color: var(--warn); font-weight: 700; text-align: left;
}

.records .row { min-height: 48px; }

/* ---------- 點名底部列 ---------- */

.attend-bar {
  position: fixed; left: 0; right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-b));
  z-index: 15;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px max(16px, calc((100% - 640px) / 2 + 16px));
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 14px rgba(0, 0, 0, .06);
}
#attend-count { font-weight: 700; }
.attend-bar .btn { min-width: 132px; }

/* ---------- 底部分頁 ---------- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.tabbar button {
  background: none; border: none; font: inherit; font-weight: 600; font-size: .95rem;
  color: var(--muted); cursor: pointer; position: relative;
}
.tabbar button[aria-current="page"] { color: var(--accent); }
.tabbar button[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 3px;
  border-radius: 0 0 3px 3px; background: var(--accent);
}

/* ---------- 子分頁 ---------- */

.segmented {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--surface-2); border-radius: 12px; padding: 4px; margin-bottom: 16px;
}
.segmented button {
  min-height: 40px; border: none; border-radius: 9px; background: transparent;
  font: inherit; font-weight: 600; color: var(--muted); cursor: pointer;
}
.segmented button[aria-selected="true"], .segmented button[aria-pressed="true"] {
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}

.month-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 18px 0 8px; flex-wrap: wrap; }
.month-head h3 { margin: 0; }
.month-head .sum { color: var(--muted); font-size: .9rem; font-weight: 600; }

/* ---------- 對話框 ---------- */

dialog.dlg {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
}
dialog.dlg[open] { display: flex; flex-direction: column; }
dialog.dlg::backdrop { background: rgba(0, 0, 0, .45); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 8px 0 16px; }
.dlg-head h2 { margin: 0; font-size: 1.15rem; }
.dlg-body { padding: 8px 16px 12px; overflow-y: auto; flex: 1; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.dlg-foot:empty { display: none; }
.dlg-foot .btn { flex: 1 1 120px; }

.balance-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 12px; flex-wrap: wrap; }
.balance-head .big { font-size: 1.6rem; font-weight: 800; }
.info { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 14px; }
.info dt { color: var(--muted); }
.info dd { margin: 0; }
.code-text { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; letter-spacing: .06em; }
.actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.actions-grid .btn { white-space: normal; }
.hist .row { padding: 10px 0; min-height: 48px; }
.hist .del { color: var(--danger); }
.dlg .list { margin-bottom: 4px; }

.copy-box { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; }

.radio-group { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; border: none; padding: 0; }
.radio-group legend { font-weight: 600; margin-bottom: 6px; padding: 0; font-size: .95rem; }
.radio-card {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-weight: 600;
}
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.names { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 8px 0 0; }
.names li { background: var(--surface-2); border-radius: 8px; padding: 4px 10px; }

/* ---------- 提示訊息 ---------- */

.toast {
  position: fixed; left: 50%; z-index: 100;
  bottom: calc(24px + var(--safe-b));
  transform: translate(-50%, 20px);
  max-width: calc(100vw - 32px);
  padding: 12px 18px; border-radius: 12px;
  background: var(--text); color: var(--bg);
  font-weight: 600; box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
body[data-view="admin"] .toast { bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); }
body[data-view="admin"][data-tab="attend"] .toast { bottom: calc(var(--tabbar-h) + var(--safe-b) + 84px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: var(--danger-ink); }

.banner {
  border-radius: 12px; padding: 12px 14px; margin-bottom: 16px;
  background: var(--danger-soft); color: var(--danger); font-weight: 600;
}
.banner .btn { margin-top: 10px; }

@media (min-width: 560px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}

/* ============================================================
   課程預約（第二版）
   ============================================================ */

.tabbar.two { grid-template-columns: repeat(2, 1fr); }
.tabbar.five { grid-template-columns: repeat(5, 1fr); }
.tabbar.five button { font-size: .9rem; }
body[data-public="1"] main { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 24px); }
body[data-public="1"] .public-footer { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); }
body[data-public="1"] .toast { bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); }

.sched-head { display: flex; flex-direction: column; gap: 6px; }
.sched-head h2 { margin: 0; }
.sched-head .rules { color: var(--muted); font-size: .9rem; margin: 0; }
.me-chip {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .9rem;
  border: none; border-radius: 999px; padding: 6px 12px; min-height: 36px; cursor: pointer; font-family: inherit;
}

/* 日期列 */
.day-strip {
  display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 10px; margin: 0 0 8px;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.day-strip::-webkit-scrollbar { height: 0; }
.day-btn {
  flex: 0 0 auto; width: 52px; min-height: 68px; scroll-snap-align: start;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  font: inherit; color: var(--text); cursor: pointer; padding: 6px 0;
}
.day-btn .dow { font-size: .78rem; color: var(--muted); font-weight: 600; }
.day-btn .dnum { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.day-btn .dcount { font-size: .72rem; color: var(--accent); font-weight: 700; min-height: 1em; }
.day-btn.empty .dnum, .day-btn.empty .dow { color: var(--muted); opacity: .7; }
.day-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.day-btn[aria-pressed="true"] .dow, .day-btn[aria-pressed="true"] .dcount { color: var(--accent-ink); }
.day-btn[aria-pressed="true"] .dnum { color: var(--accent-ink); opacity: 1; }
.day-title { display: flex; justify-content: space-between; align-items: baseline; margin: 4px 0 8px; gap: 8px; }
.day-title h3 { margin: 0; }

/* 課程列 */
.class-row { align-items: stretch; }
.class-row .time {
  flex: none; width: 58px; display: flex; flex-direction: column; justify-content: center;
  font-variant-numeric: tabular-nums;
}
.class-row .time b { font-size: 1.05rem; }
.class-row .time small { color: var(--muted); font-size: .8rem; }
.class-row .side { justify-content: center; }
.class-row.dim .main, .class-row.dim .time { opacity: .55; }

.chip {
  display: inline-block; white-space: nowrap; border-radius: 999px; padding: 3px 10px;
  font-size: .82rem; font-weight: 700; border: 1px solid transparent;
}
.chip.open { background: var(--accent-soft); color: var(--accent); }
.chip.wait { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.chip.full, .chip.closed, .chip.past { background: var(--surface-2); color: var(--muted); }
.chip.cancelled { background: var(--danger-soft); color: var(--danger); }
.chip.mine, .chip.mine-wait { background: var(--accent); color: var(--accent-ink); }
.chip.mine-wait { background: var(--warn); color: var(--surface); }

/* 課程詳情 */
.lead { color: var(--text); line-height: 1.7; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 14px; }
.tile { background: var(--surface-2); border-radius: 12px; padding: 10px 8px; text-align: center; min-width: 0; }
.tile .k { display: block; color: var(--muted); font-size: .8rem; }
.tile .v { display: block; font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.tile .v small { font-size: .8rem; color: var(--muted); font-weight: 600; }
.action-box { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 6px; display: flex; flex-direction: column; gap: 10px; }
.action-box p { margin: 0; }
.action-box .who { font-weight: 700; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; min-width: 0; }
.status-line { font-weight: 700; }
.status-line.ok { color: var(--accent); }
.status-line.warn { color: var(--warn); }
.status-line.muted { color: var(--muted); font-weight: 600; }

/* 老師：課表分頁 */
.rule-list { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 12px; }
.rule-list dt { color: var(--muted); }
.rule-list dd { margin: 0; font-weight: 600; }
.att-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; min-height: 52px; }
.att-row .main { flex: 1; min-width: 0; }
.att-row label { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; cursor: pointer; }
.pos { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; align-items: center; justify-content: center;
  background: var(--warn-soft); color: var(--warn); font-weight: 800; font-size: .85rem; flex: none; }
.picker-list { max-height: 50vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; margin-top: 10px; }
.btn-stack { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
select { -webkit-appearance: none; appearance: none; background-image: none; }

/* 常用選項 */
.preset-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.preset {
  display: inline-flex; align-items: center; min-height: 44px; padding: 6px 14px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  font: inherit; font-size: .95rem; color: var(--text); cursor: pointer; max-width: 100%;
}
.preset[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.preset.static { min-height: 32px; padding: 3px 12px; cursor: default; background: var(--surface-2); border-color: transparent; font-size: .9rem; }
.small-h { font-size: .9rem; color: var(--muted); margin: 10px 0 6px; }

/* LINE 登入 */
.btn.line { background: #06c755; border-color: #06c755; color: #ffffff; }
.btn.line:hover { background: #05b34c; }
.tag.line { background: #06c755; color: #ffffff; }
.line-card h2 { margin-bottom: 4px; }
.line-card .btn.line { margin-top: 4px; }
.or-line { margin: -4px 0 12px; }
.line-who { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-2); }


/* ============================================================
   iOS 風格（覆蓋前面的基本樣式）
   ============================================================ */

body {
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em; }
h3 { font-size: 1.05rem; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }

/* 導覽列：毛玻璃 */
.topbar {
  background: var(--bar-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--separator);
  padding: 8px 12px 8px 16px;
  padding-top: max(8px, env(safe-area-inset-top, 0px));
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: inherit; min-height: 44px; }
.brand-logo {
  flex: none; width: 34px; height: 34px; border-radius: 9px; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; font-family: var(--font-brand); font-weight: 700; font-size: 1.05rem;
}
.brand-logo.has-img { background: var(--surface); box-shadow: 0 0 0 .5px var(--separator); }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-name { font-family: var(--font-brand); font-weight: 600; font-size: 1.02rem; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-tagline { color: var(--muted); font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 2px; flex: none; }
.icon-action { width: 44px; height: 44px; border-radius: 22px; border: none; background: transparent; color: var(--accent); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-action:hover, .icon-action[aria-pressed="true"] { background: var(--fill); }
.icon-action svg, .tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* 大標題 */
.page-title { font-size: 2rem; font-weight: 700; letter-spacing: -.03em; margin: 6px 4px 14px; line-height: 1.15; }

/* 分組清單（inset grouped） */
.card { background: var(--surface); border: none; border-radius: var(--radius); box-shadow: none; padding: 16px; margin-bottom: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.list > li + li { border-top: none; }
.list > li { position: relative; }
.list > li + li::before {
  content: ""; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--separator);
}
.hist > li + li::before, .dlg .list > li + li::before { left: 0; }
.row { min-height: 52px; padding: 10px 16px; }
button.row { padding-right: 34px; }
button.row::after {
  content: ""; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px; margin-top: -4px;
  border-top: 2px solid #c4c4c7; border-right: 2px solid #c4c4c7; transform: rotate(45deg); border-radius: 1px;
}
button.row:hover, label.row:hover { background: transparent; }
button.row:active, label.row:active { background: var(--fill); }
.row .title { font-weight: 500; }
.row .meta { font-size: .82rem; }
.section-title { margin: 22px 4px 8px; }
.section-title h3, .month-head h3 { font-size: .82rem; font-weight: 400; color: var(--muted); text-transform: none; letter-spacing: 0; }
.month-head { margin: 22px 4px 8px; }
.month-head .sum { font-size: .82rem; font-weight: 400; }
.list-head { margin: 18px 4px 8px; }
.list-head h3 { font-size: .82rem; font-weight: 400; color: var(--muted); }
.empty-row { font-size: .95rem; }

/* 按鈕 */
.btn {
  min-height: 50px; padding: 10px 18px; border-radius: 12px; border: none;
  background: var(--fill); color: var(--accent); font-size: 17px; font-weight: 600; letter-spacing: -.01em; box-shadow: none;
}
.btn:hover { background: var(--fill); filter: brightness(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.btn.danger { background: var(--danger); color: var(--danger-ink); }
.btn.danger-outline { background: var(--danger-soft); color: var(--danger); border: none; }
.btn.small { min-height: 34px; padding: 6px 14px; border-radius: 17px; font-size: 15px; }
.btn.ghost { background: transparent; }
.btn.line { background: #06c755; color: #fff; }
.btn:active { opacity: .7; }
.btn:disabled { opacity: .35; }
.linklike { color: var(--accent); text-decoration: none; font-size: .95rem; }
.linklike.del { color: var(--danger); }

/* 輸入框 */
input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
input[type="number"], input[type="date"], input[type="time"], input[type="search"], textarea, select {
  border: none; background: var(--fill); border-radius: 10px; min-height: 44px; padding: 10px 12px; font-size: 17px;
}
input:focus, textarea:focus, select:focus { box-shadow: 0 0 0 3px var(--accent-soft); }
.field > span { font-size: .82rem; font-weight: 400; color: var(--muted); margin: 0 4px 6px; }
.field .sub { margin: 4px 4px 0; }
#code-input { font-size: 1.3rem; }

/* 圓形打勾（像「提醒事項」） */
input[type="checkbox"] {
  -webkit-appearance: none; appearance: none; width: 24px; height: 24px; border-radius: 50%;
  border: 1.5px solid #c4c4c7; background: var(--surface); display: inline-grid; place-content: center; cursor: pointer; flex: none;
}
input[type="checkbox"]:checked {
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 15px no-repeat;
  border-color: var(--accent);
}
label.row.checked { background: transparent; }

/* 標籤 */
.badge { border: none; padding: 3px 9px; font-size: .8rem; font-weight: 600; }
.badge.ok { background: var(--good-soft); color: var(--good); }
.badge.low { background: var(--warn-soft); color: var(--warn); }
.badge.zero, .badge.neg { background: var(--danger-soft); color: var(--danger); }
.chip { border: none; font-weight: 600; font-size: .78rem; padding: 3px 9px; }
.chip.open { background: var(--good-soft); color: var(--good); }
.chip.wait { background: var(--warn-soft); color: var(--warn); }
.chip.full, .chip.closed, .chip.past { background: var(--fill); color: var(--muted); }
.chip.cancelled { background: var(--danger-soft); color: var(--danger); }
.chip.mine { background: var(--accent); color: #fff; }
.chip.mine-wait { background: var(--gold); color: #fff; }
.tag { background: var(--fill); color: var(--muted); border-radius: 6px; font-weight: 500; }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.num.plus { color: var(--good); }
.num.minus { color: var(--danger); }
.status-line.ok { color: var(--good); }
.status-line.warn { color: var(--warn); }

/* 底部分頁列：毛玻璃 */
.tabbar {
  background: var(--bar-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--separator);
}
.tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: .66rem; font-weight: 500; color: #8e8e93; padding: 4px 0 2px; }
.tabbar.five button { font-size: .66rem; }
.tabbar button[aria-current="page"] { color: var(--accent); }
.tabbar button[aria-current="page"]::before { display: none; }
.tabbar button[aria-current="page"] svg { stroke-width: 2.2; }

/* 總覽數字：像小工具 */
.stats { gap: 10px; }
.stat { border: none; border-radius: var(--radius); box-shadow: none; background: var(--surface); padding: 14px; }
.stat .label { font-size: .8rem; }
.stat .value { font-family: var(--font-brand); font-weight: 700; font-size: 1.9rem; letter-spacing: -.02em; }
.stat.alert .value { color: var(--warn); }

/* 課表：大標題，不用色塊 */
.sched-head { background: transparent; color: var(--text); padding: 4px 4px 0; box-shadow: none; margin-bottom: 12px; }
.sched-head h2 { color: var(--text); font-size: 2rem; letter-spacing: -.03em; }
.sched-head .rules { color: var(--muted); font-size: .85rem; }
.me-chip { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* 日期列：像「行事曆」 */
.day-strip { gap: 4px; padding: 6px 4px 10px; margin: 0 -4px 6px; }
.day-btn { background: transparent; border: none; box-shadow: none; width: 48px; min-height: 66px; border-radius: 14px; padding: 4px 0; }
.day-btn .dow { font-size: .7rem; font-weight: 500; color: var(--muted); }
.day-btn .dnum {
  width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.15rem; font-weight: 600; font-family: var(--font-brand);
}
.day-btn .dcount { font-size: .66rem; color: var(--muted); font-weight: 500; }
.day-btn.empty .dnum { color: #c4c4c7; opacity: 1; }
.day-btn[aria-pressed="true"] { background: transparent; box-shadow: none; }
.day-btn[aria-pressed="true"] .dnum { background: var(--accent); color: #fff; }
.day-btn[aria-pressed="true"] .dow, .day-btn[aria-pressed="true"] .dcount { color: var(--accent); }
.day-title { margin: 4px 4px 8px; }
.day-title h3 { font-size: .82rem; font-weight: 400; color: var(--muted); }
.class-row .time b { font-family: var(--font-brand); font-weight: 600; font-size: 1.02rem; }
.class-row .time small { font-size: .76rem; }

/* 點數卡：像 Apple 錢包的卡片 */
.points-card {
  background: linear-gradient(145deg, #0a84ff 0%, #0063d1 55%, #3a3ad6 100%);
  color: #fff; border-radius: 18px; padding: 22px 18px 18px;
  box-shadow: 0 10px 30px rgba(0, 99, 209, .25);
  overflow: hidden; position: relative;
}
.points-card::before {
  content: ""; position: absolute; width: 260px; height: 260px; right: -90px; top: -120px; border-radius: 50%;
  background: rgba(255, 255, 255, .09);
}
.points-card .who { color: rgba(255, 255, 255, .85); font-size: .95rem; font-weight: 500; }
.points-card .big { color: #fff; font-family: var(--font-brand); font-size: 2.4rem; font-weight: 700; letter-spacing: -.03em; }
.points-card .big.neg, .points-card .big.zero { color: #fff; }
.stamps { gap: 10px; max-width: 300px; position: relative; }
.stamp { border: 1.5px dashed rgba(255, 255, 255, .45); background: rgba(255, 255, 255, .06); }
.stamp.on { border: none; background: #fff; color: #0a84ff; box-shadow: none; }
.stamp svg { width: 60%; height: 60%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stamp svg .cork { fill: currentColor; }
.stamps-more { color: #fff; }
.points-card .notice { background: rgba(255, 255, 255, .18); color: #fff; border-radius: 10px; }
.points-card .code-line { color: rgba(255, 255, 255, .75); }

/* 詳情的三格 */
.tile { background: var(--fill); border-radius: 12px; }
.tile .v { font-family: var(--font-brand); font-weight: 700; }
.action-box { border-top: .5px solid var(--separator); }

/* 分段控制 */
.segmented { background: var(--fill); border-radius: 9px; padding: 2px; gap: 0; }
.segmented button { min-height: 32px; border-radius: 7px; font-size: .9rem; color: var(--text); font-weight: 500; }
.segmented button[aria-selected="true"] { background: var(--surface); box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04); font-weight: 600; }

/* 視窗：手機上像 iOS 從下方滑上來的面板 */
dialog.dlg { border: none; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-lg); }
dialog.dlg::backdrop { background: rgba(0, 0, 0, .35); }
.dlg-head { padding: 10px 8px 2px 18px; }
.dlg-head h2 { font-size: 1.1rem; font-weight: 600; }
.dlg-head .icon-btn { width: 32px; height: 32px; border-radius: 50%; background: var(--fill); font-size: 1.15rem; color: var(--muted); margin-right: 4px; }
.dlg-foot { border-top: none; padding: 8px 16px 16px; padding-bottom: max(16px, var(--safe-b)); }
@media (max-width: 559px) {
  dialog.dlg {
    width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 14px 14px 0 0;
    max-height: calc(100dvh - 40px);
  }
  dialog.dlg .dlg-head::before {
    content: ""; position: absolute; left: 50%; top: 6px; width: 36px; height: 5px; margin-left: -18px;
    border-radius: 3px; background: var(--border);
  }
  dialog.dlg .dlg-head { position: relative; padding-top: 18px; }
}
@media (prefers-reduced-motion: no-preference) {
  dialog.dlg[open] { animation: sheet-in .32s cubic-bezier(.2, .8, .2, 1); }
  @keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* 提示訊息：像 iOS 的浮動提示 */
.toast {
  background: rgba(30, 30, 32, .86); color: #fff; border-radius: 14px; font-weight: 500;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: 0 8px 30px rgba(0, 0, 0, .2);
}
.toast.error { background: rgba(215, 0, 21, .92); color: #fff; }
.banner { background: var(--danger-soft); color: var(--danger); border-radius: 12px; }

/* 其他 */
.notice { background: var(--warn-soft); color: var(--warn); border-radius: 10px; }
.preset { border: none; background: var(--fill); color: var(--text); min-height: 36px; border-radius: 18px; font-size: .92rem; }
.preset[aria-pressed="true"] { background: var(--accent); color: #fff; font-weight: 600; }
.preset.static { background: var(--fill); }
.rules-line { margin: -6px 4px 12px; }
.rules-line .linklike { color: var(--accent); }
.radio-card { border: none; background: var(--fill); border-radius: 12px; }
.radio-card:has(input:checked) { background: var(--accent-soft); color: var(--accent); }
.pos { background: var(--gold-soft); color: var(--warn); }
.brand-preview-logo, .logo-preview img { border-radius: 14px; }
.brand-preview-logo.initial, .logo-preview .initial { background: var(--accent); }
.brand-preview-name { font-family: var(--font-brand); font-weight: 600; font-size: 1.1rem; }
.picker-list { border: none; background: var(--surface-2); border-radius: 12px; }
.public-footer .linklike { color: var(--muted); font-size: .85rem; }
.attend-bar { background: var(--bar-bg); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-top: .5px solid var(--separator); box-shadow: none; }
.or-line { color: var(--muted); }
button.row { position: relative; }
.class-row .meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stamp svg { width: 66%; height: 66%; stroke-width: 1.5; }

/* ---------- KBC 品牌 ---------- */
:root { --brand-blue: #0b4ea2; --brand-navy: #07356f; --brand-red: #db2425; --brand-yellow: #f2c200; --brand-green: #3fae49; }
.brand-logo.has-img { width: auto; height: 36px; max-width: 150px; border-radius: 8px; background: #fff; box-shadow: none; padding: 2px 4px; }
.brand-logo.has-img img { width: auto; height: 100%; object-fit: contain; }
.brand.logo-only .brand-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.brand.logo-only .brand-text { padding-left: 2px; }
.points-card { background: linear-gradient(150deg, var(--brand-blue) 0%, var(--brand-navy) 100%); box-shadow: 0 10px 30px rgba(7, 53, 111, .28); padding-top: 26px; }
.points-card::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px;
  background: linear-gradient(90deg, var(--brand-red) 0 33.3%, var(--brand-yellow) 33.3% 66.6%, var(--brand-green) 66.6% 100%);
}
.stamp.on { color: var(--brand-blue); }
.brand-preview-logo { width: auto; max-width: 140px; height: 56px; padding: 4px 6px; background: #fff; }
.logo-preview img { width: auto; max-width: 160px; height: 72px; padding: 4px 6px; background: #fff; }

/* ============================================================
   米家風格：霧面漸層底、毛玻璃卡片、大圓角、細字大數字
   （覆蓋前面的樣式）
   ============================================================ */

:root {
  --mist-1: #aebdcb;
  --mist-2: #d3dce4;
  --mist-3: #eef2f5;
  --glass: rgba(255, 255, 255, .42);
  --glass-strong: rgba(255, 255, 255, .72);
  --glass-line: rgba(255, 255, 255, .65);
  --card: #ffffff;
  --text: #17202a;
  --muted: #5d6b78;
  --fill: rgba(23, 32, 42, .06);
  --separator: rgba(23, 32, 42, .08);
  --press: #17202a;          /* 主按鈕：深墨色膠囊 */
  --press-ink: #ffffff;
  --switch-on: #2fbf71;
  --soft-shadow: 0 8px 28px rgba(40, 55, 70, .08);
  --big-radius: 28px;
  --mid-radius: 20px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --mist-1: #1d2733; --mist-2: #121820; --mist-3: #0c1015;
    --glass: rgba(255, 255, 255, .07); --glass-strong: rgba(255, 255, 255, .12); --glass-line: rgba(255, 255, 255, .1);
    --card: #19212a; --text: #eef2f5; --muted: #9aa7b3; --fill: rgba(255, 255, 255, .08); --separator: rgba(255, 255, 255, .08);
    --press: #f1f4f7; --press-ink: #10161c; --switch-on: #34d07f; --soft-shadow: 0 8px 28px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  --mist-1: #1d2733; --mist-2: #121820; --mist-3: #0c1015;
  --glass: rgba(255, 255, 255, .07); --glass-strong: rgba(255, 255, 255, .12); --glass-line: rgba(255, 255, 255, .1);
  --card: #19212a; --text: #eef2f5; --muted: #9aa7b3; --fill: rgba(255, 255, 255, .08); --separator: rgba(255, 255, 255, .08);
  --press: #f1f4f7; --press-ink: #10161c; --switch-on: #34d07f; --soft-shadow: 0 8px 28px rgba(0, 0, 0, .35);
}

/* 霧面漸層背景（固定在畫面後方） */
body { background: var(--mist-3); color: var(--text); }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(120% 60% at 85% 0%, rgba(255, 255, 255, .35), transparent 60%),
    linear-gradient(180deg, var(--mist-1) 0%, var(--mist-2) 42%, var(--mist-3) 78%);
}

/* 頁首：透明毛玻璃 */
.topbar { background: color-mix(in srgb, var(--mist-1) 55%, transparent); border-bottom: none; }
.brand-logo.has-img { background: #fff; border-radius: 999px; padding: 4px 12px; height: 38px; box-shadow: 0 2px 10px rgba(40, 55, 70, .1); }
.brand-tagline { color: var(--text); opacity: .7; }
.icon-action { width: 42px; height: 42px; border-radius: 50%; background: var(--glass); color: var(--text); border: 1px solid var(--glass-line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.icon-action:hover, .icon-action[aria-pressed="true"] { background: var(--glass-strong); }

/* 問候大標題 */
.sched-head { background: transparent; padding: 10px 4px 4px; margin-bottom: 14px; }
.sched-head .hello { margin: 0; font-size: 1.15rem; font-weight: 400; color: var(--text); opacity: .85; }
.sched-head h2 { margin: 2px 0 8px; font-size: 2rem; font-weight: 700; letter-spacing: -.03em; color: var(--text); }
.sched-head .rules { color: var(--muted); }
.me-chip { background: var(--glass-strong); color: var(--text); border: 1px solid var(--glass-line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding: 8px 14px; }
.page-title { font-weight: 700; }

/* 卡片：白色大圓角＋柔和陰影 */
.card { background: var(--card); border-radius: var(--big-radius); box-shadow: var(--soft-shadow); padding: 20px; }
.card.flush { border-radius: var(--big-radius); }
.stat { background: var(--glass-strong); border: 1px solid var(--glass-line); border-radius: var(--mid-radius); box-shadow: none; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.stat .value { font-weight: 300; font-size: 2.4rem; letter-spacing: -.04em; }
.stat .unit { font-weight: 500; }
.row { min-height: 60px; padding: 12px 18px; }
button.row { padding-right: 38px; }
button.row::after { right: 18px; border-color: rgba(120, 135, 150, .55); }
.list > li + li::before { left: 18px; right: 18px; background: var(--separator); }
.section-title h3, .month-head h3, .list-head h3, .day-title h3 { color: var(--text); opacity: .7; font-size: .85rem; font-weight: 500; }

/* 按鈕：膠囊 */
.btn { border-radius: 999px; background: var(--card); color: var(--text); box-shadow: 0 2px 8px rgba(40, 55, 70, .07); min-height: 50px; }
.btn:hover { background: var(--card); }
.btn.primary { background: var(--press); color: var(--press-ink); box-shadow: 0 6px 16px rgba(23, 32, 42, .22); }
.btn.small { border-radius: 999px; min-height: 36px; background: var(--fill); box-shadow: none; }
.btn.small.primary { background: var(--press); color: var(--press-ink); }
.btn.danger { background: #e5484d; color: #fff; box-shadow: none; }
.btn.danger-outline { background: rgba(229, 72, 77, .1); color: #d13438; box-shadow: none; }
.btn.line { background: #06c755; color: #fff; box-shadow: 0 6px 16px rgba(6, 199, 85, .25); }
.linklike { color: var(--accent); }

/* 輸入框 */
input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
input[type="number"], input[type="date"], input[type="time"], input[type="search"], textarea, select {
  background: var(--fill); border-radius: 14px;
}

/* 開關：米家式綠色切換鈕 */
input[type="checkbox"] {
  width: 51px; height: 31px; border-radius: 999px; border: none; background: rgba(120, 130, 140, .3);
  position: relative; transition: background .2s; display: inline-block;
}
input[type="checkbox"]::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: transform .2s;
}
input[type="checkbox"]:checked { background: var(--switch-on); border: none; }
input[type="checkbox"]:checked::after { transform: translateX(20px); }

/* 日期：膠囊籤 */
.day-strip { gap: 8px; padding: 4px 2px 12px; }
.day-btn {
  width: auto; min-width: 64px; min-height: 0; padding: 8px 14px; border-radius: 999px;
  flex-direction: row; gap: 6px; background: var(--glass); border: 1px solid var(--glass-line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.day-btn .dow { font-size: .85rem; color: var(--text); opacity: .75; font-weight: 500; }
.day-btn .dnum { width: auto; height: auto; background: none !important; font-size: 1rem; font-weight: 600; color: var(--text) !important; }
.day-btn .dcount { display: none; }
.day-btn.empty { opacity: .55; }
.day-btn[aria-pressed="true"] { background: var(--card); border-color: var(--card); box-shadow: 0 4px 14px rgba(40, 55, 70, .12); }
.day-btn[aria-pressed="true"] .dow { color: var(--text); opacity: 1; }

/* 課程卡：大時間＋膠囊狀態 */
.class-row .time { width: 64px; }
.class-row .time b { font-weight: 300; font-size: 1.5rem; letter-spacing: -.03em; }
.chip { border-radius: 999px; padding: 5px 11px; }
.chip.open { background: rgba(47, 191, 113, .14); color: #1f8f53; }
.chip.mine { background: var(--press); color: var(--press-ink); }

/* 點數卡：毛玻璃面板＋超大細數字＋刻度尺 */
.points-card {
  background: var(--glass-strong); color: var(--text); border: 1px solid var(--glass-line);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-radius: var(--big-radius); box-shadow: var(--soft-shadow); text-align: left; padding: 22px 22px 20px;
}
.points-card::before { display: none; }
.points-card::after { left: 22px; right: auto; width: 54px; top: 18px; height: 4px; border-radius: 4px; }
.points-card .who { color: var(--muted); font-size: .95rem; margin-top: 10px; }
.points-card .big { color: var(--text); font-weight: 400; font-size: 1.1rem; margin: 2px 0 6px; line-height: 1; display: flex; align-items: flex-start; gap: 4px; }
.points-card .big .pre { padding-top: 14px; color: var(--muted); }
.points-card .big .n { font-size: 6rem; font-weight: 200; letter-spacing: -.06em; line-height: .95; font-family: var(--font-brand); }
.points-card .big .u { padding-top: 14px; font-size: 1.4rem; font-weight: 400; }
.points-card .big.neg .n { color: #d13438; }
.points-card .big.zero { font-size: 1.9rem; font-weight: 600; padding: 12px 0 6px; color: #d13438; }
/* 印章改成刻度：亮的刻度 = 剩下的點數 */
.stamps { display: flex; align-items: flex-end; gap: 0; justify-content: space-between; max-width: none; height: 46px; margin: 10px 0 4px; }
.stamp { aspect-ratio: auto; width: 3px; height: 22px; border-radius: 2px; border: none !important; background: rgba(23, 32, 42, .16); box-shadow: none; }
.stamp.on { height: 42px; background: var(--text); }
.stamp svg { display: none; }
.points-card .notice { background: rgba(255, 159, 10, .16); color: #9a5a00; }
.points-card .code-line { color: var(--muted); text-align: left; }
.stamps-more { color: var(--muted); text-align: left; }

/* 詳情三格 */
.tile { background: var(--fill); border-radius: var(--mid-radius); }
.tile .v { font-weight: 300; font-size: 1.6rem; }

/* 浮動膠囊分頁列 */
.tabbar {
  left: 12px; right: 12px; bottom: calc(10px + var(--safe-b));
  height: 64px; padding: 6px; border-radius: 999px; border: 1px solid var(--glass-line);
  background: color-mix(in srgb, var(--card) 78%, transparent);
  box-shadow: 0 10px 30px rgba(40, 55, 70, .16);
}
.tabbar button { border-radius: 999px; color: var(--muted); font-size: .7rem; }
.tabbar button[aria-current="page"] { background: var(--press); color: var(--press-ink); }
.tabbar.five button { font-size: .66rem; }
body[data-view="admin"] main, body[data-public="1"] main { padding-bottom: calc(100px + var(--safe-b)); }
body[data-view="admin"][data-tab="attend"] main { padding-bottom: calc(176px + var(--safe-b)); }
body[data-public="1"] .public-footer { padding-bottom: calc(96px + var(--safe-b)); }
.attend-bar { bottom: calc(84px + var(--safe-b)); left: 12px; right: 12px; border-radius: 999px; padding: 8px 8px 8px 20px; border: 1px solid var(--glass-line); background: color-mix(in srgb, var(--card) 80%, transparent); box-shadow: 0 10px 30px rgba(40, 55, 70, .14); }
.toast, body[data-view="admin"] .toast, body[data-public="1"] .toast { bottom: calc(92px + var(--safe-b)); border-radius: 999px; }
body[data-view="admin"][data-tab="attend"] .toast { bottom: calc(160px + var(--safe-b)); }

/* 面板（從下方滑上來） */
dialog.dlg { border-radius: var(--big-radius); background: var(--card); }
@media (max-width: 559px) { dialog.dlg { border-radius: var(--big-radius) var(--big-radius) 0 0; } }
.segmented { border-radius: 999px; padding: 4px; background: var(--glass); border: 1px solid var(--glass-line); }
.segmented button { border-radius: 999px; }
.segmented button[aria-selected="true"] { background: var(--card); }
.preset { border-radius: 999px; }
.preset[aria-pressed="true"] { background: var(--press); color: var(--press-ink); }
.empty { color: var(--muted); }

/* 課程列：時間一行、狀態在右上，內容在下面（不會被擠壓） */
.class-row {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "time side" "main main";
  row-gap: 4px; column-gap: 12px; align-items: center; padding: 14px 18px;
}
button.class-row { padding-right: 18px; }
button.class-row::after { display: none; }
.class-row .time { grid-area: time; width: auto; flex-direction: row; align-items: baseline; gap: 6px; justify-content: flex-start; }
.class-row .time b { white-space: nowrap; }
.class-row .time small { font-size: .9rem; white-space: nowrap; }
.class-row .main { grid-area: main; min-width: 0; }
.class-row .main .title { font-size: 1.05rem; font-weight: 600; }
.class-row .side { grid-area: side; flex-direction: row; align-items: center; gap: 8px; }
.class-row .meta { white-space: normal; }

/* 開關放在右邊（點名清單、課程視窗的出席名單） */
.attend-name { display: contents; }
.attend-name .main { order: 1; flex: 1; min-width: 0; }
label.row .badge { order: 2; }
.attend-name input { order: 3; }
.att-row label { display: contents; }
.att-row label .main { order: 1; flex: 1; min-width: 0; }
.att-row .badge { order: 2; }
.att-row label input { order: 3; }
.att-row .linklike { order: 4; }

/* ============================================================
   課程詳情（重新設計）、開課狀態、LINE 通知
   ============================================================ */

.ico {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--fill); color: var(--text);
}
.ico svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* 日期與時間 */
.cd-when { margin: 0 0 16px; }
.cd-date { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: .95rem; font-weight: 500; min-height: 28px; }
.cd-time { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cd-time b { font-family: var(--font-brand); font-size: 3.4rem; font-weight: 200; letter-spacing: -.05em; line-height: 1.05; }
.cd-time span { font-size: 1.3rem; font-weight: 300; color: var(--muted); }
.cd-time em { font-style: normal; font-size: .82rem; font-weight: 600; background: var(--fill); border-radius: 999px; padding: 5px 12px; margin-left: auto; align-self: center; white-space: nowrap; }

/* 地點、教練、扣點 */
.cd-info { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.cd-info li { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cd-info .k { color: var(--muted); font-size: .82rem; flex: none; width: 2.4em; }
.cd-info .v { font-weight: 600; min-width: 0; }

/* 名額與開課狀態 */
.cd-seats { background: var(--fill); border-radius: var(--mid-radius); padding: 14px 16px; margin: 0 0 14px; }
.cd-seats-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.cd-seats-head .k { color: var(--muted); font-size: .85rem; }
.cd-seats-head .v { font-weight: 700; font-size: 1.1rem; }
.bar { height: 8px; border-radius: 999px; background: rgba(120, 130, 140, .22); overflow: hidden; margin: 10px 0 8px; }
.bar span { display: block; height: 100%; border-radius: 999px; background: var(--text); }
.cd-seats-foot { color: var(--muted); font-size: .85rem; }
.cd-open { display: flex; gap: 12px; align-items: flex-start; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--separator); }
.cd-open.solo, .cd-seats > .cd-open:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.cd-open b { display: block; }
.cd-open div > span { display: block; color: var(--muted); font-size: .85rem; margin-top: 2px; }
.cd-open.on .ico { background: var(--good-soft); color: var(--good); }
.cd-open.pending .ico { background: var(--warn-soft); color: var(--warn); }
.cd-open.off .ico { background: var(--danger-soft); color: var(--danger); }

.cd-note { margin: 0 0 14px; }
.cd-note h3 { font-size: .85rem; font-weight: 500; color: var(--muted); margin: 0 0 4px; }
.cd-note p { margin: 0; }

/* 預約截止、取消期限 */
.cd-rules { background: var(--fill); border-radius: var(--mid-radius); padding: 2px 16px; margin: 0 0 6px; }
.cd-rules > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 11px 0; }
.cd-rules > div + div { border-top: 1px solid var(--separator); }
.cd-rules .k { color: var(--muted); font-size: .88rem; flex: none; }
.cd-rules .v { text-align: right; font-weight: 700; font-size: .98rem; min-width: 0; }
.cd-rules small { display: block; font-weight: 400; color: var(--muted); font-size: .76rem; margin-top: 1px; }

/* 我的預約狀態 */
.action-box { border-top: none; padding-top: 8px; margin-top: 0; }
.cd-status { display: flex; gap: 12px; align-items: center; border-radius: var(--mid-radius); padding: 14px 16px; }
.cd-status.ok { background: var(--good-soft); }
.cd-status.ok .ico { background: var(--switch-on); color: #fff; }
.cd-status.warn { background: var(--warn-soft); }
.cd-status.warn .ico { background: #ff9f0a; color: #fff; }
.cd-status b { display: block; font-size: 1.05rem; }
.cd-status div > span { display: block; color: var(--muted); font-size: .88rem; }

/* 清單上的開課狀態 */
.meta.op { font-weight: 600; }
.meta.op.on { color: var(--good); }
.meta.op.pending { color: var(--warn); }
.meta.op.off { color: var(--danger); }

.form-note { margin: -6px 4px 14px; }
.warn-text { color: var(--warn); }
.notify-status .rule-list { margin-bottom: 10px; }
.notify-status .btn { margin-top: 4px; }

.note-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; min-height: 52px; }
.note-row .main { flex: 1; min-width: 0; }

/* 名單列裡的姓名與說明各佔一行 */
.att-row .title, .note-row .title { display: block; font-weight: 600; }
.att-row .meta, .note-row .meta { display: block; color: var(--muted); font-size: .82rem; }
.att-row .meta:empty { display: none; }
.rules-line { color: var(--muted); font-size: .88rem; line-height: 1.5; }

/* 修改通知內容 */
.tpl { border-top: 1px solid var(--separator); padding: 16px 0 6px; display: flex; flex-direction: column; gap: 8px; }
.tpl-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tpl-head b { display: block; }
.tpl-head span { display: block; }
.tpl.off textarea, .tpl.off .tok-row, .tpl.off .tpl-preview { opacity: .45; }
.tok-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tok { border: none; border-radius: 999px; background: var(--fill); color: var(--text); font: inherit; font-size: .8rem; padding: 6px 10px; min-height: 32px; cursor: pointer; }
.tpl-preview { background: var(--fill); border-radius: 16px 16px 16px 4px; padding: 10px 14px; font-size: .9rem; white-space: pre-wrap; overflow-wrap: anywhere; }
#edit-templates { margin-top: 10px; }

#add-class { margin-bottom: 6px; }
.radio-card input[type="radio"] { width: 20px; height: 20px; }

/* 總覽：今天的課與報名學生 */
.today-list { display: grid; gap: 12px; margin-bottom: 18px; }
.today-card { display: flex; flex-direction: column; gap: 6px; width: 100%; text-align: left; border: none; font: inherit; color: inherit; cursor: pointer; margin: 0; }
.today-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.today-time b { font-family: var(--font-brand); font-weight: 300; font-size: 1.7rem; letter-spacing: -.03em; }
.today-time small { color: var(--muted); font-size: .9rem; margin-left: 6px; }
.today-name { font-weight: 700; font-size: 1.08rem; }
.today-card .meta { color: var(--muted); font-size: .85rem; display: block; }
.today-names { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; }
.today-names span { background: var(--fill); border-radius: 999px; padding: 5px 12px; font-weight: 600; font-size: .95rem; }
.today-names span.absent { opacity: .5; text-decoration: line-through; }

/* ============================================================
   學生的「我的點數」（重新設計）
   ============================================================ */
.points-card { text-align: left; padding: 20px 20px 18px; }
.points-card::after { display: none; }
.pc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.pc-label { display: block; color: var(--muted); font-size: .82rem; font-weight: 500; }
.points-card .who { margin: 0; color: var(--text); font-size: 1.15rem; font-weight: 700; }
.pc-pill { border-radius: 999px; padding: 5px 12px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.pc-pill.ok { background: rgba(47, 191, 113, .14); color: #1f8f53; }
.pc-pill.low { background: rgba(255, 159, 10, .16); color: #9a5a00; }
.pc-pill.zero, .pc-pill.neg { background: rgba(229, 72, 77, .12); color: #d13438; }

.pc-ring { position: relative; width: 196px; height: 196px; margin: 8px auto 2px; }
.pc-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.pc-ring circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.pc-ring .track { stroke: rgba(120, 130, 140, .16); }
.pc-ring .fill { stroke: url(#none); stroke: var(--text); transition: stroke-dasharray .6s ease; }
.pc-ring.ok .fill { stroke: #2fbf71; }
.pc-ring.low .fill { stroke: #ff9f0a; }
.pc-ring.neg .track, .pc-ring.zero .track { stroke: rgba(229, 72, 77, .18); }
.points-card .pc-ring .big {
  position: absolute; inset: 0; display: flex; flex-direction: row; flex-wrap: wrap;
  align-items: baseline; justify-content: center; align-content: center; gap: 0 2px; margin: 0; text-align: center;
}
.points-card .pc-ring .big .pre { flex-basis: 100%; padding: 0; font-size: .85rem; color: var(--muted); font-weight: 500; }
.points-card .pc-ring .big .pre:empty { display: none; }
.points-card .pc-ring .big .n { font-size: 4.2rem; font-weight: 200; letter-spacing: -.05em; line-height: 1; }
.points-card .pc-ring .big .u { padding: 0; font-size: 1.1rem; font-weight: 500; }
.points-card .pc-ring .big.neg .n, .points-card .pc-ring .big.zero .n { color: #d13438; }
.pc-caption { text-align: center; color: var(--muted); font-size: .82rem; margin: 0 0 14px; }

.pc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pc-stat { background: var(--fill); border-radius: 16px; padding: 10px 8px; text-align: center; min-width: 0; }
.pc-stat .v { display: block; font-weight: 700; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-stat .k { display: block; color: var(--muted); font-size: .75rem; margin-top: 2px; }
.pc-notice { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 0; flex-wrap: wrap; }
.pc-notice .btn { min-height: 38px; }
.points-card .code-line { text-align: center; margin: 12px 0 0; }
.stamps { display: none; }

/* 我的預約：日曆小方塊 */
.bk-list > li + li::before { left: 0; right: 0; }
.bk-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.bk-date {
  flex: none; width: 54px; border-radius: 14px; background: var(--fill); text-align: center; padding: 6px 0 7px;
  display: flex; flex-direction: column; line-height: 1.15;
}
.bk-date .m { font-size: .68rem; color: var(--muted); font-weight: 600; }
.bk-date b { font-family: var(--font-brand); font-size: 1.45rem; font-weight: 600; letter-spacing: -.02em; }
.bk-date .w { font-size: .68rem; color: var(--muted); }
.bk-item .main { flex: 1; min-width: 0; }
.bk-item .title { display: block; font-weight: 700; }
.bk-item .meta { display: block; color: var(--muted); font-size: .82rem; }
.bk-item .side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* 最近紀錄：小圖示 */
.rec-list .row { justify-content: flex-start; gap: 12px; padding-left: 0; padding-right: 0; }
.rec-list > li + li::before { left: 48px; right: 0; }
.rec-list .row .main { flex: 1; }
.rec-list .ico { width: 34px; height: 34px; }
.rec-list .ico.k-topup { background: rgba(47, 191, 113, .14); color: #1f8f53; }
.rec-list .ico.k-book { background: rgba(11, 78, 162, .1); color: #0b4ea2; }
.rec-list .ico.k-attend { background: var(--fill); }
.rec-list .ico.k-adjust { background: rgba(255, 159, 10, .15); color: #9a5a00; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .rec-list .ico.k-book { background: rgba(91, 155, 240, .2); color: #8cb8ff; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pc-pill.ok, :root:not([data-theme="light"]) .chip.open { background: rgba(52, 208, 127, .18); color: #6fe3a3; }
  :root:not([data-theme="light"]) .pc-pill.low { background: rgba(255, 159, 10, .2); color: #ffc46b; }
  :root:not([data-theme="light"]) .pc-pill.zero, :root:not([data-theme="light"]) .pc-pill.neg { background: rgba(255, 69, 58, .2); color: #ff8f86; }
  :root:not([data-theme="light"]) .rec-list .ico.k-topup { background: rgba(52, 208, 127, .18); color: #6fe3a3; }
  :root:not([data-theme="light"]) .rec-list .ico.k-adjust { background: rgba(255, 159, 10, .2); color: #ffc46b; }
}
:root[data-theme="dark"] .pc-pill.ok, :root[data-theme="dark"] .chip.open { background: rgba(52, 208, 127, .18); color: #6fe3a3; }
:root[data-theme="dark"] .pc-pill.low { background: rgba(255, 159, 10, .2); color: #ffc46b; }
:root[data-theme="dark"] .pc-pill.zero, :root[data-theme="dark"] .pc-pill.neg { background: rgba(255, 69, 58, .2); color: #ff8f86; }

.clear-row { display: flex; justify-content: flex-end; margin: -2px 4px 6px; }

/* 紀錄 → 儲值：收入摘要與誰儲值 */
.income { display: grid; grid-template-columns: 1.6fr 1fr; gap: 10px; margin: 0 0 14px; }
.income > div { background: var(--card); border-radius: var(--mid-radius); box-shadow: var(--soft-shadow); padding: 14px 16px; min-width: 0; }
.income .k { display: block; color: var(--muted); font-size: .82rem; }
.income .v { display: block; font-family: var(--font-brand); font-weight: 300; font-size: 2rem; letter-spacing: -.03em; line-height: 1.2; }
.income-side .v { font-size: 1.35rem; padding-top: 6px; }
.income .sub { display: block; color: var(--muted); font-size: .78rem; margin-top: 2px; }
.small-seg { margin-bottom: 4px; }
.pay-row { justify-content: flex-start; gap: 12px; }
.pay-who {
  flex: none; width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--fill); font-weight: 700; color: var(--text);
}
.pay-row .main { flex: 1; }
.pay-amt { font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 家庭：切換小朋友 */
.kid-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.kid-switch .kid {
  border: 1px solid var(--glass-line); background: var(--glass); color: var(--text); border-radius: 999px;
  min-height: 40px; padding: 6px 16px; font: inherit; font-weight: 600; cursor: pointer;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.kid-switch .kid[aria-pressed="true"] { background: var(--press); color: var(--press-ink); border-color: var(--press); }
.kid-switch.in-dialog { margin: 0; }
.kid-switch.in-dialog .kid { background: var(--fill); border-color: transparent; backdrop-filter: none; }
.kid-switch.in-dialog .kid[aria-pressed="true"] { background: var(--press); }
.tag.fam { background: rgba(11, 78, 162, .1); color: var(--accent); }
#add-kid { margin-bottom: 10px; }
.kid-status { margin-bottom: 8px; }
.kid-status .linklike { margin-left: auto; flex: none; }
.action-box .form-error { white-space: pre-line; }

/* ---------- 彩蛋：KBC 顛球王（連點 Logo 5 下） ---------- */
body.egg-open { overflow: hidden; }
.egg {
  position: fixed; inset: 0; z-index: 200; overflow: hidden;
  background: linear-gradient(180deg, var(--accent-soft), transparent 60%), var(--bg);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  animation: egg-in .25s ease-out;
}
@keyframes egg-in { from { opacity: 0; transform: scale(.98); } }
.egg-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.egg-top {
  position: absolute; left: 0; right: 0; top: 0; pointer-events: none;
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 16px 0;
}
.egg-top button { pointer-events: auto; }
.egg-score { font-family: var(--font-brand); font-size: 3rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.egg-combo { color: var(--muted); font-size: .85rem; font-weight: 600; margin-top: 4px; min-height: 1.2em; }
.egg-combo.hot { color: var(--gold); }
.egg-right { display: flex; align-items: center; gap: 8px; }
.egg-hearts { font-size: 1rem; letter-spacing: 1px; margin-right: 2px; }
.egg-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; padding: 0;
  background: var(--fill); color: var(--text); font-size: 1.35rem; line-height: 1; cursor: pointer;
}
.egg-panel {
  position: absolute; left: 16px; right: 16px; top: 50%; transform: translateY(-50%);
  max-width: 360px; margin: 0 auto; padding: 24px 20px 20px;
  background: var(--surface); border-radius: 26px; box-shadow: var(--shadow-lg); text-align: center;
  animation: egg-pop .3s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes egg-pop { from { opacity: 0; transform: translateY(-50%) scale(.9); } }
.egg-title { font-family: var(--font-brand); font-size: 1.9rem; font-weight: 800; letter-spacing: -.01em; }
.egg-title::after { content: " 🏸"; }
.egg-rules { text-align: left; margin: 14px 0 6px; padding-left: 1.2em; color: var(--text); font-size: .92rem; line-height: 1.6; }
.egg-rules b { color: var(--accent); }
.egg-sub { color: var(--muted); margin: 6px 0 16px; }
.egg-go { margin-top: 10px; font-size: 1.1rem; }
.egg-rank {
  display: inline-block; padding: 5px 14px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-weight: 700;
}
.egg-big { font-family: var(--font-brand); font-size: 2.8rem; font-weight: 800; margin-top: 6px; }
.egg-badge { font-weight: 700; color: var(--gold); margin-bottom: 8px; font-size: 1.05rem; }
.egg-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0 0 18px; }
.egg-stats div { background: var(--surface-2); border-radius: 14px; padding: 8px 2px; display: flex; flex-direction: column; }
.egg-stats b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.egg-stats span { color: var(--muted); font-size: .72rem; }
.egg-panel .btn-row { justify-content: center; }
@media (prefers-reduced-motion: reduce) { .egg, .egg-panel { animation: none; } }

/* 羽球對打 */
.egg.rally { background: #0d2238; }
.egg.rally .egg-top { color: #ffffff; }
.egg.rally .egg-btn { background: rgba(255, 255, 255, .18); color: #ffffff; }
.egg-board {
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; max-width: 68vw;
  font-family: var(--font-brand); font-weight: 700; text-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}
.egg-board b { font-size: 2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.egg-board i { font-style: normal; font-size: 1.4rem; opacity: .7; }
.egg-board span { font-size: .9rem; opacity: .9; }
.egg-foe { flex-basis: 100%; font-size: .78rem !important; font-weight: 600; opacity: .75 !important; }
.egg-alt { margin: 12px 0 0; }
.egg-ups { text-align: left; background: var(--surface-2); border-radius: 16px; padding: 10px 12px; margin: 12px 0 14px; }
.egg-ups-head { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 6px; }
.egg-ups-head span { color: var(--gold); }
.egg-up { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 6px 0; }
.egg-up + .egg-up { border-top: .5px solid var(--separator); }
.egg-up-name { display: flex; flex-direction: column; min-width: 0; }
.egg-up-name span { color: var(--muted); font-size: .74rem; }
.egg-dots { display: flex; gap: 3px; }
.egg-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--fill); }
.egg-dots i.on { background: var(--accent); }
.egg-plus {
  width: 32px; height: 32px; border-radius: 50%; border: 0; font-size: 1.2rem; font-weight: 700; cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
}
.egg-plus:disabled { background: var(--fill); color: var(--muted); cursor: default; }

/* 對打：角色選擇、VS、必殺集氣 */
.egg.rally { background: #2b3138; }
.egg-panel { max-height: calc(100% - 110px); overflow-y: auto; overscroll-behavior: contain; }
.egg-panel.wide { max-width: 560px; top: calc(70px + env(safe-area-inset-top)); bottom: 16px; transform: none; max-height: none; animation: none; }
.egg-title.small { font-size: 1.45rem; }
.egg-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin: 10px 0 12px; }
.egg-card {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 8px;
  border: 2px solid transparent; border-radius: 16px; background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit;
  background-image: linear-gradient(180deg, color-mix(in srgb, var(--tc) 22%, transparent), transparent 70%);
}
.egg-card.on { border-color: var(--tc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc) 30%, transparent); }
.egg-card b { font-size: .95rem; }
.egg-type {
  display: inline-block; font-size: .7rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; white-space: nowrap;
  background: color-mix(in srgb, var(--tc) 18%, transparent); color: color-mix(in srgb, var(--tc) 75%, var(--text));
}
.egg-detail { text-align: left; background: var(--surface-2); border-radius: 16px; padding: 10px 12px; margin-bottom: 12px; }
.egg-detail p { margin: 4px 0; font-size: .9rem; }
.egg-detail-head { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; }
.egg-statbars { display: grid; gap: 5px; margin-top: 8px; }
.egg-statbars > div { display: grid; grid-template-columns: 2.6em 1fr 1.4em; align-items: center; gap: 8px; font-size: .82rem; }
.egg-statbar { height: 8px; border-radius: 99px; background: var(--fill); overflow: hidden; }
.egg-statbar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.egg-vs { display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin: 8px 0 2px; }
.egg-vs > div { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.egg-vs-mark { font-family: var(--font-brand); font-weight: 900; font-size: 1.6rem; font-style: italic; color: var(--danger); margin-bottom: 40px; }
.egg-gauge {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom));
  width: min(320px, 76%); display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none;
  color: #fff; font-size: .78rem; font-weight: 700; text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}
.egg-gauge-bar { width: 100%; height: 10px; border-radius: 99px; background: rgba(0, 0, 0, .35); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3); }
.egg-gauge-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffd166, #ff8a3d); transition: width .25s ease; }
.egg-gauge.full .egg-gauge-bar i { background: linear-gradient(90deg, #ff8a3d, #ff3d6e, #ffd166); animation: egg-glow .6s ease-in-out infinite alternate; }
.egg-gauge.full span { color: #ffd166; }
@keyframes egg-glow { from { filter: brightness(1); } to { filter: brightness(1.5); } }
@media (prefers-reduced-motion: reduce) { .egg-gauge.full .egg-gauge-bar i { animation: none; } }

/* 點數分類：團體班、個人班、私人教學… */
.cat-badges { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }
.cat-badge { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.cat-badge small { color: var(--muted); font-size: .72rem; font-weight: 600; }
.pc-wallets { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; margin: 14px 0 16px; }
.pc-wallet {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 6px 12px; border-radius: 18px;
  background: rgba(47, 191, 113, .1); color: #1f8f53;
}
.pc-wallet.low { background: rgba(255, 159, 10, .13); color: #9a5a00; }
.pc-wallet.zero, .pc-wallet.neg { background: rgba(229, 72, 77, .1); color: #d13438; }
.pc-wallet .k { font-size: .8rem; font-weight: 700; color: var(--text); }
.pc-wallet .n { font-size: 2rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pc-wallet .u { font-size: .75rem; opacity: .8; }
.pc-cat { text-align: center; font-weight: 700; font-size: .85rem; margin: 2px 0 4px; }
.cat-wallets { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; align-items: center; }
.cat-wallet { display: flex; flex-direction: column; padding: 8px 12px; border-radius: 14px; background: var(--good-soft); color: var(--good); min-width: 92px; }
.cat-wallet.low { background: var(--warn-soft); color: var(--warn); }
.cat-wallet.zero, .cat-wallet.neg { background: var(--danger-soft); color: var(--danger); }
.cat-wallet .k { font-size: .75rem; font-weight: 600; color: var(--muted); }
.cat-wallet .n { font-size: 1.2rem; font-weight: 800; }
.cat-field .preset-row { margin-top: 4px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pc-wallet { color: #4cd68a; }
  :root:not([data-theme="light"]) .pc-wallet.low { color: #ffb340; }
  :root:not([data-theme="light"]) .pc-wallet.zero, :root:not([data-theme="light"]) .pc-wallet.neg { color: #ff6b6f; }
}

/* 課表：依課程分類篩選（全部、兒童團體班、個人班、VIP班…） */
.class-filter { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; margin: 0 0 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.class-filter::-webkit-scrollbar { display: none; }
.filter-chip { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.filter-chip .n { font-size: .75rem; font-weight: 700; min-width: 18px; padding: 0 5px; border-radius: 999px; background: rgba(120, 130, 140, .18); text-align: center; }
.filter-chip[aria-pressed="true"] .n { background: rgba(255, 255, 255, .25); }

/* 課程方案與價格 */
.tabbar.three { grid-template-columns: repeat(3, 1fr); }
.plan-nav { margin-bottom: 8px; }
.plan-card { scroll-margin-top: 80px; }
.plan-title { margin: 0 0 6px; font-size: 1.2rem; }
.plan-notes { margin: 0 0 10px; padding-left: 1.1em; color: var(--muted); font-size: .88rem; line-height: 1.55; }
.plan-sec + .plan-sec { margin-top: 10px; }
.plan-sec h4 { margin: 6px 0 4px; font-size: .92rem; color: var(--accent); }
.plan-list { list-style: none; margin: 0; padding: 0; }
.plan-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: .5px solid var(--separator); }
.plan-row .main { display: flex; flex-direction: column; min-width: 0; }
.plan-row .title { font-weight: 600; }
.plan-row .meta { color: var(--muted); font-size: .8rem; }
.plan-price { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.plan-price b { font-size: 1.15rem; }
.plan-price small { color: var(--muted); margin-left: 2px; }
#view-plans > .btn { margin-top: 10px; }
.plan-admin-group { border-top: .5px solid var(--separator); padding: 12px 0 8px; }
.plan-admin-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan-admin-row { display: flex; align-items: center; gap: 6px; }
.plan-admin-row .row { flex: 1; min-width: 0; }
.plan-admin-tools { display: inline-flex; gap: 4px; align-items: center; flex-shrink: 0; }
.icon-mini { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--fill); color: var(--text); font-weight: 700; cursor: pointer; }
.icon-mini:disabled { opacity: .35; cursor: default; }
.add-plan { margin-top: 6px; }
.plan-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 6px; margin-bottom: 4px; }
.plan-tile { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 9px 4px; border-radius: 14px; background: var(--fill); text-align: center; min-width: 0; }
.plan-tile .k { font-size: .78rem; color: var(--muted); font-weight: 600; }
.plan-tile .plan-price b { font-size: 1.02rem; }
.plan-tile .meta { color: var(--muted); font-size: .72rem; }

/* 月費會員（VIP） */
.tag.vip { background: rgba(212, 160, 23, .16); color: #8a6400; }
.member-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; margin: 0 0 12px; border-radius: 14px; background: rgba(212, 160, 23, .12); }
.member-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: .85rem; }
.member-main b { font-size: .95rem; }
.member-main span { color: var(--muted); }
.pc-member { display: flex; flex-direction: column; align-items: center; gap: 1px; text-align: center; margin: 0 0 12px; padding: 8px 10px; border-radius: 14px; background: rgba(212, 160, 23, .12); font-size: .82rem; }
.pc-member span { color: var(--muted); }
#member-hint { margin: 0 0 8px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tag.vip { color: #f5c542; }
}
