/* ============================================================
   會員端 / 老師端 — 細長置中殼(桌機也是手機寬,參考 fit-book 型式)
   結構順序照 playbook/04:reset → 字體 → 殼 → 元件 → @media 最底
   ============================================================ */

/* 1. 字體(@import 必須在最前) */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600&family=Noto+Serif+TC:wght@500;700&family=Noto+Sans+TC:wght@400;500;700&display=swap');

/* 2. reset */
* { margin: 0; padding: 0; box-sizing: border-box; }
/* 捲軸位置永遠保留:SweetAlert 開彈窗會把頁面捲軸藏掉,若不保留,置中的 .app 會左右跳 ~8px(pitfalls 007) */
html { scrollbar-gutter: stable; }
/* 頁面捲軸也走細版(與 dialog.css 的 .ui-scroll 同款):桌機看會員端時 Windows 原生粗捲軸與版面質感不合 */
@supports not selector(::-webkit-scrollbar) {
  html { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--primary) 40%, transparent) transparent; }
}
html::-webkit-scrollbar { width: 8px; height: 8px; }
html::-webkit-scrollbar-track { background: transparent; }
html::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--primary) 40%, transparent); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
html::-webkit-scrollbar-thumb:hover { background-color: var(--primary); }
html::-webkit-scrollbar-button { display: none; height: 0; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
/* inline SVG 圖示預設尺寸(未被父層規則指定時,跟隨字級) */
svg { width: 1.25em; height: 1.25em; flex-shrink: 0; }
.ic-lg { width: 30px; height: 30px; }

body {
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  color: var(--ink);
  background: var(--bg-outer); /* 欄外底,比 --bg 深半階,做出細長欄的層次 */
  -webkit-font-smoothing: antialiased;
  transition: background .3s;
}
h1, h2, h3, .brand-text b, .page-title {
  font-family: "Cormorant Garamond", "Noto Serif TC", "Microsoft JhengHei", serif;
}

/* 3. app 殼:細長置中欄 */
.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  box-shadow: 0 0 40px rgba(46, 38, 23, .08);
  display: flex;
  flex-direction: column;
}
.app-main { flex: 1; padding: var(--sp-4); }

/* 4. 頂部品牌列(往下滑會離開,tabs 才黏) */
.app-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px var(--sp-4) 10px;
}
.brand-logo {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: "Cormorant Garamond", "Noto Serif TC", serif;
  font-size: 19px; font-weight: 600;
  flex-shrink: 0;
}
.brand-text { line-height: 1.2; }
.brand-text b { font-size: 17px; letter-spacing: 2px; display: block; }
.brand-text span { font-size: 11px; color: var(--sub); letter-spacing: 1.5px; }
.header-user {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--sub);
}
.header-user .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-2); color: var(--primary-dark);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.role-chip {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--primary-dark);
  border: 1px solid var(--line); letter-spacing: 1px;
}

/* 5. sticky 主導覽 tabs */
.app-tabs {
  position: sticky; top: 0; z-index: 60;
  display: flex;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(46,38,23,.02);
}
.app-tabs a {
  flex: 1;
  text-align: center;
  padding: 12px 4px 10px;
  font-size: 14px; letter-spacing: 1px;
  color: var(--sub);
  border-bottom: 2.5px solid transparent;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  transition: color .2s;
}
.app-tabs a svg { width: 20px; height: 20px; }
.app-tabs a.active {
  color: var(--primary-dark);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

/* 6. 週曆橫條(預約頁,黏在 tabs 下方;一 ~ 日整週 + 前後週箭頭) */
.date-strip-wrap {
  position: sticky; top: 63px; z-index: 55;
  background: var(--bg);
  padding: 10px var(--sp-4) 10px;
  border-bottom: 1px solid var(--line);
}
.date-strip-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
  position: relative;
}
.date-strip-head .month { font-size: 15px; font-weight: 700; letter-spacing: 1px; }
.date-strip-head .spacer { flex: 1; }
/* .chip-btn / .cal-pop / .dp-anchor → 移至 dialog.css(後台共用) */
.week-row { display: flex; align-items: stretch; gap: 4px; }
.week-arrow {
  flex: 0 0 26px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--sub);
  border-radius: 8px;
  transition: all .2s;
}
.week-arrow:hover { background: var(--surface-2); color: var(--primary-dark); }
.week-arrow svg { width: 16px; height: 16px; }
.week-days { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.date-cell {
  text-align: center;
  padding: 7px 0 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .2s;
}
.date-cell .dow { font-size: 11px; color: var(--sub); display: block; margin-bottom: 3px; }
.date-cell .num { font-size: 15px; font-weight: 700; }
.date-cell.selected { background: var(--primary); border-color: var(--primary); }
.date-cell.selected .dow, .date-cell.selected .num { color: #fff; }
.date-cell.today:not(.selected) { border-color: var(--primary); }
.date-cell:not(.selected):not(.dim):hover { background: var(--surface-2); }
.date-cell.dim { opacity: .35; cursor: not-allowed; }

/* 6b. 日曆彈層與通用日期欄位 → dialog.css(全站共用,後台亦用) */

/* 6b2. 公告列(預約頁頂部,一行;後台可設,無公告不顯示) */
.notice-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; margin-bottom: 12px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px; color: var(--ink); line-height: 1.5;
}
.notice-bar svg { width: 16px; height: 16px; color: var(--primary-dark); flex: none; }
.notice-bar .t { flex: 1; min-width: 0; }
.notice-bar .go { color: var(--primary-dark); font-weight: 700; white-space: nowrap; }

/* 5 個分頁時字級略縮,320px 寬手機也放得下 */
.app-tabs a { font-size: 13.5px; letter-spacing: .5px; padding: 11px 2px 9px; }

/* 6c. 輪播(消息頁頂部;.in-main = 放在 main 內,不另加左右外距) */
.carousel.in-main { margin: 0 0 14px; }
.carousel {
  position: relative;
  margin: 2px var(--sp-4) 10px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: 0 8px 26px rgba(46, 38, 23, .10);
}
.carousel-track {
  display: flex;
  transition: transform .5s var(--ease);
  touch-action: pan-y;
}
.carousel-track img {
  flex: 0 0 100%;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}
.carousel-count {
  position: absolute; right: 10px; bottom: 10px;
  background: rgba(46, 38, 23, .55); color: #fff;
  font-size: 11.5px; letter-spacing: 1px;
  padding: 3px 10px; border-radius: 999px;
}
.carousel-dots {
  position: absolute; left: 0; right: 0; bottom: 12px;
  display: flex; justify-content: center; gap: 6px;
  pointer-events: none;
}
.carousel-dots i {
  width: 6px; height: 6px; border-radius: 999px;
  background: rgba(255, 255, 255, .55);
  transition: all .3s;
}
.carousel-dots i.on { width: 18px; background: #fff; }

/* 6d. 分段器(課表:即將上課 / 上課紀錄) */
.seg {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: var(--sp-4);
}
.seg button {
  flex: 1;
  border: none; background: transparent;
  padding: 9px 8px;
  border-radius: 999px;
  color: var(--sub); font-size: 14px; letter-spacing: 1px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all .25s var(--ease);
}
.seg button .cnt {
  font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px;
  background: var(--line); color: var(--sub);
  display: inline-flex; align-items: center; justify-content: center;
}
.seg button.active {
  background: var(--surface); color: var(--primary-dark); font-weight: 700;
  box-shadow: 0 2px 10px rgba(46, 38, 23, .10);
}
.seg button.active .cnt { background: var(--primary); color: #fff; }
.seg-panel { display: none; }
.seg-panel.active { display: block; }

/* 7. 卡片 */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
}
.card-title {
  font-size: 15px; font-weight: 700; letter-spacing: 1px;
  display: flex; align-items: center; gap: 8px;
  margin-bottom: var(--sp-3);
}
.card-title svg { width: 18px; height: 18px; color: var(--primary-dark); }
.section-label {
  font-size: 13px; color: var(--sub); letter-spacing: 2px;
  margin: var(--sp-4) 2px var(--sp-2);
  display: flex; align-items: center; gap: 8px;
}

/* 8. 課堂卡(預約列表 / 課表) */
.class-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px var(--sp-4);
  margin-bottom: var(--sp-3);
  display: flex; align-items: center; gap: 12px;
}
.class-card .t-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--surface-2); color: var(--primary-dark);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
  flex-shrink: 0;
}
.class-card .c-info { flex: 1; min-width: 0; }
.class-card .c-name {
  font-size: 15px; font-weight: 700;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.class-card .c-meta {
  font-size: 13px; color: var(--sub); margin-top: 3px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.class-card .c-meta svg { width: 13px; height: 13px; vertical-align: -2px; }
.class-card .c-side {
  text-align: right; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
}
.seats-note { font-size: 12px; color: var(--sub); }
.seats-note.hot { color: var(--warn); }

/* 9. 徽章 */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  letter-spacing: .5px; font-weight: 500;
}
.badge svg { width: 11px; height: 11px; }
.badge-1v1   { background: var(--info-bg);  color: var(--info); }
.badge-group { background: var(--ok-bg);    color: var(--ok); }
.badge-trial { background: var(--warn-bg);  color: var(--warn); }
.badge-ok    { background: var(--ok-bg);    color: var(--ok); }
.badge-warn  { background: var(--warn-bg);  color: var(--warn); }
.badge-danger{ background: var(--danger-bg);color: var(--danger); }
.badge-muted { background: var(--surface-2);color: var(--sub); }

/* 10. 按鈕 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 22px;
  background: var(--primary); color: #fff;
  border: none; border-radius: 999px;
  font-size: 14px; letter-spacing: 2px;
  transition: all .25s var(--ease);
}
.btn:hover { background: var(--primary-dark); }
.btn svg { width: 15px; height: 15px; }
.btn-sm { padding: 7px 16px; font-size: 13px; letter-spacing: 1px; }
.btn-block { width: 100%; padding: 13px; font-size: 15px; }
.btn-outline {
  background: transparent; color: var(--primary-dark);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--surface-2); }
.btn-ghost {
  background: var(--surface); color: var(--sub);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
/* .btn-danger-outline → dialog.css(全站共用) */
/* 深色卡(invert)上的描邊鈕 */
.btn-invert-outline {
  background: transparent; color: var(--invert-ink);
  border: 1.5px solid var(--invert-sub);
}
.btn-invert-outline:hover {
  background: rgba(255, 255, 255, .14);
  border-color: var(--invert-ink); color: var(--invert-ink);
}
.btn:disabled, .btn.disabled {
  background: var(--line); color: var(--sub);
  cursor: not-allowed; border-color: var(--line);
}

/* 11. 表單 */
.form-group { margin-bottom: var(--sp-4); }
.form-group label {
  display: block; font-size: 13px; color: var(--sub);
  letter-spacing: 1px; margin-bottom: 6px;
}
.form-group label .req { color: var(--danger); }
.ui-input, .ui-select, .ui-textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 15px;
  transition: border-color .2s;
}
.ui-input:focus, .ui-select:focus, .ui-textarea:focus {
  outline: none; border-color: var(--primary);
}
.ui-input:disabled {
  background: var(--surface-2); color: var(--sub);
  cursor: not-allowed; opacity: .65;
}
.form-hint { font-size: 12px; color: var(--sub); margin-top: 5px; }

/* 數字輸入框:隱藏原生 spinner(視覺乾淨) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* 開關(設定頁用,與後台同款) */
.ui-switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.ui-switch input { display: none; }
.ui-switch i {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--line); transition: background .2s; cursor: pointer;
}
.ui-switch i::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: left .2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.ui-switch input:checked + i { background: var(--primary); }
.ui-switch input:checked + i::after { left: 21px; }

/* 自訂 checkbox / pill 複選 → dialog.css(全站共用,後台彈窗亦用) */

/* 12. 數字統計卡 */
.stat-row { display: flex; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.stat-card {
  flex: 1;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px; text-align: center;
}
.stat-card .num {
  font-size: 26px; font-weight: 700; color: var(--primary-dark);
  font-family: "Cormorant Garamond", "Noto Serif TC", serif;
  line-height: 1.15;
}
.stat-card .lbl { font-size: 12px; color: var(--sub); letter-spacing: 1px; margin-top: 2px; }

/* 13. 列表列(錢包批次 / 明細) */
.row-list { display: flex; flex-direction: column; }
.row-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 2px;
  border-bottom: 1px dashed var(--line);
  font-size: 14px;
}
.row-item:last-child { border-bottom: none; }
.row-item .r-main { flex: 1; min-width: 0; }
.row-item .r-sub { font-size: 12px; color: var(--sub); margin-top: 2px; }
.row-item .r-val { text-align: right; font-weight: 700; flex-shrink: 0; }
.row-item .r-val .r-sub { font-weight: 400; }

/* 14. 提示橫幅 */
.banner {
  display: flex; gap: 10px; align-items: flex-start;
  border-radius: var(--radius-lg);
  padding: 14px var(--sp-4);
  margin-bottom: var(--sp-3);
  font-size: 14px; line-height: 1.55;
}
.banner svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; }
.banner-info { background: var(--info-bg); color: var(--info); }
.banner-warn { background: var(--warn-bg); color: var(--warn); }
.banner b { display: block; margin-bottom: 2px; }

/* 15. 進度條(級距) */
.progress {
  height: 8px; border-radius: 999px;
  background: var(--surface-2); overflow: hidden;
}
.progress > i {
  display: block; height: 100%;
  background: var(--primary); border-radius: 999px;
}

/* 16. Modal(playbook/04) */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(46, 38, 23, .55);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-backdrop.show { opacity: 1; pointer-events: auto; }
.modal {
  background: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%; max-width: 560px;
  max-height: 82vh; overflow-y: auto;
  padding: 20px var(--sp-4) 26px;
  transform: translateY(24px); transition: transform .25s var(--ease);
}
.modal-backdrop.show .modal { transform: translateY(0); }
.modal h3 {
  font-size: 17px; letter-spacing: 1px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.modal h3 svg { width: 19px; height: 19px; color: var(--primary-dark); }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

/* 17. Toast(playbook/04) */
.ui-toast {
  position: fixed; left: 50%; bottom: 40px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff;
  padding: 13px 26px; border-radius: 999px;
  letter-spacing: 1.5px; font-size: 14px;
  opacity: 0; pointer-events: none;
  transition: all .3s; z-index: 9999;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
  max-width: 88vw; text-align: center;
}
.ui-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 18. 頁尾 */
.app-footer {
  text-align: center;
  padding: 22px var(--sp-4) 28px;
  font-size: 12px; color: var(--sub);
  letter-spacing: 1px;
  border-top: 1px solid var(--line);
}
.app-footer .links { margin-bottom: 6px; }
.app-footer .links a { margin: 0 8px; }
.app-footer .links a:hover { color: var(--primary-dark); }

/* 19. 登入頁 */
.auth-wrap {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 30px var(--sp-4);
}
.auth-logo {
  width: 66px; height: 66px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: "Cormorant Garamond", "Noto Serif TC", serif;
  font-size: 30px; margin-bottom: 12px;
}
.auth-title { font-size: 24px; letter-spacing: 4px; }
.auth-sub { font-size: 12px; color: var(--sub); letter-spacing: 3px; margin: 4px 0 24px; }
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 22px;
}
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--sub); font-size: 12px; letter-spacing: 2px;
  margin: 18px 0;
}
.auth-divider::before, .auth-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}
.btn-line {
  width: 100%; padding: 12px;
  background: #06c755; color: #fff;
  border: none; border-radius: var(--radius);
  font-size: 15px; letter-spacing: 1px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-line svg { width: 20px; height: 20px; }
.btn-google {
  width: 100%; padding: 12px; margin-top: 10px;
  background: #fff; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: var(--radius);
  font-size: 15px; letter-spacing: 1px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-google svg { width: 18px; height: 18px; }
.auth-note { font-size: 12px; color: var(--sub); text-align: center; margin-top: 8px; }
.demo-accounts {
  width: 100%; max-width: 400px; margin-top: 20px;
}
.demo-accounts .demo-head {
  font-size: 12px; color: var(--sub); letter-spacing: 2px;
  text-align: center; margin-bottom: 10px;
}
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.demo-chip {
  background: var(--surface); border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 9px 10px; font-size: 12.5px; color: var(--sub);
  text-align: left; line-height: 1.45;
  transition: all .2s;
}
.demo-chip b { color: var(--ink); font-size: 13px; display: block; }
.demo-chip:hover { border-color: var(--primary); background: var(--surface-2); }

/* 20. 註冊步驟條 */
.stepper {
  display: flex; align-items: center;
  margin-bottom: 20px;
}
.stepper .step {
  flex: 1; text-align: center; position: relative;
  font-size: 12px; color: var(--sub);
}
.stepper .dot {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--line);
  color: var(--sub);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  margin: 0 auto 5px; position: relative; z-index: 2;
}
.stepper .step::before {
  content: ""; position: absolute;
  top: 13px; left: -50%; right: 50%;
  height: 2px; background: var(--line);
}
.stepper .step:first-child::before { display: none; }
.stepper .step.done .dot,
.stepper .step.current .dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.stepper .step.done::before,
.stepper .step.current::before { background: var(--primary); }
.stepper .step.current { color: var(--primary-dark); font-weight: 700; }
.reg-step { display: none; }
.reg-step.active { display: block; }
.terms-box {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px; font-size: 13px; line-height: 1.8; color: var(--sub);
  max-height: 240px; overflow-y: auto; margin-bottom: 14px;
}
.terms-box h4 { color: var(--ink); margin-bottom: 6px; }

/* 21. 老師排課月曆(美化版) */
.tcal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.tcal-head .m {
  flex: 1;
  font-size: 16px; font-weight: 700; letter-spacing: 1.5px;
  font-family: "Cormorant Garamond", "Noto Serif TC", serif;
}
.tcal-nav {
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--sub);
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.tcal-nav:hover { border-color: var(--primary); color: var(--primary-dark); }
.tcal-nav svg { width: 15px; height: 15px; }
.tcal-legend {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 12px; color: var(--sub);
}
.tcal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.tcal-legend i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.tcal-legend i.op { background: var(--primary); }
.tcal-legend i.bk { background: var(--ok); }
.tcal-legend i.off { background: var(--danger); }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-grid .cal-dow {
  font-size: 11px; color: var(--sub);
  padding: 4px 0 7px; letter-spacing: 1px;
}
.cal-cell {
  position: relative;
  border: 1px solid transparent; border-radius: 10px;
  padding: 9px 2px 8px;
  min-height: 52px; cursor: pointer;
  background: transparent;
  transition: all .15s;
}
.cal-cell.has { background: var(--surface-2); }
.cal-cell.offday { background: var(--danger-bg); }
.cal-cell:hover { border-color: var(--primary); }
.cal-cell.blank { pointer-events: none; background: transparent; }
.cal-cell.past { opacity: .4; }
.cal-cell.today { border-color: var(--primary); }
.cal-cell.sel { background: var(--primary); border-color: var(--primary); }
.cal-cell.sel .d { color: #fff; }
.cal-cell .d { font-size: 13.5px; font-weight: 700; }
.cal-cell .dots {
  display: flex; gap: 2.5px; justify-content: center;
  margin-top: 4px; min-height: 6px; flex-wrap: wrap;
}
.cal-cell .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--primary); }
.cal-cell .dots i.bk { background: var(--ok); }
.cal-cell .dots i.off { background: var(--danger); }
.cal-cell.sel .dots i { background: rgba(255, 255, 255, .9); }

/* 21b. 會員預約月曆(沿用 .cal-grid;點色依課型) */
.cal-cell.none { opacity: .45; cursor: default; }
.cal-cell.none:hover { border-color: transparent; }
.cal-cell .dots i.t1 { background: var(--primary); }
.cal-cell .dots i.tg { background: var(--info); }
.cal-cell .dots i.mine { background: var(--ok); }
.cal-cell .dots i.sub { background: var(--warn); }
.tcal-legend i.t1 { background: var(--primary); }
.tcal-legend i.tg { background: var(--info); }
.tcal-legend i.mine { background: var(--ok); }
.tcal-legend i.sub { background: var(--warn); }

/* 老師對學員的私人備註(學員頁卡片預覽列) */
.t-note { display: flex; align-items: flex-start; gap: 5px; color: var(--sub); font-style: normal; line-height: 1.5; }
.t-note svg { color: var(--primary); flex: none; margin-top: 2px; }
.t-note .t-note-text { flex: 1; min-width: 0; }
.cal-filter { margin-bottom: 12px; }
.cal-filter .ui-pills { justify-content: flex-start; }

/* 21c. 子頁返回列(儲值 / 兌換 → 錢包) */
.back-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13.5px; color: var(--sub);
  margin: 2px 0 12px; padding: 4px 0;
  transition: color .2s;
}
.back-link:hover { color: var(--primary-dark); }
.back-link svg { width: 16px; height: 16px; }

/* 老師端時段列 */
.slot-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 2px;
  border-bottom: 1px dashed var(--line);
  font-size: 14px;
}
.slot-row:last-child { border-bottom: none; }
.slot-row .time { font-weight: 700; width: 96px; flex-shrink: 0; }
.slot-row .who { flex: 1; min-width: 0; color: var(--sub); font-size: 13px; }

/* 22. 大結尾 @media */
@media (max-width: 600px) {
  .app { box-shadow: none; }
  body { background: var(--bg); }
}
@media (max-width: 400px) {
  .app-tabs a { font-size: 13px; letter-spacing: 0; }
  .stat-card .num { font-size: 22px; }
  .demo-grid { grid-template-columns: 1fr; }
}
