:root {
  color-scheme: light;
  --ink: #17241f;
  --muted: #617069;
  --forest: #20372f;
  --forest-2: #2f5446;
  --forest-soft: #e3ece7;
  --paper: #f7f5ef;
  --card: #fff;
  --line: #d7dfda;
  --danger: #a63f35;
  --error-bg: #fff0ed;
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  min-height: 2.75rem;
  padding: 0.65rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  color: var(--ink);
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}
button:hover:not(:disabled) {
  border-color: #91a39a;
  background: #f8faf9;
}
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #2878c8;
  outline-offset: 2px;
}
button.primary {
  color: #fff;
  border-color: var(--forest);
  background: var(--forest);
}
button.primary:hover:not(:disabled) {
  background: var(--forest-2);
}
button.danger {
  color: var(--danger);
}
button.quiet,
.back-link {
  border-color: transparent;
  background: transparent;
}
button.icon-button {
  min-width: 2.75rem;
  padding: 0.25rem;
  border: 0;
  background: transparent;
  font-size: 1.6rem;
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}
h1 {
  margin: 0.15rem 0 0;
  font-size: clamp(1.75rem, 4vw, 2.45rem);
  line-height: 1.12;
}
h2 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
}
h3 {
  margin: 0;
  font-size: 1.08rem;
}
p {
  line-height: 1.55;
}
.muted,
small {
  color: var(--muted);
}
.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.skip-link {
  position: fixed;
  top: -5rem;
  left: 1rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  color: #fff;
  background: var(--forest);
  border-radius: 0.5rem;
}
.skip-link:focus {
  top: 1rem;
}

.login-page {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 1rem;
  background: radial-gradient(circle at 20% 10%, #e7eee9, transparent 42%),
    var(--paper);
}
.auth-card {
  width: min(27rem, 100%);
  padding: clamp(1.5rem, 6vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  background: #fff;
  box-shadow: 0 18px 50px rgb(25 45 37 / 9%);
}
.login-logo {
  display: block;
  width: 9rem;
  height: 9rem;
  margin: 0 auto 1rem;
  object-fit: contain;
  border-radius: 1rem;
}
.auth-card h1 {
  margin-top: 0.5rem;
}
.auth-card .primary {
  width: 100%;
  margin-top: 0.35rem;
}

label {
  display: grid;
  gap: 0.4rem;
  margin: 0.9rem 0;
  font-weight: 700;
}
input,
select,
textarea {
  width: 100%;
  min-height: 2.85rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #aebbb4;
  border-radius: 0.6rem;
  color: var(--ink);
  background: #fff;
}
textarea {
  min-height: 6.5rem;
  resize: vertical;
}
label small {
  font-weight: 500;
}
.checkbox {
  grid-template-columns: auto 1fr;
  align-items: center;
}
.checkbox input {
  width: 1.25rem;
  min-height: 1.25rem;
}
.stack-form {
  display: grid;
  gap: 0.2rem;
}
.notice {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid #aacbbb;
  border-radius: 0.7rem;
  background: #edf8f1;
}
.notice.error {
  color: #812b25;
  border-color: #e1aaa5;
  background: var(--error-bg);
}

.app-shell {
  display: grid;
  min-height: 100dvh;
  grid-template-columns: 15rem 1fr;
  grid-template-rows: auto 1fr;
}
.topbar {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem clamp(1.25rem, 4vw, 3rem) 1rem;
  border-bottom: 1px solid var(--line);
  background: rgb(247 245 239 / 94%);
}
.topbar-brand,
.family-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.brand-mark {
  width: 3.5rem;
  height: 3.5rem;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 0.75rem;
}
.account {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.side-nav {
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.5rem 1rem;
  color: #eff7f3;
  background: var(--forest);
}
.side-brand {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  align-items: center;
  gap: 0.65rem;
  margin: 0.2rem 0.5rem 1.25rem;
  font-weight: 800;
  line-height: 1.1;
}
.side-brand img {
  width: 3.5rem;
  height: 3.5rem;
  object-fit: cover;
  border-radius: 0.75rem;
  background: #fff;
}
.nav-link {
  display: flex;
  align-items: center;
  min-height: 3rem;
  gap: 0.75rem;
  padding: 0.7rem 0.8rem;
  border-radius: 0.7rem;
  color: inherit;
  text-decoration: none;
  font-weight: 650;
}
.nav-link:hover,
.nav-link.active {
  background: rgb(255 255 255 / 14%);
}
#main {
  grid-column: 2;
  width: min(76rem, 100%);
  padding: clamp(1.25rem, 4vw, 3rem);
}
.panel {
  padding: clamp(1.15rem, 3vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--card);
  box-shadow: 0 6px 24px rgb(25 45 37 / 4%);
}
.state-panel {
  text-align: center;
}
.state-panel:only-child {
  min-height: 8rem;
}
.section-heading,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.section-heading {
  margin-bottom: 1.25rem;
}
.section-heading p {
  margin: 0.35rem 0 0;
}
.panel-heading {
  margin-bottom: 1rem;
}
.actions,
.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.tabs button[aria-pressed="true"] {
  color: #fff;
  border-color: var(--forest);
  background: var(--forest);
}
.date-nav,
.schedule-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.date-nav input {
  min-width: 9rem;
}
.compact-field,
.schedule-toolbar label {
  margin: 0;
}
.schedule-toolbar {
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
}
.schedule-toolbar .tabs {
  margin: 0;
}
.holiday-note {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid #dfc78e;
  border-radius: 0.75rem;
  background: #fff8e6;
}
.holiday-note span {
  color: #6e5a2f;
  font-size: 0.9rem;
}
.schedule-list {
  display: grid;
  gap: 0.75rem;
}
.lesson-card {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
}
.lesson-card.is-overloaded {
  border-color: #d59b70;
}
.lesson-time {
  display: grid;
  justify-items: center;
  color: var(--forest);
}
.lesson-time strong {
  font-size: 1.25rem;
}
.lesson-time span {
  color: var(--muted);
  font-size: 0.78rem;
}
.lesson-main {
  min-width: 0;
}
.lesson-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.lesson-heading p,
.member-summary p {
  margin: 0.3rem 0 0;
  color: var(--muted);
}
.capacity-cue,
.status-badge,
.mini-holiday {
  display: inline-flex;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  color: var(--forest);
  background: var(--forest-soft);
  font-size: 0.76rem;
  font-weight: 750;
  white-space: nowrap;
}
.capacity-cue.overload,
.status-badge.warning {
  color: #7a381f;
  background: #ffeadc;
}
.capacity-cue.empty {
  color: var(--muted);
  background: #eef1ef;
}
.status-row,
.participant-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.6rem;
}
.participant-chip {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 0.86rem;
}
.participant-chip small {
  font-size: 0.7rem;
}
.chip-action {
  min-width: 1.7rem;
  min-height: 1.7rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: var(--forest-soft);
}
.lesson-date-label {
  margin: 1rem 0 0.4rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: capitalize;
}
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(8.5rem, 1fr));
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}
.day-column,
.room-column {
  min-height: 12rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: #fff;
}
.day-column.is-today {
  border-color: var(--forest-2);
  box-shadow: inset 0 0 0 1px var(--forest-2);
}
.day-heading {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  text-transform: capitalize;
}
.day-heading span {
  color: var(--muted);
  font-size: 0.78rem;
}
.mini-holiday {
  display: flex;
  margin-bottom: 0.45rem;
  color: #6e5a2f;
  background: #fff1c9;
  white-space: normal;
}
.calendar-lesson {
  display: grid;
  width: 100%;
  min-height: auto;
  gap: 0.15rem;
  margin-bottom: 0.45rem;
  padding: 0.55rem;
  border: 0;
  border-radius: 0.55rem;
  text-align: left;
  background: var(--forest-soft);
}
.calendar-lesson span,
.calendar-lesson small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-lesson small {
  color: #4d5b55;
}
.calendar-empty {
  display: block;
  padding: 0.5rem;
}
.room-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}
.room-column h3 {
  margin-bottom: 0.75rem;
}
.room-slot {
  display: grid;
  gap: 0.2rem;
  padding: 0.65rem 0;
  border-top: 1px solid var(--line);
}
.room-slot small {
  color: var(--muted);
}
.groups-panel {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.group-card {
  display: grid;
  align-content: space-between;
  gap: 1rem;
}
.group-card .eyebrow {
  margin-bottom: 0.35rem;
}
.member-summary {
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}
.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(20rem, 100%), 1fr));
  gap: 0.75rem;
}
.family-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 5rem;
  padding: 1rem 1.1rem;
  text-align: left;
}
.family-card span:first-child,
.list-item > div:first-child {
  display: grid;
  gap: 0.3rem;
}
.family-card small,
.list-item small {
  display: block;
  font-weight: 500;
}
.back-link {
  margin: -1rem 0 1rem -0.75rem;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.access-panel {
  grid-column: 1 / -1;
}
.item-list {
  display: grid;
  gap: 0.65rem;
}
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.list-item:first-child {
  padding-top: 0;
  border-top: 0;
}
.copy-box {
  display: flex;
  align-items: end;
  gap: 0.5rem;
  margin: 1rem 0;
  padding: 0.8rem;
  border-radius: 0.7rem;
  background: var(--forest-soft);
}
.copy-box label {
  flex: 1;
  margin: 0;
}
.bottom-nav {
  display: none;
}

dialog {
  width: min(34rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 1rem;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 24px 80px rgb(0 0 0 / 22%);
}
dialog::backdrop {
  background: rgb(12 22 18 / 58%);
}
#dialog-form {
  padding: 1.25rem;
  overflow: auto;
}
.dialog-heading,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.dialog-actions {
  justify-content: flex-end;
  margin-top: 1.25rem;
}

.family-body {
  min-height: 100dvh;
  background: radial-gradient(circle at 90% 0%, #e2ebe6, transparent 38%),
    var(--paper);
}
.family-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 62rem;
  margin: auto;
  padding: 1.5rem 1rem 1rem;
}
.language-switch {
  display: flex;
  gap: 0.25rem;
}
.language-switch button {
  min-width: 3rem;
  padding: 0.5rem;
}
.language-switch button[aria-pressed="true"] {
  color: #fff;
  border-color: var(--forest);
  background: var(--forest);
}
.family-main {
  width: min(62rem, 100%);
  margin: auto;
  padding: 1rem;
}
.family-main > div > h2 {
  margin: 0.35rem 0 1rem;
  font-size: clamp(1.7rem, 5vw, 2.4rem);
}
.family-children {
  margin-bottom: 1rem;
}
.child-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.child-switcher button[aria-pressed="true"] {
  color: #fff;
  border-color: var(--forest);
  background: var(--forest);
}
.child-profile {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.25rem;
}
.child-profile img {
  width: 6rem;
  height: 6rem;
  object-fit: cover;
  border-radius: 50%;
}
.child-profile h3 {
  margin-top: 0.25rem;
  font-size: 1.45rem;
}
.empty-copy {
  margin-bottom: 0;
  color: var(--muted);
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
    padding-bottom: calc(4.7rem + env(safe-area-inset-bottom));
  }
  .side-nav {
    display: none;
  }
  .topbar {
    padding: 1.1rem 1rem 0.9rem;
  }
  .topbar .brand-mark {
    width: 3rem;
    height: 3rem;
  }
  .account > span {
    display: none;
  }
  #main {
    padding: 1rem;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .access-panel {
    grid-column: auto;
  }
  .section-heading {
    align-items: flex-end;
  }
  .list-item {
    align-items: flex-start;
    flex-direction: column;
  }
  .item-actions {
    width: 100%;
  }
  .item-actions button {
    flex: 1;
  }
  .copy-box {
    align-items: stretch;
    flex-direction: column;
  }
  .schedule-toolbar,
  .lesson-heading,
  .holiday-note {
    align-items: stretch;
    flex-direction: column;
  }
  .schedule-toolbar .tabs {
    overflow-x: auto;
  }
  .schedule-toolbar .tabs button {
    flex: 1 0 auto;
  }
  .lesson-card {
    grid-template-columns: 3.6rem minmax(0, 1fr);
  }
  .lesson-card > button {
    grid-column: 1 / -1;
  }
  .room-grid {
    grid-template-columns: 1fr;
  }
  .bottom-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(4rem, 1fr));
    padding: 0.35rem 0.2rem calc(0.35rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgb(255 255 255 / 96%);
    backdrop-filter: blur(12px);
  }
  .bottom-nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 3.7rem;
    flex-direction: column;
    gap: 0.15rem;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 750;
  }
  .bottom-nav a span:first-child {
    font-size: 1.1rem;
  }
  .bottom-nav a.active {
    color: var(--forest);
  }
}

@media (max-width: 430px) {
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }
  .section-heading > button {
    width: 100%;
  }
  .family-header {
    align-items: flex-start;
  }
  .family-header h1 {
    font-size: 1.55rem;
  }
  .family-brand-mark {
    width: 3rem;
    height: 3rem;
  }
  .child-profile {
    grid-template-columns: 1fr;
  }
  .date-nav {
    width: 100%;
  }
  .date-nav input {
    flex: 1;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
