:root {
  --bg: #f4efe6;
  --surface: rgba(255, 252, 246, 0.84);
  --surface-strong: #fffaf1;
  --ink: #1e2430;
  --muted: #5f6570;
  --line: rgba(34, 48, 63, 0.12);
  --green: #2f7d4c;
  --amber: #c07c15;
  --red: #b54c3f;
  --blue: #2f5a88;
  --shadow: 0 18px 40px rgba(44, 41, 35, 0.1);
  --radius-lg: 28px;
  --radius-md: 20px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, rgba(58, 111, 163, 0.16), transparent 28%), radial-gradient(circle at top right, rgba(224, 169, 85, 0.22), transparent 24%), linear-gradient(180deg, #f8f4ec 0%, var(--bg) 42%, #efe6d9 100%);
}
a { color: var(--blue); }
.page-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 40px; }
.hero, .layout, .detail-layout, .main-column, .side-column, .subject-grid, .timetable, .topics-editor, .calendar-grid, .detail-main-column { display: grid; gap: 24px; }
.hero { margin-bottom: 24px; }
.hero-copy, .card, .hero-panel { border: 1px solid var(--line); background: var(--surface); backdrop-filter: blur(14px); box-shadow: var(--shadow); }
.hero-copy, .hero-panel, .card { border-radius: var(--radius-lg); padding: 22px; }
.hero-copy { background: linear-gradient(130deg, rgba(255,255,255,.92), rgba(245,236,214,.82)), var(--surface); padding: 28px; }
.hero h1, .card h2, .detail h3 { margin: 0; font-family: Georgia, "Times New Roman", serif; line-height: 1.02; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 4.1rem); max-width: 11ch; }
.eyebrow, .section-label, .pill { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; }
.hero-text, .section-note, .detail-copy, .info-card p, .subject-meta, .metric-label, .metric-value, .status-copy, .school-line, .legend span, .editor-tag, .completed-list, .calendar-weekdays { color: var(--muted); }
.hero-panel { display: grid; gap: 14px; align-content: start; }
.controls, .detail-header { display: grid; gap: 16px; }
.controls-top, .section-heading, .subject-head, .metric-row, .status-row, .school-line, .topic-editor-head { display: flex; justify-content: space-between; gap: 12px; }
.controls-top { align-items: start; }
.toggle-group, .filter-row, .legend, .topic-flags, .period-list { display: flex; flex-wrap: wrap; gap: 10px; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.filter-button, .schedule-toggle, .back-link { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; padding: 12px 16px; font: inherit; font-weight: 800; cursor: pointer; text-decoration: none; }
.filter-button.active, .schedule-toggle.is-open { background: var(--ink); color: #fff; }
.auth-layout { min-height: calc(100vh - 80px); display: grid; place-items: center; }
.auth-panel { width: min(620px, 100%); }
.auth-primary { display: inline-flex; background: var(--ink); color: #fff; }
.auth-error { color: var(--red); font-weight: 800; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; }
.dot-green { background: var(--green); } .dot-amber { background: var(--amber); } .dot-red { background: var(--red); }
.section-heading { align-items: end; margin-bottom: 16px; }
.section-heading.tight { margin-bottom: 12px; }
.section-heading h2 { font-size: 1.55rem; }
.subject-card, .timetable-day, .calendar-month, .topic-editor-card { border: 1px solid var(--line); border-radius: 24px; padding: 18px; background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(249,241,225,.92)); box-shadow: var(--shadow); }
.subject-card { cursor: pointer; transition: transform 180ms ease, border-color 180ms ease; }
.subject-card:hover { transform: translateY(-3px); border-color: rgba(47,90,136,.3); }
.subject-name { font-weight: 800; font-size: 1.1rem; }
.subject-meta { font-size: .92rem; margin-top: 6px; }
.pill { align-self: start; border-radius: 999px; padding: 8px 10px; }
.pill.green { color: var(--green); background: rgba(47,125,76,.14); } .pill.amber { color: var(--amber); background: rgba(192,124,21,.14); } .pill.red { color: var(--red); background: rgba(181,76,63,.14); }
.metric-row, .status-row { margin-top: 16px; align-items: end; }
.metric-row strong { color: var(--ink); font-size: 1.7rem; }
.metric-label { font-size: .82rem; }
.progress-track { width: 100%; height: 10px; margin-top: 12px; background: rgba(30,36,48,.08); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #3f7b62, #d29a3d); }
.progress-track.large { height: 14px; margin-top: 0; }
.comparison-chip, .flag-chip { display: inline-flex; align-items: center; justify-content: center; padding: 7px 10px; border-radius: 999px; font-size: .78rem; font-weight: 800; }
.comparison-chip.green, .flag-chip.green { color: var(--green); background: rgba(47,125,76,.14); }
.comparison-chip.amber { color: var(--amber); background: rgba(192,124,21,.14); }
.comparison-chip.red { color: var(--red); background: rgba(181,76,63,.14); }
.comparison-chip.blue, .flag-chip.blue { color: var(--blue); background: rgba(47,90,136,.14); }
.comparison-text.green { color: var(--green); } .comparison-text.amber { color: var(--amber); } .comparison-text.red { color: var(--red); } .comparison-text.blue { color: var(--blue); }
.detail-page-shell { padding-bottom: 56px; }
.detail-page-intro { margin-bottom: 24px; }
.detail-status-card { display: grid; gap: 14px; align-content: start; }
.detail-actions { margin-top: 18px; }
.detail-kpis, .assessment-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.kpi { padding: 14px; border-radius: var(--radius-md); background: var(--surface-strong); border: 1px solid var(--line); }
.kpi strong { display: block; margin-top: 6px; font-size: 1.05rem; }
.progress-hero { margin-top: 8px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-strong); }
.progress-hero-inline { margin-top: 16px; max-width: 520px; }
.progress-hero-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 10px; }
.progress-hero-head strong { font-size: 1.3rem; }
.editor-section { margin-top: 24px; }
.current-topic-picker { margin-top: 12px; }
.completed-list { margin: 12px 0 0; padding-left: 18px; display: grid; gap: 8px; }
.note-form { display: grid; gap: 14px; margin-top: 12px; }
.note-topic-list { display: grid; gap: 10px; }
.note-topic-option { display: flex; gap: 10px; align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.76); }
.notes-list { display: grid; gap: 12px; margin-top: 14px; }
.notes-table-wrap { border: 1px solid var(--line); border-radius: var(--radius-md); overflow-x: auto; overflow-y: hidden; background: rgba(255,255,255,.76); }
.notes-table-header, .note-row { display: grid; grid-template-columns: 72px 96px 104px minmax(170px, 1.7fr) minmax(110px, 1fr) 132px; gap: 12px; align-items: start; min-width: 720px; }
.notes-table-header { padding: 14px 16px; background: rgba(30,36,48,.06); border-bottom: 1px solid var(--line); font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.notes-table-body { display: grid; }
.note-row { padding: 16px; border-top: 1px solid rgba(30,36,48,.08); }
.note-row:first-child { border-top: 0; }
.note-cell { min-width: 0; }
.note-grade strong { font-size: 1.1rem; }
.note-cell-text { color: var(--muted); line-height: 1.4; }
.note-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.note-card-topics { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.note-card-note { margin: 10px 0 0; color: var(--muted); }
.note-card-head span { color: var(--muted); }
.note-card-actions { display: flex; gap: 10px; margin-top: 12px; align-items: center; }
.note-actions-cell { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-start; }
.ghost-button { border: 1px solid var(--line); border-radius: 999px; padding: 10px 14px; background: transparent; color: var(--ink); font: inherit; cursor: pointer; }
.ghost-button:hover { background: rgba(255,255,255,.7); }
.icon-action { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 10px 14px; background: #fff; color: var(--ink); font: inherit; font-weight: 800; text-decoration: none; cursor: pointer; }
.icon-action:hover { background: rgba(255,255,255,.84); }
.icon-action.danger { color: var(--red); }
.icon-action-symbol { width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; }
.icon-action-symbol svg { width: 16px; height: 16px; fill: currentColor; display: block; }
.add-note-action { background: var(--ink); color: #fff; }
.add-note-action:hover { background: #2b3442; }
@media (max-width: 1100px) {
  .notes-table-header, .note-row { grid-template-columns: 68px 92px 96px minmax(150px, 1.5fr) minmax(80px, .9fr) 120px; min-width: 650px; }
  .icon-action { padding: 9px 12px; }
  .icon-action-label { font-size: .9rem; }
}
.curriculum-checklist { display: grid; gap: 18px; margin-top: 12px; }
.curriculum-domain-group { display: grid; gap: 14px; padding: 2px 0 8px; border-top: 1px solid var(--line); }
.curriculum-domain-group:first-child { border-top: 0; }
.curriculum-domain-head, .curriculum-content-head { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.curriculum-domain-head h3, .curriculum-content-head h4 { margin: 2px 0 0; line-height: 1.18; }
.curriculum-domain-head h3 { font-size: 1.18rem; }
.curriculum-content-list { display: grid; gap: 14px; }
.curriculum-content-group { display: grid; gap: 10px; padding-left: 14px; border-left: 3px solid rgba(47,125,76,.28); }
.curriculum-content-head p { margin: 6px 0 0; color: var(--muted); }
.curriculum-progress { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: rgba(255,255,255,.72); color: var(--muted); font-size: .82rem; font-weight: 800; }
.topics-checklist { display: grid; gap: 12px; margin-top: 12px; }
.topics-checklist.nested { margin-top: 0; }
.topic-check-item { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 12px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(255,255,255,.76); }
.topic-check-item.checked { background: rgba(232,245,236,.9); }
.topic-check { margin-top: 4px; width: 18px; height: 18px; }
.topic-check-copy p { margin: 6px 0 0; color: var(--muted); }
.topic-check-line { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.topic-mini-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; color: var(--muted); font-size: .86rem; }
.editor-topic-meta { margin-top: 10px; }
.field-block { display: grid; gap: 8px; margin-top: 12px; }
.field-block.compact { margin-top: 0; }
.editor-input, .editor-textarea, .editor-select { width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: #fffdf9; color: var(--ink); font: inherit; }
.edit-mode-note { color: var(--muted); margin-bottom: 12px; }
.is-hidden-editor { display: none; }
.edit-mode-closed { padding: 14px 0 4px; color: var(--muted); }
.timetable-editor-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid rgba(30,36,48,.08); }
.timetable-editor-row:first-of-type { border-top: 0; }
.editor-index { font-weight: 800; }
.collapsible-panel { overflow: hidden; transition: opacity 180ms ease, transform 180ms ease, max-height 220ms ease, padding 220ms ease, margin 220ms ease; max-height: 2600px; opacity: 1; transform: translateY(0); }
.collapsible-panel.is-hidden { max-height: 0; opacity: 0; transform: translateY(-8px); padding-top: 0; padding-bottom: 0; margin-top: -8px; margin-bottom: -8px; border-width: 0; pointer-events: none; }
.period-chip { border-radius: 999px; padding: 10px 12px; font-size: .82rem; font-weight: 700; }
.period-chip.course { background: rgba(47,125,76,.14); color: var(--green); } .period-chip.special { background: rgba(47,90,136,.14); color: var(--blue); } .period-chip.vacation { background: rgba(181,76,63,.14); color: var(--red); }
.calendar-weekdays, .calendar-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.calendar-weekdays { margin-bottom: 8px; font-size: .8rem; }
.day-cell { min-height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: rgba(30,36,48,.05); }
.day-cell.course { background: rgba(47,125,76,.14); } .day-cell.special { background: rgba(47,90,136,.16); } .day-cell.vacation { background: rgba(181,76,63,.18); } .day-cell.empty { background: transparent; }
.empty-state { padding: 12px 0 4px; }
.day-off-card { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(120px, 220px) minmax(0, 1fr); gap: 22px; align-items: center; overflow: hidden; background: linear-gradient(135deg, rgba(255,250,241,.96), rgba(228,241,232,.92)); }
.day-off-illustration { min-height: 150px; display: grid; place-items: center; border-radius: 22px; background: radial-gradient(circle at 34% 30%, rgba(224,169,85,.28), transparent 34%), rgba(255,255,255,.6); }
.day-off-illustration svg { width: min(100%, 220px); height: auto; }
.day-off-sun { fill: #e4a343; }
.day-off-wave { fill: none; stroke: #2f7d4c; stroke-width: 9; stroke-linecap: round; }
.day-off-wave.muted { stroke: rgba(47,90,136,.42); stroke-width: 7; }
.day-off-book { fill: #2f5a88; }
.day-off-lines, .day-off-laces { fill: none; stroke: #fffaf1; stroke-width: 5; stroke-linecap: round; }
.day-off-shoe { fill: none; stroke: #1e2430; stroke-width: 10; stroke-linecap: round; }
.day-off-copy h3 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.8rem, 5vw, 3rem); line-height: 1; }
.day-off-copy p { color: var(--muted); line-height: 1.55; }
.text-link-button { border: 0; padding: 0; background: transparent; color: var(--blue); font: inherit; font-weight: 800; text-decoration: underline; cursor: pointer; }
.raw-curriculum-block {
  margin: 12px 0 0;
  white-space: pre-wrap;
  font: inherit;
  color: var(--muted);
  background: rgba(255,255,255,.7);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  max-height: 360px;
  overflow: auto;
}
@media (min-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.9fr); }
  .dashboard-hero { grid-template-columns: minmax(0, 1fr); }
  .layout { grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr); }
  .dashboard-layout { grid-template-columns: minmax(0, 1fr); }
  .subject-grid, .calendar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-layout { grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr); }
  .detail-main-column { max-width: 920px; }
}
@media (max-width: 899px) {
  .page-shell { width: min(100% - 20px, 860px); }
  .controls-top { flex-direction: column; align-items: stretch; }
  .toggle-group { flex-direction: column; }
  .assessment-grid, .detail-kpis { grid-template-columns: 1fr; }
  .timetable-editor-row { grid-template-columns: 28px minmax(0, 1fr); }
  .editor-tag { grid-column: 2; }
  .topic-check-line { flex-direction: column; }
  .progress-hero-head { flex-direction: column; align-items: start; }
  .notes-table-header { display: none; }
  .note-row { grid-template-columns: 1fr; gap: 10px; }
  .note-cell::before { content: attr(data-label); display: block; margin-bottom: 4px; font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
  .day-off-card { grid-template-columns: 1fr; }
}
