:root {
  color-scheme: light;
  --white: #ffffff;
  --canvas: #fff7fa;
  --navy: #082956;
  --navy-strong: #061f43;
  --teal: #c2185b;
  --teal-dark: #9f174d;
  --teal-soft: #fde7f0;
  --amber: #c85f00;
  --amber-soft: #fff3e6;
  --red: #b42318;
  --red-soft: #fef3f2;
  --green: #b31555;
  --green-soft: #fdeaf2;
  --ink: #17202b;
  --muted: #65727f;
  --line: #d9e0e3;
  --line-strong: #c2ccd0;
  --shadow: 0 10px 30px rgba(8, 41, 86, .08);
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --content: 760px;
  font-family: "Segoe UI", "Microsoft JhengHei", "Noto Sans TC", Arial, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-height: 100%; background: var(--canvas); }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
svg { display: block; }

.app-shell {
  width: min(100%, var(--content));
  min-height: 100vh;
  margin: 0 auto;
  background: var(--white);
  box-shadow: 0 0 0 1px rgba(8, 41, 86, .06);
}

@media (min-width: 900px) {
  .is-payment-report .app-shell, .is-payment-report .bottom-nav { width: min(calc(100% - 36px), 1180px); }
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  padding: max(16px, env(safe-area-inset-top)) 20px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(14px);
}

.wordmark {
  display: block;
  color: var(--navy-strong);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
  text-decoration: none;
}

.wordmark span { font-weight: 700; }
.app-header p { margin: 1px 0 0; color: var(--muted); font-size: 12px; }

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  color: var(--teal);
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
}

.icon-button:hover { background: var(--teal-soft); border-color: #efb6cb; }
.icon-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

main { min-height: calc(100vh - 158px); padding: 24px 20px 112px; outline: 0; }

.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-heading h1, .page-heading h2 { margin: 0; color: var(--navy-strong); font-size: clamp(26px, 7vw, 34px); line-height: 1.16; letter-spacing: -.035em; }
.page-heading p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.hero-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 78px;
  margin: 4px 0 24px;
  padding: 18px 24px;
  color: var(--white);
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--teal);
  font-size: 22px;
  font-weight: 760;
  letter-spacing: .02em;
  box-shadow: 0 10px 24px rgba(194, 24, 91, .18);
}

.hero-action:hover { background: var(--teal-dark); }

.unpaid-reminder { margin: 0 0 24px; overflow: hidden; border: 1px solid #efc37d; border-radius: var(--radius-lg); background: #fffaf0; box-shadow: 0 8px 22px rgba(154, 94, 7, .08); }
.unpaid-reminder-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 16px 17px; color: #623c08; border-bottom: 1px solid #efc37d; background: #fff3d9; }
.unpaid-reminder-heading span { display: block; margin-bottom: 2px; color: #9a5e07; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.unpaid-reminder-heading h2 { margin: 0; color: #623c08; font-size: 20px; }
.unpaid-reminder-heading > strong { text-align: right; white-space: nowrap; }
.unpaid-reminder-heading small { color: #7d4e0a; font-size: 11px; }
.unpaid-reminder-list { display: grid; }
.unpaid-reminder-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 13px 16px; color: var(--ink); text-align: left; border: 0; border-bottom: 1px solid #f1d9b2; background: white; }
.unpaid-reminder-row:last-child { border-bottom: 0; }
.unpaid-reminder-row:hover { background: #fffdf8; }
.unpaid-reminder-row span, .unpaid-reminder-row strong, .unpaid-reminder-row small { display: block; }
.unpaid-reminder-row strong { color: var(--navy); font-size: 15px; }
.unpaid-reminder-row small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.unpaid-reminder-row > span:last-child { text-align: right; }
.unpaid-reminder-row b { color: #9a5e07; font-size: 15px; }
.unpaid-reminder-more { margin: 0; padding: 10px 16px; color: #7d4e0a; font-size: 11px; border-top: 1px solid #efc37d; }
.unpaid-reminder-clear { display: grid; gap: 3px; padding: 15px 17px; color: #8f1749; border-color: #eab1c5; background: var(--green-soft); box-shadow: none; }
.unpaid-reminder-clear strong { color: #8f1749; }
.unpaid-reminder-clear span { font-size: 12px; }

.section { margin-top: 28px; }
.section-title { margin: 0 0 12px; color: var(--navy); font-size: 20px; letter-spacing: -.02em; }

.action-list, .record-list { border-top: 1px solid var(--line); }

.action-row, .record-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  width: 100%;
  min-height: 72px;
  gap: 16px;
  padding: 14px 4px;
  color: var(--navy-strong);
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.action-row:hover, .record-row:hover { background: #fff9fb; }
.row-icon { display: grid; width: 42px; height: 42px; place-items: center; color: var(--teal); border: 1px solid #f0bfd1; border-radius: 50%; }
.row-icon svg, .chevron svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.row-copy { min-width: 0; }
.row-title { display: block; color: var(--navy-strong); font-size: 17px; font-weight: 700; }
.row-meta { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.row-side { display: flex; align-items: center; gap: 10px; }
.amount { color: var(--navy-strong); font-weight: 760; white-space: nowrap; }
.chevron { color: var(--navy); }
.chevron svg { width: 18px; }
.record-edit-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 5px 12px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
  border: 1px solid #e8a9c0;
  border-radius: 999px;
  background: #fff9fb;
}
.record-row:hover .record-edit-label { background: #fff0f5; }

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 3px 10px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.status-unpaid, .status-partial { color: var(--amber); background: var(--amber-soft); }
.status-paid { color: var(--green); background: var(--green-soft); }
.status-void { color: var(--red); background: var(--red-soft); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  gap: 8px;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}
.button-primary { color: var(--white); border-color: var(--teal); background: var(--teal); }
.button-primary:hover { border-color: var(--teal-dark); background: var(--teal-dark); }
.button-secondary { color: var(--navy); border-color: var(--line-strong); background: var(--white); }
.button-secondary:hover { background: #fff7fa; }
.button-danger { color: var(--red); border-color: #f1b4af; background: var(--red-soft); }
.button-block { width: 100%; }
.button-small { min-height: 36px; padding: 6px 11px; font-size: 13px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 18px; }
.toolbar-group { display: flex; flex-wrap: wrap; gap: 8px; }
.search { width: min(100%, 330px); }

.field { display: grid; gap: 7px; margin-bottom: 17px; }
.field > span, .field-label { color: var(--navy); font-size: 14px; font-weight: 750; }
.field small { margin-top: -2px; color: var(--muted); font-size: 12px; }
.course-code-entry { padding: 13px; border: 2px solid #edb3c9; border-radius: var(--radius-sm); background: var(--teal-soft); }
.course-code-entry input { border-color: var(--teal); font-size: 18px; font-weight: 800; letter-spacing: .025em; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
input, select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 16px;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(194, 24, 91, .16); border-color: var(--teal); }
input[readonly] { color: #515c66; background: #f7f9f9; }
.field-error { min-height: 20px; margin: 0 0 8px; color: var(--red); font-size: 13px; }

.form-page { margin: -24px -20px -112px; padding-bottom: 120px; }
.form-page-header { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; min-height: 68px; padding: 10px 14px; color: white; background: var(--navy); }
.form-page-header h1 { margin: 0; font-size: 21px; text-align: center; }
.back-button { color: white; border-color: rgba(255,255,255,.3); background: transparent; }
.form-content { padding: 22px 20px; }
.inline-note { margin: -8px 0 18px; color: var(--muted); font-size: 13px; }
.invoice-course-heading { display: flex; justify-content: space-between; gap: 12px; margin: 8px 0 12px; color: var(--navy); }
.invoice-course-heading strong, .invoice-course-heading span { display: block; }
.invoice-course-heading span { margin-top: 3px; color: var(--muted); font-size: 13px; font-weight: 400; }
.invoice-course-items { display: grid; gap: 16px; margin-bottom: 14px; }
.invoice-course-item { padding: 16px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff9fb; box-shadow: 0 5px 16px rgba(8, 41, 86, .04); }
.invoice-item-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.invoice-item-header h2 { margin: 0; color: var(--navy); font-size: 18px; }
.invoice-total-panel { margin: 20px 0 8px; padding: 17px; border: 2px solid var(--teal); border-radius: var(--radius); background: var(--teal-soft); }
.invoice-total-panel h2 { margin: 0 0 14px; color: var(--navy); font-size: 20px; }
.invoice-total-panel .inline-note { margin-bottom: 0; }
.date-list { display: grid; gap: 9px; margin-bottom: 12px; }
.date-row { display: grid; grid-template-columns: 1fr 48px; }
.date-row input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.date-remove { color: var(--red); border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: white; font-size: 20px; }
.sticky-save { position: fixed; z-index: 15; right: 0; bottom: 0; left: 0; width: min(100%, var(--content)); margin: auto; padding: 12px 20px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.97); }

.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.summary-item { padding: 13px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff9fb; }
.summary-item span { display: block; color: var(--muted); font-size: 12px; }
.summary-item strong { display: block; margin-top: 3px; color: var(--navy); font-size: 18px; }
.summary-item small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.home-payment-overview { margin: 0 0 20px; padding: 16px; border: 1px solid #eab1c5; border-radius: var(--radius-lg); background: linear-gradient(135deg, #fff6f9, #fff); box-shadow: 0 8px 22px rgba(123, 19, 73, .06); }
.home-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.home-section-heading span { display: block; color: var(--teal); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.home-section-heading h2 { margin: 2px 0 0; color: var(--navy); font-size: 20px; }
.home-section-heading button { padding: 5px 0; color: var(--teal); border: 0; background: transparent; font-size: 13px; font-weight: 800; }
.home-payment-summary-grid { grid-template-columns: 1fr 1fr; margin: 13px 0 0; }
.home-payment-row .row-icon { color: var(--green); }
.home-payment-more { width: 100%; padding: 13px; color: var(--teal); border: 0; border-bottom: 1px solid var(--line); background: #fff9fb; font-weight: 800; }
.compact-empty-state { padding: 24px 14px; }
.payment-summary-grid { grid-template-columns: repeat(4, 1fr); }
.monthly-total-section { margin-top: 22px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.monthly-total-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 15px 16px; border-bottom: 1px solid var(--line); background: #fff4f8; }
.monthly-total-heading span { display: block; color: var(--teal); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.monthly-total-heading h2 { margin: 2px 0 0; color: var(--navy); font-size: 20px; }
.monthly-total-heading small { color: var(--muted); font-size: 11px; text-align: right; }
.monthly-total-list { display: grid; }
.monthly-total-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.monthly-total-row:last-child { border-bottom: 0; }
.monthly-total-row strong, .monthly-total-row span { display: block; }
.monthly-total-row strong { color: var(--navy); font-size: 16px; }
.monthly-total-row span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.monthly-total-row b { color: var(--teal-dark); font-size: 18px; white-space: nowrap; }

.payment-report-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.payment-calendar-section { margin-top: 22px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.payment-calendar-toolbar { position: sticky; left: 0; display: grid; grid-template-columns: auto minmax(210px, 1fr) auto; align-items: end; gap: 10px; min-width: 720px; padding: 14px; border-bottom: 1px solid var(--line); background: #fff9fb; }
.payment-calendar-toolbar label { display: grid; gap: 5px; color: var(--navy); font-size: 12px; font-weight: 750; }
.payment-calendar-toolbar input { min-height: 42px; }
.payment-week-range { position: sticky; left: 0; width: fit-content; margin: 0; padding: 11px 14px 3px; color: var(--navy); font-size: 13px; font-weight: 800; }
.payment-calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(148px, 1fr)); gap: 1px; min-width: 1040px; padding: 10px; background: var(--line); }
.payment-calendar-day { min-height: 220px; background: white; }
.payment-calendar-day.is-today { box-shadow: inset 0 0 0 2px var(--teal); }
.payment-calendar-day > header { min-height: 78px; padding: 10px; border-bottom: 1px solid var(--line); background: #fff9fb; }
.payment-calendar-day > header div, .payment-calendar-day > header strong, .payment-calendar-day > header span, .payment-calendar-day > header b { display: block; }
.payment-calendar-day > header strong { color: var(--navy); font-size: 15px; }
.payment-calendar-day > header span { color: var(--muted); font-size: 11px; }
.payment-calendar-day > header b { margin-top: 5px; color: var(--teal-dark); font-size: 13px; }
.payment-calendar-day-body { display: grid; gap: 8px; padding: 8px; }
.payment-calendar-card { display: grid; gap: 5px; width: 100%; padding: 10px; color: var(--ink); text-align: left; border: 1px solid #efbfd1; border-radius: 9px; background: #fff5f8; }
.payment-calendar-card:hover { border-color: var(--teal); background: var(--teal-soft); }
.payment-calendar-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.payment-calendar-card-top strong { color: var(--navy); font-size: 14px; }
.payment-calendar-card-top b { color: var(--teal-dark); font-size: 12px; white-space: nowrap; }
.payment-calendar-card > small { color: var(--muted); font-size: 10px; }
.payment-period-line { display: grid; gap: 2px; margin-top: 4px; }
.payment-period-line strong { color: var(--navy); font-size: 11px; line-height: 1.35; }
.payment-period-line span { color: var(--muted); font-size: 10px; line-height: 1.4; overflow-wrap: anywhere; }
.payment-calendar-empty { margin: 16px 4px; color: var(--muted); font-size: 12px; text-align: center; }
.payment-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.payment-table { width: 100%; min-width: 920px; border-collapse: collapse; background: white; font-size: 13px; }
.payment-table th, .payment-table td { padding: 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.payment-table th { color: var(--navy); background: #fff4f8; font-size: 12px; }
.payment-table td > small { display: block; margin-top: 3px; color: var(--muted); }
.payment-table .payment-period-line { margin: 0 0 6px; }
.payment-table .payment-period-line:last-child { margin-bottom: 0; }
.payment-table-amount { color: var(--navy); font-weight: 800; white-space: nowrap; }
.payment-table-empty { padding: 34px !important; color: var(--muted); text-align: center !important; }

.detail-panel { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); }
.detail-panel h2 { margin: 0 0 14px; color: var(--navy); font-size: 21px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
.detail-item dt { color: var(--muted); font-size: 12px; }
.detail-item dd { margin: 2px 0 0; color: var(--ink); font-weight: 650; overflow-wrap: anywhere; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.date-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0 0; }
.date-chip { padding: 5px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--navy); background: #fff8fb; font-size: 13px; }
.invoice-date-chip { display: grid; gap: 2px; }
.invoice-date-chip small { color: var(--muted); font-size: 11px; font-weight: 700; }
.invoice-item-time { margin-top: -4px; color: var(--teal-dark); font-weight: 700; }
.invoice-detail-courses { display: grid; gap: 12px; }
.invoice-detail-course { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff9fb; }
.invoice-detail-course-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.invoice-detail-course-header span { color: var(--muted); font-size: 12px; }
.invoice-detail-course-header h3 { margin: 2px 0 0; color: var(--navy); font-size: 17px; }
.invoice-detail-course-header strong { color: var(--navy); white-space: nowrap; }
.invoice-remark { margin-top: 14px; padding: 13px 14px; border-left: 4px solid var(--gold); border-radius: 8px; background: #fffaf0; }
.invoice-remark h3 { margin: 0 0 6px; color: var(--navy); font-size: 14px; }
.invoice-remark p { margin: 0; color: var(--ink); line-height: 1.6; overflow-wrap: anywhere; }

.empty-state { padding: 44px 16px; color: var(--muted); text-align: center; border-bottom: 1px solid var(--line); }
.empty-state strong { display: block; margin-bottom: 6px; color: var(--navy); font-size: 18px; }

.warning { margin: 18px 0; padding: 14px 16px; color: #68400a; border: 1px solid #f2cf96; border-radius: var(--radius); background: #fff9ed; font-size: 14px; }
.settings-group { margin: 0 0 28px; }
.settings-group h2 { margin: 0 0 12px; color: var(--navy); font-size: 19px; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 9px; }

.receipt-page { margin: -24px -20px -112px; padding-bottom: 190px; background: var(--canvas); }
.receipt-sheet { width: min(calc(100% - 28px), 680px); min-height: 860px; margin: 18px auto; padding: 28px; border: 1px solid var(--line-strong); background: white; box-shadow: var(--shadow); }
.receipt-header { padding-bottom: 18px; text-align: center; border-bottom: 3px solid var(--teal); }
.receipt-header h1 { margin: 0 0 7px; color: var(--navy); font-size: 22px; }
.receipt-header p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.receipt-header h2 { margin: 16px 0 0; color: var(--ink); font-size: 18px; letter-spacing: .05em; }
.receipt-number { display: flex; justify-content: space-between; gap: 12px; margin: 22px 0; font-size: 12px; }
.receipt-number strong { color: var(--navy); }
.receipt-grid { display: grid; grid-template-columns: 112px 1fr; margin: 0; border-top: 1px solid var(--line-strong); }
.receipt-grid dt, .receipt-grid dd { margin: 0; padding: 11px; border-bottom: 1px solid var(--line-strong); }
.receipt-grid dt { color: var(--muted); background: #fff7fa; font-size: 12px; }
.receipt-grid dd { font-size: 13px; overflow-wrap: anywhere; }
.receipt-grid .receipt-amount { color: var(--navy); font-size: 20px; font-weight: 800; }
.receipt-paid-message, .paid-message { color: var(--navy); font-size: 16px; font-weight: 900; }
.receipt-partial-message { color: #7b4a00; font-weight: 800; background: #fff8e8; }
.final-payment-list { display: grid; gap: 8px; }
.final-payment-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.final-payment-row span { min-width: 0; }
.final-payment-row strong { display: block; color: var(--ink); }
.final-payment-row small { display: block; margin-top: 3px; color: var(--muted); line-height: 1.35; }
.final-payment-row b { flex: 0 0 auto; color: var(--navy); white-space: nowrap; }
.final-payment-total { display: flex; justify-content: space-between; gap: 12px; padding-top: 4px; color: var(--navy); font-size: 15px; }
.final-receipt-note { margin: 14px 0 0; padding: 10px 12px; color: #5c6570; border: 1px dashed var(--line-strong); background: #fafafa; font-size: 11px; line-height: 1.5; text-align: center; }
.receipt-course-list { display: grid; gap: 9px; }
.receipt-course-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.receipt-course-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.receipt-course-row b { color: var(--navy); white-space: nowrap; }
.receipt-course-total { display: flex; justify-content: space-between; gap: 12px; padding-top: 8px; border-top: 2px solid var(--teal); color: var(--navy); }
.receipt-notice { margin-top: 18px; padding: 12px 14px; border: 1px solid var(--line-strong); background: #fff9fb; break-inside: avoid; }
.receipt-notice h3 { margin: 0 0 8px; color: var(--navy); font-size: 13px; }
.receipt-notice div { font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.receipt-footer { margin-top: 14px; color: var(--muted); font-size: 10px; }
.receipt-actions { position: fixed; z-index: 20; right: 0; bottom: 0; left: 0; display: grid; gap: 8px; width: min(100%, var(--content)); margin: auto; padding: 10px 20px max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.98); }
.receipt-share-note { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.35; text-align: center; }
.receipt-action-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.receipt-action-buttons [data-print-final-receipt] { grid-column: 1 / -1; }

.thermal-page { margin: -24px -20px -112px; padding-bottom: 190px; background: #f8edf2; }
.thermal-print-guide { width: min(calc(100% - 28px), 80mm); margin: 16px auto 8px; padding: 12px 14px; color: #082956; border: 1px solid #e7afc4; border-radius: 10px; background: #fff1f6; font-size: 13px; line-height: 1.5; }
.thermal-screen-label { width: min(calc(100% - 28px), 80mm); margin: 18px auto -8px; color: #6f2948; font-size: 12px; font-weight: 800; }
.thermal-notice-sheet { width: min(calc(100% - 28px), 80mm); margin: 18px auto; padding: 6mm 4mm; color: #000; border: 1px solid #88928f; background: white; box-shadow: var(--shadow); font-family: "Microsoft JhengHei", "Segoe UI", sans-serif; }
.thermal-header { padding-bottom: 4mm; text-align: center; border-bottom: 1.5px dashed #333; }
.thermal-header h1 { margin: 0 0 2mm; color: #111; font-size: 20px; line-height: 1.3; }
.thermal-header p { margin: 0; color: #333; font-size: 14px; font-weight: 700; line-height: 1.5; }
.thermal-header h2 { margin: 3mm 0 0; color: #111; font-size: 24px; line-height: 1.15; letter-spacing: .04em; }
.thermal-header h2 span { font-size: 13px; letter-spacing: .1em; }
.thermal-student-name { margin-top: 3mm; padding: 3mm 2mm; text-align: center; border: 2px solid #000; }
.thermal-student-name span { display: block; margin-bottom: 1mm; font-size: 14px; font-weight: 800; }
.thermal-student-name strong { display: block; font-size: 34px; font-weight: 900; line-height: 1.15; overflow-wrap: anywhere; }
.thermal-meta, .thermal-totals { display: grid; grid-template-columns: 24mm 1fr; margin: 3mm 0 0; font-size: 16px; }
.thermal-meta dt, .thermal-meta dd, .thermal-totals dt, .thermal-totals dd { margin: 0; padding: 1.5mm 0; border-bottom: 1px dotted #888; overflow-wrap: anywhere; }
.thermal-meta dt, .thermal-totals dt { color: #555; }
.thermal-meta dd, .thermal-totals dd { text-align: right; font-weight: 700; }
.thermal-courses { margin-top: 4mm; border-top: 1.5px solid #222; }
.thermal-course { display: grid; grid-template-columns: 1fr auto; gap: 1mm 3mm; padding: 2.5mm 0; border-bottom: 1px dashed #777; }
.thermal-course span, .thermal-course strong, .thermal-course small { display: block; }
.thermal-course span { color: #555; font-size: 14px; font-weight: 700; }
.thermal-course strong { margin-top: .5mm; font-size: 16px; line-height: 1.4; }
.thermal-course b { font-size: 16px; white-space: nowrap; }
.thermal-course small { grid-column: 1 / -1; color: #333; font-size: 14px; font-weight: 700; line-height: 1.5; }
.thermal-totals { margin-top: 3mm; border-top: 2px solid #111; }
.thermal-totals dt, .thermal-totals dd { font-size: 17px; }
.thermal-totals .thermal-balance { font-size: 26px; }
.thermal-remark { margin-top: 3mm; padding: 2.5mm; border: 1px solid #777; }
.thermal-remark h3 { margin: 0 0 1mm; font-size: 16px; }
.thermal-remark p { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.thermal-terms-header { display: grid; gap: 1.5mm; padding-bottom: 3mm; color: #000; text-align: center; border-bottom: 2px solid #000; }
.thermal-terms-header strong { font-size: 18px; line-height: 1.35; }
.thermal-terms-header span { font-size: 14px; font-weight: 800; }
.thermal-terms-header b { font-size: 28px; font-weight: 900; line-height: 1.2; overflow-wrap: anywhere; }
.thermal-terms-header small { font-size: 13px; font-weight: 800; }
.thermal-fee-header .thermal-fee-title { color: #000; font-size: 22px; font-weight: 900; line-height: 1.2; }
.thermal-notice-sheet .receipt-notice { margin-top: 3mm; padding: 2.5mm; border-color: #000; background: white; }
.thermal-notice-sheet .receipt-notice h3 { margin-bottom: 1.5mm; color: #000; font-size: 16px; line-height: 1.15; }
.thermal-notice-sheet .receipt-notice div { color: #000; font-size: 9.5px; font-weight: 700; line-height: 1.35; }
.thermal-parent-notice p { margin: 0 0 .8mm; break-inside: avoid; }
.thermal-parent-notice p:last-child { margin-bottom: 0; }
.thermal-compact-header { gap: .8mm; padding-bottom: 1.5mm; }
.thermal-compact-header strong { font-size: 14px; }
.thermal-compact-header span { font-size: 11px; }
.thermal-compact-header b { font-size: 20px; }
.thermal-paid-message { margin: 3mm 0 0; padding: 2.5mm; text-align: center; border: 2px solid #000; font-size: 18px; font-weight: 900; }
.thermal-footer { margin-top: 3mm; padding-top: 2mm; color: #333; text-align: center; border-top: 1px dashed #777; font-size: 12px; font-weight: 700; }

.bottom-nav {
  position: fixed;
  z-index: 30;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  width: min(100%, var(--content));
  min-height: 78px;
  margin: auto;
  padding: 7px 6px max(7px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.98);
  box-shadow: 0 -8px 24px rgba(8, 41, 86, .06);
  backdrop-filter: blur(16px);
}
.is-editing .bottom-nav { display: none; }
.is-editing .app-header { display: none; }
.nav-item { display: grid; place-items: center; align-content: center; gap: 3px; padding: 4px 2px; color: var(--navy); border: 0; background: transparent; font-size: 12px; }
.nav-item svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.nav-item.is-active { color: var(--teal); font-weight: 800; }
.nav-item.is-active::after { width: 24px; height: 3px; content: ""; border-radius: 2px; background: var(--teal); }

.dialog { width: min(calc(100% - 28px), 560px); max-height: min(88vh, 760px); padding: 0; overflow: hidden; border: 0; border-radius: var(--radius-lg); box-shadow: 0 24px 80px rgba(8, 41, 86, .24); }
.dialog::backdrop { background: rgba(4, 20, 38, .52); backdrop-filter: blur(3px); }
.dialog form { max-height: inherit; display: flex; flex-direction: column; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0; color: var(--navy); font-size: 21px; }
.dialog-body { padding: 18px; overflow: auto; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 13px 18px; border-top: 1px solid var(--line); background: #fff9fb; }

.toast { position: fixed; z-index: 100; right: 18px; bottom: 98px; left: 18px; max-width: 430px; margin: auto; padding: 12px 16px; color: white; text-align: center; border-radius: var(--radius-sm); background: var(--navy-strong); box-shadow: var(--shadow); opacity: 0; transform: translateY(18px); pointer-events: none; transition: .2s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

.lock-screen { position: fixed; z-index: 200; inset: 0; display: grid; place-items: center; padding: 24px; background: #fff3f7; }
.lock-screen[hidden] { display: none; }
.lock-panel { width: min(100%, 390px); padding: 32px; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: var(--shadow); }
.lock-panel h1 { margin: 18px 0 4px; color: var(--navy); font-size: 25px; }
.lock-panel > p { margin: 0 0 22px; color: var(--muted); }
.brand-mark { display: grid; width: 60px; height: 60px; place-items: center; color: white; border-radius: 16px; background: var(--teal); font-size: 22px; font-weight: 850; }

.cloud-gate { position: fixed; z-index: 220; inset: 0; display: grid; place-items: center; padding: 24px; background: #fff3f7; }
.cloud-gate[hidden] { display: none; }
.cloud-panel { width: min(100%, 410px); padding: 32px; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: var(--shadow); }
.cloud-panel h1 { margin: 18px 0 5px; color: var(--navy); font-size: 25px; }
.cloud-panel > p { margin: 0 0 22px; color: var(--muted); }
.cloud-state { color: var(--muted); }
.cloud-state.is-synced { color: var(--green); }
.cloud-state.is-syncing { color: var(--teal); }
.cloud-state.is-error { color: var(--red); }

@media (max-width: 520px) {
  .receipt-page { margin: -24px -14px -112px; }
  .field-row, .detail-grid { grid-template-columns: 1fr; }
  .receipt-action-buttons { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .row-side { align-items: flex-end; flex-direction: column; gap: 5px; }
  .record-row { gap: 11px; }
  .payment-summary-grid { grid-template-columns: 1fr; }
  .payment-report-actions .button { width: 100%; }
  .payment-calendar-section { overflow: visible; border: 0; }
  .payment-calendar-toolbar { position: static; grid-template-columns: 1fr 1fr; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); }
  .payment-calendar-toolbar label { grid-column: 1 / -1; grid-row: 1; }
  .payment-week-range { position: static; width: auto; padding: 12px 2px 8px; text-align: center; }
  .payment-calendar-grid { grid-template-columns: 1fr; min-width: 0; gap: 10px; padding: 0; background: transparent; }
  .payment-calendar-day { min-height: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); }
  .payment-calendar-day > header { display: flex; align-items: center; justify-content: space-between; min-height: 0; }
  .payment-calendar-day > header b { margin-top: 0; font-size: 14px; }
  .payment-calendar-card-top strong { font-size: 16px; }
  .payment-calendar-card-top b { font-size: 14px; }
  .payment-period-line strong { font-size: 13px; }
  .payment-period-line span { font-size: 12px; }
  .home-payment-summary-grid { grid-template-columns: 1fr 1fr; }
  .payment-summary-grid { grid-template-columns: 1fr 1fr; }
  .monthly-total-heading { display: grid; }
  .monthly-total-heading small { text-align: left; }
  .monthly-total-row b { font-size: 16px; }
}

@media (min-width: 900px) {
  body { padding: 18px 0; }
  .app-shell { min-height: calc(100vh - 36px); border-radius: 20px; overflow: hidden; }
  .bottom-nav { bottom: 18px; border-radius: 0 0 20px 20px; }
  .sticky-save { bottom: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

@media print {
  @page { size: A4; margin: 14mm; }
  .app-header, .bottom-nav, .sticky-save, .toast, .no-print { display: none !important; }
  body, .app-shell, main, .receipt-page, .thermal-page { width: auto; min-height: 0; margin: 0; padding: 0; background: white; box-shadow: none; }
  .receipt-sheet { width: 100%; min-height: 267mm; margin: 0; padding: 8mm; border: 1px solid #9aa7ad; box-shadow: none; }
  .receipt-header { padding-bottom: 4mm; }
  .receipt-header h1 { font-size: 18px; }
  .receipt-header h2 { margin-top: 3mm; font-size: 15px; }
  .receipt-number { margin: 4mm 0; }
  .receipt-grid dt, .receipt-grid dd { padding: 2mm 2.5mm; }
  .receipt-notice { margin-top: 3mm; padding: 3mm; }
  .receipt-notice h3 { margin-bottom: 1.5mm; font-size: 9pt; }
  .receipt-notice div { font-size: 7.5pt; line-height: 1.28; }
  .receipt-footer { margin-top: 3mm; font-size: 8pt; }
  body.is-thermal-print, body.is-thermal-print .app-shell, body.is-thermal-print main, body.is-thermal-print .thermal-page { width: 72mm; min-width: 72mm; max-width: 72mm; margin: 0; color: #000; }
  body.is-thermal-print * { color: #000 !important; border-color: #000 !important; text-shadow: none !important; box-shadow: none !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .thermal-notice-sheet { width: 72mm; max-width: 72mm; min-height: 202mm; margin: 0; padding: 0; border: 0; box-shadow: none; background: #fff; }
  .thermal-page-one { break-after: page; page-break-after: always; }
  .thermal-terms-sheet { break-after: auto; page-break-after: auto; }
  .thermal-break-after { break-after: page; page-break-after: always; }
  .thermal-header h1 { font-size: 16pt; }
  .thermal-header p { font-size: 10.5pt; font-weight: 700; line-height: 1.45; }
  .thermal-header h2 { font-size: 20pt; }
  .thermal-header h2 span { font-size: 11pt; }
  .thermal-student-name { padding: 3mm 2mm; border-width: 2px; }
  .thermal-student-name span { font-size: 12pt; }
  .thermal-student-name strong { font-size: 26pt; font-weight: 900; line-height: 1.1; }
  .thermal-meta, .thermal-totals { font-size: 12pt; }
  .thermal-meta dt, .thermal-meta dd, .thermal-totals dt, .thermal-totals dd { border-bottom-width: 1px; }
  .thermal-course span { font-size: 11pt; }
  .thermal-course strong, .thermal-course b { font-size: 12pt; }
  .thermal-course small { font-size: 11pt; line-height: 1.45; }
  .thermal-totals dt, .thermal-totals dd { font-size: 13pt; }
  .thermal-totals .thermal-balance { font-size: 20pt; }
  .thermal-remark h3 { font-size: 12pt; }
  .thermal-remark p { font-size: 12pt; line-height: 1.45; }
  .thermal-terms-header strong { font-size: 14pt; }
  .thermal-terms-header span { font-size: 10.5pt; }
  .thermal-terms-header b { font-size: 20pt; font-weight: 900; }
  .thermal-terms-header small { font-size: 9.5pt; }
  .thermal-fee-header .thermal-fee-title { font-size: 18pt; }
  .thermal-notice-sheet .receipt-notice { break-inside: auto; padding: 3mm; border-width: 1.5px; }
  .thermal-notice-sheet .receipt-notice h3 { margin-bottom: 1.2mm; font-size: 12pt; line-height: 1.1; }
  .thermal-notice-sheet .receipt-notice div { font-size: 7pt; font-weight: 700; line-height: 1.32; }
  .thermal-parent-notice p { margin: 0 0 .7mm; break-inside: avoid; page-break-inside: avoid; }
  .thermal-compact-header { gap: .7mm; padding-bottom: 1.2mm; }
  .thermal-compact-header strong { font-size: 10.5pt; }
  .thermal-compact-header span { font-size: 8pt; }
  .thermal-compact-header b { font-size: 15pt; }
  .thermal-paid-message { font-size: 14pt; }
  .thermal-footer { font-size: 10pt; }
}


.student-delete-panel { margin-top: 14px; padding: 14px; border: 1px solid #f1b4af; border-radius: 14px; background: var(--red-soft); display: grid; gap: 8px; }
.student-delete-panel strong { color: var(--red); }
.student-delete-panel span { color: var(--muted); font-size: 13px; line-height: 1.55; }
.student-delete-panel .button { justify-self: start; }


/* v1.17.0 — 日程、報到及學生出席紀錄 */
.schedule-toolbar { display: grid; grid-template-columns: auto minmax(180px, 1fr) auto auto; gap: 10px; align-items: end; margin-bottom: 16px; }
.schedule-toolbar label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 800; }
.schedule-toolbar input { min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: white; color: var(--navy); font: inherit; }
.schedule-summary-grid { grid-template-columns: repeat(6, 1fr); margin-bottom: 18px; }
.schedule-summary-grid .summary-item { min-width: 0; }
.schedule-calendar-section { margin-bottom: 20px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: white; }
.schedule-calendar-heading { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fff9fb; }
.schedule-calendar-heading h2 { margin: 0; text-align: center; color: var(--navy); font-size: 18px; }
.schedule-calendar-weekdays, .schedule-calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.schedule-calendar-weekdays span { padding: 8px 2px; color: var(--muted); text-align: center; font-size: 12px; font-weight: 800; border-bottom: 1px solid var(--line); }
.schedule-calendar-day { min-height: 66px; display: grid; place-items: center; align-content: center; gap: 3px; padding: 7px 2px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: white; color: var(--navy); }
.schedule-calendar-day:nth-child(7n) { border-right: 0; }
.schedule-calendar-day b { font-size: 15px; }
.schedule-calendar-day span { color: var(--teal); font-size: 11px; font-weight: 900; }
.schedule-calendar-day small { color: #b9c1c7; font-size: 11px; }
.schedule-calendar-day.is-today b { display: grid; width: 28px; height: 28px; place-items: center; color: white; border-radius: 50%; background: var(--teal); }
.schedule-calendar-day.is-selected { background: #fff0f5; box-shadow: inset 0 0 0 2px rgba(194,24,91,.18); }
.schedule-calendar-day.is-empty { background: #fafafa; }
.schedule-session-list { display: grid; gap: 10px; }
.schedule-session-row { display: grid; grid-template-columns: 120px minmax(0,1fr) 116px minmax(190px,auto); gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.schedule-time, .schedule-person, .schedule-status { display: grid; gap: 4px; }
.schedule-time strong { color: var(--navy); font-size: 16px; }
.schedule-time span, .schedule-person span, .schedule-status small { color: var(--muted); font-size: 12px; }
.schedule-person > button { justify-self: start; padding: 0; border: 0; background: transparent; color: var(--navy); text-align: left; font: inherit; }
.schedule-person > button strong { font-size: 16px; }
.schedule-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.attendance-status { display: inline-flex; width: max-content; align-items: center; justify-content: center; padding: 5px 8px; border-radius: 999px; font-size: 12px; font-weight: 900; }
.attendance-pending { color: #5d6670; background: #eef1f3; }
.attendance-present { color: #166534; background: #dcfce7; }
.attendance-leave { color: #1d4ed8; background: #dbeafe; }
.attendance-absent { color: #b42318; background: #fee4e2; }
.attendance-makeup { color: #6d28d9; background: #ede9fe; }
.schedule-makeup-link { margin-top: 5px; padding: 7px 9px; border-radius: 10px; background: #f7f4ff; color: #5b21b6; font-size: 12px; line-height: 1.45; }
.schedule-makeup-link button { margin-left: 7px; padding: 0; border: 0; background: transparent; color: var(--teal); font-weight: 800; text-decoration: underline; }
.student-record-row { padding: 8px 10px 8px 0; }
.student-row-main { min-width: 0; flex: 1; display: flex; align-items: center; gap: 12px; padding: 7px 10px; border: 0; background: transparent; color: inherit; text-align: left; }
.student-attendance-summary { grid-template-columns: repeat(6, 1fr); margin-bottom: 18px; }
.student-history-list { display: grid; gap: 8px; }
.student-history-row { display: grid; grid-template-columns: 150px minmax(0,1fr) auto; gap: 12px; align-items: start; padding: 13px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: white; }
.student-history-row > div { display: grid; gap: 3px; }
.student-history-row strong { color: var(--navy); }
.student-history-row span { color: var(--muted); font-size: 12px; }
.student-history-makeup { margin-top: 5px; padding: 6px 8px; border-radius: 8px; background: #f7f4ff; color: #5b21b6; font-size: 12px; }
.student-history-makeup.is-warning { background: #fff4e5; color: #9a6700; }

@media (max-width: 720px) {
  .bottom-nav { min-height: 76px; padding-left: 2px; padding-right: 2px; }
  .nav-item { font-size: 10.5px; }
  .nav-item svg { width: 21px; height: 21px; }
  .schedule-toolbar { grid-template-columns: 1fr 1fr; }
  .schedule-toolbar label { grid-column: 1 / -1; grid-row: 1; }
  .schedule-toolbar [data-schedule-today] { grid-column: 1 / -1; }
  .schedule-summary-grid, .student-attendance-summary { grid-template-columns: repeat(3, 1fr); }
  .schedule-session-row { grid-template-columns: 90px minmax(0,1fr); }
  .schedule-status { justify-self: start; }
  .schedule-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .student-history-row { grid-template-columns: 105px minmax(0,1fr); }
  .student-history-row > .attendance-status { grid-column: 2; justify-self: start; }
}

@media (max-width: 420px) {
  .schedule-summary-grid, .student-attendance-summary { grid-template-columns: repeat(2, 1fr); }
  .schedule-calendar-day { min-height: 58px; }
  .schedule-calendar-day span { font-size: 10px; }
}

/* v1.18.0 — 快速週期排堂及課程分鐘自動同步 */
.quick-schedule-box { margin: 18px 0; padding: 16px; border: 2px solid #b7e0de; border-radius: var(--radius); background: #f4fbfb; }
.quick-schedule-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.quick-schedule-heading strong, .quick-schedule-heading span { display: block; }
.quick-schedule-heading strong { color: var(--navy); font-size: 18px; }
.quick-schedule-heading span { margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.schedule-shortcuts { display: flex; flex-wrap: wrap; gap: 7px; margin: -2px 0 12px; }
.weekday-picker { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; margin: 0 0 13px; }
.weekday-toggle { min-height: 58px; padding: 7px 2px; color: var(--navy); border: 1px solid var(--line-strong); border-radius: 12px; background: white; font: inherit; cursor: pointer; }
.weekday-toggle span, .weekday-toggle strong { display: block; }
.weekday-toggle span { color: var(--muted); font-size: 9px; font-weight: 700; }
.weekday-toggle strong { margin-top: 2px; font-size: 18px; }
.weekday-toggle.is-selected { color: white; border-color: var(--teal); background: var(--teal); box-shadow: 0 4px 12px rgba(21, 117, 114, .16); }
.weekday-toggle.is-selected span { color: rgba(255,255,255,.82); }
.quick-schedule-summary { margin: 10px 0 14px; color: var(--teal-dark); font-size: 13px; font-weight: 800; line-height: 1.45; }
.quick-schedule-box .inline-note { margin-bottom: 0; }
.advanced-schedule { margin: 12px 0 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: white; }
.advanced-schedule summary { padding: 13px 14px; color: var(--navy); font-size: 13px; font-weight: 800; cursor: pointer; }
.advanced-schedule-body { padding: 3px 14px 14px; border-top: 1px solid var(--line); }
.duration-follow { display: flex; align-items: center; gap: 9px; margin: -2px 0 12px; padding: 11px 12px; border: 1px solid #b7e0de; border-radius: var(--radius-sm); background: #f4fbfb; color: var(--navy); font-size: 13px; font-weight: 750; }
.duration-follow input { width: 20px; min-height: 20px; height: 20px; flex: 0 0 20px; accent-color: var(--teal); }
.duration-follow strong { color: var(--teal-dark); }
.date-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.date-actions .button { flex: 1 1 180px; }

@media (max-width: 560px) {
  .quick-schedule-box { margin-left: -4px; margin-right: -4px; padding: 13px; }
  .weekday-picker { gap: 5px; }
  .weekday-toggle { min-height: 54px; border-radius: 10px; }
  .weekday-toggle span { font-size: 8px; }
  .weekday-toggle strong { font-size: 17px; }
  .schedule-shortcuts .button { flex: 1 1 calc(50% - 7px); }
}

/* v1.19.0 — 下月預開學費單 */
.status-draft { color: #6d28d9; background: #f3e8ff; }
.hero-action-group { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 24px; }
.hero-action-group .hero-action { min-height: 68px; margin: 0; font-size: 18px; }
.hero-action-secondary { color: var(--teal) !important; border: 2px solid var(--teal) !important; background: white !important; box-shadow: none !important; }
.hero-action-secondary:hover { color: white !important; background: var(--teal) !important; }
.advance-billing-controls { margin-bottom: 16px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: white; }
.advance-billing-controls > .field { max-width: 320px; margin-bottom: 14px; }
.advance-billing-summary { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; margin: 10px 0 14px; }
.advance-billing-summary > div { display: grid; gap: 3px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff9fb; }
.advance-billing-summary span { color: var(--muted); font-size: 11px; font-weight: 750; }
.advance-billing-summary strong { color: var(--navy); font-size: 21px; }
.advance-billing-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.advance-billing-list { display: grid; gap: 9px; padding-bottom: 12px; }
.advance-billing-row { display: grid; grid-template-columns: 26px minmax(0,1fr) auto; gap: 11px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: white; cursor: pointer; }
.advance-billing-row input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--teal); }
.advance-billing-row.has-warning { border-color: #f0c36a; background: #fffaf0; }
.advance-billing-row.is-existing { opacity: .72; background: #f7faf8; cursor: default; }
.advance-billing-row.is-blocked { background: #fff7f7; cursor: default; }
.advance-billing-main { min-width: 0; display: grid; gap: 4px; }
.advance-billing-main strong { color: var(--navy); font-size: 16px; }
.advance-billing-main small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.advance-warning, .advance-ok { display: block; margin-top: 4px; font-size: 11px; font-weight: 800; line-height: 1.45; }
.advance-warning { color: #9a6700; }
.advance-ok { color: #166534; }
.advance-billing-footnote { margin: 8px 0 86px; padding: 13px 14px; color: #68400a; border: 1px solid #f2cf96; border-radius: var(--radius-sm); background: #fff9ed; font-size: 12px; line-height: 1.55; }
.advance-draft-banner { display: grid; gap: 4px; margin: 18px 0; padding: 14px 16px; color: #5b21b6; border: 1px solid #d8b4fe; border-radius: var(--radius); background: #faf5ff; }
.advance-draft-banner strong { font-size: 15px; }
.advance-draft-banner span { font-size: 12px; line-height: 1.45; }

@media (max-width: 620px) {
  .hero-action-group { grid-template-columns: 1fr; }
  .hero-action-group .hero-action { min-height: 60px; }
  .advance-billing-summary { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .advance-billing-actions .button { flex: 1 1 calc(50% - 8px); }
  .advance-billing-row { grid-template-columns: 24px minmax(0,1fr); }
  .advance-billing-row > .status { grid-column: 2; justify-self: start; }
}

/* v1.20.1 — Multi-user, branding, reminders and management reports */
.wordmark-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.app-brand-copy { min-width: 0; }
.app-brand-logo { width: 38px; height: 38px; object-fit: contain; flex: 0 0 auto; border-radius: 8px; background: white; }
.brand-mark.has-custom-logo { overflow: hidden; padding: 6px; background: white; border: 1px solid var(--line); }
.brand-mark.has-custom-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.document-logo { display: block; width: min(130px, 38vw); max-height: 74px; margin: 0 auto 10px; object-fit: contain; }
.thermal-logo { display: block; width: 92px; max-height: 60px; margin: 0 auto 7px; object-fit: contain; }

.payment-instructions { margin: 16px 0; padding: 14px 16px; border: 1px solid #e3bfd0; border-radius: var(--radius); background: #fff7fa; break-inside: avoid; }
.payment-instructions h3 { margin: 0 0 8px; color: var(--navy); font-size: 15px; }
.payment-instructions p { margin: 4px 0; color: var(--ink); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }

.settings-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.settings-section-heading h2 { margin-bottom: 4px; }
.settings-subheading { display: grid; gap: 4px; margin: 22px 0 12px; padding-top: 18px; border-top: 1px solid var(--line); }
.settings-subheading strong { color: var(--navy); font-size: 16px; }
.settings-subheading span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.brand-settings-panel { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: center; gap: 18px; margin-bottom: 18px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff9fb; }
.settings-logo-preview, .settings-logo-placeholder { width: 120px; height: 90px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.settings-logo-preview { display: block; padding: 8px; object-fit: contain; }
.settings-logo-placeholder { display: grid; place-items: center; color: var(--muted); font-size: 12px; text-align: center; }
.brand-settings-panel strong { display: block; margin-bottom: 4px; color: var(--navy); }
.account-summary { padding: 15px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff9fb; }
.account-summary p { margin: 4px 0; }
.compact-field { min-width: min(260px, 100%); margin: 0; }

.reminder-list { display: grid; gap: 12px; margin-top: 16px; }
.reminder-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 5px 16px rgba(8, 41, 86, .04); }
.reminder-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 15px 16px 10px; }
.reminder-card-top strong, .reminder-card-top span { display: block; }
.reminder-card-top strong { color: var(--navy); font-size: 17px; }
.reminder-card-top span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.reminder-card-top b { color: var(--teal-dark); font-size: 17px; white-space: nowrap; }
.reminder-card-meta { display: grid; gap: 4px; padding: 0 16px 12px; color: var(--muted); font-size: 12px; }
.reminder-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: #fff9fb; }
.filter-button.button-primary { color: white; border-color: var(--teal); background: var(--teal); }

.management-summary-grid { grid-template-columns: repeat(4, 1fr); }
.management-attendance-bar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.management-attendance-bar span { padding: 11px 10px; color: var(--navy); text-align: center; border: 1px solid var(--line); border-radius: 10px; background: #fff9fb; font-size: 12px; font-weight: 750; }

.staff-list { display: grid; gap: 10px; }
.staff-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 15px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.staff-row strong, .staff-row span, .staff-row small { display: block; }
.staff-row strong { color: var(--navy); font-size: 16px; }
.staff-row span { margin-top: 2px; color: var(--ink); font-size: 13px; }
.staff-row small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.staff-row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.audit-list { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.audit-row { display: grid; grid-template-columns: 132px 140px minmax(0, 1fr); gap: 10px; align-items: start; padding: 11px 13px; border-bottom: 1px solid var(--line); font-size: 12px; }
.audit-row:last-child { border-bottom: 0; }
.audit-row span { color: var(--muted); }
.audit-row strong { color: var(--navy); }
.audit-row b { color: var(--ink); font-weight: 650; }

@media (max-width: 680px) {
  .management-summary-grid { grid-template-columns: 1fr 1fr; }
  .management-attendance-bar { grid-template-columns: 1fr 1fr; }
  .brand-settings-panel { grid-template-columns: 1fr; }
  .settings-logo-preview, .settings-logo-placeholder { width: 100%; max-width: 180px; }
  .staff-row { grid-template-columns: 1fr; }
  .staff-row-actions { justify-content: flex-start; }
  .audit-row { grid-template-columns: 92px minmax(0, 1fr); }
  .audit-row b { grid-column: 1 / -1; }
}

@media (max-width: 420px) {
  .app-brand-logo { width: 32px; height: 32px; }
  .wordmark { font-size: 19px; }
  .reminder-card-top { display: grid; }
  .reminder-card-top b { font-size: 16px; }
  .reminder-actions .button { flex: 1 1 100%; }
  .management-summary-grid { grid-template-columns: 1fr 1fr; }
}


/* v1.20.1 — billed lessons are separate from attendance dates */
.billed-lessons-box{display:grid;grid-template-columns:minmax(140px,.7fr) minmax(0,1.3fr);gap:12px;align-items:end;padding:14px;margin:12px 0;border:1px solid var(--border);border-radius:16px;background:var(--surface-soft,#fff7fa)}
.billed-lessons-box .field{margin:0}.billed-lessons-help{display:flex;flex-direction:column;gap:4px;padding-bottom:8px}.billed-lessons-help strong{font-size:15px}.billed-lessons-help span{font-size:13px;line-height:1.45;color:var(--muted)}
.lesson-distribution-tools{margin:6px 0 14px}.lesson-distribution-tools .inline-note{margin:0 0 8px}
@media (max-width:560px){.billed-lessons-box{grid-template-columns:1fr}.billed-lessons-help{padding-bottom:0}}

/* v1.20.2 學費追蹤表 */
.student-tuition-summary { grid-template-columns: repeat(4, 1fr); }
.student-next-payment { font-size: 15px !important; line-height: 1.35; }
.tuition-history-list { display: grid; gap: 9px; }
.tuition-history-row { display: grid; grid-template-columns: minmax(0,1fr) 150px auto; gap: 14px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.tuition-history-main { min-width: 0; display: grid; gap: 5px; }
.tuition-history-main > button { width: fit-content; padding: 0; border: 0; background: none; color: var(--navy); text-align: left; cursor: pointer; }
.tuition-history-main > span { color: var(--muted); font-size: 12px; }
.tuition-history-money { display: grid; gap: 3px; text-align: right; }
.tuition-history-money strong { color: var(--navy); font-size: 16px; }
.tuition-history-money span, .tuition-history-money small { color: var(--muted); font-size: 12px; }
.tuition-date-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.tuition-date-chip, .tuition-date-more { display: inline-flex; align-items: center; padding: 3px 7px; border-radius: 999px; background: #f7f4ff; color: #5b21b6; font-size: 11px; white-space: nowrap; }
.tuition-date-more { background: #f2f2f2; color: var(--muted); }
.tuition-tracker-summary { grid-template-columns: repeat(3, 1fr); }
.tuition-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.tuition-tracker-table { width: 100%; min-width: 1080px; border-collapse: collapse; background: #fff; font-size: 13px; }
.tuition-tracker-table th, .tuition-tracker-table td { padding: 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.tuition-tracker-table th { position: sticky; top: 0; z-index: 1; background: #fff4f8; color: var(--navy); font-size: 12px; }
.tuition-tracker-table tbody tr:last-child td { border-bottom: 0; }
.tuition-student-cell { min-width: 150px; }
.tuition-student-cell > button { display: block; padding: 0; border: 0; background: none; color: var(--navy); cursor: pointer; text-align: left; }
.tuition-student-cell small { display: block; margin-top: 4px; color: var(--muted); }
.tuition-latest-paid { min-width: 300px; }
.tuition-latest-paid > strong, .tuition-latest-paid > small { display: block; }
.tuition-latest-paid > small { margin-top: 3px; color: var(--muted); }
.tuition-next-link { display: grid; gap: 3px; padding: 0; border: 0; background: none; text-align: left; color: #9a3412; cursor: pointer; }
.tuition-next-link small { color: var(--muted); }
.tuition-next-text { max-width: 230px; line-height: 1.4; }
.tuition-next-ok { color: #166534; }
.tuition-next-alert { color: #b91c1c; }
.tuition-next-due { color: #9a3412; }

@media (max-width: 760px) {
  .student-tuition-summary { grid-template-columns: 1fr 1fr; }
  .tuition-history-row { grid-template-columns: minmax(0,1fr) auto; }
  .tuition-history-money { grid-column: 1; text-align: left; }
  .tuition-history-row > .status { grid-column: 2; grid-row: 1; }
  .tuition-tracker-summary { grid-template-columns: 1fr 1fr; }
  .tuition-table-wrap { margin-left: -4px; margin-right: -4px; }
}

/* v1.20.3 月費繳費矩陣 */
.tuition-matrix-summary { grid-template-columns: repeat(4, 1fr); }
.matrix-controls { display: grid; grid-template-columns: 170px minmax(320px, 1fr) minmax(220px, 320px); gap: 14px; align-items: end; margin-bottom: 12px; }
.matrix-control-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.matrix-weekday-group { flex-wrap: wrap; gap: 6px; }
.matrix-weekday { min-width: 42px; }
.matrix-search-field .search { width: 100%; }
.matrix-legend { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin: 8px 0 12px; color: var(--muted); font-size: 12px; }
.matrix-legend span { display: inline-flex; align-items: center; gap: 6px; }
.matrix-legend i { width: 14px; height: 14px; border: 1px solid #d4d4d4; border-radius: 3px; }
.legend-paid { background: #c6efce; }
.legend-partial { background: #ffeb9c; }
.legend-overdue { background: #ffc7ce; }
.legend-pending { background: #fff; }
.legend-none { background: #e7e6e6; }
.tuition-matrix-wrap { overflow: auto; max-height: min(68vh, 720px); border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overscroll-behavior: contain; }
.tuition-matrix-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; font-size: 12px; }
.tuition-matrix-table th, .tuition-matrix-table td { min-width: 74px; height: 48px; padding: 7px 8px; border-right: 1px solid #dedede; border-bottom: 1px solid #dedede; text-align: center; vertical-align: middle; }
.tuition-matrix-table thead th { position: sticky; top: 0; z-index: 4; background: #fff4f8; color: var(--navy); font-weight: 800; white-space: nowrap; }
.tuition-matrix-table th:last-child, .tuition-matrix-table td:last-child { border-right: 0; }
.matrix-student-head, .matrix-student { position: sticky; left: 0; z-index: 3; min-width: 180px !important; width: 180px; max-width: 180px; text-align: left !important; }
.matrix-student-head { z-index: 6 !important; background: #fff4f8 !important; }
.matrix-student { background: #fff; }
.matrix-student button { display: block; width: 100%; padding: 0; border: 0; background: none; color: var(--navy); text-align: left; cursor: pointer; }
.matrix-student small { display: block; margin-top: 3px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.matrix-date-head strong, .matrix-date-head small { display: block; }
.matrix-date-head small { margin-top: 2px; color: var(--muted); font-weight: 500; }
.matrix-cell { font-weight: 800; }
.matrix-cell span { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; min-height: 28px; }
.matrix-paid { background: #c6efce; color: #166534; }
.matrix-partial { background: #ffeb9c; color: #854d0e; }
.matrix-overdue { background: #ffc7ce; color: #991b1b; }
.matrix-pending { background: #fff; color: #6b7280; }
.matrix-none { background: #e7e6e6; color: #9ca3af; font-weight: 500; }
.matrix-tail { min-width: 130px !important; background: #fff; text-align: left !important; white-space: nowrap; }
.matrix-next { min-width: 210px !important; white-space: normal; line-height: 1.35; }
.tuition-matrix-row:hover .matrix-student, .tuition-matrix-row:hover .matrix-tail { background: #fffafc; }

@media (max-width: 760px) {
  .tuition-matrix-summary { grid-template-columns: 1fr 1fr; }
  .matrix-controls { grid-template-columns: 1fr; gap: 9px; }
  .matrix-weekday-group { display: grid; grid-template-columns: repeat(4, 1fr); }
  .matrix-weekday { min-width: 0; width: 100%; }
  .tuition-matrix-wrap { margin-left: -4px; margin-right: -4px; max-height: 66vh; border-radius: 10px; }
  .matrix-student-head, .matrix-student { min-width: 142px !important; width: 142px; max-width: 142px; }
  .tuition-matrix-table th, .tuition-matrix-table td { min-width: 68px; padding: 6px; }
  .matrix-tail { min-width: 112px !important; }
  .matrix-next { min-width: 180px !important; }
}

/* v1.20.4 weekday/monthly worksheet selector */
.matrix-sheet-selector{min-width:0;flex:1}.matrix-sheet-tabs{display:flex;gap:8px;overflow-x:auto;padding:2px 0 6px;scrollbar-width:thin}.matrix-sheet-tabs .button{flex:0 0 auto;white-space:nowrap}.monthly-period-table td,.monthly-period-table th{vertical-align:middle}.monthly-period-table td:nth-child(3){min-width:220px}.monthly-period-table .matrix-student{min-width:160px}
@media (max-width:720px){.matrix-sheet-selector{width:100%}.matrix-sheet-tabs{width:100%;padding-bottom:8px}.monthly-period-table{min-width:1050px}}

/* v1.20.5 student invoice history */
.student-invoice-card { border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; overflow: hidden; }
.student-invoice-card + .student-invoice-card { margin-top: 10px; }
.student-invoice-card[open] { box-shadow: 0 8px 24px rgba(31, 43, 68, .06); }
.student-invoice-summary { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr) 145px auto; gap: 14px; align-items: center; padding: 14px; cursor: pointer; }
.student-invoice-summary::-webkit-details-marker { display: none; }
.student-invoice-summary::before { content: '›'; font-size: 24px; color: var(--muted); transform: rotate(0deg); transition: transform .15s ease; align-self: center; }
.student-invoice-card[open] > .student-invoice-summary::before { transform: rotate(90deg); }
.student-invoice-summary { grid-template-columns: 20px minmax(0, 1fr) 145px auto; }
.student-invoice-summary-main { display: grid; gap: 3px; min-width: 0; }
.student-invoice-summary-main > strong { color: var(--navy); font-size: 15px; }
.student-invoice-summary-main > small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.student-invoice-summary-money { display: grid; gap: 3px; text-align: right; }
.student-invoice-summary-money > strong { color: var(--navy); font-size: 16px; }
.student-invoice-summary-money > small { color: var(--muted); font-size: 12px; }
.student-invoice-content { border-top: 1px solid var(--line); padding: 16px; background: #fbfcfe; display: grid; gap: 14px; }
.student-invoice-content-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.student-invoice-content-heading span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.student-invoice-content-heading h3 { margin: 2px 0 0; color: var(--navy); }
.student-invoice-money-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.student-invoice-money-grid > div { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 10px 12px; display: grid; gap: 4px; }
.student-invoice-money-grid span { color: var(--muted); font-size: 11px; }
.student-invoice-money-grid strong { color: var(--navy); font-size: 15px; }
.student-invoice-courses .invoice-detail-course { background: #fff; }
.student-invoice-remarks { padding: 12px; border-radius: 10px; background: #fff8e8; border: 1px solid #f0dfad; }
.student-invoice-remarks p { margin: 6px 0 0; }
.student-invoice-payments { display: grid; gap: 8px; }
.student-invoice-payments h4 { margin: 0; color: var(--navy); }
.student-invoice-payment { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.student-invoice-payment span { color: var(--muted); font-size: 12px; text-align: right; }
.student-invoice-paid { border-left: 4px solid #3f9b67; }
.student-invoice-partial { border-left: 4px solid #d79a24; }
.student-invoice-unpaid { border-left: 4px solid #cc5555; }
.student-invoice-draft { border-left: 4px solid #8893a6; }
@media (max-width: 640px) {
  .student-invoice-summary { grid-template-columns: 18px minmax(0, 1fr) auto; gap: 8px; }
  .student-invoice-summary-money { grid-column: 2; text-align: left; }
  .student-invoice-summary > .status { grid-column: 3; grid-row: 1; }
  .student-invoice-content-heading { align-items: flex-start; flex-direction: column; }
  .student-invoice-money-grid { grid-template-columns: 1fr 1fr 1fr; }
  .student-invoice-payment { flex-direction: column; }
  .student-invoice-payment span { text-align: left; }
}



/* v1.20.7 — Primary invoice action */
.dashboard-primary-invoice { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:13px; width:100%; margin:0 0 14px; padding:15px 16px; text-align:left; color:#fff; border:0; border-radius:17px; background:linear-gradient(135deg,var(--navy-strong),#174f9e); box-shadow:0 10px 25px rgba(8,41,86,.16); }
.dashboard-primary-invoice:hover { transform:translateY(-1px); box-shadow:0 13px 29px rgba(8,41,86,.20); }
.dashboard-primary-invoice-icon { display:grid; width:43px; height:43px; place-items:center; flex:0 0 auto; border-radius:13px; background:rgba(255,255,255,.16); font-size:28px; font-weight:500; line-height:1; }
.dashboard-primary-invoice-copy { min-width:0; }
.dashboard-primary-invoice-copy strong, .dashboard-primary-invoice-copy small { display:block; }
.dashboard-primary-invoice-copy strong { font-size:19px; line-height:1.2; }
.dashboard-primary-invoice-copy small { margin-top:3px; color:rgba(255,255,255,.78); font-size:11px; line-height:1.35; }
.dashboard-primary-invoice-action { display:flex; align-items:center; gap:5px; white-space:nowrap; color:#fff; font-size:12px; font-weight:850; }
.dashboard-primary-invoice-action span { font-size:22px; line-height:1; }
@media (max-width:480px) {
  .dashboard-primary-invoice { grid-template-columns:auto minmax(0,1fr); gap:11px; padding:14px; border-radius:15px; }
  .dashboard-primary-invoice-icon { width:40px; height:40px; font-size:26px; }
  .dashboard-primary-invoice-copy strong { font-size:18px; }
  .dashboard-primary-invoice-copy small { font-size:10.5px; }
  .dashboard-primary-invoice-action { grid-column:2; margin-top:-2px; font-size:11px; }
}

/* v1.20.6 — Management Dashboard */
@media (min-width: 900px) {
  .is-dashboard .app-shell, .is-dashboard .bottom-nav { width: min(calc(100% - 36px), 980px); }
}
.dashboard-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:18px; }
.dashboard-heading h1 { margin:0; color:var(--navy-strong); font-size:clamp(27px,7vw,36px); line-height:1.12; letter-spacing:-.035em; }
.dashboard-heading p { margin:6px 0 0; color:var(--muted); font-size:13px; }
.dashboard-report-link { padding:8px 0; color:var(--teal); border:0; background:transparent; font-weight:800; white-space:nowrap; }
.dashboard-stats { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin:0 0 16px; }
.dashboard-stat-card { min-width:0; padding:15px; text-align:left; border:1px solid var(--line); border-radius:16px; background:#fff; box-shadow:0 6px 18px rgba(8,41,86,.05); }
.dashboard-stat-card:hover { transform:translateY(-1px); box-shadow:0 9px 22px rgba(8,41,86,.08); }
.dashboard-stat-top { display:flex; align-items:center; gap:8px; min-width:0; }
.dashboard-stat-icon { display:grid; width:31px; height:31px; place-items:center; border-radius:10px; background:#eef5ff; color:#1658ad; flex:0 0 auto; }
.dashboard-stat-icon svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.dashboard-stat-label { min-width:0; color:var(--muted); font-size:12px; font-weight:800; }
.dashboard-stat-card strong { display:block; margin-top:10px; color:var(--navy-strong); font-size:24px; line-height:1.1; letter-spacing:-.025em; overflow-wrap:anywhere; }
.dashboard-stat-card strong em { margin-left:2px; font-size:13px; font-style:normal; font-weight:750; }
.dashboard-stat-card small { display:block; margin-top:6px; color:var(--muted); font-size:10.5px; line-height:1.35; }
.dashboard-tone-orange .dashboard-stat-icon { color:#b65800; background:#fff1df; }
.dashboard-tone-green .dashboard-stat-icon { color:#147a55; background:#e9f8f0; }
.dashboard-tone-money .dashboard-stat-icon { color:#a2134d; background:#fde7f0; }
.dashboard-tone-money strong { color:#147a55; font-size:21px; }
.dashboard-quick-actions { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:9px; margin:0 0 20px; }
.dashboard-quick-actions button { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:7px; min-height:86px; padding:12px 7px; color:var(--navy); border:1px solid var(--line); border-radius:15px; background:#fff; box-shadow:0 5px 16px rgba(8,41,86,.04); }
.dashboard-quick-actions button:hover { border-color:#efb6cb; background:#fff9fb; }
.dashboard-quick-actions button > span { display:grid; width:35px; height:35px; place-items:center; color:var(--teal); border-radius:11px; background:var(--teal-soft); font-size:24px; font-weight:500; }
.dashboard-quick-actions svg { width:19px; height:19px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.dashboard-quick-actions strong { font-size:12px; }
.dashboard-panel { margin-top:18px; overflow:hidden; border:1px solid var(--line); border-radius:18px; background:#fff; box-shadow:0 7px 20px rgba(8,41,86,.045); }
.dashboard-panel-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; padding:15px 16px 12px; border-bottom:1px solid var(--line); }
.dashboard-panel-heading span { display:block; color:var(--teal); font-size:10px; font-weight:850; letter-spacing:.08em; text-transform:uppercase; }
.dashboard-panel-heading h2 { margin:2px 0 0; color:var(--navy); font-size:19px; }
.dashboard-panel-heading button { padding:5px 0; color:var(--teal); border:0; background:transparent; font-size:12px; font-weight:800; }
.dashboard-task-list { display:grid; }
.dashboard-task-row { display:grid; grid-template-columns:auto minmax(0,1fr) auto auto; gap:11px; align-items:center; width:100%; min-height:66px; padding:11px 14px; color:var(--ink); text-align:left; border:0; border-bottom:1px solid var(--line); background:#fff; }
.dashboard-task-row:last-child { border-bottom:0; }
.dashboard-task-row:hover { background:#fff9fb; }
.dashboard-task-icon { display:grid; width:38px; height:38px; place-items:center; border-radius:12px; color:#1658ad; background:#eef5ff; }
.dashboard-task-icon svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.dashboard-task-red { color:#b42318; background:#fef3f2; }
.dashboard-task-orange { color:#b65800; background:#fff1df; }
.dashboard-task-green { color:#147a55; background:#e9f8f0; }
.dashboard-task-count { display:grid; min-width:28px; height:28px; place-items:center; padding:0 8px; border-radius:999px; color:#1658ad; background:#eef5ff; font-size:12px; font-weight:850; }
.dashboard-task-count-red { color:#b42318; background:#fef3f2; }
.dashboard-task-count-orange { color:#b65800; background:#fff1df; }
.dashboard-task-count-green { color:#147a55; background:#e9f8f0; }
.dashboard-record-list { border-top:0; }
.dashboard-record-list .record-row { padding-left:14px; padding-right:14px; }
.dashboard-class-row { grid-template-columns:62px minmax(0,1fr) auto; }
.dashboard-time { color:var(--navy); font-size:14px; font-weight:850; }
.dashboard-more-row { width:100%; padding:12px 15px; color:var(--teal); border:0; border-top:1px solid var(--line); background:#fff9fb; font-size:12px; font-weight:800; }
.dashboard-payment-strip { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:0; border-bottom:1px solid var(--line); background:#fff9fb; }
.dashboard-payment-strip > div { min-width:0; padding:13px 15px; border-right:1px solid var(--line); }
.dashboard-payment-strip > div:last-child { border-right:0; }
.dashboard-payment-strip span, .dashboard-payment-strip strong, .dashboard-payment-strip small { display:block; }
.dashboard-payment-strip span { color:var(--muted); font-size:10.5px; font-weight:750; }
.dashboard-payment-strip strong { margin-top:3px; color:var(--navy); font-size:16px; overflow-wrap:anywhere; }
.dashboard-payment-strip small { margin-top:2px; color:var(--muted); font-size:9.5px; }
@media (max-width:760px) {
  .dashboard-stats { grid-template-columns:1fr 1fr; }
  .dashboard-stat-card { min-height:126px; }
}
@media (max-width:480px) {
  main { padding-left:14px; padding-right:14px; }
  .dashboard-heading { margin-bottom:14px; }
  .dashboard-heading h1 { font-size:28px; }
  .dashboard-stats { gap:8px; }
  .dashboard-stat-card { min-height:118px; padding:13px; border-radius:15px; }
  .dashboard-stat-card strong { font-size:22px; }
  .dashboard-tone-money strong { font-size:18px; }
  .dashboard-stat-label { font-size:11px; }
  .dashboard-quick-actions { gap:7px; }
  .dashboard-quick-actions button { min-height:80px; padding:10px 4px; }
  .dashboard-quick-actions strong { font-size:11px; }
  .dashboard-task-row { grid-template-columns:auto minmax(0,1fr) auto; }
  .dashboard-task-row .chevron { display:none; }
  .dashboard-payment-strip { grid-template-columns:1fr; }
  .dashboard-payment-strip > div { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:4px 12px; align-items:center; border-right:0; border-bottom:1px solid var(--line); }
  .dashboard-payment-strip > div:last-child { border-bottom:0; }
  .dashboard-payment-strip strong { grid-row:1 / 3; grid-column:2; margin:0; text-align:right; }
  .dashboard-class-row { grid-template-columns:54px minmax(0,1fr) auto; gap:10px; }
}


/* v1.20.8 — customer data portability */
.data-portability-panel {
  border: 1px solid rgba(32, 81, 145, 0.2);
  background: linear-gradient(180deg, rgba(239, 247, 255, 0.72), rgba(255,255,255,0.96));
}
.data-portability-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.data-retention-note {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff8e8;
  border: 1px solid #f2dfae;
  color: #6b541e;
  font-size: 13px;
  line-height: 1.55;
}
@media (max-width: 640px) {
  .data-portability-actions { display: grid; grid-template-columns: 1fr; }
  .data-portability-actions .button { width: 100%; justify-content: center; }
}


/* v1.20.10 — Student search quick add */
.student-list-heading .student-add-primary { flex: 0 0 auto; white-space: nowrap; }
.student-search-empty { margin-top: 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: #fffafc; }
.student-search-empty[hidden] { display: none !important; }
.student-search-empty .button { margin-top: 12px; }
@media (max-width: 640px) {
  .student-list-heading { align-items: stretch; }
  .student-list-heading .student-add-primary { width: 100%; min-height: 48px; }
  .student-search-toolbar .search { flex: 1 1 100%; width: 100%; }
  .student-search-toolbar .toolbar-group { width: 100%; }
  .student-search-toolbar .toolbar-group .button { flex: 1 1 calc(50% - 8px); }
}

/* v1.20.12 — renewal comparison + payment details */
.dashboard-advance-billing { width: 100%; display: grid; grid-template-columns: 48px minmax(0,1fr) auto; align-items: center; gap: 12px; margin: -2px 0 16px; padding: 14px 16px; border: 1px solid #bfd8f2; border-radius: var(--radius); background: #f4f9ff; color: var(--navy); text-align: left; cursor: pointer; }
.dashboard-advance-billing:hover { border-color: #8fbbe6; background: #eef7ff; }
.dashboard-advance-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: #e1effc; color: #135e9d; font-size: 24px; font-weight: 900; }
.dashboard-advance-copy { min-width: 0; display: grid; gap: 3px; }
.dashboard-advance-copy strong { font-size: 15px; }
.dashboard-advance-copy small { color: var(--muted); line-height: 1.45; }
.dashboard-advance-action { color: #135e9d; font-size: 13px; font-weight: 850; white-space: nowrap; }
.payment-instructions { border: 1.5px solid #e09ab4; background: #fff8fb; }
.payment-instructions h3 { margin-bottom: 8px; }
.payment-instructions p { margin: 3px 0; line-height: 1.42; }
.payment-instructions p:first-of-type { font-weight: 850; color: var(--navy); }
@media (max-width: 640px) {
  .dashboard-advance-billing { grid-template-columns: 42px minmax(0,1fr); }
  .dashboard-advance-action { grid-column: 2; justify-self: start; }
}

/* v1.20.12 — current-month renewal invoice comparison reminder */
.dashboard-renewal-panel { margin: 0 0 14px; border: 1px solid #efc978; border-radius: var(--radius); background: #fffaf0; overflow: hidden; }
.dashboard-renewal-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid #f2dfb3; }
.dashboard-renewal-heading > div { min-width: 0; display: grid; gap: 3px; }
.dashboard-renewal-heading strong { color: var(--navy); font-size: 15px; }
.dashboard-renewal-heading small { color: var(--muted); line-height: 1.45; }
.dashboard-renewal-heading button, .dashboard-renewal-more { border: 0; background: transparent; color: #9a5a00; font-weight: 850; cursor: pointer; }
.dashboard-renewal-list { display: grid; }
.dashboard-renewal-row { display: grid; grid-template-columns: 150px minmax(0,1fr) 22px; gap: 12px; align-items: center; padding: 12px 16px; border: 0; border-bottom: 1px solid #f5e8c9; background: transparent; text-align: left; cursor: pointer; }
.dashboard-renewal-row:hover { background: #fff5dd; }
.dashboard-renewal-row:last-child { border-bottom: 0; }
.dashboard-renewal-student { color: var(--navy); font-weight: 850; }
.dashboard-renewal-lines { min-width: 0; display: grid; gap: 4px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.dashboard-renewal-lines b { color: #9a5a00; margin-right: 5px; }
.dashboard-renewal-chevron { color: #9a5a00; font-size: 21px; font-weight: 900; }
.dashboard-renewal-more { width: 100%; padding: 11px 16px; text-align: left; border-top: 1px solid #f5e8c9; }
.advance-comparison { display: grid; grid-template-columns: minmax(0,1fr) 24px minmax(0,1fr); gap: 8px; align-items: center; margin-top: 2px; padding: 9px 10px; border-radius: 10px; background: #f7f9fc; }
.advance-comparison > span:not(.advance-comparison-arrow) { display: grid; gap: 3px; min-width: 0; }
.advance-comparison b { color: var(--navy); font-size: 12px; }
.advance-comparison small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.advance-comparison-arrow { color: #5680a8; text-align: center; font-weight: 900; }
@media (max-width: 680px) {
  .dashboard-renewal-heading { align-items: flex-start; flex-direction: column; }
  .dashboard-renewal-row { grid-template-columns: minmax(0,1fr) 20px; gap: 8px; }
  .dashboard-renewal-student { grid-column: 1; }
  .dashboard-renewal-lines { grid-column: 1; }
  .dashboard-renewal-chevron { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .advance-comparison { grid-template-columns: 1fr; }
  .advance-comparison-arrow { transform: rotate(90deg); }
}


/* v1.20.13 — advance billing submit action must stay above bottom navigation */
.is-advance-billing .advance-billing-footnote { margin-bottom: 176px; }
.advance-billing-create-top { margin-left: auto; }
.advance-billing-submit-bar { z-index: 35; bottom: calc(78px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 14px; align-items: center; }
.advance-billing-selected-summary { display: grid; gap: 2px; color: var(--navy); }
.advance-billing-selected-summary span { font-size: 14px; font-weight: 800; }
.advance-billing-selected-summary strong { color: var(--teal); font-size: 18px; }
.advance-billing-selected-summary small { color: var(--muted); font-size: 11px; line-height: 1.35; }
@media (min-width: 900px) { .is-advance-billing .advance-billing-submit-bar { bottom: 96px; } }
@media (max-width: 720px) {
  .advance-billing-create-top { flex: 1 1 100% !important; margin-left: 0; }
  .advance-billing-submit-bar { bottom: calc(76px + env(safe-area-inset-bottom)); grid-template-columns: 1fr; gap: 8px; padding-top: 9px; padding-bottom: 9px; }
  .advance-billing-submit-bar .button { width: 100%; }
  .advance-billing-selected-summary { grid-template-columns: auto 1fr; align-items: center; column-gap: 8px; }
  .advance-billing-selected-summary small { text-align: right; }
}

/* v1.20.15 invoice discounts / prepaid tuition */
.receipt-course-adjustment{display:flex;justify-content:space-between;gap:12px;padding:5px 0;color:#65727f;font-size:.94em}.receipt-course-adjustment strong{white-space:nowrap}.receipt-course-adjustment.is-deduction strong{color:#8a3a00}.invoice-total-panel input[readonly]{font-weight:700}.invoice-total-panel #invoice-amount{font-size:1.25rem;font-weight:900;color:#082956}

/* v1.20.16 — non-lesson charge items */
.material-charge-box {
  border: 1px solid var(--border, #d9dee8);
  border-radius: 14px;
  padding: 14px;
  background: #f8fafc;
}
.material-charge-box p { margin: 6px 0 14px; color: var(--muted, #667085); line-height: 1.55; }
.material-charge-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  color: #344054;
  background: #e9eef7;
}
.invoice-course-item.is-material-item { border-left: 4px solid #667085; }
.invoice-detail-material { background: #f8fafc; }
.material-item-note { color: var(--muted, #667085); font-size: 13px; }
[data-course-lesson-only][hidden] { display: none !important; }

/* v1.20.17 — cash tendered / change calculator */
.cash-payment-panel {
  border: 1px solid var(--line, #d9dde7);
  border-radius: 14px;
  padding: 14px;
  margin: 4px 0 14px;
  background: #f8fafc;
}
.cash-payment-panel[hidden] { display: none !important; }
.cash-payment-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.cash-payment-heading strong { font-size: 1rem; }
.cash-payment-heading span { color: var(--muted, #6b7280); font-size: .82rem; }
.cash-change-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #d8dee9;
  margin: 4px 0 6px;
}
.cash-change-result span { font-weight: 700; }
.cash-change-result strong { font-size: 1.35rem; color: #0f766e; }
.cash-change-result strong.cash-change-short { color: #b42318; }
.receipt-cash-change { font-weight: 900; }
@media (max-width: 520px) {
  .cash-payment-heading { align-items: flex-start; flex-direction: column; gap: 2px; }
  .cash-change-result strong { font-size: 1.2rem; }
}


/* v1.20.18 — quick pay-in-full action */
.payment-quick-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -2px 0 14px;
}
.payment-quick-actions .payment-pay-full {
  flex: 0 0 auto;
  font-weight: 800;
}
.payment-quick-actions small {
  color: var(--muted, #667085);
  line-height: 1.35;
}
@media (max-width: 520px) {
  .payment-quick-actions { align-items: stretch; flex-direction: column; }
  .payment-quick-actions .payment-pay-full { width: 100%; min-height: 48px; font-size: 1rem; }
}
