/* Admin Dashboard Styles */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #ca8a04;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --white: #ffffff;
  --sidebar-width: 280px;

  /* Tokens the admin JS asks for (codebase review 1.14, 2026-10-18). Before these were defined,
     every use without a fallback fell back to the inherited value (e.g. the sale total rendered at
     body size). Tokens that already had a fallback are set to that fallback, so nothing changes. */
  --primary-light: #e3f2fd;
  --error: var(--danger);
  --info: var(--primary);
  --info-bg: #eff6ff;
  --info-text: #1e40af;
  --warning-bg: #fef3c7;
  --warning-text: #9a3412;
  --warning-700: #b45309;
  --text-secondary: var(--gray-500);
  --font-heading-1: var(--font-h3);  /* 32px */
  --font-heading-2: var(--font-h4);  /* 24px, walkthrough.css's fallback */
  --font-heading-3: var(--font-h5);  /* 20px */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  background: var(--gray-50);
  color: var(--gray-800);
}

/* Login */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-05);
  background: var(--gray-100);
}

.login-card {
  background: var(--white);
  border-radius: 12px;
  padding: var(--space-07);
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.login-header {
  text-align: center;
  margin-bottom: var(--space-06);
}

.login-header h1 {
  font-size: var(--font-h4);
  line-height: var(--lh-h4);
  font-weight: 700;
  margin-bottom: var(--space-02);
}

.login-header p {
  color: var(--gray-500);
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
}

/* Form Elements */
.form-group {
  margin-bottom: var(--space-04);
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: var(--space-02);
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  color: var(--gray-700);
}

.form-input, .form-select {
  width: 100%;
  padding: 0.75rem 0.75rem;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 2rem;
}

.form-input:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input-sm {
  padding: 0.5rem 0.75rem;
  font-size: var(--font-body-1);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-02);
  padding: 0.75rem 1rem;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  font-weight: 500;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
}

.btn-secondary:hover {
  background: var(--gray-200);
}

.btn-success {
  background: var(--success);
  color: var(--white);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

/* Suspend, Pause, Apply Late Fees, Request Cancellation (review 1.14: these rendered as a bare .btn) */
.btn-warning {
  background: var(--warning);
  color: var(--white);
}

.btn-warning:hover {
  background: #a16207;
}

.btn-link {
  background: none;
  color: var(--primary);
  text-decoration: underline;
}

.btn-sm {
  padding: 0.5rem 0.75rem;
  font-size: var(--font-body-3);
  line-height: var(--lh-body-3);
}

/* Tablet suggestion banner — inserted before admin layout to push content down */
.tablet-suggestion-banner {
  background: #1d4ed8;
  color: #fff;
  padding: 0.75rem 1rem;
  text-align: center;
  font-size: var(--font-body-1);
  z-index: 9999;
}
.tablet-suggestion-banner a { color: #fff; text-decoration: underline; font-weight: 600; }
.tablet-suggestion-banner button { background: none; border: none; color: #fff; font-size: var(--font-h5); cursor: pointer; margin-left: var(--space-03); vertical-align: middle; min-width: 44px; min-height: 44px; }

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
}

.btn-block {
  width: 100%;
}

/* Error/Success Messages */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: var(--space-04);
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
}

.alert-error {
  background: #fee2e2;
  color: var(--danger);
  border: 1px solid #fecaca;
}

.alert-success {
  background: #dcfce7;
  color: var(--success);
  border: 1px solid #bbf7d0;
}

.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.alert-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid #fde68a;
}

.text-muted {
  color: var(--gray-500);
}

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

/* Admin Layout */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--gray-900);
  color: var(--white);
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
}

.sidebar-header {
  padding: var(--space-05);
  border-bottom: 1px solid var(--gray-700);
}

.school-brand {
  display: flex;
  align-items: center;
  gap: var(--space-03);
}

.school-logo {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: var(--white);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.school-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.school-name {
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer {
  padding: var(--space-03) var(--space-05);
  border-top: 1px solid var(--gray-700);
  margin-top: auto;
}

.sidebar-app-name {
  font-size: var(--font-body-3);
  color: var(--gray-500);
  text-align: center;
}

.sidebar-nav {
  padding: 0.75rem 0;
}

.nav-section {
  padding: 0.5rem 1rem;
  font-size: var(--font-body-3);
  line-height: var(--lh-body-3);
  font-weight: 600;
  text-transform: uppercase;
  color: var(--gray-400);
  margin-top: var(--space-04);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-03);
  padding: 0.75rem 1.5rem;
  color: var(--gray-300);
  text-decoration: none;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  transition: all 0.2s;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--gray-800);
  color: var(--white);
}

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

.nav-icon {
  width: 20px;
  text-align: center;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
}

.top-bar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.page-title {
  font-size: var(--font-h5);
  line-height: var(--lh-h5);
  font-weight: 600;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: var(--space-03);
}

.topbar-clock {
  font-size: var(--font-body-3);
  line-height: var(--lh-body-3);
  color: var(--gray-500);
  white-space: nowrap;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
}

/* The avatar is a button: it opens My account (passkeys). */
button.user-avatar {
  border: none;
  padding: 0;
  font-family: inherit;
  color: inherit;
  cursor: pointer;
}

.page-content {
  padding: var(--space-05);
}

/* Dashboard Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-05);
  margin-bottom: var(--space-05);
}

.stat-card {
  background: var(--white);
  border-radius: 8px;
  padding: var(--space-05);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Opt-in interactive variant. Scoped to its own class so the plain .stat-card
   used elsewhere does not start looking clickable. */
.stat-card-clickable {
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.stat-card-clickable:hover {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.16);
  transform: translateY(-1px);
}
.stat-card-clickable:active {
  transform: translateY(0);
}
.stat-card-clickable:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .stat-card-clickable {
    transition: none;
  }
  .stat-card-clickable:hover {
    transform: none;
  }
}

.stat-label {
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  color: var(--gray-500);
  margin-bottom: var(--space-01);
}

.stat-value {
  font-size: var(--font-h4);
  line-height: var(--lh-h4);
  font-weight: 700;
  color: var(--gray-900);
}

.stat-change {
  font-size: var(--font-body-3);
  line-height: var(--lh-body-3);
  margin-top: var(--space-01);
}

.stat-change.positive {
  color: var(--success);
}

.stat-change.negative {
  color: var(--danger);
}

/* Cards */
.card {
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: var(--space-05);
}

.card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  font-weight: 600;
}

.card-body {
  padding: var(--space-05);
}

/* Tables */
.table-container {
  overflow-x: auto;
}

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

.table th,
.table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-100);
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
}

.table th {
  font-weight: 600;
  font-size: var(--font-body-3);
  line-height: var(--lh-body-3);
  text-transform: uppercase;
  color: var(--gray-500);
  background: var(--gray-50);
}

.table tr:hover {
  background: var(--gray-50);
}

.table-actions {
  display: flex;
  gap: var(--space-02);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: var(--font-body-3);
  line-height: var(--lh-body-3);
  font-weight: 500;
  border-radius: 20px;
}

.badge-success {
  background: #dcfce7;
  color: var(--success);
}

.badge-warning {
  background: #fef3c7;
  color: var(--warning);
}

.badge-danger {
  background: #fee2e2;
  color: var(--danger);
}

.badge-info {
  background: #dbeafe;
  color: var(--primary);
}

.badge-primary {
  background: #dbeafe;
  color: var(--primary);
}

.badge-secondary {
  background: var(--gray-200, #e5e7eb);
  color: var(--gray-700, #374151);
}

.badge-neutral {
  background: var(--gray-900, #111827);
  color: #fff;
}

.badge-error {
  background: #fee2e2;
  color: var(--danger);
}

/* Member Avatar */
.member-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  color: var(--gray-600);
}

.member-info {
  display: flex;
  align-items: center;
  gap: var(--space-03);
}

.member-name {
  font-weight: 500;
}

.member-email {
  font-size: var(--font-body-3);
  line-height: var(--lh-body-3);
  color: var(--gray-500);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal {
  background: var(--white);
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(-20px);
  transition: transform 0.2s ease;
}

/* Wider modal for table-heavy content (e.g. Billing Overview detail).
   Triggered by a marker class inside the modal body — pure CSS, no JS state. */
.modal:has(.modal-wide-content) {
  max-width: min(1400px, 95vw);
}
.modal-wide-content .table-scroll {
  overflow-x: auto;
  margin: 0 calc(-1 * var(--space-05));
  padding: 0 var(--space-05);
}

/* Billing Overview detail modal — section + table polish */
.billing-section {
  margin-bottom: var(--space-06);
}
.billing-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-03) var(--space-04);
  border-radius: 6px;
  margin-bottom: var(--space-03);
  border-left: 3px solid var(--gray-300);
  background: var(--gray-100);
}
.billing-section--paid .billing-section-header {
  background: rgba(40, 167, 69, 0.08);
  border-left-color: var(--success);
}
.billing-section--pending .billing-section-header {
  background: rgba(255, 193, 7, 0.08);
  border-left-color: var(--warning);
}
.billing-section-total {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.billing-section--paid .billing-section-total {
  color: var(--success);
}
.billing-section--pending .billing-section-total {
  color: #b8860b; /* darker amber for legibility on light background */
}
.billing-section .table tbody tr {
  transition: background 0.1s ease;
}
.billing-section .table tbody tr:hover {
  background: var(--gray-100);
}
.billing-section .table .amount-cell {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.billing-section .table .date-cell {
  white-space: nowrap;
}
.billing-section .table .status-cell .badge {
  display: inline-block;
  min-width: 72px;
  text-align: center;
}
.billing-section .table tbody tr[data-action] {
  cursor: pointer;
}
.billing-section .table tbody tr[data-action]:hover .member-name {
  text-decoration: underline;
}
.billing-section .member-name {
  font-weight: 500;
  color: inherit;
}
.billing-section-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-02);
  padding: var(--space-05);
  color: var(--gray-500);
  font-style: italic;
  background: var(--gray-50, #f9fafb);
  border-radius: 6px;
}

/* Stripe Elements iframe needs explicit stacking in modal context */
#card-element {
  position: relative;
  z-index: 1;
  min-height: 24px;
}

.modal-overlay.show .modal {
  transform: translateY(0);
}

.modal-header {
  padding: var(--space-05);
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: var(--font-h4);
  color: var(--gray-400);
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--gray-600);
}

.modal-body {
  padding: var(--space-05);
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-100);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-03);
}

/* Search & Filters */
.toolbar {
  display: flex;
  gap: var(--space-03);
  margin-bottom: var(--space-05);
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--space-07);
  color: var(--gray-500);
}

.empty-state-icon {
  font-size: var(--font-h2);
  margin-bottom: var(--space-04);
  opacity: 0.5;
}

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-07);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
    z-index: 200;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .toolbar {
    flex-direction: column;
  }

  .search-input {
    width: 100%;
  }
}

/* Toggle Switch */
.toggle-label {
  display: flex;
  align-items: center;
  gap: var(--space-03);
  cursor: pointer;
  user-select: none;
}

.toggle-switch {
  appearance: none;
  -webkit-appearance: none;
  width: 48px;
  height: 26px;
  background: var(--gray-300);
  border-radius: 26px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-switch::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch:checked {
  background: var(--primary);
}

.toggle-switch:checked::before {
  transform: translateX(22px);
}

.toggle-switch:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.toggle-text {
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  color: var(--gray-700);
}

/* Package Form Layout */
.package-form-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: var(--space-05);
  padding-bottom: var(--space-10);
}

.package-form-layout .form-column {
  background: var(--white);
  border-radius: 12px;
  padding: var(--space-05);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.package-form-layout .preview-column {
  position: sticky;
  top: 20px;
  align-self: start;
}

.pricing-preview {
  background: var(--white);
  border-radius: 12px;
  padding: var(--space-05);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pricing-preview h3 {
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: var(--space-04);
  padding-bottom: var(--space-03);
  border-bottom: 1px solid var(--gray-200);
}

.pricing-line {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
}

.pricing-line.total {
  font-weight: 600;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  border-top: 2px solid var(--gray-200);
  margin-top: var(--space-02);
  padding-top: var(--space-03);
}

.pricing-line.highlight {
  background: var(--gray-50);
  margin: 0 -1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  color: var(--primary);
}

.pricing-line .label {
  color: var(--gray-600);
}

.pricing-line .value {
  color: var(--gray-800);
}

.pricing-line .value.discount {
  color: var(--success);
}

.pricing-section {
  margin-bottom: var(--space-05);
}

.pricing-section:last-child {
  margin-bottom: 0;
}

.pricing-section-title {
  font-size: var(--font-body-3);
  line-height: var(--lh-body-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  margin-bottom: var(--space-02);
}

/* Payment Schedule List */
.schedule-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-02);
}

.schedule-item {
  display: flex;
  align-items: center;
  gap: var(--space-03);
  padding: 0.75rem 0.75rem;
  background: var(--gray-50);
  border-radius: 8px;
}

.schedule-item.first {
  background: var(--primary-light, #e3f2fd);
  border: 1px solid var(--primary);
}

.schedule-number {
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-200);
  border-radius: 50%;
  font-size: var(--font-body-3);
  line-height: var(--lh-body-3);
  font-weight: 600;
  color: var(--gray-600);
}

.schedule-item.first .schedule-number {
  background: var(--primary);
  color: white;
}

.schedule-details {
  flex: 1;
}

.schedule-desc {
  font-weight: 500;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
}

.schedule-date {
  font-size: var(--font-body-3);
  line-height: var(--lh-body-3);
  color: var(--gray-500);
}

.schedule-amount {
  font-weight: 600;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
}

/* Payment date editing toolbar */
.schedule-toolbar {
  padding: 0.5rem 1rem;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: var(--space-03);
  flex-wrap: wrap;
}

.schedule-toolbar-check {
  display: flex;
  align-items: center;
  gap: var(--space-02);
  font-size: var(--font-body-3);
  line-height: var(--lh-body-3);
  cursor: pointer;
}

.schedule-toolbar-divider {
  color: var(--gray-300);
}

.schedule-toolbar-group {
  display: flex;
  align-items: center;
  gap: var(--space-02);
}

.schedule-toolbar-label {
  font-size: var(--font-body-3);
  line-height: var(--lh-body-3);
}

.schedule-toolbar-input {
  height: 28px;
  font-size: var(--font-body-3);
  line-height: var(--lh-body-3);
  padding: 0.25rem 0.5rem;
}

.payment-date-checkbox {
  cursor: pointer;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.payment-date-input {
  max-width: 150px;
  font-size: var(--font-body-3);
  line-height: var(--lh-body-3);
  padding: 0.25rem 0.5rem;
  margin-top: var(--space-01);
}

/* Sticky Footer: the one fixed action bar for long forms (codebase review Phase 4d, 2026-10-18:
   four pages hand-wrote their own with left: 240px against a 280px sidebar). */
.sticky-footer {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  padding: 1rem 1.5rem;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-03);
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.sticky-footer .footer-left {
  display: flex;
  align-items: center;
  gap: var(--space-03);
}

.sticky-footer .footer-right {
  display: flex;
  gap: var(--space-03);
}

/* Page Header with Back Link */
.page-header-with-back {
  margin-bottom: var(--space-05);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-02);
  color: var(--gray-500);
  text-decoration: none;
  font-size: var(--font-body-1);
  line-height: var(--lh-body-1);
  margin-bottom: var(--space-02);
}

.back-link:hover {
  color: var(--primary);
}

.page-header-with-back h1 {
  font-size: var(--font-h4);
  line-height: var(--lh-h4);
  font-weight: 600;
  color: var(--gray-800);
}

/* Form Section Divider */
.form-section-title {
  font-size: var(--font-body-3);
  line-height: var(--lh-body-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  margin: 1.5rem 0 0.75rem;
  padding-top: var(--space-04);
  border-top: 1px solid var(--gray-200);
}

.form-section-title:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* Responsive: Stack columns on smaller screens */
@media (max-width: 767.98px) {
  .package-form-layout {
    grid-template-columns: 1fr;
  }

  .package-form-layout .preview-column {
    position: static;
    order: -1;
  }

  .sticky-footer {
    left: 0;
  }
}

/* ========================================
   Attendance Schedule View
   ======================================== */

/* Day tabs row */
.day-tabs {
  display: flex;
  gap: var(--space-01);
}

.day-tab {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--gray-200);
  background: white;
  font-weight: 500;
  font-size: var(--font-body-1);
  transition: all 0.2s;
}

.day-tab:hover {
  background: var(--gray-50);
}

.day-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.day-tab.today:not(.active) {
  border-color: var(--primary);
  color: var(--primary);
}

/* Week navigation */
.week-nav {
  display: flex;
  align-items: center;
  gap: var(--space-02);
}

.week-nav-label {
  font-weight: 600;
  font-size: var(--font-body-1);
  min-width: 180px;
  text-align: center;
}

/* Class cards */
.class-card {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: var(--space-04);
  margin-bottom: var(--space-03);
  background: white;
}

.class-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-03);
}

.class-card-name {
  font-weight: 600;
  font-size: var(--font-body-1);
  margin-right: var(--space-03);
}

.class-card-time {
  color: var(--gray-500);
  font-size: var(--font-body-3);
}

.class-card-count {
  font-size: var(--font-body-3);
  color: var(--gray-500);
  white-space: nowrap;
}

.class-card-members {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-02);
  margin-bottom: var(--space-03);
}

.checkin-member-chip {
  display: flex;
  align-items: center;
  gap: var(--space-02);
  padding: 0.25rem 0.75rem 0.25rem 0.25rem;
  background: var(--gray-50);
  border-radius: 20px;
  font-size: var(--font-body-3);
}

/* Check-in modal search results */
.checkin-search-results {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  margin-top: var(--space-02);
}

.checkin-member-item {
  display: flex;
  align-items: center;
  gap: var(--space-03);
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.15s;
}

.checkin-member-item:last-child {
  border-bottom: none;
}

.checkin-member-item:hover {
  background: var(--gray-50);
}

.checkin-member-item.selected {
  background: #eff6ff;
  border-color: var(--primary);
}

/* ========================================
   POS 2-Column Layout
   ======================================== */

.pos-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-04);
  align-content: start;
}

.pos-product-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: var(--space-04);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.pos-product-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}

.pos-product-name {
  font-weight: 600;
  font-size: var(--font-body-1);
  margin-bottom: var(--space-01);
}

.pos-product-price {
  color: var(--gray-500);
  font-size: var(--font-body-1);
}

.pos-cart-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--gray-100);
}

.pos-cart-item:last-child {
  border-bottom: none;
}

.pos-customer-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.pos-cart-column {
  display: flex;
  flex-direction: column;
}

/* Mobile responsive — attendance schedule */
@media (max-width: 575.98px) {
  .day-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }
  .day-tab {
    flex-shrink: 0;
    padding: 0.5rem 0.75rem;
    font-size: var(--font-body-3);
  }
  .week-nav {
    flex-wrap: wrap;
    justify-content: center;
  }
  .week-nav-label {
    min-width: auto;
    order: -1;
    width: 100%;
    text-align: center;
    margin-bottom: var(--space-02);
  }
  .class-card-members {
    flex-direction: column;
  }
  .class-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-01);
  }
}

/* Portal invite table — responsive */
@media (max-width: 767.98px) {
  .portal-invite-col-members {
    display: none;
  }
}

.search-result-item:hover { background: var(--gray-100); }

/* Dashboard top row: 50% (stats + revenue) | 50% (billing overview parent) */
.dashboard-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-05);
  margin-bottom: var(--space-05);
}
.dashboard-row-left {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-05);
  min-width: 0;
}
.dashboard-row-right {
  min-width: 0;
}
.dashboard-row-right > .card {
  height: 100%;
  margin: 0;
}
.dashboard-col-stats {
  display: flex;
  flex-direction: column;
  gap: var(--space-03);
  min-width: 180px;
}
.dashboard-col-stats .stat-card {
  flex: 1;
}
.dashboard-col-revenue {
  min-width: 0;
  container-type: inline-size;
}
.dashboard-projected-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-05);
  margin-bottom: var(--space-05);
}
.dashboard-billing-clickable {
  cursor: pointer;
  transition: box-shadow 0.15s ease;
}
.dashboard-billing-clickable:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
@media (max-width: 1023px) {
  .dashboard-row { grid-template-columns: 1fr; }
  .dashboard-projected-row { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .dashboard-row-left { grid-template-columns: 1fr; }
}

/* Revenue visualization card */
.revenue-card-inner {
  display: grid;
  grid-template-columns: minmax(0, 180px) minmax(0, 1fr);
  gap: var(--space-05);
  align-items: center;
}
.revenue-chart-container {
  width: 100%;
  max-width: 180px;
  aspect-ratio: 1;
  margin: 0 auto;
}
.revenue-breakdown {
  display: flex;
  flex-direction: column;
  gap: var(--space-03);
}
.revenue-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--font-body-1);
}
.revenue-row-label {
  display: flex;
  align-items: center;
  gap: var(--space-02);
}
.revenue-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.revenue-pct {
  color: var(--gray-400);
  font-size: var(--font-body-3);
  min-width: 40px;
  text-align: right;
}
/* Invoices list — single-row layout. All cells stay on one line; items column
   truncates with ellipsis and surfaces full content on hover via title attr;
   actions cell keeps buttons inline regardless of width. */
.invoices-table th,
.invoices-table td {
  white-space: nowrap;
}
.invoices-table .col-items {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.invoices-table .col-actions .btn {
  margin-right: 4px;
}
.invoices-table .col-actions .btn:last-child {
  margin-right: 0;
}

/* Stack donut + breakdown AND the card header (title/dropdown vs total/refunds)
   when the revenue card column itself gets cramped, not when the viewport does.
   The 50/50 dashboard-row split makes this trigger well above 600px viewport
   width, so the old @media query was too late. */
@container (max-width: 420px) {
  .revenue-card-inner { grid-template-columns: 1fr; justify-items: center; }
  .revenue-breakdown { width: 100%; }
  .dashboard-col-revenue .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-02);
  }
}
