@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=Sora:wght@500;600;700&display=swap');

:root {
  --bg: #f4f7f8;
  --surface: #ffffff;
  --surface-soft: #eef4f5;
  --text: #1d2d35;
  --muted: #6a7c86;
  --line: #d8e1e5;
  --primary: #0f766e;
  --primary-strong: #115e59;
  --accent: #d97706;
  --danger: #b42318;
  --success: #15803d;
  --radius: 14px;
  --shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--text);
  background: radial-gradient(1000px 400px at 0% -20%, #d4efe9 0%, rgba(212, 239, 233, 0) 70%),
              radial-gradient(900px 360px at 100% -10%, #fde8d2 0%, rgba(253, 232, 210, 0) 70%),
              var(--bg);
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: 'Sora', sans-serif;
}

a { color: inherit; text-decoration: none; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  background: linear-gradient(160deg, #0f172a, #103a46);
  color: #dbe9ef;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(145deg, #14b8a6, #f59e0b);
  display: grid;
  place-items: center;
  color: #052e2b;
  font-weight: 700;
}

.brand h1 { font-size: 1rem; }
.brand p { margin: 4px 0 0; font-size: .75rem; color: #9fb1bb; }

.menu { display: grid; gap: 6px; }
.menu a {
  padding: 11px 12px;
  border-radius: 10px;
  color: #c7d7df;
  font-weight: 500;
  transition: .2s ease;
}
.menu a:hover,
.menu a.active {
  background: rgba(255,255,255,.12);
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 6px;
  color: #9fb1bb;
  font-size: .85rem;
}

.sidebar-footer a { color: #ffd9a8; }

.main {
  padding: 24px;
  display: grid;
  gap: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.page-title p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: .9rem;
}

.mobile-toggle {
  display: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid #edf1f3;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.kpi {
  padding: 16px;
}

.kpi .label { color: var(--muted); font-size: .82rem; }
.kpi .value { font-family: 'Sora', sans-serif; font-size: 1.45rem; margin-top: 6px; }

.kpi.primary { border-left: 5px solid var(--primary); }
.kpi.accent { border-left: 5px solid var(--accent); }
.kpi.success { border-left: 5px solid var(--success); }
.kpi.danger { border-left: 5px solid var(--danger); }

.grid-2 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
}

.panel-head {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-body { padding: 16px; }

.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
}

.table th, .table td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid #ecf0f2;
}

.table th { color: var(--muted); font-weight: 600; }

.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: .75rem;
  font-weight: 600;
}
.badge.ok { background: #dcfce7; color: #166534; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.alert { background: #fee2e2; color: #991b1b; }

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
}

.btn-soft {
  background: #eff7f6;
  color: var(--primary-strong);
  border: 1px solid #d0ebe7;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label { font-size: .84rem; color: var(--muted); }
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #d6e1e5;
  border-radius: 10px;
  padding: 10px;
  font: inherit;
  background: #fff;
}

.field textarea { min-height: 90px; resize: vertical; }

.flash {
  padding: 10px 12px;
  border-radius: 10px;
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.login-card {
  width: min(430px, 100%);
  padding: 24px;
  border-radius: 18px;
  background: rgba(255,255,255,.92);
  border: 1px solid #dce7eb;
  box-shadow: var(--shadow);
}

.login-card p {
  color: var(--muted);
  margin: 8px 0 18px;
}

.kid-login {
  background:
    radial-gradient(circle at 12% 10%, #ffd9e8 0, #ffd9e800 18%),
    radial-gradient(circle at 88% 12%, #fff1a8 0, #fff1a800 20%),
    linear-gradient(180deg, #fff9ec 0%, #f8fbff 100%);
}

.kid-login .login-card {
  border: 2px solid #ffe39c;
  background: linear-gradient(160deg, rgba(255, 255, 255, .95), rgba(255, 246, 226, .95));
}

.kid-login-icons {
  font-size: 2rem;
  margin-bottom: 8px;
}

.error {
  color: var(--danger);
  font-size: .78rem;
}

@media (max-width: 1080px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    transform: translateX(-100%);
    transition: .25s ease;
    z-index: 30;
  }

  .app-shell.sidebar-open .sidebar { transform: translateX(0); }
  .mobile-toggle { display: inline-flex; }
  .main { padding: 14px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

/* Kid-friendly dashboard theme (scoped only to dashboard page) */
.kid-dashboard {
  background:
    radial-gradient(circle at 12% 8%, #ffe1ef 0, #ffe1ef00 18%),
    radial-gradient(circle at 88% 10%, #fff2bf 0, #fff2bf00 20%),
    radial-gradient(circle at 38% 82%, #d6fff3 0, #d6fff300 20%),
    linear-gradient(180deg, #fffaf0 0%, #f7fbff 58%, #eef8ff 100%);
  background-attachment: fixed;
}

.kid-dashboard .sidebar {
  background: linear-gradient(180deg, #3f2c8f 0%, #1c5fa8 52%, #0ca7a2 100%);
}

.kid-dashboard .menu a.active,
.kid-dashboard .menu a:hover {
  background: rgba(255, 255, 255, 0.2);
}

.kid-hero {
  position: relative;
  overflow: hidden;
  padding: 20px 22px;
  min-height: 170px;
  border-radius: 22px;
  border: 2px solid #ffe39c;
  background: linear-gradient(135deg, #fff2a7 0%, #ffd4ec 45%, #c8ecff 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.kid-hero h1 {
  font-size: 1.35rem;
  color: #23346b;
  line-height: 1.2;
  max-width: 68%;
  position: relative;
  z-index: 3;
}

.kid-hero p {
  margin: 8px 0 0;
  font-weight: 600;
  color: #354978;
  max-width: 68%;
  position: relative;
  z-index: 3;
}

.kid-sticker {
  position: absolute;
  font-size: 2.8rem;
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .12));
  z-index: 2;
  width: 96px;
  height: 96px;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  color: transparent;
  overflow: hidden;
  user-select: none;
  pointer-events: none;
}

.kid-sticker.sun {
  top: 2px;
  right: 18px;
  background-image: url('/img/kids/sun.svg');
}

.kid-sticker.cloud {
  top: 30px;
  right: 108px;
  width: 108px;
  background-image: url('/img/kids/cloud.svg');
}

.kid-sticker.rainbow {
  bottom: 0;
  right: 20px;
  width: 110px;
  height: 74px;
  background-image: url('/img/kids/rainbow.svg');
}

@media (max-width: 860px) {
  .kid-hero {
    min-height: 150px;
    padding: 18px 16px;
  }
  .kid-hero h1,
  .kid-hero p {
    max-width: 100%;
    padding-right: 86px;
  }
  .kid-sticker {
    width: 78px;
    height: 78px;
  }
  .kid-sticker.cloud {
    right: 80px;
    top: 32px;
    width: 86px;
  }
  .kid-sticker.rainbow {
    width: 88px;
    height: 58px;
    right: 12px;
  }
}

.kid-dashboard .kid-card {
  border-radius: 20px;
  border: 2px solid #f6f0ff;
  box-shadow: 0 10px 24px rgba(35, 52, 107, 0.12);
}

.kid-dashboard .kpi.primary {
  background: linear-gradient(145deg, #ecfeff, #dbeafe);
  border-left-color: #3b82f6;
}

.kid-dashboard .kpi.accent {
  background: linear-gradient(145deg, #fff7ed, #ffedd5);
  border-left-color: #f97316;
}

.kid-dashboard .kpi.danger {
  background: linear-gradient(145deg, #fef2f2, #ffe4e6);
  border-left-color: #ef4444;
}

.kid-dashboard .kpi.success {
  background: linear-gradient(145deg, #ecfdf5, #dcfce7);
  border-left-color: #22c55e;
}

.kid-dashboard .card {
  border-radius: 20px;
  border: 2px solid #eef3ff;
  box-shadow: 0 10px 24px rgba(51, 65, 85, 0.10);
}

.kid-dashboard .panel-head {
  background: linear-gradient(180deg, #ffffff, #f6faff);
  border-bottom: 2px solid #ecf2ff;
}

.kid-dashboard .table th {
  color: #475569;
}

.kid-dashboard .table td {
  background: rgba(255, 255, 255, 0.65);
}

.kid-dashboard .table tr:hover td {
  background: #f3f9ff;
}

.kid-dashboard .field input,
.kid-dashboard .field select,
.kid-dashboard .field textarea {
  border: 2px solid #d7e8ff;
  border-radius: 14px;
}

.kid-dashboard .field input:focus,
.kid-dashboard .field select:focus,
.kid-dashboard .field textarea:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.16);
}

.kid-dashboard .btn-primary {
  background: linear-gradient(135deg, #ff6b6b, #ff9f43);
}

.kid-dashboard .btn-soft {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: #0c4a6e;
}

/* Compact mode for pages that should feel less visually large */
.kid-dashboard.compact-page .main {
  gap: 14px;
}

.kid-dashboard.compact-page .kid-hero {
  min-height: 138px;
  padding: 14px 18px;
}

.kid-dashboard.compact-page .kid-hero h1 {
  font-size: 1.1rem;
}

.kid-dashboard.compact-page .kid-hero p {
  font-size: .88rem;
}

.kid-dashboard.compact-page .kid-sticker {
  width: 78px;
  height: 78px;
}

.kid-dashboard.compact-page .kid-sticker.cloud {
  width: 86px;
  right: 84px;
}

.kid-dashboard.compact-page .kid-sticker.rainbow {
  width: 86px;
  height: 56px;
}

.kid-dashboard.compact-page .kpi .value {
  font-size: 1.2rem;
}

.public-registration {
  background: #ffffff;
}

.registration-page {
  width: min(980px, 100%);
  margin: 0 auto;
  min-height: 100vh;
  background: #fff;
  border-left: 1px solid #e5e7eb;
  border-right: 1px solid #e5e7eb;
}

.registration-banner {
  min-height: 236px;
  padding: 28px 44px;
  color: #fff;
  background:
    radial-gradient(circle at 8px 8px, rgba(255, 255, 255, .12) 2px, transparent 3px) 0 0 / 24px 24px,
    linear-gradient(135deg, #7b2ba3, #8f36ad);
  display: grid;
  grid-template-columns: 150px 1fr 170px;
  gap: 20px;
  align-items: start;
}

.registration-logo {
  display: grid;
  justify-items: center;
  gap: 10px;
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  text-align: center;
}

.logo-book {
  width: 112px;
  height: 112px;
  border: 4px solid #f7d85b;
  border-radius: 18px 18px 28px 28px;
  display: grid;
  place-items: center;
  color: #f7d85b;
  font-size: 1.8rem;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.2);
}

.registration-title {
  text-align: center;
  display: grid;
  gap: 4px;
}

.registration-title p,
.registration-title span {
  font-family: 'Sora', sans-serif;
  font-size: .95rem;
}

.registration-title h1 {
  margin-top: 12px;
  text-transform: uppercase;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.registration-social {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: .82rem;
}

.registration-social strong {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: #315baa;
  color: #fff;
  font-family: Georgia, serif;
  font-size: 1.7rem;
  border-radius: 4px;
}

.registration-form {
  padding: 18px 94px 0;
  display: grid;
  gap: 28px;
}

.registration-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 22px;
  padding-bottom: 26px;
  border-bottom: 18px solid #7b2ba3;
}

.registration-section h2 {
  grid-column: 1 / -1;
  justify-self: center;
  width: min(760px, 100%);
  padding: 12px 20px;
  border-radius: 8px;
  background: #7b2ba3;
  color: #fff;
  text-align: center;
  text-transform: uppercase;
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.registration-section h3 {
  grid-column: 1 / -1;
  text-align: center;
  text-transform: uppercase;
  font-size: 1rem;
}

.photo-box {
  grid-column: 1 / -1;
  justify-self: center;
  width: 180px;
  aspect-ratio: 1 / 1;
  border: 4px solid #a6a6a6;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: #777;
}

.registration-section .field label {
  color: #2f2f35;
  font-family: 'Sora', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
}

.registration-section .field input,
.registration-section .field select,
.registration-section .field textarea {
  border: 4px solid #a8a8a8;
  border-radius: 6px;
  min-height: 48px;
  font-size: 1rem;
}

.registration-section .field textarea {
  min-height: 76px;
}

.registration-section .field input:focus,
.registration-section .field select:focus,
.registration-section .field textarea:focus {
  outline: none;
  border-color: #7b2ba3;
  box-shadow: 0 0 0 4px rgba(123, 43, 163, .14);
}

.span-2,
.family-block,
.health-panel,
.registration-footer-grid,
.registration-actions {
  grid-column: 1 / -1;
}

.family-block {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 22px;
}

.family-block + .family-block {
  margin-top: 18px;
}

.health-panel {
  border: 1px solid #c9c9c9;
  border-radius: 6px;
  padding: 22px;
}

.health-panel p {
  margin: 0 0 16px;
  font-size: 1.45rem;
  color: #111;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 3px solid #111;
  margin-bottom: 20px;
}

.health-grid label {
  min-height: 52px;
  padding: 10px 12px;
  border: 2px solid #111;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
}

.health-panel input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: #7b2ba3;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 10px;
}

.registration-footer-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 38px;
  align-items: end;
}

.signature-field input {
  min-height: 108px;
}

.office-box {
  border: 4px solid #111;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.office-box div {
  display: grid;
  grid-template-columns: 1fr 150px;
  align-items: center;
  gap: 10px;
}

.office-box i {
  display: block;
  min-height: 38px;
  border: 3px solid #111;
}

.registration-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 4px;
}

.registration-actions .btn {
  min-width: 150px;
}

@media (max-width: 860px) {
  .registration-page {
    border: 0;
  }

  .registration-banner {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 24px 18px;
    text-align: center;
  }

  .registration-form {
    padding: 14px 16px 0;
  }

  .registration-section,
  .family-block,
  .registration-footer-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

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

  .office-box div {
    grid-template-columns: 1fr;
  }

  .registration-actions {
    flex-direction: column-reverse;
  }

  .registration-actions .btn {
    width: 100%;
  }
}

/* Professional public student registration page */
.public-registration {
  min-height: 100vh;
  background:
    
    
    radial-gradient(circle at 10% 12%, rgba(255, 218, 121, .36) 0 120px, transparent 121px),
    radial-gradient(circle at 92% 8%, rgba(125, 211, 252, .34) 0 150px, transparent 151px),
    radial-gradient(circle at 18% 88%, rgba(187, 247, 208, .34) 0 140px, transparent 141px),
    linear-gradient(180deg, #fffaf0 0%, #f5fbff 46%, #eff8f4 100%);
  padding: 30px 16px 44px;
}

.registration-page-pro {
  width: min(1120px, 100%);
  margin: 0 auto;
  min-height: auto;
  border: 0;
  background: transparent;
}

.registration-hero {
  position: relative;
  overflow: hidden;
  min-height: 260px;
  padding: 30px clamp(20px, 4vw, 46px);
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 26px;
  color: #ffffff;
  background:
    
    radial-gradient(circle at 13% 16%, rgba(255, 231, 143, .38) 0 78px, transparent 80px),
    radial-gradient(circle at 88% 22%, rgba(255, 255, 255, .16) 0 115px, transparent 116px),
    linear-gradient(135deg, #5b1f7a 0%, #7c2fa3 52%, #a13aba 100%);
  box-shadow: 0 24px 60px rgba(42, 12, 61, .34);
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 180px;
  gap: 24px;
  align-items: center;
}

.registration-hero::after {
  content: "";
  position: absolute;
  inset: auto 28px -42px auto;
  width: 210px;
  height: 110px;
  background: url('/img/kids/rainbow.svg') center / contain no-repeat;
  opacity: .95;
}

.registration-logo,
.registration-title,
.registration-social {
  position: relative;
  z-index: 2;
}

.registration-logo {
  align-self: center;
  padding: 16px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(255, 255, 255, .78);
  box-shadow: 0 14px 28px rgba(15, 23, 42, .08);
  color: #4b176d;
}

.logo-book {
  width: 88px;
  height: 88px;
  border: 0;
  border-radius: 24px;
  background: linear-gradient(145deg, #16a085, #47d4bd);
  color: #fff;
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, .08), 0 12px 24px rgba(22, 160, 133, .25);
}

.registration-title {
  text-align: left;
  gap: 7px;
}

.registration-pill {
  width: max-content;
  max-width: 100%;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .95);
  color: #5b1f7a;
  border: 1px solid rgba(255, 255, 255, .78);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.registration-title p,
.registration-title span {
  color: #f8eaff;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(42, 12, 61, .35);
}

.registration-title h1 {
  margin-top: 6px;
  color: #ffffff;
  text-shadow: 0 3px 10px rgba(42, 12, 61, .42);
  text-transform: none;
  font-size: clamp(2rem, 4vw, 3.45rem);
  line-height: 1.04;
}

.registration-social {
  justify-self: end;
  align-self: start;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .92);
  color: #4b176d;
  box-shadow: 0 12px 24px rgba(42, 12, 61, .18);
}

.registration-social strong {
  border-radius: 11px;
  background: #4b176d;
}

.registration-bubbles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.registration-bubbles span {
  position: absolute;
  display: block;
  border-radius: 50%;
  background: rgba(255, 255, 255, .55);
}

.registration-bubbles span:nth-child(1) { width: 74px; height: 74px; left: 26px; bottom: 26px; }
.registration-bubbles span:nth-child(2) { width: 42px; height: 42px; right: 235px; top: 28px; }
.registration-bubbles span:nth-child(3) { width: 56px; height: 56px; right: 88px; bottom: 88px; }

.registration-form {
  width: min(980px, calc(100% - 28px));
  margin: -34px auto 0;
  padding: 0 0 28px;
  display: grid;
  gap: 18px;
  position: relative;
  z-index: 4;
}

.registration-form .flash {
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 12px 24px rgba(22, 101, 52, .10);
}

.registration-section {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
  padding: 24px;
  border: 1px solid #e2edf2;
  border-bottom: 1px solid #e2edf2;
  border-radius: 22px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 18px 48px rgba(30, 64, 86, .10);
}

.registration-section h2 {
  justify-self: stretch;
  padding: 0 0 14px;
  border-radius: 0;
  background: transparent;
  color: #15324a;
  border-bottom: 2px solid #edf4f7;
  text-align: left;
  text-transform: none;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
}

.registration-section h2::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 9px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #22c55e);
  vertical-align: 2px;
}

.registration-section h3 {
  color: #486171;
  text-align: left;
  text-transform: none;
  font-size: 1rem;
}

.photo-box {
  width: 138px;
  border: 2px dashed #9fd8e7;
  border-radius: 18px;
  background: #f5fcff;
  color: #447184;
  font-weight: 700;
}

.registration-section .field {
  gap: 7px;
}

.registration-section .field label {
  color: #405767;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: .86rem;
  font-weight: 700;
  text-transform: none;
}

.registration-section .field input,
.registration-section .field select,
.registration-section .field textarea {
  border: 1px solid #d8e7ee;
  border-radius: 14px;
  min-height: 46px;
  padding: 11px 13px;
  color: #183244;
  background: #fbfdfe;
  font-size: .95rem;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.registration-section .field textarea {
  min-height: 92px;
}

.registration-section .field input:focus,
.registration-section .field select:focus,
.registration-section .field textarea:focus {
  outline: none;
  border-color: #38bdf8;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(56, 189, 248, .14);
}

.family-block {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  padding: 18px;
  border-radius: 18px;
  background: #f8fbfc;
  border: 1px solid #e6f0f4;
}

.family-block + .family-block {
  margin-top: 2px;
}

.health-panel {
  border: 1px solid #e2edf2;
  border-radius: 18px;
  padding: 18px;
  background: #f8fbfc;
}

.health-panel p {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 700;
  color: #405767;
}

.health-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  border: 0;
  margin-bottom: 16px;
}

.health-grid label {
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid #dcebf1;
  border-radius: 14px;
  background: #fff;
  color: #294356;
}

.health-panel input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #0ea5e9;
}

.inline-check {
  min-height: 38px;
}
.inline-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #0ea5e9;
}

.registration-footer-grid {
  grid-template-columns: minmax(0, 1fr) minmax(320px, .95fr);
  gap: 18px;
}

.signature-field input {
  min-height: 72px;
}

.office-box {
  border: 1px dashed #b9cbd4;
  border-radius: 18px;
  padding: 16px;
  background: #fffdf6;
}

.office-box strong {
  color: #92400e;
}

.office-box div {
  grid-template-columns: minmax(0, 1fr) 120px;
  color: #526879;
  font-size: .86rem;
}

.office-box i {
  min-height: 30px;
  border: 1px solid #d8c9a4;
  border-radius: 10px;
  background: #fff;
}

.registration-actions {
  justify-content: center;
  gap: 14px;
  padding-top: 10px;
}

.registration-actions .btn {
  min-width: 170px;
  border-radius: 14px;
  padding: 12px 18px;
}

.registration-actions .btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #10b981);
  box-shadow: 0 12px 24px rgba(14, 165, 233, .22);
}

.registration-actions .btn-soft {
  background: #fff;
  color: #476171;
  border: 1px solid #dbe8ee;
}

@media (max-width: 860px) {
  .public-registration {
    padding: 14px 10px 28px;
  }

  .registration-hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 22px 16px 92px;
    justify-items: center;
    text-align: center;
  }

  .registration-title {
    text-align: center;
    justify-items: center;
  }

  .registration-social {
    justify-self: center;
  }

  .registration-form {
    width: 100%;
    margin-top: -48px;
  }

  .registration-section,
  .family-block,
  .registration-footer-grid,
  .health-grid {
    grid-template-columns: 1fr;
  }

  .registration-section {
    padding: 18px;
    border-radius: 18px;
  }

  .span-2 {
    grid-column: 1;
  }

  .registration-actions {
    flex-direction: column-reverse;
  }

  .registration-actions .btn {
    width: 100%;
  }
}

/* SaaS admin and template selection */
.muted { color: var(--muted); }
.package-editor { box-shadow: none; }
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.template-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #e3edf2;
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
}
.template-card input { justify-self: end; }
.template-preview {
  min-height: 92px;
  border-radius: 12px;
  background: var(--tpl-bg);
  border: 1px solid rgba(15, 23, 42, .08);
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  padding: 12px;
  overflow: hidden;
}
.template-preview i {
  display: block;
  border-radius: 10px;
  background: var(--tpl-primary);
}
.template-preview b,
.template-preview em {
  display: block;
  border-radius: 999px;
  background: var(--tpl-accent);
  height: 18px;
  align-self: center;
}
.template-preview em {
  width: 70%;
  opacity: .45;
}
.template-card strong { color: var(--text); }
.template-card small { color: var(--muted); }
@media (max-width: 860px) {
  .template-grid { grid-template-columns: 1fr; }
}

.menu-label {
    display: block;
    margin: 14px 10px 6px;
    color: rgba(255,255,255,.58);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.branch-menu form { margin: 0; }
.branch-link {
    width: 100%;
    border: 0;
    background: transparent;
    color: rgba(255,255,255,.78);
    text-align: left;
    padding: 9px 12px;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
}
.branch-link span,
.branch-link small { display: block; }
.branch-link span { font-weight: 800; }
.branch-link small { margin-top: 2px; font-size: 11px; color: rgba(255,255,255,.58); }
.branch-link.active,
.branch-link:hover { background: rgba(255,255,255,.12); color: #fff; }
.branch-list { display: grid; gap: 10px; }
.branch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
}
.branch-row strong,
.branch-row span,
.branch-row small { display: block; }
.branch-row small { color: var(--muted); margin-top: 3px; }
.flash.error { background: #fee2e2; color: #991b1b; border-color: #fecaca; }

.branch-selector-section {
    border: 2px solid #e9d5ff;
    background: #faf5ff;
}
.branch-selector-section h2 {
    color: #5b21b6;
}
.branch-selector-section small {
    color: #6b7280;
    font-weight: 600;
}

.settings-logo-preview {
  width: 112px;
  height: 112px;
  object-fit: contain;
  padding: 10px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #dbe8ee;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .08);
}

.registration-logo-img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  padding: 10px;
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 12px 26px rgba(42, 12, 61, .18);
}

.registration-pill {
  background: linear-gradient(135deg, #fff7cc, #ffffff);
  color: #4b176d;
  border: 1px solid rgba(255, 232, 132, .95);
  box-shadow: 0 10px 22px rgba(42, 12, 61, .18);
  text-shadow: none;
}

.registration-social {
  text-decoration: none;
}

.registration-social:hover {
  transform: translateY(-1px);
}
.registration-hero .registration-logo {
  width: 150px;
  min-height: 150px;
  padding: 14px;
  display: grid;
  place-items: center;
}

.registration-hero .registration-logo-img {
  width: 122px;
  height: 122px;
  padding: 0;
  border-radius: 22px;
  object-fit: contain;
  background: #ffffff;
  box-shadow: 0 12px 26px rgba(42, 12, 61, .18);
}

@media (max-width: 860px) {
  .registration-hero .registration-logo {
    width: 140px;
    min-height: 140px;
  }

  .registration-hero .registration-logo-img {
    width: 112px;
    height: 112px;
  }
}
.registration-hero .registration-logo-img {
  width: 122px;
  height: 122px;
  padding: 0;
  border-radius: 18px;
  object-fit: cover;
  background: transparent;
  box-shadow: none;
}

@media (max-width: 860px) {
  .registration-hero .registration-logo-img {
    width: 112px;
    height: 112px;
  }
}
.registration-hero .registration-logo {
  width: 140px;
  min-height: 140px;
  padding: 8px;
  border: 4px solid rgba(255, 255, 255, .86);
  border-radius: 20px;
  background: rgba(255, 255, 255, .18);
  box-shadow: 0 12px 28px rgba(42, 12, 61, .18);
}

.registration-hero .registration-logo-img {
  width: 118px;
  height: 118px;
  padding: 0;
  border-radius: 14px;
  background: transparent;
  box-shadow: none;
  object-fit: cover;
}

.registration-hero .registration-social {
  min-width: 182px;
  max-width: 230px;
  padding: 12px 14px;
  gap: 10px;
  align-items: center;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, .78);
  background: rgba(255, 255, 255, .92);
  color: #4b176d;
  box-shadow: 0 14px 28px rgba(42, 12, 61, .18);
}

.registration-hero .registration-social strong {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: #5b1f7a;
  color: #ffffff;
  font-size: 1.45rem;
  line-height: 1;
}

.registration-hero .registration-social span {
  color: #4b176d;
  font-weight: 800;
  line-height: 1.22;
  font-size: .82rem;
}

@media (max-width: 860px) {
  .registration-hero .registration-logo {
    width: 132px;
    min-height: 132px;
    padding: 7px;
  }

  .registration-hero .registration-logo-img {
    width: 112px;
    height: 112px;
  }

  .registration-hero .registration-social {
    min-width: 0;
    width: min(230px, 100%);
  }
}
body {
  background:
    radial-gradient(1000px 400px at 0% -20%, color-mix(in srgb, var(--primary) 18%, transparent) 0%, rgba(255, 255, 255, 0) 70%),
    radial-gradient(900px 360px at 100% -10%, color-mix(in srgb, var(--accent) 18%, transparent) 0%, rgba(255, 255, 255, 0) 70%),
    var(--tenant-bg, var(--bg));
}

.sidebar {
  background: var(--tenant-sidebar, linear-gradient(160deg, #0f172a, #103a46));
}

.brand-mark,
.btn-primary,
.kpi.accent,
.registration-actions .btn-primary {
  background: linear-gradient(145deg, var(--primary), var(--accent));
}

.btn-primary {
  border-color: var(--primary);
}

.menu a:hover,
.menu a.active,
.branch-link.active,
.branch-link:hover {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
}

.card,
.registration-section,
.branch-selector-section {
  border-color: color-mix(in srgb, var(--primary) 18%, #edf1f3);
}

.panel-head h3,
.page-title h1,
.registration-section h2,
.branch-selector-section h2 {
  color: var(--primary-strong);
}

.registration-section h2::before {
  background: linear-gradient(135deg, var(--accent), var(--primary));
}

.registration-hero {
  background:
    radial-gradient(circle at 13% 16%, rgba(255, 255, 255, .22) 0 78px, transparent 80px),
    radial-gradient(circle at 88% 22%, rgba(255, 255, 255, .16) 0 115px, transparent 116px),
    var(--tenant-hero, linear-gradient(135deg, #5b1f7a 0%, #7c2fa3 52%, #a13aba 100%));
}

.registration-pill {
  color: var(--primary-strong);
  border-color: color-mix(in srgb, var(--accent) 50%, #ffffff);
}

.registration-hero .registration-logo {
  border-color: color-mix(in srgb, var(--accent) 50%, #ffffff);
}

.registration-hero .registration-social strong {
  background: var(--primary);
}

.registration-hero .registration-social span,
.registration-hero .registration-social {
  color: var(--primary-strong);
}

.template-card:has(input:checked) {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}
.student-profile-section {
  align-items: start;
}

.student-profile-fields {
  grid-column: span 1;
  display: grid;
  gap: 16px;
}

.student-profile-fields .span-2 {
  grid-column: 1;
}

.student-photo-panel {
  grid-column: 2;
  grid-row: 2 / span 2;
  justify-self: end;
  width: min(240px, 100%);
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 20%, #d8e7ee);
  border-radius: 18px;
  background: color-mix(in srgb, var(--tenant-soft, #f8fbfc) 75%, #ffffff);
}

.student-photo-preview {
  aspect-ratio: 4 / 5;
  width: 100%;
  min-height: 230px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px dashed color-mix(in srgb, var(--primary) 34%, #9fd8e7);
  border-radius: 16px;
  background: #ffffff;
  color: var(--primary-strong);
  font-weight: 800;
  cursor: pointer;
}

.student-photo-preview img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.student-photo-preview span {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 18px;
  text-align: center;
}

.student-photo-input {
  display: none;
}

.student-photo-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.student-photo-actions .btn {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
}

@media (max-width: 860px) {
  .student-profile-fields,
  .student-photo-panel {
    grid-column: 1;
  }

  .student-photo-panel {
    grid-row: auto;
    justify-self: stretch;
    width: 100%;
  }

  .student-photo-preview {
    min-height: 220px;
  }
}
.student-profile-section {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 220px;
  gap: 18px;
}

.student-profile-section h2 {
  grid-column: 1 / -1;
}

.student-profile-fields {
  grid-column: 1 / 3;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.student-profile-fields .span-2 {
  grid-column: span 1;
}

.student-photo-panel {
  grid-column: 3;
  grid-row: 2 / span 2;
  width: 220px;
  padding: 12px;
  gap: 10px;
}

.student-photo-preview {
  min-height: 190px;
  aspect-ratio: 1 / 1;
}

.student-photo-actions {
  gap: 8px;
}

.student-photo-actions .btn {
  padding: 9px 10px;
  font-size: .82rem;
}

@media (max-width: 960px) {
  .student-profile-section {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .student-profile-fields {
    grid-column: 1 / -1;
  }

  .student-photo-panel {
    grid-column: 1 / -1;
    grid-row: auto;
    justify-self: center;
    width: min(220px, 100%);
  }
}

@media (max-width: 640px) {
  .student-profile-fields {
    grid-template-columns: 1fr;
  }

  .student-profile-section {
    grid-template-columns: 1fr;
  }
}
.registration-hero .registration-pill {
  background: #ffffff;
  color: var(--primary-strong, #4b176d);
  border: 2px solid color-mix(in srgb, var(--accent) 45%, #ffffff);
  box-shadow: 0 8px 18px rgba(42, 12, 61, .22);
  text-shadow: none;
  font-weight: 900;
}
.registration-section {
  gap: 16px 18px;
}

.registration-section .field {
  gap: 6px;
  margin: 0;
}

.registration-section .field label {
  margin: 0;
  line-height: 1.25;
}

.registration-section .field input,
.registration-section .field select,
.registration-section .field textarea {
  min-height: 46px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.student-profile-section {
  gap: 16px 18px;
}

.student-profile-fields {
  gap: 16px 18px;
}

.student-photo-panel {
  margin-top: 0;
}

.family-block {
  gap: 16px 18px;
}

.health-panel {
  margin-top: 0;
}
.student-profile-section {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 220px;
  row-gap: 10px;
  column-gap: 18px;
  align-items: start;
}

.student-profile-fields {
  display: contents;
}

.student-profile-fields .field {
  grid-column: auto;
}

.student-profile-section > .field {
  margin: 0;
}

.student-photo-panel {
  grid-column: 3;
  grid-row: 2 / span 2;
  align-self: start;
}

.student-photo-preview {
  min-height: 170px;
}

@media (max-width: 960px) {
  .student-profile-fields {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 10px;
    column-gap: 18px;
  }

  .student-photo-panel {
    grid-column: 1 / -1;
    grid-row: auto;
  }
}

@media (max-width: 640px) {
  .student-profile-fields {
    grid-template-columns: 1fr;
  }
}
.student-profile-section {
  display: grid;
  grid-template-columns: 1fr;
  row-gap: 16px;
}

.student-profile-section h2 {
  grid-column: 1;
}

.student-profile-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 18px;
  align-items: stretch;
}

.student-profile-left {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 14px;
  min-height: 268px;
}

.student-profile-pair,
.student-profile-extra {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}

.student-profile-left .field,
.student-profile-extra .field {
  min-width: 0;
}

.student-profile-left .field input,
.student-profile-left .field select,
.student-profile-extra .field input,
.student-profile-extra .field select {
  width: 100%;
}

.student-photo-panel {
  grid-column: auto;
  grid-row: auto;
  justify-self: stretch;
  width: 220px;
  height: 100%;
  min-height: 268px;
  padding: 10px;
  display: grid;
  grid-template-rows: 1fr auto;
}

.student-photo-preview {
  min-height: 0;
  height: 100%;
  aspect-ratio: auto;
}

.student-profile-extra {
  grid-column: 1;
}

@media (max-width: 860px) {
  .student-profile-top {
    grid-template-columns: 1fr;
  }

  .student-profile-left {
    min-height: 0;
    grid-template-rows: auto;
  }

  .student-photo-panel {
    width: min(240px, 100%);
    min-height: 240px;
    justify-self: center;
  }
}

@media (max-width: 640px) {
  .student-profile-pair,
  .student-profile-extra {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 860px) {
  .student-profile-top {
    display: flex;
    flex-direction: column;
  }

  .student-photo-panel {
    order: -1;
    width: min(240px, 100%);
    min-height: 240px;
    justify-self: center;
    align-self: center;
  }

  .student-profile-left {
    order: 1;
    width: 100%;
  }
}
.student-profile-top,
.student-profile-extra {
  padding: 18px;
  border-radius: 18px;
  background: #f8fbfc;
  border: 1px solid #e6f0f4;
}

.student-profile-extra {
  margin-top: 0;
}

.student-photo-panel {
  background: #ffffff;
}

@media (max-width: 860px) {
  .student-profile-top,
  .student-profile-extra {
    padding: 16px;
  }
}
.required-marker {
  color: #dc2626;
  margin-left: 3px;
  font-weight: 900;
}

.registration-section .field .error {
  color: #dc2626;
  font-size: .78rem;
  font-weight: 800;
  line-height: 1.25;
}

.registration-section .field input:invalid,
.registration-section .field select:invalid,
.registration-section .field textarea:invalid {
  border-color: color-mix(in srgb, #dc2626 45%, #d8e7ee);
}

.required-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.checkbox-tile {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #dbe8ee;
  border-radius: 10px;
  background: #fbfdfe;
  color: #294356;
  font-weight: 700;
  cursor: pointer;
}

.checkbox-tile input {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
}

.checkbox-tile:has(input:checked) {
  border-color: color-mix(in srgb, var(--primary) 45%, #dbe8ee);
  background: color-mix(in srgb, var(--primary) 8%, #ffffff);
}

.registration-field-controls {
  display: grid;
  gap: 6px;
}
.control-header {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 8px;
  font-size: .78rem;
  font-weight: 700;
  color: #6a7e8b;
  text-transform: uppercase;
  padding: 4px 0;
}
.control-row {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 8px;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid #e2edf2;
  border-radius: 8px;
  background: #fbfdfe;
}
.control-row span {
  font-size: .9rem;
  color: #294356;
}
.checkbox-tile-sm {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  cursor: pointer;
}
.checkbox-tile-sm input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}
.form-input {
  width: 100%;
  border: 1px solid #d6e1e5;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: .9rem;
  background: #fff;
  box-sizing: border-box;
}

.payment-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.payment-block {
  border: 1px solid #e2edf2;
  border-radius: 14px;
  padding: 16px;
  background: #fff;
  text-align: center;
}
.payment-block h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #294356;
}
.payment-block p {
  margin: 0 0 12px;
  font-size: .85rem;
  color: #405767;
  line-height: 1.5;
}
.qr-preview {
  max-width: 180px;
  height: auto;
  border: 1px solid #e2edf2;
  border-radius: 10px;
  padding: 4px;
  background: #fff;
}
.payment-items-table {
  margin-top: 8px;
}
.payment-items-table th,
.payment-items-table td {
  padding: 8px 12px;
  font-size: .9rem;
}

/* ============================================================
   SITE HEADER & FOOTER
   ============================================================ */

.site-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary-strong);
  font-weight: 700;
  font-size: 1.1rem;
  font-family: 'Sora', sans-serif;
}

.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--primary), var(--accent));
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
}

.logo-text {
  font-weight: 700;
}

.header-divider {
  color: var(--line);
  font-weight: 300;
}

.header-subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
  background: var(--surface-soft);
  padding: 4px 10px;
  border-radius: 6px;
}

.header-center {
  display: flex;
  justify-content: center;
}

.page-title {
  font-family: 'Sora', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-strong);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--primary), var(--accent));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.user-name {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  font-size: 0.7rem;
  padding: 3px 8px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 20px 24px;
  margin-top: auto;
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  color: var(--primary-strong);
}

.footer-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--primary), var(--accent));
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 0.8rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  font-size: 0.85rem;
}

.footer-links a {
  color: var(--muted);
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-copyright {
  font-size: 0.8rem;
  color: var(--muted);
}

.footer-version {
  font-size: 0.7rem;
  color: var(--muted);
  opacity: 0.7;
}

/* Responsive adjustments */
@media (max-width: 860px) {
  .site-header {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px 16px;
  }
  
  .header-left {
    order: 1;
    justify-content: space-between;
    width: 100%;
  }
  
  .header-center {
    order: 2;
    width: 100%;
  }
  
  .page-title {
    text-align: center;
    font-size: 1.1rem;
  }
  
  .header-right {
    order: 3;
    justify-content: flex-end;
  }
  
  .user-name {
    display: none;
  }
  
  .footer-links {
    flex-direction: column;
    gap: 8px;
  }
}

/* Main content wrapper for pages with header/footer */
.main-content {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.login-page .main-content {
  padding: 40px 24px;
}

/* ============================================================
   APP CHROME POLISH: HEADER, FOOTER, COLLAPSIBLE ICON SIDEBAR
   ============================================================ */
body:has(.site-header) {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body:has(.site-header) .main-content {
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 16px;
}

body:has(.site-header) .main-content.login-page {
  display: grid;
  place-items: center;
  padding: 34px 16px;
}

.site-header {
  min-height: 66px;
  grid-template-columns: minmax(260px, 1fr) auto minmax(260px, 1fr);
  padding: 10px 18px;
  border-bottom: 1px solid rgba(216, 225, 229, .92);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 28px rgba(15, 23, 42, .06);
}

.header-left,
.header-right,
.user-menu {
  min-width: 0;
}

.header-left {
  gap: 10px;
}

.header-right {
  justify-content: flex-end;
}

.logo-link {
  min-width: 0;
}

.logo-mark,
.footer-logo,
.user-avatar,
.brand-mark {
  background: linear-gradient(145deg, var(--primary), var(--accent));
}

.header-subtitle {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--primary) 12%, #e5edf1);
  background: color-mix(in srgb, var(--primary) 7%, #ffffff);
  color: var(--primary-strong);
}

.header-center {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 220px;
}

.page-kicker {
  color: var(--muted);
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.site-header .page-title {
  margin: 0;
  color: var(--text);
  font-size: clamp(1rem, 1.7vw, 1.28rem);
  line-height: 1.2;
  text-align: center;
}

.sidebar-toggle-btn,
.sidebar-toggle {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #dbe8ee;
  border-radius: 10px;
  background: #ffffff;
  color: var(--primary-strong);
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.sidebar-toggle-btn:hover,
.sidebar-toggle:hover {
  border-color: color-mix(in srgb, var(--primary) 35%, #dbe8ee);
  background: color-mix(in srgb, var(--primary) 8%, #ffffff);
}

.user-menu {
  padding: 5px;
  border: 1px solid #e4edf1;
  border-radius: 14px;
  background: #fbfdfe;
}

.user-meta {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.user-role {
  color: var(--muted);
  font-size: .7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.site-footer {
  padding: 12px 18px;
  background: rgba(255, 255, 255, .95);
  border-top: 1px solid rgba(216, 225, 229, .9);
}

.footer-content {
  max-width: none;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 14px;
  text-align: left;
}

.footer-brand span:last-child {
  display: grid;
  gap: 1px;
}

.footer-brand small {
  color: var(--muted);
  font-size: .72rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
}

.footer-links {
  gap: 10px;
  font-weight: 700;
}

.footer-links a {
  padding: 6px 10px;
  border-radius: 999px;
}

.footer-links a:hover {
  background: color-mix(in srgb, var(--primary) 8%, #ffffff);
}

.footer-copyright {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.footer-version {
  padding: 4px 8px;
  border-radius: 999px;
  background: #f3f7f9;
  opacity: 1;
}

.app-shell {
  width: 100%;
  grid-template-columns: 280px minmax(0, 1fr);
  transition: grid-template-columns .24s ease;
}

body:has(.site-header) .app-shell {
  min-height: calc(100vh - 130px);
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 76px minmax(0, 1fr);
}

.app-shell > .main,
.app-shell > main.main {
  min-width: 0;
  width: 100%;
}

.sidebar {
  width: auto;
  min-width: 0;
  padding: 18px 14px;
  overflow-x: hidden;
  overflow-y: auto;
  transition: padding .24s ease;
}

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

.sidebar .brand {
  min-width: 0;
}

.sidebar .brand-text {
  min-width: 0;
}

.sidebar .brand-text h1,
.sidebar .brand-text p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu a,
.branch-link,
.sidebar-footer a {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
}

.nav-icon {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, .12);
  color: #ffffff;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .02em;
}

.menu a.active .nav-icon,
.menu a:hover .nav-icon,
.branch-link.active .nav-icon,
.branch-link:hover .nav-icon,
.sidebar-footer a:hover .nav-icon {
  background: rgba(255, 255, 255, .22);
}

.nav-label,
.branch-copy,
.sidebar .brand-text,
.sidebar-footer small {
  min-width: 0;
  transition: opacity .16s ease, width .16s ease;
}

.branch-copy {
  display: grid;
  gap: 2px;
}

.branch-copy span,
.branch-copy small,
.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer a {
  padding: 9px 12px;
  color: #ffd9a8;
}

.app-shell.sidebar-collapsed .sidebar {
  padding: 18px 10px;
}

.app-shell.sidebar-collapsed .sidebar-header {
  justify-content: center;
}

.app-shell.sidebar-collapsed .sidebar .brand-text,
.app-shell.sidebar-collapsed .sidebar .menu-label,
.app-shell.sidebar-collapsed .sidebar .nav-label,
.app-shell.sidebar-collapsed .sidebar .branch-copy,
.app-shell.sidebar-collapsed .sidebar .sidebar-footer small {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar .brand,
.app-shell.sidebar-collapsed .sidebar .menu a,
.app-shell.sidebar-collapsed .sidebar .branch-link,
.app-shell.sidebar-collapsed .sidebar .sidebar-footer a {
  justify-content: center;
}

.app-shell.sidebar-collapsed .sidebar .menu a,
.app-shell.sidebar-collapsed .sidebar .branch-link,
.app-shell.sidebar-collapsed .sidebar .sidebar-footer a {
  padding: 7px;
}

.app-shell.sidebar-collapsed .sidebar .nav-icon {
  flex-basis: 36px;
  width: 36px;
  height: 36px;
}

.app-shell.sidebar-collapsed .main {
  padding-left: 18px;
  padding-right: 18px;
}

@media (max-width: 980px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .header-center {
    order: 3;
    grid-column: 1 / -1;
    justify-items: start;
    min-width: 0;
  }

  .header-subtitle,
  .user-role,
  .logo-text {
    display: none;
  }

  .footer-content {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .footer-copyright {
    justify-self: center;
    flex-wrap: wrap;
    justify-content: center;
    white-space: normal;
  }
}

@media (max-width: 860px) {
  body:has(.site-header) .main-content {
    padding: 10px;
  }

  .app-shell,
  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    width: 268px;
    padding: 20px 16px;
  }

  .app-shell.sidebar-collapsed .sidebar {
    padding: 20px 16px;
  }

  .app-shell.sidebar-collapsed .sidebar .brand-text,
  .app-shell.sidebar-collapsed .sidebar .menu-label,
  .app-shell.sidebar-collapsed .sidebar .nav-label,
  .app-shell.sidebar-collapsed .sidebar .branch-copy,
  .app-shell.sidebar-collapsed .sidebar .sidebar-footer small {
    display: initial;
  }

  .app-shell.sidebar-collapsed .sidebar .brand,
  .app-shell.sidebar-collapsed .sidebar .menu a,
  .app-shell.sidebar-collapsed .sidebar .branch-link,
  .app-shell.sidebar-collapsed .sidebar .sidebar-footer a {
    justify-content: flex-start;
  }

  .app-shell.sidebar-collapsed .sidebar .sidebar-toggle {
    display: inline-grid;
  }

  .user-menu .btn {
    display: none;
  }
}
.app-shell.sidebar-collapsed .sidebar .sidebar-header {
  flex-direction: column;
  justify-content: flex-start;
}

.app-shell.sidebar-collapsed .sidebar .nav-icon {
  display: inline-grid !important;
}
.template-picker-card .panel-head {
  align-items: start;
  gap: 14px;
}

.template-picker-card .panel-head p {
  margin: 5px 0 0;
  font-size: .86rem;
}

.selectable-template {
  position: relative;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 12px;
  border-width: 2px;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.selectable-template:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--tpl-primary) 38%, #e3edf2);
  box-shadow: 0 12px 26px rgba(15, 23, 42, .08);
}

.selectable-template .template-radio {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--tpl-primary);
}

.selectable-template .template-preview,
.selectable-template .template-copy {
  grid-column: 2;
}

.template-copy {
  display: grid;
  gap: 3px;
}

.selectable-template:has(.template-radio:checked) {
  border-color: var(--tpl-primary);
  background: color-mix(in srgb, var(--tpl-primary) 7%, #ffffff);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--tpl-primary) 14%, transparent), 0 14px 30px rgba(15, 23, 42, .10);
}

.selectable-template:has(.template-radio:checked)::after {
  content: "Dipilih";
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--tpl-primary);
  color: #ffffff;
  font-size: .68rem;
  font-weight: 900;
}

@media (max-width: 640px) {
  .selectable-template {
    grid-template-columns: 1fr;
  }

  .selectable-template .template-radio {
    grid-column: 1;
    grid-row: auto;
  }

  .selectable-template .template-preview,
  .selectable-template .template-copy {
    grid-column: 1;
  }
}

/* Color SVG icons for collapsed sidebar mode */
.nav-icon svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-icon {
  color: #ffffff;
  box-shadow: inset 0 -8px 18px rgba(255, 255, 255, .12), 0 8px 18px rgba(0, 0, 0, .10);
}

.icon-dashboard { background: linear-gradient(135deg, #38bdf8, #2563eb); }
.icon-students { background: linear-gradient(135deg, #fb7185, #db2777); }
.icon-fees { background: linear-gradient(135deg, #fbbf24, #f97316); }
.icon-finance { background: linear-gradient(135deg, #34d399, #059669); }
.icon-exams { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.icon-books { background: linear-gradient(135deg, #60a5fa, #0ea5e9); }
.icon-attendance { background: linear-gradient(135deg, #4ade80, #16a34a); }
.icon-teachers { background: linear-gradient(135deg, #f472b6, #ec4899); }
.icon-classes { background: linear-gradient(135deg, #22d3ee, #0891b2); }
.icon-parent { background: linear-gradient(135deg, #fdba74, #ea580c); }
.icon-reports { background: linear-gradient(135deg, #818cf8, #4f46e5); }
.icon-notifications { background: linear-gradient(135deg, #facc15, #ca8a04); }
.icon-inventory { background: linear-gradient(135deg, #94a3b8, #475569); }
.icon-clerks { background: linear-gradient(135deg, #2dd4bf, #0f766e); }
.icon-settings { background: linear-gradient(135deg, #c084fc, #9333ea); }
.icon-admin { background: linear-gradient(135deg, #ef4444, #991b1b); }
.icon-branch { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.icon-branches { background: linear-gradient(135deg, #06b6d4, #0369a1); }
.icon-logout { background: linear-gradient(135deg, #f87171, #dc2626); }

.menu a.active .nav-icon,
.branch-link.active .nav-icon {
  outline: 2px solid rgba(255, 255, 255, .72);
  outline-offset: 2px;
}

/* ============================================================
   SELECTED DESIGN TEMPLATE APPLIED TO ALL AUTHENTICATED PAGES
   ============================================================ */
body:has(.app-shell) {
  background:
    radial-gradient(900px 320px at 0% -10%, color-mix(in srgb, var(--primary) 20%, transparent) 0%, transparent 68%),
    radial-gradient(850px 300px at 100% 0%, color-mix(in srgb, var(--accent) 18%, transparent) 0%, transparent 70%),
    linear-gradient(180deg, color-mix(in srgb, var(--tenant-bg, var(--bg)) 72%, #ffffff) 0%, var(--tenant-bg, var(--bg)) 100%);
}

body.kid-dashboard:has(.app-shell) {
  background:
    radial-gradient(circle at 12% 8%, color-mix(in srgb, var(--accent) 22%, transparent) 0, transparent 18%),
    radial-gradient(circle at 88% 10%, color-mix(in srgb, var(--primary) 16%, transparent) 0, transparent 20%),
    linear-gradient(180deg, color-mix(in srgb, var(--tenant-bg, #f7fbff) 58%, #ffffff) 0%, var(--tenant-bg, #eef8ff) 100%);
  background-attachment: fixed;
}

.app-shell .sidebar,
.kid-dashboard .sidebar {
  background: var(--tenant-sidebar, linear-gradient(160deg, #0f172a, #103a46));
}

.app-shell .topbar {
  min-height: 72px;
  padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--primary) 12%, #edf1f3);
  border-radius: 16px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 7%, #ffffff) 0%, #ffffff 62%),
    var(--surface);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .07);
}

.app-shell .page-title h1,
.app-shell .page-title h2,
.app-shell .panel-head h3,
.app-shell .card h3,
.app-shell .card h2 {
  color: var(--primary-strong);
}

.app-shell .page-title p,
.app-shell .panel-head a,
.app-shell .muted {
  color: color-mix(in srgb, var(--primary-strong) 58%, var(--muted));
}

.app-shell .card,
.app-shell .kid-card,
.app-shell .family-block,
.app-shell .health-panel,
.app-shell .office-box {
  border-color: color-mix(in srgb, var(--primary) 15%, #edf1f3);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .075);
}

.app-shell .panel-head {
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 5%, #ffffff), #ffffff);
  border-bottom-color: color-mix(in srgb, var(--primary) 14%, var(--line));
}

.app-shell .kid-hero {
  border-color: color-mix(in srgb, var(--accent) 35%, #ffffff);
  background:
    radial-gradient(circle at 13% 16%, rgba(255, 255, 255, .40) 0 76px, transparent 78px),
    radial-gradient(circle at 88% 18%, rgba(255, 255, 255, .22) 0 105px, transparent 108px),
    var(--tenant-hero, linear-gradient(135deg, #fff2a7 0%, #ffd4ec 45%, #c8ecff 100%));
}

.app-shell .kid-hero h1,
.app-shell .kid-hero p {
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(15, 23, 42, .30);
}

.app-shell .kpi.primary,
.app-shell .kpi.accent,
.app-shell .kpi.success,
.app-shell .kpi.danger {
  background: linear-gradient(145deg, #ffffff, color-mix(in srgb, var(--tenant-bg, #f8fbfc) 60%, #ffffff));
  border-left-color: var(--primary);
}

.app-shell .kpi.accent {
  border-left-color: var(--accent);
}

.app-shell .kpi.success {
  border-left-color: color-mix(in srgb, var(--primary) 68%, #22c55e);
}

.app-shell .kpi.danger {
  border-left-color: color-mix(in srgb, var(--accent) 55%, #ef4444);
}

.app-shell .kpi .value {
  color: var(--primary-strong);
}

.app-shell .table th {
  color: var(--primary-strong);
  background: color-mix(in srgb, var(--primary) 6%, #ffffff);
}

.app-shell .table tr:hover td {
  background: color-mix(in srgb, var(--primary) 4%, #ffffff);
}

.app-shell .field input,
.app-shell .field select,
.app-shell .field textarea {
  border-color: color-mix(in srgb, var(--primary) 18%, #d6e1e5);
  background: color-mix(in srgb, var(--tenant-bg, #ffffff) 18%, #ffffff);
}

.app-shell .field input:focus,
.app-shell .field select:focus,
.app-shell .field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent);
}

.app-shell .btn-primary,
.site-header .btn-primary,
.registration-actions .btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #ffffff;
}

.app-shell .btn-soft,
.site-header .btn-soft {
  background: color-mix(in srgb, var(--primary) 8%, #ffffff);
  border-color: color-mix(in srgb, var(--primary) 18%, #dbe8ee);
  color: var(--primary-strong);
}

.app-shell .mobile-toggle {
  border-color: color-mix(in srgb, var(--primary) 18%, var(--line));
  color: var(--primary-strong);
}

.app-shell .badge.ok {
  background: color-mix(in srgb, var(--primary) 18%, #dcfce7);
  color: color-mix(in srgb, var(--primary-strong) 75%, #166534);
}

.app-shell .badge.warn {
  background: color-mix(in srgb, var(--accent) 20%, #fef3c7);
  color: color-mix(in srgb, var(--accent) 70%, #78350f);
}

.app-shell .badge.alert {
  background: color-mix(in srgb, var(--accent) 15%, #fee2e2);
  color: color-mix(in srgb, var(--accent) 48%, #991b1b);
}

.site-header:has(+ .app-shell),
body:has(.app-shell) .site-header {
  border-bottom-color: color-mix(in srgb, var(--primary) 14%, var(--line));
}

body:has(.app-shell) .site-footer {
  border-top-color: color-mix(in srgb, var(--primary) 14%, var(--line));
}

body:has(.app-shell) .footer-links a:hover {
  color: var(--primary-strong);
  background: color-mix(in srgb, var(--primary) 8%, #ffffff);
}

.app-shell .template-card:has(input:checked),
.app-shell .checkbox-tile:has(input:checked) {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}

/* Mobile header: one compact row, no overlapping with sidebar */
@media (max-width: 860px) {
  body:has(.site-header) {
    padding-top: 58px;
  }

  .site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 80;
    min-height: 58px;
    height: 58px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 8px;
    align-items: center;
    padding: 8px 12px;
    border-radius: 0;
  }

  .header-left,
  .header-center,
  .header-right {
    display: flex;
    align-items: center;
    min-width: 0;
    width: auto;
  }

  .header-left {
    grid-column: 1;
    justify-content: flex-start;
    order: 0;
  }

  .header-center {
    grid-column: 2;
    order: 0;
    justify-content: center;
    justify-items: center;
    gap: 0;
    min-width: 0;
  }

  .header-right {
    grid-column: 3;
    order: 0;
    justify-content: flex-end;
  }

  .sidebar-toggle-btn,
  .sidebar-toggle {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .site-header .logo-link,
  .site-header .header-subtitle,
  .site-header .page-kicker,
  .site-header .user-meta,
  .site-header .user-menu .btn {
    display: none !important;
  }

  .site-header .page-title {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .96rem;
    line-height: 1.1;
    text-align: center;
  }

  .site-header .user-menu {
    padding: 0;
    border: 0;
    background: transparent;
  }

  .site-header .user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: .82rem;
  }

  body:has(.site-header) .app-shell,
  body:has(.site-header) .app-shell.sidebar-collapsed {
    min-height: calc(100vh - 58px);
  }

  body:has(.site-header) .main,
  body:has(.site-header) .main-content {
    padding-top: 10px;
  }

  .sidebar {
    top: 58px;
    height: calc(100vh - 58px);
    z-index: 70;
    box-shadow: 18px 0 40px rgba(15, 23, 42, .20);
  }

  .app-shell.sidebar-open::after {
    content: "";
    position: fixed;
    inset: 58px 0 0 0;
    z-index: 60;
    background: rgba(15, 23, 42, .28);
  }

  .app-shell.sidebar-open .sidebar {
    z-index: 71;
  }

  .topbar {
    min-height: auto;
  }

  .topbar .page-title h1,
  .topbar .page-title h2 {
    font-size: 1rem;
  }

  .topbar .page-title p {
    font-size: .78rem;
  }
}

/* Force all authenticated pages to match the compact /finance sizing */
.app-shell .main {
  gap: 18px !important;
  padding: 24px !important;
}

.app-shell .kid-hero,
.kid-dashboard.compact-page .kid-hero {
  height: 136px !important;
  min-height: 136px !important;
  max-height: 136px !important;
  padding: 18px 20px !important;
  overflow: hidden !important;
  align-content: center;
}

.app-shell .kid-hero h1,
.kid-dashboard.compact-page .kid-hero h1 {
  max-width: 72% !important;
  margin: 0 !important;
  font-size: 1.15rem !important;
  line-height: 1.2 !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.app-shell .kid-hero p,
.kid-dashboard.compact-page .kid-hero p {
  max-width: 72% !important;
  margin: 8px 0 0 !important;
  font-size: .88rem !important;
  line-height: 1.32 !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.app-shell .kid-hero .kid-sticker {
  width: 78px !important;
  height: 78px !important;
}

.app-shell .kid-hero .kid-sticker.cloud {
  width: 86px !important;
  right: 84px !important;
}

.app-shell .kid-hero .kid-sticker.rainbow {
  width: 86px !important;
  height: 56px !important;
}

.app-shell .topbar {
  min-height: 98px !important;
  padding: 20px !important;
  align-items: center !important;
}

.app-shell .topbar .page-title h1,
.app-shell .topbar .page-title h2 {
  margin: 0 !important;
  font-size: clamp(1.75rem, 2.7vw, 2.15rem) !important;
  line-height: 1.12 !important;
}

.app-shell .topbar .page-title p {
  margin: 6px 0 0 !important;
  font-size: .92rem !important;
  line-height: 1.35 !important;
}

.app-shell .kpi-grid {
  gap: 14px !important;
}

.app-shell .kpi {
  padding: 16px !important;
}

.app-shell .kpi .value {
  font-size: 1.45rem !important;
}

@media (max-width: 860px) {
  .app-shell .main {
    gap: 14px !important;
    padding: 14px !important;
  }

  .app-shell .kid-hero,
  .kid-dashboard.compact-page .kid-hero {
    height: 124px !important;
    min-height: 124px !important;
    max-height: 124px !important;
    padding: 14px 16px !important;
  }

  .app-shell .kid-hero h1,
  .app-shell .kid-hero p {
    max-width: calc(100% - 86px) !important;
    padding-right: 0 !important;
  }

  .app-shell .topbar {
    min-height: 82px !important;
    padding: 14px 16px !important;
  }

  .app-shell .topbar .page-title h1,
  .app-shell .topbar .page-title h2 {
    font-size: 1.25rem !important;
  }
}

/* Strict topbar sizing to match /finance across all authenticated pages */
.app-shell .topbar,
.kid-dashboard.compact-page .topbar {
  min-height: 96px !important;
  height: 96px !important;
  max-height: 96px !important;
  padding: 18px 20px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  overflow: hidden !important;
}

.app-shell .topbar .page-title {
  min-width: 0 !important;
  display: grid !important;
  gap: 6px !important;
}

.app-shell .topbar .page-title h1,
.app-shell .topbar .page-title h2,
.kid-dashboard.compact-page .topbar .page-title h1,
.kid-dashboard.compact-page .topbar .page-title h2 {
  margin: 0 !important;
  font-size: 2rem !important;
  line-height: 1.12 !important;
  max-height: 2.3rem !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.app-shell .topbar .page-title p,
.kid-dashboard.compact-page .topbar .page-title p {
  margin: 0 !important;
  font-size: .93rem !important;
  line-height: 1.35 !important;
  max-height: 1.35rem !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.app-shell .topbar .mobile-toggle {
  width: 38px !important;
  height: 38px !important;
  padding: 8px !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 auto !important;
}

@media (max-width: 860px) {
  .app-shell .topbar,
  .kid-dashboard.compact-page .topbar {
    min-height: 76px !important;
    height: 76px !important;
    max-height: 76px !important;
    padding: 12px 14px !important;
  }

  .app-shell .topbar .page-title h1,
  .app-shell .topbar .page-title h2,
  .kid-dashboard.compact-page .topbar .page-title h1,
  .kid-dashboard.compact-page .topbar .page-title h2 {
    font-size: 1.18rem !important;
    max-height: 1.4rem !important;
  }

  .app-shell .topbar .page-title p,
  .kid-dashboard.compact-page .topbar .page-title p {
    font-size: .78rem !important;
    max-height: 1.1rem !important;
  }
}

/* Prevent sparse pages from stretching grid rows and creating large blank gaps */
.app-shell .main,
.app-shell > main.main {
  align-content: start !important;
  grid-auto-rows: max-content !important;
}

.app-shell .main > * {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

.app-shell .flash:empty {
  display: none !important;
}

/* Keep authenticated page blocks tight and consistent like /finance */
body:has(.app-shell) .app-shell {
  align-items: start !important;
}

body:has(.app-shell) .main {
  align-items: stretch !important;
  justify-content: stretch !important;
  row-gap: 18px !important;
}

body:has(.app-shell) .main > .card,
body:has(.app-shell) .main > .topbar,
body:has(.app-shell) .main > .kid-hero,
body:has(.app-shell) .main > section,
body:has(.app-shell) .main > header,
body:has(.app-shell) .main > div {
  align-self: start !important;
  width: 100% !important;
}

body:has(.app-shell) .main > .topbar + .card,
body:has(.app-shell) .main > .topbar + section.card,
body:has(.app-shell) .main > .flash + .card,
body:has(.app-shell) .main > .flash + section.card {
  margin-top: 0 !important;
}
/* Mobile sidebar labels stay visible even when desktop collapsed state is saved */
@media (max-width: 860px) {
  .app-shell.sidebar-collapsed .sidebar .menu a .nav-label,
  .app-shell.sidebar-collapsed .sidebar .sidebar-footer a .nav-label,
  .app-shell.sidebar-collapsed .sidebar .branch-link .branch-copy,
  .sidebar.collapsed .menu a .nav-label,
  .sidebar.collapsed .sidebar-footer a .nav-label,
  .sidebar.collapsed .branch-link .branch-copy {
    display: grid !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: auto !important;
    max-width: 178px !important;
    min-width: 0 !important;
  }

  .app-shell.sidebar-collapsed .sidebar .menu a,
  .app-shell.sidebar-collapsed .sidebar .branch-link,
  .app-shell.sidebar-collapsed .sidebar .sidebar-footer a,
  .sidebar.collapsed .menu a,
  .sidebar.collapsed .branch-link,
  .sidebar.collapsed .sidebar-footer a {
    grid-template-columns: 32px minmax(0, 1fr) !important;
    justify-content: flex-start !important;
    gap: 10px !important;
  }

  .app-shell.sidebar-collapsed .sidebar .menu-label,
  .sidebar.collapsed .menu-label {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}
/* Hide duplicate page-level Menu buttons on mobile; header toggle handles sidebar */
@media (max-width: 860px) {
  .app-shell .mobile-toggle,
  .topbar .mobile-toggle {
    display: none !important;
  }
}
/* Topbar title alignment: desktop left, mobile center */
.app-shell .topbar .page-title,
.kid-dashboard.compact-page .topbar .page-title {
  text-align: left !important;
  justify-items: start !important;
}

@media (max-width: 860px) {
  .app-shell .topbar {
    justify-content: center !important;
  }

  .app-shell .topbar .page-title,
  .kid-dashboard.compact-page .topbar .page-title {
    text-align: center !important;
    justify-items: center !important;
    width: 100% !important;
  }

  .app-shell .topbar .page-title h1,
  .app-shell .topbar .page-title h2,
  .app-shell .topbar .page-title p,
  .kid-dashboard.compact-page .topbar .page-title h1,
  .kid-dashboard.compact-page .topbar .page-title h2,
  .kid-dashboard.compact-page .topbar .page-title p {
    text-align: center !important;
    max-width: 100% !important;
  }
}
/* Sidebar should fill the full app area down to the footer */
body:has(.app-shell) .app-shell {
  align-items: stretch !important;
}

body:has(.app-shell) .sidebar {
  align-self: stretch !important;
  min-height: 100% !important;
  height: auto !important;
}

body:has(.app-shell) .sidebar-header {
  justify-content: flex-start !important;
}

@media (max-width: 860px) {
  body:has(.app-shell) .sidebar {
    height: calc(100vh - 58px) !important;
  }
}
/* Header tenant brand uses uploaded kindergarten logo and active branch name */
.site-header .tenant-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.site-header .tenant-logo {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
}

.site-header .tenant-logo.has-image {
  padding: 0;
  background: #ffffff;
  border: 1px solid color-mix(in srgb, var(--primary) 16%, #e5edf1);
}

.site-header .tenant-logo-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.site-header .tenant-brand-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.site-header .tenant-brand-copy .logo-text {
  display: block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--primary-strong);
  font-weight: 900;
  line-height: 1.12;
}

.site-header .tenant-brand-copy .header-subtitle {
  display: block;
  max-width: 260px;
  padding: 0;
  border: 0;
  background: transparent;
  color: color-mix(in srgb, var(--primary-strong) 62%, var(--muted));
  font-size: .76rem;
  font-weight: 700;
  line-height: 1.2;
}

@media (max-width: 860px) {
  .site-header .tenant-brand {
    display: none !important;
  }
}
.registration-field-controls-visibility .control-header,
.registration-field-controls-visibility .control-row {
  grid-template-columns: minmax(0, 1fr) 58px 58px;
}

.registration-field-controls-visibility .control-header span:not(:first-child) {
  text-align: center;
}

.registration-field-controls-visibility .control-row > span {
  min-width: 0;
}
.payment-qr-section {
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--tenant-bg, #eafff6) 84%, #ffffff) 0%,
      color-mix(in srgb, var(--tenant-bg, #eafff6) 58%, #ffffff) 100%);
  border-color: color-mix(in srgb, var(--primary) 18%, #d7efe8);
  box-shadow: 0 14px 32px rgba(15, 23, 42, .06);
}

.payment-qr-section h2 {
  color: var(--primary-strong);
  margin-bottom: 22px;
}


.payment-qr-section > h2,
.payment-qr-section > .payment-qr-card,
.payment-qr-section > .payment-upload-box,
.payment-qr-section > .payment-items-compact,
.payment-qr-section > .payment-note {
  grid-column: 1 / -1;
}
.payment-qr-card {
  display: grid;
  grid-template-columns: minmax(210px, 280px) minmax(280px, 1fr);
  gap: clamp(24px, 6vw, 72px);
  align-items: center;
  max-width: 880px;
}

.payment-qr-visual {
  display: grid;
  place-items: center;
}

.payment-qr-image,
.payment-qr-placeholder {
  width: min(220px, 100%);
  aspect-ratio: 1;
  border: 10px solid color-mix(in srgb, var(--tenant-bg, #f8fffb) 30%, #ffffff);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
  box-shadow: 0 8px 18px rgba(8, 54, 52, .08);
}

.payment-qr-placeholder {
  display: grid;
  place-items: center;
  color: var(--primary-strong);
  font-weight: 800;
  border-style: dashed;
}

.payment-qr-details {
  display: grid;
  gap: 0;
  min-width: 0;
}

.payment-qr-details div,
.payment-items-compact div {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(0, auto);
  gap: 18px;
  align-items: center;
  min-height: 42px;
  border-bottom: 1px solid color-mix(in srgb, var(--primary) 18%, transparent);
  color: color-mix(in srgb, var(--primary-strong) 72%, #4b6670);
}

.payment-qr-details strong,
.payment-items-compact strong {
  color: var(--primary-strong);
  text-align: right;
  overflow-wrap: anywhere;
}

.payment-items-compact {
  margin: 20px 0 0;
  max-width: 520px;
}

.payment-note {
  margin: 16px 0 0;
  color: color-mix(in srgb, var(--primary-strong) 68%, #4b6670);
  font-size: .9rem;
}

.payment-upload-box {
  width: 100%;
  box-sizing: border-box;
  margin-top: 16px;
  min-height: 116px;
  border: 2px dashed color-mix(in srgb, var(--primary) 54%, #63c8c7);
  border-radius: 10px;
  background: color-mix(in srgb, var(--tenant-bg, #ffffff) 28%, #ffffff);
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
  clear: both;
}

.payment-upload-box label {
  font-weight: 800;
  color: var(--primary-strong);
}

.payment-upload-box strong {
  color: color-mix(in srgb, var(--primary-strong) 66%, #536a72);
}

.payment-upload-box input {
  width: min(100%, 640px);
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, .84);
  padding: 11px;
}

`r`n@media (max-width: 760px) {
  
.payment-qr-section > h2,
.payment-qr-section > .payment-qr-card,
.payment-qr-section > .payment-upload-box,
.payment-qr-section > .payment-items-compact,
.payment-qr-section > .payment-note {
  grid-column: 1 / -1;
}
.payment-qr-card {
    grid-template-columns: 1fr;
    gap: 22px;
    max-width: none;
  }

  .payment-items-compact {
    max-width: none;
  }
}
.settings-logo-frame {
  width: 144px;
  min-height: 144px;
  padding: 8px;
  border: 4px solid color-mix(in srgb, var(--accent) 56%, #ffffff);
  border-radius: 22px;
  background: color-mix(in srgb, var(--tenant-bg, #ffffff) 26%, rgba(255, 255, 255, .72));
  box-shadow: 0 12px 28px rgba(15, 23, 42, .12);
  display: grid;
  place-items: center;
}

.settings-kindergarten-logo-preview {
  width: 120px;
  height: 120px;
  border-radius: 15px;
  object-fit: cover;
  display: block;
  background: transparent;
}

.registration-fields-card {
  grid-column: 1 / -1;
  width: 100%;
  max-width: none;
  margin-top: 24px;
}

.settings-form-shell {
  width: 100%;
  max-width: none;
}

.registration-field-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.registration-field-main,
.registration-field-side {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.registration-field-group h4 {
  color: var(--primary-strong);
}

.student-registration-field-group {
  width: 100%;
  min-width: 0;
}

.student-field-controls,
.dual-field-controls {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px 10px;
}

.compact-field-controls {
  grid-template-columns: 1fr !important;
  gap: 6px;
}

.compact-registration-field-group .control-row,
.student-field-controls .control-row,
.dual-field-controls .control-row {
  min-height: 38px;
  padding: 3px 8px;
}

.compact-registration-field-group .control-header,
.student-field-controls .control-header,
.dual-field-controls .control-header {
  padding: 2px 0;
}

@media (max-width: 1180px) {
  .registration-field-layout {
    grid-template-columns: 1fr;
  }

  .registration-field-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .registration-field-side,
  .student-field-controls,
  .dual-field-controls {
    grid-template-columns: 1fr !important;
  }
}