/* 羽球練練團分錢錢｜UUPM: Vibrant & Block-based，靛藍＋橘，Nunito／Noto Sans TC */
:root {
  --primary: #4F46E5;
  --primary-dark: #3730A3;
  --secondary: #818CF8;
  --cta: #F97316;
  --cta-dark: #EA580C;
  --bg: #EEF2FF;
  --card: #FFFFFF;
  --text: #1E1B4B;
  --muted: #6B7280;
  --line: #E5E7EB;
  --ok: #16A34A;
  --ok-bg: #DCFCE7;
  --warn-bg: #FEF3C7;
  --danger: #DC2626;
  --radius: 18px;
  --shadow: 0 2px 12px rgba(30, 27, 75, 0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: "Nunito", "Noto Sans TC", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 0 16px 120px;
  touch-action: manipulation;
  line-height: 1.5;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
input { font-family: inherit; }
a { color: var(--primary); }
.hidden { display: none !important; }

/* 頂欄 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0 14px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo {
  width: 40px; height: 40px; border-radius: 12px; background: var(--primary);
  display: grid; place-items: center; color: #fff;
}
.brand h1 { font-size: 20px; font-weight: 800; letter-spacing: 0; }
.brand .sub { font-size: 12px; color: var(--muted); font-weight: 600; }
.me { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.me img, .avatar {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--secondary);
  display: inline-grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px; flex-shrink: 0;
}
.badge-admin { font-size: 11px; background: var(--cta); color: #fff; border-radius: 999px; padding: 2px 8px; font-weight: 800; }

/* 區塊標題 */
.section-title {
  font-size: 14px; font-weight: 800; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0; margin: 22px 0 10px; display: flex; align-items: center; gap: 6px;
}

/* 卡片 */
.card {
  background: var(--card); border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
  box-shadow: var(--shadow); transition: transform 150ms ease, box-shadow 150ms ease;
}
.card.tappable { cursor: pointer; }
.card.tappable:active { transform: scale(0.985); }
.card.today { outline: 3px solid var(--cta); }
.session-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.session-date { font-size: 22px; font-weight: 900; line-height: 1.15; }
.session-date .wk { color: var(--primary); }
.session-time { color: var(--muted); font-weight: 700; font-size: 14px; margin-top: 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 800; background: var(--bg); color: var(--primary); white-space: nowrap;
}
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: #B45309; }
.chips { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.see-list { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 800; color: var(--primary); margin: 6px 0 10px; }
.chip.cta { background: #FFF7ED; color: var(--cta-dark); }

/* 頭像列 */
.avatars { display: flex; align-items: center; margin: 14px 0 4px; min-height: 36px; }
.avatars .avatar { margin-right: -8px; border: 2px solid #fff; width: 34px; height: 34px; font-size: 13px; }
.avatars .more { margin-left: 14px; font-size: 13px; color: var(--muted); font-weight: 700; }
.avatars .empty { font-size: 13px; color: var(--muted); font-weight: 600; }

/* 按鈕 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 20px; border-radius: 14px; font-size: 17px; font-weight: 800;
  transition: transform 120ms ease, background 150ms ease, box-shadow 150ms ease; width: 100%;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-cta { background: var(--cta); color: #fff; box-shadow: 0 4px 14px rgba(249, 115, 22, 0.35); }
.btn-cta:hover { background: var(--cta-dark); }
.btn-ghost { background: var(--bg); color: var(--primary); }
.btn-ghost:hover { background: #E0E7FF; }
.btn-ok { background: var(--ok-bg); color: var(--ok); }
.btn-line { background: #06C755; color: #fff; }
.btn-line:hover { background: #05A847; }
.btn-danger { background: #FEE2E2; color: var(--danger); }
.btn-sm { height: 38px; font-size: 14px; padding: 0 14px; border-radius: 10px; width: auto; }
.btn-row { display: flex; gap: 10px; margin-top: 12px; }
.btn-row .btn { flex: 1; }
.mt { margin-top: 12px; }

/* 名單 */
.member-list { margin-top: 8px; }
.member {
  display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line);
}
.member:last-child { border-bottom: none; }
.member .name { flex: 1; font-weight: 700; font-size: 16px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member .name small { color: var(--muted); font-weight: 600; font-size: 12px; margin-left: 6px; }
.check {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--bg); color: #C7CBD9; transition: background 150ms ease, color 150ms ease;
}
.check.on { background: var(--ok); color: #fff; }
.check.can { cursor: pointer; }
.check.can:hover { color: var(--primary); }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); }
.icon-btn:hover { background: var(--bg); color: var(--danger); }
.icon-btn.on { color: var(--cta); }
.tag-admin { background: #FFF7ED; color: var(--cta-dark); border-radius: 999px; padding: 1px 7px; font-size: 11px; font-weight: 800; margin-left: 6px; }

/* 金額卡 */
.amount-card {
  background: linear-gradient(135deg, var(--primary), #2563EB); color: #fff; border-radius: 20px;
  padding: 24px 20px 20px; text-align: center; box-shadow: 0 6px 24px rgba(79, 70, 229, 0.4); margin-bottom: 14px;
}
.amount-card .label { font-size: 14px; opacity: 0.85; font-weight: 700; }
.amount-card .amount { font-size: 60px; font-weight: 900; line-height: 1.05; letter-spacing: -2px; margin: 4px 0; }
.amount-card .amount small { font-size: 22px; font-weight: 800; letter-spacing: 0; opacity: 0.85; margin-right: 4px; }
.amount-card .breakdown { font-size: 13px; opacity: 0.85; margin-top: 14px; border-top: 1px solid rgba(255,255,255,0.25); padding-top: 12px; text-align: left; line-height: 1.9; }
.amount-card .breakdown .row { display: flex; justify-content: space-between; }
.amount-card .breakdown .total { font-weight: 800; opacity: 1; border-top: 1px solid rgba(255,255,255,0.2); margin-top: 4px; padding-top: 6px; }

/* 結算表單（步進器，沿用參考站） */
.field { margin-bottom: 14px; }
.field-label { font-size: 14px; font-weight: 800; color: #374151; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.step-btn {
  width: 48px; height: 48px; border-radius: 12px; background: var(--primary); color: #fff; font-size: 24px;
  display: grid; place-items: center; flex-shrink: 0; transition: transform 100ms ease;
}
.step-btn.minus { background: #E5E7EB; color: #6B7280; }
.step-btn:active { transform: scale(0.92); }
.step-input {
  flex: 1; min-width: 0; height: 48px; text-align: center; font-size: 28px; font-weight: 900;
  border: 2px solid transparent; border-radius: 12px; background: var(--bg); color: var(--text); outline: none;
  appearance: none; -moz-appearance: textfield;
}
.step-input::-webkit-outer-spin-button, .step-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.step-input:focus { border-color: var(--primary); background: #fff; }
.rate-row { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.rate-input {
  width: 76px; height: 34px; border: 1.5px dashed #A5B4FC; border-radius: 8px; text-align: center;
  font-size: 15px; font-weight: 800; color: var(--primary); background: #F5F7FF; outline: none; appearance: none;
}
.rate-input:focus { border-style: solid; }
.hint { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 6px; }
.preview { font-size: 14px; font-weight: 800; color: var(--primary); margin-top: 4px; }

/* 管理員區 */
.admin-box { border: 2px dashed #C7D2FE; background: #F8FAFF; }
.admin-box .section-title { margin-top: 0; }
.inline-form { display: flex; gap: 8px; }
.inline-form input {
  flex: 1; height: 44px; border-radius: 12px; border: 1.5px solid var(--line); padding: 0 12px; font-size: 16px; outline: none;
}
.inline-form input:focus { border-color: var(--primary); }

/* 返回列 */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--primary); font-weight: 800; font-size: 15px; padding: 6px 0 12px; }

/* 提示 */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 700; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity 200ms ease, transform 200ms ease; max-width: 92vw; text-align: center; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.loading { text-align: center; color: var(--muted); font-weight: 700; padding: 40px 0; }
.error-box { background: #FEF2F2; color: var(--danger); border-radius: 12px; padding: 14px; font-weight: 700; margin: 12px 0; }
.note { font-size: 13px; color: var(--muted); font-weight: 600; line-height: 1.6; }
.pay-note { background: var(--warn-bg); color: #92400E; border-radius: 12px; padding: 10px 12px; font-size: 13px; font-weight: 700; margin-top: 10px; line-height: 1.6; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (min-width: 640px) { body { max-width: 560px; margin: 0 auto; } }
