:root {
  color-scheme: light;
  --ink: #222222;
  --muted: #6f716f;
  --line: #e2e3df;
  --soft-line: #ecece8;
  --paper: #ffffff;
  --canvas: #f7f7f4;
  --cream: #fffaf0;
  --accent: #486b68;
  --accent-soft: #e6f0ee;
  --danger: #9a463f;
  --shadow: 0 1px 2px rgba(25, 27, 25, .04), 0 8px 24px rgba(25, 27, 25, .035);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
[hidden] { display: none !important; }
.shell { width: min(1120px, calc(100% - 28px)); margin-inline: auto; }
.nav { justify-content: space-between !important; }
.nav-links { margin-left: auto; }

.intro { padding: 30px 0 19px; }
.tool-label { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 10px; color: var(--accent); font-size: 12px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.tool-label::before { width: 8px; height: 8px; border-radius: 2px; background: #a6c8bf; content: ""; transform: rotate(8deg); }
h1 { max-width: 780px; margin: 0; font-size: clamp(37px, 7vw, 62px); line-height: .98; letter-spacing: -.055em; }
.intro-copy { max-width: 690px; margin: 15px 0 0; color: #464a47; font-size: clamp(17px, 2.5vw, 20px); line-height: 1.5; }
.intro-note { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.privacy-strip { display: flex; gap: 11px; margin: 19px 0 0; padding: 13px 15px; border: 1px solid #cad9d4; border-radius: 12px; background: #eff6f4; color: #42514d; font-size: 13px; line-height: 1.55; }
.privacy-strip::before { flex: 0 0 9px; width: 9px; height: 9px; margin-top: 5px; border: 2px solid #5c8f86; border-radius: 50%; content: ""; }
.privacy-strip strong { color: var(--ink); }
.privacy-strip small { display: block; margin-top: 2px; }

.ledger-app { padding: 6px 0 52px; }
.summary-card, .editor-card, .courses-panel { border: 1px solid var(--line); border-radius: 16px; background: var(--paper); box-shadow: var(--shadow); }
.summary-card { display: grid; gap: 20px; padding: 19px; }
.summary-total { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; padding-bottom: 17px; border-bottom: 1px solid var(--soft-line); }
.summary-total span, .summary-count span { color: var(--muted); font-size: 12px; font-weight: 750; }
.summary-total strong { display: block; margin-top: 3px; font-size: clamp(35px, 10vw, 48px); letter-spacing: -.055em; line-height: 1; }
.summary-count { text-align: right; }
.summary-count strong { display: block; margin-top: 2px; font-size: 24px; }
.breakdown-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.breakdown-title h2 { margin: 0; font-size: 15px; letter-spacing: -.015em; }
.save-status { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.save-status::before { width: 6px; height: 6px; border-radius: 50%; background: #78a99c; content: ""; }
.breakdown-list { display: grid; gap: 6px; }
.breakdown-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 11px; border-radius: 9px; background: #f7f7f4; }
.breakdown-row div { display: grid; gap: 2px; }
.breakdown-row strong, .breakdown-row b { font-size: 13px; }
.breakdown-row span, .breakdown-empty { color: var(--muted); font-size: 11px; }
.breakdown-empty { margin: 0; padding: 5px 0; line-height: 1.5; }

.workspace { display: grid; gap: 16px; margin-top: 16px; }
.editor-card { align-self: start; padding: 18px; scroll-margin-top: 90px; }
.card-heading { margin-bottom: 17px; }
.card-heading h2 { margin: 0; font-size: 21px; letter-spacing: -.035em; }
.card-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.form-grid { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 12px; font-weight: 800; }
.field small:not(.field-error) { color: var(--muted); font-size: 11px; line-height: 1.45; }
input, select, textarea { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid #d2d4cf; border-radius: 9px; background: #fff; color: var(--ink); outline: 0; }
textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #a0a39e; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { border-color: #7c9e96; outline: 3px solid rgba(95, 143, 132, .18); outline-offset: 1px; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: #b4635b; background: #fff9f8; }
.field-error { min-height: 0; color: var(--danger); font-size: 11px; font-weight: 720; }
.date-grid { display: grid; gap: 12px; }
.money-wrap { position: relative; }
.money-wrap b { position: absolute; top: 50%; left: 12px; translate: 0 -50%; color: #777b77; font-size: 14px; }
.money-wrap input { padding-left: 29px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 17px; }
.button { min-height: 44px; padding: 9px 15px; border: 1px solid #2f3936; border-radius: 9px; background: #2f3936; color: #fff; font-weight: 800; }
.button.secondary { border-color: #d1d3cf; background: #fff; color: var(--ink); }
.status-line { min-height: 20px; margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

.courses-panel { overflow: hidden; }
.courses-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px; border-bottom: 1px solid var(--soft-line); }
.courses-heading h2 { margin: 0; font-size: 21px; letter-spacing: -.035em; }
.courses-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.courses-controls { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.output-button { min-height: 44px; padding: 8px 11px; border: 1px solid #cfd4d0; border-radius: 8px; background: #f7faf8; color: #355b53; font-size: 12px; font-weight: 800; }
.output-button:hover { background: #eef5f2; }
.clear-button { min-height: 44px; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--danger); font-size: 12px; font-weight: 800; }
.output-note { margin: 0; padding: 10px 18px; border-bottom: 1px solid var(--soft-line); background: #fbfbf9; color: var(--muted); font-size: 11px; line-height: 1.5; }
.output-note strong { color: #3d5952; }
.course-list { display: grid; }
.course-card { padding: 17px 18px; border-bottom: 1px solid var(--soft-line); }
.course-card:last-child { border-bottom: 0; }
.course-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.course-card h3 { margin: 7px 0 0; font-size: 18px; line-height: 1.25; letter-spacing: -.025em; overflow-wrap: anywhere; }
.category-badge { display: inline-flex; min-height: 25px; align-items: center; padding: 3px 8px; border-radius: 6px; background: #eef0ec; color: #4d5350; font-size: 10px; font-weight: 850; }
.category-sports { background: #e8f1ec; color: #39614e; }
.category-stem { background: #e8eef7; color: #425d7e; }
.category-arts { background: #f4e9ee; color: #7d4b60; }
.category-language { background: #f3efe2; color: #76643d; }
.category-others { background: #eeeeec; color: #555753; }
.course-fee { flex: 0 0 auto; font-size: 18px; letter-spacing: -.025em; }
.course-dates { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 14px 0 0; font-size: 12px; line-height: 1.5; }
.course-dates dt { color: var(--muted); }
.course-dates dd { margin: 0; font-weight: 700; }
.course-note { margin: 12px 0 0; padding: 10px 11px; border-left: 3px solid #ccd8d4; background: #f7f8f6; color: #555a57; font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.course-actions { display: flex; gap: 5px; margin-top: 12px; }
.course-actions button { min-height: 44px; padding: 9px 12px; border: 1px solid #d9dad6; border-radius: 8px; background: #fff; color: #4f5551; font-size: 11px; font-weight: 800; }
.course-actions .delete-button { color: var(--danger); }
.course-empty { padding: 48px 20px; text-align: center; }
.course-empty strong { font-size: 16px; }
.course-empty p { max-width: 390px; margin: 7px auto 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

.explain { padding: 4px 0 58px; }
.explain-grid { display: grid; gap: 14px; }
.explain article { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: #fbfbf8; }
.explain h2 { margin: 0; font-size: 20px; letter-spacing: -.03em; }
.explain p { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }

.confirm-dialog { width: min(420px, calc(100% - 28px)); padding: 0; border: 1px solid #cfd1cd; border-radius: 14px; background: #fff; color: var(--ink); box-shadow: 0 24px 80px rgba(24, 26, 24, .2); }
.confirm-dialog::backdrop { background: rgba(31, 33, 31, .38); backdrop-filter: blur(2px); }
.confirm-inner { padding: 21px; }
.confirm-inner h2 { margin: 0; font-size: 21px; letter-spacing: -.03em; }
.confirm-inner p { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.confirm-actions button { min-height: 44px; padding: 8px 13px; border: 1px solid #d4d5d2; border-radius: 8px; background: #fff; color: var(--ink); font-weight: 800; }
.confirm-actions .danger-action { border-color: var(--danger); background: var(--danger); color: #fff; }
.print-report { display: none; }

@media (min-width: 660px) {
  .summary-card { grid-template-columns: minmax(250px, .75fr) minmax(0, 1.25fr); align-items: start; padding: 22px; }
  .summary-total { height: 100%; grid-template-columns: 1fr; align-content: space-between; padding: 0 22px 0 0; border-right: 1px solid var(--soft-line); border-bottom: 0; }
  .summary-count { text-align: left; }
  .date-grid { grid-template-columns: repeat(2, 1fr); }
  .date-grid .enrollment-field { grid-column: 1 / -1; }
  .explain-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  .intro { padding-top: 43px; }
  .workspace { grid-template-columns: minmax(340px, 410px) minmax(0, 1fr); align-items: start; gap: 18px; }
  .editor-card { position: sticky; top: 98px; }
  .course-card { padding: 20px 22px; }
}

@media (max-width: 620px) {
  .shell { width: min(100% - 22px, 1120px); }
  .nav-links a:not(.nav-pill) { display: none; }
  .intro { padding-top: 24px; }
  .privacy-strip { padding: 12px; }
  .course-card-top { gap: 9px; }
  .course-fee { font-size: 16px; }
  .course-dates { grid-template-columns: 1fr; gap: 1px; }
  .course-dates dd + dt { margin-top: 6px; }
  .courses-heading { align-items: flex-start; }
  .courses-controls { width: 100%; justify-content: flex-start; }
  .courses-heading { flex-wrap: wrap; }
  .output-button { flex: 1 1 130px; }
  .clear-button { flex: 1 1 100%; text-align: left; }
  .confirm-actions { flex-direction: column-reverse; }
  .confirm-actions button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; transition: none !important; }
}

@page { size: Letter portrait; margin: .52in; }

@media print {
  * { box-shadow: none !important; }
  html, body { width: auto; min-width: 0; margin: 0; background: #fff !important; color: #111 !important; }
  body > .site-header, body > main, body > .confirm-dialog, body > .site-footer { display: none !important; }
  .print-report { display: block !important; font: 9pt/1.35 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
  .print-header { display: grid; grid-template-columns: 1fr auto; gap: 10pt 18pt; align-items: start; padding-bottom: 12pt; border-bottom: 2px solid #222; }
  .print-brand { display: flex; grid-column: 1 / -1; align-items: center; gap: 7pt; font-size: 10pt; }
  .print-brand span { display: grid; width: 22pt; height: 20pt; place-items: center; border: 1.5pt solid #111; border-radius: 48% 52% 46% 54%; background: #f5cf47 !important; color: #111 !important; font-weight: 900; transform: rotate(-4deg); }
  .print-header h1 { margin: 0; font-size: 21pt; line-height: 1.05; letter-spacing: -.03em; }
  .print-header p { margin: 3pt 0 0; color: #555 !important; }
  .print-prepared { text-align: right; white-space: nowrap; }
  .print-privacy { grid-column: 1 / -1; margin: 1pt 0 0 !important; padding: 6pt 8pt; border: 1px solid #b8c8c2; background: #f1f5f3 !important; color: #314b44 !important; font-size: 7.5pt; font-weight: 700; }
  .print-summary { display: grid; grid-template-columns: 1fr 1fr; margin: 14pt 0 16pt; border: 1px solid #bbb; }
  .print-summary > div { padding: 9pt 11pt; }
  .print-summary > div + div { border-left: 1px solid #bbb; }
  .print-summary span { display: block; color: #555 !important; font-size: 8pt; font-weight: 700; }
  .print-summary strong { display: block; margin-top: 2pt; font-size: 18pt; line-height: 1.1; }
  .print-section { margin-top: 15pt; break-inside: auto; }
  .print-section h2 { margin: 0 0 6pt; font-size: 12pt; }
  .print-report table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  .print-report thead { display: table-header-group; }
  .print-report tr { break-inside: avoid; page-break-inside: avoid; }
  .print-report th, .print-report td { padding: 5.5pt 6pt; border: 1px solid #bbb; vertical-align: top; text-align: left; overflow-wrap: anywhere; }
  .print-report th { background: #f0f0ed !important; font-size: 7.5pt; }
  .print-report td:last-child, .print-report th:last-child { text-align: right; }
  .print-course-table th:nth-child(1) { width: 25%; }
  .print-course-table th:nth-child(2) { width: 14%; }
  .print-course-table th:nth-child(3) { width: 21%; }
  .print-course-table th:nth-child(4) { width: 28%; }
  .print-course-table th:nth-child(5) { width: 12%; }
  .print-course-name { display: block; font-weight: 800; }
  .print-course-category { display: block; margin-top: 2pt; color: #555 !important; font-size: 7.5pt; }
  .print-empty { margin: 14pt 0; padding: 10pt; border: 1px solid #bbb; }
  .print-footer { display: flex; justify-content: space-between; gap: 18pt; margin-top: 16pt; padding-top: 7pt; border-top: 1px solid #bbb; color: #555 !important; font-size: 7.5pt; break-inside: avoid; }
  .print-footer p { margin: 0; }
  .print-footer p:first-child { max-width: 70%; }
  .print-footer p:last-child { white-space: nowrap; }
}
