:root {
  --bg: #e7eef9;
  --panel: rgba(255, 255, 255, 0.92);
  --ink: #0f2240;
  --muted: #45618d;
  --accent: #1a4f9d;
  --accent-dark: #0b3470;
  --gold: #f4bf2a;
  --warn-bg: #fff2d6;
  --border: rgba(15, 34, 64, 0.12);
  --danger: #c72d2d;
  --success: #1d7a56;
  --success-bg: rgba(29, 122, 86, 0.12);
  --shadow: 0 24px 55px rgba(11, 52, 112, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(244, 191, 42, 0.3), transparent 26%),
    radial-gradient(circle at right, rgba(26, 79, 157, 0.2), transparent 32%),
    linear-gradient(180deg, #f7fbff 0%, var(--bg) 100%);
}

.app-shell {
  width: min(1140px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.masthead {
  padding: 24px;
  margin-bottom: 24px;
  background:
    radial-gradient(circle at top left, rgba(244, 191, 42, 0.18), transparent 24%),
    linear-gradient(135deg, #ffffff 0%, #eef5ff 55%, #e8f0fb 100%);
  border-color: rgba(15, 34, 64, 0.1);
}

.masthead-top,
.masthead-bottom,
.brand-lockup,
.manager-bar,
.manager-actions,
.view-switcher,
.view-switcher-tabs {
  display: flex;
  align-items: center;
  gap: 16px;
}

.masthead-top,
.masthead-bottom,
.view-switcher {
  justify-content: space-between;
}

.masthead-top {
  margin-bottom: 18px;
}

.masthead-bottom {
  justify-content: flex-start;
  gap: 18px;
}

.brand-badge {
  width: 82px;
  height: 112px;
  object-fit: contain;
  filter: drop-shadow(0 16px 26px rgba(11, 52, 112, 0.14));
}

.brand-copy {
  display: grid;
  gap: 6px;
}

.view-switcher {
  margin-bottom: 24px;
  padding: 16px 20px;
}

.view-switcher-copy {
  display: grid;
  gap: 6px;
}

.view-switcher h2 {
  margin: 0;
  font-size: 1.15rem;
}

.view-switcher-tabs {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.view-tab {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(15, 34, 64, 0.12);
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent-dark);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.view-tab.active {
  background: linear-gradient(135deg, rgba(26, 79, 157, 0.98) 0%, rgba(11, 52, 112, 0.98) 100%);
  color: white;
  border-color: transparent;
}

.auth-panel {
  margin-bottom: 24px;
}

.manager-identity,
.last-login-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

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

.eyebrow,
.section-kicker,
.hero-label,
.data-label {
  margin: 0 0 8px;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 700;
}

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

h1 {
  margin: 0;
  font-size: clamp(2rem, 3.8vw, 3rem);
  line-height: 0.98;
  max-width: 14ch;
}

.hero-copy,
.hero-subtext,
.access-copy,
.access-hint,
.stat-copy,
.records-helper,
.slot-helper,
.consent-copy p {
  color: var(--muted);
  max-width: 60ch;
}

.access-mode,
.manager-badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.access-mode,
.manager-badge {
  background: rgba(26, 79, 157, 0.1);
  color: var(--accent-dark);
}

.manager-bar {
  justify-content: space-between;
  align-items: center;
  min-width: 320px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(15, 34, 64, 0.08);
}

.manager-meta {
  display: grid;
  gap: 6px;
}

.manager-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-link-button,
.icon-button {
  border: none;
  background: transparent;
  color: var(--accent-dark);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.top-link-button {
  min-height: 40px;
  padding: 0 2px;
  border-bottom: 2px solid rgba(26, 79, 157, 0.25);
}

.top-logout-button {
  min-height: 40px;
  padding: 0 14px;
}

.top-edit-button {
  min-height: 40px;
  padding: 0 14px;
}

.top-edit-button.active {
  background: linear-gradient(135deg, rgba(26, 79, 157, 0.98) 0%, rgba(11, 52, 112, 0.98) 100%);
  color: white;
  border-color: transparent;
}

.top-link-button:hover,
.icon-button:hover {
  color: var(--accent);
}

.hero-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.hero-card {
  width: min(520px, 100%);
  padding: 18px 22px;
  background: linear-gradient(180deg, rgba(26, 79, 157, 0.98) 0%, rgba(11, 52, 112, 0.98) 100%);
  color: white;
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 34px rgba(11, 52, 112, 0.18);
}

.hero-card strong {
  font-size: 1.55rem;
  line-height: 1.1;
  margin-bottom: 10px;
}

.hero-card .hero-label,
.hero-card .hero-subtext {
  color: rgba(255, 255, 255, 0.88);
}

.panel {
  padding: 20px;
  margin-bottom: 24px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}

.content-grid.form-hidden {
  grid-template-columns: 1fr;
}

.panel-heading {
  margin-bottom: 14px;
}

.panel-heading h2 {
  margin-bottom: 0;
  font-size: 1.3rem;
}

.stat-card {
  margin-bottom: 0;
}

.stat-value {
  display: block;
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--accent-dark);
  margin-bottom: 8px;
}

.manager-tools {
  padding: 16px;
  border-radius: 18px;
  background: rgba(26, 79, 157, 0.04);
}

.login-form,
.kid-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.kid-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.login-form label,
.kid-form label,
.admission-grid label,
.admission-group > label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 0.92rem;
}

.form-message {
  margin: 0;
  align-self: end;
  color: var(--muted);
  font-size: 0.9rem;
}

.login-form input,
.kid-form input,
.kid-form select,
.admission-form input,
.admission-form select,
.admission-form textarea,
.primary-btn,
.secondary-btn,
.danger-btn,
.renew-btn {
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font: inherit;
}

.login-form input,
.kid-form input,
.kid-form select,
.admission-form input,
.admission-form select,
.admission-form textarea {
  padding: 0 14px;
  background: #ffffff;
}

.admission-form textarea {
  min-height: 104px;
  padding: 12px 14px;
  resize: vertical;
}

.kid-form input:disabled,
.kid-form select:disabled,
.admission-form input:disabled,
.admission-form select:disabled {
  cursor: not-allowed;
  background: #f3eee4;
  color: #7a837d;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.renew-btn {
  padding: 0 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.primary-btn {
  align-self: end;
  border: none;
  background: linear-gradient(135deg, var(--gold) 0%, #ffd86c 100%);
  color: var(--accent-dark);
}

.secondary-btn {
  background: white;
  color: var(--accent-dark);
}

.danger-btn {
  min-height: 40px;
  background: white;
  color: var(--danger);
  border-color: rgba(155, 28, 28, 0.18);
}

.renew-btn {
  min-height: 40px;
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(29, 122, 86, 0.2);
}

.primary-btn:hover,
.secondary-btn:hover,
.danger-btn:hover,
.renew-btn:hover,
.view-tab:hover {
  transform: translateY(-1px);
}

.editor-lock {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(26, 79, 157, 0.06);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
}

.records-panel {
  min-height: 100%;
}

.slot-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(15, 34, 64, 0.08);
  border-radius: 18px;
  background: rgba(26, 79, 157, 0.03);
}

.slot-toolbar-copy {
  display: grid;
  gap: 4px;
}

.slot-helper {
  margin: 0;
  font-size: 0.86rem;
}

.slot-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.slot-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(15, 34, 64, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--accent-dark);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}

.slot-chip strong {
  font-size: 0.88rem;
}

.slot-chip.active {
  background: linear-gradient(135deg, rgba(26, 79, 157, 0.98) 0%, rgba(11, 52, 112, 0.98) 100%);
  color: white;
  border-color: transparent;
}

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

.kids-table {
  width: 100%;
  border-collapse: collapse;
}

.kids-table th,
.kids-table td {
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-size: 0.92rem;
}

.kids-table th {
  color: var(--muted);
  font-size: 0.82rem;
}

.kids-table tbody tr.alert-row {
  background: var(--warn-bg);
}

.status-pill,
.alert-pill,
.type-pill,
.state-pill,
.slot-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.85rem;
  font-weight: 700;
}

.status-paid {
  background: rgba(26, 79, 157, 0.12);
  color: var(--accent-dark);
}

.status-unpaid {
  background: rgba(155, 28, 28, 0.12);
  color: var(--danger);
}

.alert-pill {
  background: rgba(244, 191, 42, 0.22);
  color: #8d6400;
}

.alert-pill.safe {
  background: rgba(29, 122, 86, 0.12);
  color: var(--success);
}

.type-pill.new {
  background: rgba(26, 79, 157, 0.12);
  color: var(--accent-dark);
}

.type-pill.returning {
  background: rgba(244, 191, 42, 0.22);
  color: #8d6400;
}

.state-pill.active {
  background: rgba(29, 122, 86, 0.12);
  color: var(--success);
}

.state-pill.discontinued {
  background: rgba(69, 97, 141, 0.12);
  color: var(--muted);
}

.slot-pill {
  background: rgba(26, 79, 157, 0.09);
  color: var(--accent-dark);
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-note {
  color: var(--muted);
  font-size: 0.82rem;
}

.meta-text {
  display: inline-block;
  color: rgba(69, 97, 141, 0.78);
  font-size: 0.78rem;
  line-height: 1.25;
}

.form-panel .section-kicker,
.records-panel .section-kicker {
  font-size: 0.72rem;
}

.form-panel h2,
.records-panel h2 {
  font-size: 1.2rem;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
}

.admission-panel {
  padding: 20px;
}

.admission-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.admission-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(15, 34, 64, 0.08);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(26, 79, 157, 0.06), rgba(244, 191, 42, 0.12));
}

.admission-reg-value {
  display: block;
  font-size: 1.65rem;
  line-height: 1;
  color: var(--accent-dark);
}

.admission-form {
  display: grid;
  gap: 14px;
}

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

.admission-column {
  display: grid;
  gap: 14px;
}

.admission-group {
  padding: 14px;
  border: 1px solid rgba(15, 34, 64, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.admission-group-head {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.admission-group-head h3 {
  margin: 0;
  font-size: 1rem;
}

.admission-grid {
  display: grid;
  gap: 10px;
}

.admission-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admission-grid.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dob-grid {
  grid-template-columns: 120px 180px 140px 120px;
  align-items: end;
}

.compact-head .section-kicker {
  margin-bottom: 4px;
  font-size: 0.7rem;
}

.compact-grid label,
.compact-grid .checkbox-row,
.compact-option-block label {
  font-size: 0.86rem;
}

.compact-grid input,
.compact-grid select,
.compact-grid textarea {
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.92rem;
}

.compact-grid textarea {
  min-height: 72px;
  padding: 10px 12px;
}

.compact-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dob-compact-row {
  display: grid;
  grid-template-columns: 88px 120px 112px 92px;
  gap: 10px;
  align-items: end;
}

.data-tile {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(15, 34, 64, 0.08);
  background: rgba(26, 79, 157, 0.05);
}

.compact-data-tile {
  min-height: 38px;
  justify-content: center;
}

.data-value {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--accent-dark);
}

.full-span {
  grid-column: 1 / -1;
}

.single-check-row {
  margin-bottom: 8px;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
}

.checkbox-row input {
  min-height: auto;
}

.option-block {
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(15, 34, 64, 0.08);
  border-radius: 16px;
  display: grid;
  gap: 8px;
}

.option-block legend {
  padding: 0 8px;
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--accent-dark);
}

.compact-inline-choice {
  margin-bottom: 10px;
}

.starter-choice {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(15, 34, 64, 0.08);
  border-radius: 16px;
  background: rgba(26, 79, 157, 0.05);
}

.admission-style-layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 10px;
}

.compact-option-block {
  gap: 7px;
}

.style-option-block {
  align-content: start;
}

.style-option-block legend {
  margin-bottom: 4px;
}

.style-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid rgba(15, 34, 64, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink);
}

.style-choice:has(input:checked) {
  border-color: rgba(26, 79, 157, 0.24);
  background: rgba(26, 79, 157, 0.08);
  color: var(--accent-dark);
}

.style-choice input {
  margin: 0;
}

.admission-style-layout.disabled {
  opacity: 0.55;
}

.admission-style-layout.disabled .style-choice {
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.58);
}

.consent-copy {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.compact-consent-copy {
  gap: 0;
  margin-bottom: 10px;
}

.compact-consent-copy p {
  font-size: 0.85rem;
  line-height: 1.45;
}

.consent-grid {
  display: grid;
  gap: 12px;
}

.compact-consent-grid {
  gap: 8px;
}

.consent-row {
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(26, 79, 157, 0.05);
}

.admission-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.global-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1000;
  min-width: 240px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(26, 79, 157, 0.98) 0%, rgba(11, 52, 112, 0.98) 100%);
  color: white;
  box-shadow: 0 18px 38px rgba(11, 52, 112, 0.24);
  font-size: 0.95rem;
  font-weight: 700;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1040px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kid-form {
    grid-template-columns: 1fr;
  }

  .admission-heading,
  .admission-banner {
    display: grid;
  }

  .admission-compact-layout {
    grid-template-columns: 1fr;
  }

  .compact-grid-three,
  .compact-grid-two,
  .dob-compact-row,
  .admission-style-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .slot-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .slot-filters {
    justify-content: flex-start;
  }

  .masthead-top,
  .masthead-bottom,
  .view-switcher {
    flex-direction: column;
    align-items: stretch;
  }

  .manager-bar,
  .hero-card {
    min-width: 0;
  }

  .global-toast {
    right: 16px;
    bottom: 16px;
  }

  .view-switcher-tabs {
    justify-content: flex-start;
  }
}

@media (max-width: 860px) {
  .login-form {
    grid-template-columns: 1fr;
  }

  .masthead-top,
  .masthead-bottom,
  .brand-lockup,
  .manager-bar {
    display: grid;
  }

  .manager-actions {
    justify-content: stretch;
  }

  .brand-lockup,
  .brand-copy {
    justify-content: center;
    text-align: center;
  }

  .form-message {
    align-self: start;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .app-shell {
    width: calc(100% - 16px);
    padding: 18px 0 34px;
  }

  .panel,
  .masthead,
  .view-switcher,
  .admission-panel {
    border-radius: 20px;
  }

  .brand-badge {
    width: 72px;
    height: 96px;
  }

  h1 {
    font-size: 1.85rem;
    max-width: none;
  }

  .hero-copy,
  .records-helper,
  .stat-copy {
    font-size: 0.9rem;
  }

  .hero-card {
    width: 100%;
    padding: 16px 18px;
  }

  .hero-card strong {
    font-size: 1.3rem;
  }

  .view-tab {
    min-height: 40px;
    padding: 0 14px;
    font-size: 0.88rem;
  }

  .slot-toolbar {
    padding: 12px;
  }

  .slot-chip {
    min-height: 36px;
    padding: 0 12px;
    font-size: 0.8rem;
  }

  .kids-table th,
  .kids-table td {
    padding: 8px 8px;
    font-size: 0.84rem;
  }

  .admission-panel {
    padding: 14px;
  }

  .admission-banner {
    padding: 12px 14px;
  }

  .admission-reg-value {
    font-size: 1.45rem;
  }

  .admission-group {
    padding: 12px;
  }

  .admission-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .admission-actions .primary-btn,
  .admission-actions .secondary-btn {
    width: 100%;
  }
}
