:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --ink: #17201c;
  --muted: #647067;
  --panel: #ffffff;
  --line: #dfe5df;
  --green: #06c755;
  --green-dark: #048a3c;
  --coral: #e96b4c;
  --alert: #c9362c;
  --shadow: 0 12px 36px rgba(23, 32, 28, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.shell {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0 14px;
}

.topbar-title {
  flex: 1 1 auto;
  min-width: 0;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 1 auto;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
  margin-bottom: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-top: 14px;
}

.hidden {
  display: none !important;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: #eaf7ef;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.status-alert {
  color: var(--alert);
}

.pill.status-alert,
.schedule-status.status-alert {
  background: #fff;
  color: var(--alert);
  box-shadow: inset 0 0 0 1px currentColor;
}

.stack {
  display: grid;
  gap: 14px;
}

.grid-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  display: block;
  width: 100%;
  inline-size: 100%;
  min-width: 0;
  min-inline-size: 0;
  max-width: 100%;
  max-inline-size: 100%;
  height: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font: inherit;
  line-height: 1.2;
}

textarea {
  height: auto;
  min-height: 128px;
  padding: 12px;
  line-height: 1.6;
  resize: vertical;
}

select {
  appearance: auto;
  -webkit-appearance: menulist;
}

input[type="month"],
input[type="time"] {
  appearance: none;
  -webkit-appearance: none;
  line-height: 44px;
  text-align: center;
}

input[type="file"] {
  height: auto;
  min-height: 48px;
  padding: 6px 10px;
  line-height: 34px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

input[type="file"]::file-selector-button {
  min-height: 34px;
  margin: 0 10px 0 0;
  border: 0;
  border-radius: 8px;
  background: #edf2ed;
  color: var(--ink);
  padding: 0 12px;
  font: inherit;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

input[type="month"]::-webkit-date-and-time-value,
input[type="time"]::-webkit-date-and-time-value {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  margin: 0;
  line-height: 44px;
  text-align: center;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  padding: 0 16px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  padding: 0 16px;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
}

.button-link.secondary {
  background: #edf2ed;
  color: var(--ink);
}

.topbar-icon-link {
  display: inline-grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(23, 32, 28, 0.08);
}

.topbar-icon-link:hover {
  border-color: #c8d1c9;
}

.topbar-icon-link svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

button.secondary {
  background: #edf2ed;
  color: var(--ink);
}

button.danger {
  background: #fff1ed;
  color: var(--coral);
  border: 1px solid #f4c6b9;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.children-list {
  display: grid;
  gap: 10px;
}

.child-row {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr 0.8fr 0.8fr 44px;
  gap: 8px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  width: 44px;
  padding: 0;
  background: #fff1ed;
  color: var(--coral);
  border: 1px solid #f4c6b9;
}

.billing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.billing-legal-note {
  margin: 12px 0 0;
  font-size: 13px;
}

.file-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 8px 10px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.file-summary span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.legal-link-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.legal-link {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.legal-link:hover,
.legal-link:focus-visible {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(6, 199, 85, 0.12);
}

.legal-document .topbar {
  align-items: flex-start;
}

.legal-document article {
  display: grid;
  gap: 22px;
}

.legal-document article > section {
  display: grid;
  gap: 8px;
}

.legal-document h2,
.legal-document h3 {
  margin: 0;
}

.legal-document h1 {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.legal-document h3 {
  font-size: 16px;
}

.legal-document p,
.legal-document li {
  line-height: 1.75;
}

.legal-document ol,
.legal-document ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 1.4em;
}

.legal-document a {
  color: var(--green-dark);
  font-weight: 800;
}

.legal-table-wrap {
  overflow-x: auto;
}

.legal-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 14px;
}

.legal-table th,
.legal-table td {
  padding: 12px;
  border: 1px solid var(--line);
  line-height: 1.7;
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.legal-table th {
  width: 32%;
  background: #fbfcfb;
  color: var(--ink);
  text-align: left;
}

.legal-meta {
  color: var(--muted);
  font-size: 13px;
}

.legal-back-link {
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.legal-back-link:hover,
.legal-back-link:focus-visible {
  text-decoration: underline;
}

.guardian-list {
  display: grid;
  gap: 10px;
}

.guardian-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.guardian-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  background: #eaf7ef;
  color: var(--green-dark);
  font-weight: 900;
  overflow: hidden;
}

.guardian-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.guardian-body {
  flex: 1;
  min-width: 0;
}

.guardian-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.invite-url {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.invite-link-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.invite-link-number {
  color: var(--green-dark);
  font-weight: 800;
  flex: 0 0 auto;
}

.invite-link-item a {
  font-weight: 700;
}

.referral-code-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.referral-code-value {
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: 0;
}

.referral-code-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.referral-code-form input {
  text-transform: uppercase;
  font-weight: 800;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-heading h2 {
  margin-bottom: 0;
}

.schedule-list {
  display: grid;
  gap: 12px;
}

.schedule-list-item {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.schedule-list-item:hover,
.schedule-list-item:focus-visible {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(6, 199, 85, 0.12);
}

.schedule-list-media {
  display: grid;
  place-items: center;
  width: 112px;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.schedule-list-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.schedule-pdf-preview {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
}

.schedule-pdf-preview canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.schedule-pdf-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  background: #fff;
}

.schedule-pdf-preview canvas[data-pdf-rendered="true"] + .schedule-pdf-fallback {
  display: none;
}

.schedule-list-media[data-zoom-auth-src],
.review-image-frame[data-zoom-auth-src] {
  cursor: zoom-in;
}

.review-image-frame[data-zoom-auth-src]:focus-visible {
  outline: 3px solid rgba(6, 199, 85, 0.28);
  outline-offset: 3px;
}

.schedule-list-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.schedule-list-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.schedule-list-period,
.schedule-list-children {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-list-children {
  margin-top: 0;
}

.schedule-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  justify-self: start;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eaf7ef;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.schedule-file-link {
  width: 100%;
  min-height: 100%;
  text-align: center;
}

.schedule-file-frame {
  display: grid;
  place-items: center;
  gap: 12px;
  min-height: 220px;
  padding: 18px;
}

.schedule-detail-pdf-preview {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: #fff;
}

.schedule-detail-pdf-preview[data-pdf-zoom-auth-src] {
  cursor: zoom-in;
}

.schedule-detail-pdf-preview[data-pdf-zoom-auth-src]:focus-visible {
  outline: 3px solid rgba(6, 199, 85, 0.28);
  outline-offset: 3px;
}

.review-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(240px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.review-image-frame {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  overflow: hidden;
}

.review-image-frame img {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: #fff;
}

.image-zoom-open {
  overflow: hidden;
}

.image-zoom-dialog {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(23, 32, 28, 0.86);
}

.image-zoom-dialog img,
.image-zoom-dialog canvas {
  display: block;
  width: auto;
  max-width: min(100%, 1040px);
  max-height: calc(100vh - 80px);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
  object-fit: contain;
}

.image-zoom-close {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 1;
  display: inline-grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
}

.review-actions {
  display: grid;
  gap: 14px;
}

.child-choice-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.child-choice-list legend {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.period-choice-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.period-choice-list legend {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.period-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.child-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
  font-size: 15px;
}

.child-choice input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
}

.strong {
  font-weight: 800;
}

.muted {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 18px;
  max-width: 520px;
  margin: 0 auto;
  padding: 12px 14px;
  border-radius: 8px;
  background: #17201c;
  color: #fff;
  text-align: center;
  box-shadow: var(--shadow);
}

.spec-table-wrap {
  overflow-x: auto;
}

.spec-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.55;
}

.spec-table th,
.spec-table td {
  padding: 10px 12px;
  border: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

.spec-table th {
  background: #fbfcfb;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.spec-id {
  color: var(--green-dark);
  font-weight: 900;
  white-space: nowrap;
}

.static-page-story {
  display: block;
  width: 100%;
  min-height: 100vh;
  border: 0;
  background: var(--bg);
}

#storybook-docs .docs-story [id^="story--app-screens--"][data-story-block] {
  display: grid;
  justify-items: center;
}

#storybook-docs .docs-story [id^="story--app-screens--"][data-story-block] > [id$="-inner"] {
  width: min(390px, 100%);
  container: docs-screen-preview / inline-size;
}

@container docs-screen-preview (max-width: 640px) {
  .grid-form,
  .referral-code-form,
  .legal-link-list,
  .period-grid,
  .child-row,
  .review-layout,
  .panel-heading,
  .billing-row {
    grid-template-columns: 1fr;
  }

  .billing-row {
    display: grid;
  }

  .legal-table-wrap {
    overflow-x: visible;
  }

  .legal-table,
  .legal-table tbody,
  .legal-table tr,
  .legal-table th,
  .legal-table td {
    display: block;
    width: 100%;
  }

  .legal-table {
    border: 1px solid var(--line);
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 8px;
    overflow: hidden;
  }

  .legal-table tr {
    margin-bottom: 0;
    border: 0;
    border-radius: 0;
  }

  .legal-table th,
  .legal-table td {
    border: 0;
  }

  .legal-table tr + tr {
    border-top: 1px solid var(--line);
  }

  .legal-table th {
    border-bottom: 1px solid var(--line);
  }

  .file-summary {
    display: grid;
    gap: 8px;
  }

  .icon-button {
    width: 100%;
  }

  .schedule-list-media {
    width: 100%;
  }

  .schedule-list-item {
    grid-template-columns: minmax(82px, 28%) minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }
}

@media (max-width: 640px) {
  .legal-document .topbar {
    display: grid;
    gap: 10px;
  }

  .legal-back-link {
    justify-self: start;
  }

  .grid-form,
  .referral-code-form,
  .legal-link-list,
  .period-grid,
  .child-row,
  .review-layout,
  .panel-heading,
  .billing-row {
    grid-template-columns: 1fr;
  }

  .billing-row {
    display: grid;
  }

  .legal-table-wrap {
    overflow-x: visible;
  }

  .legal-table,
  .legal-table tbody,
  .legal-table tr,
  .legal-table th,
  .legal-table td {
    display: block;
    width: 100%;
  }

  .legal-table {
    border: 1px solid var(--line);
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 8px;
    overflow: hidden;
  }

  .legal-table tr {
    margin-bottom: 0;
    border: 0;
    border-radius: 0;
  }

  .legal-table th,
  .legal-table td {
    border: 0;
  }

  .legal-table tr + tr {
    border-top: 1px solid var(--line);
  }

  .legal-table th {
    border-bottom: 1px solid var(--line);
  }

  .file-summary {
    display: grid;
    gap: 8px;
  }

  .icon-button {
    width: 100%;
  }

  .schedule-list-media {
    width: 100%;
  }

  .schedule-list-item {
    grid-template-columns: minmax(82px, 28%) minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .image-zoom-dialog {
    padding: 64px 12px 18px;
  }

  .image-zoom-dialog img,
  .image-zoom-dialog canvas {
    max-height: calc(100vh - 96px);
  }
}
