*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif; background: #edf5f1; color: #17211d; }
a { color: inherit; }
button, input, textarea { font: inherit; }
[hidden] { display: none !important; }
:root {
  --green: #176b4d;
  --green-dark: #0d4b35;
  --mint: #dff2ea;
  --orange: #ef7b29;
  --blue: #246fa8;
  --paper: #fffdf7;
  --line: #c9d9d1;
  --muted: #5f7169;
  --shadow: 0 16px 46px -30px rgba(13, 75, 53, .42);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--green); color: white; font-weight: 800; }
.brand strong, .brand small { display: block; line-height: 1.1; }
.brand small { color: var(--muted); font-size: 12px; margin-top: 2px; }
.eyebrow { margin: 0 0 7px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.button, .icon-button { border: 0; cursor: pointer; text-decoration: none; transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 44px; border-radius: 8px; padding: 10px 16px; font-weight: 800; }
.button:hover, .icon-button:hover { transform: translateY(-1px); }
.button-primary { background: var(--green); color: white; box-shadow: 0 10px 24px -16px var(--green-dark); }
.button-light { background: white; color: var(--green-dark); border: 1px solid rgba(255,255,255,.72); }
.button-outline { background: transparent; color: var(--green-dark); border: 1px solid var(--line); }
.icon-button { width: 42px; height: 42px; border-radius: 50%; background: var(--mint); color: var(--green-dark); font-size: 30px; line-height: 1; }
.sign-in-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #176b4d, #246fa8); }
.gate-panel { width: min(460px, 100%); background: var(--paper); border-radius: 8px; padding: 28px; box-shadow: var(--shadow); }
.gate-panel h1 { margin: 14px 0 10px; font-size: clamp(30px, 7vw, 46px); line-height: 1; }
.gate-panel p { color: var(--muted); }
.calendar-app { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 14px clamp(16px, 4vw, 34px); background: rgba(255, 253, 247, .94); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.student-chip { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.student-initial { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--orange); color: white; font-weight: 900; }
.student-chip strong, .student-chip small { display: block; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.student-chip small { color: var(--muted); font-size: 12px; margin-top: 3px; }
main { width: min(1220px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 54px; }
.calendar-hero { display: flex; justify-content: space-between; align-items: end; gap: 22px; padding: clamp(22px, 4vw, 38px); border-radius: 8px; color: white; background: linear-gradient(125deg, #176b4d 0%, #246fa8 58%, #ef7b29 100%); box-shadow: var(--shadow); }
.calendar-hero h1 { margin: 0; font-size: clamp(34px, 7vw, 66px); line-height: .96; letter-spacing: 0; }
.calendar-hero p:not(.eyebrow) { max-width: 64ch; margin: 14px 0 0; color: rgba(255,255,255,.88); }
.calendar-hero .eyebrow { color: rgba(255,255,255,.78); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.privacy-banner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; margin-top: 16px; padding: 14px 16px; background: #fffdf7; border: 1px solid #d6c487; border-left: 5px solid #ef7b29; border-radius: 8px; box-shadow: var(--shadow); }
.privacy-banner strong { display: block; color: var(--green-dark); }
.privacy-banner p { margin: 3px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.privacy-icon { display: grid; place-items: center; width: 40px; height: 40px; background: #fff0d2; border-radius: 50%; font-size: 20px; }
.subject-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.subject-strip a { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 48px; padding: 8px; color: #20352d; background: #fffdf7; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; font-weight: 900; text-decoration: none; text-align: center; }
.subject-strip a:nth-child(2) { border-bottom-color: #ef7b29; }
.subject-strip a:nth-child(3) { border-bottom-color: #246fa8; }
.subject-strip a:nth-child(4) { border-bottom-color: #7c5ba7; }
.subject-strip span { font-size: 18px; }
.calendar-shell { display: grid; grid-template-columns: minmax(360px, .88fr) minmax(0, 1.12fr); gap: 18px; margin-top: 18px; align-items: start; }
.month-panel, .day-panel { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 18px; box-shadow: var(--shadow); }
.month-toolbar, .day-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.month-toolbar h2, .day-heading h2 { margin: 0; font-size: 24px; line-height: 1.12; }
.date-controls { display: grid; grid-template-columns: minmax(0, 1fr) 100px auto; align-items: end; gap: 8px; margin-top: 16px; padding: 10px; background: #f4f8f6; border: 1px solid var(--line); border-radius: 8px; }
.date-controls label span { display: block; margin: 0 0 4px; color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.date-controls select { width: 100%; height: 40px; padding: 0 10px; color: #17211d; background: white; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-weight: 800; }
.weekday-row, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.weekday-row { margin-top: 20px; color: var(--muted); font-size: 12px; font-weight: 800; text-align: center; }
.calendar-grid { margin-top: 8px; }
.day-cell { position: relative; min-height: 74px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: #fbfffc; color: #17211d; text-align: left; cursor: pointer; }
.day-cell:hover, .day-cell.is-selected { border-color: var(--green); box-shadow: inset 0 0 0 2px rgba(23, 107, 77, .16); }
.day-cell.is-empty { visibility: hidden; }
.day-cell.is-today { background: #fff2df; }
.day-num { display: block; font-weight: 900; }
.day-subjects { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.25; }
.day-dot { position: absolute; right: 8px; top: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 13px; margin-top: 13px; color: var(--muted); font-size: 12px; font-weight: 800; }
.calendar-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--orange); }
.legend-dot.today { background: #ffd99c; border: 1px solid #c67c18; }
.legend-dot.photo { background: #246fa8; }
.day-image { position: absolute; right: 7px; bottom: 6px; font-size: 14px; line-height: 1; }
.calendar-note { color: var(--muted); font-size: 13px; margin: 14px 0 0; }
.entry-status { flex: none; border-radius: 999px; padding: 7px 11px; background: var(--mint); color: var(--green-dark); font-size: 12px; font-weight: 900; }
.diary-evidence { margin: 18px 0 0; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.diary-evidence[hidden] { display: none; }
.diary-evidence-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.diary-evidence-heading h3 { margin: 0; font-size: 18px; }
.diary-evidence-heading .eyebrow { margin-bottom: 4px; }
.diary-image-link { display: block; overflow: hidden; background: #e7efeb; border: 1px solid var(--line); border-radius: 6px; }
.diary-image-link img { display: block; width: 100%; max-height: 520px; object-fit: contain; }
.diary-evidence figcaption { margin-top: 9px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.diary-form { margin-top: 18px; }
.diary-form label { display: block; color: var(--muted); font-weight: 800; font-size: 13px; margin-bottom: 7px; }
.diary-form input, .diary-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; background: white; color: #17211d; padding: 10px 11px; outline: none; }
.diary-form input:disabled, .diary-form textarea:disabled { color: #35463f; background: #f5f7f6; opacity: 1; }
.button:disabled, .remove-row:disabled { cursor: not-allowed; opacity: .5; transform: none; }
.diary-form textarea { min-height: 72px; resize: vertical; }
.diary-form input:focus, .diary-form textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23, 107, 77, .16); }
.entry-table { margin-top: 16px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.entry-table-head, .entry-row { display: grid; grid-template-columns: minmax(110px, .72fr) repeat(3, minmax(0, 1fr)) 38px; gap: 0; }
.entry-table-head { background: var(--mint); color: var(--green-dark); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.entry-table-head span, .entry-row > * { border-right: 1px solid var(--line); }
.entry-table-head span { padding: 10px; }
.entry-table-head span:last-child, .entry-row > *:last-child { border-right: 0; }
.entry-row { border-top: 1px solid var(--line); background: white; }
.entry-row input, .entry-row textarea { border: 0; border-radius: 0; min-height: 58px; }
.remove-row { display: grid; place-items: center; width: 100%; border: 0; background: #fff6f0; color: #9a3d16; cursor: pointer; font-size: 24px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.form-message { min-height: 22px; margin: 12px 0 0; color: var(--green-dark); font-weight: 800; }
.learning-phase { margin-top: 22px; padding-top: 20px; border-top: 2px solid var(--line); }
.phase-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.phase-heading h3 { margin: 0; font-size: 22px; }
.phase-heading > span { flex: none; padding: 6px 9px; color: #7a421d; background: #fff0e4; border: 1px solid #efc7aa; border-radius: 14px; font-size: 11px; font-weight: 900; }
.phase-copy { margin: 7px 0 16px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.learning-plan { display: grid; gap: 14px; }
.plan-subject { overflow: hidden; background: white; border: 1px solid var(--line); border-radius: 8px; }
.plan-subject > header { padding: 13px 14px; background: #f4f8f6; border-bottom: 1px solid var(--line); }
.plan-subject > header span { color: var(--green); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.plan-subject h4 { margin: 3px 0; font-size: 17px; }
.plan-subject header p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.confirmation-warning { display: inline-flex; margin-top: 8px; padding: 5px 7px; color: #8b3e1d; background: #fff0e4; border: 1px solid #efc7aa; border-radius: 12px; font-size: 10px; }
.activity-link { display: inline-flex; margin-top: 8px; color: var(--green); font-size: 11px; font-weight: 900; text-decoration: none; }
.confirmation-warning + .activity-link { margin-left: 8px; }
.phase-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.phase-item { display: grid; grid-template-columns: 30px 1fr; grid-template-rows: 1fr auto; gap: 7px 9px; min-width: 0; padding: 13px; border-right: 1px solid var(--line); }
.phase-item:last-child { border-right: 0; }
.phase-item > span { font-size: 22px; }
.phase-item > div { min-width: 0; }
.phase-item strong { font-size: 13px; }
.phase-item p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.42; }
.phase-item button { grid-column: 1 / -1; min-height: 34px; color: var(--green-dark); background: var(--mint); border: 1px solid #b9d8ca; border-radius: 6px; font-size: 11px; font-weight: 900; cursor: pointer; }
.phase-item.practice button { color: #1c587f; background: #eaf4fb; border-color: #bfd9e9; }
.phase-item.play button { color: #834319; background: #fff0e4; border-color: #efc7aa; }
.phase-item button:disabled { cursor: default; opacity: .7; }
@media (max-width: 860px) {
  .topbar, .calendar-hero { align-items: flex-start; flex-direction: column; }
  .hero-actions { justify-content: flex-start; }
  .calendar-shell { grid-template-columns: 1fr; }
  .subject-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .entry-table-head { display: none; }
  .entry-row { grid-template-columns: 1fr; padding: 10px; gap: 8px; }
  .entry-row > * { border: 1px solid var(--line); border-radius: 6px; }
  .remove-row { min-height: 42px; }
  .phase-grid { grid-template-columns: 1fr; }
  .phase-item { border-right: 0; border-bottom: 1px solid var(--line); }
  .phase-item:last-child { border-bottom: 0; }
}
@media (max-width: 560px) {
  main { width: min(100% - 18px, 1220px); padding-top: 12px; }
  .month-panel, .day-panel { padding: 12px; }
  .day-cell { min-height: 58px; padding: 7px; }
  .day-subjects { display: none; }
  .form-actions { flex-direction: column; }
  .privacy-banner { grid-template-columns: auto minmax(0, 1fr); }
  .privacy-banner .button { grid-column: 1 / -1; width: 100%; }
  .subject-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .date-controls { grid-template-columns: minmax(0, 1fr) 88px; }
  .date-controls .button { grid-column: 1 / -1; }
  .diary-evidence-heading { align-items: flex-start; flex-direction: column; }
  .diary-evidence-heading .button { width: 100%; }
}
