/* =========================================================
   Parent Admin — standalone stylesheet
   Loaded only on admin pages (adminApp = true in render_head)
   ========================================================= */

/* Reset body for admin */
body.admin-app {
  margin: 0;
  background: #f1f5f9;
  background-image: none;
  color: #1e293b;
}

.admin-app input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.admin-app select,
.admin-app textarea {
  font-size: 16px;
}

/* ----------------------------------------------------------
   Shell: sidebar + workspace side-by-side
   ---------------------------------------------------------- */
.admin-shell {
  display: flex;
  min-height: 100dvh;
}

/* ----------------------------------------------------------
   Sidebar
   ---------------------------------------------------------- */
.admin-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: #1e1b4b;
  color: #e0e7ff;
  display: flex;
  flex-direction: column;
  padding: 0;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  z-index: 20;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-family {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-tagline {
  font-size: 0.7rem;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0.65rem;
  gap: 0.15rem;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.62rem 0.85rem;
  border-radius: 9px;
  text-decoration: none;
  color: rgba(224,231,255,0.8);
  font-weight: 500;
  font-size: 0.9rem;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}

.sidebar-link:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.sidebar-link.is-active {
  background: rgba(99,102,241,0.9);
  color: #fff;
  font-weight: 600;
}

.sidebar-link-icon {
  font-size: 1rem;
  width: 1.25rem;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 0.65rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar-link-alt  { color: rgba(224,231,255,0.7); }
.sidebar-link-danger { color: #fca5a5 !important; }
.sidebar-link-danger:hover { background: rgba(239,68,68,0.2) !important; color: #fecaca !important; }

/* ----------------------------------------------------------
   Workspace (right of sidebar)
   ---------------------------------------------------------- */
.admin-workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Top bar */
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  color: #1e293b;
}

.topbar-subtitle {
  margin: 0.1rem 0 0;
  color: #64748b;
  font-size: 0.85rem;
}

.topbar-kid-btn { flex-shrink: 0; }

/* Main content area */
.admin-main {
  padding: 1.5rem;
  flex: 1;
}

/* ----------------------------------------------------------
   Alerts / Toasts
   ---------------------------------------------------------- */
.admin-toast {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.85rem 1.1rem;
  border-radius: 10px;
  margin-bottom: 1.25rem;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.5;
}

.admin-toast-success {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #86efac;
}

.admin-toast-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.admin-toast-info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

/* ----------------------------------------------------------
   Stats row (Dashboard)
   ---------------------------------------------------------- */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.15rem 1.25rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: box-shadow 0.15s;
}

.stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.stat-icon-kids   { background: #ede9fe; }
.stat-icon-chores { background: #dcfce7; }
.stat-icon-done   { background: #fef9c3; }

.stat-num {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.1;
}

.stat-label {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 500;
}

/* Quick actions */
.admin-quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.quick-action-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  text-decoration: none;
  color: #1e293b;
  font-weight: 600;
  font-size: 0.9rem;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.quick-action-card:hover {
  border-color: #818cf8;
  box-shadow: 0 2px 8px rgba(99,102,241,0.15);
  color: #4338ca;
}

.quick-action-icon {
  font-size: 1.3rem;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border-radius: 9px;
  flex-shrink: 0;
}

/* ----------------------------------------------------------
   Page grid (form + list side by side)
   ---------------------------------------------------------- */
.admin-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.25rem;
  align-items: start;
}

/* ----------------------------------------------------------
   Sections (white cards)
   ---------------------------------------------------------- */
.admin-section {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.25rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid #f1f5f9;
}

.admin-section-header h2,
.admin-section h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 1.1rem;
  color: #1e293b;
}

.admin-section-header h2 { margin: 0; }

/* ----------------------------------------------------------
   Entity cards (kids list, chores list)
   ---------------------------------------------------------- */
.admin-entity-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.admin-entity-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  flex-wrap: wrap;
}

.admin-entity-card .item-body { flex: 1; min-width: 120px; }
.admin-entity-card .item-body strong { display: block; font-size: 0.95rem; color: #1e293b; margin-bottom: 0.2rem; }

.entity-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* ----------------------------------------------------------
   Badges
   ---------------------------------------------------------- */
.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-photo    { background: #dbeafe; color: #1e40af; }
.badge-inactive { background: #f1f5f9; color: #64748b; }
.badge-points   { background: #ede9fe; color: #5b21b6; }

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

/* ----------------------------------------------------------
   Forms
   ---------------------------------------------------------- */
.form label > span,
.form fieldset > legend {
  color: #374151;
}

.form input[type="text"],
.form input[type="password"],
.form input[type="number"],
.form input[type="date"],
.form select {
  background: #fff;
  border-color: #cbd5e1;
  color: #1e293b;
  border-radius: 8px;
}

.form input:focus,
.form select:focus {
  outline: none;
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 0.85rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding-top: 1rem;
  margin-top: 0.5rem;
  border-top: 1px solid #f1f5f9;
}

/* Pill checkboxes */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.45rem;
}

.checkbox-pill {
  display: flex !important;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.7rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500 !important;
  margin: 0 !important;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}

.checkbox-pill input { width: auto; margin: 0; }

.checkbox-pill:has(input:checked) {
  border-color: #818cf8;
  background: #eef2ff;
  color: #4338ca;
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.25rem 0 1rem;
}

/* File drop zone */
.form-file-drop {
  border: 2px dashed #cbd5e1;
  border-radius: 9px;
  padding: 0.85rem 1rem;
  background: #f8fafc;
  margin-bottom: 1rem;
}

.form-file-drop span {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
  color: #374151;
}

.form-file-drop input[type="file"] {
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  box-shadow: none !important;
}

/* Preview of avatar/photo in edit form */
.preview-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-radius: 9px;
  border: 1px solid #e2e8f0;
  margin-bottom: 1rem;
}

/* Empty state */
.empty-state-box {
  text-align: center;
  padding: 2.5rem 1rem;
  color: #94a3b8;
}

.empty-state-box .empty-icon {
  font-size: 2.25rem;
  display: block;
  margin-bottom: 0.5rem;
  opacity: 0.75;
}

/* ----------------------------------------------------------
   History page
   ---------------------------------------------------------- */
.history-filters {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.history-filters .form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: flex-end;
  margin: 0;
}

.history-filters label { margin: 0; flex: 1; min-width: 160px; }

.history-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.history-card .item-body { flex: 1; }

.history-thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 9px;
  border: 2px solid #e2e8f0;
  flex-shrink: 0;
}

.history-thumb-placeholder {
  width: 60px;
  height: 60px;
  border-radius: 9px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  color: #94a3b8;
}

/* ----------------------------------------------------------
   Login & Signup pages
   ---------------------------------------------------------- */
.admin-login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #1a1744 100%);
  position: relative;
  overflow: hidden;
}

.admin-login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(167,139,250,0.25) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(99,102,241,0.25) 0%, transparent 45%);
  pointer-events: none;
}

.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
  margin-bottom: 1.5rem;
  align-self: flex-start;
  opacity: 0.95;
  transition: opacity 0.15s;
}
.login-brand:hover { opacity: 1; }

.login-brand-icon { font-size: 1.4rem; line-height: 1; }

.admin-login-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 920px;
  width: 100%;
  background: #ffffff;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 40px 100px rgba(0,0,0,0.45), 0 0 0 1px rgba(167,139,250,0.15);
  position: relative;
  z-index: 1;
  color: #1e293b;
}

.admin-login-hero {
  padding: 3rem 2.5rem;
  background: linear-gradient(160deg, #312e81 0%, #4338ca 60%, #6366f1 100%);
  color: #fff;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.admin-login-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(167,139,250,0.4) 0%, transparent 50%);
  pointer-events: none;
}

.admin-login-hero > * { position: relative; z-index: 1; }

.admin-login-hero h1 {
  font-size: 2rem;
  line-height: 1.15;
  margin-bottom: 0.6rem;
  color: #fff;
  font-weight: 700;
}

.admin-login-hero p {
  opacity: 0.92;
  margin: 0 0 1.75rem;
  line-height: 1.55;
  font-size: 1rem;
  color: rgba(255,255,255,0.9);
}

.login-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(167,139,250,0.25);
  border: 1px solid rgba(167,139,250,0.5);
  color: #e0e7ff;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  margin-bottom: 1.25rem;
  align-self: flex-start;
}

.login-feature-list { list-style: none; padding: 0; margin: 0; }
.login-feature-list li {
  padding: 0.5rem 0 0.5rem 1.85rem;
  position: relative;
  font-size: 0.95rem;
  color: rgba(255,255,255,0.95);
  line-height: 1.4;
}
.login-feature-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 0.55rem;
  font-weight: 700;
  color: #ffffff;
  background: rgba(255,255,255,0.2);
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  line-height: 1;
}

.admin-login-form {
  padding: 3rem 2.5rem;
  color: #1e293b;
  display: flex;
  flex-direction: column;
}

.admin-login-form h2 {
  margin: 0 0 0.35rem;
  color: #0f172a;
  font-size: 1.65rem;
  font-weight: 700;
}

.admin-login-form .subtitle {
  color: #64748b;
  font-size: 0.95rem;
  margin: 0 0 1.5rem;
}

/* Force readable text on the white panel regardless of theme */
.admin-login-form,
.admin-login-form p,
.admin-login-form label,
.admin-login-form label > span,
.admin-login-form .form label > span {
  color: #334155;
}

.admin-login-form .form input[type="text"],
.admin-login-form .form input[type="email"],
.admin-login-form .form input[type="password"],
.admin-login-form .form select {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  color: #0f172a;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.admin-login-form .form input::placeholder { color: #94a3b8; }

.admin-login-form .form input:focus,
.admin-login-form .form select:focus {
  outline: none;
  border-color: #6366f1;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(99,102,241,0.15);
}

.admin-login-form .form label > span {
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.4rem;
}

.admin-login-form .form button[type="submit"] {
  margin-top: 0.5rem;
  width: 100%;
  padding: 0.95rem 1.25rem;
  font-size: 1.05rem;
  border-radius: 10px;
}

.admin-login-form .footer-link {
  color: #64748b;
  font-size: 0.92rem;
  text-align: center;
  margin-top: 1.25rem;
}

.admin-login-form .footer-link a {
  color: #6366f1;
  font-weight: 600;
  text-decoration: none;
}

.admin-login-form .footer-link a:hover {
  color: #4f46e5;
  text-decoration: underline;
}

.admin-login-form .form hr {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 1.5rem 0;
}

.admin-login-form .admin-toast {
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

.admin-login-form .admin-toast a {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
}

/* Password input with toggle */
.password-field {
  position: relative;
}
.password-field input {
  padding-right: 3rem !important;
}
.password-toggle {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 1.05rem;
  line-height: 1;
}
.password-toggle:hover { background: #f1f5f9; color: #334155; }

.signup-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0 1rem;
  color: #94a3b8;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.signup-divider::before,
.signup-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

@media (max-width: 760px) {
  .admin-login-page { padding: 1.5rem 1rem; }
  .admin-login-panel { grid-template-columns: 1fr; max-width: 480px; border-radius: 20px; }
  .admin-login-hero { padding: 1.75rem 1.75rem 1.5rem; }
  .admin-login-hero h1 { font-size: 1.5rem; }
  .admin-login-hero p { margin-bottom: 1rem; font-size: 0.95rem; }
  .login-brand { font-size: 1rem; margin-bottom: 1rem; }
  .login-feature-list { display: none; }
  .admin-login-form { padding: 1.75rem; }
}

/* ----------------------------------------------------------
   Admin Leaderboard
   ---------------------------------------------------------- */
.admin-leaderboard {
  margin-bottom: 1.25rem;
}

.lb-tabs {
  display: flex;
  gap: 0.3rem;
}

.lb-tab {
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.lb-tab:hover {
  background: #eef2ff;
  color: #4338ca;
  border-color: #c7d2fe;
}

.lb-tab.is-active {
  background: #4f46e5;
  color: #fff;
  border-color: #4f46e5;
}

.lb-panel { display: none; }
.lb-panel.is-active { display: block; }

.lb-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.8rem 1rem;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  transition: border-color 0.12s;
}

.lb-row:hover { border-color: #c7d2fe; }

.lb-row.lb-first {
  background: linear-gradient(135deg, #fef9c3 0%, #fef3c7 100%);
  border-color: #fde68a;
}

.lb-rank {
  font-size: 1.35rem;
  width: 2rem;
  text-align: center;
  flex-shrink: 0;
  line-height: 1;
}

.lb-info {
  flex: 1;
  min-width: 0;
}

.lb-name {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  color: #1e293b;
  margin-bottom: 0.25rem;
}

.lb-streak {
  font-weight: 600;
  font-size: 0.82rem;
  color: #ea580c;
  margin-left: 0.35rem;
}

.lb-progress-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.2rem;
  max-width: 180px;
}

.lb-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #818cf8);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.lb-progress-label {
  font-size: 0.73rem;
  color: #64748b;
}

.lb-points {
  font-size: 1.25rem;
  font-weight: 800;
  color: #4f46e5;
  flex-shrink: 0;
  text-align: right;
}

.lb-pts-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  text-align: right;
  margin-top: -2px;
}

/* ----------------------------------------------------------
   Button overrides for admin
   ---------------------------------------------------------- */
.btn-primary {
  background: #4f46e5;
}
.btn-primary:hover {
  background: #4338ca;
}

/* ----------------------------------------------------------
   Misc utilities
   ---------------------------------------------------------- */
.inline-form { display: inline; margin: 0; }

/* ----------------------------------------------------------
   Responsive: phone / tablet / desktop
   ---------------------------------------------------------- */

/* Shared nav badge */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #f59e0b;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  margin-left: auto;
}

.topbar-pending-badge {
  display: none;
  flex-shrink: 0;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}

.sidebar-expand-toggle { display: none; }

/* Mobile bottom tab bar — hidden on tablet+ */
.admin-bottom-nav,
.admin-more-sheet,
.admin-more-backdrop {
  display: none;
}

/* Pending approval card */
.pending-approval-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.15rem;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid #fcd34d;
  border-radius: 12px;
  text-decoration: none;
  color: #78350f;
  transition: box-shadow 0.15s;
}
.pending-approval-card:hover {
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.2);
}
.pending-approval-icon { font-size: 1.75rem; flex-shrink: 0; }
.pending-approval-body { flex: 1; min-width: 0; }
.pending-approval-body strong { display: block; font-size: 1rem; margin-bottom: 0.15rem; }
.pending-approval-body span { font-size: 0.85rem; opacity: 0.85; }
.pending-approval-arrow { font-weight: 700; flex-shrink: 0; }

/* History photo lightbox */
.history-lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(15, 23, 42, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-top: calc(1rem + env(safe-area-inset-top));
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}
.history-lightbox.hidden { display: none; }
.history-lightbox img {
  max-width: 100%;
  max-height: 90dvh;
  border-radius: 12px;
  object-fit: contain;
}
.history-lightbox-close {
  position: absolute;
  top: calc(0.75rem + env(safe-area-inset-top));
  right: 0.75rem;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
}
.history-thumb-btn {
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 9px;
  flex-shrink: 0;
}
.history-thumb-btn:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* Dashboard layout — single column on all breakpoints */
.dashboard-wide {
  display: block;
}

/* ── Phone + tablet: simplified dashboard (≤1024px) ── */
@media (max-width: 1024px) {
  .stat-card-kids {
    display: none;
  }

  .admin-quick-actions {
    display: none;
  }

  .admin-stats {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }
}

/* ── Phone: ≤767px ── */
@media (max-width: 767px) {
  .admin-shell { flex-direction: column; }

  .admin-sidebar {
    display: none;
  }

  .admin-workspace {
    padding-bottom: calc(4.25rem + env(safe-area-inset-bottom));
  }

  .admin-main { padding: 1rem; }
  .admin-topbar {
    padding: 0.85rem 1rem;
    position: sticky;
    top: 0;
  }
  .topbar-kid-btn { display: none; }
  .topbar-pending-badge { display: inline-flex; }

  .admin-grid { grid-template-columns: 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }

  .admin-stats .stat-card {
    padding: 0.85rem 1rem;
  }
  .admin-stats .stat-num {
    font-size: 1.5rem;
  }
  .entity-actions { width: 100%; justify-content: flex-end; }

  .admin-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  }

  .admin-bottom-link {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    min-height: 56px;
    padding: 0.35rem 0.15rem;
    border: none;
    background: transparent;
    text-decoration: none;
    color: #64748b;
    font-family: inherit;
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
  }

  .admin-bottom-link.is-active { color: #4f46e5; }
  .admin-bottom-icon { font-size: 1.25rem; line-height: 1; }
  .admin-bottom-link .nav-badge {
    position: absolute;
    top: 0.25rem;
    right: calc(50% - 1.35rem);
    margin-left: 0;
  }

  .admin-more-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 110;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }
  .admin-more-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .admin-more-sheet {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 120;
    background: #fff;
    border-radius: 16px 16px 0 0;
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform 0.25s ease;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.15);
  }
  .admin-more-sheet.is-open { transform: translateY(0); }

  .admin-more-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 1.05rem;
  }
  .admin-more-close {
    width: 44px;
    height: 44px;
    border: none;
    background: #f1f5f9;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
  }

  .admin-more-links {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }
  .admin-more-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    text-decoration: none;
    color: #1e293b;
    font-weight: 600;
    font-size: 0.95rem;
  }
  .admin-more-link.is-active { background: #eef2ff; color: #4f46e5; }
  .admin-more-link-danger { color: #dc2626; }

  body.admin-more-open { overflow: hidden; }
}

/* ── Tablet: 768–1024px — icon rail sidebar ── */
@media (min-width: 768px) and (max-width: 1024px) {
  .admin-app input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  .admin-app select,
  .admin-app textarea {
    font-size: 0.95rem;
  }

  .admin-sidebar {
    width: 72px;
    transition: width 0.2s ease;
    position: relative;
  }

  .admin-sidebar.is-expanded {
    width: 240px;
  }

  .sidebar-brand-text,
  .sidebar-link-text,
  .sidebar-footer .sidebar-link-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity 0.15s;
  }

  .admin-sidebar.is-expanded .sidebar-brand-text,
  .admin-sidebar.is-expanded .sidebar-link-text {
    opacity: 1;
    width: auto;
  }

  .sidebar-brand {
    justify-content: center;
    padding: 1rem 0.5rem;
  }
  .admin-sidebar.is-expanded .sidebar-brand {
    justify-content: flex-start;
    padding: 1.25rem 1rem 1rem;
  }

  .sidebar-link {
    justify-content: center;
    padding: 0.75rem;
    min-height: 48px;
  }
  .admin-sidebar.is-expanded .sidebar-link {
    justify-content: flex-start;
    padding: 0.62rem 0.85rem;
  }

  .sidebar-link .nav-badge {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    margin-left: 0;
    min-width: 1rem;
    height: 1rem;
    font-size: 0.6rem;
  }
  .admin-sidebar.is-expanded .sidebar-link .nav-badge {
    position: static;
    margin-left: auto;
  }

  .sidebar-link { position: relative; }

  .sidebar-expand-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    border: none;
    background: rgba(255,255,255,0.06);
    color: #e0e7ff;
    cursor: pointer;
    font-size: 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  .admin-sidebar.is-expanded .sidebar-expand-toggle span {
    transform: rotate(180deg);
    display: inline-block;
  }

  .sidebar-footer .sidebar-link {
    font-size: 0;
  }
  .admin-sidebar.is-expanded .sidebar-footer .sidebar-link {
    font-size: 0.9rem;
  }

  .admin-main { padding: 1.25rem; }
  .admin-grid { grid-template-columns: 1fr; }
  .form-grid-2 { grid-template-columns: 1fr 1fr; }

  .sidebar-link,
  .btn,
  .admin-bottom-link {
    min-height: 44px;
  }
}

/* ── Desktop: 1025px+ ── */
@media (min-width: 1025px) {
  .admin-app input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  .admin-app select,
  .admin-app textarea {
    font-size: 0.95rem;
  }

  .admin-workspace {
    max-width: calc(100vw - 240px);
  }

  .admin-main {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
  }

  .admin-topbar {
    position: sticky;
    top: 0;
    z-index: 15;
  }

  .topbar-pending-badge { display: inline-flex; }
}

/* Disable hover-only effects on touch devices */
@media (hover: none) {
  .stat-card:hover,
  .quick-action-card:hover,
  .pending-approval-card:hover {
    box-shadow: inherit;
  }
  .sidebar-link:hover {
    background: transparent;
    color: rgba(224,231,255,0.8);
  }
  .sidebar-link.is-active:hover {
    background: rgba(99,102,241,0.9);
    color: #fff;
  }
}

@media (prefers-reduced-motion: reduce) {
  .admin-sidebar,
  .admin-more-sheet,
  .admin-more-backdrop,
  .lb-progress-fill {
    transition: none !important;
  }
}
