:root {
  color-scheme: light;
  --bg: #f4efe6;
  --paper: #fffaf2;
  --ink: #1f2933;
  --muted: #5f6c77;
  --line: #dccfbb;
  --shadow: 0 20px 60px rgba(66, 45, 12, 0.08);
  --woodland: #dbeed6;
  --kaiser: #d8ebf4;
  --warm: #f5dfb7;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  overflow-x: hidden;
  min-height: 100vh;
  padding-top: env(safe-area-inset-top, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  background:
    radial-gradient(circle at top left, rgba(219, 238, 214, 0.85), transparent 26%),
    radial-gradient(circle at top right, rgba(216, 235, 244, 0.7), transparent 24%),
    var(--bg);
  overscroll-behavior-y: contain;
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.hero,
.panel,
.timeline-card,
.kid-card {
  border: 1px solid rgba(125, 94, 39, 0.12);
  box-shadow: var(--shadow);
}

.hero {
  display: flex;
  gap: 24px;
  align-items: end;
  background: linear-gradient(135deg, rgba(255, 250, 242, 0.96), rgba(255, 246, 231, 0.92));
  border-radius: 28px;
  padding: 28px;
  margin-bottom: 22px;
}

.hero-edit-link {
  margin-top: 12px;
}

.eyebrow,
.panel-label,
.last-updated,
.timeline-school,
.timeline-time,
.kid-school,
.kid-source,
.notes {
  color: var(--muted);
}

.eyebrow,
.panel-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin-top: 6px;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 0.95;
}

.subtitle {
  margin-top: 14px;
  max-width: 58ch;
  font-size: 1rem;
  line-height: 1.5;
}

.refresh-button {
  display: inline-flex;
  align-items: center;
  border: 0;
  border-radius: 999px;
  background: #1f2933;
  color: white;
  padding: 14px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(125, 94, 39, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  padding: 12px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.secondary-button.is-saved {
  border-color: transparent;
  background: var(--sage);
}

button {
  font: inherit;
}

.layout {
  display: block;
}

.panel {
  border-radius: 24px;
  background: var(--paper);
  padding: 24px;
}

.main-column {
  display: grid;
  gap: 22px;
}

.refresh-panel {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.refresh-panel-copy {
  display: grid;
  gap: 8px;
}

.saved-grades-view,
.saved-reminder-view,
.grade-form {
  display: grid;
  gap: 12px;
}

.notification-form {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.notification-meta {
  min-height: 1lh;
}

.notification-toggle-row,
.notification-time-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.notification-toggle-row span,
.notification-time-row span {
  font-weight: 600;
}

.notification-time-row input,
.notification-toggle-row input[type="checkbox"] {
  font: inherit;
}

.notification-time-row input {
  min-width: 112px;
  border: 1px solid rgba(125, 94, 39, 0.18);
  border-radius: 12px;
  background: white;
  color: var(--ink);
  padding: 10px 12px;
}

.notification-time-row.is-disabled {
  opacity: 0.58;
}

.saved-grades-view .edit-link-button {
  justify-self: start;
}

.edit-link-button {
  width: fit-content;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  text-decoration: underline;
  cursor: pointer;
}

.grade-form .notes {
  padding-left: 0;
}

.grade-checkbox-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.grade-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid rgba(125, 94, 39, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  cursor: pointer;
}

.grade-checkbox input {
  margin: 0;
  accent-color: #1f2933;
}

.grade-picker-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.helper-text {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.grade-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.grade-picker-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.grade-select {
  min-width: 190px;
  border: 1px solid rgba(125, 94, 39, 0.2);
  border-radius: 12px;
  background: white;
  color: var(--ink);
  padding: 10px 12px;
  font: inherit;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 18px;
}

.kids,
.daily-menu,
.kid-events {
  display: grid;
  gap: 14px;
}

.kids {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}

.refresh-last-updated {
  margin-top: 6px;
}

.pill,
.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

.pill-kid[data-accent="woodland"],
.kid-card[data-accent="woodland"] .kid-card-header {
  background: var(--woodland);
}

.pill-kid[data-accent="kaiser"],
.kid-card[data-accent="kaiser"] .kid-card-header {
  background: var(--kaiser);
}

.pill-kind {
  background: #f4ebd8;
}

.pill-source {
  background: #ece7df;
}

.kid-school,
.kid-source,
.notes {
  font-size: 0.94rem;
  line-height: 1.45;
}

.kid-source,
.menu-source-link,
.bell-link {
  overflow-wrap: anywhere;
}

.kid-card {
  background: white;
  border-radius: 22px;
  overflow: hidden;
}

.kid-card-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
  padding: 18px;
}

.kid-card-heading {
  min-width: 0;
}

.kid-card h3 {
  margin-bottom: 4px;
}

.kid-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: end;
  flex-wrap: wrap;
}

.status-badge {
  background: rgba(255, 255, 255, 0.75);
}

.kid-source,
.events-block,
.kid-events {
  padding: 0 18px 18px;
}

.events-block {
  padding-top: 8px;
}

.events-block-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.bell-link {
  color: inherit;
  font-size: 0.88rem;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  white-space: nowrap;
}

body.modal-open {
  overflow: hidden;
}

.menu-card {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.menu-card-footer {
  margin-top: 16px;
}

.bell-modal[hidden] {
  display: none;
}

.bell-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
}

.bell-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 41, 51, 0.42);
  backdrop-filter: blur(4px);
}

.bell-modal-card {
  position: relative;
  width: min(100%, 560px);
  border: 1px solid rgba(125, 94, 39, 0.14);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.98), rgba(255, 247, 235, 0.96));
  box-shadow: 0 28px 70px rgba(37, 28, 10, 0.22);
  padding: 24px;
}

.bell-modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.bell-modal-close {
  border: 0;
  border-radius: 999px;
  background: #1f2933;
  color: white;
  padding: 10px 14px;
  cursor: pointer;
}

.bell-modal-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.bell-modal-section {
  padding: 0;
}

.bell-modal-rows {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.bell-modal-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: baseline;
}

.bell-modal-row span {
  color: var(--muted);
}

.bell-modal-row strong {
  justify-self: end;
  white-space: nowrap;
  text-align: right;
  font-size: 1.02rem;
}

.bell-modal-source {
  color: inherit;
  font-weight: 700;
}

@media (max-width: 720px) {
  .refresh-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .refresh-button {
    justify-content: center;
  }

  .kid-card-actions {
    flex-direction: column;
    align-items: end;
  }
}

.menu-card + .menu-card {
  margin-top: 14px;
}

.weekly-menu-grid {
  display: grid;
  gap: 18px;
  margin-top: 0;
}

.week-row {
  border: 1px solid #ddceb4;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 245, 236, 0.96)),
    #fffdf8;
  padding: 16px;
  box-shadow:
    0 10px 24px rgba(66, 45, 12, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.week-date {
  display: inline-flex;
  align-items: center;
  max-width: fit-content;
  margin-bottom: 12px;
  padding: 6px 10px;
  border: 1px solid #e4d4b8;
  border-radius: 999px;
  background: #fff7e8;
  font-weight: 700;
  line-height: 1.35;
  font-size: 0.96rem;
}

.week-meals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.menu-source-link,
.menu-status,
.meal-empty,
.meal-extras {
  color: var(--muted);
}

.menu-source-link {
  font-size: 0.88rem;
}

.menu-status,
.meal-empty,
.meal-extras,
.meal-primary {
  font-size: 0.94rem;
  line-height: 1.45;
}

.meal-card {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.meal-card .panel-label {
  margin-bottom: 10px;
}

.meal-primary {
  margin: 0;
  padding-left: 18px;
  font-weight: 600;
  font-size: 0.98rem;
}

.meal-primary li + li {
  margin-top: 8px;
}

.meal-extras {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meal-extra-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f2eadc;
  color: #5d5141;
  font-size: 0.8rem;
  line-height: 1.2;
}

.meal-extra-summary {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.menu-status {
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f7efe1;
}

.kid-event-row {
  display: block;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.kid-event-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.kid-event-copy {
  min-width: 0;
}

.event-source-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0.78;
}

.event-source-school {
  background: #eef3e6;
  color: #5f6c77;
}

.event-source-pfo {
  background: #f5ebd9;
  color: #5f6c77;
}

.kid-event-meta {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 8px;
  margin-bottom: 6px;
}

.kid-event-meta-copy {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.kid-event-meta-chip {
  flex-shrink: 0;
}

.kid-event-row strong {
  display: block;
  margin-bottom: 0;
  font-size: 0.94rem;
  line-height: 1.35;
}

.kid-event-row span {
  color: var(--muted);
  font-size: 0.82rem;
}

.notes {
  padding-left: 18px;
  margin: 0;
}

.notes li + li {
  margin-top: 8px;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--muted);
}

.error-state {
  display: grid;
  gap: 10px;
}

.onboarding-state {
  background: rgba(255, 255, 255, 0.74);
}

.error-state p {
  margin: 0;
}

.inline-retry-button {
  justify-self: start;
}

.loading-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  z-index: 40;
  transform: translate(-50%, 16px);
  max-width: min(92vw, 420px);
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(31, 41, 51, 0.94);
  color: white;
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 16px 34px rgba(31, 41, 51, 0.18);
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast[data-visible="true"] {
  opacity: 1;
  transform: translate(-50%, 0);
}

.loading-line {
  height: 14px;
  border-radius: 999px;
  background: #efe5d3;
}

.loading-line-wide {
  width: 82%;
}

.loading-line-short {
  width: 56%;
}

.loading-shimmer {
  position: relative;
  overflow: hidden;
}

.loading-shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.72), transparent);
  animation: loading-shimmer 1.35s infinite;
}

@keyframes loading-shimmer {
  100% {
    transform: translateX(100%);
  }
}

@media (max-width: 860px) {
  .hero,
  .panel-header,
  .kid-card-header,
  .events-block-header,
  .menu-card-header {
    align-items: start;
    flex-direction: column;
  }

  .week-row,
  .week-meals {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .shell {
    padding: 12px 12px 28px;
  }

  .hero {
    gap: 18px;
    border-radius: 22px;
    padding: 20px;
  }

  .panel,
  .menu-card {
    border-radius: 20px;
    padding: 18px;
  }

  .menu-card {
    border-radius: 0;
    padding: 0;
  }

  .kid-card {
    border-radius: 18px;
  }

  .kid-card-header,
  .kid-source,
  .events-block,
  .kid-events {
    padding-left: 14px;
    padding-right: 14px;
  }

  .kid-card-header {
    padding-top: 14px;
  }

  .refresh-button {
    width: 100%;
    justify-content: center;
  }

  .secondary-button {
    width: 100%;
  }

  .week-row {
    padding: 14px;
  }

  .meal-card {
    padding: 0;
  }

  #menuPanel {
    padding: 0;
  }

  #menuPanel .panel-header {
    margin-bottom: 12px;
    padding: 0 6px;
  }

  #menuPanel .daily-menu {
    gap: 0;
  }

  #menuPanel .menu-card {
    border-radius: 20px;
  }
}

.single-kid-panel {
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}

.single-kid-panel .kids {
  gap: 0;
}

.single-kid-panel .kid-card {
  border-radius: 20px;
}

#kidsPanel {
  display: grid;
  gap: 14px;
}

#kidsPanel .kids {
  gap: 14px;
}

#menuPanel {
  display: grid;
  gap: 14px;
}

#menuPanel .panel-header {
  margin-bottom: 0;
}

.legal-links {
  display: flex;
  gap: 8px;
  margin-bottom: 0;
}

.app-footer {
  justify-content: center;
  padding: 24px 0 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.legal-shell {
  width: min(100% - 32px, 720px);
  margin: 0 auto;
  padding: 48px 0 72px;
}

.legal-back-link {
  display: inline-block;
  margin-bottom: 20px;
}

.legal-card {
  padding: clamp(24px, 6vw, 48px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 253, 248, 0.93);
  box-shadow: var(--shadow);
}

.legal-card h1 {
  margin: 4px 0 8px;
}

.legal-card h2 {
  margin: 32px 0 8px;
  font-size: 1.12rem;
}

.legal-card p {
  max-width: 62ch;
  color: var(--ink-soft);
  line-height: 1.65;
}

.legal-updated,
.legal-footer {
  font-size: 0.9rem;
}

.legal-footer {
  margin-top: 34px;
}

@media (max-width: 420px) {
  h1 {
    font-size: 1.8rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  .subtitle,
  .kid-school,
  .kid-source,
  .notes,
  .menu-status,
  .meal-empty,
  .meal-extras,
  .meal-primary {
    font-size: 0.9rem;
  }

  .week-date {
    max-width: 100%;
    white-space: normal;
  }

  .meal-primary {
    padding-left: 16px;
  }

  .meal-extra-pill {
    max-width: 100%;
  }
}
