:root {
  color-scheme: light;
  --ink: #24333a;
  --muted: #78838a;
  --soft-ink: #52636a;
  --paper: #f6f5f0;
  --white: #fffefa;
  --teal: #247c72;
  --teal-dark: #1b625b;
  --teal-light: #e3f1ed;
  --line: #e7e9e3;
  --shadow: 0 22px 65px rgba(55, 71, 66, .08);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 7% 5%, rgba(204, 231, 219, .40), transparent 29rem),
    radial-gradient(ellipse at 96% 38%, rgba(244, 223, 194, .23), transparent 27rem),
    var(--paper);
}

button, input, select { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.page-shell { width: min(1160px, calc(100% - 64px)); margin: 0 auto; }
.topbar {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(96, 117, 108, .12);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font: 800 16px/1 "Avenir Next", "Segoe UI", sans-serif;
  letter-spacing: -.035em;
}

.brand-mark {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: #3a9283;
  font-size: 23px;
  box-shadow: 0 5px 12px rgba(58, 146, 131, .20);
}

.top-actions { display: flex; align-items: center; gap: 12px; }
.connection-status { color: var(--muted); font-size: 12px; }
.connection-status.is-offline { color: #a1513a; }

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.button:hover { transform: translateY(-1px); }
.button:focus-visible, .icon-button:focus-visible, .done-button:focus-visible {
  outline: 3px solid rgba(42, 137, 121, .35);
  outline-offset: 2px;
}
.button:disabled { opacity: .65; cursor: wait; transform: none; }
.button-primary {
  color: #fff;
  background: var(--teal);
  box-shadow: 0 6px 13px rgba(36, 124, 114, .16);
}
.button-primary:hover { background: var(--teal-dark); box-shadow: 0 9px 18px rgba(36, 124, 114, .21); }
.button-soft { color: var(--teal-dark); background: #e5f1ed; }
.button-soft:hover { background: #d8ebe5; }
.button-quiet { color: var(--soft-ink); background: transparent; border-color: #e3e7e1; }
.button-quiet:hover { background: #fff; }
.button-wide { width: 100%; margin-top: 8px; min-height: 51px; }
.button-small { min-height: 34px; padding: 0 11px; font-size: 12px; }

.login-layout {
  min-height: calc(100vh - 89px);
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  align-items: center;
  gap: clamp(48px, 8vw, 106px);
  padding: 56px 3.2% 76px;
}

.login-story { position: relative; min-height: 430px; padding-top: 27px; }
.eyebrow {
  display: inline-block;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
  line-height: 1.35;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
.login-story h1, .welcome-copy h1 {
  margin: 17px 0 15px;
  font: 800 clamp(38px, 5.2vw, 63px)/1.07 "Avenir Next", "Segoe UI", sans-serif;
  letter-spacing: -.065em;
}

.login-story h1 span { color: #318679; }
.login-story > p {
  max-width: 410px;
  margin-bottom: 0;
  color: var(--soft-ink);
  font-size: 16px;
  line-height: 1.75;
}

.story-cards { position: relative; height: 167px; margin-top: 47px; }
.story-card {
  position: absolute;
  display: flex;
  width: 232px;
  min-height: 85px;
  align-items: center;
  gap: 13px;
  padding: 17px;
  border: 1px solid rgba(51, 86, 74, .09);
  border-radius: 18px;
  box-shadow: 0 14px 33px rgba(61, 78, 70, .09);
  color: #394b4b;
  font-size: 13px;
}
.story-card span { display: grid; width: 49px; height: 49px; place-items: center; border-radius: 15px; background: rgba(255,255,255,.67); font-size: 27px; }
.story-card-one { top: 0; left: 9px; z-index: 1; background: #e6f2ec; transform: rotate(-4deg); }
.story-card-two { top: 60px; left: 124px; background: #faebd8; transform: rotate(3deg); }
.decor { position: absolute; pointer-events: none; }
.decor-star { right: 32px; top: 105px; color: #e7b956; font-size: 43px; }
.decor-dot { right: 72px; bottom: 95px; width: 11px; height: 11px; border-radius: 50%; background: #8abcae; }

.login-panel {
  width: min(100%, 430px);
  justify-self: end;
  padding: 39px 40px 31px;
  border: 1px solid rgba(101, 120, 110, .13);
  border-radius: 24px;
  background: rgba(255, 254, 250, .92);
  box-shadow: var(--shadow);
}
.login-panel-top { display: flex; align-items: center; gap: 12px; margin-bottom: 17px; }
.avatar { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 15px; background: #f8e8ce; font-size: 21px; }
.login-panel h2, .modal-card h2 {
  margin: 0 0 8px;
  font: 800 25px/1.2 "Avenir Next", "Segoe UI", sans-serif;
  letter-spacing: -.045em;
}
.muted { color: var(--muted); font-size: 13px; line-height: 1.6; }
.login-panel > .muted { margin-bottom: 27px; }
.form-stack { display: flex; flex-direction: column; }
label { margin: 13px 0 7px; color: #43555c; font-size: 12px; font-weight: 700; }
input, select {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid #e2e6e0;
  border-radius: 11px;
  outline: none;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
  transition: border-color .16s ease, box-shadow .16s ease;
}
input:focus, select:focus { border-color: #78b9aa; box-shadow: 0 0 0 3px rgba(69, 158, 139, .12); }
input::placeholder { color: #a7afb0; }
.login-footnote { display: flex; align-items: center; gap: 7px; margin: 25px 0 0; color: #87918d; font-size: 11px; }
.form-error { margin: 10px 0 0; color: #a73f35; font-size: 12px; line-height: 1.5; }

.app-view { padding: 47px 0 25px; }
.welcome-row {
  display: flex;
  min-height: 111px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 33px;
}
.welcome-copy h1 { margin: 9px 0 5px; font-size: clamp(31px, 4vw, 43px); }
.welcome-copy p { margin-bottom: 0; font-size: 14px; }
.teacher-controls { display: flex; align-items: end; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.student-picker { display: block; min-width: 190px; margin: 0; color: var(--muted); font-size: 11px; }
.student-picker select { display: block; margin-top: 7px; min-height: 43px; font-weight: 700; }

.day-panel {
  overflow: hidden;
  border: 1px solid rgba(101, 120, 110, .13);
  border-radius: 25px;
  background: var(--white);
  box-shadow: var(--shadow);
}
.day-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 31px 35px 24px;
}
.day-heading { margin: 7px 0 0; font: 800 25px/1.2 "Avenir Next", "Segoe UI", sans-serif; letter-spacing: -.04em; }
.date-controls { display: flex; align-items: center; gap: 8px; }
.icon-button {
  display: inline-grid;
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #e5e9e3;
  border-radius: 12px;
  color: #63736f;
  background: #fff;
  cursor: pointer;
  font-size: 16px;
  transition: background .16s ease, color .16s ease;
}
.icon-button:hover { color: var(--teal); background: #eff7f3; }
.today-button { min-height: 39px; padding: 0 14px; font-size: 12px; }

.progress-row { padding: 0 35px 25px; }
.progress-copy { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; color: #586a6b; font-size: 12px; font-weight: 600; }
.progress-count { color: #8b9692; font-weight: 500; }
.progress-track { height: 8px; overflow: hidden; border-radius: 99px; background: #edf0ea; }
.progress-fill { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #64b39d, #4b998e); transition: width .4s ease; }

.agenda-list { display: flex; flex-direction: column; gap: 11px; padding: 0 35px; }
.activity-card {
  position: relative;
  display: grid;
  min-height: 100px;
  grid-template-columns: 37px 66px 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 15px 17px;
  border: 1px solid rgba(64, 79, 69, .07);
  border-radius: 19px;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.activity-card:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(59, 76, 67, .055); }
.card-sun { background: #fff5dd; }
.card-sky { background: #eaf4fb; }
.card-mint { background: #e8f4ec; }
.card-lilac { background: #f2eefb; }
.card-peach { background: #fff0e5; }
.card-rose { background: #fbecef; }
.activity-card.is-done { opacity: .76; }
.activity-card.is-done .activity-details h3 { text-decoration: line-through; text-decoration-color: rgba(55, 100, 83, .45); }
.activity-number { justify-self: center; color: #9da8a0; font: 700 10px/1 "Avenir Next", "Segoe UI", sans-serif; letter-spacing: .06em; }
.activity-time { color: #4b6160; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.activity-icon { display: grid; width: 55px; height: 55px; place-items: center; border-radius: 17px; background: rgba(255, 255, 255, .65); font-size: 28px; }
.activity-details h3 { margin: 0 0 4px; color: #30464a; font: 800 15px/1.3 "Avenir Next", "Segoe UI", sans-serif; }
.activity-details p { margin: 0; color: #788681; font-size: 11px; }
.activity-actions { display: flex; gap: 5px; }
.action-button { width: 34px; height: 34px; border-color: rgba(78, 95, 83, .12); background: rgba(255, 255, 255, .6); }
.delete-action:hover { color: #a9473b; background: #fff0eb; }
.done-button {
  min-width: 92px;
  min-height: 39px;
  padding: 0 13px;
  border: 1px solid rgba(53, 135, 115, .16);
  border-radius: 12px;
  color: #34796e;
  background: rgba(255,255,255,.55);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  transition: background .16s ease, transform .16s ease;
}
.done-button:hover { transform: translateY(-1px); background: #fff; }
.done-button-complete { color: #fff; border-color: transparent; background: #43937f; }
.done-button-complete:hover { background: #347d6d; }

.empty-state { padding: 22px 30px 30px; text-align: center; }
.empty-illustration { display: grid; width: 72px; height: 72px; margin: 2px auto 14px; place-items: center; border-radius: 25px; background: #edf5ee; font-size: 37px; }
.empty-state h3 { margin: 0 0 7px; color: #3b5252; font: 800 18px/1.3 "Avenir Next", "Segoe UI", sans-serif; }
.empty-state p { max-width: 390px; margin: 0 auto 17px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.agenda-footer {
  display: flex;
  min-height: 73px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 23px 35px 0;
  border-top: 1px solid #edf0ea;
  color: #8a9490;
  font-size: 11px;
}
.agenda-footer > span { display: inline-flex; align-items: center; gap: 8px; }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: #6eb09c; }
.sync-dot.is-saving { background: #d69d4d; animation: pulse 1s infinite alternate; }
@keyframes pulse { from { opacity: .45; } to { opacity: 1; } }
.add-button { min-height: 40px; padding: 0 14px; font-size: 12px; }
.app-footer { display: flex; justify-content: space-between; gap: 12px; padding: 19px 4px 0; color: #9ba49e; font-size: 11px; }

.modal {
  width: min(490px, calc(100% - 28px));
  max-height: min(86vh, 850px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 23px;
  color: var(--ink);
  background: transparent;
  box-shadow: 0 24px 90px rgba(27, 44, 37, .23);
}
.modal::backdrop { background: rgba(32, 48, 45, .37); backdrop-filter: blur(3px); }
.modal-card { position: relative; padding: 31px 34px 29px; border-radius: inherit; background: #fffefa; }
.modal-close { position: absolute; top: 15px; right: 17px; width: 34px; height: 34px; border: 0; border-radius: 11px; color: #72817b; background: #f3f5f0; cursor: pointer; font-size: 22px; line-height: 1; }
.modal-icon { display: grid; width: 48px; height: 48px; margin-bottom: 15px; place-items: center; border-radius: 16px; background: #ecf5ed; font-size: 24px; }
.modal-card .eyebrow { margin-bottom: 8px; }
.modal-card h2 { margin-bottom: 7px; }
.modal-card > .muted { margin-bottom: 18px; }
.field-hint { display: block; margin: 6px 0 0; color: #9aa39f; font-size: 10px; }
.label-optional { color: #a2aaa6; font-weight: 500; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 21px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.student-list { margin-top: 24px; border-top: 1px solid var(--line); }
.student-list h3 { margin: 20px 0 7px; color: #77847e; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.student-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f0f1ec; }
.student-row > span { display: flex; flex-direction: column; gap: 3px; }
.student-row strong { color: #405457; font-size: 13px; }
.student-row small { color: #89958f; font-size: 10px; }
.classroom-form { margin-top: 20px; }
.classroom-form .field-label { margin: 13px 0 7px; color: #43555c; font-size: 12px; font-weight: 700; }
.classroom-student-choices { max-height: 190px; overflow: auto; padding: 8px 12px; border: 1px solid #e2e6e0; border-radius: 11px; background: #fff; }
.classroom-student-choice { display: flex; align-items: center; gap: 10px; margin: 0; padding: 7px 0; color: #43555c; font-size: 12px; }
.classroom-student-choice + .classroom-student-choice { border-top: 1px solid #f0f1ec; }
.classroom-student-choice input { width: 17px; min-height: 17px; margin: 0; accent-color: #327c70; }
.classroom-student-choice input:disabled + span { color: #a2aaa6; }
.toast {
  position: fixed;
  z-index: 4;
  right: 24px;
  bottom: 22px;
  max-width: min(400px, calc(100% - 48px));
  padding: 13px 17px;
  border: 1px solid rgba(41, 114, 98, .16);
  border-radius: 14px;
  color: #fff;
  background: #327c70;
  box-shadow: 0 12px 36px rgba(31, 67, 58, .2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
  font-size: 12px;
  font-weight: 700;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast-error { background: #a34e42; border-color: transparent; }

@media (max-width: 820px) {
  .page-shell { width: min(100% - 40px, 680px); }
  .login-layout { grid-template-columns: 1fr; gap: 20px; padding: 38px 0 55px; }
  .login-story { min-height: 0; padding: 12px 4px 0; }
  .login-story h1 { max-width: 520px; font-size: clamp(37px, 8vw, 56px); }
  .login-story > p { max-width: 510px; font-size: 14px; }
  .story-cards { display: none; }
  .decor-star { right: 12%; top: 36px; font-size: 34px; }
  .decor-dot { display: none; }
  .login-panel { justify-self: center; margin: 8px auto 0; }
  .app-view { padding-top: 34px; }
  .day-topline, .progress-row, .agenda-list { padding-right: 24px; padding-left: 24px; }
  .agenda-footer { margin-right: 24px; margin-left: 24px; }
  .activity-card { grid-template-columns: 28px 55px 60px minmax(0,1fr) auto; gap: 10px; padding: 13px; }
  .activity-icon { width: 49px; height: 49px; border-radius: 15px; font-size: 25px; }
}

@media (max-width: 560px) {
  .page-shell { width: calc(100% - 28px); }
  .topbar { height: 68px; }
  .brand { gap: 8px; font-size: 14px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 11px; }
  .top-actions { gap: 6px; }
  .connection-status { font-size: 10px; }
  .install-button { min-height: 36px; padding: 0 10px; font-size: 11px; }
  #logoutButton { min-height: 36px; padding: 0 10px; font-size: 11px; }
  .login-layout { min-height: calc(100vh - 69px); gap: 16px; padding-top: 28px; }
  .login-story h1 { margin-top: 12px; font-size: 39px; }
  .login-story > p { font-size: 13px; line-height: 1.55; }
  .login-panel { padding: 27px 22px 24px; border-radius: 20px; }
  .login-panel h2 { font-size: 22px; }
  .app-view { padding-top: 25px; }
  .welcome-row { min-height: 0; align-items: flex-start; flex-direction: column; gap: 17px; margin-bottom: 23px; }
  .welcome-copy h1 { font-size: 32px; }
  .welcome-copy p { font-size: 12px; }
  .teacher-controls { width: 100%; align-items: end; flex-wrap: wrap; }
  .student-picker { min-width: 0; flex: 1 1 100%; }
  .teacher-controls > .button { flex: 1 1 auto; min-height: 42px; padding: 0 10px; font-size: 11px; }
  .day-panel { border-radius: 20px; }
  .day-topline { align-items: flex-end; padding: 22px 17px 17px; }
  .day-heading { max-width: 190px; font-size: 20px; }
  .date-controls { gap: 5px; }
  .icon-button { width: 35px; height: 35px; border-radius: 10px; }
  .today-button { min-height: 35px; padding: 0 10px; }
  .progress-row { padding: 0 18px 19px; }
  .progress-copy { font-size: 10px; }
  .agenda-list { gap: 9px; padding: 0 12px; }
  .activity-card { min-height: 92px; grid-template-columns: 45px minmax(0,1fr) auto; gap: 9px; padding: 11px; border-radius: 16px; }
  .activity-number { display: none; }
  .activity-time { position: absolute; top: 9px; left: 66px; color: #71827e; font-size: 10px; }
  .activity-icon { grid-column: 1; grid-row: 1; width: 45px; height: 45px; border-radius: 14px; font-size: 23px; }
  .activity-details { grid-column: 2; grid-row: 1; padding-top: 7px; }
  .activity-details h3 { font-size: 13px; }
  .activity-details p { font-size: 9px; }
  .done-button { grid-column: 3; grid-row: 1; min-width: 69px; min-height: 34px; padding: 0 8px; font-size: 10px; }
  .activity-actions { grid-column: 3; grid-row: 1; }
  .action-button { width: 30px; height: 30px; }
  .agenda-footer { min-height: 65px; margin: 17px 14px 0; font-size: 9px; }
  .add-button { min-height: 35px; padding: 0 10px; font-size: 10px; }
  .empty-state { padding: 15px 16px 24px; }
  .empty-state h3 { font-size: 16px; }
  .empty-state p { font-size: 11px; }
  .app-footer { font-size: 9px; }
  .modal-card { padding: 27px 21px 22px; }
  .modal-actions .button { min-height: 40px; padding: 0 12px; font-size: 11px; }
}

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