:root {
  color-scheme: light;
  --app-bg: #e4e9f1;
  --surface: #eef2f7;
  --surface-soft: #e7edf5;
  --surface-raised: #ffffff;
  --text: #111827;
  --muted: #64748b;
  --border: #dbe3ed;
  --primary: #0d3b66;
  --primary-strong: #082b4d;
  --primary-soft: #e6eef7;
  --accent: #0f8f78;
  --accent-soft: #e5f6f2;
  --danger: #c24135;
  --danger-soft: #fff0ed;
  --warning: #a96400;
  --warning-soft: #fff4df;
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.13);
  --nav-height: 78px;
  --radius: 8px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --app-bg: #080f1a;
  --surface: #0d1624;
  --surface-raised: #121e2f;
  --surface-soft: #172235;
  --text: #f2f6fb;
  --muted: #9caec4;
  --border: #243348;
  --primary: #78b7ff;
  --primary-strong: #a7d0ff;
  --primary-soft: #152a43;
  --accent: #48d0ad;
  --accent-soft: #102f2b;
  --danger: #ff8a7c;
  --danger-soft: #351c1d;
  --warning: #f7c76b;
  --warning-soft: #352818;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
}

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

body.is-soft-loading .app-content,
body.is-soft-loading .auth-card {
  opacity: 0.72;
  pointer-events: none;
}

.app-content,
.auth-card {
  transition: opacity 180ms ease;
}

.auth-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 1rem;
  background: var(--app-bg);
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 430px;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-raised);
  box-shadow: var(--shadow);
}

.auth-theme-toggle {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  margin: 1.55rem auto 1.25rem;
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border));
  border-radius: 24px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 2.15rem;
  font-weight: 850;
  letter-spacing: 0.04em;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.auth-heading {
  margin-bottom: 1.55rem;
  text-align: center;
}

.auth-heading h1 {
  margin: 0.35rem 0 0;
  color: var(--text);
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: 0;
}

.auth-heading p {
  margin: 0.78rem 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.08rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.form-field span {
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 750;
}

.form-field input {
  width: 100%;
  min-height: 52px;
  padding: 0.78rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--text);
  outline: 0;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.form-field input::placeholder {
  color: color-mix(in srgb, var(--muted) 75%, transparent);
}

.form-field input:focus {
  border-color: var(--primary);
  background: var(--surface-raised);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent);
}

.field-error {
  color: var(--danger);
  font-size: 0.78rem;
  font-style: normal;
  line-height: 1.35;
}

.auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0.18rem 0 0.35rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.auth-confirmation {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.15rem;
  text-align: center;
}

.auth-confirmation .auth-heading {
  margin-bottom: 0;
}

.auth-status-icon {
  width: 54px;
  height: 54px;
  font-size: 1.45rem;
}

.auth-confirmation p {
  max-width: 29rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.65;
}

.auth-confirmation strong {
  color: var(--text);
  font-weight: 760;
}

.remember-me {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.remember-me input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
}

.auth-options a {
  color: var(--primary-strong);
  font-weight: 750;
  white-space: nowrap;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  position: relative;
  width: 100%;
  max-width: 520px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow-x: hidden;
}

.top-loader {
  position: fixed;
  z-index: 30;
  top: 0;
  left: 50%;
  width: 100%;
  max-width: 520px;
  height: 3px;
  transform: translateX(-50%) scaleX(0);
  transform-origin: left;
  background: var(--accent);
  opacity: 0;
  transition: transform 220ms ease, opacity 160ms ease;
}

.top-loader.is-visible {
  opacity: 1;
  transform: translateX(-50%) scaleX(1);
}

.soft-loader {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  width: min(100% - 2rem, 520px);
  pointer-events: none;
  transform: translate(-50%, 12px);
  opacity: 0;
  transition: opacity 160ms ease, transform 160ms ease;
}

.app-shell .soft-loader {
  bottom: calc(var(--nav-height) + 1rem + env(safe-area-inset-bottom));
}

.soft-loader span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0.48rem 0.78rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-raised) 94%, transparent);
  color: var(--text);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(16px);
  font-size: 0.84rem;
  font-weight: 760;
}

.mobile-pdf-bar {
  position: fixed;
  z-index: 100;
  top: 0;
  left: 50%;
  width: 100%;
  max-width: 520px;
  padding: calc(0.55rem + env(safe-area-inset-top)) 0.75rem 0.55rem;
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--surface-raised) 96%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.mobile-pdf-back {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  min-height: 40px;
  padding: 0 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--primary-strong);
  font-weight: 760;
}

.pdf-preview-page {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--surface);
}

.pdf-preview-shell {
  position: relative;
  width: 100%;
  max-width: 520px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--surface);
}

.pdf-preview-content {
  padding: calc(64px + env(safe-area-inset-top)) 0.85rem 1.25rem;
}

.pdf-document-preview {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.pdf-document-heading {
  text-align: center;
}

.pdf-document-logo {
  width: 78px;
  height: 78px;
  margin-bottom: 0.7rem;
  object-fit: contain;
}

.pdf-document-heading h1 {
  margin: 0;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.2;
}

.pdf-document-heading p {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.pdf-info-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 1rem 0;
  border-top: 1px solid var(--border);
}

.pdf-info-list div {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.2fr);
  gap: 0.7rem;
  padding: 0.62rem 0;
  border-bottom: 1px solid var(--border);
}

.pdf-info-list dt,
.pdf-preview-item span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 740;
}

.pdf-info-list dd {
  margin: 0;
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.35;
}

.pdf-document-preview h2 {
  margin: 1rem 0 0.65rem;
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
}

.pdf-preview-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.pdf-preview-item {
  display: flex;
  flex-direction: column;
  gap: 0.58rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.pdf-preview-item strong,
.pdf-preview-item em {
  display: block;
  margin-top: 0.12rem;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.86rem;
  font-style: normal;
  line-height: 1.35;
}

.pdf-preview-item em {
  color: var(--muted);
}

.pdf-preview-note {
  margin: 1rem 0 0;
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.45;
}

.pdf-preview-note + .pdf-preview-note {
  margin-top: 0.45rem;
}

.pdf-preview-note + .btn {
  margin-top: 1rem;
}

body.is-soft-loading .soft-loader {
  transform: translate(-50%, 0);
  opacity: 1;
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: calc(1rem + env(safe-area-inset-top)) 1rem 0.9rem;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  backdrop-filter: blur(18px);
}

.header-title,
.screen-title h2,
.section-heading h2,
.profile-card h2,
.return-state h2 {
  margin: 0;
  color: var(--text);
  font-weight: 750;
  line-height: 1.1;
  letter-spacing: 0;
}

.header-title {
  margin-top: 0.2rem;
  font-size: 1.16rem;
}

.header-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 0.42rem;
}

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.icon-btn.auth-theme-toggle {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.notification-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--surface-raised);
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 42%, transparent);
  animation: notificationPulse 1.55s ease-out infinite;
}

.notification-dot::after {
  position: absolute;
  inset: -5px;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  border-radius: 50%;
  content: "";
}

@keyframes notificationPulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 42%, transparent);
  }
  72% {
    box-shadow: 0 0 0 8px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}


.icon-btn:active,
.nav-item:active,
.child-card:active,
.btn:active {
  transform: scale(0.98);
}

.app-content {
  padding: 1rem 1rem calc(var(--nav-height) + 1.25rem + env(safe-area-inset-bottom));
}

.screen-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: screenIn 160ms ease-out;
}

@keyframes screenIn {
  from {
    transform: translateY(6px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.1;
  text-transform: uppercase;
}

.summary-panel,
.priority-section,
.quiet-panel,
.profile-card,
.settings-list,
.transaction-card,
.checkout-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.summary-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
}

.summary-panel-main {
  align-items: flex-start;
}

.summary-panel strong {
  display: block;
  margin-top: 0.1rem;
  color: var(--primary-strong);
  font-size: clamp(2.2rem, 11vw, 3.3rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.summary-panel i {
  color: var(--accent);
  font-size: 2rem;
}

.summary-panel-soft {
  background: var(--primary-soft);
}

.checkout-intro strong,
.return-summary strong {
  font-size: clamp(1.9rem, 9vw, 2.6rem);
}
.summary-fee-line {
  display: block;
  margin-top: 0.48rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.3;
}
.summary-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  margin-top: 0.75rem;
}

.mini-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0.28rem 0.52rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 760;
  line-height: 1;
  white-space: nowrap;
}

.mini-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.mini-primary {
  background: color-mix(in srgb, var(--primary-soft) 70%, var(--surface-raised));
  color: var(--primary-strong);
}

.mini-success {
  background: var(--accent-soft);
  color: var(--accent);
}

.mini-muted {
  background: var(--surface-soft);
  color: var(--muted);
}

.summary-label,
.muted-line {
  color: var(--muted);
  font-size: 0.88rem;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.75rem;
}

.section-heading.compact {
  padding-bottom: 0;
}

.section-heading h2,
.screen-title h2,
.profile-card h2,
.return-state h2 {
  margin-top: 0.18rem;
  font-size: 1.14rem;
}

.screen-title {
  padding: 0.2rem 0 0;
}

.amount-alert,
.amount-neutral {
  white-space: nowrap;
  font-size: 1.06rem;
  font-weight: 800;
}

.amount-alert {
  color: var(--danger);
}

.amount-neutral {
  color: var(--primary-strong);
}

.rounded-table {
  overflow: hidden;
  border-radius: 0 0 var(--radius) var(--radius);
}

.payment-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  min-height: 66px;
  padding: 0.82rem 1rem;
  background: var(--surface-raised);
}

.payment-row + .payment-row::before {
  position: absolute;
  top: 0;
  left: 1rem;
  right: 1rem;
  height: 1px;
  background: var(--border);
  content: "";
}

.payment-row.urgent {
  background: var(--danger-soft);
}

.payment-row > div {
  min-width: 0;
}

.payment-row > div:last-child {
  text-align: right;
}

.row-with-icon,
.heading-with-icon {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.heading-with-icon {
  align-items: flex-start;
}

.row-with-icon > span:last-child,
.heading-with-icon > div {
  min-width: 0;
}

.status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 1rem;
}

.icon-primary {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.icon-calendar {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.icon-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.icon-success {
  background: var(--accent-soft);
  color: var(--accent);
}

.icon-muted {
  background: var(--surface-soft);
  color: var(--muted);
}

.payment-row strong,
.check-row strong,
.child-card strong {
  display: block;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 760;
  line-height: 1.25;
}

.payment-row em,
.payment-row > div:not(.row-with-icon):first-child > span,
.payment-row > div:last-child span,
.check-row em,
.child-card span,
.timeline-item span,
.transaction-card em {
  display: block;
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.79rem;
  font-style: normal;
  line-height: 1.25;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-height: 28px;
  padding: 0.32rem 0.55rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 0.74rem;
  font-weight: 750;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
}

.status-pill i {
  margin-right: 0.28rem;
}

.status-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-success {
  background: var(--accent-soft);
  color: var(--accent);
}

.action-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.68rem 0.95rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 750;
  letter-spacing: 0;
  line-height: 1.15;
  text-align: center;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.btn.disabled,
.btn[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.55;
}

.w-100 {
  width: 100%;
}

.btn-lg {
  min-height: 54px;
}

.btn-primary {
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary-strong);
  --bs-btn-hover-border-color: var(--primary-strong);
  --bs-btn-active-bg: var(--primary-strong);
  --bs-btn-active-border-color: var(--primary-strong);
}

[data-theme="dark"] .btn-primary {
  --bs-btn-color: #07111f;
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary-strong);
  --bs-btn-hover-border-color: var(--primary-strong);
}

.btn-outline-primary {
  --bs-btn-color: var(--primary-strong);
  --bs-btn-bg: color-mix(in srgb, var(--primary-soft) 72%, var(--surface-raised));
  --bs-btn-border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
  --bs-btn-hover-bg: color-mix(in srgb, var(--primary-soft) 86%, var(--surface-raised));
  --bs-btn-hover-border-color: var(--primary);
  --bs-btn-hover-color: var(--primary-strong);
  --bs-btn-active-bg: var(--primary-soft);
  --bs-btn-active-border-color: var(--primary);
  --bs-btn-active-color: var(--primary-strong);
  min-height: 48px;
}

.link-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  width: 100%;
  padding: 0.68rem 0.95rem;
  border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--primary-soft) 72%, var(--surface-raised));
  color: var(--primary-strong);
  font-size: 0.94rem;
  font-weight: 750;
  line-height: 1.15;
  text-align: center;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.link-action:hover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary-soft) 86%, var(--surface-raised));
  color: var(--primary-strong);
}

.app-bottom-nav {
  position: fixed;
  z-index: 25;
  bottom: 0;
  left: 50%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
  max-width: 520px;
  min-height: var(--nav-height);
  padding: 0.48rem 0.55rem calc(0.5rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-raised) 96%, transparent);
  backdrop-filter: blur(18px);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-width: 0;
  min-height: 58px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 720;
  line-height: 1;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.nav-item i {
  font-size: 1.2rem;
}

.nav-item span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.children-list,
.history-list,
.settings-list,
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 0.72rem;
}

.child-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
  min-height: 82px;
  padding: 0.82rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.child-card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  min-width: 0;
}

.child-status-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.32rem;
  flex: 0 0 auto;
}

.child-status-stack strong {
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1;
}

.child-card-body > div {
  min-width: 0;
}

.child-student-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.child-card .status-pill {
  white-space: normal;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 800;
}

.avatar-green {
  background: var(--accent-soft);
  color: var(--accent);
}

.avatar-muted {
  background: var(--surface-soft);
  color: var(--muted);
}

.avatar-large {
  width: 58px;
  height: 58px;
  font-size: 1.25rem;
}

.quiet-panel {
  padding-bottom: 1rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  padding: 1rem;
}

.metric-tile {
  padding: 0.78rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.metric-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.metric-tile strong {
  display: block;
  margin-top: 0.2rem;
  color: var(--text);
  font-size: 1.2rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  width: fit-content;
  color: var(--primary-strong);
  font-weight: 750;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.3rem;
  padding: 0.28rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.segmented-control button,
.segmented-control a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.segmented-control .active {
  background: var(--surface-raised);
  color: var(--primary-strong);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.payment-picker {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.check-row {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.78rem;
  align-items: center;
  min-height: 64px;
  padding: 0.84rem 1rem;
  background: var(--surface-raised);
}

.check-row:not(.compact) + .check-row:not(.compact)::before {
  position: absolute;
  top: 0;
  left: 1rem;
  right: 1rem;
  height: 1px;
  background: var(--border);
  content: "";
}

.check-row.urgent {
  background: var(--danger-soft);
}

.check-row.compact {
  min-height: 58px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0.75rem 1rem 0;
}

.check-row.is-paid {
  background: var(--surface-soft);
}

.check-row.is-paid strong,
.check-row.is-paid b {
  color: var(--muted);
}

.check-row.is-paid input {
  opacity: 0.72;
}

.check-row input {
  width: 1.22rem;
  height: 1.22rem;
  margin: 0;
  border-color: var(--border);
}

.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

.check-row span {
  min-width: 0;
}

.check-row b {
  white-space: nowrap;
  color: var(--text);
  font-size: 0.95rem;
}

.checkout-panel {
  position: sticky;
  bottom: calc(var(--nav-height) + 0.8rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.85rem;
  background: color-mix(in srgb, var(--surface-raised) 94%, transparent);
  backdrop-filter: blur(18px);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.12);
}

.checkout-panel span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.checkout-panel strong {
  display: block;
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1.2;
}

.checkout-panel .btn {
  min-height: 46px;
  padding-inline: 1rem;
  white-space: nowrap;
}

.success-state,
.return-state {
  text-align: center;
}

.success-state {
  padding: 1.4rem 1rem;
}

.success-state i {
  color: var(--accent);
  font-size: 2.4rem;
}

.success-state p,
.return-state p {
  max-width: 26rem;
  margin: 0.5rem auto 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.timeline-list {
  padding: 1rem;
}

.timeline-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
}

.timeline-item:first-child {
  border-top: 0;
}

.timeline-item strong {
  display: block;
  color: var(--text);
  font-size: 0.95rem;
}

.timeline-item em {
  color: var(--text);
  font-style: normal;
  font-weight: 750;
}

.payment-return {
  min-height: calc(100vh - 190px);
  justify-content: center;
}

.return-state {
  padding: 1.4rem 1rem;
}

.return-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 74px;
  height: 74px;
  margin-bottom: 1rem;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 2rem;
}

.payment-return.is-complete .return-icon {
  background: var(--accent-soft);
  color: var(--accent);
}

.payment-return:not(.is-complete) > .return-state .return-icon i {
  animation: spin 950ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.transaction-card {
  overflow: hidden;
}

.transaction-card summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  min-height: 72px;
  padding: 1rem;
  cursor: pointer;
  list-style: none;
}

.transaction-card summary::-webkit-details-marker {
  display: none;
}

.transaction-card summary strong,
.transaction-card summary b {
  color: var(--text);
  font-size: 0.98rem;
}

.transaction-details {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0 1rem 1rem;
}

.transaction-details div {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border);
}

.transaction-details span {
  color: var(--muted);
  font-size: 0.84rem;
}

.transaction-details strong {
  color: var(--text);
  font-size: 0.84rem;
  text-align: right;
}

.settings-list {
  gap: 0;
  overflow: hidden;
}

.settings-details {
  border-top: 0;
}

.settings-details summary {
  list-style: none;
  cursor: pointer;
}

.settings-details summary::-webkit-details-marker {
  display: none;
}

.settings-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  min-height: 58px;
  width: 100%;
  padding: 0.9rem 1rem;
  border: 0;
  border-top: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text);
  text-align: left;
}

.settings-row:first-child {
  border-top: 0;
}

.settings-row span {
  font-weight: 720;
}

.settings-chevron {
  transition: transform 0.18s ease;
}

.settings-details[open] .settings-chevron {
  transform: rotate(180deg);
}

.settings-documents {
  display: grid;
  gap: 0;
  padding: 0.15rem 0 0.35rem 0;
  border-top: 1px solid var(--border);
  background: var(--surface-raised);
}

.settings-documents a {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.7rem;
  align-items: center;
  min-height: 48px;
  padding: 0.72rem 1rem 0.72rem 2.85rem;
  color: var(--text);
  text-decoration: none;
}

.settings-documents a + a {
  border-top: 1px solid var(--border);
}

.settings-documents i {
  color: var(--primary-strong);
}

.settings-documents span {
  font-size: 0.93rem;
  font-weight: 680;
  line-height: 1.2;
}

.danger-text {
  color: var(--danger);
}

.notifications-list {
  display: flex;
  flex-direction: column;
  gap: 0.72rem;
}

.notification-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.78rem;
  align-items: center;
  min-height: 74px;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.notification-card.unread {
  background: var(--primary-soft);
}

.notification-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--primary-strong);
  font-size: 1.15rem;
}

.notification-icon.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.notification-icon.calendar {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.notification-icon.muted {
  background: var(--accent-soft);
  color: var(--accent);
}

.notification-card strong {
  display: block;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 760;
  line-height: 1.25;
}

.notification-card span {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.28;
}

.empty-state {
  display: flex;
  align-items: center;
  flex-direction: column;
  padding: 2rem 1.2rem;
  text-align: center;
}

.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 1.65rem;
}

.empty-icon-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.empty-state h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.12rem;
  font-weight: 780;
  letter-spacing: 0;
}

.empty-state p {
  max-width: 25rem;
  margin: 0.52rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

@media (min-width: 720px) {
  body {
    padding: 1.4rem 0;
  }

  .app-shell {
    min-height: calc(100vh - 2.8rem);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
  }

  .app-bottom-nav,
  .top-loader {
    border-radius: 0 0 20px 20px;
  }
}

@media (max-width: 390px) {
  .app-content {
    padding-inline: 0.75rem;
  }

  .app-header {
    gap: 0.65rem;
    padding-inline: 0.75rem;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
  }

  .header-actions {
    gap: 0.34rem;
  }

  .summary-panel,
  .section-heading,
  .payment-row,
  .check-row,
  .profile-card {
    padding-inline: 0.82rem;
  }

  .child-card-body {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.45rem;
  }

  .child-status-stack {
    align-items: flex-start;
  }

  .checkout-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .checkout-panel .btn {
    width: 100%;
  }
}
