/* HBGS Design System - Combined CSS */
/* Auto-generated by scripts/build-css.js — do not edit directly */
/* Edit the individual files in css/split/ then run: node scripts/build-css.js */

/* ===== base.css ===== */
/* HBGS Design System v2.1 - Base (Variables, Reset, Typography) */
/* Build 1.4.0-beta.11 */
/* Google Fonts loaded via <link> in index.html for parallel loading */

:root {
  /* Brand Colors - Highbridge Green */
  --hbgs-green-50: #f0fdf4;
  --hbgs-green-100: #dcfce7;
  --hbgs-green-200: #bbf7d0;
  --hbgs-green-300: #86efac;
  --hbgs-green-400: #4ade80;
  --hbgs-green-500: #22c55e;
  --hbgs-green-600: #16a34a;
  --hbgs-green-700: #15803d;
  --hbgs-green-800: #166534;
  --hbgs-green-900: #14532d;

  /* Neutral Colors */
  --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;

  /* Semantic Colors */
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --danger: #ef4444;
  --info: #3b82f6;

  /* Bus Student Highlight */
  --bus-bg: #fef9c3;
  --bus-border: #fde047;
  --bus-text: #854d0e;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 20px 40px -8px rgba(22, 101, 52, 0.15);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;

  /* v4.7.1: Z-index scale - consolidated to prevent conflicts */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-sidebar: 400;
  --z-modal-backdrop: 500;
  --z-modal: 600;
  --z-popover: 700;
  --z-tooltip: 800;
  --z-toast: 900;
  --z-splash: 1000;

  /* Layout */
  --sidebar-width: 260px;
  --header-height: 64px;
  --touch-target: 44px;
  --control-height: 44px;
  --content-max-width: 1440px;
  --mobile-gutter: 14px;
  --bottom-nav-height: 68px;

  /* Shared spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* Shared component geometry */
  --radius-control: 8px;
  --radius-card: 10px;
  --radius-modal: 12px;
  --font-size-body: 14px;
  --font-size-supporting: 13px;
  --line-height-body: 1.5;
  --line-height-compact: 1.35;

  /* Safe Areas */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  /* Theme-aware colors (Light mode defaults) */
  --primary: #16a34a;
  --primary-color: #16a34a; /* v4.7.2: Alias for legacy references in pages.css/dashboard.css */
  --primary-light: rgba(22, 163, 74, 0.08);
  --primary-hover: #15803d;
  --border-primary: #16a34a;
  --info-rgb: 59, 130, 246;
  --gray-0: #ffffff; /* v4.7.2: Missing from scale, referenced in dashboard.css */
  --bg-primary: #ffffff;
  --card-bg: #ffffff;
  --bg-secondary: #f3f4f6;
  --bg-tertiary: #e5e7eb;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --text-tertiary: #9ca3af;
  --border-color: #e5e7eb;
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* v4.7.1: Accessible focus indicators for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--hbgs-green-600, #16a34a);
  outline-offset: 2px;
}

/* Remove outline for mouse clicks (only show for keyboard) */
:focus:not(:focus-visible) {
  outline: none;
}

/* Native app behavior - prevent overscroll/bounce */
html {
  /* iOS PWA fix: When using black-translucent status bar, the document moves UP
     into the status bar area, creating a white gap at the bottom.
     Adding safe-area-inset-top to min-height compensates for this. */
  min-height: calc(100% + env(safe-area-inset-top));
  background: var(--gray-50);
  overscroll-behavior: none;
}

html, body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--gray-50);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  color: var(--gray-900);
  min-height: 100%;
  width: 100%;
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: none;
  overscroll-behavior-y: contain;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* PWA standalone mode */
@media all and (display-mode: standalone) {
  html, body {
    background: var(--gray-50);
  }

  .app-layout {
    height: 100%;
  }
}

/* Notification highlight animation */
@keyframes highlight-pulse {
  0% { background-color: rgba(22, 163, 74, 0.3); }
  50% { background-color: rgba(22, 163, 74, 0.15); }
  100% { background-color: transparent; }
}

/* Custom Scrollbar Styles */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--gray-300) transparent;
}

/* Date picker calendar icon - ensure visibility in dark mode */
input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.7;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.dark-mode input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.8);
}

@media (prefers-color-scheme: dark) {
  input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.8);
  }
}

/* ===== layout.css ===== */
/* HBGS Design System v2.1 - Layout */

/* ============================================
   LAYOUT
   ============================================ */

.app-layout {
  display: flex;
  position: fixed;
  inset: 0;
  background: var(--gray-50);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background: var(--hbgs-green-900);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: var(--z-sidebar); /* v4.7.2: Use z-index variable */
  overflow: hidden;
}

.sidebar-header {
  flex-shrink: 0; /* Prevent header from shrinking */
  padding: 20px;
  padding-top: calc(12px + var(--safe-top));
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  width: 44px;
  height: 44px;
  background: white;
  border-radius: var(--radius-md);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.sidebar-title {
  color: white;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.sidebar-subtitle {
  color: var(--hbgs-green-300);
  font-size: 12px;
  font-weight: 500;
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  min-height: 0; /* Important: allows flex item to shrink below content size */
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 24px;
}

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

/* Ensure last nav item can scroll fully into view */
.nav-section:last-child .nav-item:last-child {
  scroll-margin-bottom: 16px;
}

.nav-section-title {
  color: var(--hbgs-green-400);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 12px;
  margin-bottom: 8px;
}

/* Collapsible nav sections */
.nav-section-collapsible .nav-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 8px 12px;
  margin: 0 0 4px 0;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  user-select: none;
}

.nav-section-collapsible .nav-section-title:hover {
  background: rgba(255,255,255,0.05);
}

.nav-section-arrow {
  font-size: 10px;
  transition: transform 0.2s ease;
  opacity: 0.6;
}

.nav-section-collapsible.collapsed .nav-section-arrow {
  transform: rotate(-90deg);
}

.nav-section-items {
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease;
  max-height: 1000px;
  opacity: 1;
}

.nav-section-collapsible.collapsed .nav-section-items {
  max-height: 0;
  opacity: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: var(--hbgs-green-100);
  text-decoration: none;
  font-weight: 500;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 14px;
  font-family: inherit;
  position: relative;
}

@media (hover: hover) {
  .nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
  }
}

.nav-item.active {
  background: var(--hbgs-green-600);
  color: white;
}

.nav-item-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.nav-item-badge {
  margin-left: auto;
  background: var(--hbgs-green-500);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

.nav-item.active .nav-item-badge {
  background: white;
  color: var(--hbgs-green-700);
}

.nav-item-badge.soon {
  background: var(--hbgs-green-700);
  font-size: 10px;
}

/* WIP (Work In Progress) badge */
.wip-badge {
  margin-left: auto;
  background: #f59e0b;
  color: #1a1a1a;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.nav-item.active .wip-badge {
  background: #fbbf24;
  color: #1a1a1a;
}

/* Favorite star icon on nav items */
.nav-item-fav {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.15s, color 0.15s;
  color: var(--hbgs-green-300);
  z-index: 1;
  line-height: 1;
  padding: 4px;
}

@media (hover: hover) {
  .nav-item:hover .nav-item-fav {
    opacity: 0.5;
  }
  .nav-item:hover .nav-item-fav:hover {
    opacity: 1;
    color: #facc15;
  }
  .nav-item:hover .nav-item-fav.favorited:hover {
    opacity: 0.6;
  }
}

.nav-item-fav.favorited {
  opacity: 1;
  color: #facc15;
}

/* Remove button on favorite clones */
.nav-fav-remove {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.15s, color 0.15s;
  color: var(--hbgs-green-300);
  z-index: 1;
  line-height: 1;
  padding: 4px;
}

@media (hover: hover) {
  .nav-item:hover .nav-fav-remove {
    opacity: 0.5;
  }
  .nav-item:hover .nav-fav-remove:hover {
    opacity: 1;
    color: #ef4444;
  }
}

.nav-item-fav .nav-fav-icon {
  width: 14px;
  height: 14px;
  display: block;
}

/* Favorites section styling */
.nav-favorites-section .nav-section-title span:first-child::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  vertical-align: -1px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='m12 2 3 7 7 .6-5.3 4.6 1.6 6.8L12 17.5 5.7 21l1.6-6.8L2 9.6 9 9Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='m12 2 3 7 7 .6-5.3 4.6 1.6 6.8L12 17.5 5.7 21l1.6-6.8L2 9.6 9 9Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.nav-item.disabled,
.nav-item:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Notification badges in nav */
.nav-notification-badge {
  background: #ef4444;
  min-width: 18px;
  text-align: center;
}

.nav-item.active .nav-notification-badge {
  background: #ef4444;
  color: white;
}

/* Sidebar version row - hidden, using footer instead */
.sidebar-version-row {
  display: none;
}

.sidebar-bug-btn {
  background: rgba(239, 68, 68, 0.2);
  border: none;
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
}

.sidebar-bug-btn:hover {
  background: rgba(239, 68, 68, 0.3);
}

/* Sidebar Footer */
.sidebar-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer-row,
.sidebar-footer-inline {
  display: none;
}

.sidebar-version {
  color: var(--hbgs-green-400);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.version-badge-beta {
  /* Calm flat dark: quiet green wash pill, no gradient, no pulse */
  background: rgba(34, 197, 94, 0.14);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

@keyframes betaPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.dark-mode-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: none;
  background: rgba(255,255,255,0.1);
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.dark-mode-btn:hover {
  background: rgba(255,255,255,0.2);
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  overflow: hidden;
}

/* Top Header */
.top-header {
  height: var(--header-height);
  min-height: var(--header-height);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: var(--z-sticky); /* v4.7.2: Use z-index variable */
  gap: 16px;
}

.page-title-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.term-archive-chip {
  align-items: center;
  max-width: min(34vw, 260px);
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid color-mix(in srgb, var(--warning, #f59e0b) 40%, var(--border-color));
  border-radius: 999px;
  background: color-mix(in srgb, var(--warning, #f59e0b) 10%, var(--bg-primary));
  color: var(--warning-text, #92400e);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mobile menu button - hidden on desktop */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--gray-700);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.mobile-menu-btn:hover {
  background: var(--gray-100);
}

/* v4.7.2: .page-title moved to components.css (single source of truth) */

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-shrink: 0;
}

.header-action-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 6px;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.header-action-btn:hover {
  background: var(--bg-secondary);
}

/* User Dropdown Menu */
.header-user-dropdown {
  position: relative;
}

.header-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 6px 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-width: 0;
}

.header-user-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

.header-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
  flex: 0 0 20px;
}

.header-action-icon .hbgs-icon {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.header-user-avatar {
  background: transparent;
  border-radius: 0;
}

.header-user-name {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 14px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-user-caret {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.header-user-dropdown.open .header-user-caret {
  transform: rotate(180deg);
}

.header-dropdown-menu {
  position: fixed;
  top: calc(var(--header-height) + 4px);
  right: 24px;
  min-width: 240px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  display: none;
  z-index: var(--z-popover); /* v4.7.2: Use z-index variable instead of 99999 */
}

.header-user-dropdown.open .header-dropdown-menu {
  display: block;
}

.header-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  text-align: left;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.header-dropdown-item:first-child {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.header-dropdown-item:last-child {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.header-dropdown-item:hover {
  background: var(--bg-secondary);
}

.header-dropdown-school-term {
  padding: 12px 16px;
}

.profile-school-term-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.profile-school-term-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.profile-school-term-kicker {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-school-term-status {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.35;
}

.profile-school-term-status.is-archive {
  color: var(--warning, #b45309);
  font-weight: 700;
}

.profile-school-term-select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
}

.profile-school-term-select.is-archive {
  border-color: var(--warning, #b45309);
}

.profile-school-term-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.profile-school-term-reset {
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--warning, #b45309);
  border-color: color-mix(in srgb, var(--warning, #f59e0b) 40%, var(--border-color));
  background: color-mix(in srgb, var(--warning, #f59e0b) 10%, var(--bg-primary));
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.profile-school-term-reset:hover {
  background: var(--bg-tertiary);
}

.header-dropdown-school-term.is-archive {
  background: color-mix(in srgb, #f59e0b 7%, transparent);
}

.header-dropdown-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.header-dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

.header-dropdown-logout {
  color: var(--error);
}

.header-dropdown-logout:hover {
  background: #fee2e2;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  z-index: 1;
  min-width: 0;
}

/* v4.13.1: Page transition fade-in — eliminates visible flicker on navigation */
@keyframes pageFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.page-fade-in {
  animation: pageFadeIn 120ms ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .page-fade-in { animation: none; }
}

/* ============================================
   NOTIFICATIONS
   ============================================ */

.notification-dropdown {
  position: relative;
}

.notification-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  position: relative;
  transition: background 0.2s, color 0.2s;
}

.notification-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.notification-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 600;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-badge.hidden {
  display: none;
}

.notification-panel,
.notification-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 360px;
  max-height: 480px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-popover); /* v4.7.2: Use z-index variable instead of 1000 */
  display: none;
  overflow: hidden;
}

.notification-panel.open,
.notification-menu.open {
  display: block;
}

.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.notification-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

/* Close button - hidden on desktop, shown on mobile */
.notification-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.notification-close-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.notification-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.notification-mark-all {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-family: inherit;
}

.notification-mark-all:hover {
  background: var(--bg-secondary);
}

.notification-actions-bar {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.notification-action-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.notification-action-btn:hover {
  color: var(--text-primary);
  border-color: var(--primary);
  background: var(--bg-tertiary);
}

.notification-action-btn.danger:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.notification-action-btn svg {
  flex-shrink: 0;
}

.notification-list {
  max-height: 360px;
  overflow-y: auto;
}

.push-enable-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-secondary);
  gap: 12px;
}

.push-enable-banner .btn {
  padding: 6px 12px;
  font-size: 12px;
  white-space: nowrap;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.2s;
}

.notification-item:hover {
  background: var(--bg-secondary);
}

.notification-item.unread {
  background: var(--bg-secondary);
}

.notification-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: 10px;
  font-size: 18px;
}

/* Notification types share one restrained accent; urgency remains on status badges. */
.notification-icon.attendance,
.notification-icon.bathroom,
.notification-icon.copies,
.notification-icon.supplies,
.notification-icon.tech,
.notification-icon.unblock,
.notification-icon.timeoff,
.notification-icon.calendar,
.notification-icon.other {
  background: var(--primary-light);
}

.notification-content {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.notification-text {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 4px;
  word-wrap: break-word;
}

.notification-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  line-height: 1.4;
  word-wrap: break-word;
}

.notification-time {
  font-size: 12px;
  color: var(--text-tertiary);
}

.notification-item-title {
  font-weight: 500;
  margin-bottom: 4px;
}

.notification-item-body {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.notification-item-time {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* Enhanced Notification Center - v2.7 */
.notification-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.notification-history-btn,
.notification-settings-btn {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  transition: background 0.15s;
}

.notification-history-btn:hover,
.notification-settings-btn:hover {
  background: var(--bg-secondary);
}

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

.notification-filters {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-secondary);
}

.notification-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  font-family: inherit;
}

.notification-filter:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.notification-filter.active {
  background: var(--hbgs-green-500);
  color: white;
  border-color: var(--hbgs-green-500);
}

.notification-filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 16px;
  height: 16px;
  line-height: 1;
}

.notification-filter.active .notification-filter-badge {
  background: rgba(255,255,255,0.3);
}

.notification-group {
  border-bottom: 1px solid var(--border-color);
}

.notification-group:last-child {
  border-bottom: none;
}

.notification-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: background 0.15s;
}

.notification-group-header:hover {
  background: var(--bg-tertiary);
}

.notification-group-icon {
  font-size: 18px;
}

.notification-group-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  flex: 1;
}

.notification-group-badge {
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.notification-group-arrow {
  color: var(--text-muted);
  font-size: 16px;
}

.notification-group-items {
  background: var(--bg-primary);
}

.notification-group-items .notification-item {
  padding-left: 24px;
}

.notification-group-more {
  padding: 10px 24px;
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
  cursor: pointer;
}

.notification-group-more:hover {
  background: var(--bg-secondary);
}

.notification-footer {
  padding: 10px 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

/* Header icon buttons - SVG icons */
.notification-history-btn,
.notification-settings-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.notification-history-btn svg,
.notification-settings-btn svg {
  color: var(--text-secondary);
  transition: color 0.15s;
}

.notification-history-btn:hover svg,
.notification-settings-btn:hover svg {
  color: var(--text-primary);
}

.notification-history-btn.active svg {
  color: var(--hbgs-green-500);
}

/* v3.0 - Urgent Notification Styles */
.notification-badge.urgent {
  animation: badge-pulse 1.5s ease-in-out infinite;
  background: #dc2626;
}

@keyframes badge-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  50% { transform: scale(1.1); box-shadow: 0 0 0 4px rgba(220, 38, 38, 0); }
}

.notification-urgent-section {
  background: rgba(220, 38, 38, 0.05);
  border-bottom: 1px solid var(--border-color);
}

.notification-section-header {
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.notification-section-header.urgent {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
  border-bottom: 1px solid rgba(220, 38, 38, 0.2);
}

.notification-item.priority-urgent {
  border-left: 3px solid #dc2626;
  background: rgba(220, 38, 38, 0.03);
}

.notification-item.priority-urgent:hover {
  background: rgba(220, 38, 38, 0.08);
}

.notification-item.priority-action {
  border-left: 3px solid #f59e0b;
}

.notification-priority-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.notification-priority-badge.urgent {
  background: #dc2626;
  color: white;
  animation: priority-pulse 2s ease-in-out infinite;
}

@keyframes priority-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.notification-urgent-indicator {
  font-size: 8px;
  vertical-align: middle;
  animation: indicator-pulse 2s infinite;
}

@keyframes indicator-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Bathroom nav badge - urgent style */
.nav-notification-badge[data-notification-type="bathroom"] {
  background: #dc2626;
}

/* Attendance nav badge */
.nav-notification-badge[data-notification-type="attendance"] {
  background: #f59e0b;
}

/* v3.8.6 - Enhanced Notification Center UI */

/* Back button when filtered */
.notification-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  margin-right: 8px;
  background: var(--bg-secondary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.notification-back-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Fix unread indicator position */
.notification-item {
  position: relative;
}

/* Loading state */
.notification-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.notification-loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-color);
  border-top-color: var(--hbgs-green-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Generic loading spinner */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 14px;
  gap: 12px;
}

.loading-spinner::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

/* Skeleton loading placeholder */
.skeleton-loader {
  padding: 24px;
}

.skeleton-loader .skeleton-header {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  align-items: center;
}

.skeleton-loader .skeleton-line {
  height: 14px;
  background: var(--border-color);
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}

.skeleton-loader .skeleton-line::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent);
  animation: shimmer 1.5s infinite;
}

.skeleton-loader .skeleton-line.skeleton-lg { height: 20px; width: 40%; }
.skeleton-loader .skeleton-line.skeleton-md { height: 14px; width: 65%; }
.skeleton-loader .skeleton-line.skeleton-sm { height: 12px; width: 30%; }

.skeleton-loader .skeleton-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.skeleton-loader .skeleton-stat-card {
  flex: 1;
  height: 64px;
  background: var(--border-color);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.skeleton-loader .skeleton-stat-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent);
  animation: shimmer 1.5s infinite;
}

.skeleton-loader .skeleton-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-loader .skeleton-row {
  height: 44px;
  background: var(--border-color);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.skeleton-loader .skeleton-row::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent);
  animation: shimmer 1.5s infinite;
}

.skeleton-loader .skeleton-row:nth-child(2) { opacity: .7; }
.skeleton-loader .skeleton-row:nth-child(3) { opacity: .5; }
.skeleton-loader .skeleton-row:nth-child(4) { opacity: .3; }
.skeleton-loader .skeleton-row:nth-child(5) { opacity: .15; }

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Improved empty state */
.notification-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.notification-empty svg {
  opacity: 0.3;
  margin-bottom: 16px;
}

.notification-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.notification-empty-desc {
  font-size: 13px;
  color: var(--text-muted);
}

/* Retry button */
.notification-retry-btn {
  margin-top: 16px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--hbgs-green-500);
  background: transparent;
  border: 1px solid var(--hbgs-green-500);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.notification-retry-btn:hover {
  background: var(--hbgs-green-500);
  color: white;
}

/* Disabled action buttons */
.notification-action-btn.disabled,
.notification-action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Individual dismiss button */
.notification-dismiss-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  padding: 0;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0;
  color: var(--text-muted);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-item:hover .notification-dismiss-btn {
  opacity: 1;
}

.notification-dismiss-btn:hover {
  background: var(--bg-tertiary);
  color: var(--danger);
}

/* Truncated message */
.notification-desc.truncated {
  cursor: default;
}

/* Better scrollbar for filters */
.notification-filters {
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.notification-filters::-webkit-scrollbar {
  height: 4px;
}

.notification-filters::-webkit-scrollbar-track {
  background: transparent;
}

.notification-filters::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.notification-filters::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Swipe hint on mobile */
@media (max-width: 768px) {
  .notification-dismiss-btn {
    display: none;
  }

  .notification-item {
    touch-action: pan-y;
  }
}

/* ===== components.css ===== */
/* HBGS Design System v2.1 - Components */

/* ============================================
   COMPONENTS
   ============================================ */

/* Page Header - used above cards */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.page-title {
  font-size: 24px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.page-subtitle {
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
  color: var(--text-secondary);
  margin: var(--space-1) 0 0;
}

.page-header-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: 9px var(--space-4);
  font-size: var(--font-size-body);
  line-height: var(--line-height-compact);
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), opacity var(--transition-fast);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--hbgs-green-700);
}

.btn-secondary,
.btn-outline {
  background: var(--card-bg);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover:not(:disabled),
.btn-outline:hover:not(:disabled) {
  background: var(--bg-secondary);
  border-color: var(--hbgs-refined-line-strong, var(--gray-400));
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.btn-outline.btn-danger {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
}

.btn-outline.btn-danger:hover:not(:disabled) {
  background: #fee2e2;
}

.btn-sm {
  padding: 7px var(--space-3);
  font-size: var(--font-size-supporting);
}

.btn-lg {
  min-height: 48px;
  padding: 12px var(--space-6);
  font-size: 16px;
}

.btn-icon {
  width: var(--touch-target);
  min-width: var(--touch-target);
  padding: 0;
}

/* Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  box-shadow: none;
  overflow: hidden;
  margin-bottom: var(--space-4);
}

.card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.card-title {
  font-size: 16px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.card-subtitle {
  font-size: var(--font-size-supporting);
  line-height: 1.45;
  color: var(--text-secondary);
  margin-top: 2px;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

.card-body-flush {
  padding: 0;
}

.card-footer {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

/* Card Controls - filter row below header */
.card-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.card-controls-filters {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.card-controls input[type="text"],
.card-controls input[type="search"],
.card-controls input[type="date"],
.card-controls select {
  flex: 1;
  min-width: 120px;
}

.card-controls-filters select {
  flex: 1;
  min-width: 100px;
}

.card-controls .btn {
  flex-shrink: 0;
}

/* Stats Card */
.stats-card {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: calc(100vh - 140px);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 20px 24px;
}

.stat-box {
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  text-align: center;
}

.stat-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--hbgs-green-700);
  line-height: 1;
}

.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 8px;
}

.stats-breakdown {
  flex: 1;
  padding: 0 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stats-section {
  flex: 1;
  padding: 16px 24px;
}

.stats-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  margin-bottom: 12px;
}

.stats-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 32px;
}

.stats-list-empty {
  font-size: 13px;
  color: var(--gray-400);
  font-style: italic;
  padding: 4px 0;
}

.stats-list-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  background: var(--gray-50);
  border-radius: var(--radius-md);
  font-size: 13px;
  gap: 10px;
  overflow: hidden;
}

.stats-list-rank {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-200);
  color: var(--gray-600);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
}

.stats-list-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.stats-list-name {
  color: var(--gray-700);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  line-height: 1.3;
}

.stats-list-class {
  font-size: 11px;
  color: var(--gray-400);
  font-weight: 400;
  line-height: 1.3;
  margin-top: 1px;
}

.stats-list-label {
  color: var(--gray-700);
  font-weight: 500;
}

.stats-list-value {
  font-weight: 700;
  color: var(--hbgs-green-700);
  flex-shrink: 0;
  white-space: nowrap;
}

.stat-box-sm {
  padding: 12px;
}

.stat-box-sm .stat-value {
  font-size: 1.25rem;
}

.stat-box-sm .stat-label {
  font-size: 0.6875rem;
}

/* Single stat highlight - centered large stat */
.stat-highlight {
  text-align: center;
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
}

.stat-highlight .stat-value {
  font-size: 48px;
  font-weight: 700;
  color: var(--hbgs-green-600);
  line-height: 1;
}

.stat-highlight .stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 8px;
}

/* Dismissal note in table */
.dismissal-note {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 2px;
  font-style: italic;
  line-height: 1.4;
}

.dismissal-student-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.stats-insight {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  font-size: 13px;
}

.stats-insight-label {
  color: var(--text-secondary);
}

.stats-insight-value {
  font-weight: 600;
  color: var(--text-primary);
}

/* Bathroom Log Styles */
.bathroom-controls {
  display: flex;
  gap: 12px;
  padding: 0 24px 16px;
}

.bathroom-controls input,
.bathroom-controls select {
  flex: 1;
}

.btn-block {
  display: block;
  width: calc(100% - 48px);
  margin: 0 24px 16px;
}

.bathroom-section {
  border-top: 1px solid var(--gray-100);
}

.bathroom-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--gray-50);
}

.bathroom-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
}

.bathroom-section-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--hbgs-green-700);
  background: var(--hbgs-green-100);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.bathroom-out-list {
  padding: 12px 24px;
}

.empty-state-inline {
  font-size: 13px;
  color: var(--gray-400);
  font-style: italic;
  padding: 8px 0;
}

.bathroom-out-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  margin-bottom: 8px;
}

.bathroom-out-item:last-child {
  margin-bottom: 0;
}

.bathroom-out-item.bathroom-out-long {
  background: #fef3c7;
  border: 1px solid #fcd34d;
}

.bathroom-out-item.bathroom-out-frequent {
  background: #fee2e2;
  border: 1px solid #fca5a5;
}

.bathroom-out-item.bathroom-out-long.bathroom-out-frequent {
  background: linear-gradient(135deg, #fef3c7 50%, #fee2e2 50%);
  border: 1px solid #f87171;
}

.bathroom-frequent-badge {
  display: inline-block;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 8px;
}

.bathroom-out-info {
  flex: 1;
}

.bathroom-out-name {
  font-weight: 600;
  color: var(--gray-900);
}

.bathroom-out-info .link-btn {
  font-weight: 600;
  font-size: inherit;
}

.bathroom-out-meta {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 2px;
}

.bathroom-out-timer {
  font-size: 18px;
  font-weight: 700;
  color: var(--hbgs-green-700);
  min-width: 60px;
  text-align: center;
}

.bathroom-out-timer.timer-warning {
  color: #d97706;
}

.duration-warning {
  color: #d97706;
  font-weight: 600;
}

.list-row-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

/* Card Grid - two-panel layout (main content + sidebar) */
/* v5.0.1: Use proportional columns so main table gets more space than stats sidebar */
.card-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1024px) {
  .card-grid {
    grid-template-columns: 1fr 320px;
  }
}

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

/* Tables */
.table-wrapper,
.table-responsive,
.data-table-wrapper {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text-primary);
}

.data-table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: 11px;
  line-height: 1.3;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-color);
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
}

.data-table tbody tr {
  background: transparent;
}

.data-table tbody tr:hover {
  background: var(--bg-secondary);
}

.data-table tbody tr.bus-row {
  background: var(--bus-bg);
}

.data-table tbody tr.bus-row:hover {
  background: #fef08a;
}

.data-table tbody tr.selected {
  background: var(--hbgs-green-50);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
  background: var(--gray-100);
  color: var(--gray-700);
}

.badge-success {
  background: var(--hbgs-green-100);
  color: var(--hbgs-green-800);
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-error,
.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge-info {
  background: #dbeafe;
  color: #1e40af;
}

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

/* Nav Badge (for sidebar items) */
.nav-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 700;
  border-radius: 4px;
  margin-left: auto;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-badge.wip {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.nav-badge.beta {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
}

.nav-badge.new {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

/* Contact Pills */
.contacts-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.contact-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 16px;
  background: var(--gray-100);
  color: var(--gray-800);
  white-space: nowrap;
}

.contact-pill-link {
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.contact-pill-link:hover {
  background: var(--primary);
  color: white;
}

.contact-rel {
  color: var(--gray-500);
  font-weight: 400;
  font-size: 11px;
}

.contact-more {
  font-size: 11px;
  color: var(--primary);
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
}

.contact-more:hover {
  color: var(--primary-hover);
  text-decoration-style: solid;
}

.student-name-text {
  font-weight: 600;
  color: var(--hbgs-green-600);
}

.student-name-link {
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
}

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

.badge-bus {
  background: var(--bus-bg);
  color: var(--bus-text);
}

.badge-signin {
  background: var(--hbgs-green-100);
  color: var(--hbgs-green-800);
}

.badge-signout {
  background: #ffedd5;
  color: #c2410c;
}

/* Red Flag Styles */
.red-flag-row,
.red-flag-student {
  background: rgba(220, 38, 38, 0.08);
  border-left: 3px solid var(--danger);
}

.red-flag-row:hover,
.red-flag-student:hover {
  background: rgba(220, 38, 38, 0.15);
}

.avatar-danger {
  background: var(--danger) !important;
  color: white !important;
}

.btn-danger {
  background: var(--danger);
  color: white;
  border: 1px solid var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
  border-color: #b91c1c;
}

/* Forms */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: var(--font-size-supporting);
  line-height: var(--line-height-compact);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-input,
.form-select,
input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
textarea,
select {
  width: 100%;
  min-height: var(--control-height);
  padding: 9px var(--space-3);
  font-size: var(--font-size-body);
  line-height: var(--line-height-compact);
  font-family: inherit;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-control);
  background: var(--card-bg);
  color: var(--text-primary);
  transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
}

input[type="search"] {
  -webkit-appearance: none;
  appearance: none;
}

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
}

.form-input:focus,
.form-select:focus,
input[type="text"]:focus,
input[type="search"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--hbgs-refined-green, var(--hbgs-green-500));
  box-shadow: none;
}

.form-input:focus-visible,
.form-select:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--hbgs-refined-green, var(--hbgs-green-600));
  outline-offset: 2px;
}

.form-input::placeholder,
input[type="text"]::placeholder,
input[type="search"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="number"]::placeholder {
  color: var(--gray-400);
}

/* Form Row - for JS compatibility */
.form-row {
  margin-bottom: 20px;
}

.form-row label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-hint {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
  margin-bottom: 0;
}

.form-row-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-row-inline label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  cursor: pointer;
}

/* Input with addon */
.input-with-addon {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-with-addon select {
  flex: 1;
}

.input-addon-text {
  font-size: 13px;
  color: var(--gray-500);
}

/* Search Row - for JS compatibility */
.search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 24px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-100);
}

.search-row input[type="text"] {
  flex: 1;
  min-width: 200px;
  max-width: 300px;
}

.search-row select {
  width: auto;
  min-width: 140px;
}

/* Actions Row - for JS compatibility */
.actions-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.actions-row input[type="date"],
.actions-row select {
  width: auto;
  min-width: 140px;
}

/* Data Shell - for JS compatibility */
.data-shell {
  padding: 0;
}

.data-empty {
  min-height: 132px;
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
}

/* Enhanced Empty States */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  padding: var(--space-8) var(--space-5);
  text-align: center;
}

.empty-state-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: var(--space-3);
}

.empty-state-title {
  font-size: 16px;
  line-height: 1.3;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-2);
}

.empty-state-text {
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
  color: var(--text-secondary);
  margin: 0;
  max-width: 32rem;
}

.empty-state-action {
  margin-top: var(--space-4);
}

/* Action Buttons - inline buttons in table rows */
.action-btns {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

/* Minimalistic Icons */
.icon {
  width: 14px;
  height: 14px;
  display: inline-block;
  vertical-align: middle;
  opacity: 0.8;
}

/* Icon with text - add margin */
.icon + span,
span + .icon {
  margin-left: 6px;
}

/* When icon is inside a button with text */
.btn .icon:first-child:not(:last-child) {
  margin-right: 6px;
}

/* Icon-only buttons */
.btn .icon:only-child {
  margin: 0;
}

/* Bare icon buttons - no button styling */
.icon-btn {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  opacity: 1;
}

.icon-btn .icon {
  width: 18px;
  height: 18px;
  opacity: 1;
}

.icon-btn.danger .icon {
  filter: var(--icon-filter, none) brightness(0) saturate(100%) invert(27%) sepia(95%) saturate(5478%) hue-rotate(355deg) brightness(102%) contrast(95%);
}

[data-theme="dark"] .icon-btn.danger .icon {
  filter: invert(1) brightness(0) saturate(100%) invert(27%) sepia(95%) saturate(5478%) hue-rotate(355deg) brightness(130%) contrast(95%);
}

.icon-edit {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7'/%3E%3Cpath d='M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  filter: var(--icon-filter, none);
}

.icon-delete {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  filter: var(--icon-filter, none);
}

.icon-key {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  filter: var(--icon-filter, none);
}

.icon-history {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  filter: var(--icon-filter, none);
}

.icon-export {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='7 10 12 15 17 10'/%3E%3Cline x1='12' y1='15' x2='12' y2='3'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  filter: var(--icon-filter, none);
}

.icon-import {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='17 8 12 3 7 8'/%3E%3Cline x1='12' y1='3' x2='12' y2='15'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  filter: var(--icon-filter, none);
}

.icon-tablet {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='2' width='16' height='20' rx='2' ry='2'/%3E%3Cline x1='12' y1='18' x2='12.01' y2='18'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  filter: var(--icon-filter, none);
}

.icon-shield {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  filter: var(--icon-filter, none);
}

.icon-user {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  filter: var(--icon-filter, none);
}

.icon-bus {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l2-2h12l2 2v10H4z'/%3E%3Crect x='4' y='10' width='16' height='6'/%3E%3Ccircle cx='7.5' cy='18.5' r='1.5'/%3E%3Ccircle cx='16.5' cy='18.5' r='1.5'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  filter: var(--icon-filter, none);
}

.icon-check {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  filter: var(--icon-filter, none);
}

.icon-undo {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='1 4 1 10 7 10'/%3E%3Cpath d='M3.51 15a9 9 0 1 0 2.13-9.36L1 10'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  filter: var(--icon-filter, none);
}

.icon-eye {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  filter: var(--icon-filter, none);
}

.icon-database {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cellipse cx='12' cy='5' rx='9' ry='3'/%3E%3Cpath d='M21 12c0 1.66-4 3-9 3s-9-1.34-9-3'/%3E%3Cpath d='M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  filter: var(--icon-filter, none);
}

.icon-download {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='7 10 12 15 17 10'/%3E%3Cline x1='12' y1='15' x2='12' y2='3'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  filter: var(--icon-filter, none);
}

.icon-upload {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='17 8 12 3 7 8'/%3E%3Cline x1='12' y1='3' x2='12' y2='15'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  filter: var(--icon-filter, none);
}

.icon-refresh {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='23 4 23 10 17 10'/%3E%3Cpolyline points='1 20 1 14 7 14'/%3E%3Cpath d='M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  filter: var(--icon-filter, none);
}

.icon-save {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z'/%3E%3Cpolyline points='17 21 17 13 7 13 7 21'/%3E%3Cpolyline points='7 3 7 8 15 8'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  filter: var(--icon-filter, none);
}

.icon-restore {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='1 4 1 10 7 10'/%3E%3Cpath d='M3.51 15a9 9 0 1 0 2.13-9.36L1 10'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  filter: var(--icon-filter, none);
}

.icon-clock {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  filter: var(--icon-filter, none);
}

.icon-folder {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  filter: var(--icon-filter, none);
}

/* List Row - for JS compatibility (modal student list) */
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.list-row:hover {
  background: var(--gray-50);
}

.list-row.bus-row {
  background: var(--bus-bg);
}

.list-row.bus-row:hover {
  background: #fef08a;
}

.list-primary {
  font-weight: 600;
  color: var(--gray-900);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.list-secondary {
  font-size: 13px;
  color: var(--gray-500);
}

/* Avatar Component */
.avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: var(--radius-md);
  background: var(--hbgs-green-100);
  color: var(--hbgs-green-800);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.avatar.avatar-class {
  font-size: 12px;
  font-weight: 600;
}

.student-icon {
  font-size: 0;
}

.student-icon::before {
  content: '';
  width: 20px;
  height: 20px;
  background: currentColor;
  display: block;
  opacity: 0.9;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 2h6v2h2a3 3 0 0 1 3 3v11a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3h2V2Zm2 3h2V4h-2v1ZM7 6a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H7Zm5 7a3 3 0 1 1 0-6 3 3 0 0 1 0 6Zm-5 4.5c.9-2.25 2.7-3.5 5-3.5s4.1 1.25 5 3.5V18H7v-.5Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 2h6v2h2a3 3 0 0 1 3 3v11a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3h2V2Zm2 3h2V4h-2v1ZM7 6a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H7Zm5 7a3 3 0 1 1 0-6 3 3 0 0 1 0 6Zm-5 4.5c.9-2.25 2.7-3.5 5-3.5s4.1 1.25 5 3.5V18H7v-.5Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.staff-icon {
  font-size: 0 !important;
}

.staff-icon::before {
  content: '';
  width: 20px;
  height: 20px;
  background: currentColor;
  display: block;
  opacity: 0.9;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4a4 4 0 1 1 0 8 4 4 0 0 1 0-8Zm0 10c3.15 0 5.75 2.15 6.5 5H5.5c.75-2.85 3.35-5 6.5-5Zm-3.3 1.1L12 18l3.3-2.9c-.95-.7-2.1-1.1-3.3-1.1s-2.35.4-3.3 1.1Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4a4 4 0 1 1 0 8 4 4 0 0 1 0-8Zm0 10c3.15 0 5.75 2.15 6.5 5H5.5c.75-2.85 3.35-5 6.5-5Zm-3.3 1.1L12 18l3.3-2.9c-.95-.7-2.1-1.1-3.3-1.1s-2.35.4-3.3 1.1Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.avatar.bus {
  background: var(--bus-bg);
  color: var(--bus-text);
}

.avatar-cell {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.avatar-cell > :not(.avatar) {
  min-width: 0;
  flex: 1;
}

.avatar-info-name {
  font-weight: 600;
  color: var(--gray-900);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.avatar-info-sub {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 2px;
}

/* Staff name cell - better alignment */
.staff-name-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 0;
}

.staff-name-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.staff-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.staff-email {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Small search input for header rows */
.search-input-sm {
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  color: var(--text-primary);
  min-width: 160px;
}

.search-input-sm:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 101, 52, 0.1);
}

/* Link Button - clickable text that looks like plain text */
.link-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  display: block;
  max-width: 100%;
  font-weight: 600;
  color: var(--gray-900);
  cursor: pointer;
  text-align: left;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
}

.link-btn:hover {
  color: var(--hbgs-green-700);
}

/* History Summary - for JS compatibility */
.history-summary {
  padding: 16px 20px;
  background: var(--hbgs-green-50);
  border-radius: var(--radius-md);
  margin: 16px;
  font-weight: 600;
  color: var(--hbgs-green-800);
}

/* Actions Cell - for JS compatibility */
.actions-cell {
  position: relative;
  display: inline-block;
}

.actions-menu,
.signin-actions-menu,
.student-actions-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--bg-primary); /* v4.7.2: Use CSS variable for dark mode compat */
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
  min-width: 160px;
  z-index: 50;
  display: none;
}

.actions-menu.open,
.signin-actions-menu.open,
.student-actions-menu.open {
  display: block;
}

.actions-menu-item,
.signin-action-item,
.student-action-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--gray-700);
  cursor: pointer;
  transition: background var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.actions-menu-item:hover,
.signin-action-item:hover,
.student-action-item:hover {
  background: var(--gray-50);
}

.actions-menu-item-danger {
  color: var(--error);
}

.actions-menu-item-danger:hover {
  background: #fef2f2;
}

/* Bus Toggle Label */
.bus-toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
}

/* Modal styles consolidated in modals.css */

/* History Modal Styles */
.history-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}

.history-avatar {
  width: 56px;
  height: 56px;
  min-width: 56px;
  border-radius: var(--radius-lg);
  background: var(--hbgs-green-100);
  color: var(--hbgs-green-800);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
}

.history-info h3 {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 700;
}

.history-info p {
  margin: 0;
  font-size: 14px;
  color: var(--gray-600);
}

.history-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.history-stat {
  text-align: center;
  padding: 12px;
  background: var(--gray-50);
  border-radius: var(--radius-md);
}

.history-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-900);
}

.history-stat-label {
  font-size: 12px;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Hidden utility */
.hidden {
  display: none !important;
}


/* ============================================
   VIEW AS FEATURE
   ============================================ */

.view-as-container {
  margin-right: 16px;
}

.view-as-select {
  padding: 6px 12px;
  font-size: 13px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  background: var(--bg-primary); /* v4.7.2: Use CSS variable for dark mode compat */
  color: var(--gray-700);
  cursor: pointer;
  min-width: 180px;
}

.view-as-select:focus {
  outline: none;
  border-color: var(--hbgs-green-500);
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
}

.view-as-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px 16px;
  background: linear-gradient(90deg, #f59e0b, #d97706);
  color: white;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.view-as-banner .btn-sm {
  padding: 6px 14px;
  font-size: 12px;
  background: rgba(255,255,255,0.2);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.view-as-banner .btn-sm:hover {
  background: rgba(255,255,255,0.3);
}

/* Viewing As Mode - Visual indicators throughout the UI */
.viewing-as-mode .header-user-avatar {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3);
}

.viewing-as-mode .header-user-name {
  color: #f59e0b;
  font-weight: 600;
}

.viewing-as-mode .header-user-btn {
  background: rgba(245, 158, 11, 0.1);
  border-radius: var(--radius-md);
}

/* Dark mode */
[data-theme="dark"] .view-as-select {
  background: var(--gray-800);
  border-color: var(--gray-600);
  color: var(--gray-200);
}

[data-theme="dark"] .view-as-select:focus {
  border-color: var(--hbgs-green-500);
}

/* ============================================
   STUDENTS DIRECTORY ENHANCEMENTS
   ============================================ */

.phone-link {
  color: var(--hbgs-green-600);
  text-decoration: none;
}

.phone-link:hover {
  text-decoration: underline;
}

.bus-cell {
  text-align: center;
  font-size: 18px;
}

[data-theme="dark"] .phone-link {
  color: var(--hbgs-green-400);
}

/* ========== LIST CARDS (Copy Requests, etc) ========== */
.list-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: border-color var(--transition-fast);
}

.list-card:hover {
  border-color: var(--hbgs-green-500);
}

.list-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.list-card-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
}

.list-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.list-card-body {
  margin-bottom: 12px;
}

.list-card-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.list-card-requester {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.list-card-notes {
  margin-top: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.list-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Canceled List Card */
.list-card.canceled {
  opacity: 0.6;
  background: var(--bg-tertiary);
}

.list-card.canceled:hover {
  border-color: var(--border-color);
}

.list-card.canceled .list-card-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* ============================================
   Copy Request Cards
   ============================================ */

.copy-card-layout {
  display: flex;
  gap: 16px;
}

.copy-card-main {
  flex: 1;
  min-width: 0;
}

.copy-card-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  min-width: 120px;
}

.copy-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.copy-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.copy-requester {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.copy-requester strong {
  color: var(--text-primary);
}

.copy-card-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.copy-detail {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.875rem;
}

.copy-detail-label {
  color: var(--text-secondary);
  min-width: 60px;
}

.copy-detail-value {
  color: var(--text-primary);
  font-weight: 500;
}

.copy-detail-link {
  color: var(--primary);
  text-decoration: none;
}

.copy-detail-link:hover {
  text-decoration: underline;
}

.copy-card-notes {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

.copy-card-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
  line-height: 1.4;
}

.copy-card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
}

.copy-card-actions .btn {
  width: 100%;
  justify-content: center;
}

/* Responsive */
@media (max-width: 600px) {
  .copy-card-layout {
    flex-direction: column;
  }

  .copy-card-side {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    min-width: 0;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    margin-top: 12px;
  }

  .copy-card-actions {
    flex-direction: row;
  }

  .copy-card-actions .btn {
    width: auto;
  }
}

/* Tabs Row */
.tabs-row {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-top: 8px;
}

.tab-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--hbgs-green-100);
  color: var(--hbgs-green-700);
}

[data-theme="dark"] .tab-btn.active {
  background: var(--hbgs-green-900);
  color: var(--hbgs-green-300);
}

/* Day Total */
.day-total {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Checkbox Group */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.checkbox-group .checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--text-primary);
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Team Member Items */
.team-members-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.team-member-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
}

.team-member-name {
  flex: 1;
  font-weight: 500;
  color: var(--text-primary);
}

.team-member-qty {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.team-member-qty-input {
  width: 70px;
  min-width: 70px;
  max-width: 70px;
  flex-shrink: 0;
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  text-align: center;
  background: var(--bg-primary);
  color: var(--text-primary);
}

.team-member-qty-input:focus {
  outline: none;
  border-color: var(--hbgs-green-500);
}

[data-theme="dark"] .team-member-qty-input {
  background: var(--gray-100);
  border-color: var(--gray-300);
  color: var(--gray-900);
}

.team-member-item .btn-ghost {
  padding: 4px 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.team-member-item .btn-ghost:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

[data-theme="dark"] .team-member-item {
  background: var(--gray-800);
}

/* Small button variants */
.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
}

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

.btn-success:hover {
  background: var(--success-dark, #059669);
}

/* ========== ALERTS ========== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--warning);
  color: var(--warning);
}

.alert-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--danger);
  color: var(--danger);
}

.alert-success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid var(--success);
  color: var(--success);
}

.form-error {
  font-size: 0.875rem;
}

/* ========== INFO BOX ========== */
.info-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.info-box-title {
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.info-box-content p {
  margin: 8px 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ========== DISMISSED ROW ========== */
.dismissed-row {
  opacity: 0.5;
  background: var(--bg-secondary);
}

.dismissed-row td {
  text-decoration: line-through;
}

.dismissed-row td:first-child,
.dismissed-row td:last-child {
  text-decoration: none;
}

/* ========== CHECKBOX LABEL ========== */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ========== LINK WARNING ========== */
.link-warning {
  background: var(--warning-bg, #fef3c7);
  border: 1px solid var(--warning-border, #f59e0b);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 8px;
  font-size: 0.875rem;
}

.link-warning-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--warning-text, #92400e);
}

.link-warning-icon {
  font-size: 1.1em;
}

.link-warning p {
  margin: 8px 0;
  color: var(--text-secondary);
}

.link-warning ol {
  margin: 8px 0 8px 20px;
  padding: 0;
  color: var(--text-secondary);
}

.link-warning ol li {
  margin: 4px 0;
}

.link-warning-tip {
  background: var(--bg-secondary);
  padding: 8px;
  border-radius: var(--radius-sm);
  margin-top: 10px !important;
  font-size: 0.8125rem;
}

/* Early Dismissal - Fixed Time Display */
.fixed-time-display {
  background: var(--bg-secondary);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  border: 1px solid var(--border-primary);
}

/* Approved Badge */
.approved-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--hbgs-green-50);
  color: var(--hbgs-green-700);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
}

/* Dismissed row styling */
.dismissed-row {
  opacity: 0.6;
  background: var(--bg-secondary) !important;
}

.dismissed-row td {
  text-decoration: line-through;
  color: var(--text-muted);
}

.dismissed-row td:first-child,
.dismissed-row td:last-child,
.dismissed-row .approved-badge {
  text-decoration: none;
}

/* Date Navigation */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

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

.search-box input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg-primary);
  color: var(--text-primary);
}

.search-box input:focus {
  outline: none;
  border-color: var(--hbgs-green-500);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-nav input[type="date"] {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
}

.date-nav input[type="date"]:focus {
  outline: none;
  border-color: var(--hbgs-green-500);
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus Visible - keyboard focus indicator */
:focus-visible {
  outline: 2px solid var(--hbgs-green-500);
  outline-offset: 2px;
}

/* Remove outline for mouse users, keep for keyboard */
:focus:not(:focus-visible) {
  outline: none;
}

/* Skip Link (for keyboard navigation) */
.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  transform: translateY(-100%);
  background: var(--hbgs-green-600);
  color: white;
  padding: 8px 16px;
  z-index: 10000;
  text-decoration: none;
  font-weight: 600;
  border-radius: 0 0 8px 0;
}

.skip-link:focus {
  transform: translateY(0);
}

/* High Contrast Focus for modals */
.modal-backdrop:focus-within .modal {
  box-shadow: 0 0 0 2px var(--hbgs-green-500), 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* ============================================
   TOUCH TARGETS (44x44px minimum)
   ============================================ */

/* Ensure minimum touch target size */
@media (pointer: coarse) {
  /* Buttons */
  .btn {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 20px;
  }

  .btn-sm {
    min-height: 44px;
    min-width: 44px;
    padding: 10px 16px;
  }

  /* Nav items */
  .nav-item {
    min-height: 48px;
    padding: 12px 16px;
  }

  /* Form inputs */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="search"],
  input[type="date"],
  input[type="time"],
  select,
  textarea {
    min-height: 44px;
    padding: 12px;
  }

  /* Checkboxes and radios with labels */
  .checkbox-label,
  .radio-label {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 8px 0;
  }

  /* Action buttons in tables */
  .actions-cell button,
  .data-table button {
    min-height: 44px;
    min-width: 44px;
    padding: 10px;
  }

  /* Tab buttons */
  .tab-btn,
  .tabs-row button {
    min-height: 44px;
    padding: 12px 16px;
  }

  /* Icon buttons */
  .btn-icon,
  button[aria-label] {
    min-height: 44px;
    min-width: 44px;
  }

  /* Close buttons */
  .modal-close,
  [class*="close"] button {
    min-height: 44px;
    min-width: 44px;
  }

  /* Autocomplete items */
  .autocomplete-dropdown div,
  .autocomplete-item {
    min-height: 44px;
    padding: 12px;
  }

  /* Date navigation buttons */
  .date-nav button {
    min-height: 44px;
    min-width: 44px;
  }

  /* Stat boxes should be tappable */
  .stat-box {
    min-height: 80px;
    cursor: pointer;
  }

  /* Filter tabs */
  .filter-tabs button,
  .dash-filter-tabs button {
    min-height: 44px;
    padding: 10px 16px;
  }
}

/* ============================================
   PROGRESS BARS
   ============================================ */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-bar-mini {
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill-mini {
  height: 100%;
  background: var(--success);
  border-radius: 3px;
}

.progress-fill-mini.danger {
  background: var(--danger);
}

/* Clickable rows */
.clickable-row {
  cursor: pointer;
  transition: background 0.15s;
}

.clickable-row:hover {
  background: var(--gray-50);
}

/* Student name links */
.student-link {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s;
}

.student-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* ============================================
   IMPORT STATUS INDICATOR
   ============================================ */

.import-status-dropdown {
  position: relative;
}

.import-status-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  color: var(--primary);
  transition: background 0.15s;
}

.import-status-btn:hover {
  background: var(--bg-secondary);
}

.import-status-btn .import-spinner {
  animation: spin 1s linear infinite;
}

.import-status-btn.done .import-spinner {
  display: none;
}

.import-status-btn.done .import-done {
  display: block !important;
  color: var(--success);
}

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

.import-status-menu {
  position: absolute;
  top: 100%;
  right: 0;
  width: 320px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  z-index: 1000;
  display: none;
  overflow: hidden;
}

.import-status-dropdown.open .import-status-menu {
  display: block;
}

.import-status-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.import-status-title {
  font-weight: 600;
  font-size: 14px;
}

.import-status-clear {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
}

.import-status-clear:hover {
  color: var(--primary);
}

.import-status-list {
  max-height: 300px;
  overflow-y: auto;
}

.import-status-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}

.import-status-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.import-status-item:last-child {
  border-bottom: none;
}

.import-status-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.import-status-item-name {
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.import-status-item-name .status-icon {
  font-size: 14px;
}

.import-status-item-time {
  font-size: 11px;
  color: var(--text-secondary);
}

.import-status-item-progress {
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}

.import-status-item-progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s;
}

.import-status-item-progress-bar.complete {
  background: var(--success);
}

.import-status-item-progress-bar.error {
  background: var(--danger);
}

.import-status-item-message {
  font-size: 12px;
  color: var(--text-secondary);
}

.import-status-item-message.success {
  color: var(--success);
}

.import-status-item-message.error {
  color: var(--danger);
}

/* ============================================
   UNIVERSAL SEARCH
   ============================================ */

.universal-search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: var(--bg-secondary);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.universal-search-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.universal-search-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.universal-search-modal.open {
  opacity: 1;
  visibility: visible;
}

.universal-search-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.universal-search-container {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 16px;
  background: var(--bg-primary);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  transform: translateY(-20px);
  transition: transform 0.2s;
}

.universal-search-modal.open .universal-search-container {
  transform: translateY(0);
}

.universal-search-input-wrapper {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
}

.universal-search-icon {
  color: var(--text-secondary);
  flex-shrink: 0;
}

.universal-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 18px;
  color: var(--text-primary);
  outline: none;
}

.universal-search-input::placeholder {
  color: var(--text-muted);
}

.universal-search-kbd {
  padding: 4px 8px;
  font-size: 12px;
  font-family: monospace;
  background: var(--bg-secondary);
  border-radius: 4px;
  color: var(--text-secondary);
}

.universal-search-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 8px;
}

.universal-search-hint,
.universal-search-loading,
.universal-search-empty,
.universal-search-error {
  padding: 24px;
  text-align: center;
  color: var(--text-secondary);
}

.universal-search-section {
  margin-bottom: 8px;
}

.universal-search-section-title {
  padding: 8px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.universal-search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.universal-search-result:hover,
.universal-search-result.focused {
  background: var(--bg-secondary);
}

.universal-search-result .result-icon {
  font-size: 24px;
}

.universal-search-result .result-info {
  flex: 1;
  min-width: 0;
}

.universal-search-result .result-name {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
}

.universal-search-result .result-detail {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
}

.universal-search-result .result-arrow {
  color: var(--text-muted);
  font-size: 18px;
}

.universal-search-more {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.universal-search-result-group {
  border-bottom: 1px solid var(--border-color);
}

.universal-search-result-group:last-child {
  border-bottom: none;
}

.universal-search-result-action {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px 12px 48px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  color: var(--primary);
  transition: background 0.15s;
}

.universal-search-result-action:hover {
  background: var(--bg-secondary);
}

.universal-search-result-action .result-icon {
  font-size: 14px;
}

/* Search Hint Tags */
.search-hint-tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--bg-secondary);
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Where Is Result */
.where-is-result {
  padding: 16px;
}

.where-is-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.where-is-icon {
  font-size: 32px;
}

.where-is-name {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.where-is-badge {
  padding: 4px 12px;
  background: var(--primary);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: white;
}

.where-is-body {
  margin-bottom: 16px;
}

.where-is-location {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.where-is-location > div {
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
}

.where-is-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.where-is-value {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.where-is-room .where-is-value {
  font-size: 24px;
  color: var(--primary);
}

.where-is-not-found {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px;
  background: var(--bg-secondary);
  border-radius: 12px;
  text-align: center;
  justify-content: center;
}

.where-is-not-found .where-is-status {
  font-size: 24px;
}

.where-is-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Person Quick View Modal */
.person-quickview-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.person-quickview-modal .modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.person-quickview-container {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--bg-primary);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.person-quickview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.person-quickview-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--text-primary);
}

.person-quickview-content {
  padding: 20px;
}

.quickview-loading,
.quickview-error {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-secondary);
}

.quickview-person-info {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.quickview-avatar {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  border-radius: 12px;
}

.quickview-avatar.student-avatar {
  background: #dbeafe;
}

.quickview-avatar.staff-avatar {
  background: #dcfce7;
}

.quickview-details {
  flex: 1;
}

.quickview-class,
.quickview-role {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 15px;
}

.quickview-grade,
.quickview-stats {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.quickview-current-location {
  background: #dcfce7;
  border: 1px solid #86efac;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.quickview-current-location.location-free {
  background: #fef3c7;
  border-color: #fcd34d;
}

.quickview-current-location.location-unknown {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

.location-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #22c55e;
  color: white;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}

.location-badge.location-duty {
  background: #3b82f6;
}

.location-free .location-badge {
  background: #f59e0b;
}

.location-unknown .location-badge {
  background: var(--text-muted);
}

.location-room {
  font-size: 20px;
  font-weight: 700;
  color: #166534;
  margin-bottom: 4px;
}

.location-free .location-room {
  color: #92400e;
}

.location-unknown .location-room {
  color: var(--text-secondary);
}

.location-info {
  font-size: 14px;
  color: #15803d;
  line-height: 1.4;
}

.location-free .location-info {
  color: #a16207;
}

.location-unknown .location-info {
  color: var(--text-secondary);
}

.location-time {
  font-size: 13px;
  color: #16a34a;
  margin-top: 8px;
  font-weight: 500;
}

.quickview-actions {
  display: flex;
  gap: 12px;
}

.quickview-actions .btn {
  flex: 1;
}

/* Dark mode adjustments */
[data-theme="dark"] .quickview-current-location {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.3);
}

[data-theme="dark"] .quickview-current-location.location-free {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .location-room {
  color: #4ade80;
}

[data-theme="dark"] .location-free .location-room {
  color: #fbbf24;
}

[data-theme="dark"] .location-info {
  color: #86efac;
}

[data-theme="dark"] .location-free .location-info {
  color: #fcd34d;
}

[data-theme="dark"] .quickview-avatar.student-avatar {
  background: rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .quickview-avatar.staff-avatar {
  background: rgba(34, 197, 94, 0.2);
}

/* Profile Location Cards */
.profile-current-location {
  margin-bottom: 16px;
}

.current-location-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 12px;
  border: 2px solid var(--border-color);
}

.current-location-card.location-active,
.current-location-card.location-teaching {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
  border-color: #10b981;
}

.current-location-card.location-prep {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(139, 92, 246, 0.05));
  border-color: #8b5cf6;
}

.current-location-card.location-weekend,
.current-location-card.location-ended,
.current-location-card.location-before {
  background: var(--bg-secondary);
}

.current-location-card.location-transition {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.05));
  border-color: #f59e0b;
}

.current-location-card.location-bathroom {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.05));
  border-color: #3b82f6;
}

.current-location-card.location-bathroom-long {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
  border-color: #ef4444;
}

.current-location-card.location-lunch {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.05));
  border-color: #f59e0b;
}

.current-location-card .location-badge.lunch {
  background: #f59e0b;
}

.current-location-card .location-badge.badge-warning {
  background: #ef4444;
}

.current-location-card .location-icon {
  font-size: 32px;
}

.current-location-card .location-info {
  flex: 1;
}

.current-location-card .location-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.current-location-card .location-room {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.current-location-card .location-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.current-location-card .location-detail {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.current-location-card .location-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.current-location-card .location-badge {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  background: #10b981;
  color: white;
  animation: pulse 1.5s infinite;
}

.current-location-card .location-badge.prep {
  background: #8b5cf6;
}

.current-location-card .location-badge.transit {
  background: #3b82f6;
}

/* Schedule Timeline */
.schedule-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.schedule-period {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.schedule-period.current {
  background: rgba(16, 185, 129, 0.1);
  border-color: #10b981;
}

.schedule-period.prep {
  opacity: 0.7;
}

.schedule-period-num {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.schedule-period.current .schedule-period-num {
  background: #10b981;
}

.schedule-period.prep .schedule-period-num {
  background: #8b5cf6;
}

.schedule-period-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0;
}

.schedule-period-subject {
  font-weight: 600;
  color: var(--text-primary);
}

.schedule-period-details {
  font-size: 13px;
  color: var(--text-secondary);
}

.schedule-now-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  background: #10b981;
  color: white;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
/* Notification highlight animation */
@keyframes notification-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.6);
    background-color: rgba(22, 163, 74, 0.15);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(22, 163, 74, 0);
    background-color: rgba(22, 163, 74, 0.1);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0);
    background-color: transparent;
  }
}

.notification-highlight {
  position: relative;
  z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================
   Team Request Section
   ============================================ */

.form-section {
  border-top: 1px solid var(--border-color);
  margin-top: 16px;
  padding-top: 16px;
}

.form-section-header {
  margin-bottom: 12px;
}

.form-help {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.team-request-section {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 12px;
}

.team-members-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.team-member-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.team-member-name {
  flex: 1;
  font-weight: 500;
}

.team-member-qty {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.add-team-member-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.add-team-member-row input[type="text"] {
  flex: 1;
}

/* Consolidated workspace navigation */
[data-workspace-secondary] {
  display: none !important;
}

.workspace-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin: 0 0 18px;
  padding: 5px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.workspace-tabs::-webkit-scrollbar {
  display: none;
}

.workspace-tab {
  min-height: 44px;
  flex: 0 0 auto;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}

.workspace-tab:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.workspace-tab.active,
.workspace-tab[aria-selected="true"] {
  background: var(--card-bg);
  border-color: var(--border-color);
  color: var(--hbgs-green-600);
  box-shadow: var(--shadow-sm);
}

.workspace-tab:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--hbgs-green-500) 45%, transparent);
  outline-offset: 1px;
}

/* Shared student/family context inside Contact Log. */
.contact-context-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(230px, 1fr) auto;
  align-items: center;
  gap: 12px 18px;
  margin: -6px 0 18px;
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
}

.contact-context-picker {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.contact-context-picker label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.contact-context-picker .form-input {
  min-width: 0;
  margin: 0;
}

.contact-context-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.contact-context-summary strong {
  color: var(--text-primary);
  margin-right: 4px;
}

.contact-context-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.contact-context-hint {
  grid-column: 2 / -1;
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.pr-tabs-row {
  display: flex;
  align-items: stretch;
  gap: 4px;
  margin-bottom: 20px;
  padding: 4px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
}

.pr-tabs-row .pr-tab {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  white-space: nowrap;
}

.pr-tabs-row .pr-tab.active,
.pr-tabs-row .pr-tab[aria-selected="true"] {
  border-color: var(--border-color);
  background: var(--card-bg);
  color: var(--hbgs-green-600);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 900px) {
  .contact-context-bar {
    grid-template-columns: 1fr;
  }

  .contact-context-hint {
    grid-column: 1;
  }

  .contact-context-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 600px) {
  .workspace-tabs {
    margin-bottom: 12px;
    padding: 4px;
    scroll-padding-inline: 4px;
  }

  .workspace-tab {
    min-height: 44px;
    padding: 8px 12px;
  }

  .contact-context-bar {
    margin-top: 0;
    padding: 10px;
    gap: 10px;
  }

  .contact-context-picker {
    grid-template-columns: 1fr auto;
  }

  .contact-context-picker label {
    grid-column: 1 / -1;
  }

  .contact-context-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .contact-context-actions .btn {
    width: 100%;
  }

  .pr-tabs-row {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    scroll-padding-inline: 4px;
  }

  .pr-tabs-row::-webkit-scrollbar {
    display: none;
  }

  .pr-tabs-row .pr-tab {
    flex: 0 0 auto;
  }
}

/* ===== pages.css ===== */
/* HBGS Design System v2.1 - Pages */

/* ============================================
   Dashboard Styles
   ============================================ */

.dash {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

/* Hero Header - High specificity to prevent override */
.dash .dash-hero,
.dash-hero {
  background: linear-gradient(135deg, #16a34a 0%, #14532d 100%) !important;
  border-radius: 16px;
  padding: 24px 28px;
  display: flex !important;
  justify-content: space-between;
  position: relative;
  z-index: 1;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  min-height: 80px;
  width: 100%;
  box-sizing: border-box;
}

.dash-hero-content {
  color: white !important;
  flex: 1;
  min-width: 200px;
}

.dash-hero-title,
.dash-hero .dash-hero-title,
h1.dash-hero-title {
  margin: 0 !important;
  padding: 0;
  font-size: 26px !important;
  font-weight: 700 !important;
  color: white !important;
  background: none !important;
  border: none !important;
}

.dash-hero-date,
.dash-hero .dash-hero-date,
p.dash-hero-date {
  margin: 4px 0 0 0 !important;
  padding: 0;
  font-size: 14px !important;
  color: rgba(255,255,255,0.8) !important;
}

/* Tab Buttons */
.dash-hero-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dash-tab,
button.dash-tab {
  display: flex !important;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: 1px solid rgba(255,255,255,0.3) !important;
  border-radius: 8px;
  background: rgba(255,255,255,0.1) !important;
  color: white !important;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dash-tab:hover,
button.dash-tab:hover {
  background: rgba(255,255,255,0.2) !important;
}

.dash-tab.active,
button.dash-tab.active {
  background: white !important;
  color: #16a34a !important;
  border-color: white !important;
}

/* Stats Row */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.dash-stat {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.dash-stat-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: 10px;
  font-size: 22px;
  flex-shrink: 0;
}

.dash-stat-data {
  display: flex;
  flex-direction: column;
}

.dash-stat-num {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.dash-stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.dash-stat-alert {
  border-color: var(--warning);
  background: rgba(245, 158, 11, 0.1);
}

.dash-stat-alert .dash-stat-num {
  color: var(--warning);
}

.dash-stat-urgent {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
  animation: pulse-urgent 2s infinite;
}

.dash-stat-urgent .dash-stat-num {
  color: var(--danger);
}

@keyframes pulse-urgent {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.dash-stat-clickable {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.dash-stat-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.dash-stat-clickable:active {
  transform: translateY(0);
}

/* Main Content Grid */
.dash-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

/* Panels */
.dash-panel {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
}

.dash-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.dash-panel-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.dash-panel-count {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
}

.dash-panel-count-warn {
  background: #fef3c7;
  color: #92400e;
}

.dash-panel-content {
  flex: 1;
  overflow-y: auto;
  max-height: 360px;
}

/* Activity Items */
.dash-activity {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
}

.dash-activity:last-child {
  border-bottom: none;
}

.dash-activity-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 14px;
  flex-shrink: 0;
}

.dash-activity-icon.green {
  background: #dcfce7;
  color: #166534;
}

.dash-activity-icon.yellow {
  background: #fef3c7;
  color: #92400e;
}

.dash-activity-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-activity-info strong {
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-activity-info span {
  font-size: 12px;
  color: var(--text-secondary);
}

.dash-activity-time {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Alert Items */
.dash-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  margin: 4px 0;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.dash-alert:first-child {
  margin-top: 0;
}

.dash-alert:hover {
  transform: translateX(2px);
}

.dash-alert-warn {
  background: #fef3c7;
  border: 1px solid #fcd34d;
}

.dash-alert-info {
  background: #dbeafe;
  border: 1px solid #93c5fd;
}

.dash-alert-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.dash-alert-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-alert-content strong {
  font-size: 14px;
  color: var(--text-primary);
}

.dash-alert-content span {
  font-size: 13px;
  color: var(--text-secondary);
}

.dash-alert-arrow {
  color: var(--text-muted);
  font-size: 14px;
  opacity: 0.5;
}

/* Empty States */
.dash-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px 16px;
  color: var(--text-secondary);
}

.dash-empty-icon {
  font-size: 24px;
  opacity: 0.5;
}

.dash-empty-ok {
  color: var(--primary);
}

.dash-empty-ok .dash-empty-icon {
  opacity: 1;
}

.dash-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 1024px) {
  .dash-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .dash-main {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .dash-hero {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
  }

  .dash-hero-content {
    min-width: 0;
  }

  .dash-hero-title {
    font-size: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .dash-hero-tabs {
    justify-content: flex-start;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 4px;
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .dash-hero-tabs::-webkit-scrollbar {
    display: none;
  }

  .dash-tab {
    flex: 0 0 auto;
    padding: 8px 12px;
    font-size: 12px;
    gap: 4px;
    white-space: nowrap;
  }

  .dash-stat {
    padding: 14px;
  }

  .dash-stat-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .dash-stat-num {
    font-size: 20px;
  }

  .dash-stat-label {
    font-size: 11px;
  }

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

/* Extra small phones */
@media (max-width: 380px) {
  .dash-hero {
    padding: 12px;
  }

  .dash-hero-title {
    font-size: 16px;
  }

  .dash-hero-date {
    font-size: 12px;
  }

  .dash-hero-tabs {
    margin: 0 -12px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .dash-tab {
    padding: 6px 10px;
    font-size: 11px;
  }

  .dash-stat {
    padding: 12px;
  }

  .dash-stat-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .dash-stat-num {
    font-size: 18px;
  }
}

/* Dark Mode Overrides */
[data-theme="dark"] .dash-activity-icon.green {
  background: rgba(22, 163, 74, 0.2);
  color: #86efac;
}

[data-theme="dark"] .dash-activity-icon.yellow {
  background: rgba(234, 179, 8, 0.2);
  color: #fde047;
}

[data-theme="dark"] .dash-alert-warn {
  background: rgba(234, 179, 8, 0.15);
  border-color: rgba(234, 179, 8, 0.3);
}

[data-theme="dark"] .dash-alert-info {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] .dash-panel-count-warn {
  background: rgba(234, 179, 8, 0.2);
  color: #fde047;
}

/* ============================================
   Import Modal Styles
   ============================================ */

.import-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--bg-secondary);
}

.import-dropzone:hover,
.import-dropzone.dragover {
  border-color: var(--primary-color);
  background: rgba(22, 163, 74, 0.05);
}

.import-dropzone-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.import-dropzone-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.import-dropzone-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.import-preview {
  margin-top: 16px;
}

.import-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.import-preview-title {
  font-weight: 600;
  color: var(--text-primary);
}

.import-preview-count {
  font-size: 13px;
  color: var(--text-secondary);
}

.import-preview-table {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.import-preview-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.import-preview-table th,
.import-preview-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.import-preview-table th {
  background: var(--bg-secondary);
  font-weight: 600;
  position: sticky;
  top: 0;
}

.import-preview-table tr:last-child td {
  border-bottom: none;
}

.import-error-row {
  background: #fef2f2;
}

.import-error-row td {
  color: #dc2626;
}

.import-status {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
}

.import-status-success {
  background: #dcfce7;
  color: #166534;
}

.import-status-error {
  background: #fef2f2;
  color: #dc2626;
}

.import-status-warning {
  background: #fef3c7;
  color: #92400e;
}

[data-theme="dark"] .import-dropzone {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
}

[data-theme="dark"] .import-dropzone:hover,
[data-theme="dark"] .import-dropzone.dragover {
  border-color: var(--primary-color);
  background: rgba(22, 163, 74, 0.1);
}

[data-theme="dark"] .import-preview-table th {
  background: var(--bg-tertiary);
}

[data-theme="dark"] .import-error-row {
  background: rgba(220, 38, 38, 0.1);
}

[data-theme="dark"] .import-status-success {
  background: rgba(22, 163, 74, 0.15);
  color: #4ade80;
}

[data-theme="dark"] .import-status-error {
  background: rgba(220, 38, 38, 0.15);
  color: #f87171;
}

[data-theme="dark"] .import-status-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

/* ============================================
   New Dashboard Layout (1.2)
   ============================================ */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  grid-template-rows: auto 1fr;
  gap: 24px;
}

.dashboard-stats {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.dashboard-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dashboard-sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Dash Stat Cards */
.dash-stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.dash-stat-icon {
  font-size: 28px;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: 12px;
  flex-shrink: 0;
}

.dash-stat-content {
  flex: 1;
  min-width: 0;
}

.dash-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.dash-stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}

.quick-action-btn:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.quick-action-icon {
  font-size: 24px;
}

/* Activity Feed */
.activity-feed {
  max-height: 400px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

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

.activity-icon {
  font-size: 18px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: 8px;
  flex-shrink: 0;
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-main {
  font-weight: 500;
  color: var(--text-primary);
}

.activity-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.activity-time {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Alerts */
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alerts-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  background: #fef3c7;
  border: 1px solid #f59e0b;
}

.alert-warning {
  background: #fef3c7;
  border-color: #f59e0b;
}

.alert-icon {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-message {
  flex: 1;
  font-size: 13px;
  color: #92400e;
  line-height: 1.4;
}

#dashAlertsCard.has-alerts {
  border-color: #f59e0b;
}

/* Bathroom Status List */
.bathroom-status-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bathroom-status-item {
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
}

.bathroom-status-item.is-long {
  background: #fef3c7;
  border: 1px solid #f59e0b;
}

.bathroom-status-name {
  font-weight: 500;
  color: var(--text-primary);
}

.bathroom-status-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.bathroom-status-item.is-long .bathroom-status-meta {
  color: #92400e;
}

/* Responsive Dashboard */
@media (max-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

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

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

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

  .dash-stat-card {
    padding: 16px;
  }

  .dash-stat-icon {
    width: 44px;
    height: 44px;
    font-size: 22px;
  }

  .dash-stat-value {
    font-size: 24px;
  }

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

  .quick-action-btn {
    padding: 16px 8px;
    font-size: 12px;
  }
}

/* Dark mode for new dashboard */
[data-theme="dark"] .dash-stat-card {
  background: var(--card-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .dash-stat-icon {
  background: var(--bg-secondary);
}

[data-theme="dark"] .quick-action-btn {
  background: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .quick-action-btn:hover {
  background: var(--primary-color);
  color: white;
}

[data-theme="dark"] .activity-icon {
  background: var(--bg-secondary);
}

[data-theme="dark"] .alert-item {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
}

[data-theme="dark"] .alert-message {
  color: #fbbf24;
}

[data-theme="dark"] #dashAlertsCard.has-alerts {
  border-color: #f59e0b;
}

[data-theme="dark"] .bathroom-status-item {
  background: var(--bg-secondary);
}

[data-theme="dark"] .bathroom-status-item.is-long {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
}

[data-theme="dark"] .bathroom-status-item.is-long .bathroom-status-meta {
  color: #fbbf24;
}

/* ========== KEY MANAGEMENT ========== */
.key-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.key-controls .search-input-sm {
  flex: 1;
  min-width: 200px;
}
.key-controls select {
  min-width: 150px;
}
.key-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.key-id {
  font-weight: 600;
  color: var(--text-primary);
}
.key-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ========== SCHEDULE BUILDER INPUT SIZES ========== */
/* v5.0: Replaced inline style="width:Xpx" with responsive classes */
.sb-input-xs { width: 70px; }
.sb-input-sm { width: 100px; }
.sb-input-md { width: 140px; }
.sb-input-lg { width: 220px; }
.sb-color-input {
  width: 50px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
}
.sb-color-input-sm {
  width: 30px;
  height: 24px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
}

.add-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .sb-input-xs,
  .sb-input-sm,
  .sb-input-md,
  .sb-input-lg {
    width: 100%;
  }

  .sb-color-input {
    width: 44px;
    height: 44px;
  }

  .add-form {
    flex-direction: column;
    align-items: stretch;
  }

  .add-form .form-group {
    width: 100%;
  }

  .add-form .btn {
    width: 100%;
  }
}

/* ========== SIDEBAR COLLAPSE ========== */
.sidebar {
  transition: width 0.3s ease, padding 0.3s ease;
}
.sidebar.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  overflow: hidden;
}
.sidebar.collapsed > * {
  opacity: 0;
  pointer-events: none;
}
.main-wrapper {
  transition: margin-left 0.3s ease;
}
.main-wrapper.expanded {
  margin-left: 0 !important;
}
.sidebar-toggle-btn {
  display: none;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: all 0.2s;
  margin-right: 8px;
}
.sidebar-toggle-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
@media (min-width: 769px) {
  .sidebar-toggle-btn {
    display: inline-flex;
  }
}

/* ========== AUTOCOMPLETE DROPDOWN ========== */
.autocomplete-wrapper {
  position: relative;
}
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  max-height: 250px;
  overflow-y: auto;
  display: none;
  margin-top: 4px;
}
.autocomplete-dropdown.open {
  display: block;
}
.autocomplete-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s;
}
.autocomplete-item:hover {
  background: var(--bg-tertiary);
}
.autocomplete-item:first-child {
  border-radius: 8px 8px 0 0;
}
.autocomplete-item:last-child {
  border-radius: 0 0 8px 8px;
}
.autocomplete-item:only-child {
  border-radius: 8px;
}
.autocomplete-name {
  font-weight: 500;
  color: var(--text-primary);
}
.autocomplete-role {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: capitalize;
}
.autocomplete-empty {
  padding: 12px 14px;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
}

/* ========== PERMISSIONS EDITOR ========== */
.permissions-editor {
  padding: 8px 0;
}
.permissions-header h4 {
  margin: 0 0 4px 0;
  font-size: 1rem;
  color: var(--text-primary);
}
.permissions-role-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0 0 16px 0;
}
.permissions-mode {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
}
.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.875rem;
}
.radio-option input[type="radio"] {
  margin: 0;
}
.permissions-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: opacity 0.2s;
}
.permission-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}
.permission-row:last-child {
  border-bottom: none;
}
.permission-label {
  font-weight: 500;
  color: var(--text-primary);
}
.permission-default {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.permission-select {
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 0.8125rem;
  min-width: 120px;
}
.permission-select:focus {
  outline: none;
  border-color: var(--primary);
}

/* ========== STUDENT PROFILE MODAL ========== */
.student-profile {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.student-profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.avatar.avatar-lg {
  width: 64px;
  height: 64px;
  min-width: 64px;
  font-size: 24px;
}

.student-profile-info {
  flex: 1;
  min-width: 0;
}

.student-profile-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.student-profile-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.student-profile-address {
  overflow-wrap: anywhere;
}

.student-address {
  display: inline-block;
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

/* v4.8.0: Copyable info items in student profile */
.profile-copyable {
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}
.profile-copyable:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  outline: 1px solid var(--border-color);
}

.student-profile-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.profile-stat {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.profile-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.profile-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* Student Profile Achievements */
.student-profile-achievements {
  margin: 16px 0;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: 12px;
}

.profile-achievements-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.profile-achievements-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-achievement-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: color-mix(in srgb, var(--badge-color) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--badge-color) 40%, transparent);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
}

.profile-achievement-badge.gold {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.15));
  border-color: #fbbf24;
}

.profile-achievement-badge.silver {
  background: linear-gradient(135deg, rgba(156, 163, 175, 0.2), rgba(107, 114, 128, 0.15));
  border-color: #9ca3af;
}

.profile-achievement-badge.bronze {
  background: linear-gradient(135deg, rgba(146, 64, 14, 0.2), rgba(120, 53, 15, 0.15));
  border-color: #92400e;
}

.achievement-icon {
  font-size: 1rem;
}

.achievement-label {
  white-space: nowrap;
}

/* Badge management */
.profile-achievement-badge.custom-badge {
  position: relative;
  padding-right: 8px;
}

.profile-achievement-badge .badge-remove-btn {
  display: none;
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  padding: 0;
  background: var(--danger);
  color: white;
  border: 2px solid var(--bg-secondary);
  border-radius: 50%;
  font-size: 12px;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
}

.profile-achievement-badge.custom-badge:hover .badge-remove-btn {
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-add-badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px dashed var(--border-color);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.profile-add-badge-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.profile-add-badge-btn span:first-child {
  font-size: 14px;
  font-weight: bold;
}

/* Badge selection in modal */
.badge-select-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: color-mix(in srgb, var(--badge-color) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--badge-color) 40%, transparent);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
}

.badge-select-btn:hover {
  background: color-mix(in srgb, var(--badge-color) 30%, transparent);
  transform: scale(1.05);
}

.student-profile-sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-section {
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
}

.profile-section-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-tertiary, rgba(0,0,0,0.05));
  border-bottom: 1px solid var(--border-color);
  gap: 8px;
}

.profile-section-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
  flex: 1;
}

.profile-section-count {
  background: var(--primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

.profile-section-content {
  padding: 10px 12px;
  max-height: 200px;
  overflow-y: auto;
}

/* Collapsible sections */
.profile-section-collapsible[data-collapsed="true"] .profile-collapsible-content {
  display: none;
}

.profile-section-collapsible[data-collapsed="false"] .profile-collapsible-content {
  display: block;
}

.profile-section-collapsible[data-collapsed="true"] .profile-section-toggle {
  transform: rotate(0deg);
}

.profile-section-collapsible[data-collapsed="false"] .profile-section-toggle {
  transform: rotate(90deg);
}

.profile-section-toggle {
  font-size: 12px;
  transition: transform 0.2s;
  color: var(--text-secondary);
}

.profile-subsection {
  padding: 0;
}

.profile-subsection[data-collapsed="true"] .profile-subsection-content {
  display: none;
}

.profile-subsection[data-collapsed="false"] .profile-subsection-content {
  display: block;
}

.profile-subsection[data-collapsed="true"] .profile-subsection-toggle {
  transform: rotate(0deg);
}

.profile-subsection[data-collapsed="false"] .profile-subsection-toggle {
  transform: rotate(90deg);
}

.profile-subsection-toggle {
  font-size: 10px;
  transition: transform 0.2s;
  color: var(--text-secondary);
}

.profile-subsection-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.profile-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.profile-list-item:last-child {
  border-bottom: none;
}

.profile-list-main {
  font-size: 0.875rem;
  color: var(--text-primary);
}

.profile-list-meta {
  display: flex;
  gap: 6px;
}

.profile-list-more {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
  padding: 8px 0;
  font-style: italic;
}

@media (max-width: 480px) {
  .student-profile-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .avatar.avatar-lg {
    width: 48px;
    height: 48px;
    min-width: 48px;
    font-size: 18px;
  }
}

/* Enhanced Student Profile - v2.3.0 */
.student-profile-name-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

/* v5.7.0: Allow long student names to wrap cleanly in the profile modal */
#studentProfileModal .modal-header {
  align-items: flex-start;
  gap: 12px;
}

#studentProfileModal .modal-title {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}

.absence-flag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.absence-flag-danger {
  background: rgba(220, 38, 38, 0.15);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.3);
}

.absence-flag-warning {
  background: rgba(217, 119, 6, 0.15);
  color: var(--warning);
  border: 1px solid rgba(217, 119, 6, 0.3);
}

.absence-flag-caution {
  background: rgba(234, 179, 8, 0.15);
  color: #ca8a04;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.student-profile-attendance-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.attendance-bar-label {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 90px;
}

.attendance-bar-track {
  flex: 1;
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
  max-width: 150px;
}

.attendance-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.attendance-bar-value {
  font-size: 14px;
  font-weight: 700;
  min-width: 45px;
}

/* Perfect Attendance Display */
.perfect-attendance {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  gap: 8px;
}

.perfect-attendance-icon {
  font-size: 36px;
}

.perfect-attendance-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--success);
}

.student-profile-top-row {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.student-profile-top-row .student-profile-stats {
  flex: 1;
}

/* Mini Calendar */
.mini-calendar {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 12px;
  min-width: 200px;
}

.mini-cal-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 8px;
}

.mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.mini-cal-header {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  padding: 4px 0;
}

.mini-cal-day {
  position: relative;
  font-size: 11px;
  text-align: center;
  padding: 4px;
  border-radius: 4px;
  color: var(--text-primary);
}

.mini-cal-day.empty {
  visibility: hidden;
}

.mini-cal-day.today {
  font-weight: 700;
  background: var(--primary);
  color: white;
}

.mini-cal-day.present {
  background: rgba(34, 197, 94, 0.15);
}

.mini-cal-day.absent {
  background: rgba(220, 38, 38, 0.1);
}

.mini-cal-day.excused {
  background: rgba(217, 119, 6, 0.1);
}

.mini-cal-day.late {
  background: rgba(245, 158, 11, 0.15);
}

.mini-cal-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
}

.mini-cal-dot.danger {
  background: var(--danger);
}

.mini-cal-dot.warning {
  background: var(--warning);
}

.mini-cal-legend {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 10px;
  color: var(--text-muted);
}

.mini-cal-legend span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Quick Contacts */
.profile-quick-contacts {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
}

.quick-contacts-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.contacts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.contact-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
}

.contact-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.contact-card-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.contact-card-rel {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: 4px;
}

.contact-card-phones {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.contact-phone-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: var(--touch-target);
  padding: 4px 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 12px;
  color: var(--hbgs-green-400);
  text-decoration: none;
  transition: all 0.15s;
}

.contact-phone-btn:hover {
  background: var(--hbgs-green-500);
  color: white;
  border-color: var(--hbgs-green-500);
}

/* Legacy quick-contact styles for backwards compat */
.quick-contact {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.quick-contact:last-child {
  border-bottom: none;
}

.quick-contact-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  flex: 1;
}

.quick-contact-rel {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 60px;
}

.quick-contact-phone {
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.quick-contact-phone:hover {
  text-decoration: underline;
}

/* Profile Actions */
.profile-actions {
  display: flex;
  gap: 8px;
  padding: 8px 0;
}

.profile-actions .btn-sm {
  font-size: 12px;
  padding: 6px 12px;
}

/* Absence Flag Dots for Tables */
.absence-flag-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.absence-flag-dot-danger {
  background: var(--danger);
}

.absence-flag-dot-warning {
  background: var(--warning);
}

.absence-flag-dot-caution {
  background: #eab308;
}

.flag-legend {
  color: var(--text-muted);
}

.flag-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 600px) {
  .student-profile-top-row {
    flex-direction: column;
  }

  .mini-calendar {
    width: 100%;
  }

  .student-profile-stats {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

/* ========== Student Profile Modal - Mobile Enhancements ========== */
@media (max-width: 768px) {
  .student-profile {
    gap: 16px;
  }

  /* Header - stack vertically on mobile */
  .student-profile-header {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }

  .student-profile-info {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .student-profile-name-row {
    flex-direction: column;
    gap: 6px;
  }

  .student-profile-name {
    font-size: 1.125rem;
  }

  .absence-flag {
    font-size: 10px;
    padding: 2px 8px;
  }

  /* Attendance bar centered on mobile */
  .student-profile-attendance-bar {
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .attendance-bar-track {
    flex: none;
    width: 120px;
  }

  /* Stats grid - 3 columns on mobile */
  .student-profile-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .profile-stat {
    padding: 10px 8px;
    border-radius: 10px;
  }

  .profile-stat-value {
    font-size: 1.125rem;
  }

  .profile-stat-label {
    font-size: 0.65rem;
    letter-spacing: 0.03em;
  }

  /* Quick contacts - card style on mobile */
  .profile-quick-contacts {
    padding: 12px;
  }

  .quick-contacts-title {
    font-size: 13px;
  }

  .contacts-list {
    gap: 10px;
  }

  .contact-card {
    padding: 10px;
  }

  .contact-card-name {
    font-size: 13px;
  }

  .contact-card-phones {
    gap: 6px;
  }

  .contact-phone-btn {
    padding: 8px 12px;
    font-size: 13px;
    flex: 1;
    justify-content: center;
    min-width: 120px;
  }

  /* Legacy quick-contact mobile styles */
  .quick-contact {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0;
  }

  .quick-contact-name {
    flex: none;
    width: 100%;
    font-size: 13px;
  }

  .quick-contact-rel {
    flex: 1;
    min-width: auto;
    font-size: 11px;
  }

  .quick-contact-phone {
    font-size: 13px;
    font-weight: 600;
    background: var(--primary);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
  }

  .quick-contact-phone:hover {
    text-decoration: none;
  }

  /* Profile actions - full width on mobile */
  .profile-actions {
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 0;
  }

  .profile-actions .btn-sm {
    flex: 1;
    min-width: 120px;
    justify-content: center;
    padding: 10px 12px;
    font-size: 13px;
  }

  /* Sections - compact on mobile */
  .student-profile-sections {
    gap: 12px;
  }

  .profile-section {
    border-radius: 10px;
  }

  .profile-section-header {
    padding: 10px 12px;
  }

  .profile-section-title {
    font-size: 0.8125rem;
  }

  .profile-section-count {
    font-size: 0.7rem;
    padding: 2px 6px;
  }

  .profile-section-content {
    padding: 10px 12px;
    max-height: 280px;
  }

  /* Schedule section needs more height to show all periods */
  .schedule-timeline {
    max-height: none;
  }

  /* List items - card style on mobile */
  .profile-list {
    gap: 6px;
  }

  .profile-list-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 10px;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
  }

  .profile-list-item:last-child {
    border-bottom: 1px solid var(--border-color);
  }

  .profile-list-main {
    font-size: 0.8125rem;
  }

  .profile-list-meta {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 4px;
  }

  .profile-list-more {
    font-size: 0.75rem;
    padding: 6px 0;
  }
}

@media (max-width: 480px) {
  .student-profile-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .profile-stat {
    padding: 8px 6px;
  }

  .profile-stat-value {
    font-size: 1rem;
  }

  .profile-stat-label {
    font-size: 0.6rem;
  }

  .profile-section-content {
    max-height: 260px;
  }
}

/* ========== STAFF TABLE ========== */
.staff-table th:nth-child(1),
.staff-table td:nth-child(1) {
  width: 40%;
}

.staff-table th:nth-child(2),
.staff-table td:nth-child(2) {
  width: 15%;
  text-align: center;
}

.staff-table th:nth-child(3),
.staff-table td:nth-child(3) {
  width: 20%;
  text-align: center;
}

.staff-table th:nth-child(4),
.staff-table td:nth-child(4) {
  width: 25%;
  text-align: right;
}

/* ============================================
   Student Detail Modal Styles
   ============================================ */

/* .modal-lg defined in modals.css (canonical) */

.student-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 600px) {
  .student-detail-grid {
    grid-template-columns: 1fr;
  }
}

.student-detail-section h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.detail-value {
  font-size: 14px;
  color: var(--text-primary);
  text-align: right;
}

.detail-value a {
  color: var(--hbgs-green-600);
  text-decoration: none;
}

.detail-value a:hover {
  text-decoration: underline;
}

/* Contacts Grid */
.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.contact-card {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 12px;
  border: 1px solid var(--border-color);
}

.contact-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.contact-relation {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.contact-phone {
  font-size: 13px;
}

.contact-phone a {
  color: var(--hbgs-green-600);
  text-decoration: none;
}

.contact-phone a:hover {
  text-decoration: underline;
}

/* Attendance Badges */
.attendance-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.attendance-good {
  background: rgba(22, 163, 74, 0.15);
  color: #16a34a;
}

.attendance-warning {
  background: rgba(234, 179, 8, 0.15);
  color: #ca8a04;
}

.attendance-low {
  background: rgba(220, 38, 38, 0.15);
  color: #dc2626;
}

/* Attendance Module Layout */
.att-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .att-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

.att-stat-card {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  text-align: center;
}

.att-stat-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 4px;
}

.att-stat-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.att-charts-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .att-charts-row {
    grid-template-columns: 1fr;
  }
}

.att-chart-card {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.att-chart-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}

.att-chart-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 16px 0;
}

.att-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.att-bar-label {
  width: 36px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
}

.att-bar-track {
  flex: 1;
  height: 28px;
  background: var(--gray-100);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.att-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.3s ease;
}

.att-bar-value {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.att-info-box {
  padding: 14px 16px;
  background: var(--success-bg, rgba(22, 163, 74, 0.1));
  border-radius: 10px;
  border: 1px solid var(--success);
  margin-bottom: 20px;
}

.att-info-box strong {
  color: var(--success);
}

.att-info-box.warning {
  background: var(--warning-bg, rgba(234, 179, 8, 0.1));
  border-color: var(--warning);
}

.att-info-box.warning strong {
  color: var(--warning);
}

.att-info-box.danger {
  background: var(--danger-bg, rgba(220, 38, 38, 0.1));
  border-color: var(--danger);
}

.att-info-box.danger strong {
  color: var(--danger);
}

.att-table-wrapper {
  max-height: 300px;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.att-section {
  margin-bottom: 28px;
}

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

.att-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.att-section-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--gray-100);
  padding: 2px 8px;
  border-radius: 10px;
}

/* Radio Group */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
}

.radio-group input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--hbgs-green-600);
}

/* ============================================
   Admin Configuration Styles
   ============================================ */

/* Admin Tabs */
.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 16px 20px 0;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
  white-space: nowrap;
}

.admin-tab:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.admin-tab.active {
  color: var(--hbgs-green-600);
  border-bottom-color: var(--hbgs-green-600);
}

.admin-tab-icon {
  font-size: 16px;
}

.admin-tab-content {
  padding: 20px;
}

.admin-tab-pane {
  display: none;
}

.admin-tab-pane.active {
  display: block !important;
  min-height: 100px;
}

/* Debug: make security and notifications panes visible */
.admin-tab-pane[data-tab="security"],
.admin-tab-pane[data-tab="notifications"] {
  background: var(--bg-primary);
}

.admin-tab-pane[data-tab="security"] .collapsible-header,
.admin-tab-pane[data-tab="notifications"] .collapsible-header {
  background: var(--bg-secondary) !important;
}

.admin-sections {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.admin-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  overflow: hidden;
}

.admin-section.admin-collapsible {
  padding: 0;
}

.admin-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.admin-section-header:hover {
  background: var(--bg-tertiary);
}

.admin-section-header h3 {
  margin: 0;
}

.admin-section-header .collapse-icon {
  font-size: 12px;
  color: var(--text-secondary);
  transition: transform 0.2s;
}

.admin-collapsible.collapsed .collapse-icon {
  transform: rotate(-90deg);
}

.admin-section-content {
  padding: 0 20px 20px 20px;
}

.admin-collapsible.collapsed .admin-section-content {
  display: none;
}

.admin-section h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.admin-section > p {
  margin: 0 0 16px 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.admin-status {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
}

.status-row:not(:last-child) {
  border-bottom: 1px solid var(--border-color);
}

.status-label {
  color: var(--text-secondary);
  font-size: 13px;
}

.status-value {
  color: var(--text-primary);
  font-weight: 500;
  font-size: 13px;
}

.admin-actions {
  margin-top: 16px;
}

.admin-access-list {
  max-height: 300px;
  overflow-y: auto;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.stat-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--hbgs-green-600);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

.badge-primary {
  background: var(--hbgs-green-600);
  color: white;
}

/* Role Permissions Editor */
.role-permissions-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.role-tab {
  padding: 8px 20px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.role-tab:hover {
  background: var(--bg-tertiary);
}

.role-tab.active {
  background: var(--hbgs-green-600);
  border-color: var(--hbgs-green-600);
  color: white;
}

.role-permissions-editor {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

/* Admin Dashboard Widget List */
.admin-widget-list {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px;
  max-height: 500px;
  overflow-y: auto;
}

.admin-widget-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: grab;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.admin-widget-item:last-child {
  margin-bottom: 0;
}

.admin-widget-item:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
}

.admin-widget-item.dragging {
  opacity: 0.5;
  background: var(--primary-light);
  border-color: var(--primary);
}

.admin-widget-item.drag-over {
  border-color: var(--primary);
  background: var(--bg-tertiary);
}

.admin-widget-drag {
  color: var(--text-muted);
  cursor: grab;
  padding: 4px;
  font-size: 14px;
  line-height: 1;
}

.admin-widget-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.admin-widget-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.admin-widget-toggle-label {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.admin-widget-checkbox {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.admin-widget-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--gray-300);
  transition: 0.3s;
  border-radius: 24px;
}

.admin-widget-toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.admin-widget-checkbox:checked + .admin-widget-toggle-slider {
  background-color: var(--hbgs-green-600);
}

.admin-widget-checkbox:checked + .admin-widget-toggle-slider:before {
  transform: translateX(20px);
}

.perm-group {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 12px;
}

.perm-group-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.perm-group-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.perm-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.perm-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.perm-item-name {
  font-size: 13px;
  color: var(--text-primary);
}

.perm-item-default {
  font-size: 11px;
  color: var(--text-muted);
}

.perm-item .role-perm-select,
.perm-item .permission-select {
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 12px;
  min-width: 110px;
}

/* Legacy styles - keep for compatibility */
.perms-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.perm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.perm-row:last-child {
  border-bottom: none;
}

.perm-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.perm-select select,
.role-perm-select {
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  min-width: 140px;
}

/* Admin Config Mobile Responsive */
@media (max-width: 768px) {
  .admin-tabs {
    padding: 12px 12px 0;
    gap: 2px;
  }

  .admin-tab {
    padding: 10px 12px;
    font-size: 13px;
    flex-direction: column;
    gap: 4px;
  }

  .admin-tab-icon {
    font-size: 18px;
  }

  .admin-tab-label {
    font-size: 11px;
  }

  .admin-tab-content {
    padding: 12px;
  }

  .admin-sections {
    padding: 12px;
    gap: 16px;
  }

  .admin-section {
    padding: 16px;
  }

  .admin-section h3 {
    font-size: 15px;
  }

  .admin-section > p {
    font-size: 13px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    overflow: visible;
  }

  /* Make last item span full width if odd number of items */
  .stats-grid .stat-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .stat-card {
    padding: 12px;
    min-width: 0;
  }

  .stat-value {
    font-size: 22px;
  }

  .stat-label {
    font-size: 10px;
  }

  .role-permissions-tabs {
    flex-wrap: wrap;
  }

  .role-tab {
    padding: 8px 16px;
    font-size: 13px;
    flex: 1;
    text-align: center;
  }

  .role-permissions-editor {
    padding: 12px;
    grid-template-columns: 1fr;
  }

  .perm-group {
    padding: 10px;
  }

  .perm-item {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .perm-item .role-perm-select {
    width: 100%;
  }

  /* Legacy perm-row styles */
  .perm-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 0;
  }

  .perm-label {
    font-size: 13px;
  }

  .perm-select,
  .perm-select select,
  .role-perm-select {
    width: 100%;
    min-width: unset;
  }

  .admin-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

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

  .admin-actions .form-row {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .admin-actions .form-row > div {
    width: 100% !important;
  }

  .logs-controls {
    flex-direction: column;
  }

  .logs-controls select,
  .logs-controls input {
    width: 100%;
  }

  .logs-table {
    font-size: 12px;
  }

  .logs-table th,
  .logs-table td {
    padding: 8px 6px;
  }
}

@media (max-width: 480px) {
  .admin-sections {
    padding: 8px;
    gap: 12px;
  }

  .admin-section {
    padding: 12px;
  }

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

  .stat-value {
    font-size: 18px;
  }
}

/* ==================== Device Management ==================== */

.devices-layout {
  grid-template-columns: 350px 1fr;
}

.carts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 600px;
  overflow-y: auto;
  padding: 4px;
}

.cart-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* Keep Assets usable on high-DPI laptops and survive generated CSS rebuilds. */
#pageRoot .card-grid.devices-layout:has(#devicesPanel[style*="display: none"]) {
  grid-template-columns: minmax(0, 1fr) !important;
}

@media (min-width: 901px) {
  #pageRoot .card-grid.devices-layout {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 16px !important;
  }

  #pageRoot .devices-layout > .card,
  #pageRoot .devices-layout .devices-panel {
    min-width: 0 !important;
  }

  #pageRoot .devices-layout .carts-list {
    display: flex !important;
    flex-direction: row !important;
    gap: 10px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    max-height: 160px !important;
    padding: 10px !important;
    scroll-snap-type: x proximity;
  }

  #pageRoot .devices-layout .cart-card {
    flex: 0 0 240px !important;
    min-width: 0 !important;
    margin: 0 !important;
    scroll-snap-align: start;
  }

  #pageRoot .devices-layout .devices-list {
    max-height: calc(100vh - 330px) !important;
    overflow-x: auto !important;
  }

  #pageRoot .devices-panel .card-header-actions,
  #pageRoot .devices-panel .card-controls {
    flex-wrap: wrap !important;
  }
}

.cart-card:hover {
  border-color: var(--hbgs-green-400);
  background: var(--bg-tertiary);
}

.cart-card.active {
  border-color: var(--hbgs-green-600);
  background: var(--hbgs-green-50);
}

[data-theme="dark"] .cart-card.active {
  background: rgba(34, 197, 94, 0.15);
}

.cart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cart-card-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.cart-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 4px;
}

.cart-card-stats {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.cart-stat {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 10px;
}

.devices-panel {
  min-height: 400px;
}

.devices-list {
  max-height: 500px;
  overflow-y: auto;
}

.student-select-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.student-select-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.student-select-item:hover {
  background: var(--bg-tertiary);
  border-color: var(--hbgs-green-400);
}

.student-select-item.assigned {
  background: var(--hbgs-green-50);
  border-color: var(--hbgs-green-300);
}

[data-theme="dark"] .student-select-item.assigned {
  background: rgba(34, 197, 94, 0.1);
}

.student-select-name {
  font-weight: 500;
  font-size: 14px;
}

.student-select-class {
  font-size: 12px;
  color: var(--text-muted);
}

.current-assignments-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.assignment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--hbgs-green-100);
  border-radius: 16px;
  font-size: 13px;
  color: var(--hbgs-green-800);
}

[data-theme="dark"] .assignment-chip {
  background: rgba(34, 197, 94, 0.2);
  color: var(--hbgs-green-300);
}

.assignment-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: 14px;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.assignment-chip-remove:hover {
  opacity: 1;
}

.assigned-students {
  font-size: 13px;
  color: var(--hbgs-green-700);
}

[data-theme="dark"] .assigned-students {
  color: var(--hbgs-green-400);
}

@media (max-width: 900px) {
  .devices-layout {
    grid-template-columns: 1fr;
  }

  .carts-list {
    max-height: 300px;
  }
}

/* ============================================
   FILTER TABS (Tech Support, Website Unblock)
   ============================================ */
.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 0 16px 0;
}

.filter-tab {
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-tab:hover {
  background: var(--gray-100);
  color: var(--text-primary);
}

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

/* Card toolbar for filter tabs */
.card-toolbar {
  padding: 0 24px;
  border-bottom: 1px solid var(--border-color);
}

/* Status badges for tickets */
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.status-badge.status-open {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.status-badge.status-progress {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.status-badge.status-resolved {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

/* Priority badges */
.priority-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.priority-badge.priority-low {
  background: rgba(107, 114, 128, 0.1);
  color: #6b7280;
}

.priority-badge.priority-normal {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.priority-badge.priority-high {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.priority-badge.priority-urgent {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Coming Soon Page */
.coming-soon-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  text-align: center;
  color: var(--text-secondary);
}

.coming-soon-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.coming-soon-page h2 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.coming-soon-page p {
  margin: 0;
  font-size: 16px;
  color: var(--primary);
  font-weight: 500;
}

.coming-soon-desc {
  margin-top: 12px !important;
  font-size: 14px !important;
  color: var(--text-muted) !important;
  font-weight: 400 !important;
  max-width: 400px;
}

/* ============================================
   Time Off Requests
   ============================================ */

.requests-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.request-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
}

.request-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.request-type {
  display: flex;
  align-items: center;
  gap: 8px;
}

.request-type-icon {
  font-size: 20px;
}

.request-type-label {
  font-weight: 600;
  color: var(--text-primary);
}

.request-card-body {
  padding: 16px;
}

.request-staff {
  margin-bottom: 8px;
  color: var(--text-primary);
}

.request-dates {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.request-date-range {
  color: var(--text-primary);
  font-weight: 500;
}

.request-days {
  color: var(--text-muted);
  font-size: 14px;
}

.request-reason {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-radius: 6px;
}

.request-review-notes {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(var(--info-rgb), 0.1);
  border-radius: 6px;
  border-left: 3px solid var(--info);
}

.request-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

.request-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.request-actions {
  display: flex;
  gap: 8px;
}

/* Filter tabs for time off */
.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-tab:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-muted);
}

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

.filter-tab .badge {
  font-size: 11px;
  padding: 2px 6px;
  min-width: 18px;
}

.filter-tab.active .badge {
  background: rgba(255,255,255,0.2);
  color: white;
}

/* Form row for date inputs */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

  .request-card-footer {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .request-actions {
    justify-content: flex-end;
  }

  /* Time Off - Filter tabs horizontal scroll */
  .filter-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    gap: 6px;
    padding-bottom: 8px;
    margin-bottom: 12px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .filter-tabs::-webkit-scrollbar {
    display: none;
  }

  .filter-tab {
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 13px;
  }

  /* Time Off - Request cards improved */
  .request-card-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }

  .request-type-label {
    font-size: 14px;
  }

  .request-card-body {
    padding: 12px;
  }

  /* Per-day status chips - better wrapping */
  .per-day-statuses {
    gap: 3px !important;
  }

  .per-day-statuses span {
    font-size: 10px !important;
    padding: 2px 4px !important;
  }

  /* Day approval modal - mobile optimized */
  .day-row {
    flex-wrap: wrap !important;
    padding: 12px 0 !important;
  }

  .day-status-toggle {
    width: 100%;
    margin-top: 8px;
  }

  .day-btn {
    flex: 1 !important;
    min-height: 44px !important;
    font-size: 13px !important;
  }

  /* Stats grids - 2 columns on mobile */
  .stats-grid[style*="grid-template-columns: repeat(4"],
  .stats-grid[style*="repeat(4, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Staff detail modal on mobile */
  .staff-detail-modal .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Request notes - prevent overflow */
  .request-notes {
    word-break: break-word;
    font-size: 13px;
  }

  .request-review-notes {
    word-break: break-word;
    font-size: 12px;
  }

  /* Action buttons in request card */
  .request-actions .btn {
    padding: 8px 12px;
    font-size: 13px;
    min-height: 40px;
  }

  /* Content with sidebar - stack on mobile */
  .content-with-sidebar {
    grid-template-columns: 1fr !important;
  }

  .content-sidebar {
    position: static;
    order: -1;
  }

  /* Sidebar stats as horizontal scroll */
  .sidebar-card {
    padding: 12px;
  }

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

  /* Overview stats in sidebar - more compact */
  .sidebar-stat {
    padding: 8px 6px;
  }

  .sidebar-stat-value {
    font-size: 20px;
  }

  .sidebar-stat-label {
    font-size: 10px;
  }

  /* Days report modal */
  .days-report-modal .modal {
    max-width: 100% !important;
  }

  .days-report-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Top requesters list */
  .top-requester-item {
    padding: 10px 0 !important;
  }

  .top-requester-item .avatar {
    width: 32px !important;
    height: 32px !important;
    font-size: 12px !important;
  }
}

/* Extra small screens - 360px */
@media (max-width: 360px) {
  .filter-tab {
    padding: 6px 10px;
    font-size: 12px;
  }

  .filter-tab .badge {
    font-size: 10px;
    padding: 1px 4px;
    min-width: 14px;
  }

  .request-card-header {
    padding: 8px 10px;
  }

  .request-type-icon {
    font-size: 16px;
  }

  .request-type-label {
    font-size: 13px;
  }

  .request-card-body {
    padding: 10px;
  }

  .request-card-footer {
    padding: 10px;
  }

  .request-meta {
    font-size: 11px;
  }

  /* Stack action buttons vertically on very small screens */
  .request-actions {
    flex-direction: column;
    width: 100%;
  }

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

  /* Per-day statuses - even more compact */
  .per-day-statuses span {
    font-size: 9px !important;
    padding: 1px 3px !important;
  }
}

/* Content with Sidebar Layout */
.content-with-sidebar {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  align-items: start;
}

.content-main {
  min-width: 0;
}

.content-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: 4px;
}

/* Custom scrollbar for sidebar */
.content-sidebar::-webkit-scrollbar {
  width: 6px;
}

.content-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.content-sidebar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.content-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.sidebar-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--border-color);
}

.sidebar-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.sidebar-stat {
  text-align: center;
  padding: 8px;
  background: var(--bg-tertiary);
  border-radius: 8px;
}

.sidebar-stat-value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.sidebar-stat-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
}

.personal-days-progress {
  text-align: center;
}

.progress-bar {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.top-requesters-list .top-requester-item:last-child {
  border-bottom: none;
}

@media (max-width: 900px) {
  .content-with-sidebar {
    grid-template-columns: 1fr;
  }

  .content-sidebar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar-card {
    flex: 1;
    min-width: 200px;
  }
}

@media (max-width: 480px) {
  .content-sidebar {
    flex-direction: column;
  }

  .sidebar-card {
    min-width: 100%;
  }
}

/* Audit Log Styles */
.log-stat {
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  min-width: 70px;
}

.log-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--hbgs-green-400);
  line-height: 1.2;
}

.log-stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.logs-filters input[type="text"] {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 14px;
}

.logs-filters input[type="text"]:focus {
  outline: none;
  border-color: var(--hbgs-green-400);
}

.logs-filters input[type="date"] {
  min-width: 130px;
}

.logs-table-container table {
  font-size: 13px;
}

.logs-table-container code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', Monaco, monospace;
}

@media (max-width: 768px) {
  .logs-header {
    flex-direction: column !important;
    gap: 16px !important;
  }

  .logs-stats {
    width: 100%;
    justify-content: space-around;
  }

  .logs-filters {
    flex-direction: column !important;
  }

  .logs-filters > * {
    width: 100% !important;
    min-width: 100% !important;
  }

  .logs-table-container {
    max-height: 350px !important;
    font-size: 12px;
  }

  .logs-table-container th,
  .logs-table-container td {
    padding: 8px 6px !important;
  }
}

/* ============================================
   Media Library Collapsible
   ============================================ */

.media-library-card.collapsed .media-library-body {
  display: none;
}

.media-library-card.collapsed .media-library-controls {
  display: none !important;
}

.media-library-card.collapsed .media-collapse-icon {
  transform: rotate(-90deg);
}

/* ============================================
   Media Library Grid
   ============================================ */

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  padding: 8px 0;
}

.media-item {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}

.media-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.media-preview {
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.media-preview img,
.media-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}

.media-item:hover .media-preview img,
.media-item:hover .media-preview video {
  transform: scale(1.05);
}

.media-preview-video {
  background: linear-gradient(180deg, #182131 0%, #0f1720 100%);
}

.media-preview-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(10, 15, 25, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.16);
  pointer-events: none;
}

.media-info {
  padding: 10px 12px;
  border-top: 1px solid var(--border-color);
}

.media-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.media-meta {
  font-size: 11px;
  color: var(--text-secondary);
}

.media-actions {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.media-actions .btn-sm {
  padding: 4px 8px;
  font-size: 11px;
}

.media-reference-warning {
  display: grid;
  gap: 12px;
}

.media-reference-warning p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

.media-reference-list {
  display: grid;
  gap: 8px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.media-reference-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-secondary);
}

.media-reference-item strong {
  color: var(--text-primary);
}

.media-reference-item span {
  color: var(--text-secondary);
  font-size: 12px;
}

/* Image picker in modals */
.image-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding: 8px;
}

.image-picker-item {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s, transform 0.2s;
}

.image-picker-item:hover {
  border-color: var(--primary);
  transform: scale(1.02);
}

.image-picker-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Selectable media item in pickers */
.media-item.selectable {
  cursor: pointer;
}

.media-item.selectable:hover {
  border-color: var(--primary);
}

.media-item-name {
  padding: 8px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--bg-secondary);
}

/* Responsive */
@media (max-width: 768px) {
  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }

  .media-info {
    padding: 8px 10px;
  }

  .media-name {
    font-size: 12px;
  }

  .media-actions {
    padding: 6px 10px;
  }
}

@media (max-width: 480px) {
  .media-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

/* ============================================
   Login Screen Styles (extracted from index.html for caching)
   ============================================ */
.login-wrapper {
  min-height: 100vh;
  min-height: var(--app-height, 100vh);
  height: var(--app-height, 100vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a2e;
  padding: 20px;
}
.login-card {
  background: #16213e;
  border-radius: 16px;
  box-shadow: 0 18px 45px rgba(0,0,0,0.28);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  border: 1px solid rgba(56, 189, 248, 0.22);
}

@media (max-width: 480px) {
  .login-wrapper {
    padding: 12px;
    align-items: stretch;
  }

  .login-card {
    padding: 24px 18px;
    border-radius: 14px;
    margin: auto 0;
  }

  .login-header {
    margin-bottom: 24px;
  }

  .login-logo {
    width: 88px;
    height: 88px;
    margin-bottom: 16px;
  }
}
.login-header {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo {
  width: 120px;
  height: 120px;
  margin: 0 auto 20px;
}
.login-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.login-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #e8e8e8;
  margin-bottom: 4px;
}
.login-subtitle {
  font-size: 0.875rem;
  color: #cbd5e1;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-field label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #cbd5e1;
}
.login-field input {
  padding: 12px 14px;
  border: 1px solid #40506a;
  border-radius: 8px;
  font-size: 1rem;
  background: #1e293b;
  color: #e2e8f0;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.login-field input::placeholder {
  color: #9aa8bc;
}
.login-field input:focus {
  outline: none;
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}
.forgot-password-link {
  display: inline-flex;
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #93c5fd;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.forgot-password-link:hover,
.forgot-password-link:focus-visible {
  color: #bfdbfe;
  text-decoration: underline;
  outline: none;
}
.login-reset-note {
  margin-top: 10px;
  color: #cbd5e1;
  font-size: 0.85rem;
  line-height: 1.45;
}
.login-reset-status {
  min-height: 1.2em;
  margin-top: 10px;
  font-size: 0.875rem;
}
.login-reset-status.error { color: #fca5a5; }
.login-reset-status.success { color: #86efac; }
.login-field .password-wrapper {
  position: relative;
}
.login-field .password-wrapper input {
  width: 100%;
  padding-right: 58px;
}
.login-field .password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  opacity: 0.82;
  color: #cbd5e1;
}
.login-field .password-toggle:hover,
.login-field .password-toggle:focus-visible {
  opacity: 1;
  background: rgba(148, 163, 184, 0.12);
}
.login-field .password-toggle:focus-visible {
  outline: 2px solid rgba(34, 197, 94, 0.75);
  outline-offset: 2px;
}
.login-default-password-note {
  text-align: center;
  margin-top: 14px;
  font-size: 0.75rem;
  color: #8da0b8;
}
.login-default-password-note span {
  color: #c3d0e1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 600;
}
.year-end-lockdown-message {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 14px 0 16px;
  padding: 12px 14px;
  border: 1px solid rgba(34, 197, 94, 0.28);
  border-left: 4px solid #22c55e;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.52);
  line-height: 1.45;
}
.year-end-lockdown-message strong {
  color: #f8fafc;
  font-size: 0.92rem;
}
.year-end-lockdown-message span {
  color: #9fb0c6;
  font-size: 0.82rem;
}
.login-btn {
  padding: 14px;
  background: #22c55e;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.login-btn:hover {
  background: #16a34a;
}
.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.login-btn-secondary {
  background: rgba(15, 23, 42, 0.35);
  color: #cbd5e1;
  border: 1px solid #475569;
}
.login-btn-secondary:hover {
  background: #1e293b;
  border-color: #475569;
  color: #e2e8f0;
}
.login-btn .btn-icon {
  width: 18px;
  height: 18px;
}
.login-passkey-btn {
  padding: 10px 16px;
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid #334155;
  border-radius: 8px;
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 0.85rem;
}
.login-passkey-btn:hover {
  background: #1e293b;
  border-color: #22c55e;
  color: #e2e8f0;
}
.login-passkey-btn:hover .passkey-icon {
  color: #22c55e;
}
.login-passkey-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.passkey-icon {
  width: 18px;
  height: 18px;
  color: #64748b;
  transition: color 0.2s;
}
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
  color: #64748b;
  font-size: 0.8rem;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #334155;
}
.login-error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  padding: 12px;
  border-radius: 8px;
  font-size: 0.875rem;
  text-align: center;
  display: none;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.login-error.show {
  display: block;
}
.login-version {
  text-align: center;
  margin-top: 20px;
  font-size: 0.75rem;
  color: #8190a6;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.login-version .version-badge-beta {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.login-hint {
  color: #cbd5e1;
}

@media (max-height: 480px) and (orientation: landscape) {
  .login-logo {
    display: none;
  }

  .login-card {
    padding: 12px 22px;
  }

  .login-btn {
    padding: 10px 14px;
  }
}

/* ============================================
   Theme-aware connection banner
   ============================================ */
.header-offline-indicator {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--hbgs-danger) 12%, var(--hbgs-surface-2));
  color: var(--hbgs-danger);
  animation: offline-pulse 2s ease-in-out infinite;
}
.header-offline-indicator.visible {
  display: flex;
}
@keyframes offline-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.72; }
}
.app-offline-banner {
  --offline-banner-accent: var(--hbgs-danger);
  position: fixed;
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  left: 50%;
  right: auto;
  width: min(calc(100% - 32px), 680px);
  max-width: 680px;
  z-index: var(--z-toast, 900);
  pointer-events: none;
  transform: translate(-50%, calc(100% + 32px));
  transition: transform 0.24s ease;
}
.app-offline-banner.syncing {
  --offline-banner-accent: var(--hbgs-warn);
}
.app-offline-banner.cached {
  --offline-banner-accent: var(--hbgs-info);
}
.app-offline-banner.visible {
  transform: translate(-50%, 0);
  pointer-events: auto;
}
.offline-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 12px;
  background: var(--hbgs-surface);
  color: var(--hbgs-ink);
  border: 1px solid var(--hbgs-line);
  border-left: 4px solid var(--offline-banner-accent);
  border-radius: var(--hbgs-radius, 12px);
  box-shadow: 0 10px 30px color-mix(in srgb, var(--hbgs-ink) 18%, transparent);
  pointer-events: none;
}
.app-offline-banner.visible .offline-banner-content {
  pointer-events: auto;
}
.offline-banner-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: var(--hbgs-radius-pill, 999px);
  background: color-mix(in srgb, var(--offline-banner-accent) 12%, var(--hbgs-surface-2));
  color: var(--offline-banner-accent);
  font-size: 0;
  animation: pulse-offline 2s ease-in-out infinite;
}
.offline-banner-icon::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
@keyframes pulse-offline {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
.offline-banner-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.offline-banner-text strong {
  color: var(--hbgs-ink);
  font-size: 14px;
  font-weight: 650;
}
.offline-banner-text span {
  color: var(--hbgs-ink-2);
  font-size: 12px;
}
.offline-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.offline-pending-count {
  padding: 4px 9px;
  border-radius: var(--hbgs-radius-pill, 999px);
  background: var(--hbgs-surface-2);
  color: var(--hbgs-ink-2);
  font-size: 12px;
  white-space: nowrap;
}
.offline-banner-dismiss {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--hbgs-line-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--hbgs-ink-2);
  cursor: pointer;
  position: relative;
  z-index: 2;
  pointer-events: auto;
  touch-action: manipulation;
}
.offline-banner-dismiss:hover {
  background: var(--hbgs-surface-2);
  color: var(--hbgs-ink);
}
.offline-banner-dismiss:focus-visible {
  outline: 2px solid var(--offline-banner-accent);
  outline-offset: 2px;
}
@media (max-width: 768px) {
  .app-layout:not(.hidden) ~ .app-offline-banner {
    bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 12px);
  }
  .app-offline-banner {
    width: min(calc(100% - 20px), 680px);
  }
  .offline-banner-content {
    min-height: 52px;
    padding: 8px 10px;
  }
  .offline-banner-dismiss {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
  }
  .offline-banner-text span {
    display: none;
  }
}

/* ============================================
   v5.0: Dark Mode Overrides for Page-Specific Elements
   ============================================ */

/* Attendance module */
[data-theme="dark"] .att-stat-card {
  background: var(--card-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .att-info-box {
  background: var(--success-bg);
  border-color: var(--success);
}

[data-theme="dark"] .att-info-box strong {
  color: var(--success-text);
}

[data-theme="dark"] .att-info-box.warning {
  background: var(--warning-bg);
  border-color: var(--warning);
}

[data-theme="dark"] .att-info-box.warning strong {
  color: var(--warning-text);
}

[data-theme="dark"] .att-info-box.danger {
  background: var(--danger-bg);
  border-color: var(--danger);
}

[data-theme="dark"] .att-info-box.danger strong {
  color: var(--danger-text);
}

[data-theme="dark"] .att-chart-card {
  background: var(--card-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .att-bar-track {
  background: var(--bg-secondary);
}

[data-theme="dark"] .att-table-wrapper {
  border-color: var(--border-color);
}

/* Absence flags - use semantic variables */
[data-theme="dark"] .absence-flag-dot-caution {
  background: #eab308;
}

[data-theme="dark"] .absence-flag-danger {
  background: rgba(220, 38, 38, 0.2);
  color: #f87171;
  border-color: rgba(220, 38, 38, 0.4);
}

[data-theme="dark"] .absence-flag-warning {
  background: rgba(217, 119, 6, 0.2);
  color: #fbbf24;
  border-color: rgba(217, 119, 6, 0.4);
}

[data-theme="dark"] .absence-flag-caution {
  background: rgba(234, 179, 8, 0.2);
  color: #fde047;
  border-color: rgba(234, 179, 8, 0.4);
}

/* Attendance badges */
[data-theme="dark"] .attendance-good {
  background: rgba(22, 163, 74, 0.2);
  color: #4ade80;
}

[data-theme="dark"] .attendance-warning {
  background: rgba(234, 179, 8, 0.2);
  color: #fde047;
}

[data-theme="dark"] .attendance-low {
  background: rgba(220, 38, 38, 0.2);
  color: #f87171;
}

/* Status badges */
[data-theme="dark"] .status-badge.status-open {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

[data-theme="dark"] .status-badge.status-progress {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

[data-theme="dark"] .status-badge.status-resolved {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

/* Priority badges */
[data-theme="dark"] .priority-badge.priority-low {
  background: rgba(107, 114, 128, 0.2);
  color: #9ca3af;
}

[data-theme="dark"] .priority-badge.priority-normal {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

[data-theme="dark"] .priority-badge.priority-high {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

[data-theme="dark"] .priority-badge.priority-urgent {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* Key management */
[data-theme="dark"] .key-desc {
  color: var(--text-muted);
}

/* Request cards (time off) */
[data-theme="dark"] .request-card {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

[data-theme="dark"] .request-card-header {
  background: var(--bg-tertiary);
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .request-card-footer {
  background: var(--bg-tertiary);
  border-top-color: var(--border-color);
}

[data-theme="dark"] .request-reason {
  background: var(--bg-tertiary);
}

[data-theme="dark"] .request-review-notes {
  background: var(--info-bg);
  border-left-color: var(--info);
  color: var(--info-text);
}

/* Sidebar cards (time off sidebar) */
[data-theme="dark"] .sidebar-card {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

[data-theme="dark"] .sidebar-stat {
  background: var(--bg-tertiary);
}

/* Progress bars */
[data-theme="dark"] .progress-bar {
  background: var(--bg-tertiary);
}

/* Admin sections */
[data-theme="dark"] .admin-section {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

[data-theme="dark"] .admin-section-header:hover {
  background: var(--bg-tertiary);
}

[data-theme="dark"] .admin-status {
  background: var(--bg-primary);
  border-color: var(--border-color);
}

/* Admin widget items */
[data-theme="dark"] .admin-widget-item {
  background: var(--bg-secondary);
}

[data-theme="dark"] .admin-widget-item:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
}

/* Card controls and filter tabs */
[data-theme="dark"] .card-controls {
  background: var(--bg-secondary);
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .filter-tab {
  background: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

[data-theme="dark"] .filter-tab:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

[data-theme="dark"] .filter-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Media library */
[data-theme="dark"] .media-item {
  background: var(--card-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .media-info {
  border-top-color: var(--border-color);
}

[data-theme="dark"] .media-actions {
  background: var(--bg-secondary);
  border-top-color: var(--border-color);
}

/* Autocomplete */
[data-theme="dark"] .autocomplete-dropdown {
  background: var(--card-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .autocomplete-item:hover {
  background: var(--bg-tertiary);
}

/* Permissions editor */
[data-theme="dark"] .permissions-mode {
  background: var(--bg-secondary);
}

[data-theme="dark"] .permission-select {
  background: var(--card-bg);
  color: var(--text-primary);
  border-color: var(--border-color);
}

/* Perm groups (security settings) */
[data-theme="dark"] .perm-group {
  background: var(--bg-secondary);
}

[data-theme="dark"] .perm-group-title {
  border-bottom-color: var(--border-color);
}

/* Role tabs */
[data-theme="dark"] .role-tab {
  background: var(--bg-primary);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

[data-theme="dark"] .role-tab:hover {
  background: var(--bg-tertiary);
}

[data-theme="dark"] .role-permissions-editor {
  background: var(--bg-primary);
  border-color: var(--border-color);
}

/* Admin widget list */
[data-theme="dark"] .admin-widget-list {
  background: var(--bg-primary);
  border-color: var(--border-color);
}

/* Search results dropdown */
[data-theme="dark"] .search-results {
  background: var(--card-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .search-result-item {
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .search-result-item:hover {
  background: var(--bg-tertiary);
}

/* Device management */
[data-theme="dark"] .devices-panel {
  background: var(--card-bg);
}

/* Contact cards in profile */
[data-theme="dark"] .contact-card {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

[data-theme="dark"] .contact-phone-btn {
  background: var(--bg-primary);
  border-color: var(--border-color);
  color: var(--hbgs-green-400);
}

[data-theme="dark"] .contact-phone-btn:hover {
  background: var(--hbgs-green-600);
  color: white;
  border-color: var(--hbgs-green-600);
}

/* Profile sections */
[data-theme="dark"] .profile-section {
  background: var(--bg-secondary);
}

[data-theme="dark"] .profile-section-header {
  background: var(--bg-tertiary);
  border-bottom-color: var(--border-color);
}

/* Mini calendar */
[data-theme="dark"] .mini-calendar {
  background: var(--bg-secondary);
}

[data-theme="dark"] .mini-cal-day.present {
  background: rgba(34, 197, 94, 0.2);
}

[data-theme="dark"] .mini-cal-day.absent {
  background: rgba(220, 38, 38, 0.2);
}

[data-theme="dark"] .mini-cal-day.excused {
  background: rgba(217, 119, 6, 0.2);
}

[data-theme="dark"] .mini-cal-day.late {
  background: rgba(245, 158, 11, 0.25);
}

/* Profile stat boxes */
[data-theme="dark"] .profile-stat {
  background: var(--bg-secondary);
}

/* Quick contacts */
[data-theme="dark"] .profile-quick-contacts {
  background: var(--bg-secondary);
}

/* Student achievements */
[data-theme="dark"] .student-profile-achievements {
  background: var(--bg-secondary);
}

/* Import dropzone - already handled but ensure consistency */
[data-theme="dark"] .import-dropzone {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
}

/* Card toolbar */
[data-theme="dark"] .card-toolbar {
  border-bottom-color: var(--border-color);
}

/* Admin tabs */
[data-theme="dark"] .admin-tab:hover {
  background: var(--bg-tertiary);
}

[data-theme="dark"] .admin-tab.active {
  color: var(--hbgs-green-400);
  border-bottom-color: var(--hbgs-green-400);
}

[data-theme="dark"] .admin-tab-content {
  background: var(--bg-primary);
}

/* Keep Key Management actions inside narrow portrait and touch-landscape viewports. */
@media (max-width: 768px), (max-height: 500px) and (hover: none) and (pointer: coarse) {
  .keys-layout > .card > .card-header {
    align-items: stretch;
  }

  .keys-header-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  .keys-header-actions .btn {
    width: 100%;
    min-width: 0;
    padding-inline: 8px;
    white-space: normal;
  }
}

/* ===== dashboard.css ===== */
/* HBGS Design System v2.1 - Dashboard */

/* ============================================
   Dashboard Layout
   ============================================ */

.dash {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

.dash-start-of-day {
  padding: 18px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: var(--card-bg);
  box-shadow: none;
}

.dash-start-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.dash-start-heading h2 { margin: 2px 0 0; font-size: 18px; }
.dash-start-kicker, .dash-start-role { color: var(--text-muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.dash-start-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.dash-start-card {
  min-height: 108px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 14px;
  color: var(--text-primary);
  text-align: left;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: none;
  cursor: pointer;
}
.dash-start-card:hover { border-color: var(--hbgs-green-500); }
.dash-start-card strong { font-size: 25px; line-height: 1.1; }
.dash-start-card > span:last-child { color: var(--text-secondary); font-size: 12px; }
.dash-start-card.is-unavailable { opacity: .72; cursor: not-allowed; }
.dash-start-card.is-unavailable:hover { border-color: var(--border-color); }
.dash-start-label { font-size: 12px; font-weight: 700; }
.dash-start-empty { color: var(--text-secondary); font-size: 13px; }

@media (max-width: 720px) {
  .dash-start-of-day { padding: 14px; }
  .dash-start-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-start-card { min-height: 96px; padding: 12px; }
  .dash-start-heading { align-items: flex-start; }
}

/* 320px viewports and 200% text zoom collapse to a readable single column. */
@media (max-width: 360px) {
  .dash-start-cards { grid-template-columns: minmax(0, 1fr); }
  .dash-start-heading { flex-direction: column; }
}

/* ============================================
   Announcements Banner
   ============================================ */

.dash-announcements {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.announcement {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  border-left: 4px solid;
  position: relative;
}

.announcement-info {
  background: #eff6ff;
  border-color: #3b82f6;
}

.announcement-warning {
  background: #fffbeb;
  border-color: #f59e0b;
}

.announcement-urgent {
  background: #fef2f2;
  border-color: #ef4444;
  animation: pulse-announcement 2s infinite;
}

@keyframes pulse-announcement {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

.announcement-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.announcement-content {
  flex: 1;
}

.announcement-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.announcement-message {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.announcement-dismiss {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.announcement-dismiss:hover {
  background: rgba(0,0,0,0.1);
  color: var(--text-primary);
}

/* Announcement Management List */
.announcements-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.announcement-item {
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--card-bg);
}

.announcement-item.inactive,
.announcement-item.expired {
  opacity: 0.6;
}

.announcement-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.announcement-item-icon {
  font-size: 18px;
}

.announcement-item-title {
  font-weight: 600;
  flex: 1;
}

.announcement-item-message {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.4;
}

.announcement-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

.announcement-item-actions {
  display: flex;
  gap: 8px;
}

/* ============================================
   Hero Header
   ============================================ */

.dash .dash-hero,
.dash-hero {
  background: linear-gradient(135deg, #16a34a 0%, #14532d 100%) !important;
  border-radius: 16px;
  padding: 24px 28px;
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  min-height: 80px;
  width: 100%;
  box-sizing: border-box;
  overflow: visible;
  position: relative;
}

.dash-customize-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

/* Only show on desktop */
@media (min-width: 769px) {
  .dash-customize-btn {
    display: flex;
  }
}

.dash-customize-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.8);
}

.dash-customize-btn svg {
  width: 11px;
  height: 11px;
}

.dash-hero-content {
  flex: 1;
  min-width: 200px;
}

.dash-hero-title {
  font-size: 24px;
  font-weight: 700;
  color: white;
  margin: 0 0 4px 0;
}

.dash-hero-date {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
}

/* Tab Buttons */
.dash-hero-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.dash-tab {
  padding: 5px 10px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9);
}

.dash-tab:hover {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

.dash-tab.active {
  background: white;
  color: #16a34a;
}

/* Classes Module */
.classes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 16px;
}

.class-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.class-card:hover {
  border-color: var(--hbgs-green-500);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.class-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.class-card-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.class-card-count {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--gray-100);
  padding: 4px 10px;
  border-radius: 20px;
}

.class-card-preview {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.class-card-student {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 2px 0;
}

.class-card-more {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 4px;
}

.class-detail-header {
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.class-detail-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.class-detail-stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--hbgs-green-600);
}

.class-detail-stat-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* Class indicator stat */
.dash-stat-class-indicator {
  background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
  color: white;
}

.dash-stat-class-indicator .dash-stat-icon {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.dash-stat-class-indicator .dash-stat-num {
  color: white;
}

.dash-stat-class-indicator .dash-stat-label {
  color: rgba(255, 255, 255, 0.9);
}

/* ============================================
   Stats Row
   ============================================ */

#dashStats.dash-stats {
  display: block;
  width: 100%;
}

.dash-stat {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: transform 0.15s, box-shadow 0.15s;
}

.dash-stat-clickable {
  cursor: pointer;
}

.dash-stat-clickable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.dash-stat-clickable:active {
  transform: translateY(0);
}

.dash-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  font-size: 22px;
  flex-shrink: 0;
}

.dash-stat-icon.green { background: rgba(22, 163, 74, 0.15); }
.dash-stat-icon.blue { background: rgba(59, 130, 246, 0.15); }
.dash-stat-icon.orange { background: rgba(249, 115, 22, 0.15); }
.dash-stat-icon.purple { background: rgba(139, 92, 246, 0.15); }
.dash-stat-icon.teal { background: rgba(20, 184, 166, 0.15); }
.dash-stat-icon.red { background: rgba(239, 68, 68, 0.15); }

.dash-stat-data {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.dash-stat-num {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.dash-stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Urgent Tech Support Stat */
.dash-stat-urgent {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.05);
  animation: pulse-urgent 2s infinite;
}

@keyframes pulse-urgent {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

/* ============================================
   Main Content Grid
   ============================================ */

.dash-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Panels */
.dash-panel {
  background: var(--card-bg);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.dash-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.dash-panel-header h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.dash-panel-count {
  background: var(--hbgs-green-100);
  color: var(--hbgs-green-700);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.dash-panel-content {
  padding: 12px;
  flex: 1;
  overflow-y: auto;
  max-height: 400px;
}

/* ============================================
   Activity Items
   ============================================ */

.dash-activity-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.dash-activity-item:hover {
  background: var(--bg-tertiary);
}

.dash-activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.dash-activity-icon.signin { background: rgba(22, 163, 74, 0.15); }
.dash-activity-icon.bathroom { background: rgba(59, 130, 246, 0.15); }
.dash-activity-icon.pickup { background: rgba(249, 115, 22, 0.15); }
.dash-activity-icon.dismissal { background: rgba(139, 92, 246, 0.15); }
.dash-activity-icon.copies { background: rgba(20, 184, 166, 0.15); }

.dash-activity-info {
  flex: 1;
  min-width: 0;
}

.dash-activity-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.dash-activity-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.dash-activity-time {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ============================================
   Alert Items
   ============================================ */

.dash-alert {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: transform 0.1s ease;
  align-items: flex-start;
}

.dash-alert:hover {
  transform: translateX(2px);
}

.dash-alert:last-child {
  margin-bottom: 0;
}

.dash-alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border-left: 3px solid var(--danger);
}

.dash-alert-warn {
  background: rgba(245, 158, 11, 0.1);
  border-left: 3px solid var(--warning);
}

.dash-alert-info {
  background: rgba(59, 130, 246, 0.1);
  border-left: 3px solid var(--info, #3b82f6);
}

.dash-alert-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.05);
  border-left: 3px solid var(--danger);
  margin-bottom: 6px;
}

.dash-alert-item:last-child {
  margin-bottom: 0;
}

.dash-alert-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.dash-alert-danger .dash-alert-icon {
  background: rgba(239, 68, 68, 0.15);
}

.dash-alert-warn .dash-alert-icon {
  background: rgba(245, 158, 11, 0.15);
}

.dash-alert-info .dash-alert-icon {
  background: rgba(59, 130, 246, 0.15);
}

.dash-alert-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-alert-content strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.dash-alert-content span {
  font-size: 13px;
  color: var(--text-muted);
}

.dash-alert-arrow {
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.7;
  margin-top: 2px;
}

.dash-alert:hover .dash-alert-arrow {
  opacity: 1;
}

/* ============================================
   Empty States
   ============================================ */

.dash-empty {
  text-align: center;
  padding: 20px 16px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.dash-empty-icon {
  font-size: 24px;
  margin-bottom: 4px;
  opacity: 0.8;
}

.dash-empty-text {
  font-size: 13px;
}

.dash-empty-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.dash-empty-success .dash-empty-icon {
  opacity: 0.8;
  color: var(--success);
}

.dash-loading {
  text-align: center;
  padding: 20px 16px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ============================================
   Weather Widget
   ============================================ */

.dash-weather {
  padding: 16px;
}

.dash-weather-content {
  display: flex;
  align-items: center;
  gap: 20px;
}

.dash-weather-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-weather-icon {
  font-size: 48px;
  line-height: 1;
}

.dash-weather-temp {
  display: flex;
  align-items: flex-start;
}

.dash-weather-temp-value {
  font-size: 42px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.dash-weather-temp-unit {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 4px;
}

.dash-weather-details {
  flex: 1;
  min-width: 0;
}

.dash-weather-desc {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.dash-weather-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.dash-weather-stats span {
  white-space: nowrap;
}

.dash-weekly-weather-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  gap: 0;
}

.dash-weekly-weather-day {
  min-width: 0;
  padding: 0 8px;
  text-align: center;
  border-left: 1px solid var(--border-color);
}

.dash-weekly-weather-day:first-child {
  border-left: 0;
}

.dash-weekly-weather-name {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.dash-weekly-weather-icon {
  font-size: 24px;
  line-height: 1;
  margin: 4px 0;
}

.dash-weekly-weather-icon .hbgs-icon {
  width: 24px;
  height: 24px;
}

.dash-weekly-weather-temps {
  display: flex;
  justify-content: center;
  gap: 5px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
}

.dash-weekly-weather-temps span + span,
.dash-weekly-weather-pop {
  color: var(--text-secondary);
  font-weight: 500;
}

.dash-weekly-weather-pop {
  font-size: 11px;
  margin-top: 2px;
}

@media (max-width: 640px) {
  .dash-weekly-weather-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    row-gap: 12px;
  }

  .dash-weekly-weather-day:nth-child(3n + 1) {
    border-left: 0;
  }
}

@media (max-width: 480px) {
  .dash-weather-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .dash-weather-icon {
    font-size: 36px;
  }

  .dash-weather-temp-value {
    font-size: 32px;
  }

  .dash-weather-stats {
    gap: 8px;
  }
}

/* ============================================
   Charts
   ============================================ */

.dash-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.dash-chart-card {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.dash-chart-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.dash-chart-container {
  height: 200px;
  position: relative;
}

/* ============================================
   Dashboard Dark Mode
   ============================================ */

[data-theme="dark"] .announcement-info {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
}

[data-theme="dark"] .announcement-warning {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
}

[data-theme="dark"] .announcement-urgent {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
}

[data-theme="dark"] .announcement-dismiss:hover {
  background: rgba(255,255,255,0.1);
}

[data-theme="dark"] .dash-stat-icon.green { background: rgba(34, 197, 94, 0.15); }
[data-theme="dark"] .dash-stat-icon.blue { background: rgba(59, 130, 246, 0.15); }
[data-theme="dark"] .dash-stat-icon.orange { background: rgba(249, 115, 22, 0.15); }
[data-theme="dark"] .dash-stat-icon.purple { background: rgba(139, 92, 246, 0.15); }
[data-theme="dark"] .dash-stat-icon.teal { background: rgba(20, 184, 166, 0.15); }
[data-theme="dark"] .dash-stat-icon.red { background: rgba(239, 68, 68, 0.15); }

[data-theme="dark"] .dash-stat-urgent {
  background: rgba(239, 68, 68, 0.15);
}

[data-theme="dark"] .dash-activity-icon.signin { background: rgba(34, 197, 94, 0.2); }
[data-theme="dark"] .dash-activity-icon.bathroom { background: rgba(59, 130, 246, 0.2); }
[data-theme="dark"] .dash-activity-icon.pickup { background: rgba(249, 115, 22, 0.2); }
[data-theme="dark"] .dash-activity-icon.dismissal { background: rgba(139, 92, 246, 0.2); }
[data-theme="dark"] .dash-activity-icon.copies { background: rgba(20, 184, 166, 0.2); }

[data-theme="dark"] .dash-alert-item {
  background: rgba(239, 68, 68, 0.1);
}

[data-theme="dark"] .dash-panel-count {
  background: rgba(22, 163, 74, 0.2);
  color: #4ade80;
}

/* ============================================
   Dashboard Mobile Responsive
   ============================================ */

@media (max-width: 768px) {
  .dash {
    gap: 16px;
  }

  .dash-hero {
    padding: 16px 18px;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    position: relative;
  }

  .dash-hero .dash-customize-btn {
    position: absolute;
    top: 12px;
    right: 12px;
  }

  .dash-hero-content {
    min-width: 100%;
  }

  .dash-hero-title {
    font-size: 20px;
  }

  .dash-hero-date {
    font-size: 13px;
  }

  .dash-hero-tabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    flex-wrap: nowrap;
  }

  .dash-hero-tabs::-webkit-scrollbar {
    display: none;
  }

  .dash-tab {
    padding: 4px 10px;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .dash-stat {
    padding: 14px;
    gap: 10px;
  }

  .dash-stat-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .dash-stat-num {
    font-size: 22px;
  }

  .dash-stat-label {
    font-size: 12px;
  }

  .dash-main {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .dash-panel-header {
    padding: 12px 16px;
  }

  .dash-panel-header h3 {
    font-size: 14px;
  }

  .dash-panel-content {
    padding: 8px;
    max-height: 300px;
  }

  .dash-activity-item {
    padding: 10px;
    gap: 10px;
  }

  .dash-activity-icon {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .dash-activity-title {
    font-size: 13px;
  }

  .dash-activity-meta,
  .dash-activity-time {
    font-size: 11px;
  }

  .dash-alert {
    padding: 10px;
    gap: 10px;
  }

  .dash-alert-icon {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  .dash-alert-content strong {
    font-size: 12px;
  }

  .dash-alert-content span {
    font-size: 11px;
  }

  .dash-charts {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .dash-chart-card {
    padding: 16px;
  }

  .dash-chart-title {
    font-size: 14px;
    margin-bottom: 12px;
  }

  .dash-chart-container {
    height: 180px;
  }

  .classes-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }

  .class-card {
    padding: 14px;
  }

  .class-card-name {
    font-size: 16px;
  }

  .announcement {
    padding: 12px 14px;
    gap: 10px;
  }

  .announcement-icon {
    font-size: 18px;
  }

  .announcement-title {
    font-size: 14px;
  }

  .announcement-message {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .dash-hero {
    padding: 14px 16px;
  }

  .dash-hero-title {
    font-size: 18px;
  }

  .dash-stat {
    padding: 12px;
  }

  .dash-stat-num {
    font-size: 20px;
  }

  .dash-chart-container {
    height: 160px;
  }
}

/* ============================================
   Leaderboard Widget
   ============================================ */

.dash-leaderboard-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid var(--border-color);
  overflow: hidden;
  /* No margin needed - grid gap handles spacing */
}

.dash-leaderboard-title {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.dash-leaderboard-list {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-leaderboard-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--gray-50, rgba(0,0,0,0.02));
  cursor: pointer;
  transition: background 0.15s ease;
}

.dash-leaderboard-item:hover {
  background: var(--bg-tertiary);
}

.dash-leaderboard-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.dash-leaderboard-rank.gold {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: white;
}

.dash-leaderboard-rank.silver {
  background: linear-gradient(135deg, #9ca3af, #6b7280);
  color: white;
}

.dash-leaderboard-rank.bronze {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: white;
}

.dash-leaderboard-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.dash-leaderboard-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  flex-shrink: 0;
}

.dash-leaderboard-empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 20px 16px;
  font-size: 13px;
}

/* ============================================
   Events Widget
   ============================================ */

.dash-event-item {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--gray-50, rgba(0,0,0,0.02));
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.dash-event-item:last-child {
  margin-bottom: 0;
}

.dash-event-item:hover {
  background: var(--bg-tertiary);
}

.dash-event-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 6px 8px;
  background: var(--primary);
  border-radius: 8px;
  flex-shrink: 0;
}

.dash-event-date-day {
  font-size: 18px;
  font-weight: 700;
  color: white;
  line-height: 1;
}

.dash-event-date-month {
  font-size: 10px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
}

.dash-event-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-event-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-event-desc {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-event-type {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  align-self: flex-start;
}

.dash-event-type.event {
  background: rgba(59, 130, 246, 0.1);
  color: var(--info, #3b82f6);
}

.dash-event-type.closed {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.dash-event-type.half_day {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

/* ============================================
   Packages Widget
   ============================================ */

.dash-package-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--gray-50, rgba(0,0,0,0.02));
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.dash-package-item:last-child {
  margin-bottom: 0;
}

.dash-package-item:hover {
  background: var(--bg-tertiary);
}

.dash-package-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.dash-package-info {
  flex: 1;
  min-width: 0;
}

.dash-package-recipient {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-package-details {
  font-size: 11px;
  color: var(--text-secondary);
}

.dash-package-location {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ============================================
   Quick Actions Widget
   ============================================ */

.dash-quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
  padding: 16px;
}

.dash-quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  border-radius: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.15s ease;
}

.dash-quick-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
}

.dash-quick-action:active {
  transform: translateY(0);
}

.dash-quick-action-icon {
  font-size: 24px;
}

.dash-quick-action-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: center;
}

/* ============================================
   Weekly Summary Widget
   ============================================ */

.dash-summary {
  padding: 16px;
}

.dash-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
}

.dash-summary-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-summary-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.dash-summary-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.dash-summary-change {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  width: fit-content;
}

.dash-summary-change.positive {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

.dash-summary-change.negative {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

/* ============================================
   Distribution Widget
   ============================================ */

.dash-dist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.dash-dist-item:last-child {
  margin-bottom: 0;
}

.dash-dist-label {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 60px;
  flex-shrink: 0;
}

.dash-dist-bar {
  flex: 1;
  height: 24px;
  background: var(--bg-secondary);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.dash-dist-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.3s ease;
}

.dash-dist-value {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ============================================
   Dashboard Widget Dark Mode
   ============================================ */

[data-theme="dark"] .dash-leaderboard-card {
  background: var(--card-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .dash-leaderboard-item {
  background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .dash-leaderboard-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .dash-leaderboard-rank {
  background: var(--bg-tertiary);
}

[data-theme="dark"] .dash-event-item,
[data-theme="dark"] .dash-package-item {
  background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .dash-event-item:hover,
[data-theme="dark"] .dash-package-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .dash-quick-action {
  background: var(--card-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .dash-quick-action:hover {
  border-color: var(--primary);
}

[data-theme="dark"] .dash-dist-bar {
  background: var(--bg-tertiary);
}

/* ============================================
   Dashboard Widget Mobile Responsive
   ============================================ */

@media (max-width: 768px) {
  .dash-leaderboard-item {
    padding: 6px 8px;
  }

  .dash-leaderboard-name {
    font-size: 12px;
  }

  .dash-leaderboard-value {
    font-size: 12px;
  }

  .dash-event-item {
    padding: 8px 10px;
  }

  .dash-event-date {
    min-width: 40px;
    padding: 4px 6px;
  }

  .dash-event-date-day {
    font-size: 16px;
  }

  .dash-event-date-month {
    font-size: 9px;
  }

  .dash-event-title {
    font-size: 12px;
  }

  .dash-package-item {
    padding: 8px 10px;
  }

  .dash-package-recipient {
    font-size: 12px;
  }

  .dash-quick-actions {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 12px;
  }

  .dash-quick-action {
    padding: 12px 8px;
  }

  .dash-quick-action-icon {
    font-size: 20px;
  }

  .dash-quick-action-label {
    font-size: 11px;
  }

  .dash-summary-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .dash-summary-value {
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  .dash-quick-actions {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================
   Dashboard Widget Container (defined in JS)
   ============================================ */

/* Ensure consistent widget gaps */
.dash-widgets {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.dash-widget {
  transition: all 0.3s ease;
  position: relative;
  grid-column: span 2; /* Full width by default */
}

.dash-widget.dash-widget-half {
  grid-column: span 1; /* Half width */
}

.dash-widget.hidden {
  display: none !important;
}

/* Remove any extra margins that could cause inconsistent spacing */
.dash-widget > div:first-child {
  margin-top: 0;
}

.dash-widget > div:last-child {
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .dash-widgets {
    grid-template-columns: 1fr;
  }
  .dash-widget,
  .dash-widget.dash-widget-half {
    grid-column: span 1;
  }
}

/* ===== modals.css ===== */
/* HBGS Design System v2.1 - Modals & Toasts */

/* ============================================
   Modal Backdrop & Container
   ============================================ */

html.has-open-dialog,
html.has-open-dialog body {
  overflow: hidden !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal-backdrop);
  padding: var(--space-6);
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--card-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-modal);
  width: 100%;
  max-width: 480px;
  max-height: min(90vh, 900px);
  max-height: min(90dvh, 900px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.modal-lg {
  max-width: 640px;
}

.modal-xl {
  max-width: 900px;
  width: 95%;
}

/* ============================================
   Modal Header
   ============================================ */

.modal-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-width: 0;
  position: sticky;
  top: 0;
  z-index: 2;
  flex-shrink: 0;
  background: var(--card-bg);
}

.modal-title {
  font-size: 18px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.modal-close,
.modal-close-btn,
.modal-header [aria-label^="Close"],
.modal-header button[id$="Close"] {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--gray-400);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  /* v5.2.5: Ensure close button is always accessible on touch devices */
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

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

/* ============================================
   Modal Body
   ============================================ */

.modal-body {
  padding: var(--space-5);
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-help {
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
  color: var(--text-secondary);
  margin: 0 0 var(--space-4);
}

/* ============================================
   Modal Footer
   ============================================ */

.modal-footer {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  flex-wrap: wrap;
  position: sticky;
  bottom: 0;
  z-index: 2;
  flex-shrink: 0;
  background: var(--card-bg);
}

/* ============================================
   Export Modal Options
   ============================================ */

.export-options {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.export-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
}

.export-option input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--hbgs-green-600);
}

.export-range-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
  padding: 16px;
  background: var(--gray-50);
  border-radius: var(--radius-md);
}

/* ============================================
   Student Detail Modal
   ============================================ */

.student-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 600px) {
  .student-detail-grid {
    grid-template-columns: 1fr;
  }

  /* v5.2.5: Mobile modal fixes - ensure modals are fully usable on small screens */
  .modal-backdrop {
    padding: 8px;
    align-items: flex-end; /* slide up from bottom on mobile for easier close reach */
  }

  .modal {
    height: auto;
    max-height: min(92vh, calc(100vh - 8px));
    max-height: min(92dvh, calc(100dvh - 8px));
    border-radius: var(--radius-modal) var(--radius-modal) 0 0;
    width: 100% !important;
    max-width: 100% !important;
  }

  .modal-header {
    padding: 16px;
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 2;
  }

  .modal-header h2 {
    font-size: 16px;
    margin: 0;
    padding-right: 8px;
    flex: 1;
    min-width: 0;
    word-break: break-word;
  }

  .modal-close {
    font-size: 22px;
    min-width: 44px;
    min-height: 44px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color);
  }

  [data-theme="dark"] .modal-close {
    background: rgba(255, 255, 255, 0.12);
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.25);
  }

  .modal-body {
    padding: 16px;
    flex: 0 1 auto;
    max-height: calc(100vh - 164px);
    max-height: calc(100dvh - 164px);
    -webkit-overflow-scrolling: touch;
  }

  .modal-footer {
    padding: 12px 16px;
    flex-wrap: wrap;
  }

  .modal-footer .btn {
    flex: 1;
    min-height: 44px;
    justify-content: center;
  }

  .export-options {
    flex-direction: column;
  }

  .export-range-fields {
    grid-template-columns: 1fr;
  }
}

.student-detail-section h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.detail-value {
  font-size: 14px;
  color: var(--text-primary);
  text-align: right;
}

.detail-value a {
  color: var(--hbgs-green-600);
  text-decoration: none;
}

.detail-value a:hover {
  text-decoration: underline;
}

/* Contacts Grid */
.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.contact-card {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 12px;
  border: 1px solid var(--border-color);
}

.contact-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.contact-relation {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.contact-phone {
  font-size: 13px;
}

.contact-phone a {
  color: var(--hbgs-green-600);
  text-decoration: none;
}

.contact-phone a:hover {
  text-decoration: underline;
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-toast); /* v4.7.2: Use z-index variable instead of 9999 */
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #1f2937;
  color: #ffffff !important;
  padding: 16px 24px;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px -5px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255,255,255,0.1);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toastSlideIn 0.3s ease;
  max-width: 400px;
  min-width: 280px;
  pointer-events: auto;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* v4.14.0: Fixed class name to match toast.js (was .toast.hiding, JS adds toast-hiding) */
.toast.toast-hiding {
  animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}

/* v4.14.0: Fixed class names to match toast.js (was .toast.success etc., JS adds toast-success) */
.toast.toast-success {
  background: #16a34a !important;
  border-left: 4px solid #22c55e;
}

.toast.toast-error {
  background: #dc2626 !important;
  border-left: 4px solid #ef4444;
}

.toast.toast-info {
  background: #2563eb !important;
  border-left: 4px solid #3b82f6;
}

.toast.toast-warning {
  background: #d97706 !important;
  border-left: 4px solid #f59e0b;
}

/* ============================================
   Import Modal
   ============================================ */

.import-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--bg-secondary);
}

.import-dropzone:hover,
.import-dropzone.dragover {
  border-color: var(--primary-color);
  background: rgba(22, 163, 74, 0.05);
}

.import-dropzone-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.import-dropzone-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.import-dropzone-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.import-preview {
  margin-top: 16px;
}

.import-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.import-preview-title {
  font-weight: 600;
  color: var(--text-primary);
}

.import-preview-count {
  font-size: 13px;
  color: var(--text-secondary);
}

.import-preview-table {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.import-preview-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.import-preview-table th,
.import-preview-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.import-preview-table th {
  background: var(--bg-tertiary);
  font-weight: 600;
  position: sticky;
  top: 0;
}

/* ============================================
   Student History Modal
   ============================================ */

.history-summary {
  padding: 16px 20px;
  background: var(--hbgs-green-50);
  border-radius: var(--radius-md);
  margin: 16px;
  font-weight: 600;
  color: var(--hbgs-green-800);
}

/* ============================================
   Dark Mode
   ============================================ */

[data-theme="dark"] .modal {
  background: var(--card-bg);
}

[data-theme="dark"] .modal-header {
  border-color: var(--border-color);
}

[data-theme="dark"] .modal-footer {
  border-color: var(--border-color);
}

[data-theme="dark"] .modal-close {
  color: var(--text-muted);
}

[data-theme="dark"] .modal-close:hover {
  color: var(--text-primary);
}

[data-theme="dark"] .export-range-fields {
  background: var(--bg-tertiary);
}

[data-theme="dark"] .history-summary {
  background: rgba(22, 163, 74, 0.15);
  color: #4ade80;
}

/* ============================================
   Staff Onboarding Tutorial (v5.0.5)
   ============================================ */

.staff-onboarding-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: staffOnboardFadeIn 0.3s ease;
}

.staff-onboarding-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 32px 28px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  animation: staffOnboardPopIn 0.4s ease;
}

.staff-onboarding-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.staff-onboarding-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.staff-onboarding-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}

.staff-onboarding-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 20px;
}

.staff-onboarding-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-color);
  transition: background 0.2s;
}

.staff-onboarding-dot.active {
  background: var(--primary);
}

.staff-onboarding-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.staff-onboarding-btn {
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.2s, opacity 0.2s;
}

.staff-onboarding-btn:hover {
  opacity: 0.85;
}

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

.staff-onboarding-btn.secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

@keyframes staffOnboardFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes staffOnboardPopIn {
  from { opacity: 0; transform: scale(0.9) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ===== kiosk.css ===== */
/* HBGS Design System v2.2 - Kiosk */

/* ============================================
   KIOSK STYLES
   ============================================ */

body.kiosk-body {
  background: linear-gradient(160deg, var(--hbgs-green-50) 0%, var(--hbgs-green-100) 50%, var(--hbgs-green-200) 100%);
  overflow: hidden;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  /* Safe area support for iPad */
  padding-top: env(safe-area-inset-top, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
}

/* Offline Banner */
.kiosk-offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 24px;
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: white;
  font-size: 18px;
  font-weight: 600;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.kiosk-offline-banner.visible {
  transform: translateY(0);
}

.kiosk-offline-banner.syncing {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.offline-icon {
  font-size: 24px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.offline-status-text {
  text-align: center;
}

.offline-pending-badge {
  display: none;
  background: white;
  color: #dc2626;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
}

.offline-pending-badge.visible {
  display: inline-block;
}

/* Offline confirmation banner variation */
.kiosk-confirm-banner.offline {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* Error banner variation */
.kiosk-confirm-banner.kiosk-error-banner {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.kiosk-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh; /* Dynamic viewport height for iOS Safari */
  min-height: 0; /* Prevent flex overflow */
}

.kiosk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(22, 101, 52, 0.1);
}

.kiosk-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.kiosk-logo {
  height: 48px;
  width: 48px;
  object-fit: contain;
}

.kiosk-brand-text {
  display: flex;
  flex-direction: column;
}

.kiosk-school-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--hbgs-green-900);
  letter-spacing: -0.02em;
}

.kiosk-school-sub {
  font-size: 13px;
  color: var(--hbgs-green-700);
  font-weight: 500;
}

.kiosk-header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.kiosk-clock {
  text-align: right;
}

.kiosk-clock-time {
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.kiosk-clock-date {
  font-size: 13px;
  color: var(--gray-500);
}

.kiosk-staff-btn {
  background: white;
  border: 2px solid var(--gray-200);
  color: var(--gray-700);
  padding: 12px 24px;
  min-height: 44px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.kiosk-staff-btn:active {
  background: var(--gray-50);
  transform: scale(0.98);
}

.kiosk-main {
  flex: 1;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  padding: 24px;
  overflow: hidden;
}

/* Sign-in Card */
.kiosk-signin-card {
  background: white;
  border-radius: 14px;
  padding: 40px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.kiosk-greeting {
  text-align: center;
  margin-bottom: 36px;
}

.kiosk-wave {
  font-size: 56px;
  margin-bottom: 12px;
}

.kiosk-title {
  font-size: 32px;
  font-weight: 800;
  color: var(--gray-900);
  margin: 0 0 8px 0;
  letter-spacing: -0.03em;
}

.kiosk-subtitle {
  font-size: 17px;
  color: var(--gray-500);
  margin: 0;
}

.kiosk-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex: 1;
}

.kiosk-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kiosk-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-700);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kiosk-label-num {
  background: var(--hbgs-green-600);
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.kiosk-select-wrapper {
  position: relative;
}

.kiosk-select {
  width: 100%;
  padding: 20px 60px 20px 20px;
  font-size: 19px;
  font-weight: 500;
  font-family: inherit;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
  color: var(--gray-900);
  cursor: pointer;
  transition: all 0.2s;
  appearance: none;
  -webkit-appearance: none;
  min-height: 44px;
  box-sizing: border-box;
}

.kiosk-select-wrapper::after {
  content: '';
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  pointer-events: none;
}

.kiosk-select:focus {
  outline: none;
  border-color: var(--hbgs-green-500);
  background: white;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
}

.kiosk-select:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.kiosk-signin-btn {
  margin-top: auto;
  padding: 22px 40px;
  font-size: 20px;
  font-weight: 700;
  font-family: inherit;
  color: white;
  background: var(--hbgs-green-600);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 8px 20px rgba(22, 163, 74, 0.35);
  min-height: 44px;
}

.kiosk-signin-btn:active:not(:disabled) {
  transform: scale(0.98);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.35);
}

.kiosk-signin-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

/* Bathroom Kiosk Button Modes */
.kiosk-btn-signin-mode {
  background: var(--hbgs-green-600);
  box-shadow: 0 8px 20px rgba(22, 163, 74, 0.35);
}

.kiosk-btn-signout-mode {
  background: #ea580c;
  box-shadow: 0 8px 20px rgba(234, 88, 12, 0.35);
}

.kiosk-warning {
  background: #fef3c7 !important;
  border-left: 4px solid #f59e0b;
}

.kiosk-warning .kiosk-recent-meta {
  color: #92400e;
}

.kiosk-help {
  text-align: center;
  font-size: 14px;
  color: var(--gray-400);
  margin-top: 16px;
}

/* Recent Card */
.kiosk-recent-card {
  background: white;
  border-radius: 14px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  min-height: 0; /* v5.2.0: Allow flex shrink for scrollable list */
  overflow: hidden; /* v5.2.0: Clip to card bounds */
}

.kiosk-recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--gray-100);
}

.kiosk-recent-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
}

.kiosk-recent-count {
  background: var(--hbgs-green-100);
  color: var(--hbgs-green-800);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.kiosk-recent-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
  min-height: 0; /* v5.2.0: Allow scroll within flex container */
}

/* Compatibility with old kiosk JS */
.kiosk-recent-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  gap: 14px;
}

.kiosk-recent-item:active {
  background: var(--gray-200);
  transform: scale(0.98);
}

.kiosk-recent-item.kiosk-bus {
  background: var(--bus-bg);
}

.kiosk-recent-main {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-900);
  flex: 1;
}

.kiosk-recent-meta {
  font-size: 13px;
  color: var(--gray-500);
}

.kiosk-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  font-size: 16px;
  gap: 8px;
  padding: 40px 20px;
}

/* Success Banner */
.kiosk-confirm-banner {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: kioskFadeIn 0.3s ease-out;
}

.kiosk-confirm-banner.hidden {
  display: none;
}

@keyframes kioskFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.kiosk-confirm-content {
  text-align: center;
  animation: kioskPopIn 0.4s ease-out;
}

@keyframes kioskPopIn {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.kiosk-confirm-icon {
  font-size: 80px;
  margin-bottom: 20px;
}

.kiosk-confirm-title {
  font-size: 36px;
  font-weight: 800;
  color: var(--hbgs-green-800);
  margin: 0 0 12px 0;
}

.kiosk-confirm-text {
  font-size: 20px;
  color: var(--hbgs-green-700);
}

/* v5.2.1: Tap hint on "In Restroom" list items */
.kiosk-tap-hint {
  font-size: 12px;
  color: var(--gray-400);
  white-space: nowrap;
  padding-left: 8px;
  transition: color 0.15s;
}
.kiosk-recent-item:active .kiosk-tap-hint {
  color: var(--gray-600);
}

/* v5.2.1: Sign-out confirmation dialog (bathroom kiosk) */
.kiosk-confirm-dialog {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: kioskFadeIn 0.2s ease-out;
}
.kiosk-confirm-dialog.hidden {
  display: none;
}
.kiosk-dialog-card {
  background: white;
  border-radius: 16px;
  padding: 32px;
  width: 90%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: kioskPopIn 0.3s ease-out;
}
.kiosk-dialog-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--hbgs-green-100, #dcfce7);
  color: var(--hbgs-green-700, #15803d);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  margin: 0 auto 16px;
}
.kiosk-dialog-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 8px;
}
.kiosk-dialog-text {
  font-size: 15px;
  color: var(--gray-500);
  margin: 0 0 24px;
}
.kiosk-dialog-actions {
  display: flex;
  gap: 12px;
}
.kiosk-dialog-btn {
  flex: 1;
  padding: 14px 20px;
  border-radius: 10px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  transition: transform 0.1s, opacity 0.1s;
}
.kiosk-dialog-btn:active {
  transform: scale(0.96);
  opacity: 0.85;
}
.kiosk-dialog-cancel {
  background: var(--gray-100);
  color: var(--gray-700);
}
.kiosk-dialog-confirm {
  background: var(--hbgs-green-600, #16a34a);
  color: white;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}
.kiosk-dialog-hint {
  font-size: 12px;
  color: var(--gray-400);
  margin: 16px 0 0;
}

/* v5.3.0: Kiosk Switcher */
.kiosk-switcher {
  position: relative;
}

.kiosk-switcher-btn {
  background: white;
  border: 2px solid var(--gray-200);
  color: var(--gray-600);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  padding: 0;
}

.kiosk-switcher-btn:active {
  background: var(--gray-50);
  transform: scale(0.95);
}

.kiosk-switcher-btn.open {
  background: var(--hbgs-green-50);
  border-color: var(--hbgs-green-300);
  color: var(--hbgs-green-700);
}

.kiosk-switcher-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kiosk-switcher-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05);
  min-width: 240px;
  z-index: 500;
  overflow: hidden;
  animation: kioskMenuIn 0.15s ease-out;
}

.kiosk-switcher-menu.open {
  display: block;
}

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

.kiosk-switcher-label {
  padding: 12px 16px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-400);
}

.kiosk-switcher-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 500;
  color: var(--gray-800);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.1s;
}

.kiosk-switcher-item:last-child {
  margin-bottom: 6px;
}

.kiosk-switcher-item:active {
  background: var(--gray-100);
}

.kiosk-switcher-item.active {
  color: var(--hbgs-green-700);
  font-weight: 600;
  background: var(--hbgs-green-50);
  cursor: default;
}

.kiosk-switcher-icon {
  font-size: 20px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.kiosk-switcher-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 499;
}

.kiosk-switcher-overlay.open {
  display: block;
}

/* Kiosk Portrait Mode */
@media (orientation: portrait) {
  .kiosk-main {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    gap: 20px;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .kiosk-signin-card {
    padding: 32px;
  }

  .kiosk-recent-card {
    max-height: 260px;
  }

  .kiosk-greeting {
    margin-bottom: 28px;
  }

  .kiosk-wave { font-size: 44px; }
  .kiosk-title { font-size: 26px; }

  .kiosk-clock { display: none; }
}

/* iPad Portrait - larger touch targets and better spacing */
@media (min-width: 768px) and (orientation: portrait) {
  .kiosk-main {
    padding: 24px;
    gap: 24px;
  }

  .kiosk-signin-card {
    padding: 40px;
  }

  .kiosk-recent-card {
    max-height: 320px;
    padding: 32px;
  }

  .kiosk-select {
    padding: 22px 60px 22px 22px;
    font-size: 20px;
  }

  .kiosk-signin-btn {
    padding: 24px 40px;
    font-size: 22px;
  }

  .kiosk-wave { font-size: 56px; }
  .kiosk-title { font-size: 32px; }
  .kiosk-subtitle { font-size: 18px; }
}

/* iPad Landscape - optimized two-column layout */
@media (min-width: 768px) and (orientation: landscape) {
  .kiosk-main {
    padding: 28px;
    gap: 28px;
  }

  .kiosk-signin-card {
    padding: 36px;
  }

  .kiosk-recent-card {
    padding: 28px;
  }

  .kiosk-select {
    padding: 20px 60px 20px 20px;
    font-size: 19px;
  }
}

/* iPad Pro 12.9" and larger screens */
@media (min-width: 1024px) {
  .kiosk-main {
    padding: 32px;
    gap: 32px;
  }

  .kiosk-signin-card {
    padding: 44px;
  }

  .kiosk-recent-list {
    gap: 12px;
  }

  .kiosk-recent-item {
    padding: 16px 18px;
  }
}

/* v5.2.0: Override responsive.css position:fixed on body for kiosk pages */
@media (max-width: 768px) {
  body.kiosk-body {
    position: static !important;
    width: auto !important;
    height: 100%;
    height: 100dvh;
  }
}

/* Phone - small screens */
@media (max-width: 600px) {
  .kiosk-header {
    padding: 12px 16px;
  }

  .kiosk-logo {
    height: 36px;
    width: 36px;
  }

  .kiosk-school-name {
    font-size: 14px;
  }

  .kiosk-school-sub {
    font-size: 11px;
  }

  .kiosk-staff-btn {
    padding: 10px 14px;
    font-size: 13px;
  }

  .kiosk-main {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .kiosk-signin-card {
    padding: 20px;
  }

  .kiosk-greeting {
    margin-bottom: 16px;
  }

  .kiosk-wave {
    font-size: 36px;
    margin-bottom: 8px;
  }

  .kiosk-title {
    font-size: 22px;
  }

  .kiosk-subtitle {
    font-size: 14px;
  }

  .kiosk-form {
    gap: 16px;
  }

  .kiosk-select {
    padding: 14px 44px 14px 14px;
    font-size: 16px;
  }

  .kiosk-select-wrapper::after {
    right: 14px;
    width: 20px;
    height: 20px;
  }

  .kiosk-signin-btn {
    padding: 16px 24px;
    font-size: 17px;
  }

  .kiosk-recent-card {
    padding: 16px;
    max-height: 220px;
  }

  .kiosk-recent-header {
    margin-bottom: 12px;
    padding-bottom: 10px;
  }

  .kiosk-recent-title {
    font-size: 15px;
  }

  .kiosk-recent-main {
    font-size: 14px;
  }

  .kiosk-recent-meta {
    font-size: 12px;
  }

  .kiosk-recent-item {
    padding: 10px 12px;
    gap: 10px;
  }

  .kiosk-clock {
    display: none;
  }

  .kiosk-confirm-icon {
    font-size: 56px;
  }

  .kiosk-confirm-title {
    font-size: 24px;
  }

  .kiosk-confirm-text {
    font-size: 16px;
  }

  .kiosk-empty {
    padding: 20px 12px;
    font-size: 14px;
  }
}

/* ===== responsive.css ===== */
/* HBGS Design System v2.3 - Responsive (Mobile Optimized) */

/* ============================================
   RESPONSIVE - 768px and below
   ============================================ */

@media (max-width: 768px), (max-height: 500px) and (hover: none) and (pointer: coarse) {
  /* Match notes app fixed body approach - use dvh for dynamic viewport */
  html {
    height: 100%;
    height: var(--app-height, 100dvh);
    overflow: hidden;
    /* Prevent iOS swipe-back navigation gesture in PWA */
    overscroll-behavior-x: none;
    touch-action: pan-y;
  }

  body {
    height: 100%;
    height: var(--app-height, 100dvh);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
    /* Prevent iOS swipe-back navigation gesture in PWA */
    overscroll-behavior-x: none;
    touch-action: pan-y;
  }

  .app-layout {
    top: 0;
    right: auto;
    bottom: auto;
    left: 0;
    width: 100%;
    height: var(--app-height, 100dvh);
  }

  .app-layout, .main-wrapper {
    height: 100%;
    height: var(--app-height, 100dvh);
    overflow: hidden;
    overscroll-behavior-x: none;
    touch-action: pan-y;
    min-width: 0;
  }

  .main-content {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
    flex: 1;
    overscroll-behavior-x: none;
    touch-action: pan-y;
  }

  /* v4.7.1: Dashboard stats grid - 2 columns on mobile */
  .dash-stats-modern {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
  }

  /* Cards should fit within screen */
  .card {
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .card-header, .card-controls, .card-actions, .card-footer {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Sidebar - slide in from the More button edge on mobile */
  /* v4.14.0: Use CSS variable z-index so modals/toasts layer above sidebar */
  .sidebar {
    position: fixed;
    z-index: var(--z-sidebar);
    left: auto;
    right: 0;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    width: 280px;
    max-width: 85vw;
  }

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

  /* Mobile overlay when sidebar is open */
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    z-index: calc(var(--z-sidebar) - 1);
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .sidebar-overlay.open {
    display: block;
    opacity: 1;
  }

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

  /* Top Header */
  .top-header {
    padding: 0 12px;
    height: 56px;
    min-height: 56px;
    gap: 8px;
  }

  .page-title {
    font-size: 17px;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .page-title-section {
    gap: 8px;
    flex: 1;
    min-width: 0;
  }

  .header-actions {
    gap: 8px;
    flex-shrink: 0;
  }

  /* Hide user name on small screens, just show avatar */
  .header-user-name {
    display: none;
  }

  .header-user-caret {
    display: none;
  }

  .header-user-btn {
    padding: 4px;
  }

  .header-dropdown-menu {
    top: calc(56px + env(safe-area-inset-top, 0px) + 8px);
    left: 12px;
    right: 12px;
    min-width: 0;
    width: auto;
    max-width: none;
     max-height: calc(var(--app-height, 100dvh) - 56px - var(--bottom-nav-height) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 16px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  /* Mobile menu button - larger touch target */
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    margin-right: 8px;
    border-radius: 8px;
    transition: background 0.2s;
  }

  .mobile-menu-btn:active {
    background: var(--bg-tertiary);
  }

  .main-content {
    padding: 12px;
  }


  .main-content > * {
    min-width: 0;
    max-width: 100%;
  }

  .page-header,
  .page-header-actions,
  .card,
  .card-header,
  .card-body,
  .card-actions,
  .card-header-actions,
  .card-controls,
  .card-controls-filters,
  .view-as-banner {
    min-width: 0;
  }

  .page-header-actions,
  .card-actions,
  .card-header-actions {
    width: 100%;
  }

  .page-header-actions .btn,
  .card-actions .btn,
  .card-header-actions .btn {
    flex: 1 1 160px;
    min-width: 0;
  }

  /* Card headers */
  .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px;
  }

  /* v4.7.2: Show card titles on mobile but compact — hiding them removed context */
  .card-title {
    font-size: 14px;
    margin-bottom: 8px;
  }

  /* Compact actions row for mobile */
  .actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .actions-row input[type="text"] {
    grid-column: 1 / -1;
  }

  .actions-row input[type="date"] {
    grid-column: 1 / -1;
  }

  .actions-row select {
    grid-column: 1;
  }

  .actions-row .btn-outline {
    grid-column: 2;
  }

  .actions-row .btn-primary {
    grid-column: 1 / -1;
  }

  /* Notification panel mobile - full width dropdown */
  .notification-panel,
  .notification-menu {
    position: fixed;
    top: calc(56px + env(safe-area-inset-top, 0px));
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    max-height: calc(var(--app-height, 100vh) - 80px - env(safe-area-inset-top, 0px));
    border-radius: var(--radius-lg);
    z-index: calc(var(--z-sidebar) + 1);
  }

  /* Show close button only on mobile */
  .notification-close-btn {
    display: flex !important;
  }

  .notification-list {
    max-height: calc(var(--app-height, 100vh) - 160px - env(safe-area-inset-top, 0px));
  }

  .notification-item {
    padding: 14px 16px;
    position: relative;
  }

  .notification-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 18px;
  }

  .notification-content {
    min-width: 0;
    flex: 1;
  }

  .notification-text {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    word-wrap: break-word;
  }

  .notification-desc {
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-secondary);
    word-wrap: break-word;
  }

  .notification-time {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
  }

  /* Table responsive */
  .data-table th,
  .data-table td {
    padding: 10px 8px;
    font-size: 13px;
  }

  /* Tighter time column */
  .data-table th:first-child,
  .data-table td:first-child {
    width: 65px;
    white-space: nowrap;
  }

  /* Hide less important columns on mobile */
  .data-table .hide-mobile {
    display: none;
  }

  /* Avatar cell compact */
  .avatar-cell {
    gap: 8px;
  }

  .avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 12px;
  }

  .avatar-info-name {
    font-size: 14px;
  }

  .avatar-info-sub {
    font-size: 12px;
  }

  /* Actions dropdown */
  .actions-menu {
    right: auto;
    left: 0;
  }

  /* Card controls responsive - stack all elements */
  .card-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
  }

  .card-controls input[type="text"] {
    width: 100%;
  }

  .card-controls input[type="date"] {
    width: 100%;
  }

  /* Filters row - wrap nicely */
  .card-controls-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .card-controls select {
    width: 100%;
    min-width: 0;
  }

  .card-controls .btn-primary {
    width: 100%;
  }

  .card-body {
    padding: 16px 14px;
  }

  .view-as-banner {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 12px;
    text-align: center;
  }

  /* Modal layout on mobile */
  .modal-backdrop {
    padding: 8px;
    align-items: flex-end;
  }

  .modal-backdrop.modal-backdrop-full {
    padding: 0;
    align-items: stretch;
  }

  .modal {
    max-width: 100% !important;
    width: 100% !important;
    max-height: calc(100vh - 8px) !important;
    max-height: calc(100dvh - 8px) !important;
    border-radius: 18px 18px 0 0;
    height: auto;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .modal.modal-mobile-full {
    max-height: 100% !important;
    height: 100%;
    border-radius: 0;
    padding-bottom: 0;
  }

  .modal-backdrop.modal-backdrop-full .modal.modal-mobile-full {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
  }

  .modal.modal-mobile-full .modal-body {
    flex: 1;
    min-height: 0;
    max-height: none;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .modal-header {
    padding-top: calc(12px + env(safe-area-inset-top, 0));
    flex-shrink: 0;
  }

  .modal-lg {
    max-width: 100%;
  }

  .modal-xl {
    max-width: 100% !important;
  }

  .modal-body {
    flex: 0 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: calc(100vh - 164px);
    max-height: calc(100dvh - 164px);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  /* Form inputs larger touch targets */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="number"],
  input[type="date"],
  input[type="time"],
  textarea,
  select {
    padding: 12px 14px;
    font-size: 16px; /* Prevents iOS zoom */
    min-height: 44px;
  }

  /* Buttons larger touch targets */
  .btn {
    padding: 12px 16px;
    min-height: 44px;
    font-size: 14px;
  }

  .btn-sm {
    padding: 10px 14px;
    min-height: 40px;
  }

  /* Icon buttons - ensure 44px touch target */
  .icon-btn {
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
  }

  /* Card footer */
  .card-footer {
    padding: 12px 14px;
    font-size: 13px;
  }

  /* Empty states */
  .empty-state {
    padding: 32px 16px;
  }

  .empty-state-icon {
    width: 64px;
    height: 64px;
    font-size: 28px;
  }

  /* Export modal */
  .export-options {
    flex-direction: column;
    gap: 12px;
  }

  .export-range-fields {
    grid-template-columns: 1fr;
  }

  /* Page title */
  .page-title {
    font-size: 18px;
  }

  /* Search row in modals */
  .search-row input {
    font-size: 16px;
  }

  /* Toasts stay above the fixed bottom navigation and own the safe-area offset once. */
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: calc(var(--bottom-nav-height) + var(--space-2) + env(safe-area-inset-bottom, 0px));
  }

  .toast {
    max-width: 100%;
    font-size: 14px;
    padding: 14px 16px;
  }

  /* History modal */
  .history-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .history-stat {
    padding: 10px 8px;
  }

  .history-stat-value {
    font-size: 20px;
  }

  .history-stat-label {
    font-size: 10px;
  }

  /* Hide stats card on mobile to save space */
  .card-grid {
    grid-template-columns: 1fr;
  }

  .stats-card {
    display: none;
  }

  /* Date navigation - mobile optimized */
  .date-nav,
  .att-date-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
  }

  .date-nav input[type="date"],
  .att-date-nav input[type="date"] {
    flex: 1;
    min-width: 130px;
  }

  .date-nav .btn-ghost,
  .att-date-nav .btn-ghost {
    min-width: 44px;
    width: 44px;
    padding: 0;
    justify-content: center;
  }

  /* Filter bars - mobile layout */
  .filter-bar,
  .att-filter-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
  }

  .filter-bar select,
  .att-filter-row select,
  .filter-bar input,
  .att-filter-row input {
    width: 100%;
  }

  /* Stats grids */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .stat-box {
    padding: 12px 10px;
  }

  .stat-value {
    font-size: 22px;
  }

  .stat-label {
    font-size: 11px;
  }

  /* Cards on mobile */
  .card {
    border-radius: 12px;
    margin-bottom: 12px;
  }

  /* Form groups */
  .form-group {
    margin-bottom: 16px;
  }

  .form-label {
    font-size: 13px;
    margin-bottom: 6px;
  }

  .form-row {
    flex-direction: column;
    gap: 16px;
  }

  .form-row > * {
    width: 100%;
  }

  /* Autocomplete dropdowns */
  .autocomplete-dropdown,
  .autocomplete-results {
    max-height: 200px;
  }

  .autocomplete-item {
    padding: 12px 14px;
    min-height: 44px;
  }
}

/* Extra small screens - 480px and below */
@media (max-width: 480px) {
  .top-header {
    padding: 0 10px;
    height: 52px;
    min-height: 52px;
  }

  .main-content {
    padding: 10px;
  }

  .card {
    border-radius: 10px;
  }

  .card-header {
    padding: 12px;
  }

  .card-title {
    font-size: 14px;
  }

  .card-subtitle {
    font-size: 12px;
    display: none;
  }

  /* Even more compact controls */
  .card-controls {
    gap: 6px;
    padding: 10px 12px;
  }

  .card-controls input[type="text"],
  .card-controls input[type="date"],
  .card-controls select {
    padding: 10px 12px;
    font-size: 16px; /* Keep 16px to prevent iOS zoom */
    min-height: 42px;
  }

  .card-controls .btn {
    padding: 10px 12px;
    font-size: 14px;
    min-height: 42px;
  }

  /* Table cells compact */
  .data-table th:first-child,
  .data-table td:first-child {
    padding-left: 10px;
    width: 55px;
  }

  .data-table th:last-child,
  .data-table td:last-child {
    padding-right: 10px;
  }

  /* Avatars - slightly smaller but keep recognizable */
  .avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 11px;
  }

  .avatar-info-name {
    font-size: 13px;
  }

  .avatar-info-sub {
    font-size: 11px;
  }

  /* Action buttons - keep touch friendly */
  .action-btns {
    gap: 4px;
  }

  .action-btns .btn-sm {
    padding: 8px 10px;
    min-height: 38px;
    font-size: 13px;
  }

  /* Staff name cell mobile */
  .staff-name-cell {
    gap: 8px;
  }

  .staff-name {
    font-size: 13px;
  }

  .staff-email {
    font-size: 11px;
  }

  /* Hide department column on small screens */
  .staff-table th:nth-child(3),
  .staff-table td:nth-child(3) {
    display: none;
  }

  /* v4.14.0: Icon buttons - keep 44px touch target (was regressed to 40px) */
  .icon-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }

  /* Page title smaller */
  .page-title {
    font-size: 16px;
  }

  /* Stats compact */
  .stats-grid {
    gap: 6px;
  }

  .stat-box {
    padding: 10px 8px;
  }

  .stat-value {
    font-size: 20px;
  }

  .stat-label {
    font-size: 10px;
  }

  /* Modal improvements */
  .modal-header {
    padding: 14px;
  }

  .modal-title {
    font-size: 16px;
  }

  .modal-body {
    padding: 14px;
  }

  .modal-footer {
    padding: 12px 14px;
    gap: 8px;
  }

  .modal-footer .btn {
    flex: 1;
    justify-content: center;
  }

  /* Tabs - scrollable on very small screens */
  .tabs,
  .tab-nav,
  .tabs-row {
    gap: 4px;
    padding: 4px;
  }

  .tab,
  .tab-btn {
    padding: 10px 12px;
    font-size: 13px;
  }

  /* Date navigation compact */
  .date-nav .btn-secondary,
  .att-date-nav .btn-secondary {
    font-size: 12px;
    padding: 8px 12px;
  }

  .header-dropdown-menu {
    left: 10px;
    right: 10px;
  }
}

/* Very small screens - 380px and below */
@media (max-width: 380px) {
  .main-content {
    padding: 8px;
  }

  .card-header {
    padding: 10px;
  }

  .card-controls {
    padding: 8px 10px;
  }

  /* Stack filter columns */
  .card-controls-filters {
    grid-template-columns: 1fr;
  }

  /* Stats single column */
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-box {
    flex-direction: row;
    justify-content: space-between;
    padding: 10px 12px;
  }

  /* Modal footer buttons stack */
  .modal-footer {
    flex-direction: column;
  }

  .modal-footer .btn {
    width: 100%;
  }
}

/* Tablet screens - 481px to 768px */
@media (min-width: 481px) and (max-width: 768px) {
  .staff-name-cell {
    gap: 10px;
  }

  .staff-name {
    font-size: 14px;
  }

  .staff-email {
    font-size: 12px;
  }

  /* Card title visible on tablets */
  .card-title {
    display: block;
  }

  /* Better stats grid on tablets */
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Modal not full screen on tablets */
  .modal-backdrop {
    padding: 20px;
    align-items: center;
  }

  .modal {
    max-width: 600px;
    max-height: 90vh;
    height: auto;
    border-radius: 16px;
  }
}

/* ============================================
   Additional Mobile Enhancements
   ============================================ */

@media (max-width: 768px), (max-height: 500px) and (hover: none) and (pointer: coarse) {
  /* Tables - horizontal scroll */
  .table-wrapper,
  .data-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -14px;
    padding: 0 14px;
  }

  .data-table {
    min-width: 500px;
    width: max-content;
    max-width: none;
  }

  /* Request cards (copies, tech support, supplies) */
  .request-card,
  .copy-card,
  .tech-card,
  .supply-card {
    padding: 14px;
  }

  .request-card-header,
  .copy-card-header,
  .tech-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .request-card-title {
    font-size: 14px;
  }

  .request-card-meta {
    font-size: 12px;
  }

  .request-card-actions {
    width: 100%;
    justify-content: flex-end;
  }

  /* Modals - improved sticky headers and footers */
  .modal {
    margin: 0;
    max-height: calc(100vh - 8px);
    max-height: calc(100dvh - 8px);
    height: auto;
    border-radius: 18px 18px 0 0;
    display: flex;
    flex-direction: column;
  }

  .modal-header {
    padding: 14px 16px;
    padding-top: calc(14px + env(safe-area-inset-top, 0px));
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 10;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
  }

  .modal-title {
    font-size: 17px;
  }

  .modal-body {
    padding: 16px;
    overflow-y: auto;
    flex: 0 1 auto;
    max-height: calc(100vh - 164px);
    max-height: calc(100dvh - 164px);
    -webkit-overflow-scrolling: touch;
  }

  .modal-footer {
    padding: 14px 16px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    position: sticky;
    bottom: 0;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    gap: 8px;
    flex-shrink: 0;
  }

  .modal-footer .btn {
    flex: 1;
  }

  .modal-backdrop.modal-backdrop-full {
    padding: 0;
    align-items: stretch;
  }

  .modal.modal-mobile-full {
    max-height: 100% !important;
    height: 100%;
    border-radius: 0;
    padding-bottom: 0;
  }

  .modal.modal-mobile-full .modal-body {
    flex: 1;
    min-height: 0;
    max-height: none;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .modal-backdrop.modal-backdrop-full .modal.modal-mobile-full {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
  }

  /* Student profile modal */
  .student-detail-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
  }

  .student-detail-avatar {
    width: 64px;
    height: 64px;
    font-size: 24px;
  }

  .student-detail-grid {
    grid-template-columns: 1fr;
  }

  /* Contacts grid */
  .contacts-grid {
    grid-template-columns: 1fr;
  }

  .contact-card {
    padding: 12px;
  }

  /* Badge and status pills - touch friendly */
  .badge,
  .status-badge {
    font-size: 11px;
    padding: 4px 10px;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
  }

  /* Tabs - wrap on mobile instead of horizontal scroll */
  .tab-nav,
  .tabs,
  .tabs-row,
  .att-tabs,
  .call-log-tabs {
    overflow-x: visible;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0;
    padding: 4px;
  }

  .tab-btn,
  .tab,
  .att-tab,
  .call-tab {
    flex: 0 1 auto;
    white-space: nowrap;
    padding: 8px 12px;
    font-size: 12px;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* For tabs with icons, hide text on small screens */
  .tab-btn .tab-text,
  .tab .tab-text {
    display: none;
  }

  /* Search and filter row */
  .search-row,
  .filter-row {
    flex-direction: column;
    gap: 10px;
  }

  .search-row input,
  .filter-row input,
  .search-row select,
  .filter-row select {
    width: 100%;
  }

  /* Pagination */
  .pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }

  .pagination-btn {
    padding: 10px 14px;
    font-size: 14px;
    min-height: 44px;
  }

  /* Empty states */
  .empty-state,
  .data-empty {
    padding: 32px 20px;
  }

  .empty-state-icon {
    font-size: 40px;
  }

  .empty-state-title {
    font-size: 16px;
  }

  .empty-state-text {
    font-size: 13px;
  }

  /* Action dropdowns */
  .action-dropdown,
  .dropdown-menu {
    min-width: 160px;
  }

  .dropdown-item {
    padding: 12px 16px;
    font-size: 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Universal Search */
  .universal-search-modal {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: 100%;
    border-radius: 0;
    padding-top: calc(56px + env(safe-area-inset-top, 0px)); /* Below header instead of 10vh */
  }

  .universal-search-container {
    max-width: 100%;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .universal-search-input {
    font-size: 16px;
    padding: 14px 16px;
  }

  /* Hide ESC hint on touch devices */
  .universal-search-kbd {
    display: none;
  }

  /* Phone links - make tappable */
  a[href^="tel:"] {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    min-height: 40px;
  }

  a[href^="tel:"]:active {
    opacity: 0.8;
  }
}

/* ============================================
   TOUCH FEEDBACK
   ============================================ */
@media (hover: none) and (pointer: coarse) {
  /* Touch device specific styles */

  .btn:active,
  .nav-item:active,
  .tab:active,
  .tab-btn:active {
    transform: scale(0.98);
    opacity: 0.9;
  }

  /* Increase touch targets */
  .nav-item {
    min-height: 48px;
    padding: 12px 16px;
  }

  /* Remove hover effects on touch */
  .btn:hover {
    transform: none;
  }

  /* Edit buttons always visible on touch */
  .call-edit-btn,
  .edit-btn,
  [class*="edit-btn"] {
    opacity: 1 !important;
  }
}

/* ============================================
   SAFE AREA INSETS (iPhone X+)
   ============================================ */
@supports (padding-top: env(safe-area-inset-top)) {
  .top-header {
    padding-top: env(safe-area-inset-top);
    height: calc(56px + env(safe-area-inset-top));
  }
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .toast-container {
    bottom: calc(var(--bottom-nav-height) + var(--space-2) + env(safe-area-inset-bottom));
  }
}

/* ============================================
   LANDSCAPE MOBILE
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
  .modal {
    max-height: 100vh;
  }

  .modal-body {
    max-height: calc(100vh - 120px);
  }

  /* Compact stats in landscape */
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .stat-box {
    padding: 8px;
  }

  .stat-value {
    font-size: 18px;
  }
}

/* ============================================
   MOBILE CARD FIXES - 480px and below
   ============================================ */
@media (max-width: 480px) {

  /* Generic mobile card label/value pairs */
  /* Ensure values wrap and don't overflow */
  [data-label] {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    gap: 12px;
    width: 100%;
    min-width: 0;
  }

  [data-label]::before {
    content: attr(data-label);
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    flex-shrink: 0;
    min-width: 80px;
  }

  /* Values should wrap */
  [data-label] > *,
  [data-label]::after {
    text-align: right;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  /* Dense tables become readable label/value cards on phones.
     JS adds .mobile-card-table plus data-label attributes from the table headers. */
  .table-responsive:has(table.mobile-card-table),
  .data-table-wrapper:has(table.mobile-card-table),
  .parent-reports-table:has(table.mobile-card-table) {
    overflow-x: visible !important;
  }

  table.mobile-card-table {
    display: block;
    width: 100%;
    min-width: 0 !important;
    border-collapse: separate;
    border-spacing: 0;
  }

  table.mobile-card-table thead {
    display: none;
  }

  table.mobile-card-table tbody {
    display: grid;
    gap: 10px;
  }

  table.mobile-card-table tr {
    display: grid;
    gap: 0;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--card-bg, var(--bg-primary));
    box-shadow: var(--shadow-sm);
  }

  table.mobile-card-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    width: 100% !important;
    min-width: 0 !important;
    padding: 8px 0 !important;
    border-bottom: 1px solid var(--gray-100);
    white-space: normal !important;
    text-align: right;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  table.mobile-card-table td:last-child {
    border-bottom: 0;
  }

  table.mobile-card-table td::before {
    content: attr(data-label);
    min-width: 92px;
    max-width: 42%;
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.35;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }

  table.mobile-card-table td:empty,
  table.mobile-card-table td[data-label=""] {
    display: none;
  }

  /* Student Directory - fix filter buttons */
  .student-directory-header {
    flex-direction: column !important;
    gap: 12px;
  }

  .student-directory-header .btn {
    width: 100%;
  }

  .student-filter-row {
    flex-wrap: wrap;
  }

  .student-filter-row select,
  .student-filter-row input {
    flex: 1;
    min-width: 120px;
  }

  /* Staff Directory - fix buttons */
  .staff-header-actions {
    flex-direction: column !important;
    width: 100%;
  }

  .staff-header-actions .btn {
    width: 100%;
  }

  /* Early Dismissal - fix truncation */
  #dismissalsTable td {
    flex-wrap: wrap;
  }

  #dismissalsTable td:not(:first-child):not(:last-child) {
    word-break: break-word;
  }

  /* v4.14.0: Dismissal note - reduce max-width on mobile */
  .dismissal-note {
    max-width: 180px;
  }

  /* Attendance cards - ensure proper wrapping */
  .att-list-item {
    overflow: visible !important;
  }

  .att-list-item > div {
    word-break: break-word;
    overflow-wrap: break-word;
  }

  /* Website Unblock - reduce card padding */
  .unblock-card {
    padding-bottom: 12px !important;
  }

  /* Trips/Incentives Mobile Styles */
  .trips-tabs {
    flex-wrap: wrap;
    gap: 4px;
    padding-bottom: 8px;
  }

  .trips-tab {
    padding: 8px 12px;
    font-size: 13px;
    flex: 1;
    text-align: center;
    min-width: 80px;
  }

  .trips-grid {
    grid-template-columns: 1fr !important;
  }

  .trip-card-header {
    padding: 12px;
  }

  .trip-card-title {
    font-size: 16px;
  }

  .trip-card-body {
    padding: 12px;
  }

  .trip-card-stats {
    gap: 8px;
  }

  .trip-stat-value {
    font-size: 18px;
  }

  .eligibility-summary {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }

  .eligibility-stat {
    padding: 12px 8px;
  }

  .eligibility-stat-value {
    font-size: 22px;
  }

  .eligibility-stat-label {
    font-size: 10px;
  }

  .eligibility-tabs {
    gap: 4px;
  }

  .eligibility-tab {
    padding: 6px 10px;
    font-size: 11px;
    flex: 1;
    text-align: center;
    min-width: 0;
  }

  .student-list {
    max-height: none !important;
  }

  .student-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
  }

  .student-info {
    width: 100%;
  }

  .student-meta {
    gap: 8px;
  }

  .student-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .student-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .criteria-form {
    grid-template-columns: 1fr !important;
  }

  .criteria-group {
    padding: 12px;
  }

  .quick-check {
    padding: 14px;
  }

  .quick-check h3 {
    font-size: 16px;
  }

  .athletics-card {
    padding: 14px;
  }

  .athletics-stats {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }

  .athletics-stat {
    padding: 10px 8px;
  }

  .athletics-stat-value {
    font-size: 20px;
  }

  .reward-tiers {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
  }

  .reward-tier {
    padding: 14px 10px;
  }

  .reward-tier-icon {
    font-size: 28px;
  }

  .reward-tier-name {
    font-size: 14px;
  }

  .reward-tier-req {
    font-size: 11px;
  }

  .reward-tier-count {
    font-size: 20px;
  }

  /* Student & Staff Profile Mobile Styles */
  .profile-header {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }

  .profile-avatar {
    width: 72px !important;
    height: 72px !important;
    font-size: 28px !important;
  }

  .profile-name {
    font-size: 18px !important;
  }

  .profile-stats-row {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .profile-stat {
    padding: 10px 8px !important;
  }

  .profile-stat-value {
    font-size: 20px !important;
  }

  .profile-stat-label {
    font-size: 10px !important;
  }

  .profile-section {
    margin-bottom: 12px !important;
  }

  .profile-section-header {
    padding: 10px 12px !important;
  }

  .profile-section-title {
    font-size: 13px !important;
  }

  .profile-section-content {
    padding: 12px !important;
  }

  /* Student profile achievements - flex wrapping pills with icon + label */
  .profile-achievements-badges {
    gap: 6px !important;
  }

  .profile-achievement-badge {
    padding: 5px 10px !important;
    font-size: 0.75rem !important;
    gap: 4px !important;
  }

  .achievement-icon {
    font-size: 0.85rem !important;
    flex-shrink: 0;
  }

  .achievement-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
  }

  /* Contact cards in profiles */
  .contact-card {
    padding: 10px !important;
  }

  .contact-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .contact-card-name {
    font-size: 14px !important;
  }

  .contact-card-relation {
    font-size: 11px !important;
  }

  .contact-card-info {
    gap: 6px !important;
  }

  .contact-phone,
  .contact-email {
    font-size: 13px !important;
    padding: 6px 10px !important;
  }

  /* Grades grid in profile */
  .grades-grid {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }

  .grade-item {
    padding: 8px 10px !important;
  }

  /* Staff profile schedule */
  .schedule-grid {
    grid-template-columns: 1fr !important;
  }

  .schedule-period {
    padding: 10px !important;
  }

  /* LiveSchool stats in profile */
  .liveschool-stats {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* ============================================
     TIME OFF MODULE - Mobile Optimizations
     ============================================ */

  /* Filter tabs - horizontal scroll on mobile */
  .filter-tabs {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding-bottom: 4px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .filter-tabs::-webkit-scrollbar {
    display: none;
  }

  .filter-tab {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 8px 12px;
    min-height: 40px;
  }

  /* Sort/filter controls - stack vertically on mobile */
  .sort-filter-controls {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  .sort-filter-controls > div {
    width: 100% !important;
    min-width: 0 !important;
  }

  .sort-filter-controls input[type="text"],
  .sort-filter-controls select {
    width: 100% !important;
  }

  /* Date range - stack on narrow screens */
  .sort-filter-controls > div:has(input[type="date"]) {
    flex-wrap: wrap;
  }

  .sort-filter-controls input[type="date"] {
    flex: 1;
    min-width: 120px !important;
    width: auto !important;
  }

  /* Sort row - keep inline */
  .sort-filter-controls > div:has(#sortBySelect) {
    display: flex !important;
    flex-direction: row !important;
  }

  .sort-filter-controls #sortBySelect {
    flex: 1;
  }

  /* Content with sidebar - stack on mobile */
  .content-with-sidebar {
    flex-direction: column !important;
  }

  .content-main {
    width: 100% !important;
    order: 1;
  }

  .content-sidebar {
    width: 100% !important;
    order: 2;
    margin-top: 16px;
  }

  /* Sidebar cards - horizontal scroll or collapse */
  .sidebar-card {
    margin-bottom: 12px;
  }

  /* Request cards - optimize for mobile */
  .request-card {
    padding: 12px !important;
  }

  .request-card-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px;
  }

  .request-card-footer {
    flex-direction: column;
    align-items: stretch !important;
    gap: 8px;
  }

  .request-actions {
    display: flex;
    gap: 8px;
    width: 100%;
  }

  .request-actions .btn {
    flex: 1;
  }

  /* Per-day statuses - wrap nicely */
  .per-day-statuses {
    gap: 6px !important;
  }

  .per-day-statuses > span {
    font-size: 10px !important;
    padding: 2px 4px !important;
  }

  /* Page header - stack on mobile */
  .page-header {
    flex-direction: column;
    align-items: stretch !important;
    gap: 12px;
  }

  .page-header > div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .page-header .btn {
    flex: 1;
    min-width: 120px;
  }
}

/* ============================================
   TIME OFF IMPORT MODAL - Mobile Optimizations
   ============================================ */
@media (max-width: 768px), (max-height: 500px) and (hover: none) and (pointer: coarse) {
  /* Import modal header controls */
  #timeoffImportConfirmModal .modal-body > div:first-child {
    font-size: 13px;
  }

  #timeoffImportConfirmModal .modal-body > div:nth-child(2) {
    flex-direction: column;
    align-items: stretch !important;
    gap: 8px;
  }

  /* Import records list - card layout instead of grid */
  .import-records-list {
    border: none !important;
  }

  .import-header-row {
    display: none !important; /* Hide header row on mobile */
  }

  .import-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    padding: 14px !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    margin-bottom: 10px !important;
    position: relative;
  }

  /* Checkbox - top left */
  .import-row-check {
    position: absolute !important;
    top: 14px;
    left: 14px;
    width: auto !important;
  }

  .import-row-check input[type="checkbox"] {
    width: 24px;
    height: 24px;
  }

  /* Action buttons - top right */
  .import-row-action {
    position: absolute !important;
    top: 10px;
    right: 10px;
    width: auto !important;
    display: flex !important;
    gap: 4px !important;
  }

  .import-row-action .btn {
    padding: 6px 10px !important;
    font-size: 11px !important;
  }

  /* Staff name - with left padding for checkbox, right for buttons */
  /* v4.14.0: Reduced right padding from 100px to 70px so names fit on small phones */
  .import-row-name {
    padding-left: 36px;
    padding-right: 70px;
  }

  /* Type dropdown - full width */
  .import-row-type {
    width: 100% !important;
  }

  .import-row-type select {
    width: 100% !important;
    padding: 10px !important;
    font-size: 14px !important;
  }

  /* Dates row - side by side */
  .import-row-start,
  .import-row-end {
    width: calc(50% - 4px) !important;
    display: inline-block !important;
  }

  .import-row-start {
    float: left;
  }

  .import-row-end {
    float: right;
  }

  .import-row-start::before {
    content: 'Start';
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
  }

  .import-row-end::before {
    content: 'End';
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
  }

  .import-row input[type="date"] {
    width: 100% !important;
    padding: 10px !important;
    font-size: 14px !important;
  }

  /* Status indicator */
  .import-row-status {
    clear: both;
    padding-top: 8px;
    text-align: left !important;
  }

  .import-row-status::before {
    content: 'Confidence: ';
    font-size: 12px;
    color: var(--text-muted);
  }

  /* Modal footer buttons - stack */
  #timeoffImportConfirmModal .modal-footer {
    flex-direction: column !important;
    gap: 8px !important;
  }

  #timeoffImportConfirmModal .modal-footer > * {
    width: 100%;
  }

  #timeoffImportConfirmModal .modal-footer > div {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  #timeoffImportConfirmModal .modal-footer .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ============================================
   MOBILE USABILITY IMPROVEMENTS
   ============================================ */

/* Touch-friendly tap targets - ensure 44px minimum */
@media (max-width: 768px), (max-height: 500px) and (hover: none) and (pointer: coarse) {
  /* All interactive elements should have adequate size */
  a, button, [role="button"], .clickable, [onclick] {
    min-height: 44px;
    min-width: 44px;
  }

  /* Exception for inline links in text */
  p a, span a, .inline-link {
    min-height: auto;
    min-width: auto;
  }

  /* Better spacing for touch */
  .list-item, .menu-item, .dropdown-item {
    padding: 12px 16px;
    min-height: 48px;
  }

  /* Larger checkboxes and radios */
  input[type="checkbox"], input[type="radio"] {
    width: 22px;
    height: 22px;
    margin-right: 10px;
  }

  /* Better toggle switches */
  .toggle-switch {
    min-width: 50px;
    min-height: 28px;
  }
}

/* ============================================
   PULL-TO-REFRESH VISUAL INDICATOR
   ============================================ */
@media (max-width: 768px), (max-height: 500px) and (hover: none) and (pointer: coarse) {
  .pull-indicator {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s;
  }

  .pull-indicator.visible {
    opacity: 1;
  }
}

/* ============================================
   BOTTOM SHEET STYLE MODALS (Mobile)
   ============================================ */
@media (max-width: 480px) {
  /* Small modals become bottom sheets */
  .modal[style*="max-width: 400px"],
  .modal[style*="max-width: 500px"],
  .modal-sm {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto !important;
    max-height: 85vh;
    border-radius: 20px 20px 0 0;
    animation: slideUp 0.3s ease-out;
  }

  @keyframes slideUp {
    from {
      transform: translateY(100%);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }

  /* Bottom sheet drag handle */
  .modal[style*="max-width: 400px"]::before,
  .modal[style*="max-width: 500px"]::before,
  .modal-sm::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    margin: 8px auto 4px;
  }
}

/* ============================================
   IMPROVED SCROLL BEHAVIOR
   ============================================ */
@media (max-width: 768px), (max-height: 500px) and (hover: none) and (pointer: coarse) {
  /* Momentum scrolling */
  .scrollable, .scroll-container, .modal-body, .card-body {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  /* Hide scrollbars on mobile for cleaner look */
  .scrollable::-webkit-scrollbar,
  .scroll-container::-webkit-scrollbar,
  .horizontal-scroll::-webkit-scrollbar {
    display: none;
  }

  .scrollable, .scroll-container, .horizontal-scroll {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  /* Horizontal scroll containers */
  .horizontal-scroll {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding-bottom: 8px;
  }

  .horizontal-scroll > * {
    flex-shrink: 0;
  }
}

/* ============================================
   MOBILE FORM IMPROVEMENTS
   ============================================ */
@media (max-width: 768px), (max-height: 500px) and (hover: none) and (pointer: coarse) {
  /* Prevent zoom on iOS when focusing inputs */
  input, select, textarea {
    font-size: 16px !important;
  }

  /* Better select dropdown appearance */
  select {
    -webkit-appearance: none;
    appearance: none;
    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: 36px;
  }

  /* Form group spacing */
  .form-group {
    margin-bottom: 16px;
  }

  /* Stacked form buttons */
  .form-actions, .modal-footer {
    display: flex;
    flex-direction: column-reverse;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .form-actions .btn, .modal-footer .btn {
    width: 100%;
  }

  /* Cancel button less prominent */
  .form-actions .btn-ghost, .modal-footer .btn-ghost {
    order: 1;
  }
}

/* ============================================
   FLOATING ACTION BUTTON (FAB)
   ============================================ */
@media (max-width: 768px), (max-height: 500px) and (hover: none) and (pointer: coarse) {
  .fab {
    position: fixed;
    bottom: calc(20px + env(safe-area-inset-bottom));
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    z-index: 100;
    transition: transform 0.2s, box-shadow 0.2s;
  }

  .fab:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  }
}

/* ============================================
   MOBILE-SPECIFIC DARK MODE FIXES
   ============================================ */
@media (max-width: 768px), (max-height: 500px) and (hover: none) and (pointer: coarse) {
  /* Ensure contrast in dark mode on mobile */
  .dark-mode .card, [data-theme="dark"] .card {
    border-color: var(--border-color);
  }

  /* Better visibility for placeholder text */
  .dark-mode input::placeholder,
  [data-theme="dark"] input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
  }
}

/* ============================================
   LOADING STATES - Mobile Optimized
   ============================================ */
@media (max-width: 768px), (max-height: 500px) and (hover: none) and (pointer: coarse) {
  .loading-overlay {
    backdrop-filter: blur(2px);
  }

  .loading-spinner {
    width: 32px;
    height: 32px;
  }

  /* Inline loading indicator */
  .btn.loading {
    position: relative;
    color: transparent !important;
  }

  .btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
  }

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

/* ============================================
   GESTURE HINTS
   ============================================ */
@media (max-width: 768px), (max-height: 500px) and (hover: none) and (pointer: coarse) {
  /* Swipe hint indicator */
  .swipe-hint {
    position: absolute;
    top: 50%;
    left: 8px;
    transform: translateY(-50%);
    width: 4px;
    height: 40px;
    background: var(--primary);
    border-radius: 2px;
    opacity: 0.3;
    animation: swipeHint 2s ease-in-out infinite;
  }

  @keyframes swipeHint {
    0%, 100% { transform: translateY(-50%) translateX(0); opacity: 0.3; }
    50% { transform: translateY(-50%) translateX(10px); opacity: 0.6; }
  }
}

/* ============================================
   PD ATTENDANCE MODULE - Mobile Optimizations
   ============================================ */
@media (max-width: 768px), (max-height: 500px) and (hover: none) and (pointer: coarse) {
  /* Make PD attendance table wrappers scrollable on mobile */
  .data-shell {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -14px;
    padding: 0 14px;
  }

  .data-shell .data-table {
    min-width: 420px;
  }

  /* PD Attendance content - reduce padding on mobile */
  #slContent {
    padding: 12px !important;
  }

  /* PD Attendance card header - stack on mobile */
  #slContent .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  /* PD Attendance stats - 3 columns on small screens */
  #slContent .stats-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }

  /* Session modal 2-column grids - stack on mobile */
  .modal-body > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
}

@media (max-width: 480px) {
  /* PD Attendance stats - stack to 1 column on very small */
  #slContent .stats-grid {
    grid-template-columns: 1fr !important;
  }

  #slContent .stat-box {
    flex-direction: row !important;
    justify-content: space-between;
    text-align: left !important;
  }
}

/* ============================================
   MODULE-SPECIFIC MOBILE RESPONSIVE FIXES
   v5.0: Ensure all pages work on mobile
   ============================================ */

@media (max-width: 768px), (max-height: 500px) and (hover: none) and (pointer: coarse) {
  /* --- School Calendar: 2-column layout with fixed sidebar → stack --- */
  .card-grid[style*="1fr 420px"] {
    grid-template-columns: 1fr !important;
  }

  /* --- Generic: .table-responsive wrapper (used by website.js) --- */
  .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* --- Website / Grades: 5-column stat grids → 3 columns --- */
  div[style*="repeat(5, 1fr)"] {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px !important;
  }

  /* --- Website: Contact table column widths → auto --- */
  #contactsTable th[style*="width"],
  #contactsTable td[style*="width"] {
    width: auto !important;
  }

  #contactsTable td[style*="max-width"] {
    max-width: 200px !important;
  }

  /* --- Admin Security: 180px minmax overview stats → 2 columns --- */
  div[style*="minmax(180px"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* --- Admin Security: 260px minmax role permission cards → 1 column --- */
  div[style*="minmax(260px"] {
    grid-template-columns: 1fr !important;
  }

  /* --- Time-Off / Generic: Flex filter bars with min-width children --- */
  .sort-filter-controls {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .sort-filter-controls > div {
    min-width: 0 !important;
    width: 100% !important;
    flex: none !important;
  }

  .sort-filter-controls > div[style*="display: flex"] {
    width: 100% !important;
  }

  /* --- Time-Off: Inline 2-column stats grids → 1 column --- */
  .stats-grid[style*="1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* --- Admin Announcements / Assessments: 200px minmax grids → 2 columns --- */
  div[style*="minmax(200px, 1fr)"] {
    grid-template-columns: 1fr 1fr !important;
  }

  /* --- Admin Bus Students: Search input full width --- */
  #busStudentSearch {
    width: 100% !important;
  }

  /* --- Assessments: Period cards → 2 columns --- */
  .period-cards {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* --- Schedule Builder: 300px minmax bell grid → 1 column --- */
  div[style*="minmax(300px"] {
    grid-template-columns: 1fr !important;
  }

  /* --- Trips / LiveSchool / Grades: 320px minmax card grids → 1 column --- */
  div[style*="minmax(320px"] {
    grid-template-columns: 1fr !important;
  }

  /* --- Call-Log / Reports: 4-column grids → 2 columns --- */
  div[style*="repeat(4, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* --- Trips / Admin Notifications: 3-column grids → 2 columns --- */
  div[style*="repeat(3, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* --- Analytics: 400px minmax grids → 1 column --- */
  div[style*="minmax(400px"] {
    grid-template-columns: 1fr !important;
  }

  /* --- Bookmarks: 220px minmax badge grids → 2 columns --- */
  div[style*="minmax(220px"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* --- Reports: .two-col and .stats-grid 4-col → responsive --- */
  .two-col {
    grid-template-columns: 1fr !important;
  }

  /* --- Admin Dashboard Settings: 2-column grids → 1 column --- */
  .admin-section div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* --- Devices: Fixed sidebar layout → stack --- */
  div[style*="grid-template-columns: 300px"] {
    grid-template-columns: 1fr !important;
  }

  /* --- Generic: Inline 2-column grids in cards/modals → 1 column --- */
  .card-body div[style*="grid-template-columns: 1fr 1fr"],
  .modal-body div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* --- LiveSchool: 320px card grid → 1 column --- */
  div[style*="minmax(320px, 1fr)"] {
    grid-template-columns: 1fr !important;
  }

  /* --- Admin Notifications: Digest filter selects → flexible --- */
  .digest-filters select {
    width: 100% !important;
    min-width: 0 !important;
  }
}

@media (max-width: 480px) {
  /* --- 5-column grids → 2 columns on small phones --- */
  div[style*="repeat(5, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* --- Admin Security stats → 1 column on small --- */
  div[style*="minmax(180px"] {
    grid-template-columns: 1fr !important;
  }

  /* --- 200px minmax quick actions → 1 column --- */
  div[style*="minmax(200px, 1fr)"] {
    grid-template-columns: 1fr !important;
  }

  /* --- Assessments: Period cards → 1 column --- */
  .period-cards {
    grid-template-columns: 1fr !important;
  }

  /* --- 4-column grids → 1 column --- */
  div[style*="repeat(4, 1fr)"] {
    grid-template-columns: 1fr !important;
  }

  /* --- 3-column grids → 1 column --- */
  div[style*="repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
  }

  /* --- Bookmarks: Badge grids → 1 column --- */
  div[style*="minmax(220px"] {
    grid-template-columns: 1fr !important;
  }

  /* --- Filter bar date inputs: Remove min-width --- */
  .sort-filter-controls input[type="date"] {
    min-width: 0 !important;
  }

  /* --- Generic: Font size reduction for stat values on small screens --- */
  div[style*="font-size: 1.5rem"] {
    font-size: 1.25rem !important;
  }

  /* --- Schedule Builder: Fixed-width inputs → full width on mobile --- */
  #newClassName, #newClassHomeroom, #newRoomName,
  #newSubjectName, #newSubjectShort, #newSubjectRoom,
  #electiveName, #electiveShort, #electiveMax,
  #editElectiveMax, #slName, #slMax, #bellPeriod,
  #electiveDeadline, #editElectiveDeadline {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  /* Schedule Builder: Inline form rows → stack vertically */
  .sb-inline-form,
  .sb-add-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  .sb-inline-form > *,
  .sb-add-row > * {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* --- Sport Tryouts: Table fixed widths → auto on mobile --- */
  .st-table th[style*="width"],
  .st-table td[style*="width"] {
    width: auto !important;
  }

  .st-table {
    font-size: 12px;
  }

  .st-table th,
  .st-table td {
    padding: 8px 6px !important;
  }

  /* Sport Tryouts: Search input full width */
  .st-toolbar input[type="text"] {
    width: 100% !important;
    min-width: 0 !important;
  }

  .st-toolbar {
    flex-direction: column !important;
    gap: 8px !important;
  }

  /* --- Student Engagement: Heatmap table → reduce min-width --- */
  .student-engagement table[style*="min-width"] {
    min-width: 320px !important;
  }

  /* --- Parent Reports: Tables overflow wrapper fix --- */
  .parent-reports-table {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .parent-reports-table table {
    min-width: 500px;
  }

  /* Parent Reports: Search input full width */
  .pr-search-input {
    min-width: 0 !important;
    width: 100% !important;
  }

  .pr-student-filters {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .pr-student-filters input,
  .pr-student-filters select {
    width: 100% !important;
    min-width: 0 !important;
  }

  .pr-student-actions {
    white-space: normal !important;
  }

  .pr-student-actions .btn {
    margin: 4px 2px !important;
  }

  .pr-bulk-dry-run {
    max-height: 55vh;
    overflow-y: auto;
  }

  .pr-confirm-modal {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
  }

  .pr-confirm-modal .modal-footer {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .pr-confirm-modal .modal-footer .btn {
    width: 100% !important;
  }

  /* --- Attendance: Stats row → 2 columns --- */
  .att-stats-row {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .att-stat-card {
    padding: 14px !important;
  }

  .att-stat-value {
    font-size: 24px !important;
  }

  /* Attendance: Header stack */
  .att-header {
    flex-direction: column !important;
    gap: 12px !important;
    align-items: stretch !important;
  }

  .att-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .att-header-actions .btn {
    flex: 1;
    min-width: 100px;
  }

  /* --- Reading: Stats grids → 2 columns --- */
  .reading-stats {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* --- Grades: Student grade cards → full width --- */
  .grade-card {
    min-width: 0 !important;
  }

  /* --- Copies/Supplies: Request card improvements --- */
  .copy-request-info,
  .supply-request-info {
    flex-direction: column !important;
    gap: 8px !important;
  }

  /* --- Analytics: Chart containers → responsive height --- */
  .analytics-chart-container canvas {
    max-height: 250px !important;
  }

  /* --- Settings: Section grids → 1 column --- */
  .settings-grid {
    grid-template-columns: 1fr !important;
  }

  /* --- Admin Data Import: Controls → stack --- */
  .import-controls {
    flex-direction: column !important;
    gap: 8px !important;
  }

  .import-controls .btn,
  .import-controls select,
  .import-controls input {
    width: 100% !important;
  }

  /* --- Admin Data Matching: Unmatched grids → 1 column --- */
  .matching-grid {
    grid-template-columns: 1fr !important;
  }

  /* --- Bookmarks: Header → stack on mobile --- */
  .greenhub-header {
    flex-direction: column !important;
    gap: 12px !important;
    align-items: stretch !important;
  }
}

/* ============================================
   ADDITIONAL 480px FIXES
   ============================================ */
@media (max-width: 480px) {
  /* Schedule Builder inputs - even smaller screens */
  #newSubjectColor,
  input[type="color"] {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px;
  }

  /* Sport Tryouts: Hide less important columns */
  .st-table .hide-sm {
    display: none !important;
  }

  /* Parent Reports: Compact table cells */
  .parent-reports-table th,
  .parent-reports-table td {
    padding: 8px 6px !important;
    font-size: 12px !important;
  }

  /* Attendance: Stats → 1 column on very small */
  .att-stats-row {
    grid-template-columns: 1fr !important;
  }
}

/* v5.8.28: Preserve horizontal pan inside scrollable mobile regions while the PWA shell remains fixed. */
@media (max-width: 768px), (max-height: 500px) and (hover: none) and (pointer: coarse) {
  .table-responsive,
  .tab-scroll,
  .report-preview {
    touch-action: pan-x pan-y;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }
}

/* v6.0.0-beta.6: Mobile density sweep -- preserve touch targets while reducing wasted vertical space. */
@media (max-width: 768px), (max-height: 500px) and (hover: none) and (pointer: coarse) {
  :root {
    --mobile-page-gutter: clamp(8px, 2.8vw, 12px);
    --mobile-card-pad: clamp(10px, 3vw, 14px);
    --mobile-section-gap: 10px;
  }

  .main-content {
    padding: var(--mobile-page-gutter) !important;
    gap: var(--mobile-section-gap);
  }

  .page-header {
    margin-bottom: var(--mobile-section-gap) !important;
    gap: 8px !important;
  }

  .page-header .page-subtitle,
  .page-subtitle,
  .card-subtitle {
    margin-top: 2px !important;
    line-height: 1.25;
  }

  .card {
    margin-bottom: var(--mobile-section-gap) !important;
  }

  .card-header,
  .card-body,
  .card-footer,
  .card-controls {
    padding: var(--mobile-card-pad) !important;
  }

  .card-header {
    gap: 8px !important;
  }

  .card-title {
    margin-bottom: 2px !important;
    line-height: 1.25;
  }

  .card-controls,
  .filter-bar,
  .att-filter-row,
  .sort-filter-controls,
  .page-header-actions,
  .card-actions,
  .card-header-actions {
    gap: 8px !important;
  }

  .stats-grid,
  .dash-stats-modern,
  .dashboard-stats,
  .att-stats-row,
  .reading-stats {
    gap: 8px !important;
  }

  .stat-box,
  .stat-card,
  .att-stat-card,
  .dash-stat-card,
  .metric-card {
    padding: 10px !important;
  }

  .empty-state,
  .data-empty,
  .import-status-empty,
  .universal-search-error,
  .quickview-error,
  .schedule-empty,
  .att-empty-state {
    padding: 20px 12px !important;
    min-height: auto !important;
  }

  .empty-state-icon,
  .att-empty-icon {
    margin-bottom: 8px !important;
    transform: scale(0.82);
    transform-origin: center;
  }

  input[type="search"],
  .card-controls input[type="search"] {
    width: 100% !important;
    min-width: 0 !important;
  }

  .table-responsive,
  .data-table-wrapper,
  .parent-reports-table,
  .tab-scroll,
  .report-preview {
    touch-action: pan-x pan-y;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: max(6px, env(safe-area-inset-left, 0px)) max(6px, var(--mobile-page-gutter)) max(8px, env(safe-area-inset-bottom, 0px)) !important;
  }

  .card-controls input[type="text"],
  .card-controls input[type="search"],
  .card-controls input[type="date"],
  .card-controls select,
  .card-controls .btn,
  .btn {
    min-height: 42px;
  }

  .modal-backdrop:not(.modal-backdrop-full) {
    padding: 6px !important;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 12px !important;
  }
}

/* v6.0.0-beta.7: Mobile cleanup pass -- undo over-broad tap inflation and tighten dense badge surfaces. */
@media (max-width: 768px), (max-height: 500px) and (hover: none) and (pointer: coarse) {
  .data-table tr[onclick],
  .card[onclick],
  .student-card[onclick],
  .staff-card[onclick],
  .dashboard-card[onclick],
  .achievement-card,
  .almost-badge {
    min-width: 0 !important;
  }

  .list-item,
  .menu-item,
  .dropdown-item {
    padding: 9px 12px !important;
    min-height: 42px !important;
  }

  .student-profile-achievements {
    margin: 8px 0 !important;
    padding: 10px !important;
  }

  .profile-achievements-label {
    margin-bottom: 6px !important;
  }

  .achievement-card {
    padding: 10px !important;
    gap: 5px !important;
  }

  .achievement-card-icon {
    font-size: 1.5rem !important;
    line-height: 1 !important;
    margin-bottom: 2px !important;
  }

  .achievement-card-name,
  .achievement-card-xp,
  .achievement-card-date,
  .achievement-card-desc {
    line-height: 1.2 !important;
  }

  .achievements-section {
    margin-top: 10px !important;
  }

  .achievements-section-header {
    min-height: 42px !important;
    padding: 8px 10px !important;
  }

  .achievements-collection {
    gap: 8px !important;
  }

  .almost-there-section {
    padding: 10px !important;
    margin-bottom: 10px !important;
  }

  .almost-badge {
    padding: 8px !important;
    gap: 8px !important;
  }

  .almost-badge-icon {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    font-size: 1.1rem !important;
  }
}

@media (max-width: 480px) {
  .achievement-card {
    padding: 9px !important;
  }

  .achievements-section-header {
    border-radius: 10px !important;
  }

  .achievement-card-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* v6.0.0-beta.10: Mobile student-list pan lock -- vertical-only scrolling for card/list student surfaces. */
@media (max-width: 768px), (max-height: 500px) and (hover: none) and (pointer: coarse) {
  .student-list,
  [id$="StudentList"],
  [id*="StudentList"],
  .student-data-shell,
  .staff-data-shell,
  .tech-support-data-shell,
  .data-shell:has(table.data-table[data-mobile-table="card"]) {
    overflow-x: hidden !important;
    overscroll-behavior-x: none;
    touch-action: pan-y;
    max-width: 100%;
  }

  .student-list > *,
  [id$="StudentList"] > *,
  [id*="StudentList"] > *,
  .student-item,
  .student-card,
  table.data-table[data-mobile-table="card"],
  table.data-table[data-mobile-table="card"] tbody,
  table.data-table[data-mobile-table="card"] tr,
  table.data-table[data-mobile-table="card"] td,
  table.data-table[data-mobile-table="card"] .avatar-cell,
  table.data-table[data-mobile-table="card"] .actions-cell {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  table.data-table[data-mobile-table="card"] {
    width: 100%;
    table-layout: fixed;
    touch-action: pan-y;
  }

  table.data-table[data-mobile-table="card"] tr {
    width: 100%;
    touch-action: pan-y;
  }
}

/* Mobile compact name lists: keep student/contact/staff name groups organized and space-efficient across pages. */
@media (max-width: 768px), (max-height: 500px) and (hover: none) and (pointer: coarse) {
  .contacts-cell,
  .name-list,
  .match-suggestions,
  .ath-match-suggestions,
  .trip-changes-list,
  .current-assignments,
  #currentAssignments,
  [id$="StudentList"] .student-list,
  [id*="StudentList"] .student-list {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
    gap: 4px;
    align-items: start;
    max-width: 100%;
  }

  .contact-pill,
  .contact-more,
  .suggestion-chip,
  .ath-suggestion-chip,
  .trip-change-item,
  .current-assignment,
  .autocomplete-item,
  .dropdown-item {
    min-height: 28px;
    padding: 3px 8px;
    justify-content: flex-start;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
  }

  .avatar-info,
  .student-info,
  .staff-info,
  .student-name-link,
  .student-link,
  .signin-student-link,
  .selected-student-name,
  .autocomplete-item-name,
  .dash-insight-name,
  .dash-leaderboard-name,
  .desktop-recent-btn span:first-child {
    min-width: 0;
    max-width: 100%;
  }

  .student-name-link,
  .student-link,
  .signin-student-link,
  .selected-student-name,
  .autocomplete-item-name,
  .dash-insight-name,
  .dash-leaderboard-name {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }

  .student-item,
  .student-card,
  .list-row,
  .dash-attendance-item,
  .dash-insight-item,
  .dash-leaderboard-item,
  .current-assignment {
    min-width: 0;
    max-width: 100%;
  }
}

/* ===== dark-mode.css ===== */
/* HBGS Design System v2.1 - Dark Mode */

/* ============================================
   DARK MODE
   ============================================ */

[data-theme="dark"] {
  --gray-50: #111827;
  --gray-100: #1f2937;
  --gray-200: #374151;
  --gray-300: #4b5563;
  --gray-400: #6b7280;
  --gray-500: #9ca3af;
  --gray-600: #d1d5db;
  --gray-700: #e5e7eb;
  --gray-800: #f3f4f6;
  --gray-900: #f9fafb;

  --bus-bg: #422006;
  --bus-border: #854d0e;
  --bus-text: #fef08a;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 40px -8px rgba(0, 0, 0, 0.5);

  /* Dark theme-aware colors */
  --primary: #22c55e;
  --primary-light: rgba(34, 197, 94, 0.1);
  --primary-hover: #4ade80;
  --border-primary: #22c55e;
  --info-rgb: 96, 165, 250;
  --bg-primary: #111827;
  --card-bg: #1f2937;
  --bg-secondary: #374151;
  --bg-tertiary: #4b5563;
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --text-muted: #9ca3af;
  --text-tertiary: #6b7280;
  --border-color: #374151;

  /* Alert text colors for dark backgrounds */
  --danger-bg: #450a0a;
  --danger-text: #fca5a5;
  --warning-bg: #422006;
  --warning-text: #fcd34d;
  --success-bg: #052e16;
  --success-text: #86efac;
  --info-bg: #0c1929;
  --info-text: #93c5fd;

  /* Icon filter for dark mode - inverts black icons to white */
  --icon-filter: invert(1);
}

[data-theme="dark"] body {
  background: var(--gray-50);
  color: var(--gray-900);
}

[data-theme="dark"] html {
  background: var(--gray-50);
}

/* Dark mode scrollbar */
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--gray-300);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

[data-theme="dark"] * {
  scrollbar-color: var(--gray-300) transparent;
}

[data-theme="dark"] .sidebar {
  background: #0a0f0d;
  border-right: 1px solid rgba(255,255,255,0.05);
}

[data-theme="dark"] .sidebar-header {
  border-bottom-color: rgba(255,255,255,0.05);
}

[data-theme="dark"] .sidebar-logo {
  background: var(--gray-100);
}

[data-theme="dark"] .sidebar-footer {
  border-top-color: rgba(255,255,255,0.05);
}

[data-theme="dark"] .top-header {
  background: var(--gray-100);
  border-bottom-color: var(--gray-200);
}

[data-theme="dark"] .main-content {
  background: var(--gray-50);
}

[data-theme="dark"] .card {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
}

[data-theme="dark"] .card-header {
  border-bottom-color: var(--gray-200);
}

[data-theme="dark"] .card-footer {
  background: var(--gray-50);
  border-top-color: var(--gray-200);
}

[data-theme="dark"] .stat-card {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
}

[data-theme="dark"] .stat-card-icon.green {
  background: rgba(34, 197, 94, 0.2);
}

[data-theme="dark"] .stat-card-icon.yellow {
  background: rgba(234, 179, 8, 0.2);
}

[data-theme="dark"] .stat-card-icon.blue {
  background: rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .stat-card-icon.purple {
  background: rgba(139, 92, 246, 0.2);
}

[data-theme="dark"] .data-table th {
  background: var(--gray-50);
  border-bottom-color: var(--gray-200);
}

[data-theme="dark"] .data-table td {
  border-bottom-color: var(--gray-200);
}

[data-theme="dark"] .data-table tbody tr:hover {
  background: var(--gray-200);
}

[data-theme="dark"] .data-table tbody tr.bus-row {
  background: var(--bus-bg);
}

[data-theme="dark"] .data-table tbody tr.bus-row:hover {
  background: #4a2708;
}

[data-theme="dark"] .badge {
  background: var(--gray-200);
}

[data-theme="dark"] .badge-success {
  background: rgba(34, 197, 94, 0.2);
  color: var(--hbgs-green-400);
}

[data-theme="dark"] .badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

[data-theme="dark"] .badge-error {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

[data-theme="dark"] .badge-info {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

[data-theme="dark"] .badge-bus {
  background: var(--bus-bg);
  color: var(--bus-text);
}

[data-theme="dark"] .badge-signin {
  background: rgba(22, 163, 74, 0.2);
  color: #4ade80;
}

[data-theme="dark"] .badge-signout {
  background: rgba(234, 88, 12, 0.2);
  color: #fb923c;
}

[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] select {
  background: var(--gray-100);
  border-color: var(--gray-300);
  color: var(--gray-900);
}

[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="dark"] input[type="text"]:focus,
[data-theme="dark"] input[type="number"]:focus,
[data-theme="dark"] input[type="date"]:focus,
[data-theme="dark"] select:focus {
  border-color: var(--hbgs-green-500);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
}

[data-theme="dark"] .search-row {
  background: var(--gray-100);
  border-bottom-color: var(--gray-200);
}

[data-theme="dark"] .btn-secondary,
[data-theme="dark"] .btn-outline {
  background: var(--gray-200);
  border-color: var(--gray-300);
  color: var(--gray-800);
}

[data-theme="dark"] .btn-secondary:hover:not(:disabled),
[data-theme="dark"] .btn-outline:hover:not(:disabled) {
  background: var(--gray-300);
  border-color: var(--gray-400);
}

[data-theme="dark"] .btn-ghost {
  color: var(--gray-600);
}

[data-theme="dark"] .btn-ghost:hover:not(:disabled) {
  background: var(--gray-200);
  color: var(--gray-800);
}

[data-theme="dark"] .modal-backdrop {
  background: rgba(0, 0, 0, 0.75);
}

[data-theme="dark"] .modal {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
}

[data-theme="dark"] .modal-header {
  border-bottom-color: var(--gray-200);
}

[data-theme="dark"] .modal-footer {
  border-top-color: var(--gray-200);
}

[data-theme="dark"] .actions-menu,
[data-theme="dark"] .signin-actions-menu,
[data-theme="dark"] .student-actions-menu {
  background: var(--gray-100);
  border-color: var(--gray-200);
}

[data-theme="dark"] .actions-menu-item:hover,
[data-theme="dark"] .signin-action-item:hover,
[data-theme="dark"] .student-action-item:hover {
  background: var(--gray-200);
}

[data-theme="dark"] .actions-menu-item-danger:hover {
  background: rgba(239, 68, 68, 0.15);
}

[data-theme="dark"] .list-row {
  border-bottom-color: var(--gray-200);
}

[data-theme="dark"] .list-row:hover {
  background: var(--gray-200);
}

[data-theme="dark"] .list-row.bus-row {
  background: var(--bus-bg);
}

[data-theme="dark"] .list-row.bus-row:hover {
  background: #4a2708;
}

[data-theme="dark"] .history-summary {
  background: rgba(34, 197, 94, 0.15);
  color: var(--hbgs-green-400);
}

[data-theme="dark"] .data-empty {
  color: var(--gray-500);
}

[data-theme="dark"] .empty-state-icon {
  background: var(--gray-200);
}

[data-theme="dark"] .empty-state-title {
  color: var(--gray-800);
}

[data-theme="dark"] .link-btn {
  color: var(--hbgs-green-400);
}

[data-theme="dark"] .link-btn:hover {
  color: var(--hbgs-green-300);
}

[data-theme="dark"] .avatar {
  background: rgba(34, 197, 94, 0.2);
  color: var(--hbgs-green-400);
}

[data-theme="dark"] .avatar.bus {
  background: var(--bus-bg);
  color: var(--bus-text);
}

[data-theme="dark"] .avatar-info-name {
  color: var(--gray-900);
}

[data-theme="dark"] .avatar-info-sub {
  color: var(--gray-500);
}

[data-theme="dark"] .toast {
  background: #374151;
  color: #ffffff;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .toast.toast-success {
  background: #16a34a;
}

[data-theme="dark"] .toast.toast-error {
  background: #dc2626;
}

[data-theme="dark"] .toast.toast-warning {
  background: #d97706;
}

[data-theme="dark"] .history-header {
  background: var(--gray-200);
}

[data-theme="dark"] .history-avatar {
  background: rgba(34, 197, 94, 0.2);
  color: var(--hbgs-green-400);
}

[data-theme="dark"] .history-stat {
  background: var(--gray-200);
}

[data-theme="dark"] .history-stat-value {
  color: var(--gray-900);
}

[data-theme="dark"] .stat-box {
  background: var(--bg-secondary);
}

[data-theme="dark"] .stat-value {
  color: var(--hbgs-green-400);
}

[data-theme="dark"] .stat-label {
  color: var(--text-secondary);
}

[data-theme="dark"] .stats-list-item {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .stats-list-rank {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

[data-theme="dark"] .stats-list-name {
  color: var(--text-primary);
}

[data-theme="dark"] .stats-list-label {
  color: var(--text-primary);
}

[data-theme="dark"] .stats-list-value {
  color: var(--hbgs-green-400);
}

[data-theme="dark"] .stats-list-class {
  color: var(--text-muted, var(--gray-500));
}

[data-theme="dark"] .stats-section-title {
  color: var(--text-secondary);
}

[data-theme="dark"] .stat-highlight .stat-value {
  color: var(--hbgs-green-400);
}

[data-theme="dark"] .stat-highlight .stat-label {
  color: var(--text-secondary);
}

[data-theme="dark"] .dismissal-note {
  color: var(--text-secondary);
}

[data-theme="dark"] .bathroom-section {
  border-top-color: var(--gray-200);
}

[data-theme="dark"] .bathroom-section-header {
  background: var(--gray-200);
}

[data-theme="dark"] .bathroom-section-count {
  background: rgba(34, 197, 94, 0.2);
  color: var(--hbgs-green-400);
}

[data-theme="dark"] .bathroom-out-item {
  background: var(--gray-200);
}

[data-theme="dark"] .bathroom-out-item.bathroom-out-long {
  background: #422006;
  border-color: #854d0e;
}

[data-theme="dark"] .bathroom-out-name {
  color: var(--gray-900);
}

[data-theme="dark"] .bathroom-out-timer {
  color: var(--hbgs-green-400);
}

[data-theme="dark"] .bathroom-out-timer.timer-warning {
  color: #fbbf24;
}

[data-theme="dark"] .duration-warning {
  color: #fbbf24;
}

[data-theme="dark"] .badge-warning {
  background: #422006;
  color: #fef08a;
}

[data-theme="dark"] .link-warning {
  background: #422006;
  border-color: #854d0e;
}

[data-theme="dark"] .link-warning-header {
  color: #fbbf24;
}

[data-theme="dark"] .link-warning p,
[data-theme="dark"] .link-warning ol {
  color: #fef3c7;
}

[data-theme="dark"] .link-warning-tip {
  background: rgba(0, 0, 0, 0.2);
}

/* Team Request Dark Mode */
[data-theme="dark"] .team-request-section {
  background: rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .team-member-item {
  background: var(--bg-primary);
  border-color: var(--border-color);
}

/* Early Dismissal Dark Mode */
[data-theme="dark"] .fixed-time-display {
  background: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .approved-badge {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

[data-theme="dark"] .dismissed-row {
  background: rgba(0, 0, 0, 0.2) !important;
}

/* Canceled Cards Dark Mode */
[data-theme="dark"] .list-card.canceled {
  background: rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .btn-outline.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.2);
}

[data-theme="dark"] .badge-error,
[data-theme="dark"] .badge-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* User Dropdown Dark Mode */
[data-theme="dark"] .header-dropdown-menu {
  background: var(--card-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .header-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .header-dropdown-logout:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* Announcements Dark Mode */
[data-theme="dark"] .announcement-info {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
}

[data-theme="dark"] .announcement-warning {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
}

[data-theme="dark"] .announcement-urgent {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
}

[data-theme="dark"] .announcement-dismiss:hover {
  background: rgba(255,255,255,0.1);
}

/* Notifications - Dark Mode */
[data-theme="dark"] .notification-menu {
  background: var(--bg-primary);
  border-color: var(--border-color);
}

[data-theme="dark"] .notification-item.unread {
  background: rgba(22, 163, 74, 0.1);
}

/* Dashboard activity icons */
[data-theme="dark"] .dash-activity-icon.green {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

[data-theme="dark"] .dash-activity-icon.yellow {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

[data-theme="dark"] .dash-panel-count-warn {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

/* Import status messages */
[data-theme="dark"] .import-error-row {
  background: rgba(239, 68, 68, 0.1);
}

[data-theme="dark"] .import-error-row td {
  color: #f87171;
}

[data-theme="dark"] .import-status-success {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

[data-theme="dark"] .import-status-error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

[data-theme="dark"] .import-status-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

/* Bathroom out items - frequent variant */
[data-theme="dark"] .bathroom-out-item.bathroom-out-frequent {
  background: #450a0a;
  border-color: #991b1b;
}

[data-theme="dark"] .bathroom-out-item.bathroom-out-long.bathroom-out-frequent {
  background: linear-gradient(135deg, #422006 50%, #450a0a 50%);
  border-color: #991b1b;
}

/* Kiosk warning */
[data-theme="dark"] .kiosk-warning {
  background: rgba(245, 158, 11, 0.15) !important;
  border-left-color: #f59e0b;
}

[data-theme="dark"] .kiosk-warning .kiosk-recent-meta {
  color: #fbbf24;
}

/* Kiosk sign-out mode button */
[data-theme="dark"] .kiosk-btn-signout-mode {
  background: #c2410c;
  box-shadow: 0 8px 20px rgba(194, 65, 12, 0.4);
}

/* Base .btn-danger dark mode hover */
[data-theme="dark"] .btn-danger:hover:not(:disabled) {
  background: #991b1b;
  border-color: #991b1b;
}

/* ===== beta7-polish.css ===== */
/* HBGS Beta 7 unified UI layer
 *
 * Token architecture:
 *   - Every surface/border/ink/accent value resolves to a --hbgs-* token.
 *   - Tokens are declared for safe light/dark behavior only.
 *   - Do not add theme pickers or extra visual variants without explicit approval.
 *   - The structural rules at the bottom only reference tokens, never raw hex.
 *
 * Active modes:
 *   - "dark"  -> Dark & calm (single green accent, flat surfaces, no glow)
 *   - "light" -> light token set so the same structural rules stay coherent
 */

/* ============================================================
   THEME TOKENS
   ============================================================ */

:root,
[data-theme="light"] {
  /* Surfaces */
  --hbgs-bg: #f6f8f7;            /* app background */
  --hbgs-surface: #ffffff;       /* cards / panels */
  --hbgs-surface-2: #f0f4f1;     /* headers / subtle fills */
  --hbgs-surface-3: #e7eee9;     /* inputs / hover wells */

  /* Ink */
  --hbgs-ink: #17211b;           /* primary text */
  --hbgs-ink-2: #526157;         /* secondary text */
  --hbgs-ink-3: #626f66;           /* muted text / labels; AA on secondary surfaces */

  /* Lines */
  --hbgs-line: #d8e1dc;          /* borders / dividers */
  --hbgs-line-strong: #bdcbc3;

  /* Single accent (the only color that "speaks") */
  --hbgs-accent: #15803d;
  --hbgs-accent-hover: #166534;
  --hbgs-accent-ink: #166534;    /* accent text on light surfaces */
  --hbgs-accent-contrast: #ffffff;
  --hbgs-accent-wash: rgba(22, 163, 74, 0.10);
  --hbgs-accent-ring: rgba(22, 163, 74, 0.30);

  /* Hero (single flat brand block) */
  --hbgs-hero-bg: #168044;
  --hbgs-hero-ink: #ffffff;
  --hbgs-hero-ink-2: rgba(240, 253, 244, 0.78);
  --hbgs-hero-line: rgba(255, 255, 255, 0.18);
  --hbgs-hero-well: rgba(255, 255, 255, 0.12);

  /* Complete compatibility bridge for legacy pages. */
  --gray-0: #ffffff;
  --gray-50: #f6f8f7;
  --gray-100: #f0f4f1;
  --gray-200: #e7eee9;
  --gray-300: #d8e1dc;
  --gray-400: #626f66;
  --gray-500: #626f66;
  --gray-600: #526157;
  --gray-700: #3f4c43;
  --gray-800: #26332b;
  --gray-900: #17211b;
  --primary-color: #15803d;
  --primary-light: rgba(22, 163, 74, 0.10);
  --primary-hover: #166534;
  --border-primary: #15803d;
  --text-tertiary: #626f66;

  /* Status (used sparingly; muted, no neon) */
  --hbgs-ok: #16a34a;
  --hbgs-warn: #b45309;
  --hbgs-danger: #b91c1c;
  --hbgs-info: #2563eb;

  /* Radii / motion */
  --hbgs-radius: 12px;
  --hbgs-radius-lg: 16px;
  --hbgs-radius-pill: 999px;

  color-scheme: light;
}

.dark-mode,
[data-theme="dark"] {
  /* Surfaces — calm charcoal-green, layered by lightness not by color */
  --hbgs-bg: #0f1512;            /* deepest: app background */
  --hbgs-surface: #151d18;       /* cards / panels */
  --hbgs-surface-2: #1b2620;     /* headers / subtle fills */
  --hbgs-surface-3: #202d26;     /* inputs / hover wells */

  /* Ink — near-white, no colored numerals */
  --hbgs-ink: #e8ede9;
  --hbgs-ink-2: #b4c0b8;
  --hbgs-ink-3: #93a39a;

  /* Lines — low-contrast hairlines */
  --hbgs-line: #26332c;
  --hbgs-line-strong: #35463d;

  /* Single accent */
  --hbgs-accent: #34d399;
  --hbgs-accent-hover: #4ade80;
  --hbgs-accent-ink: #6ee7b7;
  --hbgs-accent-contrast: #07130c;
  --hbgs-accent-wash: rgba(52, 211, 153, 0.12);
  --hbgs-accent-ring: rgba(52, 211, 153, 0.32);

  /* Hero — flat, slightly elevated brand block (no gradient) */
  --hbgs-hero-bg: #15633b;
  --hbgs-hero-ink: #ecfdf3;
  --hbgs-hero-ink-2: rgba(209, 250, 229, 0.72);
  --hbgs-hero-line: rgba(255, 255, 255, 0.10);
  --hbgs-hero-well: rgba(255, 255, 255, 0.08);

  /* Complete compatibility bridge for legacy pages. */
  --gray-0: #151d18;
  --gray-50: #1b2620;
  --gray-100: #202d26;
  --gray-200: #26332c;
  --gray-300: #35463d;
  --gray-400: #93a39a;
  --gray-500: #93a39a;
  --gray-600: #b4c0b8;
  --gray-700: #d0d8d2;
  --gray-800: #e0e6e2;
  --gray-900: #e8ede9;
  --primary-color: #34d399;
  --primary-light: rgba(52, 211, 153, 0.12);
  --primary-hover: #4ade80;
  --border-primary: #34d399;
  --text-tertiary: #93a39a;

  /* Status — desaturated so they don't fight the calm surface */
  --hbgs-ok: #34d399;
  --hbgs-warn: #d4a04a;
  --hbgs-danger: #ef8a8a;
  --hbgs-info: #6ba6f5;

  --hbgs-radius: 12px;
  --hbgs-radius-lg: 16px;
  --hbgs-radius-pill: 999px;

  color-scheme: dark;
}

/* ============================================================
   APP SHELL
   ============================================================ */

html,
body,
.app-layout,
.main-wrapper,
.content-area,
.main-content {
  background: var(--hbgs-bg);
  color: var(--hbgs-ink);
}

/* Sidebar — flat dark brand rail, no radial glow */
.sidebar {
  background: var(--hbgs-hero-bg);
  box-shadow: none;
  border-right: 1px solid var(--hbgs-hero-line);
}

.sidebar-header {
  padding: 20px 18px 18px;
  padding-top: calc(16px + var(--safe-top));
  border-bottom: 1px solid var(--hbgs-hero-line);
}

.sidebar-brand {
  align-items: flex-start;
  gap: 14px;
}

.sidebar-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  box-shadow: none;
  flex: 0 0 42px;
}

.sidebar-title {
  font-size: 15px;
  letter-spacing: -0.01em;
  line-height: 1.15;
  white-space: normal;
}

.sidebar-brand-copy {
  display: grid;
  min-width: 0;
  gap: 5px;
  padding-top: 1px;
}

.sidebar-title-row {
  display: grid;
  align-items: start;
  justify-items: start;
  gap: 6px;
  min-width: 0;
}


.hbgs-status-badge,
.badge,
.settings-badge,
.attendance-badge,
.ann-status-badge,
.ann-tab-badge,
.contact-more,
.contact-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 3px 9px;
  border: 1px solid var(--hbgs-line);
  border-radius: 999px;
  background: var(--hbgs-surface-2);
  color: var(--hbgs-ink-2);
  box-shadow: none;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.055em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.hbgs-status-badge-danger,
.badge-danger,
.badge-error,
.att-danger {
  border-color: color-mix(in srgb, var(--hbgs-danger) 36%, var(--hbgs-line));
  background: color-mix(in srgb, var(--hbgs-danger) 8%, var(--hbgs-surface));
  color: var(--hbgs-danger);
}

.hbgs-status-badge-warning,
.badge-warning,
.att-warn {
  border-color: color-mix(in srgb, #d97706 34%, var(--hbgs-line));
  background: color-mix(in srgb, #d97706 8%, var(--hbgs-surface));
  color: #92400e;
}

.hbgs-status-badge-success,
.badge-success,
.att-good {
  border-color: color-mix(in srgb, var(--hbgs-ok) 34%, var(--hbgs-line));
  background: color-mix(in srgb, var(--hbgs-ok) 8%, var(--hbgs-surface));
  color: var(--hbgs-ok);
}

.hbgs-status-badge-info,
.badge-info {
  border-color: color-mix(in srgb, var(--hbgs-info) 30%, var(--hbgs-line));
  background: color-mix(in srgb, var(--hbgs-info) 7%, var(--hbgs-surface));
  color: var(--hbgs-info);
}

.hbgs-status-badge-accent {
  border-color: color-mix(in srgb, var(--hbgs-accent) 36%, var(--hbgs-line));
  background: color-mix(in srgb, var(--hbgs-accent) 9%, var(--hbgs-surface));
  color: var(--hbgs-accent-ink);
}

.student-roster-badges {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-right: 8px;
  vertical-align: middle;
}

.student-name-link {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.student-name-text {
  min-width: 0;
}

.student-profile-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.student-profile-meta > span,
.student-profile-meta > a {
  margin-left: 0 !important;
}

.sidebar-subtitle {
  color: var(--hbgs-hero-ink-2);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 12px 10px 18px;
}

.nav-section {
  margin-bottom: 14px;
}

.nav-section-title,
.nav-section-collapsible .nav-section-title,
.nav-section-header {
  color: var(--hbgs-hero-ink-2) !important;
  font-size: 10px !important;
  letter-spacing: 0.1em !important;
  font-weight: 700 !important;
  text-transform: uppercase;
}

.nav-item {
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--hbgs-hero-ink-2);
  font-weight: 500;
  letter-spacing: 0;
}

/* Single subtle active marker — no double styling */
.nav-item::before {
  content: none;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--hbgs-hero-ink);
  transform: none;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.14);
  color: var(--hbgs-hero-ink);
  box-shadow: none;
}

/* Drop the per-item icon chips — they add visual noise */
.nav-item-icon {
  width: 22px;
  height: 22px;
  border-radius: 0;
  background: none !important;
  font-size: 18px;
  color: currentColor;
}

.nav-item.active .nav-item-icon {
  background: none !important;
}

.nav-item-badge,
.wip-badge {
  border-radius: var(--hbgs-radius-pill);
  font-size: 10px;
  box-shadow: none;
}

.sidebar-footer {
  background: rgba(0, 0, 0, 0.18);
  border-top: 1px solid var(--hbgs-hero-line);
  backdrop-filter: none;
}

/* Top header — flat, one hairline, no blur/shadow stack */
.top-header {
  min-height: 64px;
  padding: 12px 22px;
  background: var(--hbgs-surface);
  border-bottom: 1px solid var(--hbgs-line);
  backdrop-filter: none;
  box-shadow: none;
}

.page-title {
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--hbgs-ink);
}

.sidebar-toggle-btn,
.mobile-menu-btn,
.universal-search-btn,
.notification-btn,
.import-status-btn,
.header-offline-indicator,
.header-icon-btn {
  border-radius: 10px !important;
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--hbgs-line) !important;
  background: var(--hbgs-surface-2) !important;
  color: var(--hbgs-ink-2) !important;
  box-shadow: none;
}

.sidebar-toggle-btn:hover,
.mobile-menu-btn:hover,
.universal-search-btn:hover,
.notification-btn:hover,
.import-status-btn:hover,
.header-icon-btn:hover {
  transform: none;
  border-color: var(--hbgs-line-strong) !important;
  color: var(--hbgs-ink) !important;
  box-shadow: none;
}

/* ============================================================
   SHARED COMPONENTS
   ============================================================ */

.card,
.dash-widget,
.dash-panel,
.modal,
.hbgs-card {
  background: var(--hbgs-surface);
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius-lg);
  box-shadow: none;
}

.card:hover,
.dash-widget:hover,
.dash-panel:hover,
.hbgs-card:hover {
  box-shadow: none;
  border-color: var(--hbgs-line-strong);
}

.card-header,
.dash-widget-header,
.dash-panel-header,
.modal-header {
  background: var(--hbgs-surface-2);
  border-bottom: 1px solid var(--hbgs-line);
}

.card-title,
.dash-widget-title,
.dash-panel-title,
.modal-title {
  color: var(--hbgs-ink);
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Buttons — accent only on primary; everything else is quiet */
.btn {
  border-radius: 10px;
  min-height: 38px;
  font-weight: 600;
  letter-spacing: 0;
}

.btn-primary {
  background: var(--hbgs-accent);
  border-color: var(--hbgs-accent);
  color: #04130b;
  box-shadow: none;
}

.btn-primary:hover:not(:disabled) {
  background: var(--hbgs-accent-hover);
  border-color: var(--hbgs-accent-hover);
  transform: none;
  box-shadow: none;
}

.btn-secondary,
.btn-outline {
  background: var(--hbgs-surface-2);
  border: 1px solid var(--hbgs-line-strong);
  color: var(--hbgs-ink);
}

.form-input,
input[type="text"],
input[type="search"],
input[type="date"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
select,
textarea {
  background: var(--hbgs-surface-3);
  border: 1px solid var(--hbgs-line) !important;
  color: var(--hbgs-ink);
}

.form-input:focus,
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
  border-color: var(--hbgs-accent) !important;
  box-shadow: 0 0 0 3px var(--hbgs-accent-ring) !important;
}

/* ============================================================
   REUSABLE PAGE PRIMITIVES
   ============================================================ */

.hbgs-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.hbgs-page-kicker,
.hbgs-label {
  color: var(--hbgs-ink-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hbgs-page-title {
  margin: 0;
  color: var(--hbgs-ink);
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  letter-spacing: -0.025em;
}

.hbgs-page-subtitle {
  margin: 5px 0 0;
  color: var(--hbgs-ink-2);
  font-size: 14px;
  line-height: 1.45;
}

.hbgs-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px;
  background: var(--hbgs-surface-2);
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius-lg);
}

/* Status pills — quiet dot + text, one muted color each */
.hbgs-status-badge,
.status-badge,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--hbgs-radius-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--hbgs-line);
  background: var(--hbgs-surface-2);
  color: var(--hbgs-ink-2);
  text-transform: none;
}

.hbgs-status-badge::before,
.status-badge::before,
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: var(--hbgs-radius-pill);
  background: currentColor;
}

.hbgs-status-open,
.status-pending,
.status-open { color: var(--hbgs-warn) !important; }

.hbgs-status-progress,
.status-progress,
.status-in-progress { color: var(--hbgs-info) !important; }

.hbgs-status-done,
.status-complete,
.status-completed,
.status-resolved { color: var(--hbgs-ok) !important; }

.hbgs-status-danger,
.status-error,
.status-failed,
.status-cancelled,
.status-canceled { color: var(--hbgs-danger) !important; }

.hbgs-status-muted,
.status-disabled,
.status-muted { color: var(--hbgs-ink-3) !important; }

.hbgs-empty-state,
.data-empty,
.empty-state {
  border: 1px dashed var(--hbgs-line-strong);
  background: var(--hbgs-surface-2);
  border-radius: var(--hbgs-radius-lg);
  color: var(--hbgs-ink-3);
}

/* Student profile focus states (tested contract — keep selectors/values) */
.profile-subsection.profile-subsection-focused {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 45%, transparent);
}

.profile-timeline-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--hbgs-radius-pill);
  background: var(--hbgs-accent);
}

.profile-state-error {
  border-color: var(--hbgs-danger);
  background: color-mix(in srgb, var(--hbgs-danger) 14%, transparent);
}

.profile-empty-note {
  color: var(--hbgs-ink-3);
  font-size: 13px;
  line-height: 1.45;
}

/* ============================================================
   DASHBOARD
   ============================================================ */

.dash {
  gap: 28px;
  max-width: 1840px;
  margin-inline: auto;
}

.dash-mode-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius-lg);
  background: var(--hbgs-surface);
  color: var(--hbgs-ink);
}

.dash-mode-banner[data-mode="archive"] {
  background: color-mix(in srgb, var(--hbgs-info) 5%, var(--hbgs-surface));
  border-color: color-mix(in srgb, var(--hbgs-info) 24%, var(--hbgs-line));
}

.dash-mode-banner[data-mode="empty-active"] {
  background: color-mix(in srgb, var(--hbgs-warn) 6%, var(--hbgs-surface));
  border-color: color-mix(in srgb, var(--hbgs-warn) 26%, var(--hbgs-line));
}

.dash-mode-banner-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.dash-mode-kicker {
  color: var(--hbgs-ink-3);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dash-mode-banner-copy strong {
  color: var(--hbgs-ink);
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 750;
  line-height: 1.1;
}

.dash-mode-banner-copy > span:last-child {
  color: var(--hbgs-ink-2);
  font-size: 13px;
  line-height: 1.45;
}

.dash-mode-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.dash-mode-action {
  appearance: none;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius-pill);
  background: var(--hbgs-surface-2);
  color: var(--hbgs-ink-2);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 750;
}

.dash-mode-action:hover,
.dash-mode-action:focus-visible {
  border-color: var(--hbgs-line-strong);
  background: var(--hbgs-surface-3);
  color: var(--hbgs-ink);
  outline: none;
}

/* Beta dashboard structure: predictable, not scattered.
   The page now uses a simple rhythm: summary strip, clear section label,
   then one or two full-width work cards per row. */
.dash-ops-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.dash-ops-heading {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 0 2px 2px;
}

.dash-ops-heading span {
  color: var(--hbgs-ink);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.dash-ops-heading small {
  color: var(--hbgs-ink-3);
  font-size: 11px;
  font-weight: 500;
  text-align: right;
}

.dash-ops-card {
  display: flex;
  min-height: 96px;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 15px 16px;
  background: var(--hbgs-surface);
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius-lg);
  box-shadow: none;
  color: var(--hbgs-ink);
}

button.dash-ops-card {
  appearance: none;
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

button.dash-ops-card:hover,
button.dash-ops-card:focus-visible {
  background: var(--hbgs-surface-2);
  border-color: var(--hbgs-line-strong);
  outline: none;
}

.dash-ops-card strong {
  color: var(--hbgs-ink);
  font-size: clamp(20px, 2.2vw, 28px);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1;
}

.dash-ops-card > span:not(.dash-ops-label):not(.dash-ops-action) {
  color: var(--hbgs-ink-3);
  font-size: 11px;
}

.dash-ops-label {
  color: var(--hbgs-ink-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dash-ops-action {
  display: inline-flex;
  width: fit-content;
  margin-top: 5px;
  padding-top: 6px;
  border-top: 1px solid var(--hbgs-line);
  color: var(--hbgs-accent) !important;
  font-size: 11px !important;
  font-weight: 700;
}

.dash-ops-card.is-attention {
  border-color: color-mix(in srgb, var(--hbgs-danger) 42%, var(--hbgs-line));
  background: color-mix(in srgb, var(--hbgs-danger) 9%, var(--hbgs-surface));
}

.dash-ops-card.is-attention strong {
  color: var(--hbgs-danger);
}

.dash-ops-card.is-active:not(.is-attention) {
  border-color: color-mix(in srgb, var(--hbgs-accent) 36%, var(--hbgs-line));
}

.dash-ops-card.is-active:not(.is-attention) strong {
  color: var(--hbgs-accent);
}

.dash-widgets {
  display: grid !important;
  grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
  column-gap: 18px !important;
  row-gap: 22px !important;
  align-items: start;
}

.dash-zone-heading {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(170px, max-content) 1fr;
  align-items: center;
  gap: 16px;
  margin: 26px 0 -4px;
  padding: 16px 0 0;
  border-top: 1px solid var(--hbgs-line);
  color: var(--hbgs-ink);
}

.dash-zone-heading:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.dash-zone-heading span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dash-zone-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--hbgs-line);
  border-radius: 999px;
  background: var(--hbgs-surface);
  color: var(--hbgs-ink-2);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.dash-zone-heading small {
  display: block;
  color: var(--hbgs-ink-3);
  font-size: 11px;
  font-weight: 500;
}

.dash-widget[data-dashboard-size="full"] {
  grid-column: 1 / -1;
}

.dash-widget[data-dashboard-size="primary"] {
  grid-column: span 7;
}

.dash-widget[data-dashboard-size="secondary"] {
  grid-column: span 5;
}

.dash-widget[data-dashboard-size="third"] {
  grid-column: span 4;
}

.dash-widget[data-dashboard-priority="primary"] {
  border-color: color-mix(in srgb, var(--hbgs-accent) 18%, var(--hbgs-line)) !important;
}

.dash-widget[data-dashboard-priority="primary"] .dash-widget-header {
  background: color-mix(in srgb, var(--hbgs-accent) 5%, var(--hbgs-surface-2)) !important;
}

.dash-widget[data-dashboard-priority="reference"] {
  background: color-mix(in srgb, var(--hbgs-surface) 92%, var(--hbgs-bg)) !important;
}

.dash-widget[data-dashboard-priority="reference"] .dash-widget-title,
.dash-widget[data-dashboard-priority="reference"] .dash-widget-header {
  color: var(--hbgs-ink-2) !important;
}

.dash-widget[data-dashboard-zone="context"] .dash-widget-card,
.dash-widget[data-dashboard-zone="context"] .dash-widget-row,
.dash-widget[data-dashboard-zone="context"] .dash-leaderboard-item,
.dash-widget[data-dashboard-zone="context"] .dash-event-item {
  background: var(--hbgs-surface-2) !important;
}

/* Structural fallback if JavaScript data attributes are unavailable. */
#widgetAlerts,
#widgetQuickActions,
#widgetClassInsights {
  grid-column: span 7;
}

#widgetTodayAttendance,
#widgetAnnouncements,
#widgetWeeklySummary,
#widgetDistribution {
  grid-column: span 5;
}

#widgetStats,
#widgetCharts {
  grid-column: 1 / -1;
}

#widgetEvents,
#widgetLeaderboards,
#widgetBirthdaysActivity {
  grid-column: span 4;
}

/* Hero — one flat brand block, restrained type */
.dash-hero {
  min-height: 104px;
  background: var(--hbgs-hero-bg) !important;
  border: 1px solid var(--hbgs-hero-line);
  border-radius: var(--hbgs-radius-lg) !important;
  box-shadow: none;
  color: var(--hbgs-hero-ink);
}

.dash-hero-title {
  font-size: clamp(22px, 3vw, 30px) !important;
  font-weight: 700 !important;
  letter-spacing: -0.025em;
  color: var(--hbgs-hero-ink) !important;
}

.dash-hero-date {
  color: var(--hbgs-hero-ink-2) !important;
  font-weight: 500;
}

.dash-class-context {
  background: var(--hbgs-hero-well);
  border: 1px solid var(--hbgs-hero-line);
  border-radius: 12px;
  padding: 10px 12px;
  backdrop-filter: none;
}

.dash-class-filter-label {
  color: var(--hbgs-hero-ink-2) !important;
}

/* Widgets — flat cards, no top stripe, no glowing title dot */
.dash-attention-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hbgs-line);
}

.dash-panel-label {
  color: var(--hbgs-ink-3);
  font-size: 11px;
  font-weight: 700;
}

.dash-alert-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--hbgs-surface-2);
  border: 1px solid var(--hbgs-line);
  color: var(--hbgs-ink);
  font-size: 11px;
  font-weight: 800;
}

.dash-attention-content {
  padding: 8px;
}

.dash-widget {
  container-type: inline-size;
  min-width: 0;
  background: var(--hbgs-surface) !important;
  border: 1px solid var(--hbgs-line) !important;
  border-radius: var(--hbgs-radius-lg) !important;
  box-shadow: none;
  overflow: hidden;
}

.dash-widget:hover {
  transform: none;
  border-color: var(--hbgs-line-strong) !important;
}

.dash-widget-pulse {
  border-color: var(--hbgs-accent) !important;
  background: color-mix(in srgb, var(--hbgs-accent) 7%, var(--hbgs-surface)) !important;
  box-shadow: none !important;
}

.dash-widget::before {
  content: none;
}

.dash-widget-title::before {
  content: none;
}

.dash-widget-header {
  padding: 13px 16px !important;
  background: var(--hbgs-surface-2) !important;
  border-bottom: 1px solid var(--hbgs-line);
}

.dash-widget-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px !important;
  color: var(--hbgs-ink);
}

.dash-widget-drag {
  color: var(--hbgs-ink-3) !important;
  opacity: 0.5;
}

.dash-stats,
.dash-quick-actions {
  gap: 10px !important;
}

/* Stat strip — uniform calm cards; the NUMBER is always ink, never colored.
   Color lives only in the small leading icon chip, kept low-saturation. */
.dash-stat,
.dash-quick-action,
.dash-stat-card,
.dash-panel-card,
.dash-weather-card,
.dash-event-item,
.dash-activity-item {
  background: var(--hbgs-surface) !important;
  border: 1px solid var(--hbgs-line) !important;
  border-radius: var(--hbgs-radius) !important;
  box-shadow: none !important;
}

.dash-stat-clickable:hover,
.dash-quick-action:hover,
.dash-stat-card:hover,
.dash-panel-card:hover,
.dash-event-item:hover,
.dash-activity-item:hover {
  transform: none !important;
  border-color: var(--hbgs-line-strong) !important;
  box-shadow: none !important;
}

/* The loud part of the old design: kill multicolor stat numerals. */
.dash-stat-num,
.dash-stat-value,
.dash-panel-card .dash-stat-num {
  color: var(--hbgs-ink) !important;
}

/* Text severity chips for alerts: useful labels, not decorative emoji. */
.dash-alert-icon {
  min-width: 42px;
  width: auto !important;
  padding: 0 8px;
  color: var(--hbgs-ink);
  font-size: 10px !important;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dash-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid var(--hbgs-line);
  border-radius: 999px;
  color: var(--hbgs-ink-2) !important;
  font-size: 10px !important;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Beta 7 stat strip — one calm row; color signals action, not decoration */
.dash-stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  background: transparent;
  border: 0;
  overflow: visible;
}

.dash-stat-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  gap: 8px;
  padding: 20px 16px;
  background: var(--hbgs-surface);
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius-lg);
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  transition: background var(--transition-fast, 0.15s ease);
}

.dash-stat-cell:hover {
  background: var(--hbgs-surface-2);
}

.dash-stat-cell-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--hbgs-ink);
  letter-spacing: -0.02em;
}

.dash-stat-cell-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hbgs-ink-3);
}

/* Only cells that need action carry color */
.dash-stat-cell.is-alert .dash-stat-cell-value {
  color: var(--hbgs-danger);
}

.dash-stat-label,
.dash-stat-card .dash-stat-label {
  color: var(--hbgs-ink-3) !important;
}

/* Stat icon chips: a single restrained accent wash instead of 6 hues. */
.dash-stat-icon,
.dash-stat-icon.green,
.dash-stat-icon.blue,
.dash-stat-icon.orange,
.dash-stat-icon.purple,
.dash-stat-icon.teal,
.dash-stat-icon.red {
  background: var(--hbgs-accent-wash) !important;
  color: var(--hbgs-accent) !important;
  border-radius: 10px;
}

.dash-quick-action-icon {
  background: var(--hbgs-accent-wash);
  color: var(--hbgs-accent);
  border-radius: 10px;
  min-width: 48px;
  padding: 4px 8px;
  font-size: 10px !important;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Don't pulse / animate attention stats — calm, not flashing */
.dash-stat-urgent {
  border-color: var(--hbgs-danger) !important;
  background: var(--hbgs-surface) !important;
  animation: none !important;
}

/* Dashboard widget internals — semantic, flat, token-driven */
.dash-chart-card,
.dash-leaderboard-card,
.dash-dist-card,
.dash-summary-card,
.dash-alerts-container,
.dash-widget-card,
.dash-announcement {
  background: var(--hbgs-surface) !important;
  border: 1px solid var(--hbgs-line) !important;
  border-radius: var(--hbgs-radius-lg) !important;
  box-shadow: none !important;
  overflow: hidden;
}

.dash-chart-card::before,
.dash-leaderboard-card::before,
.dash-dist-card::before,
.dash-summary-card::before,
.dash-alerts-container::before {
  content: none !important;
}

.dash-chart-card:hover,
.dash-leaderboard-card:hover,
.dash-dist-card:hover,
.dash-summary-card:hover,
.dash-event-item:hover,
.dash-quick-action:hover,
.dash-widget-row:hover {
  transform: none !important;
  box-shadow: none !important;
  border-color: var(--hbgs-line-strong) !important;
}

.dash-widget-card-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--hbgs-line);
  background: var(--hbgs-surface-2);
}

.dash-widget-card-title,
.dash-chart-title,
.dash-leaderboard-title,
.dash-dist-title {
  color: var(--hbgs-ink) !important;
  font-size: 13px !important;
  font-weight: 750 !important;
  letter-spacing: -0.01em;
}

.dash-widget-card-body {
  padding: 8px;
}

.dash-widget-card-body.is-padded {
  padding: 16px;
}

.dash-widget-card-body.is-scrollable {
  max-height: 300px;
  overflow-y: auto;
}

.dash-widget-card-subhead {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 4px 10px;
  color: var(--hbgs-ink-2);
  font-size: 13px;
}

.dash-widget-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dash-widget-row,
.dash-leaderboard-item,
.dash-insight-item {
  display: flex !important;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px !important;
  border: 1px solid transparent;
  border-radius: var(--hbgs-radius);
  background: var(--hbgs-surface-2) !important;
  color: var(--hbgs-ink) !important;
  box-shadow: none !important;
}

.dash-attendance-item,
.birthday-item-clickable,
.dash-leaderboard-item,
.dash-insight-item {
  cursor: pointer;
}

.dash-row-main,
.dash-announcement-body {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.dash-row-title,
.dash-announcement-title {
  color: var(--hbgs-ink);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-row-title-wrap {
  white-space: normal;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.dash-row-subtitle,
.dash-announcement-message {
  color: var(--hbgs-ink-2);
  font-size: 11px;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-row-meta,
.dash-announcement-meta,
.dash-widget-more {
  color: var(--hbgs-ink-3);
  font-size: 11px;
  font-weight: 600;
}

.dash-widget-more {
  padding: 8px 10px;
  text-align: center;
}

.dash-row-token,
.dash-announcement-chip,
.dash-chip,
.dash-pin-note {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: var(--hbgs-radius-pill);
  border: 1px solid var(--hbgs-line);
  background: var(--hbgs-surface);
  color: var(--hbgs-ink-2);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
}

.dash-row-token,
.dash-announcement-chip {
  min-width: 34px;
  min-height: 24px;
  padding: 3px 8px;
}

.dash-chip,
.dash-pin-note {
  min-height: 24px;
  padding: 4px 8px;
}

.dash-tone-danger,
.dash-chip.dash-tone-danger {
  border-color: color-mix(in srgb, var(--hbgs-danger) 34%, var(--hbgs-line)) !important;
  color: var(--hbgs-danger) !important;
}

.dash-tone-warning,
.dash-chip.dash-tone-warning {
  border-color: color-mix(in srgb, #d97706 34%, var(--hbgs-line)) !important;
  color: #92400e !important;
}

.dash-tone-info,
.dash-chip.dash-tone-info {
  border-color: color-mix(in srgb, var(--hbgs-info) 28%, var(--hbgs-line)) !important;
  color: var(--hbgs-info) !important;
}

.dash-tone-success,
.dash-chip.dash-tone-success,
.dash-tone-ok,
.dash-chip.dash-tone-ok {
  border-color: color-mix(in srgb, var(--hbgs-ok) 30%, var(--hbgs-line)) !important;
  color: var(--hbgs-ok) !important;
}

.dash-tone-accent,
.dash-chip.dash-tone-accent {
  border-color: color-mix(in srgb, var(--hbgs-accent) 30%, var(--hbgs-line)) !important;
  color: var(--hbgs-accent-ink) !important;
}

.dash-announcement {
  display: flex;
  gap: 12px;
  padding: 14px;
  margin: 0 0 10px;
}

.dash-announcement-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.dash-empty-flat,
.dash-loading-centered {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 80px;
  padding: 18px;
  color: var(--hbgs-ink-2);
  text-align: center;
}

.dash-dist-fill {
  background: var(--hbgs-accent);
}

.dash-dist-fill.dash-tone-warning { background: #d97706; }
.dash-dist-fill.dash-tone-info { background: var(--hbgs-info); }
.dash-dist-fill.dash-tone-success { background: var(--hbgs-ok); }

.dash-row-avatar {
  width: 28px !important;
  height: 28px !important;
}

.is-birthday-today {
  border-color: color-mix(in srgb, var(--hbgs-accent) 32%, var(--hbgs-line)) !important;
}

@media (max-width: 640px) {
  .dash-widget-row,
  .dash-leaderboard-item,
  .dash-insight-item {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .dash-row-main,
  .dash-row-title-wrap {
    flex-basis: min(100%, 180px);
  }
}

/* ============================================================
   TABLES
   ============================================================ */

.table-container,
.data-table-wrapper,
.table-responsive {
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius-lg);
  overflow: hidden;
  background: var(--hbgs-surface);
}

.main-content table thead th,
.main-content .data-table th {
  background: var(--hbgs-surface-2) !important;
  color: var(--hbgs-ink-3) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
}

.main-content table tbody tr:hover,
.main-content .data-table tbody tr:hover {
  background: var(--hbgs-surface-2) !important;
}

/* v7.0.0-beta.69: Dashboard helpers used by the current app shell. */
.dash-ops-summary {
  grid-template-columns: minmax(220px, 0.8fr) repeat(4, minmax(0, 1fr));
  align-items: stretch;
}

.dash-ops-heading {
  display: flex;
  min-width: 0;
  min-height: 96px;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  color: var(--hbgs-ink);
}

.dash-ops-heading span {
  font-size: 15px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.dash-ops-heading small {
  color: var(--hbgs-ink-3);
  font-size: 12px;
  line-height: 1.35;
}

.dash-mode-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius-lg);
  background: var(--hbgs-surface-2);
  color: var(--hbgs-ink-2);
}

.dash-mode-banner.hidden {
  display: none !important;
}

.dash-mode-banner-copy {
  flex: 1 1 320px;
  min-width: 0;
  line-height: 1.4;
}

/* Laptop dashboard: the app shell keeps a persistent sidebar, so the content
   well is much narrower than the browser viewport on 13"/14" laptops. Collapse
   the operational widgets earlier so nested attendance/birthday panels do not
   get clipped in narrow 5/12 columns, but keep the top summary readable. */
@media (max-width: 1500px) {
  .dash-ops-summary {
    grid-template-columns: minmax(200px, 0.8fr) repeat(4, minmax(150px, 1fr));
  }

  .dash-widgets {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }

  .dash-zone-heading,
  .dash-widget[data-dashboard-size="full"],
  .dash-widget[data-dashboard-size="primary"],
  .dash-widget[data-dashboard-size="secondary"],
  #widgetStats,
  #widgetTodayAttendance,
  #widgetQuickActions,
  #widgetAnnouncements,
  #widgetAlerts,
  #widgetCharts,
  #widgetWeeklySummary,
  #widgetClassInsights,
  #widgetDistribution {
    grid-column: 1 / -1;
  }

  .dash-widget[data-dashboard-size="third"],
  #widgetEvents,
  #widgetLeaderboards,
  #widgetBirthdaysActivity {
    grid-column: span 3;
  }
}

@media (max-width: 1180px) {
  .dash-ops-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-ops-heading {
    grid-column: 1 / -1;
    min-height: 0;
  }

  .dash-widget[data-dashboard-zone],
  .dash-widget[data-dashboard-size],
  #widgetStats,
  #widgetTodayAttendance,
  #widgetQuickActions,
  #widgetAnnouncements,
  #widgetAlerts,
  #widgetCharts,
  #widgetWeeklySummary,
  #widgetClassInsights,
  #widgetDistribution,
  #widgetLeaderboards,
  #widgetBirthdaysActivity,
  #widgetEvents {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .dash-widgets {
    grid-template-columns: 1fr !important;
  }

  .dash-zone-heading,
  .dash-ops-heading {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .dash-ops-heading small {
    text-align: left;
  }
}

@media (max-width: 720px) {
  .dash-ops-summary {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================================
   MODERN APP UPGRADE LAYER
   ============================================================ */

/* App shell: more product-like, less collection-of-pages. */
.main-wrapper {
  background: var(--hbgs-bg);
}

.main-content {
  padding: clamp(16px, 2.2vw, 28px);
  scroll-padding-top: 84px;
}

.top-header {
  gap: 14px;
  background: var(--hbgs-surface) !important;
  backdrop-filter: none;
}

.page-title-section {
  min-width: 0;
}

.header-actions {
  gap: 8px;
}

.header-user-btn,
.header-dropdown-menu,
.notification-panel,
.import-status-panel,
.universal-search-panel {
  background: var(--hbgs-surface) !important;
  border: 1px solid var(--hbgs-line) !important;
  box-shadow: none !important;
}

.header-user-avatar {
  background: var(--hbgs-accent) !important;
  color: #04130b !important;
}

.header-dropdown-item,
.notification-item,
.import-status-item,
.universal-search-result {
  min-height: 44px;
}

.nav-item {
  isolation: isolate;
}

.nav-item.active::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: var(--hbgs-radius-pill);
  background: var(--hbgs-accent);
}

.nav-section-items {
  display: grid;
  gap: 2px;
}

/* Shared page rhythm. These selectors intentionally target existing classes so
   old pages inherit the same upgraded structure without route rewrites. */
.page-header,
.page-title-section-block,
.hbgs-page-header {
  padding: 16px 18px;
  background: var(--hbgs-surface);
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius-lg);
}

.page-header .page-title,
.card-title,
.modal-title {
  letter-spacing: -0.02em;
}

.page-subtitle,
.card-subtitle,
.modal-help,
.form-help,
.help-text,
.description-text {
  color: var(--hbgs-ink-2) !important;
  line-height: 1.45;
}

.page-header-actions,
.card-actions,
.card-header-actions,
.filter-row,
.filters-row,
.search-filter-row,
.toolbar,
.hbgs-toolbar {
  gap: 10px;
}

.card,
.table-container,
.data-table-wrapper,
.table-responsive,
.settings-section,
.admin-section,
.panel,
.section-card,
.stats-card {
  background: var(--hbgs-surface) !important;
  border: 1px solid var(--hbgs-line) !important;
  border-radius: var(--hbgs-radius-lg) !important;
  box-shadow: none !important;
}

.card-header,
.card-controls,
.card-footer,
.table-toolbar,
.section-header,
.panel-header {
  background: var(--hbgs-surface-2) !important;
  border-color: var(--hbgs-line) !important;
}

.card-body,
.panel-body,
.section-body {
  color: var(--hbgs-ink);
}

/* Tables: calmer density, sticky headers, clear hover without visual noise. */
.main-content table,
.data-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: 100%;
}

.main-content table thead th,
.main-content .data-table thead th,
.main-content .data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--hbgs-surface-2) !important;
  border-bottom: 1px solid var(--hbgs-line) !important;
  color: var(--hbgs-ink-3) !important;
  font-size: 11px !important;
  font-weight: 750 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
}

.main-content table td,
.main-content .data-table td {
  border-bottom: 1px solid var(--hbgs-line);
  color: var(--hbgs-ink-2);
}

.main-content table tbody tr,
.main-content .data-table tbody tr {
  transition: background 120ms ease;
}

.main-content table tbody tr:hover,
.main-content .data-table tbody tr:hover {
  background: var(--hbgs-surface-2) !important;
}

/* Forms and filters: consistent focus, clearer disabled/read-only treatment. */
.form-group {
  gap: 6px;
}

.form-label,
label {
  color: var(--hbgs-ink-2);
  font-weight: 650;
}

input[readonly],
textarea[readonly],
select[disabled],
input:disabled,
textarea:disabled,
.btn:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  border-radius: 10px !important;
}

/* Buttons: modern pressed/focus feedback, but no flashy lift. */
.btn,
button,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

.btn:focus-visible,
.nav-item:focus-visible,
.dash-quick-action:focus-visible,
.dash-stat-cell:focus-visible,
.header-user-btn:focus-visible,
.header-dropdown-item:focus-visible {
  outline: 3px solid var(--hbgs-accent-ring) !important;
  outline-offset: 2px;
}

.btn:active:not(:disabled),
.dash-quick-action:active,
.dash-stat-cell:active {
  transform: translateY(1px) !important;
}

.btn-danger,
.btn-outline.btn-danger,
.danger-btn {
  color: var(--hbgs-danger) !important;
  border-color: color-mix(in srgb, var(--hbgs-danger) 42%, var(--hbgs-line)) !important;
}

/* Empty/loading states make old pages feel intentional instead of unfinished. */
.data-empty,
.empty-state,
.hbgs-empty-state,
.no-results,
.no-data {
  display: grid;
  place-items: center;
  min-height: 96px;
  padding: 20px;
  text-align: center;
}

.dash-loading,
.loading,
.loading-state,
.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--hbgs-radius);
}

.dash-loading::after,
.loading-state::after,
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--hbgs-ink) 8%, transparent), transparent);
  animation: hbgs-skeleton-sheen 1.4s ease-in-out infinite;
}

@keyframes hbgs-skeleton-sheen {
  to { transform: translateX(100%); }
}

/* Modals/toasts: consistent product quality across old modules. */
.modal-backdrop.open {
  backdrop-filter: none;
}

.modal {
  border: 1px solid var(--hbgs-line) !important;
  box-shadow: none !important;
}

.modal-footer {
  background: var(--hbgs-surface-2);
  border-top: 1px solid var(--hbgs-line) !important;
}

.toast,
.toast-message,
.notification-toast {
  border: 1px solid var(--hbgs-line) !important;
  border-radius: var(--hbgs-radius-lg) !important;
  background: var(--hbgs-surface) !important;
  color: var(--hbgs-ink) !important;
  box-shadow: none !important;
}

.toast-success { border-left: 4px solid var(--hbgs-ok) !important; }
.toast-warning { border-left: 4px solid var(--hbgs-warn) !important; }
.toast-error { border-left: 4px solid var(--hbgs-danger) !important; }
.toast-info { border-left: 4px solid var(--hbgs-info) !important; }

/* High-traffic pages: consistent toolbar/cards without touching business logic. */
.hbgs-page-tabs,
.tabs-row,
.students-toolbar,
.attendance-toolbar,
.copy-requests-toolbar,
.tech-support-toolbar,
.admin-toolbar,
.reports-toolbar,
.controls-bar,
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px;
  background: var(--hbgs-surface-2);
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius-lg);
}

.student-card,
.staff-card,
.request-card,
.ticket-card,
.attendance-card,
.report-card,
.admin-card {
  background: var(--hbgs-surface) !important;
  border: 1px solid var(--hbgs-line) !important;
  border-radius: var(--hbgs-radius-lg) !important;
  box-shadow: none !important;
}

.student-card:hover,
.staff-card:hover,
.request-card:hover,
.ticket-card:hover,
.attendance-card:hover,
.report-card:hover,
.admin-card:hover {
  border-color: var(--hbgs-line-strong) !important;
  transform: none !important;
}

/* Page-level cleanup classes for high-traffic screens. */
.hbgs-stat-grid {
  display: grid;
  gap: 1px;
  margin-bottom: 18px;
  overflow: hidden;
  background: var(--hbgs-line);
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius-lg);
}

.hbgs-stat-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hbgs-stat-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hbgs-stat-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hbgs-stat-grid--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.hbgs-stat-cell {
  display: flex;
  min-height: 68px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 8px;
  background: var(--hbgs-surface);
  text-align: center;
}

.hbgs-stat-value {
  color: var(--hbgs-ink);
  font-size: 22px;
  font-weight: 780;
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.hbgs-stat-value.is-danger { color: var(--hbgs-danger); }
.hbgs-stat-value.is-warn { color: var(--hbgs-warn); }
.hbgs-stat-value.is-info { color: var(--hbgs-info); }
.hbgs-stat-value.is-ok { color: var(--hbgs-ok); }

.hbgs-stat-label {
  color: var(--hbgs-ink-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hbgs-scroll-shell {
  max-height: min(620px, 68vh);
  overflow-y: auto;
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius-lg);
  background: var(--hbgs-surface);
}

.hbgs-filter-line {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hbgs-filter-line > .btn,
.hbgs-filter-line > select,
.hbgs-filter-line > input {
  flex: 1 1 140px;
}

.hbgs-filter-label {
  color: var(--hbgs-ink-2);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.hbgs-note-box {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius);
  background: var(--hbgs-surface-2);
  color: var(--hbgs-ink-2);
  font-size: 13px;
  line-height: 1.5;
}

.hbgs-note-box strong {
  color: var(--hbgs-ink);
}

.hbgs-inline-help {
  margin-top: 4px;
  color: var(--hbgs-ink-3);
  font-size: 11px;
  line-height: 1.4;
}

.hbgs-status-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--hbgs-radius-pill);
  background: var(--hbgs-surface-2);
  color: var(--hbgs-ink-2);
  border: 1px solid var(--hbgs-line);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hbgs-status-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: var(--hbgs-radius-pill);
  background: currentColor;
}

.hbgs-status-dot.is-danger { color: var(--hbgs-danger); }
.hbgs-status-dot.is-info { color: var(--hbgs-info); }
.hbgs-status-dot.is-ok { color: var(--hbgs-ok); }
.hbgs-status-dot.is-warn { color: var(--hbgs-warn); }

.hbgs-modal-sm { max-width: 400px !important; }
.hbgs-modal-md { max-width: 540px !important; }
.hbgs-modal-lg { max-width: 640px !important; }

.hbgs-required { color: var(--hbgs-danger); }
.hbgs-footer-count { margin-left: 12px; }
.student-row-clickable { cursor: pointer; }
.hbgs-file-input { padding: 10px !important; }
.hbgs-hidden { display: none !important; }
.hbgs-mb-16 { margin-bottom: 16px !important; }
.hbgs-mt-16 { margin-top: 16px !important; }
.hbgs-ml-auto { margin-left: auto !important; }

.hbgs-splash-logo {
  display: block;
  width: clamp(220px, 34vw, 360px);
  max-width: 100%;
  height: auto;
  margin: 0 0 28px;
  filter: none;
}

.hbgs-splash-status {
  margin-top: 9px;
  color: rgba(255, 255, 255, .72);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .01em;
  line-height: 1.5;
}

.hbgs-splash-progress {
  position: relative;
  width: min(180px, 48vw);
  height: 2px;
  margin-top: 24px;
  overflow: hidden;
  background: rgba(255, 255, 255, .16);
}

/* Dashboard: strengthen the office-operations feel. */
.dash-hero {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
}

.dash-skeleton-grid {
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)) !important;
  gap: 16px !important;
  padding: 16px;
}

.dash-skeleton-widget {
  min-height: 200px;
}

.dash-birthdays-activity-grid,
.dash-attendance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-height: 60px;
  min-width: 0;
  padding: 16px;
}

.dash-birthdays-activity-grid > *,
.dash-attendance-grid > * {
  min-width: 0;
}

.dash-widget-card {
  display: flex;
  min-width: 0;
  min-height: 150px;
  flex-direction: column;
  overflow: hidden;
  background: var(--hbgs-surface);
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius-lg);
}

.dash-widget-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--hbgs-line);
  background: var(--hbgs-surface-2);
}

.dash-widget-card-title,
.dash-widget-card-subhead {
  color: var(--hbgs-ink);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.dash-widget-card-body {
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.dash-widget-card-body.is-padded {
  padding: 16px;
}

.dash-widget-card-body.is-scrollable {
  max-height: 320px;
  overflow-y: auto;
}

.dash-empty,
.dash-empty-flat {
  display: grid;
  min-height: 106px;
  place-items: center;
  padding: 18px;
  text-align: center;
  color: var(--hbgs-ink-3);
  font-size: 14px;
  line-height: 1.4;
}

.dash-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius-pill);
  padding: 3px 9px;
  background: var(--hbgs-surface-2);
  color: var(--hbgs-ink-2);
  font-size: 11px;
  font-weight: 700;
}

.dash-row-title,
.dash-row-title-wrap {
  min-width: 0;
  color: var(--hbgs-ink);
  font-weight: 650;
  overflow-wrap: anywhere;
}

.dash-tone-danger { border-color: color-mix(in srgb, var(--hbgs-danger) 42%, var(--hbgs-line)); }
.dash-tone-warning { border-color: color-mix(in srgb, var(--hbgs-warn) 42%, var(--hbgs-line)); }
.dash-tone-info { border-color: color-mix(in srgb, var(--hbgs-info) 34%, var(--hbgs-line)); }
.dash-tone-success { border-color: color-mix(in srgb, var(--hbgs-ok) 34%, var(--hbgs-line)); }

@container (max-width: 620px) {
  .dash-birthdays-activity-grid,
  .dash-attendance-grid {
    grid-template-columns: 1fr !important;
  }
}

.dash-loading-full {
  grid-column: 1 / -1;
  padding: 20px;
  text-align: center;
  color: var(--hbgs-ink-2);
}

.dash-zone-heading {
  min-height: 38px;
}

.dash-zone-heading span {
  color: var(--hbgs-ink);
}

.dash-zone-heading small {
  max-width: 760px;
}

.dash-widget-header {
  min-height: 48px;
}

.dash-quick-actions {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
}

.dash-quick-action {
  min-height: 68px;
  align-items: flex-start !important;
  justify-content: center;
  padding: 14px !important;
}

.dash-quick-action-label {
  color: var(--hbgs-ink);
  font-weight: 700;
}

.dash-announcement,
.dash-dist-card,
.dash-leaderboard-card,
.dash-insight-section {
  background: var(--hbgs-surface) !important;
  border: 1px solid var(--hbgs-line) !important;
  border-radius: var(--hbgs-radius) !important;
  box-shadow: none !important;
}

.dash-chart-title,
.dash-dist-title,
.dash-leaderboard-title,
.dash-insight-header {
  color: var(--hbgs-ink) !important;
  font-size: 13px !important;
  font-weight: 750 !important;
  letter-spacing: -0.01em;
}

/* Dashboard breathing-room pass: fewer side-by-side widgets and roomier internals. */
.dash-charts,
.dash-leaderboards,
.dash-birthdays-activity-grid,
.dash-attendance-grid {
  gap: 24px !important;
}

.dash-charts {
  grid-template-columns: repeat(auto-fit, minmax(520px, 1fr)) !important;
}

.dash-leaderboards {
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)) !important;
}

.dash-birthdays-activity-grid,
.dash-attendance-grid {
  grid-template-columns: repeat(2, minmax(360px, 1fr)) !important;
}

.dash-chart-card,
.dash-leaderboard-card,
.dash-dist-card,
.dash-summary-card,
.dash-alerts-container,
.dash-widget-card {
  padding: 24px !important;
}

.dash-widget-card {
  padding: 0 !important;
}

.dash-widget-card-header {
  padding: 16px 18px !important;
}

.dash-widget-card-body {
  padding: 14px !important;
}

.dash-widget-card-body.is-padded {
  padding: 22px !important;
}

.dash-widget-card-body.is-scrollable {
  max-height: 420px;
}

.dash-widget-list,
.dash-leaderboard-list {
  gap: 12px !important;
}

.dash-widget-row,
.dash-leaderboard-item,
.dash-insight-item {
  min-height: 56px;
  gap: 14px;
  padding: 12px 14px !important;
}

.dash-chart-container {
  height: clamp(240px, 17vw, 320px) !important;
}

@media (max-width: 1240px) {
  .dash-charts,
  .dash-leaderboards,
  .dash-birthdays-activity-grid,
  .dash-attendance-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 600px) {
  .dash {
    gap: 18px;
  }

  .dash-widgets {
    gap: 16px !important;
  }

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

/* ============================================================
   UNIFIED UI FINAL PASS
   ============================================================ */

/* Normalize older page-specific modules into the same flat operations system. */
.bookmark-card,
.call-log-card,
.time-off-card,
.trip-card,
.analytics-card,
.report-widget,
.website-request-card,
.device-card,
.supply-card,
.announcement-card,
.settings-card,
.summary-card,
.metric-card,
.stat-card {
  background: var(--hbgs-surface) !important;
  border: 1px solid var(--hbgs-line) !important;
  border-radius: var(--hbgs-radius-lg) !important;
  box-shadow: none !important;
  color: var(--hbgs-ink);
}

.bookmark-card:hover,
.call-log-card:hover,
.time-off-card:hover,
.trip-card:hover,
.analytics-card:hover,
.report-widget:hover,
.website-request-card:hover,
.device-card:hover,
.supply-card:hover,
.announcement-card:hover,
.settings-card:hover,
.summary-card:hover,
.metric-card:hover,
.stat-card:hover {
  border-color: var(--hbgs-line-strong) !important;
  box-shadow: none !important;
  transform: none !important;
}

.card h1,
.card h2,
.card h3,
.panel h1,
.panel h2,
.panel h3,
.section-card h1,
.section-card h2,
.section-card h3 {
  color: var(--hbgs-ink);
  letter-spacing: -0.02em;
}

.card small,
.card .muted,
.panel small,
.panel .muted,
.section-card small,
.section-card .muted {
  color: var(--hbgs-ink-3) !important;
}

/* ============================================================
   SCHEDULE BUILDER PAGE UNIFICATION
   ============================================================ */

.schedule-builder-unified {
  max-width: 1400px;
}

.schedule-builder-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  flex-wrap: wrap !important;
  gap: 16px !important;
}

.schedule-builder-stats-grid {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  gap: 8px !important;
  margin-bottom: 24px !important;
  padding: 12px !important;
  border: 1px solid var(--hbgs-line) !important;
  border-radius: var(--hbgs-radius-lg) !important;
  background: var(--hbgs-surface) !important;
  box-shadow: none !important;
}

.schedule-builder-stat {
  position: relative !important;
  text-align: center !important;
}

.schedule-builder-stat-value {
  color: var(--hbgs-ink) !important;
  font-size: 22px !important;
  font-weight: 800 !important;
}

.schedule-builder-stat-label {
  margin-top: 4px !important;
  color: var(--hbgs-ink-3) !important;
  font-size: 9px !important;
  font-weight: 700 !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
}

.schedule-builder-stat-divider {
  position: absolute !important;
  top: 15% !important;
  right: 0 !important;
  width: 1px !important;
  height: 70% !important;
  background: var(--hbgs-line) !important;
}

.schedule-builder-unified .tabs-row {
  background: var(--hbgs-surface) !important;
  border: 1px solid var(--hbgs-line) !important;
  border-radius: var(--hbgs-radius-lg) !important;
  box-shadow: none !important;
}

.schedule-builder-unified .tabs-row .tab-btn {
  min-height: 40px !important;
  color: var(--hbgs-ink-2) !important;
  border: 1px solid transparent !important;
  box-shadow: none !important;
}

.schedule-builder-unified .tabs-row .tab-btn:hover {
  background: var(--hbgs-surface-2) !important;
  color: var(--hbgs-ink) !important;
}

.schedule-builder-unified .tabs-row .tab-btn.active {
  background: color-mix(in srgb, var(--hbgs-accent) 12%, var(--hbgs-surface)) !important;
  border-color: var(--hbgs-accent) !important;
  color: var(--hbgs-ink) !important;
}

.schedule-builder-unified .builder-card,
.schedule-builder-unified .grid-container,
.schedule-builder-unified .conflict-card,
.schedule-builder-unified .para-card,
.schedule-builder-unified .absence-card,
.schedule-builder-warning-panel,
.schedule-builder-success-panel {
  background: var(--hbgs-surface) !important;
  border: 1px solid var(--hbgs-line) !important;
  border-radius: var(--hbgs-radius-lg) !important;
  box-shadow: none !important;
  transform: none !important;
}

.schedule-builder-unified .builder-card::before,
.schedule-builder-unified .conflict-card::before,
.schedule-builder-unified .para-card::before,
.schedule-builder-unified .absence-card::before {
  content: none !important;
}

.schedule-builder-unified .builder-card:hover,
.schedule-builder-unified .conflict-card:hover,
.schedule-builder-unified .para-card:hover,
.schedule-builder-unified .absence-card:hover {
  box-shadow: none !important;
  transform: none !important;
}

.schedule-builder-table {
  width: 100% !important;
  border: 1px solid var(--hbgs-line) !important;
  border-radius: var(--hbgs-radius) !important;
  background: var(--hbgs-surface) !important;
  box-shadow: none !important;
}

.schedule-builder-table th {
  background: var(--hbgs-surface-2) !important;
  color: var(--hbgs-ink-3) !important;
}

.schedule-builder-actions-cell,
.schedule-builder-inline-actions {
  display: flex !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
}

.schedule-builder-warning-panel,
.schedule-builder-success-panel {
  padding: 16px !important;
  margin-bottom: 16px !important;
}

.schedule-builder-warning-panel {
  border-color: color-mix(in srgb, var(--hbgs-warn) 42%, var(--hbgs-line)) !important;
  background: color-mix(in srgb, var(--hbgs-warn) 10%, var(--hbgs-surface)) !important;
}

.schedule-builder-success-panel {
  border-color: color-mix(in srgb, var(--hbgs-ok) 42%, var(--hbgs-line)) !important;
  background: color-mix(in srgb, var(--hbgs-ok) 10%, var(--hbgs-surface)) !important;
}

/* ============================================================
   ADMIN DATA IMPORT PAGE UNIFICATION
   ============================================================ */

.data-import-page-header {
  align-items: flex-start;
}

.data-import-page-header h1 {
  margin: 2px 0 6px;
}

.data-import-page-header p,
.data-import-workflow-header p,
.data-import-group-header p {
  margin: 0;
  max-width: 72ch;
  color: var(--hbgs-ink-3);
  font-size: 13px;
  line-height: 1.5;
}

.data-import-eyebrow {
  display: block;
  color: var(--hbgs-accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.data-import-workflow {
  padding: 20px;
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius-lg);
  background: var(--hbgs-surface);
  box-shadow: none;
}

.data-import-workflow-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.data-import-workflow-header h2,
.data-import-group-header h2 {
  margin: 3px 0 5px;
  color: var(--hbgs-ink);
  font-size: 20px;
  letter-spacing: -0.02em;
}

.data-import-workflow-badge {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid color-mix(in srgb, var(--hbgs-accent) 38%, var(--hbgs-line));
  border-radius: var(--hbgs-radius-pill);
  background: color-mix(in srgb, var(--hbgs-accent) 8%, var(--hbgs-surface));
  color: var(--hbgs-accent);
  font-size: 11px;
  font-weight: 800;
}

.data-import-workflow-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius);
  overflow: hidden;
}

.data-import-step-card {
  display: flex;
  min-width: 0;
  min-height: 118px;
  padding: 15px;
  flex-direction: column;
  gap: 5px;
  color: var(--hbgs-ink);
  text-decoration: none;
  background: var(--hbgs-surface);
  border-right: 1px solid var(--hbgs-line);
}

.data-import-step-card:last-child {
  border-right: 0;
}

.data-import-step-card:hover,
.data-import-step-card:focus-visible {
  background: var(--hbgs-surface-2);
}

.data-import-step-card:focus-visible {
  outline: 2px solid var(--hbgs-accent);
  outline-offset: -2px;
}

.data-import-step-card--primary {
  box-shadow: inset 4px 0 0 var(--hbgs-accent);
}

.data-import-step-number {
  color: var(--hbgs-accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.data-import-step-card strong {
  font-size: 14px;
}

.data-import-step-card small {
  color: var(--hbgs-ink-3);
  font-size: 12px;
  line-height: 1.4;
}

.data-import-workflow-grid {
  display: grid;
  gap: 14px;
}

.admin-data-import-page .data-import-workflow-card {
  scroll-margin-top: 88px;
}

.admin-data-import-page .data-import-workflow-card--primary {
  border-left: 4px solid var(--hbgs-accent) !important;
}

.data-import-group-header {
  padding: 10px 2px 0;
}

@media (max-width: 760px) {
  .data-import-workflow,
  .admin-data-import-page .data-import-section {
    padding: 16px !important;
  }

  .data-import-workflow-header {
    flex-direction: column;
  }

  .data-import-workflow-badge {
    align-self: flex-start;
  }

  .data-import-workflow-steps {
    grid-template-columns: 1fr;
  }

  .data-import-step-card {
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--hbgs-line);
  }

  .data-import-step-card:last-child {
    border-bottom: 0;
  }
}

.admin-data-import-page .data-import-section {
  background: var(--hbgs-surface) !important;
  border: 1px solid var(--hbgs-line) !important;
  border-radius: var(--hbgs-radius-lg) !important;
  padding: 20px !important;
  box-shadow: none !important;
}

.admin-data-import-page .data-import-section--warning {
  border-color: color-mix(in srgb, var(--hbgs-warn) 45%, var(--hbgs-line)) !important;
}

.data-import-section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.data-import-section-header h3 {
  margin: 0 0 4px;
  color: var(--hbgs-ink);
  letter-spacing: -0.01em;
}

.data-import-section-description,
.data-import-meta-label,
.data-import-status,
.data-import-note,
.data-import-muted {
  color: var(--hbgs-ink-3) !important;
  font-size: 13px;
}

.data-import-section-description {
  margin: 0;
  line-height: 1.45;
}

.data-import-meta {
  text-align: right;
  flex-shrink: 0;
}

.data-import-meta-value {
  color: var(--hbgs-ink);
  font-weight: 600;
}

.data-import-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.data-import-file-input {
  flex: 1 1 220px;
  min-width: 200px;
}

.data-import-password-input {
  flex: 0 1 220px;
}

.data-import-period-select {
  min-width: 110px;
}

.data-import-danger-action {
  border-color: color-mix(in srgb, var(--hbgs-danger) 45%, var(--hbgs-line)) !important;
  color: var(--hbgs-danger) !important;
  background: transparent !important;
}

.data-import-status {
  margin-top: 12px;
  line-height: 1.45;
}

.data-import-success {
  color: var(--hbgs-ok) !important;
}

.data-import-progress {
  color: var(--hbgs-accent) !important;
}

.data-import-error,
.data-import-error-line {
  color: var(--hbgs-danger) !important;
}

.data-import-warning-line {
  display: block;
  margin-top: 6px;
  color: var(--hbgs-warn) !important;
  font-size: 11px;
}

.data-import-note {
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius);
  padding: 10px 12px;
  line-height: 1.45;
}

.data-import-note--spaced {
  margin-bottom: 14px;
}

.data-import-note--compact {
  margin-bottom: 10px;
}

.data-import-note--warning {
  border-color: color-mix(in srgb, var(--hbgs-warn) 42%, var(--hbgs-line));
  background: color-mix(in srgb, var(--hbgs-warn) 11%, var(--hbgs-surface));
}

.data-import-note--info {
  border-color: color-mix(in srgb, var(--hbgs-accent) 38%, var(--hbgs-line));
  background: color-mix(in srgb, var(--hbgs-accent) 8%, var(--hbgs-surface));
}

.data-import-note--success {
  border-color: color-mix(in srgb, var(--hbgs-ok) 38%, var(--hbgs-line));
  background: color-mix(in srgb, var(--hbgs-ok) 9%, var(--hbgs-surface));
}

.data-import-note-title {
  color: var(--hbgs-ink);
}

.data-import-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 12px;
  border-radius: var(--hbgs-radius-pill);
  border: 1px solid var(--hbgs-line);
  font-size: 11px;
  font-weight: 700;
}

.data-import-badge--warning {
  border-color: color-mix(in srgb, var(--hbgs-warn) 45%, var(--hbgs-line));
  background: color-mix(in srgb, var(--hbgs-warn) 14%, var(--hbgs-surface));
  color: var(--hbgs-ink);
}

.data-import-badge--muted {
  background: var(--hbgs-surface-2);
  color: var(--hbgs-ink-2);
}

.data-import-legacy-list {
  margin-bottom: 12px;
  max-height: 300px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.data-import-legacy-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 6px;
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius);
  background: var(--hbgs-surface-2);
}

.data-import-legacy-title {
  flex: 1;
  font-size: 13px;
}

.data-import-legacy-source {
  color: var(--hbgs-ink-3);
  font-size: 11px;
}

.data-import-legacy-delete {
  padding: 4px 8px !important;
  border-color: color-mix(in srgb, var(--hbgs-danger) 45%, var(--hbgs-line)) !important;
  color: var(--hbgs-danger) !important;
  font-size: 11px !important;
}

/* ============================================================
   LIVESCHOOL PAGE UNIFICATION
   ============================================================ */

.liveschool-header {
  background: var(--hbgs-surface);
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius-lg);
  padding: 20px;
  box-shadow: none !important;
}

.liveschool-header h1 {
  color: var(--hbgs-ink);
}

.liveschool-header .header-actions {
  align-items: center;
}

.liveschool-tabs {
  border-bottom-color: var(--hbgs-line) !important;
  scrollbar-width: thin;
}

.liveschool-tabs .tab {
  border-radius: var(--hbgs-radius) var(--hbgs-radius) 0 0;
  min-height: 42px;
  color: var(--hbgs-ink-3) !important;
}

.liveschool-tabs .tab.active {
  color: var(--hbgs-accent) !important;
  border-bottom-color: var(--hbgs-accent) !important;
  background: color-mix(in srgb, var(--hbgs-accent) 8%, transparent) !important;
}

.liveschool-period-selector {
  align-items: center;
}

.liveschool-period-selector .period-pill {
  border-color: var(--hbgs-line) !important;
  background: var(--hbgs-surface) !important;
  color: var(--hbgs-ink-2) !important;
  box-shadow: none !important;
  min-height: 36px;
}

.liveschool-period-selector .period-pill.active {
  border-color: var(--hbgs-accent) !important;
  background: color-mix(in srgb, var(--hbgs-accent) 12%, var(--hbgs-surface)) !important;
  color: var(--hbgs-ink) !important;
}

.liveschool-loading,
.liveschool-empty-state,
.liveschool-empty-inline {
  padding: 40px;
  text-align: center;
  color: var(--hbgs-ink-3);
}

.liveschool-empty-state--large {
  padding: 60px 24px;
}

.liveschool-empty-state p {
  color: var(--hbgs-ink-3);
}

.liveschool-stat,
.liveschool-card,
.trends-section {
  background: var(--hbgs-surface) !important;
  border: 1px solid var(--hbgs-line) !important;
  border-radius: var(--hbgs-radius-lg) !important;
  box-shadow: none !important;
}

.liveschool-card-header {
  border-bottom-color: var(--hbgs-line) !important;
  color: var(--hbgs-ink);
}

.liveschool-item {
  border-bottom-color: var(--hbgs-line) !important;
}

.liveschool-item:hover {
  background: var(--hbgs-surface-2) !important;
}

.liveschool-filters,
.liveschool-weekly-controls {
  display: grid !important;
  grid-template-columns: minmax(180px, 1fr) repeat(2, minmax(120px, max-content));
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.liveschool-weekly-controls {
  grid-template-columns: max-content max-content max-content minmax(180px, 1fr);
}

.liveschool-inline-label {
  margin: 0 !important;
}

.liveschool-compact-select {
  width: auto;
}

.liveschool-year-input {
  width: 96px;
}

.liveschool-search-input {
  min-width: 180px;
}

.liveschool-table-wrapper {
  border: 1px solid var(--hbgs-line) !important;
  border-radius: var(--hbgs-radius) !important;
  overflow: auto !important;
  -webkit-overflow-scrolling: touch;
  background: var(--hbgs-surface);
}

.liveschool-table-wrapper--students {
  max-height: calc(100vh - 320px);
}

.liveschool-table-wrapper--detail {
  max-height: 350px;
}

.liveschool-table-wrapper--weekly {
  width: 100%;
}

.liveschool-count,
.liveschool-section-note,
.liveschool-week-detail-summary,
.liveschool-week-label,
.liveschool-week-date,
.liveschool-week-caption,
.liveschool-muted-text {
  color: var(--hbgs-ink-3) !important;
  font-size: 13px;
}

.liveschool-count {
  margin-top: 12px;
}

.liveschool-section-note,
.liveschool-week-summary {
  margin-bottom: 16px;
}

.trends-section--spaced {
  margin-top: 24px;
}

.trends-section h3 {
  margin: 0 0 16px;
  font-size: 16px;
  color: var(--hbgs-ink);
}

.liveschool-week-card {
  cursor: pointer;
}

.liveschool-week-card.is-selected {
  border-color: var(--hbgs-accent) !important;
  background: color-mix(in srgb, var(--hbgs-accent) 9%, var(--hbgs-surface)) !important;
}

.liveschool-week-deltas {
  margin-top: 6px;
}

.liveschool-value-positive,
.liveschool-value-negative,
.liveschool-value-warning {
  font-weight: 600;
}

.liveschool-value-positive {
  color: var(--hbgs-ok) !important;
}

.liveschool-value-negative {
  color: var(--hbgs-danger) !important;
}

.liveschool-value-warning {
  color: var(--hbgs-warn) !important;
}

.liveschool-week-separator {
  color: var(--hbgs-ink-3);
  font-size: 11px;
  margin: 0 2px;
}

.liveschool-import-modal {
  max-width: 540px;
}

.liveschool-import-help,
.liveschool-preview-content,
.liveschool-import-warning {
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius);
  background: var(--hbgs-surface-2);
}

.liveschool-import-help {
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.6;
}

.liveschool-import-steps {
  margin: 6px 0 0 16px;
  padding: 0;
}

.liveschool-import-note {
  margin-top: 8px;
  color: var(--hbgs-ink-3);
}

.liveschool-import-preview {
  margin-top: 16px;
}

.liveschool-preview-content {
  max-height: 220px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  font-size: 13px;
}

.liveschool-preview-total {
  margin-bottom: 8px;
}

.liveschool-preview-lines,
.liveschool-import-warning {
  font-size: 11px;
  line-height: 1.6;
}

.liveschool-import-warning {
  margin-top: 10px;
  padding: 10px;
  border-color: color-mix(in srgb, var(--hbgs-danger) 45%, var(--hbgs-line));
  background: color-mix(in srgb, var(--hbgs-danger) 12%, var(--hbgs-surface));
}

.liveschool-import-warning strong {
  color: var(--hbgs-danger);
}

.liveschool-warning-ack {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  cursor: pointer;
}

/* ============================================================
   BUS STUDENTS ADMIN PAGE UNIFICATION
   ============================================================ */

.admin-page-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.admin-bus-page .admin-section {
  background: var(--hbgs-surface) !important;
  border: 1px solid var(--hbgs-line) !important;
  border-radius: var(--hbgs-radius-lg) !important;
  padding: 20px !important;
  box-shadow: none !important;
}

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

.bus-section-header h3 {
  margin: 0 0 4px;
  color: var(--hbgs-ink);
  letter-spacing: -0.01em;
}

.bus-section-header p,
.bus-file-name,
.bus-list-summary,
.bus-student-id-cell {
  color: var(--hbgs-ink-3) !important;
  font-size: 13px;
}

.bus-section-header p {
  margin: 0;
  line-height: 1.45;
}

.bus-status-chip {
  flex-shrink: 0;
  align-self: flex-start;
  padding: 8px 14px;
  border-radius: var(--hbgs-radius-pill);
  border: 1px solid var(--hbgs-line);
  background: var(--hbgs-surface-2);
  color: var(--hbgs-ink-2);
  font-size: 13px;
  font-weight: 600;
}

.bus-status-chip--active {
  border-color: color-mix(in srgb, var(--hbgs-warn) 40%, var(--hbgs-line));
  background: color-mix(in srgb, var(--hbgs-warn) 16%, var(--hbgs-surface));
  color: var(--hbgs-ink);
}

.bus-upload-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.bus-file-picker {
  cursor: pointer;
  margin: 0 !important;
}

.bus-file-input {
  display: none;
}

.bus-file-name {
  min-width: min(220px, 100%);
}

.bus-danger-action {
  margin-left: auto;
  border-color: color-mix(in srgb, var(--hbgs-danger) 46%, var(--hbgs-line)) !important;
  color: var(--hbgs-danger) !important;
  background: transparent !important;
}

.bus-import-result {
  margin-top: 12px;
}

.bus-result {
  padding: 12px 16px;
  border-radius: var(--hbgs-radius);
  border: 1px solid var(--hbgs-line);
  font-size: 13px;
  line-height: 1.45;
}

.bus-result-success {
  border-color: color-mix(in srgb, var(--hbgs-ok) 44%, var(--hbgs-line));
  background: color-mix(in srgb, var(--hbgs-ok) 11%, var(--hbgs-surface));
  color: var(--hbgs-ink);
}

.bus-result-error {
  border-color: color-mix(in srgb, var(--hbgs-danger) 44%, var(--hbgs-line));
  background: color-mix(in srgb, var(--hbgs-danger) 11%, var(--hbgs-surface));
  color: var(--hbgs-danger);
}

.bus-filter-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(2, minmax(140px, max-content));
  gap: 8px;
  align-items: center;
  min-width: min(100%, 560px);
}

.bus-filter-row > * {
  min-width: 0;
}

.bus-list-summary {
  margin-bottom: 8px;
}

.bus-students-table-wrapper {
  max-height: 500px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius);
  background: var(--hbgs-surface);
}

.bus-students-table {
  width: 100%;
  min-width: 620px;
}

.bus-toggle-column {
  width: 58px;
}

.bus-toggle-cell {
  text-align: center;
}

.bus-toggle-label {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 36px;
  min-height: 36px;
}

.bus-row-active {
  background: color-mix(in srgb, var(--hbgs-warn) 8%, transparent) !important;
}

/* Mobile and PWA polish across old/new screens. */
@media (max-width: 760px) {
  .main-content {
    padding: 14px;
  }

  .top-header {
    min-height: 58px;
    padding-inline: 12px;
  }

  .header-actions {
    gap: 6px;
  }

  .header-user-name,
  .header-user-caret,
  .dash-hero::after {
    display: none;
  }

  .page-header,
  .page-title-section-block,
  .hbgs-page-header {
    padding: 14px;
  }

  .card-actions,
  .card-controls,
  .students-toolbar,
  .attendance-toolbar,
  .copy-requests-toolbar,
  .tech-support-toolbar,
  .controls-bar,
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .card-actions > *,
  .card-controls > *,
  .students-toolbar > *,
  .attendance-toolbar > *,
  .copy-requests-toolbar > *,
  .tech-support-toolbar > *,
  .controls-bar > *,
  .filter-bar > * {
    width: 100%;
  }

  .schedule-builder-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .schedule-builder-stat-divider {
    display: none !important;
  }

  .schedule-builder-unified .tabs-row {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .schedule-builder-unified .tabs-row .tab-btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .schedule-builder-actions-cell,
  .schedule-builder-inline-actions {
    justify-content: flex-end !important;
  }

  .data-import-section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .data-import-meta {
    text-align: left;
  }

  .data-import-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .data-import-controls > *,
  .data-import-file-input,
  .data-import-password-input,
  .data-import-period-select,
  .data-import-danger-action {
    width: 100%;
    min-width: 0;
  }

  .data-import-badge {
    width: 100%;
  }

  .liveschool-header,
  .liveschool-header .header-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .liveschool-header .header-actions > * {
    width: 100%;
  }

  .liveschool-tabs {
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .liveschool-period-selector,
  .liveschool-filters,
  .liveschool-weekly-controls {
    grid-template-columns: 1fr;
    align-items: stretch;
    width: 100%;
  }

  .liveschool-filters > *,
  .liveschool-weekly-controls > *,
  .liveschool-compact-select,
  .liveschool-year-input,
  .liveschool-search-input {
    width: 100%;
    min-width: 0;
  }

  .liveschool-cards,
  .liveschool-stats {
    grid-template-columns: 1fr !important;
  }

  .liveschool-table {
    min-width: 0 !important;
  }

  .bus-section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .bus-status-chip {
    width: 100%;
    text-align: center;
  }

  .bus-upload-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .bus-upload-controls > * {
    width: 100%;
  }

  .bus-danger-action {
    margin-left: 0;
  }

  .bus-filter-row {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .bus-students-table-wrapper {
    max-height: min(58vh, 520px);
  }

  .bus-students-table {
    min-width: 0 !important;
  }

  .table-container,
  .data-table-wrapper,
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .main-content table,
  .data-table {
    min-width: 720px;
  }

  .dash-hero {
    grid-template-columns: 1fr !important;
  }

  .dash-class-context,
  .dash-class-filter-row,
  .dash-class-context-note {
    align-items: stretch !important;
    text-align: left !important;
  }

  .dash-class-filter-row {
    justify-content: flex-start !important;
  }

  .dash-birthdays-activity-grid,
  .dash-attendance-grid {
    grid-template-columns: 1fr !important;
  }

  .hbgs-stat-grid,
  .hbgs-stat-grid--2,
  .hbgs-stat-grid--3,
  .hbgs-stat-grid--4,
  .hbgs-stat-grid--5 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dash-loading::after,
  .loading-state::after,
  .skeleton::after {
    animation: none !important;
  }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {
  .top-header {
    padding-inline: 16px;
  }

  .page-title {
    font-size: 20px;
  }

  .dash-hero {
    min-height: 132px;
  }

  .dash-hero-content {
    padding-top: 16px;
  }

  .hbgs-page-header {
    flex-direction: column;
  }

  .hbgs-toolbar,
  .page-header-actions,
  .card-actions {
    width: 100%;
  }
}

/* Keep the late Beta 7 responsive layer from undoing the base mobile/PWA
   safe-area header sizing. In iOS standalone mode the status bar overlays the
   viewport, so the header keeps a 56px content row below the safe area instead
   of clipping the page title and controls. */
@media (max-width: 760px) {
  .top-header {
    height: calc(56px + env(safe-area-inset-top, 0px));
    min-height: calc(56px + env(safe-area-inset-top, 0px));
    padding-block: env(safe-area-inset-top, 0px) 0;
    padding-inline: 12px;
    gap: 8px;
  }

  .page-title-section {
    flex: 1 1 auto;
    min-width: 0;
    gap: 8px;
  }

  .page-title {
    font-size: 17px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-actions {
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    min-width: 0;
  }

  .mobile-menu-btn,
  .universal-search-btn,
  .notification-btn,
  .import-status-btn,
  .header-icon-btn,
  .header-user-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px !important;
  }

  .mobile-menu-btn {
    margin-right: 0;
  }

  .header-user-btn {
    gap: 0;
  }

  .header-user-avatar {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }
}

@media (max-width: 390px) {
  .top-header {
    padding-inline: 10px;
  }

  .page-title {
    font-size: 16px;
  }

  .mobile-menu-btn,
  .universal-search-btn,
  .notification-btn,
  .import-status-btn,
  .header-icon-btn,
  .header-user-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
  }
}

@media (max-width: 600px) {
  .card,
  .dash-widget,
  .dash-panel,
  .modal,
  .hbgs-card {
    border-radius: var(--hbgs-radius-lg);
  }

  .btn,
  .nav-item,
  .sidebar-toggle-btn,
  .mobile-menu-btn,
  .universal-search-btn,
  .notification-btn,
  .import-status-btn,
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    min-height: 44px;
  }

  .dash-hero {
    padding: 20px 18px !important;
    border-radius: var(--hbgs-radius-lg) !important;
  }

  .dash-hero-title {
    font-size: 26px !important;
  }

  .dash-widgets {
    gap: 12px !important;
  }

  .dash-widget-header,
  .card-header {
    padding: 13px !important;
  }

  .hbgs-toolbar > *,
  .card-controls > * {
    flex: 1 1 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-item,
  .sidebar-toggle-btn,
  .mobile-menu-btn,
  .universal-search-btn,
  .notification-btn,
  .import-status-btn,
  .header-icon-btn,
  .btn,
  .card,
  .dash-widget,
  .dash-panel,
  .hbgs-card,
  .dash-quick-action,
  .dash-stat,
  .dash-stat-card,
  .dash-panel-card,
  .dash-event-item,
  .dash-activity-item {
    transition: none !important;
  }
}

/* Beta 7 broad polish pass: shell hierarchy, calm badges, dashboard weights, mobile wrapping. */
@media (max-width: 900px) {
  .sidebar-title-row {
    flex-wrap: wrap;
    row-gap: 4px;
  }

  .student-profile-header {
    align-items: flex-start;
  }

  .student-profile-name-row,
  .student-profile-meta,
  .profile-actions,
  .page-header,
  .page-header-actions,
  .header-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 720px) {
  .dash-ops-summary {
    gap: 10px;
  }

  .dash-ops-card {
    min-height: 82px;
    padding: 13px 14px;
  }

  .dash-zone-heading {
    margin: 20px 0 2px;
    padding-top: 14px;
  }

  .dash-widget-header {
    min-height: 44px;
  }

  .dash-widget-card-header,
  .dash-widget-card-body,
  .dash-widget-card-body.is-padded {
    padding: 12px !important;
  }

  .dash-stats-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .dash-stat-cell {
    min-height: 84px;
    padding: 14px 10px;
  }

  .dash-stat-cell-value {
    font-size: 21px;
  }

  .student-table .student-name-link {
    align-items: flex-start;
  }

  .student-roster-badges {
    width: 100%;
    margin-right: 0;
    margin-bottom: 2px;
  }

  .student-address,
  .student-profile-address {
    max-width: min(100%, 34ch);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .student-profile-header {
    gap: 12px;
  }

  .student-profile-info {
    min-width: 0;
  }

  .student-profile-meta {
    gap: 6px;
  }

  .student-profile-meta .profile-copyable,
  .student-profile-meta .hbgs-status-badge {
    max-width: 100%;
  }

  .profile-actions {
    gap: 8px;
  }

  .profile-actions .btn {
    flex: 1 1 160px;
  }
}

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

  .hbgs-status-badge,
  .badge,
  .settings-badge,
  .attendance-badge,
  .ann-status-badge,
  .ann-tab-badge {
    max-width: 100%;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
  }
}

/* Dashboard organization pass: numbered workflow sections and paired triage cards. */
.dash-widget[data-dashboard-zone="attention"][data-dashboard-size="primary"] {
  grid-column: span 7;
}

.dash-widget[data-dashboard-zone="attention"][data-dashboard-size="secondary"] {
  grid-column: span 5;
}

.dash-widget[data-dashboard-zone="context"][data-dashboard-size="third"] {
  grid-column: span 4;
}

@media (max-width: 900px) {
  .dash-widget[data-dashboard-zone="attention"][data-dashboard-size="primary"],
  .dash-widget[data-dashboard-zone="attention"][data-dashboard-size="secondary"],
  .dash-widget[data-dashboard-zone="context"][data-dashboard-size="third"] {
    grid-column: 1 / -1;
  }
}


/* School year / term context */
.school-term-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 28px;
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, #f59e0b 36%, var(--hbgs-line));
  border-radius: 14px;
  background: color-mix(in srgb, #f59e0b 10%, var(--hbgs-surface));
  color: var(--hbgs-text);
  font-size: 14px;
  font-weight: 700;
}

.term-target-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid color-mix(in srgb, var(--hbgs-accent) 30%, var(--hbgs-line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--hbgs-accent) 10%, var(--hbgs-surface));
  color: var(--hbgs-accent-strong);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.term-target-badge.is-archive {
  color: var(--hbgs-muted);
  border-color: var(--hbgs-line);
  background: color-mix(in srgb, var(--hbgs-muted) 10%, transparent);
}

.is-term-locked {
  opacity: 0.58;
  filter: grayscale(0.1);
}

@media (max-width: 720px) {
  .school-term-banner {
    align-items: flex-start;
    flex-direction: column;
    margin: 0 14px;
  }
}

@media (max-width: 960px) {
  .school-term-banner {
    margin: 0 16px;
  }
}


/* Temporary module state */
.nav-item.is-coming-next-year {
  gap: 8px;
  cursor: not-allowed;
  opacity: 0.82;
}

.nav-item.is-coming-next-year .nav-coming-next-year-badge {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  padding: 1px 6px;
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius-pill);
  background: var(--hbgs-surface-2);
  color: var(--hbgs-ink-3);
  font-size: 10px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: lowercase;
  white-space: nowrap;
}

.nav-item.is-coming-next-year:hover,
.nav-item.is-coming-next-year:focus-visible {
  background: transparent;
  color: var(--hbgs-ink-2);
}

.coming-next-year-page {
  max-width: 680px;
  margin: 48px auto;
  padding: 32px;
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius-lg);
  background: var(--hbgs-surface);
  color: var(--hbgs-ink);
  text-align: left;
}

.coming-next-year-page h1 {
  margin: 14px 0 8px;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -0.03em;
}

.coming-next-year-page p {
  margin: 0;
  color: var(--hbgs-ink-2);
  font-size: 15px;
  line-height: 1.6;
}

.coming-next-year-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid var(--hbgs-line-strong);
  border-radius: var(--hbgs-radius-pill);
  background: var(--hbgs-surface-2);
  color: var(--hbgs-ink-2);
  font-size: 11px;
  font-weight: 700;
  text-transform: lowercase;
}

.coming-next-year-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

/* ===== calm-flat-theme.css ===== */
/* ============================================================
   HBGS CALM FLAT — THEME FOUNDATION
   Final cascade layer for the live app shell. The dashboard renderer has a
   matching embedded layer so generated widgets do not drift from this style.
   ============================================================ */

:root[data-theme="dark"] {
  --hbgs-refined-bg: #0f1512;
  --hbgs-refined-surface: #151d18;
  --hbgs-refined-surface-2: #1b2620;
  --hbgs-refined-surface-3: #202d26;
  --hbgs-refined-line: #26332c;
  --hbgs-refined-line-strong: #34443b;
  --hbgs-refined-text: #e8ede9;
  --hbgs-refined-muted: #93a39a;
  --hbgs-refined-soft: #93a39a;
  --hbgs-refined-green: #22c55e;
  --hbgs-refined-green-soft: rgba(34, 197, 94, 0.14);
  /* Mockup 6: compact rail */
  --sidebar-width: 232px;

  /* Re-point the core dark tokens from Tailwind slate to Fable charcoal.
     Thousands of inline styles use var(--card-bg)/var(--gray-50)/etc., so
     this single block is what makes generated widgets match the mockup. */
  --bg-primary: #0f1512;
  --card-bg: #151d18;
  --bg-secondary: #1b2620;
  --bg-tertiary: #202d26;
  --border-color: #26332c;
  --gray-50: #1b2620;
  --gray-100: #202d26;
  --text-primary: #e8ede9;
  --text-secondary: #93a39a;
  --text-muted: #93a39a;
}

[data-theme="dark"] html,
[data-theme="dark"] body,
[data-theme="dark"] .app-layout,
[data-theme="dark"] .main-wrapper,
[data-theme="dark"] .content-area,
[data-theme="dark"] .main-content {
  background: var(--hbgs-refined-bg) !important;
  color: var(--hbgs-refined-text) !important;
}

[data-theme="dark"] .sidebar {
  background: var(--hbgs-refined-surface) !important;
  border-right: 1px solid var(--hbgs-refined-line) !important;
  box-shadow: none !important;
}

[data-theme="dark"] .sidebar-header {
  border-bottom: 1px solid var(--hbgs-refined-line) !important;
  padding: 18px 16px 16px !important;
  padding-top: calc(14px + var(--safe-top)) !important;
}

[data-theme="dark"] .sidebar-logo {
  width: 32px !important;
  height: 32px !important;
  border-radius: 8px !important;
  background: var(--hbgs-refined-green-soft) !important;
  border: 1px solid rgba(34, 197, 94, 0.25) !important;
  color: var(--hbgs-refined-green) !important;
  box-shadow: none !important;
}

[data-theme="dark"] .sidebar-title {
  color: var(--hbgs-refined-text) !important;
  font-size: 14px !important;
  font-weight: 750 !important;
  letter-spacing: -0.01em !important;
}

[data-theme="dark"] .sidebar-subtitle,
[data-theme="dark"] .nav-section-title,
[data-theme="dark"] .nav-section-collapsible .nav-section-title,
[data-theme="dark"] .nav-section-header {
  color: var(--hbgs-refined-muted) !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase !important;
}

[data-theme="dark"] .sidebar-nav {
  padding: 16px 10px !important;
}

[data-theme="dark"] .nav-section {
  margin-bottom: 13px !important;
}

[data-theme="dark"] .nav-item {
  min-height: 34px !important;
  padding: 7px 10px !important;
  border-radius: 7px !important;
  color: var(--hbgs-refined-muted) !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  box-shadow: none !important;
}

[data-theme="dark"] .nav-item:hover,
[data-theme="dark"] .nav-item.active {
  background: var(--hbgs-refined-surface-2) !important;
  color: var(--hbgs-refined-text) !important;
  transform: none !important;
  box-shadow: none !important;
}


[data-theme="dark"] .nav-item.active {
  background: var(--hbgs-refined-green-soft) !important;
  color: var(--hbgs-refined-green) !important;
}

[data-theme="dark"] .nav-item.active .nav-item-icon {
  color: var(--hbgs-refined-green) !important;
}
[data-theme="dark"] .nav-item-icon {
  width: 22px !important;
  height: 22px !important;
  background: none !important;
  color: currentColor !important;
}

[data-theme="dark"] .nav-item-icon .hbgs-icon,
[data-theme="dark"] .bottom-nav-icon .hbgs-icon,
[data-theme="dark"] .dash-quick-action-icon .hbgs-icon {
  stroke: currentColor !important;
  fill: none !important;
}

[data-theme="dark"] .top-header {
  min-height: 56px !important;
  padding: 12px 24px !important;
  background: var(--hbgs-refined-surface) !important;
  border-bottom: 1px solid var(--hbgs-refined-line) !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

/* Mockup 6 header: wide search field with placeholder label + kbd hint */
[data-theme="dark"] .top-header {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
}

/* Mockup has no page title in the header — the greeting carries it */
[data-theme="dark"] .page-title {
  display: none !important;
}

[data-theme="dark"] .page-title-section {
  flex: 0 0 auto !important;
}

[data-theme="dark"] .header-actions {
  flex: 1 !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  min-width: 0 !important;
}

[data-theme="dark"] .universal-search-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex: 1 1 auto !important;
  max-width: 440px !important;
  margin-right: auto !important;
  justify-content: flex-start !important;
  padding: 7px 12px !important;
  font-size: 13px !important;
}

/* Compact circular avatar button like the mockup */
[data-theme="dark"] .header-user-name,
[data-theme="dark"] .header-user-caret {
  display: none !important;
}

[data-theme="dark"] .header-user-btn {
  width: 34px !important;
  height: 34px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  background: var(--hbgs-refined-surface-2) !important;
  box-shadow: none !important;
}

[data-theme="dark"] .header-user-avatar {
  width: 26px !important;
  height: 26px !important;
  border-radius: 50% !important;
  background: var(--hbgs-refined-green-soft) !important;
  color: var(--hbgs-refined-green) !important;
}

[data-theme="dark"] .universal-search-btn svg {
  width: 14px !important;
  height: 14px !important;
  flex-shrink: 0;
}

[data-theme="dark"] .universal-search-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  color: var(--hbgs-refined-muted);
}

[data-theme="dark"] .universal-search-kbd {
  font-size: 10.5px;
  padding: 1px 6px;
  border: 1px solid var(--hbgs-refined-line);
  border-radius: 5px;
  color: var(--hbgs-refined-muted);
  background: var(--hbgs-refined-surface);
  flex-shrink: 0;
}

[data-theme="dark"] .header-year-chip {
  font-size: 12px;
  padding: 6px 10px;
  border: 1px solid var(--hbgs-refined-line);
  border-radius: 8px;
  color: var(--hbgs-refined-muted);
  background: var(--hbgs-refined-surface-2);
  white-space: nowrap;
}

[data-theme="dark"] .header-year-chip b {
  color: var(--hbgs-refined-text);
  font-weight: 600;
}

@media (max-width: 900px) {
  [data-theme="dark"] .universal-search-label,
  [data-theme="dark"] .universal-search-kbd,
  [data-theme="dark"] .header-year-chip span {
    display: none !important;
  }
  [data-theme="dark"] .universal-search-btn {
    width: auto !important;
  }
}

/* pre-RC convergence: iOS safe-area repair.
   viewport-fit=cover lets the app paint behind the iPhone status bar; this final
   beta7 layer had accidentally overridden responsive.css' env(safe-area-inset-top)
   header padding. Reserve the inset here, in the last-loaded design layer. */
@media (max-width: 768px) {
  [data-theme="dark"] .top-header {
    height: calc(54px + env(safe-area-inset-top, 0px)) !important;
    min-height: calc(54px + env(safe-area-inset-top, 0px)) !important;
    padding-top: calc(8px + env(safe-area-inset-top, 0px)) !important;
    padding-right: max(12px, env(safe-area-inset-right, 0px)) !important;
    padding-bottom: 8px !important;
    padding-left: max(12px, env(safe-area-inset-left, 0px)) !important;
    align-items: flex-end !important;
  }

  [data-theme="dark"] .page-title-section,
  [data-theme="dark"] .header-actions {
    align-items: center !important;
  }
}

@media (max-width: 480px) {
  [data-theme="dark"] .top-header {
    height: calc(52px + env(safe-area-inset-top, 0px)) !important;
    min-height: calc(52px + env(safe-area-inset-top, 0px)) !important;
    padding-top: calc(7px + env(safe-area-inset-top, 0px)) !important;
    padding-right: max(10px, env(safe-area-inset-right, 0px)) !important;
    padding-bottom: 7px !important;
    padding-left: max(10px, env(safe-area-inset-left, 0px)) !important;
  }
}

[data-theme="dark"] .page-title {
  color: var(--hbgs-refined-text) !important;
  font-size: clamp(19px, 2vw, 22px) !important;
  font-weight: 650 !important;
  letter-spacing: -0.02em !important;
}

[data-theme="dark"] .header-user,
[data-theme="dark"] .sidebar-toggle-btn,
[data-theme="dark"] .mobile-menu-btn,
[data-theme="dark"] .universal-search-btn,
[data-theme="dark"] .notification-btn,
[data-theme="dark"] .import-status-btn,
[data-theme="dark"] .header-icon-btn {
  border: 1px solid var(--hbgs-refined-line) !important;
  background: var(--hbgs-refined-surface-2) !important;
  color: var(--hbgs-refined-muted) !important;
  border-radius: 10px !important;
  box-shadow: none !important;
}

[data-theme="dark"] .card,
[data-theme="dark"] .hbgs-card,
[data-theme="dark"] .dash-widget,
[data-theme="dark"] .dash-panel,
[data-theme="dark"] .dash-panel-card,
[data-theme="dark"] .dashboard-card,
[data-theme="dark"] .stats-card,
[data-theme="dark"] .report-widget,
[data-theme="dark"] .analytics-card,
[data-theme="dark"] .bookmark-card,
[data-theme="dark"] .trip-card {
  background: var(--hbgs-refined-surface) !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  color: var(--hbgs-refined-text) !important;
}

[data-theme="dark"] .card-header,
[data-theme="dark"] .dash-widget-header,
[data-theme="dark"] .dash-panel-header,
[data-theme="dark"] .hbgs-card-header {
  background: var(--hbgs-refined-surface) !important;
  border-bottom: 1px solid var(--hbgs-refined-line) !important;
  padding: 13px 16px !important;
}

[data-theme="dark"] .dash-hero {
  background: var(--hbgs-refined-surface) !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  color: var(--hbgs-refined-text) !important;
}

[data-theme="dark"] .dash-hero::before,
[data-theme="dark"] .dash-hero::after {
  content: none !important;
}

[data-theme="dark"] .dash-hero-title,
[data-theme="dark"] .dash-stat-num,
[data-theme="dark"] .dash-stat-value,
[data-theme="dark"] .stat-value,
[data-theme="dark"] .metric-value,
[data-theme="dark"] .dash-widget-title {
  color: var(--hbgs-refined-text) !important;
}

[data-theme="dark"] .dash-hero-date,
[data-theme="dark"] .dash-hero-subtitle,
[data-theme="dark"] .dash-meta,
[data-theme="dark"] .card-subtitle,
[data-theme="dark"] .widget-subtitle,
[data-theme="dark"] .dash-stat-label,
[data-theme="dark"] .stat-label,
[data-theme="dark"] .metric-label {
  color: var(--hbgs-refined-muted) !important;
}

[data-theme="dark"] table,
[data-theme="dark"] .data-table,
[data-theme="dark"] .hbgs-table {
  border-color: var(--hbgs-refined-line) !important;
}

[data-theme="dark"] thead th,
[data-theme="dark"] .data-table th,
[data-theme="dark"] .hbgs-table th {
  background: var(--hbgs-refined-surface-2) !important;
  color: var(--hbgs-refined-soft) !important;
  font-size: 10.5px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.07em !important;
}

[data-theme="dark"] tbody td,
[data-theme="dark"] .data-table td,
[data-theme="dark"] .hbgs-table td {
  border-top: 1px solid var(--hbgs-refined-line) !important;
}

[data-theme="dark"] tbody tr:hover td,
[data-theme="dark"] .data-table tr:hover td,
[data-theme="dark"] .hbgs-table tr:hover td {
  background: var(--hbgs-refined-surface-2) !important;
}

[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn.primary,
[data-theme="dark"] button.primary,
[data-theme="dark"] .primary-btn {
  background: var(--hbgs-refined-green) !important;
  border-color: var(--hbgs-refined-green) !important;
  color: #08130c !important;
}

/* ── Mockup 6 structural pass ─────────────────────────────── */

/* Hero becomes a plain greeting block, like the concept */
[data-theme="dark"] .dash-hero {
  background: none !important;
  border: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
}

[data-theme="dark"] .dash-hero-title {
  font-size: 20px !important;
  font-weight: 650 !important;
  letter-spacing: -0.01em !important;
}

[data-theme="dark"] .dash-hero-date {
  font-size: 13px !important;
  margin-top: 2px !important;
}

/* Ops cards become the horizontal attention strip */
[data-theme="dark"] .dash-ops-summary {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)) !important;
  gap: 10px !important;
  margin-top: 18px !important;
}

[data-theme="dark"] .dash-ops-card {
  min-height: 0 !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 14px 16px !important;
  background: var(--hbgs-refined-surface) !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  border-radius: 10px !important;
}

[data-theme="dark"] .dash-ops-card:hover {
  border-color: var(--hbgs-refined-line-strong) !important;
}

[data-theme="dark"] .dash-ops-card strong {
  font-size: 24px !important;
  font-weight: 700 !important;
  font-variant-numeric: tabular-nums;
  order: -1;
}

[data-theme="dark"] .dash-ops-card.is-attention strong {
  color: var(--red-500, #ef4444) !important;
}

[data-theme="dark"] .dash-ops-label {
  font-size: 12.5px !important;
  color: var(--hbgs-refined-muted) !important;
}

[data-theme="dark"] .dash-ops-action {
  font-size: 12px !important;
  color: var(--hbgs-refined-green) !important;
}

/* Stats strip: joined cells, thin divider grid */
[data-theme="dark"] .dash-stats-strip {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important;
  gap: 1px !important;
  background: var(--hbgs-refined-line) !important;
  border-radius: 0 !important;
}

[data-theme="dark"] .dash-stat-cell {
  background: var(--hbgs-refined-surface) !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 13px 16px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
  box-shadow: none !important;
}

[data-theme="dark"] .dash-stat-cell:hover {
  background: var(--hbgs-refined-surface-2) !important;
}

[data-theme="dark"] .dash-stat-cell-value {
  font-size: 20px !important;
  font-weight: 700 !important;
  color: var(--hbgs-refined-text) !important;
  font-variant-numeric: tabular-nums;
}

[data-theme="dark"] .dash-stat-cell.is-alert .dash-stat-cell-value {
  color: #ef4444 !important;
}

[data-theme="dark"] .dash-stat-cell-label {
  font-size: 11.5px !important;
  color: var(--hbgs-refined-muted) !important;
}

/* Zone headings: mockup has no section banners — hide them entirely */
[data-theme="dark"] .dash-zone-heading {
  display: none !important;
}

@media (max-width: 768px) {
  [data-theme="dark"] .top-header {
    min-height: 58px !important;
    padding: 10px 13px !important;
  }

  [data-theme="dark"] .page-title {
    font-size: 18px !important;
  }

  [data-theme="dark"] .main-content,
  [data-theme="dark"] .content-area {
    padding-bottom: calc(84px + env(safe-area-inset-bottom)) !important;
  }

  [data-theme="dark"] .dash-stats,
  [data-theme="dark"] .dash-stats-modern,
  [data-theme="dark"] .hbgs-stat-grid,
  [data-theme="dark"] .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  /* Mockup 6 mobile: attention cards in a compact 2x2 grid */
  [data-theme="dark"] .dash-ops-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  /* Odd card count: let the last card span the full row instead of a hole */
  [data-theme="dark"] .dash-ops-card:last-child:nth-child(odd) {
    grid-column: 1 / -1 !important;
  }

  [data-theme="dark"] .dash-ops-card {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 4px !important;
    padding: 12px 14px !important;
  }

  [data-theme="dark"] .dash-ops-card strong {
    font-size: 22px !important;
    line-height: 1.1 !important;
  }

  [data-theme="dark"] .dash-ops-label {
    font-size: 11.5px !important;
    line-height: 1.3 !important;
  }

  /* Kill the redundant fourth line on phones */
  [data-theme="dark"] .dash-ops-action {
    display: none !important;
  }

  [data-theme="dark"] .dash-stat-cell-value {
    font-size: 18px !important;
  }
}

/* ===== calm-flat-primitives.css ===== */
/* ==========================================================
   HBGS CALM FLAT — SHARED PRODUCTION PRIMITIVES
   Shared Calm Flat Dark shell for Students, Attendance, Copy
   Requests, Bathroom, Staff and legacy card/table pages.
   Keep this late in the cascade: many page modules inject local
   <style> blocks with older gradients/hover lifts.
   ========================================================== */

[data-theme="dark"] .main-content {
  background: var(--hbgs-refined-bg) !important;
}

[data-theme="dark"] .main-content > .card,
[data-theme="dark"] .main-content > .card.animated,
[data-theme="dark"] .card-grid > .card,
[data-theme="dark"] .attendance-page .card,
[data-theme="dark"] .attendance-page [class*="att-"][class*="card"],
[data-theme="dark"] .data-shell,
[data-theme="dark"] .student-data-shell,
[data-theme="dark"] .staff-data-shell {
  background: var(--hbgs-refined-surface) !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  color: var(--hbgs-refined-text) !important;
}

[data-theme="dark"] .main-content > .card,
[data-theme="dark"] .card-grid > .card,
[data-theme="dark"] .attendance-page .card {
  overflow: hidden !important;
}

[data-theme="dark"] .card-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)) !important;
  gap: 14px !important;
}

[data-theme="dark"] .card-header,
[data-theme="dark"] .card-footer,
[data-theme="dark"] .card-controls,
[data-theme="dark"] .attendance-page .page-header,
[data-theme="dark"] .attendance-page [class*="header"] {
  border-color: var(--hbgs-refined-line) !important;
  background: transparent !important;
  box-shadow: none !important;
}

[data-theme="dark"] .card-header {
  padding: 16px 18px !important;
  gap: 12px !important;
}

[data-theme="dark"] .card-title,
[data-theme="dark"] .page-header h1,
[data-theme="dark"] .page-header .page-title,
[data-theme="dark"] .attendance-page h1,
[data-theme="dark"] .attendance-page h2,
[data-theme="dark"] .attendance-page h3 {
  color: var(--hbgs-refined-text) !important;
  letter-spacing: -0.015em !important;
}

[data-theme="dark"] .card-subtitle,
[data-theme="dark"] .page-subtitle,
[data-theme="dark"] .text-muted,
[data-theme="dark"] .empty-state-text,
[data-theme="dark"] .data-empty,
[data-theme="dark"] .attendance-page p {
  color: var(--hbgs-refined-muted) !important;
}

[data-theme="dark"] .card-controls {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  padding: 12px 18px !important;
  border-top: 1px solid var(--hbgs-refined-line) !important;
  border-bottom: 1px solid var(--hbgs-refined-line) !important;
}

[data-theme="dark"] .card-controls input,
[data-theme="dark"] .card-controls select,
[data-theme="dark"] .card-controls textarea,
[data-theme="dark"] .form-input,
[data-theme="dark"] input[type="search"],
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: var(--hbgs-refined-surface-2) !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  color: var(--hbgs-refined-text) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
}

[data-theme="dark"] .card-controls input::placeholder,
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: var(--hbgs-refined-muted) !important;
}

[data-theme="dark"] .btn,
[data-theme="dark"] .btn-outline,
[data-theme="dark"] .btn-secondary,
[data-theme="dark"] .btn-ghost {
  border-radius: 8px !important;
  box-shadow: none !important;
  transition: background .15s ease, border-color .15s ease, color .15s ease !important;
}

[data-theme="dark"] .btn-outline,
[data-theme="dark"] .btn-secondary {
  background: var(--hbgs-refined-surface-2) !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  color: var(--hbgs-refined-text) !important;
}

[data-theme="dark"] .btn-outline:hover:not(:disabled),
[data-theme="dark"] .btn-secondary:hover:not(:disabled),
[data-theme="dark"] .btn-ghost:hover:not(:disabled) {
  background: #202d26 !important;
  border-color: #34443b !important;
  transform: none !important;
}

[data-theme="dark"] .btn-primary {
  background: var(--hbgs-refined-green) !important;
  border: 1px solid var(--hbgs-refined-green) !important;
  color: #07130c !important;
}

[data-theme="dark"] .hbgs-filter-dot,
[data-theme="dark"] .hbgs-plus-icon,
[data-theme="dark"] .install-prompt-icon {
  display: inline-flex !important;
  width: 9px !important;
  height: 9px !important;
  border-radius: 999px !important;
  flex: 0 0 auto !important;
}

[data-theme="dark"] .hbgs-filter-dot.is-danger { background: #ef4444 !important; }
[data-theme="dark"] .hbgs-filter-dot.is-info { background: #38bdf8 !important; }
[data-theme="dark"] .hbgs-filter-dot.is-teal { background: #14b8a6 !important; }

[data-theme="dark"] .hbgs-plus-icon {
  width: 14px !important;
  height: 14px !important;
  border-radius: 0 !important;
  position: relative !important;
}
[data-theme="dark"] .hbgs-plus-icon::before,
[data-theme="dark"] .hbgs-plus-icon::after {
  content: '';
  position: absolute;
  background: currentColor;
  border-radius: 999px;
  left: 2px;
  right: 2px;
  top: 6px;
  height: 2px;
}
[data-theme="dark"] .hbgs-plus-icon::after {
  top: 2px;
  bottom: 2px;
  left: 6px;
  right: auto;
  width: 2px;
  height: auto;
}

/* Tables: thin separators, no row lift, charcoal rows */
[data-theme="dark"] .data-table {
  background: transparent !important;
  color: var(--hbgs-refined-text) !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

[data-theme="dark"] .data-table th {
  background: #101713 !important;
  color: var(--hbgs-refined-muted) !important;
  border-bottom: 1px solid var(--hbgs-refined-line) !important;
  font-size: 11px !important;
  letter-spacing: .08em !important;
  text-transform: uppercase !important;
}

[data-theme="dark"] .data-table td {
  border-bottom: 1px solid var(--hbgs-refined-line) !important;
  color: var(--hbgs-refined-text) !important;
}

[data-theme="dark"] .data-table tbody tr,
[data-theme="dark"] .student-table tbody tr,
[data-theme="dark"] .staff-table tbody tr {
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
}

[data-theme="dark"] .data-table tbody tr:hover,
[data-theme="dark"] .student-table tbody tr:hover,
[data-theme="dark"] .staff-table tbody tr:hover {
  background: rgba(34, 197, 94, 0.05) !important;
  transform: none !important;
  box-shadow: none !important;
}

/* Remove old accent bars/gradients injected by individual pages */
[data-theme="dark"] .stats-card::before,
[data-theme="dark"] .card::before,
[data-theme="dark"] .bathroom-page .stats-card::before {
  display: none !important;
  content: none !important;
}

[data-theme="dark"] .stats-card,
[data-theme="dark"] .bathroom-out-item,
[data-theme="dark"] .comment-item,
[data-theme="dark"] .empty-state,
[data-theme="dark"] .data-empty {
  background: var(--hbgs-refined-surface-2) !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  border-radius: 10px !important;
  box-shadow: none !important;
}

[data-theme="dark"] .bathroom-out-item.bathroom-out-long,
[data-theme="dark"] .bathroom-out-item.bathroom-out-frequent,
[data-theme="dark"] .bathroom-out-item.bathroom-out-long.bathroom-out-frequent {
  background: #1b2620 !important;
  border-left: 3px solid #f59e0b !important;
}

[data-theme="dark"] .badge,
[data-theme="dark"] .attendance-badge,
[data-theme="dark"] .staff-role-badge,
[data-theme="dark"] .staff-class-badge,
[data-theme="dark"] .staff-perms-badge,
[data-theme="dark"] .contact-pill,
[data-theme="dark"] .contact-more {
  border-radius: 999px !important;
  box-shadow: none !important;
}

/* Quieter version/update affordance */
[data-theme="dark"] .sidebar-version {
  opacity: .62 !important;
  font-size: 11px !important;
  letter-spacing: .02em !important;
}
[data-theme="dark"] .sidebar-version:hover {
  opacity: 1 !important;
}

/* Install/update prompt: shared light/dark treatment, positioned above mobile bottom navigation. */
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .install-prompt-backdrop {
  align-items: flex-end !important;
  justify-content: center !important;
  padding: 16px !important;
  padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
  background: rgba(5, 10, 7, .45) !important;
}
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .install-prompt-card {
  width: min(92vw, 320px) !important;
  background: var(--hbgs-refined-surface) !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  border-radius: 12px !important;
  padding: 14px 16px !important;
  box-shadow: 0 18px 60px rgba(0,0,0,.32) !important;
  color: var(--hbgs-refined-text) !important;
}
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .install-prompt-title-row,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .install-prompt-actions {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .install-prompt-title-row {
  margin-bottom: 8px !important;
}
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .install-prompt-card p {
  margin: 0 0 12px 0 !important;
  color: var(--hbgs-refined-muted) !important;
  font-size: 12.5px !important;
  line-height: 1.45 !important;
}
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .install-prompt-actions {
  flex-direction: column !important;
}
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .install-prompt-actions.is-row {
  flex-direction: row !important;
}
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .install-prompt-actions .btn {
  width: 100% !important;
  min-height: 44px !important;
  padding: 8px 10px !important;
  font-size: 12px !important;
}
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .install-prompt-icon {
  background: var(--hbgs-refined-green) !important;
  box-shadow: 0 0 0 5px var(--hbgs-refined-green-soft) !important;
}
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .install-prompt-icon.is-update {
  background: #38bdf8 !important;
  box-shadow: 0 0 0 5px rgba(56,189,248,.14) !important;
}

/* Announcement management: remove legacy gradients/lifts and keep controls consistent with the app shell. */
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .ann-channel-legend,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .ann-quick-btn,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .ann-card,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .ann-tabs-row {
  background: var(--hbgs-refined-surface) !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  color: var(--hbgs-refined-text) !important;
}
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .ann-quick-btn:hover,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .ann-card:hover {
  background: var(--hbgs-refined-surface-2) !important;
  border-color: var(--hbgs-refined-line-strong) !important;
  box-shadow: none !important;
  transform: none !important;
}

@media (max-width: 768px) {
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .ann-header-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .ann-header-actions .btn {
    width: 100% !important;
    min-height: 44px !important;
  }
}

@media (max-width: 768px) {
  [data-theme="dark"] .main-content {
    padding: 12px !important;
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important;
  }

  [data-theme="dark"] .card-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  [data-theme="dark"] .main-content > .card,
  [data-theme="dark"] .card-grid > .card,
  [data-theme="dark"] .attendance-page .card {
    margin-bottom: 12px !important;
    border-radius: 10px !important;
  }

  [data-theme="dark"] .card-header,
  [data-theme="dark"] .card-controls,
  [data-theme="dark"] .card-footer {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  [data-theme="dark"] .card-title {
    font-size: 15px !important;
    margin: 0 !important;
  }
  [data-theme="dark"] .card-subtitle {
    font-size: 12px !important;
    line-height: 1.35 !important;
  }

  [data-theme="dark"] .card-actions,
  [data-theme="dark"] .action-btns,
  [data-theme="dark"] .card-controls-filters {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  [data-theme="dark"] .card-actions .btn,
  [data-theme="dark"] .action-btns .btn,
  [data-theme="dark"] .card-controls input,
  [data-theme="dark"] .card-controls select {
    width: 100% !important;
    min-width: 0 !important;
    font-size: 16px !important; /* avoid iOS zoom */
  }

  [data-theme="dark"] .card-controls {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }

  /* Students: card-based mobile rows with useful labels, no shrunken table. */
  [data-theme="dark"] #studentTableShell .student-table,
  [data-theme="dark"] #staffListShell .staff-table {
    display: block !important;
    width: 100% !important;
  }
  [data-theme="dark"] #studentTableShell .student-table thead,
  [data-theme="dark"] #staffListShell .staff-table thead {
    display: none !important;
  }
  [data-theme="dark"] #studentTableShell .student-table tbody,
  [data-theme="dark"] #staffListShell .staff-table tbody {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    padding: 10px !important;
  }
  [data-theme="dark"] #studentTableShell .student-table tr,
  [data-theme="dark"] #staffListShell .staff-table tr {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 7px !important;
    padding: 12px !important;
    background: var(--hbgs-refined-surface-2) !important;
    border: 1px solid var(--hbgs-refined-line) !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    transform: none !important;
  }
  [data-theme="dark"] #studentTableShell .student-table tr.red-flag-row {
    border-left: 3px solid #ef4444 !important;
  }
  [data-theme="dark"] #studentTableShell .student-table tr::before,
  [data-theme="dark"] #studentTableShell .student-table tr.red-flag-row::before {
    display: none !important;
    content: none !important;
  }
  [data-theme="dark"] #studentTableShell .student-table td,
  [data-theme="dark"] #staffListShell .staff-table td {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    width: 100% !important;
    padding: 0 !important;
    border: 0 !important;
    font-size: 12.5px !important;
    color: var(--hbgs-refined-text) !important;
  }
  [data-theme="dark"] #studentTableShell .student-table td:first-child,
  [data-theme="dark"] #staffListShell .staff-table td:first-child {
    display: block !important;
    padding-bottom: 2px !important;
  }
  [data-theme="dark"] #studentTableShell .student-table td::before,
  [data-theme="dark"] #staffListShell .staff-table td::before {
    content: attr(data-label);
    color: var(--hbgs-refined-muted);
    font-size: 10.5px;
    letter-spacing: .06em;
    text-transform: uppercase;
  }
  [data-theme="dark"] #studentTableShell .student-table td:first-child::before,
  [data-theme="dark"] #staffListShell .staff-table td:first-child::before {
    content: none !important;
  }

  [data-theme="dark"] #staffListShell .staff-table .staff-col-assignment::before { content: 'Assignment'; }
  [data-theme="dark"] #staffListShell .staff-table .staff-col-extension::before { content: 'Ext'; }
  [data-theme="dark"] #staffListShell .staff-table .staff-col-room::before { content: 'Room'; }
  [data-theme="dark"] #staffListShell .staff-table .staff-col-role::before { content: 'Role'; }
  [data-theme="dark"] #staffListShell .staff-table .staff-col-active::before { content: 'Active'; }
  [data-theme="dark"] #staffListShell .staff-table .staff-col-actions::before { content: none; }

  [data-theme="dark"] #studentTableShell .student-table td:nth-child(3),
  [data-theme="dark"] #studentTableShell .student-table td:nth-child(4) {
    display: none !important; /* DOB/address are available in the detail sheet; keep cards compact. */
  }
  [data-theme="dark"] #studentTableShell .avatar-cell,
  [data-theme="dark"] #staffListShell .staff-name-cell {
    width: 100% !important;
    min-width: 0 !important;
  }
  [data-theme="dark"] #studentTableShell .contacts-cell {
    justify-content: flex-end !important;
    max-width: 64% !important;
  }
  [data-theme="dark"] #studentTableShell .contact-pill:nth-child(n+3) {
    display: none !important;
  }

  [data-theme="dark"] .data-table[data-mobile-table="native"] {
    display: table !important;
  }
}

/* ==========================================================
   HBGS CALM FLAT — EXPLICIT LIGHT-THEME TOKEN REPAIR
   The calm-flat dashboard renderer owns several hard-coded dark
   shells. Keep dark mode untouched, but make the dashboard usable
   when the user explicitly selects light mode.
   ========================================================== */
html:not([data-theme="dark"]) .dash-hero,
[data-theme="light"] .dash-hero {
  background: transparent !important;
  color: var(--hbgs-refined-text) !important;
}
html:not([data-theme="dark"]) .dash-hero h1,
[data-theme="light"] .dash-hero h1,
html:not([data-theme="dark"]) .dash-widget-title,
[data-theme="light"] .dash-widget-title,
html:not([data-theme="dark"]) .dash-chart-title,
[data-theme="light"] .dash-chart-title {
  color: var(--hbgs-refined-text) !important;
}
html:not([data-theme="dark"]) .dash-hero p,
[data-theme="light"] .dash-hero p,
html:not([data-theme="dark"]) .dash-widget-subtitle,
[data-theme="light"] .dash-widget-subtitle,
html:not([data-theme="dark"]) .dash-chart-subtitle,
[data-theme="light"] .dash-chart-subtitle {
  color: var(--hbgs-refined-muted) !important;
}
html:not([data-theme="dark"]) .dash-ops-card,
[data-theme="light"] .dash-ops-card,
html:not([data-theme="dark"]) .dash-widget,
[data-theme="light"] .dash-widget,
html:not([data-theme="dark"]) .dash-chart-card,
[data-theme="light"] .dash-chart-card,
html:not([data-theme="dark"]) .dash-stats-strip,
[data-theme="light"] .dash-stats-strip,
html:not([data-theme="dark"]) .dash-stat-cell,
[data-theme="light"] .dash-stat-cell,
html:not([data-theme="dark"]) .dash-class-context,
[data-theme="light"] .dash-class-context,
html:not([data-theme="dark"]) .dash-class-dropdown-wrap,
[data-theme="light"] .dash-class-dropdown-wrap,
html:not([data-theme="dark"]) .dash-activity-card,
[data-theme="light"] .dash-activity-card,
html:not([data-theme="dark"]) .dash-quick-action-card,
[data-theme="light"] .dash-quick-action-card,
html:not([data-theme="dark"]) .dash-alerts-container,
[data-theme="light"] .dash-alerts-container,
html:not([data-theme="dark"]) .dash-insight-card,
[data-theme="light"] .dash-insight-card {
  background: var(--hbgs-refined-surface) !important;
  border-color: var(--hbgs-refined-line) !important;
  color: var(--hbgs-refined-text) !important;
  box-shadow: none !important;
}
html:not([data-theme="dark"]) .dash-ops-card,
[data-theme="light"] .dash-ops-card {
  background: var(--hbgs-refined-surface-2) !important;
}
html:not([data-theme="dark"]) .dash-ops-card.is-attention,
[data-theme="light"] .dash-ops-card.is-attention {
  background: color-mix(in srgb, var(--warning) 8%, var(--hbgs-refined-surface)) !important;
  border-color: color-mix(in srgb, var(--warning) 38%, var(--hbgs-refined-line)) !important;
}
html:not([data-theme="dark"]) .dash-ops-card.is-warn,
[data-theme="light"] .dash-ops-card.is-warn {
  background: color-mix(in srgb, var(--warning) 7%, var(--hbgs-refined-surface)) !important;
  border-color: color-mix(in srgb, var(--warning) 32%, var(--hbgs-refined-line)) !important;
}
html:not([data-theme="dark"]) .dash-ops-value,
[data-theme="light"] .dash-ops-value,
html:not([data-theme="dark"]) .dash-stat-cell-value,
[data-theme="light"] .dash-stat-cell-value,
html:not([data-theme="dark"]) .dash-widget-value,
[data-theme="light"] .dash-widget-value {
  color: var(--hbgs-refined-text) !important;
}
html:not([data-theme="dark"]) .dash-ops-label,
[data-theme="light"] .dash-ops-label,
html:not([data-theme="dark"]) .dash-ops-subtext,
[data-theme="light"] .dash-ops-subtext,
html:not([data-theme="dark"]) .dash-stat-cell-label,
[data-theme="light"] .dash-stat-cell-label,
html:not([data-theme="dark"]) .dash-muted,
[data-theme="light"] .dash-muted {
  color: var(--hbgs-refined-muted) !important;
}
html:not([data-theme="dark"]) .dash-chart-card canvas,
[data-theme="light"] .dash-chart-card canvas {
  background: var(--hbgs-refined-surface) !important;
  border-radius: 8px !important;
}
html:not([data-theme="dark"]) .dash-widget-link,
[data-theme="light"] .dash-widget-link,
html:not([data-theme="dark"]) .dash-activity-action,
[data-theme="light"] .dash-activity-action {
  color: var(--hbgs-refined-green) !important;
}
html:not([data-theme="dark"]) .dashboard-mobile-bottom-pad,
[data-theme="light"] .dashboard-mobile-bottom-pad {
  background: transparent !important;
}

/* Release-candidate office-surface normalization. These selectors deliberately
   outrank page-local style blocks while keeping status color semantic. */
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .student-table thead th,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .staff-table thead th,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .data-table thead th {
  background: var(--hbgs-refined-surface-2) !important;
  color: var(--hbgs-refined-muted) !important;
  border-bottom: 1px solid var(--hbgs-refined-line) !important;
  box-shadow: none !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .table-container,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .data-table-wrapper,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .table-responsive,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .student-data-shell,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .staff-data-shell {
  overflow-x: auto !important;
  scrollbar-gutter: stable;
  border-color: var(--hbgs-refined-line) !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .contact-pill,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .contact-more {
  background: var(--hbgs-refined-surface-2) !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  color: var(--hbgs-refined-text) !important;
  box-shadow: none !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .contact-pill:hover {
  border-color: var(--hbgs-refined-green) !important;
  color: var(--hbgs-refined-green) !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .hbgs-filter-dot.is-info,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .hbgs-filter-dot.is-teal {
  background: var(--hbgs-refined-green) !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .att-status-banner {
  min-height: 48px !important;
  padding: 11px 14px !important;
  background: var(--hbgs-refined-surface) !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  border-radius: 10px !important;
  color: var(--hbgs-refined-text) !important;
  box-shadow: none !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .att-status-banner.pending {
  background: var(--hbgs-refined-surface) !important;
  border-color: color-mix(in srgb, #f59e0b 48%, var(--hbgs-refined-line)) !important;
  border-left: 3px solid #f59e0b !important;
  color: var(--hbgs-refined-text) !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .att-status-banner.review {
  background: var(--hbgs-refined-surface) !important;
  border-left: 3px solid #3b82f6 !important;
  color: var(--hbgs-refined-text) !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .att-status-banner.complete {
  background: var(--hbgs-refined-surface) !important;
  border-left: 3px solid var(--hbgs-refined-green) !important;
  color: var(--hbgs-refined-text) !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .att-tabs {
  gap: 4px !important;
  padding: 4px !important;
  background: var(--hbgs-refined-surface) !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  border-radius: 9px !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .att-tab.active {
  background: var(--hbgs-refined-green-soft) !important;
  color: var(--hbgs-refined-green) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hbgs-refined-green) 38%, transparent) !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .att-stats {
  gap: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  background: var(--hbgs-refined-line) !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  border-radius: 10px !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .att-stats > div {
  min-height: 64px;
  padding: 11px 8px !important;
  background: var(--hbgs-refined-surface) !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .att-content {
  background: var(--hbgs-refined-surface) !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  border-radius: 10px !important;
  box-shadow: none !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .att-content::before {
  content: none !important;
  display: none !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .att-empty-state,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .att-no-data {
  min-height: 190px !important;
  padding: 28px 18px !important;
  background: var(--hbgs-refined-surface) !important;
  color: var(--hbgs-refined-muted) !important;
}

/* Shared tabs, sheets, empty/error/loading states across service and admin pages. */
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) :is(.tabs, .tab-nav, .settings-tabs, .admin-tabs, .section-tabs) {
  background: var(--hbgs-refined-surface) !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  box-shadow: none !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) :is(.tab.active, .tab-btn.active, .settings-tab.active, .admin-tab.active) {
  background: var(--hbgs-refined-green-soft) !important;
  color: var(--hbgs-refined-green) !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) :is(.alert, .error-state, .loading-state, .empty-state, .data-empty) {
  border-radius: 10px !important;
  box-shadow: none !important;
}

/* Normalize legacy module headers and active filters to the permanent flat shell. */
[data-theme="dark"] .main-content .page-header {
  padding: 0 0 16px !important;
  margin-bottom: 0 !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

[data-theme="dark"] :is(.analytics-tab.active, .analytics-page .period-btn.active, .filter-tab.active) {
  background: var(--hbgs-refined-green-soft) !important;
  border-color: color-mix(in srgb, var(--hbgs-refined-green) 38%, transparent) !important;
  color: var(--hbgs-refined-green) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hbgs-refined-green) 30%, transparent) !important;
}

@media (min-width: 769px) {
  [data-theme="dark"] .analytics-tabs {
    flex-wrap: wrap !important;
    overflow-x: visible !important;
  }
}

@media (max-width: 768px) {
  [data-theme="dark"] .filter-tabs {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    overflow: visible !important;
  }

  [data-theme="dark"] .filter-tab {
    width: 100% !important;
    min-width: 0 !important;
    justify-content: center !important;
    white-space: normal !important;
  }

  [data-theme="dark"] .analytics-tabs {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    overflow: visible !important;
  }

  [data-theme="dark"] .analytics-tab {
    width: 100% !important;
    min-width: 0 !important;
    justify-content: flex-start !important;
    padding: 10px 12px !important;
    white-space: normal !important;
  }

  [data-theme="dark"] .sort-filter-controls > div:has(#sortBySelect) {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 44px !important;
    width: 100% !important;
  }

  [data-theme="dark"] #sortBySelect {
    width: 100% !important;
    min-width: 0 !important;
  }
}

/* Profiles and dialogs must not fall back to the legacy slate modal palette. */
[data-theme="dark"] #studentProfileModal .modal,
[data-theme="dark"] #staffProfileModal .modal,
[data-theme="dark"] #awardBadgeModal .modal,
[data-theme="dark"] .modal-backdrop .modal {
  background: var(--hbgs-refined-surface) !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  border-radius: 10px !important;
  color: var(--hbgs-refined-text) !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .34) !important;
}

[data-theme="dark"] #studentProfileModal .modal-header,
[data-theme="dark"] #studentProfileModal .modal-footer,
[data-theme="dark"] #staffProfileModal .modal-header,
[data-theme="dark"] #staffProfileModal .modal-footer,
[data-theme="dark"] #awardBadgeModal .modal-header,
[data-theme="dark"] #awardBadgeModal .modal-footer,
[data-theme="dark"] .modal-backdrop .modal-header,
[data-theme="dark"] .modal-backdrop .modal-footer {
  background: var(--hbgs-refined-surface-2) !important;
  border-color: var(--hbgs-refined-line) !important;
  color: var(--hbgs-refined-text) !important;
  box-shadow: none !important;
}

[data-theme="dark"] #studentProfileModal .modal-body,
[data-theme="dark"] #staffProfileModal .modal-body,
[data-theme="dark"] #awardBadgeModal .modal-body,
[data-theme="dark"] .modal-backdrop .modal-body,
[data-theme="dark"] .student-profile {
  background: var(--hbgs-refined-surface) !important;
  color: var(--hbgs-refined-text) !important;
}

[data-theme="dark"] .profile-stat,
[data-theme="dark"] .profile-section,
[data-theme="dark"] .profile-status-card {
  background: var(--hbgs-refined-surface-2) !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  border-radius: 10px !important;
  box-shadow: none !important;
}

[data-theme="dark"] .profile-achievement-badge,
[data-theme="dark"] .profile-achievement-badge.gold,
[data-theme="dark"] .profile-achievement-badge.silver,
[data-theme="dark"] .profile-achievement-badge.bronze,
[data-theme="dark"] .profile-achievement-badge.custom-badge {
  background: var(--hbgs-refined-surface-2) !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  color: var(--hbgs-refined-text) !important;
  box-shadow: none !important;
}

/* ===== calm-flat-layout.css ===== */
/* ==========================================================
   HBGS CALM FLAT — SHELL, DASHBOARD, AND RESPONSIVE LAYOUT
   Keep the approved calm-flat Mockup 6 structure identical in
   dark and light mode. Only the token values change per theme.
   This layer intentionally comes after the beta.81 light repair
   so the dashboard renderer's tokenized styles do not fall back
   to legacy white cards / green rail in light mode.
   ========================================================== */
:root:not([data-theme="dark"]),
:root[data-theme="light"] {
  --hbgs-refined-bg: var(--hbgs-bg);
  --hbgs-refined-surface: var(--hbgs-surface);
  --hbgs-refined-surface-2: var(--hbgs-surface-2);
  --hbgs-refined-surface-3: var(--hbgs-surface-3);
  --hbgs-refined-line: var(--hbgs-line);
  --hbgs-refined-line-strong: var(--hbgs-line-strong);
  --hbgs-refined-text: var(--hbgs-ink);
  --hbgs-refined-muted: var(--hbgs-ink-3);
  --hbgs-refined-soft: var(--hbgs-ink-3);
  --hbgs-refined-green: var(--hbgs-accent);
  --hbgs-refined-green-soft: var(--hbgs-accent-wash);
  --sidebar-width: 232px;

  --bg-primary: var(--hbgs-refined-bg);
  --card-bg: var(--hbgs-refined-surface);
  --bg-secondary: var(--hbgs-refined-surface-2);
  --bg-tertiary: var(--hbgs-refined-surface-3);
  --border-color: var(--hbgs-refined-line);
  --gray-50: var(--hbgs-refined-surface-2);
  --gray-100: var(--hbgs-refined-surface-3);
  --text-primary: var(--hbgs-refined-text);
  --text-secondary: var(--hbgs-refined-muted);
  --text-muted: var(--hbgs-refined-muted);
}

:root[data-theme="dark"] {
  --sidebar-width: 232px;
}

html:not([data-theme="dark"]) {
  background: var(--hbgs-refined-bg) !important;
  color: var(--hbgs-refined-text) !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) html,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) body,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .app-layout,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .main-wrapper,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .content-area,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .main-content {
  background: var(--hbgs-refined-bg) !important;
  color: var(--hbgs-refined-text) !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .sidebar:not(.collapsed) {
  width: var(--sidebar-width) !important;
  background: var(--hbgs-refined-surface) !important;
  border-right: 1px solid var(--hbgs-refined-line) !important;
  box-shadow: none !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .sidebar-header {
  padding: 16px 16px 14px !important;
  padding-top: calc(14px + var(--safe-top)) !important;
  border-bottom: 0 !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .sidebar-logo {
  width: 26px !important;
  height: 26px !important;
  border-radius: 7px !important;
  background: var(--hbgs-refined-green-soft) !important;
  border: 1px solid color-mix(in srgb, var(--hbgs-refined-green) 25%, transparent) !important;
  color: var(--hbgs-refined-green) !important;
  box-shadow: none !important;
  font-size: 13px !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .sidebar-title {
  color: var(--hbgs-refined-text) !important;
  font-size: 14px !important;
  font-weight: 650 !important;
  letter-spacing: 0 !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .sidebar-subtitle {
  color: var(--hbgs-refined-muted) !important;
  font-size: 11px !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .sidebar-nav {
  padding: 4px 10px 16px !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .nav-section {
  margin-bottom: 4px !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .nav-section-title,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .nav-section-collapsible .nav-section-title,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .nav-section-header {
  color: var(--hbgs-refined-muted) !important;
  font-size: 10.5px !important;
  font-weight: 600 !important;
  letter-spacing: .08em !important;
  text-transform: uppercase !important;
  padding: 14px 10px 4px !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .nav-item {
  min-height: 34px !important;
  padding: 7px 10px !important;
  border-radius: 7px !important;
  color: var(--hbgs-refined-muted) !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  box-shadow: none !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .nav-item:hover {
  background: var(--hbgs-refined-surface-2) !important;
  color: var(--hbgs-refined-text) !important;
  transform: none !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .nav-item.active {
  background: var(--hbgs-refined-green-soft) !important;
  color: var(--hbgs-refined-green) !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .nav-item.active::after {
  content: none !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .nav-item-icon {
  width: 17px !important;
  height: 17px !important;
  background: none !important;
  color: currentColor !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .top-header {
  min-height: 56px !important;
  padding: 12px 24px !important;
  background: var(--hbgs-refined-bg) !important;
  border-bottom: 1px solid var(--hbgs-refined-line) !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .page-title {
  display: none !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .universal-search-btn,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .mobile-menu-btn,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .header-year-chip,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .header-user-btn,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .header-icon-btn {
  background: var(--hbgs-refined-surface) !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  color: var(--hbgs-refined-muted) !important;
  box-shadow: none !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .header-user-avatar {
  background: var(--hbgs-refined-green-soft) !important;
  color: var(--hbgs-refined-green) !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-hero {
  background: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: var(--hbgs-refined-text) !important;
  padding: 0 !important;
  min-height: 0 !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-hero-title {
  color: var(--hbgs-refined-text) !important;
  font-size: 20px !important;
  font-weight: 650 !important;
  letter-spacing: -0.01em !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-hero-date {
  color: var(--hbgs-refined-muted) !important;
  font-size: 13px !important;
  margin-top: 2px !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-class-context,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-class-dropdown-wrap {
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
  color: var(--hbgs-refined-text) !important;
  padding: 0 !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-class-dropdown-wrap {
  background: var(--hbgs-refined-surface-2) !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  border-radius: 7px !important;
  padding: 4px 10px !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-summary {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)) !important;
  gap: 10px !important;
  margin-top: 18px !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-card {
  background: var(--hbgs-refined-surface) !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  color: var(--hbgs-refined-text) !important;
  min-height: 0 !important;
  display: grid !important;
  grid-template-columns: auto 1fr !important;
  grid-template-rows: auto auto !important;
  column-gap: 12px !important;
  row-gap: 0 !important;
  align-items: center !important;
  align-content: center !important;
  padding: 14px 16px !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-card.is-attention,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-card.is-warn,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-card.is-active {
  background: var(--hbgs-refined-surface) !important;
  border-color: var(--hbgs-refined-line) !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-card:hover,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-card.is-attention:hover,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-card.is-warn:hover,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-card.is-active:hover {
  border-color: var(--hbgs-refined-line-strong) !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-card strong {
  color: var(--hbgs-refined-text) !important;
  font-size: 24px !important;
  font-weight: 700 !important;
  font-variant-numeric: tabular-nums;
  grid-column: 1 !important;
  grid-row: 1 / span 2 !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-card.is-attention strong {
  color: #ef4444 !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-card.is-active:not(.is-attention) strong {
  color: #f59e0b !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-card strong.is-good {
  color: var(--hbgs-refined-green) !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-label {
  color: var(--hbgs-refined-text) !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-card span:not(.dash-ops-label):not(.dash-ops-action) {
  color: var(--hbgs-refined-muted) !important;
  font-size: 11.5px !important;
  line-height: 1.3 !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-widgets {
  grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
  grid-auto-flow: row dense !important;
  gap: 14px !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetCharts,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetTodayAttendance,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetClassInsights,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetAnnouncements {
  grid-column: span 7 !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetAlerts,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetBirthdaysActivity,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetEvents,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetWeeklySummary,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetQuickActions,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetDistribution,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetLeaderboards {
  grid-column: span 5 !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetStats {
  grid-column: 1 / -1 !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-widget,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .card,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .hbgs-card,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-panel,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-panel-card {
  background: var(--hbgs-refined-surface) !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  color: var(--hbgs-refined-text) !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-widget-header,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .card-header,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-panel-header {
  background: var(--hbgs-refined-surface) !important;
  border-bottom: 1px solid var(--hbgs-refined-line) !important;
  padding: 13px 16px !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-widget-title,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .card-title {
  color: var(--hbgs-refined-text) !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-widget-link,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-activity-action {
  color: var(--hbgs-refined-green) !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-widget-link {
  appearance: none;
  margin-left: auto;
  padding: 2px 0 !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  font: inherit;
  cursor: pointer;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-widget-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-widget-card,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-widget-card-header {
  background: var(--hbgs-refined-surface-2) !important;
  border-color: var(--hbgs-refined-line) !important;
  box-shadow: none !important;
  color: var(--hbgs-refined-text) !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-quick-action,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-event-item,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-summary-card,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-insight-section,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-alerts-container,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-insight-item,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-stat,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-chart-card,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-dist-card,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-leaderboard-card {
  background: var(--hbgs-refined-surface-2) !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  color: var(--hbgs-refined-text) !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-quick-action:hover,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-event-item:hover,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-summary-card:hover,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-widget:hover {
  background: var(--hbgs-refined-surface-3) !important;
  border-color: var(--hbgs-refined-line-strong) !important;
  transform: none !important;
  box-shadow: none !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-zone-heading {
  display: none !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-stats-strip {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important;
  gap: 1px !important;
  background: var(--hbgs-refined-line) !important;
  border: 0 !important;
  border-radius: 0 !important;
  overflow: hidden !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-stat-cell {
  background: var(--hbgs-refined-surface) !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 13px 16px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
  box-shadow: none !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-stat-cell-value {
  font-size: 20px !important;
  font-weight: 700 !important;
  color: var(--hbgs-refined-text) !important;
  font-variant-numeric: tabular-nums;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-stat-cell.is-alert .dash-stat-cell-value {
  color: #ef4444 !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-stat-cell-label {
  font-size: 11.5px !important;
  color: var(--hbgs-refined-muted) !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .bottom-nav {
  background: var(--hbgs-refined-surface) !important;
  border-top: 1px solid var(--hbgs-refined-line) !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .bottom-nav-item.active {
  color: var(--hbgs-refined-green) !important;
}

@media (max-width: 1050px) {
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-widgets {
    grid-template-columns: 1fr !important;
  }
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-widget,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetCharts,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetTodayAttendance,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetClassInsights,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetAnnouncements,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetAlerts,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetBirthdaysActivity,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetEvents,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetWeeklySummary,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetQuickActions,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetDistribution,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetLeaderboards,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetStats {
    grid-column: 1 / -1 !important;
  }
}

@media (max-width: 768px) {
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .top-header {
    height: calc(54px + env(safe-area-inset-top, 0px)) !important;
    min-height: calc(54px + env(safe-area-inset-top, 0px)) !important;
    padding-top: calc(8px + env(safe-area-inset-top, 0px)) !important;
    padding-right: max(12px, env(safe-area-inset-right, 0px)) !important;
    padding-bottom: 8px !important;
    padding-left: max(12px, env(safe-area-inset-left, 0px)) !important;
    align-items: flex-end !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .main-content,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .content-area {
    padding: 16px 14px calc(72px + env(safe-area-inset-bottom, 0px)) !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-card:last-child:nth-child(odd) {
    grid-column: 1 / -1 !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-card {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto auto !important;
    gap: 4px !important;
    align-items: start !important;
    padding: 12px 14px !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-card strong,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-card .dash-ops-label,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-card #dashOpsAbsentDetail,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-card #dashOpsCopyDetail,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-card #dashOpsTechDetail,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-card #dashOpsAttendanceDetail {
    grid-column: 1 !important;
    grid-row: auto !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-card strong {
    font-size: 22px !important;
    line-height: 1.1 !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-action {
    display: none !important;
  }
}

/* Permanent accessibility contract: visible focus and reduced motion. */
:where(a, button, input, select, textarea, [tabindex]:not([tabindex="-1"]), [role="button"]):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--hbgs-refined-green, #22c55e) 65%, white) !important;
  outline-offset: 2px !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Dashboard density: keep real charts but fit them into the reference rhythm. */
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-chart-container {
  height: 120px !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-chart-card {
  padding: 14px 16px !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-chart-title {
  margin-bottom: 10px !important;
}

@media (max-width: 768px) {
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .sidebar {
    left: auto !important;
    right: 0 !important;
    transform: translateX(100%) !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .sidebar.open {
    transform: translateX(0) !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .mobile-menu-btn {
    display: none !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .page-title-section {
    display: flex !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    align-items: center !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .page-title {
    display: block !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    overflow: hidden !important;
    color: var(--hbgs-refined-text) !important;
    font-size: 15px !important;
    font-weight: 650 !important;
    line-height: 1.2 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .header-year-chip {
    display: none !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .header-actions {
    flex: 0 0 auto !important;
    justify-content: flex-end !important;
    gap: 6px !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .universal-search-btn {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 44px !important;
    flex: 0 0 44px !important;
    justify-content: center !important;
    padding: 0 !important;
    margin-right: 0 !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .main-content .btn,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .main-content button,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .main-content input,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .main-content select,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .main-content textarea,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .sidebar .nav-item,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) :is(.modal, [role="dialog"], .header-dropdown-menu) :is(button, input, select, textarea, [role="tab"], [role="button"]) {
    min-height: var(--touch-target) !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .main-content button,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .main-content select {
    min-width: var(--touch-target) !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .main-content .page-header-actions > .btn {
    flex: 1 1 calc(50% - var(--space-1)) !important;
    width: auto !important;
    max-width: 100%;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) :is(.icon-btn, .modal-close, .btn-icon, .header-icon-btn, .notification-btn, .header-user-btn, .mobile-menu-btn) {
    min-width: var(--touch-target) !important;
    min-height: var(--touch-target) !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .main-content .page-header,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .main-content .card-header {
    gap: 12px !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .main-content .page-header h1,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .main-content .card-title {
    line-height: 1.25 !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .data-empty {
    min-height: 132px !important;
    padding: 24px 18px !important;
    line-height: 1.5 !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .bottom-nav-item {
    min-height: 56px !important;
    padding: 7px 4px 6px !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .sidebar {
    left: auto !important;
    right: 0 !important;
    border-right: 0 !important;
    border-left: 1px solid var(--hbgs-refined-line) !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .bottom-nav-label {
    font-size: 10px !important;
    line-height: 1.1 !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-class-context {
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    margin-top: 8px !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-class-context-note {
    display: none !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-chart-container {
    height: 112px !important;
  }
}

/* Mockup 6 composition: reproduce the approved page hierarchy, not only its palette. */
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetCharts {
  grid-column: 1 / -1 !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  overflow: visible !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetCharts > .dash-widget-header {
  display: none !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetCharts .dash-charts {
  display: grid !important;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) !important;
  gap: 14px !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetCharts .dash-chart-card {
  background: var(--hbgs-refined-surface) !important;
  border: 1px solid var(--hbgs-refined-line) !important;
  border-radius: 10px !important;
  min-width: 0 !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetAlerts {
  grid-column: span 7 !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetBirthdaysActivity {
  grid-column: span 5 !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetStats {
  grid-column: 1 / -1 !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetAlerts .dash-panel-header,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #dashBirthdays {
  display: none !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #dashBirthdaysActivityRow {
  display: block !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetAnnouncements,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetQuickActions,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetTodayAttendance,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetEvents,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetWeeklySummary,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetClassInsights,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetDistribution,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetLeaderboards {
  display: none !important;
}

@media (max-width: 1050px) {
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetCharts .dash-charts {
    grid-template-columns: 1fr !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetAlerts,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetBirthdaysActivity,
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetStats {
    grid-column: 1 / -1 !important;
  }
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-activity-list {
  max-height: 246px !important;
  overflow-y: auto !important;
  padding: 6px 0 !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-activity-item {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 9px 16px !important;
  background: transparent !important;
  border-radius: 0 !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-activity-item:hover {
  background: var(--hbgs-refined-surface-2) !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-activity-icon {
  background: var(--hbgs-refined-green-soft) !important;
  color: var(--hbgs-refined-green) !important;
  font-size: 12px !important;
  flex: 0 0 auto !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-activity-copy {
  min-width: 0 !important;
  flex: 1 1 auto !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-activity-title {
  color: var(--hbgs-refined-text) !important;
  font-size: 13px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-activity-subtitle,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-activity-time {
  color: var(--hbgs-refined-muted) !important;
  font-size: 11px !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-activity-time {
  flex: 0 0 auto !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-activity-empty {
  color: var(--hbgs-refined-muted) !important;
  font-size: 13px !important;
  min-height: 136px !important;
  display: grid !important;
  place-items: center !important;
  padding: 20px !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-class-filter-label,
:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-class-context-note {
  display: none !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetAlerts .dash-alert {
  background: transparent !important;
  border: 0 !important;
  border-left: 0 !important;
  border-bottom: 1px solid var(--hbgs-refined-line) !important;
  border-radius: 0 !important;
  margin: 0 !important;
  padding: 11px 14px !important;
  transform: none !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetAlerts .dash-alert:last-child {
  border-bottom: 0 !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetAlerts .dash-alert-icon {
  background: color-mix(in srgb, var(--hbgs-refined-green) 12%, transparent) !important;
  color: var(--hbgs-refined-green) !important;
  border-radius: 7px !important;
  min-width: 40px !important;
  height: 32px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  text-transform: uppercase !important;
}

:is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetCharts .dash-chart-card:only-child {
  grid-column: 1 / -1 !important;
}

@media (min-width: 769px) {
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-ops-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 769px) and (max-width: 1050px) {
  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) .dash-widgets {
    grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetCharts .dash-charts {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetAlerts {
    grid-column: span 7 !important;
  }

  :is([data-theme="dark"], [data-theme="light"], html:not([data-theme="dark"])) #widgetBirthdaysActivity {
    grid-column: span 5 !important;
  }
}

/* ===== focused-surfaces.css ===== */
/* ==========================================================
   HBGS CALM FLAT — FOCUSED STUDENT & KIOSK SURFACES
   Loaded after each focused page's workflow-specific inline CSS.
   This layer changes presentation only; it does not alter routes,
   authentication, permissions, or kiosk/student workflows.
   ========================================================== */

html[data-theme="light"] body.kiosk-body.kiosk-body {
  --focused-bg: var(--hbgs-bg, #f4f7f4);
  --focused-surface: var(--hbgs-surface, #ffffff);
  --focused-surface-2: var(--hbgs-surface-2, #f8faf8);
  --focused-line: var(--hbgs-line, #d9e1db);
  --focused-line-strong: var(--hbgs-line-strong, #b8c5bc);
  --focused-text: var(--hbgs-ink, #142319);
  --focused-muted: var(--hbgs-ink-2, #5f6f64);
  --focused-green: var(--hbgs-accent, #138a4b);
  --focused-green-soft: var(--hbgs-accent-wash, rgba(19, 138, 75, .1));
  color-scheme: light;
}

html body.student-portal-body.student-portal-body {
  --focused-bg: var(--hbgs-bg, #0f1512);
  --focused-surface: var(--hbgs-surface, #151d18);
  --focused-surface-2: var(--hbgs-surface-2, #1b2620);
  --focused-line: var(--hbgs-line, #26332c);
  --focused-line-strong: var(--hbgs-line-strong, #34443b);
  --focused-text: var(--hbgs-ink, #e8ede9);
  --focused-muted: var(--hbgs-ink-2, #93a39a);
  --focused-green: var(--hbgs-accent, #22c55e);
  --focused-green-soft: var(--hbgs-accent-wash, rgba(34, 197, 94, .12));
  color-scheme: dark;
}

html body.kiosk-body.kiosk-body,
html body.student-portal-body.student-portal-body {
  --bg-primary: var(--focused-bg);
  --bg-secondary: var(--focused-surface);
  --bg-tertiary: var(--focused-surface-2);
  --card-bg: var(--focused-surface);
  --border-color: var(--focused-line);
  --text-primary: var(--focused-text);
  --text-secondary: var(--focused-muted);
  --text-muted: var(--focused-muted);
  --primary: var(--focused-green);
  --success: var(--focused-green);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--focused-bg) !important;
  color: var(--focused-text) !important;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}

.kiosk-body :is(h1, h2, h3),
.student-portal-body :is(h1, h2, h3) {
  color: var(--focused-text) !important;
}

.kiosk-body .kiosk-header,
.kiosk-body .kiosk-signin-card,
.kiosk-body .kiosk-card,
.kiosk-body .kiosk-recent-card,
.kiosk-body .kiosk-dialog,
.kiosk-body .kiosk-switcher-menu,
.kiosk-body .kiosk-toggle-bar,
.kiosk-body .pwa-install-banner,
.student-portal-body .login-card,
.student-portal-body .dashboard-header,
.student-portal-body .dashboard-card,
.student-portal-body .progress-summary,
.student-portal-body .motivational-banner,
.student-portal-body .trip-countdown {
  background: var(--focused-surface) !important;
  border: 1px solid var(--focused-line) !important;
  border-radius: 10px !important;
  color: var(--focused-text) !important;
  box-shadow: none !important;
}

.kiosk-body .kiosk-recent-card {
  background: var(--focused-surface) !important;
  border: 1px solid var(--focused-line) !important;
  color: var(--focused-text) !important;
}

.kiosk-body .kiosk-recent-header {
  background: var(--focused-surface) !important;
  border-bottom: 1px solid var(--focused-line) !important;
  color: var(--focused-text) !important;
}

.kiosk-body .kiosk-recent-list {
  background: var(--focused-surface) !important;
  color: var(--focused-text) !important;
}

.kiosk-body .kiosk-recent-title {
  color: var(--focused-text) !important;
}

.kiosk-body .kiosk-recent-count {
  background: var(--focused-green-soft) !important;
  color: var(--focused-green) !important;
}

.kiosk-body .kiosk-header,
.student-portal-body .dashboard-header {
  border-width: 0 0 1px !important;
  border-radius: 0 !important;
}

.kiosk-body :is(input, select, textarea, .kiosk-select, .kiosk-search),
.student-portal-body :is(input, select, textarea, .form-input) {
  min-height: 44px;
  background: var(--focused-surface-2) !important;
  border: 1px solid var(--focused-line) !important;
  border-radius: 8px !important;
  color: var(--focused-text) !important;
  box-shadow: none !important;
}

.kiosk-body :is(input, textarea)::placeholder,
.student-portal-body :is(input, textarea)::placeholder {
  color: var(--focused-muted) !important;
}

.kiosk-body button,
.student-portal-body button,
.student-portal-body .btn {
  min-height: 44px;
  border-radius: 8px !important;
  box-shadow: none !important;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease !important;
}

.kiosk-body :is(.kiosk-signin-btn, .kiosk-submit-btn, .kiosk-primary-btn, .kiosk-dialog-btn.primary, button[class*="primary"]),
.student-portal-body :is(.btn-primary, .period-btn.active, .schedule-day-btn.active) {
  background: var(--focused-green) !important;
  border: 1px solid var(--focused-green) !important;
  color: #07130c !important;
}

.kiosk-body :is(.kiosk-staff-btn, .kiosk-switcher-btn, .kiosk-toggle-btn, .kiosk-dialog-btn, button:not([class*="primary"]):not([class*="submit"]):not(.kiosk-signin-btn)),
.student-portal-body :is(.btn-outline, .change-pin-btn, .logout-btn, .period-btn, .schedule-day-btn) {
  background: var(--focused-surface-2) !important;
  border: 1px solid var(--focused-line) !important;
  color: var(--focused-text) !important;
}

.kiosk-body :is(.kiosk-field, .kiosk-item, .kiosk-switcher-item, .kiosk-staff-item, .kiosk-empty, .kiosk-no-items, .kiosk-no-contacts),
.student-portal-body :is(.card-header, .schedule-card-body, .loading, .empty-state) {
  background: transparent !important;
  border-color: var(--focused-line) !important;
  color: var(--focused-text) !important;
  box-shadow: none !important;
}

.kiosk-body :is(.kiosk-subtitle, .kiosk-label, .kiosk-clock-date, .kiosk-school-sub, .kiosk-card-subtitle, .kiosk-empty, .kiosk-no-items, .kiosk-no-contacts),
.student-portal-body :is(.login-subtitle, .welcome-text, .student-meta, .portal-footer, .card-subtitle) {
  color: var(--focused-muted) !important;
}

.kiosk-body :is(.kiosk-logo, .kiosk-switcher-icon),
.student-portal-body :is(.login-logo, .card-title-icon) {
  filter: none !important;
}

.kiosk-body :focus-visible,
.student-portal-body :focus-visible {
  outline: 3px solid var(--focused-green) !important;
  outline-offset: 2px !important;
}

.kiosk-body .kiosk-main,
.student-portal-body .container {
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)) !important;
}

@media (max-width: 768px) {
  .kiosk-body .kiosk-header,
  .student-portal-body .dashboard-header {
    padding-top: calc(12px + env(safe-area-inset-top, 0px)) !important;
  }

  .kiosk-body .kiosk-signin-card,
  .kiosk-body .kiosk-card,
  .student-portal-body .login-card,
  .student-portal-body .dashboard-card {
    border-radius: 10px !important;
  }
}

.new-year-empty-state {
  max-width: 680px;
  margin: clamp(24px, 6vh, 64px) auto;
  padding: clamp(28px, 5vw, 48px) !important;
  text-align: center;
}
.new-year-empty-icon {
  width: 42px;
  height: 42px;
  margin-bottom: 14px;
  fill: none;
  stroke: var(--text-secondary);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.new-year-empty-state h2 {
  margin: 0 0 8px;
  font-size: 18px;
}
.new-year-empty-state p {
  max-width: 560px;
  margin: 0 auto;
  color: var(--text-secondary);
  line-height: 1.55;
}

@media (prefers-reduced-motion: reduce) {
  .kiosk-body *,
  .kiosk-body *::before,
  .kiosk-body *::after,
  .student-portal-body *,
  .student-portal-body *::before,
  .student-portal-body *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* RC67: Minimal staff sign-in shell */
.login-wrapper {
  --login-accent: var(--hbgs-accent, #138a4b);
  --login-accent-hover: var(--hbgs-accent-hover, #0f713e);
  --login-canvas: var(--hbgs-bg, #f4f7f4);
  --login-form: var(--hbgs-surface, #ffffff);
  --login-input: var(--hbgs-surface, #ffffff);
  --login-line: var(--hbgs-line, #d9e1db);
  --login-ink: var(--hbgs-ink, #142319);
  --login-muted: var(--hbgs-ink-2, #68736c);
  box-sizing: border-box;
  min-height: 100dvh;
  height: auto;
  padding: clamp(20px, 4vw, 48px);
  overflow-y: auto;
  align-items: safe center;
  background: var(--login-canvas);
  color: var(--login-ink);
}

.dark-mode .login-wrapper,
[data-theme="dark"] .login-wrapper {
  --login-canvas: var(--hbgs-bg, #09150f);
  --login-form: var(--hbgs-surface, #111d16);
  --login-input: var(--hbgs-surface-2, #0c1711);
  --login-line: var(--hbgs-line, #2a3c31);
  --login-ink: var(--hbgs-ink, #f1f7f3);
  --login-muted: var(--hbgs-ink-2, #a2b2a8);
}

.login-wrapper .login-card {
  width: min(100%, 440px);
  max-width: 440px;
  padding: clamp(32px, 5vw, 48px);
  border: 1px solid var(--login-line);
  border-radius: 12px;
  background: var(--login-form);
  box-shadow: none;
}

.login-form-panel { min-width: 0; }
.login-wrapper .login-header {
  margin: 0 0 32px;
  text-align: center;
}
.login-school-logo {
  display: block;
  width: min(100%, 220px);
  height: auto;
  margin: 0 auto 28px;
}

.login-eyebrow {
  margin: 0 0 8px;
  color: var(--login-muted);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.login-wrapper .login-title {
  margin: 0;
  color: var(--login-ink);
  font-size: clamp(1.75rem, 5vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.03em;
}

.login-wrapper .year-end-lockdown-message {
  margin: 0 0 var(--space-5);
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--login-line));
  border-left: 3px solid var(--warning);
  border-radius: 8px;
  background: color-mix(in srgb, var(--warning) 7%, var(--login-form));
}
.login-wrapper .year-end-lockdown-message strong { color: var(--login-ink); }
.login-wrapper .year-end-lockdown-message span { color: var(--login-muted); }
.login-wrapper .login-form { gap: 20px; }
.login-wrapper .login-field label {
  margin-bottom: 8px;
  color: var(--login-ink);
  font-size: var(--text-sm);
  font-weight: 650;
}
.login-wrapper .login-field input {
  min-height: 48px;
  border: 1px solid var(--login-line);
  border-radius: 9px;
  background: var(--login-input);
  color: var(--login-ink);
  box-shadow: none;
}
.login-wrapper .login-field input::placeholder { color: var(--login-muted); opacity: .72; }
.login-wrapper .login-field input:focus {
  border-color: var(--login-accent);
  outline: 3px solid color-mix(in srgb, var(--login-accent) 18%, transparent);
}

.login-field-meta {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}
.login-wrapper .forgot-password-link {
  min-height: 44px;
  padding: 4px 0;
  color: var(--login-accent);
  font-size: var(--text-xs);
  font-weight: 700;
}
.login-wrapper .password-toggle { width: 44px; min-width: 44px; height: 44px; color: var(--login-muted); }
.login-wrapper .login-btn,
.login-wrapper .login-passkey-btn { min-height: 48px; border-radius: 9px; font-weight: 700; }
.login-wrapper .login-btn { background: var(--login-accent); color: #ffffff; }
.login-wrapper .login-btn:hover { background: var(--login-accent-hover); }
.login-wrapper .login-passkey-btn { border-color: var(--login-line); background: var(--login-input); color: var(--login-ink); }
.login-footer {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}
.login-wrapper .login-version { margin: 0; color: var(--login-muted); font-size: .68rem; opacity: .7; }

@media (max-width: 760px) {
  .login-wrapper {
    padding: 0;
    background: var(--login-form);
  }
  .login-wrapper .login-card {
    width: 100%;
    min-height: 100dvh;
    margin: 0;
    padding: max(36px, env(safe-area-inset-top, 0px)) 24px max(28px, env(safe-area-inset-bottom, 0px));
    border: 0;
    border-radius: 0;
  }
  .login-form-panel { width: min(100%, 420px); margin: auto; }
  .login-wrapper .login-header { margin-bottom: 30px; }
  .login-school-logo { width: 200px; margin-bottom: 24px; }
}

@media (max-width: 420px) {
  .login-wrapper .login-card { padding-inline: 20px; }
}

@media (max-height: 620px) and (orientation: landscape) {
  .login-wrapper { align-items: flex-start; }
  .login-wrapper:not(.hidden) {
    padding-top: calc(76px + env(safe-area-inset-top, 0px));
  }
  .login-wrapper .login-card { min-height: 0; margin-block: 0; padding-block: 24px; }
  .login-wrapper .login-header { margin-bottom: 20px; }
  .login-school-logo { width: 180px; margin-bottom: 16px; }
  .login-footer { display: none; }
  .login-wrapper:not(.hidden) ~ .app-offline-banner {
    top: max(10px, env(safe-area-inset-top, 0px));
    right: auto;
    bottom: auto;
    left: max(10px, env(safe-area-inset-left, 0px));
    width: min(420px, calc(100% - 160px));
    max-width: 420px;
    transform: translateY(calc(-100% - 24px));
  }
  .login-wrapper:not(.hidden) ~ .app-offline-banner.visible {
    transform: translateY(0);
  }
  .login-wrapper:not(.hidden) ~ .app-offline-banner .offline-banner-text span {
    display: none;
  }
}

/* RC41: final mobile resilience contract for routed workspaces. */
@media (max-width: 768px) {
  .main-content .card { overflow: visible !important; }
  .main-content :is(.table-responsive, .table-container, .data-table-container) {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }
  .main-content :is(.btn-sm, .btn-xs, .action-btn, .tab-btn, .tab, .att-tab, .call-tab) {
    min-block-size: var(--touch-target, 44px) !important;
  }
  .main-content input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
  .main-content select,
  .main-content textarea {
    min-block-size: var(--control-height, 44px);
    max-width: 100%;
    min-width: 0;
    font-size: max(16px, 1em);
  }
  #announcementModal [style*="grid-template-columns"],
  #editAnnouncementModal [style*="grid-template-columns"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  /* RC42: keep every More-drawer option above the persistent bottom bar. */
  .sidebar {
    top: 0 !important;
    right: 0 !important;
    bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px)) !important;
    height: auto !important;
    max-height: none !important;
    border-bottom: 1px solid var(--border-color);
    box-shadow: -16px 0 36px rgba(0, 0, 0, .28);
  }
  .sidebar-nav {
    min-height: 0;
    padding-bottom: 24px !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
  }
  .sidebar-nav .nav-section:last-child {
    padding-bottom: 16px;
  }

  /* One quiet, consistent treatment for top-header actions. */
  .header-actions {
    gap: 4px !important;
  }
  .top-header :is(.universal-search-btn, .notification-btn, .header-user-btn) {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 10px !important;
    background: var(--bg-secondary) !important;
    color: var(--text-secondary) !important;
    box-shadow: none !important;
  }
  .top-header :is(.universal-search-btn, .notification-btn, .header-user-btn):is(:hover, :active, [aria-expanded="true"]) {
    border-color: var(--border-color) !important;
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
  }
  .top-header :is(.universal-search-btn, .header-action-icon) svg {
    width: 20px !important;
    height: 20px !important;
    stroke-width: 1.8 !important;
  }
  html .top-header .header-user-avatar {
    width: 20px !important;
    height: 20px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--text-secondary) !important;
  }
  .bottom-nav-icon {
    width: 22px !important;
    height: 22px !important;
    color: var(--text-secondary) !important;
  }
  .bottom-nav-icon :is(svg, .hbgs-icon) {
    width: 22px !important;
    height: 22px !important;
    stroke-width: 1.8 !important;
  }
  .bottom-nav-item.active :is(.bottom-nav-icon, .bottom-nav-label) {
    color: var(--hbgs-accent) !important;
  }
  .bottom-nav-label {
    font-size: 11px !important;
    font-weight: 600 !important;
  }
}

/* RC44: shared navigation, identity, context, content-width, and empty-state refinements. */
.mobile-sheet-heading,
.mobile-sheet-search {
  display: none;
}

.page-title-copy {
  min-width: 0;
}
.page-title-copy .page-title {
  display: block !important;
}
.page-title-context {
  display: block;
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 550;
  line-height: 1.2;
  white-space: nowrap;
}
.page-title-context.is-archive {
  color: var(--warning);
}

.header-year-select {
  min-width: 86px;
  height: 40px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--hbgs-refined-line);
  border-radius: 8px;
  background: var(--hbgs-refined-surface);
  color: var(--hbgs-refined-text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
}
.header-year-select.is-archive {
  border-color: var(--warning);
  color: var(--warning);
}

.user-menu-identity {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
}
.user-menu-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--hbgs-refined-green-soft);
  color: var(--hbgs-refined-green);
}
.user-menu-identity-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}
.user-menu-identity-copy strong,
.user-menu-identity-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-menu-identity-copy strong {
  color: var(--text-primary);
  font-size: 14px;
}
.user-menu-identity-copy span {
  color: var(--text-secondary);
  font-size: 11px;
}
.header-dropdown-group-label {
  padding: 9px 12px 4px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

#pageRoot[data-content-width] > * {
  width: 100%;
  margin-inline: auto;
}
#pageRoot[data-content-width="narrow"] > * { max-width: 760px; }
#pageRoot[data-content-width="standard"] > * { max-width: 1120px; }
#pageRoot[data-content-width="wide"] > * { max-width: var(--content-max-width); }

:is(.empty-state, .data-empty):not(:empty) {
  border-color: transparent;
  box-shadow: none;
}
.empty-state-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--hbgs-refined-green-soft);
  color: var(--hbgs-refined-green);
}
.empty-state .btn,
.data-empty .btn {
  margin-top: 14px;
}

.page-title-context[hidden],
.profile-school-term-status[hidden] {
  display: none !important;
}

/* Keep desktop shell geometry identical in light and dark themes. */
@media (min-width: 901px) {
  html .top-header .page-title-copy .page-title {
    display: block !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    white-space: nowrap;
  }
  html .top-header .page-title-section {
    flex: 0 0 auto !important;
    min-width: 0;
  }
  html .top-header .header-actions {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    gap: 10px !important;
  }
  html .top-header .universal-search-btn {
    display: inline-flex !important;
    flex: 1 1 auto !important;
    width: auto !important;
    max-width: 440px !important;
    min-width: 220px !important;
    height: 40px !important;
    margin-right: auto !important;
    padding: 7px 12px !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    border: 1px solid var(--hbgs-refined-line) !important;
    border-radius: 8px !important;
    background: var(--hbgs-refined-surface) !important;
    color: var(--hbgs-refined-muted) !important;
  }
  html .top-header .universal-search-label {
    display: block !important;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden !important;
    text-overflow: ellipsis;
    white-space: nowrap !important;
    text-align: left;
  }
  html .top-header .universal-search-kbd {
    display: inline-flex !important;
    flex: 0 0 auto;
  }
  html .top-header :is(.header-user-name, .header-user-caret) {
    display: none !important;
  }
  html .top-header :is(.notification-btn, .header-user-btn) {
    border-color: var(--hbgs-refined-line) !important;
    background: var(--hbgs-refined-surface) !important;
    color: var(--hbgs-refined-text) !important;
  }
  html .top-header .header-user-btn {
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    border-radius: 50% !important;
  }
  html .top-header .header-year-chip {
    padding: 6px 10px !important;
    border: 1px solid var(--hbgs-refined-line) !important;
    border-radius: 8px !important;
    background: var(--hbgs-refined-surface) !important;
    color: var(--hbgs-refined-text) !important;
    font-size: 12px !important;
    white-space: nowrap;
  }
}

@media (min-width: 769px) {
  .main-content .page-header {
    align-items: flex-start;
  }
  .main-content .page-header-actions {
    justify-content: flex-end;
    margin-left: auto;
  }
}

@media (max-width: 768px) {
  /* RC53: Mobile header refinement — keep the title and actions in one calm,
     vertically centered content row beneath the iOS safe area. */
  .top-header {
    box-sizing: border-box !important;
    height: calc(60px + env(safe-area-inset-top, 0px)) !important;
    min-height: calc(60px + env(safe-area-inset-top, 0px)) !important;
    padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)) !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
  }
  .top-header .page-title-section {
    align-self: stretch;
    display: flex !important;
    align-items: center !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }
  .top-header .page-title-copy {
    display: flex;
    align-items: center;
    min-width: 0;
  }
  .top-header .page-title {
    margin: 0 !important;
    font-size: 18px !important;
    font-weight: 650 !important;
    line-height: 1.2 !important;
    letter-spacing: -.015em;
  }
  .top-header .page-title-context {
    display: none !important;
  }
  .top-header .header-actions {
    align-self: stretch;
    display: flex;
    align-items: center !important;
    gap: 4px !important;
  }
  .top-header .header-year-select {
    flex: 0 0 auto;
    width: 100px;
    min-width: 100px;
    height: 40px;
    padding: 0 20px 0 8px;
    font-size: 12px;
  }
  html .top-header :is(.universal-search-btn, .notification-btn, .header-user-btn) {
    border-color: transparent !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  html .top-header :is(.universal-search-btn, .notification-btn, .header-user-btn):is(:hover, :focus-visible, :active, [aria-expanded="true"]) {
    border-color: var(--border-color) !important;
    background: var(--bg-secondary) !important;
  }

  html #appLayout #sidebar {
    top: auto !important;
    right: auto !important;
    bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 8px) !important;
    left: 50% !important;
    width: min(calc(100vw - 20px), 560px) !important;
    max-width: none !important;
    height: min(82dvh, 720px) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 18px !important;
    transform: translate(-50%, calc(100% + var(--bottom-nav-height) + 24px)) !important;
    box-shadow: 0 -18px 48px rgba(0, 0, 0, .34) !important;
  }
  html #appLayout #sidebar.open {
    transform: translate(-50%, 0) !important;
  }
  html .app-layout .sidebar .sidebar-header {
    padding: 14px !important;
    padding-top: 14px !important;
    border-bottom: 1px solid var(--border-color) !important;
  }
  /* The persistent bottom bar already owns these four destinations. Keep the
     More sheet focused on the remaining tools instead of duplicating them. */
  html .app-layout .sidebar-nav :is(#tabDashboard, #tabAttendance, #tabStudents, #tabCopyRequests) {
    display: none !important;
  }
  html .app-layout .sidebar-nav > .nav-section:first-child {
    display: none !important;
  }
  .sidebar-header .sidebar-brand {
    display: none !important;
  }
  .mobile-sheet-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .mobile-sheet-heading h2 {
    margin: 1px 0 0;
    color: var(--text-primary);
    font-size: 20px;
    line-height: 1.2;
  }
  .mobile-sheet-kicker {
    color: var(--hbgs-accent);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  .mobile-sheet-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
  }
  .mobile-sheet-search {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    margin-top: 10px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
    color: var(--text-secondary);
  }
  .mobile-sheet-search input {
    min-width: 0;
    width: 100%;
    height: 42px;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-primary);
  }
  .sidebar-nav {
    padding: 10px 12px 20px !important;
  }
  .nav-section {
    margin-bottom: 14px !important;
  }
  .nav-section-title {
    padding-inline: 10px !important;
  }

  /* Quiet header actions: preserve 44px targets without three competing boxes. */
  .top-header .universal-search-btn :is(.universal-search-label, .universal-search-kbd) {
    display: none !important;
  }
  .top-header :is(.universal-search-btn, .notification-btn, .header-user-btn) {
    border-color: transparent !important;
    background: transparent !important;
  }
  .top-header :is(.universal-search-btn, .notification-btn, .header-user-btn):is(:hover, :focus-visible, :active, [aria-expanded="true"]) {
    border-color: var(--border-color) !important;
    background: var(--bg-secondary) !important;
  }
  html .top-header .header-user-avatar {
    width: 20px !important;
    height: 20px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--text-secondary) !important;
  }
  html .top-header .header-user-btn,
  html .top-header .header-user-btn:is(:hover, :focus, :focus-visible, :active, [aria-expanded="true"]) {
    border-color: transparent !important;
    background: transparent !important;
    color: var(--text-secondary) !important;
    box-shadow: none !important;
  }

  .bottom-nav-item {
    position: relative;
  }
  .bottom-nav-item :is(.bottom-nav-icon-wrapper, .bottom-nav-label) {
    position: relative;
    z-index: 1;
  }
  .bottom-nav-item::before {
    content: '';
    position: absolute;
    inset: 5px 4px;
    border-radius: 12px;
    background: transparent;
    transition: background-color .15s ease;
  }
  .bottom-nav-item.active::before,
  .bottom-nav-item.drawer-open::before {
    background: var(--hbgs-refined-green-soft);
  }
  .bottom-nav-item.drawer-open :is(.bottom-nav-icon, .bottom-nav-label) {
    color: var(--hbgs-accent) !important;
  }
}

@media (max-width: 340px) {
  .top-header .header-year-select {
    width: 90px;
    min-width: 90px;
    padding-left: 6px;
    font-size: 11px;
  }
  .top-header .universal-search-btn {
    display: none !important;
  }
}

/* Compact school-year popover — avoids native select chrome in the app header. */
.header-year-control { position: relative; flex: 0 0 auto; }
.header-year-trigger { height: 36px; min-width: 94px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 11px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-secondary); color: var(--text-primary); font: inherit; font-size: 13px; font-weight: 650; letter-spacing: -.01em; cursor: pointer; }
.header-year-trigger:hover,
.header-year-trigger[aria-expanded="true"] { border-color: color-mix(in srgb, var(--hbgs-accent) 60%, var(--border-color)); background: var(--bg-tertiary); }
.header-year-trigger.is-archive { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 50%, var(--border-color)); }
.header-year-chevron { color: var(--text-muted); font-size: 14px; line-height: 1; transition: transform .15s ease; }
.header-year-trigger[aria-expanded="true"] .header-year-chevron { transform: rotate(180deg); }
.header-year-menu { position: absolute; z-index: var(--z-dropdown); top: calc(100% + 8px); right: 0; width: 188px; padding: 6px; border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-secondary); box-shadow: 0 16px 36px rgba(0, 0, 0, .28); }
.header-year-menu[hidden] { display: none; }
.header-year-menu-heading { padding: 7px 10px 6px; color: var(--text-muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.header-year-option { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text-primary); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.header-year-option:hover,
.header-year-option:focus-visible { background: var(--bg-tertiary); }
.header-year-option[aria-selected="true"] { background: var(--hbgs-refined-green-soft); color: var(--hbgs-accent); }
.header-year-option-status { color: var(--text-muted); font-size: 11px; font-weight: 500; }
@media (max-width: 768px) {
  .top-header .header-year-trigger { min-width: 92px; height: 44px; padding: 0 9px; font-size: 12px; }
  .header-year-menu { position: fixed; top: calc(var(--top-header-height, 54px) + env(safe-area-inset-top, 0px) + 6px); left: 10px; right: 10px; width: auto; padding: 8px; border-radius: 14px; }
  .header-year-option { min-height: 48px; padding-inline: 12px; }
}

/* Short touch-landscape devices still need full-size controls even above 768px. */
@media (max-height: 500px) and (hover: none) and (pointer: coarse) {
  html body :is(button[id], [role="button"], .btn, .call-tab) {
    min-width: var(--touch-target) !important;
    min-height: var(--touch-target) !important;
  }
  html body .app-layout .sidebar .sidebar-nav .nav-item,
  #pageRoot :is(.period-pill, .tab) {
    min-height: var(--touch-target) !important;
  }
  html body .app-layout :is(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), select, textarea) {
    min-height: var(--touch-target) !important;
  }
}

/* ===== theme-picker.css ===== */
/* HBGS theme picker — shared by the profile menu and Settings. */

/* Theme-specific tokens live last in the generated cascade so both modern
   --hbgs-* consumers and legacy aliases resolve to one coherent palette. */
:root[data-theme-name="warm-paper"] {
  --hbgs-bg: #f5f0e6;
  --hbgs-surface: #fffaf0;
  --hbgs-surface-2: #eee6d8;
  --hbgs-surface-3: #e4dac9;
  --hbgs-ink: #29261f;
  --hbgs-ink-2: #5f584c;
  --hbgs-ink-3: #6b6356;
  --hbgs-line: #d8cdbb;
  --hbgs-line-strong: #bcae98;
  --hbgs-accent: #2f855a;
  --hbgs-accent-hover: #276749;
  --hbgs-accent-ink: #22543d;
  --hbgs-accent-contrast: #ffffff;
  --hbgs-accent-wash: rgba(47, 133, 90, 0.12);
  --hbgs-accent-ring: rgba(47, 133, 90, 0.34);
  --hbgs-hero-bg: #35664b;
  --hbgs-hero-ink: #fffaf0;
  --hbgs-hero-ink-2: rgba(255, 250, 240, 0.76);
  --hbgs-hero-line: rgba(255, 250, 240, 0.2);
  --hbgs-hero-well: rgba(255, 250, 240, 0.12);
  --hbgs-refined-bg: var(--hbgs-bg);
  --hbgs-refined-surface: var(--hbgs-surface);
  --hbgs-refined-surface-2: var(--hbgs-surface-2);
  --hbgs-refined-surface-3: var(--hbgs-surface-3);
  --hbgs-refined-line: var(--hbgs-line);
  --hbgs-refined-line-strong: var(--hbgs-line-strong);
  --hbgs-refined-text: var(--hbgs-ink);
  --hbgs-refined-muted: var(--hbgs-ink-3);
  --hbgs-refined-soft: var(--hbgs-ink-3);
  --hbgs-refined-green: var(--hbgs-accent);
  --hbgs-refined-green-soft: var(--hbgs-accent-wash);
  --bg-primary: var(--hbgs-bg);
  --bg-secondary: var(--hbgs-surface);
  --bg-tertiary: var(--hbgs-surface-2);
  --card-bg: var(--hbgs-surface);
  --text-primary: var(--hbgs-ink);
  --text-secondary: var(--hbgs-ink-2);
  --text-muted: var(--hbgs-ink-3);
  --border-color: var(--hbgs-line);
  --primary: var(--hbgs-accent);
  --primary-dark: var(--hbgs-accent-hover);
  --primary-color: var(--hbgs-accent);
  --primary-light: var(--hbgs-accent-wash);
  --primary-hover: var(--hbgs-accent-hover);
  --border-primary: var(--hbgs-accent);
  --text-tertiary: #6b6356;
  /* The legacy UI still consumes the neutral scale directly. Keep those
     surfaces warm instead of allowing cool default grays to leak through. */
  --gray-0: #fffaf0;
  --gray-50: #f5f0e6;
  --gray-100: #eee6d8;
  --gray-200: #e4dac9;
  --gray-300: #d8cdbb;
  --gray-400: #6b6356;
  --gray-500: #6b6356;
  --gray-600: #5f584c;
  --gray-700: #49443b;
  --gray-800: #38342c;
  --gray-900: #29261f;
}

:root[data-theme-name="unicorn"] {
  --hbgs-bg: #f7f3ff;
  --hbgs-surface: #fffcff;
  --hbgs-surface-2: #f1ebff;
  --hbgs-surface-3: #e7defa;
  --hbgs-ink: #241b2f;
  --hbgs-ink-2: #51445f;
  --hbgs-ink-3: #655772;
  --hbgs-line: #ddd6fe;
  --hbgs-line-strong: #c4b5fd;
  --hbgs-control-line: #8b75b3;
  --hbgs-control-line-strong: #7d679f;
  --hbgs-accent: #7c3aed;
  --hbgs-accent-hover: #6d28d9;
  --hbgs-accent-ink: #6d28d9;
  --hbgs-accent-contrast: #ffffff;
  --hbgs-accent-wash: rgba(124, 58, 237, 0.12);
  --hbgs-accent-ring: #7c3aed;
  --hbgs-hero-focus-ring: #ffffff;
  --hbgs-hero-bg: #6d28d9;
  --hbgs-hero-ink: #ffffff;
  --hbgs-hero-ink-2: rgba(245, 243, 255, 0.82);
  --hbgs-hero-line: rgba(255, 255, 255, 0.22);
  --hbgs-hero-well: rgba(255, 255, 255, 0.14);
  --hbgs-refined-bg: var(--hbgs-bg);
  --hbgs-refined-surface: var(--hbgs-surface);
  --hbgs-refined-surface-2: var(--hbgs-surface-2);
  --hbgs-refined-surface-3: var(--hbgs-surface-3);
  --hbgs-refined-line: var(--hbgs-line);
  --hbgs-refined-line-strong: var(--hbgs-line-strong);
  --hbgs-refined-text: var(--hbgs-ink);
  --hbgs-refined-muted: var(--hbgs-ink-3);
  --hbgs-refined-soft: var(--hbgs-ink-3);
  --hbgs-refined-green: var(--hbgs-accent);
  --hbgs-refined-green-soft: var(--hbgs-accent-wash);
  --bg-primary: var(--hbgs-bg);
  --bg-secondary: var(--hbgs-surface);
  --bg-tertiary: var(--hbgs-surface-2);
  --card-bg: var(--hbgs-surface);
  --text-primary: var(--hbgs-ink);
  --text-secondary: var(--hbgs-ink-2);
  --text-muted: var(--hbgs-ink-3);
  --border-color: var(--hbgs-line);
  --primary: var(--hbgs-accent);
  --primary-dark: var(--hbgs-accent-hover);
  --primary-color: var(--hbgs-accent);
  --primary-light: var(--hbgs-accent-wash);
  --primary-hover: var(--hbgs-accent-hover);
  --border-primary: var(--hbgs-accent);
  --text-tertiary: #655772;
  --gray-0: #fffcff;
  --gray-50: #f7f3ff;
  --gray-100: #f1ebff;
  --gray-200: #e7defa;
  --gray-300: #ddd6fe;
  --gray-400: #655772;
  --gray-500: #655772;
  --gray-600: #51445f;
  --gray-700: #3f344a;
  --gray-800: #30263b;
  --gray-900: #241b2f;
}

html[data-theme-name="unicorn"] :where(
  input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
  select,
  textarea
) {
  border-color: var(--hbgs-control-line) !important;
}

html[data-theme-name="unicorn"] :where(
  input.input-error,
  input.is-invalid,
  input[aria-invalid="true"],
  .form-input.input-error,
  .form-input.is-invalid
) {
  border-color: var(--hbgs-danger) !important;
}

html[data-theme-name="unicorn"] :where(input.input-warning, .form-input.input-warning) {
  border-color: var(--hbgs-warn) !important;
}

html[data-theme-name="unicorn"] :where(
  input.input-success,
  input.is-valid,
  .form-input.input-success,
  .form-input.is-valid
) {
  border-color: var(--hbgs-ok) !important;
}

html[data-theme-name="unicorn"][data-theme="light"] body :is(
  a,
  button,
  input,
  select,
  textarea,
  [tabindex]:not([tabindex="-1"]),
  [role="button"]
):focus-visible {
  outline: 3px solid var(--hbgs-accent-ring) !important;
  outline-offset: 2px !important;
}

html[data-theme-name="unicorn"][data-theme="light"] body :is(
  .bulk-action-bar:has(#bulkCompleteBtn),
  .bulk-action-bar:has(#bulkFulfillBtn),
  .bulk-action-bar:has(#bulkResolveBtn)
) :is(
  a,
  button,
  input,
  select,
  textarea,
  [tabindex]:not([tabindex="-1"]),
  [role="button"]
):focus-visible {
  outline-color: var(--hbgs-hero-focus-ring) !important;
}

html[data-theme-name="unicorn"] :where(
  button,
  [role="button"],
  .btn,
  .theme-choice,
  .login-theme-toggle
) {
  border-color: var(--hbgs-control-line);
}

html[data-theme-name="unicorn"] :where(
  .sidebar-toggle-btn,
  .mobile-menu-btn,
  .universal-search-btn,
  .notification-btn,
  .import-status-btn,
  .header-icon-btn
) {
  border-color: var(--hbgs-control-line) !important;
}

html[data-theme-name="unicorn"][data-theme="light"] .top-header :is(
  .sidebar-toggle-btn,
  .mobile-menu-btn,
  .universal-search-btn,
  .notification-btn,
  .import-status-btn,
  .header-icon-btn
) {
  border-color: var(--hbgs-control-line) !important;
}

html[data-theme-name="unicorn"] :where(
  .btn-secondary:hover:not(:disabled),
  .btn-outline:not(.btn-danger):hover:not(:disabled),
  .theme-choice:not(.is-selected):hover,
  .sidebar-toggle-btn:hover,
  .mobile-menu-btn:hover,
  .universal-search-btn:hover,
  .notification-btn:hover,
  .import-status-btn:hover,
  .header-icon-btn:hover
) {
  border-color: var(--hbgs-control-line-strong) !important;
}

html[data-theme-name="unicorn"] .bulk-action-buttons .btn {
  border-color: var(--hbgs-control-line) !important;
}

html[data-theme-name="unicorn"][data-theme="light"] body .dash-ops-card-button:is(.is-attention, .is-warn, .is-active) {
  border-color: var(--hbgs-control-line) !important;
}

html[data-theme-name="unicorn"][data-theme="light"] body .dash-ops-card-button:hover {
  border-color: var(--hbgs-control-line-strong) !important;
}

html[data-theme-name="unicorn"][data-theme="light"] body .dash-ops-card-button:is(.is-attention, .is-warn, .is-active):hover {
  border-color: var(--hbgs-control-line-strong) !important;
}

html[data-theme-name="unicorn"] :is(
  .header-user-btn,
  .dash-ops-card-button,
  .workspace-tab
) {
  border-color: var(--hbgs-control-line) !important;
}

:root[data-theme-name="midnight-blue"] {
  --hbgs-bg: #0b1220;
  --hbgs-surface: #111c2f;
  --hbgs-surface-2: #17253b;
  --hbgs-surface-3: #1d2f49;
  --hbgs-ink: #edf4ff;
  --hbgs-ink-2: #bac8db;
  --hbgs-ink-3: #91a3ba;
  --hbgs-line: #263a56;
  --hbgs-line-strong: #385274;
  --hbgs-accent: #38bdf8;
  --hbgs-accent-hover: #7dd3fc;
  --hbgs-accent-ink: #7dd3fc;
  --hbgs-accent-contrast: #07130c;
  --hbgs-accent-wash: rgba(56, 189, 248, 0.14);
  --hbgs-accent-ring: rgba(56, 189, 248, 0.38);
  --hbgs-hero-bg: #102a46;
  --hbgs-hero-ink: #f0f9ff;
  --hbgs-hero-ink-2: rgba(224, 242, 254, 0.76);
  --hbgs-hero-line: rgba(125, 211, 252, 0.18);
  --hbgs-hero-well: rgba(56, 189, 248, 0.1);
  --hbgs-refined-bg: var(--hbgs-bg);
  --hbgs-refined-surface: var(--hbgs-surface);
  --hbgs-refined-surface-2: var(--hbgs-surface-2);
  --hbgs-refined-surface-3: var(--hbgs-surface-3);
  --hbgs-refined-line: var(--hbgs-line);
  --hbgs-refined-line-strong: var(--hbgs-line-strong);
  --hbgs-refined-text: var(--hbgs-ink);
  --hbgs-refined-muted: var(--hbgs-ink-3);
  --hbgs-refined-soft: var(--hbgs-ink-3);
  --hbgs-refined-green: var(--hbgs-accent);
  --hbgs-refined-green-soft: var(--hbgs-accent-wash);
  --bg-primary: var(--hbgs-bg);
  --bg-secondary: var(--hbgs-surface);
  --bg-tertiary: var(--hbgs-surface-2);
  --card-bg: var(--hbgs-surface);
  --text-primary: var(--hbgs-ink);
  --text-secondary: var(--hbgs-ink-2);
  --text-muted: var(--hbgs-ink-3);
  --border-color: var(--hbgs-line);
  --primary: var(--hbgs-accent);
  --primary-dark: #0284c7;
  --primary-color: #38bdf8;
  --primary-light: rgba(56, 189, 248, 0.14);
  --primary-hover: #7dd3fc;
  --border-primary: #38bdf8;
  --text-tertiary: #91a3ba;
  --gray-0: #111c2f;
  --gray-50: #17253b;
  --gray-100: #1d2f49;
  --gray-200: #263a56;
  --gray-300: #385274;
  --gray-400: #91a3ba;
  --gray-500: #91a3ba;
  --gray-600: #bac8db;
  --gray-700: #d4dfed;
  --gray-800: #e4edfa;
  --gray-900: #edf4ff;
}

:root[data-theme-name="obsidian"] {
  --hbgs-bg: #050606;
  --hbgs-surface: #0d0f0e;
  --hbgs-surface-2: #141715;
  --hbgs-surface-3: #1b1f1c;
  --hbgs-ink: #f2f5f3;
  --hbgs-ink-2: #c1c8c3;
  --hbgs-ink-3: #969f99;
  --hbgs-line: #242925;
  --hbgs-line-strong: #3a423c;
  --hbgs-accent: #4ade80;
  --hbgs-accent-hover: #86efac;
  --hbgs-accent-ink: #86efac;
  --hbgs-accent-contrast: #07130c;
  --hbgs-accent-wash: rgba(74, 222, 128, 0.12);
  --hbgs-accent-ring: rgba(74, 222, 128, 0.38);
  --hbgs-hero-bg: #0b1810;
  --hbgs-hero-ink: #f0fdf4;
  --hbgs-hero-ink-2: rgba(220, 252, 231, 0.74);
  --hbgs-hero-line: rgba(134, 239, 172, 0.14);
  --hbgs-hero-well: rgba(74, 222, 128, 0.08);
  --hbgs-refined-bg: var(--hbgs-bg);
  --hbgs-refined-surface: var(--hbgs-surface);
  --hbgs-refined-surface-2: var(--hbgs-surface-2);
  --hbgs-refined-surface-3: var(--hbgs-surface-3);
  --hbgs-refined-line: var(--hbgs-line);
  --hbgs-refined-line-strong: var(--hbgs-line-strong);
  --hbgs-refined-text: var(--hbgs-ink);
  --hbgs-refined-muted: var(--hbgs-ink-3);
  --hbgs-refined-soft: var(--hbgs-ink-3);
  --hbgs-refined-green: var(--hbgs-accent);
  --hbgs-refined-green-soft: var(--hbgs-accent-wash);
  --bg-primary: var(--hbgs-bg);
  --bg-secondary: var(--hbgs-surface);
  --bg-tertiary: var(--hbgs-surface-2);
  --card-bg: var(--hbgs-surface);
  --text-primary: var(--hbgs-ink);
  --text-secondary: var(--hbgs-ink-2);
  --text-muted: var(--hbgs-ink-3);
  --border-color: var(--hbgs-line);
  --primary: var(--hbgs-accent);
  --primary-dark: #22c55e;
  --primary-color: #4ade80;
  --primary-light: rgba(74, 222, 128, 0.12);
  --primary-hover: #86efac;
  --border-primary: #4ade80;
  --text-tertiary: #969f99;
  --gray-0: #0d0f0e;
  --gray-50: #141715;
  --gray-100: #1b1f1c;
  --gray-200: #242925;
  --gray-300: #3a423c;
  --gray-400: #969f99;
  --gray-500: #969f99;
  --gray-600: #c1c8c3;
  --gray-700: #d9dedb;
  --gray-800: #e7ebe8;
  --gray-900: #f2f5f3;
}

:root[data-theme-name="high-contrast"] {
  --hbgs-bg: #000000;
  --hbgs-surface: #0a0a0a;
  --hbgs-surface-2: #151515;
  --hbgs-surface-3: #202020;
  --hbgs-ink: #ffffff;
  --hbgs-ink-2: #f5f5f5;
  --hbgs-ink-3: #d4d4d4;
  --hbgs-line: #ffffff;
  --hbgs-line-strong: #ffffff;
  --hbgs-accent: #7cff6b;
  --hbgs-accent-hover: #a7ff9b;
  --hbgs-accent-ink: #a7ff9b;
  --hbgs-accent-contrast: #000000;
  --hbgs-accent-wash: rgba(124, 255, 107, 0.2);
  --hbgs-accent-ring: rgba(124, 255, 107, 0.72);
  --hbgs-hero-bg: #000000;
  --hbgs-hero-ink: #ffffff;
  --hbgs-hero-ink-2: #ffffff;
  --hbgs-hero-line: #ffffff;
  --hbgs-hero-well: #151515;
  --hbgs-refined-bg: var(--hbgs-bg);
  --hbgs-refined-surface: var(--hbgs-surface);
  --hbgs-refined-surface-2: var(--hbgs-surface-2);
  --hbgs-refined-surface-3: var(--hbgs-surface-3);
  --hbgs-refined-line: var(--hbgs-line);
  --hbgs-refined-line-strong: var(--hbgs-line-strong);
  --hbgs-refined-text: var(--hbgs-ink);
  --hbgs-refined-muted: var(--hbgs-ink-3);
  --hbgs-refined-soft: var(--hbgs-ink-3);
  --hbgs-refined-green: var(--hbgs-accent);
  --hbgs-refined-green-soft: var(--hbgs-accent-wash);
  --bg-primary: var(--hbgs-bg);
  --bg-secondary: var(--hbgs-surface);
  --bg-tertiary: var(--hbgs-surface-2);
  --card-bg: var(--hbgs-surface);
  --text-primary: var(--hbgs-ink);
  --text-secondary: var(--hbgs-ink-2);
  --text-muted: var(--hbgs-ink-3);
  --border-color: var(--hbgs-line);
  --primary: var(--hbgs-accent);
  --primary-dark: #4ade80;
  --primary-color: #7cff6b;
  --primary-light: rgba(124, 255, 107, 0.2);
  --primary-hover: #a7ff9b;
  --border-primary: #7cff6b;
  --text-tertiary: #d4d4d4;
  --gray-0: #0a0a0a;
  --gray-50: #151515;
  --gray-100: #202020;
  --gray-200: #2a2a2a;
  --gray-300: #ffffff;
  --gray-400: #d4d4d4;
  --gray-500: #d4d4d4;
  --gray-600: #f5f5f5;
  --gray-700: #ffffff;
  --gray-800: #ffffff;
  --gray-900: #ffffff;
  --hbgs-radius: 8px;
  --hbgs-radius-lg: 10px;
}

[data-theme-name="high-contrast"] :focus-visible {
  outline-color: var(--hbgs-accent) !important;
  outline-width: 3px !important;
}

.theme-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.theme-picker[hidden] {
  display: none;
}

.theme-choice {
  appearance: none;
  position: relative;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 68px;
  padding: 10px;
  border: 1px solid var(--hbgs-line, var(--border-color));
  border-radius: 12px;
  background: var(--hbgs-surface, var(--bg-primary));
  color: var(--hbgs-ink, var(--text-primary));
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.theme-choice:hover {
  border-color: var(--hbgs-line-strong, var(--primary));
  background: var(--hbgs-surface-2, var(--bg-secondary));
}

.theme-choice:focus-visible {
  outline: 3px solid var(--hbgs-accent-ring, rgba(22, 163, 74, 0.3));
  outline-offset: 2px;
}

.theme-choice.is-selected {
  border-color: var(--hbgs-accent, var(--primary));
  background: var(--hbgs-accent-wash, rgba(22, 163, 74, 0.1));
}

.theme-choice-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  width: 54px;
  height: 46px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, currentColor 16%, transparent);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.theme-choice-preview span:first-child {
  grid-row: 1 / 3;
}

.theme-choice-preview span:last-child {
  margin: 7px;
  border-radius: 999px;
}

.theme-choice-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.theme-choice-copy strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-choice-copy small {
  color: var(--hbgs-ink-3, var(--text-muted));
  font-size: 11px;
  line-height: 1.3;
}

.theme-choice-check {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--hbgs-accent, var(--primary));
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 150ms ease, transform 150ms ease;
}

.theme-choice.is-selected .theme-choice-check {
  opacity: 1;
  transform: scale(1);
}

.theme-picker-compact {
  padding: 6px 10px 10px;
}

.theme-picker-compact.theme-picker {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.theme-picker-compact .theme-choice {
  min-height: 48px;
  grid-template-columns: 30px minmax(0, 1fr) 16px;
  gap: 7px;
  padding: 7px;
  border-radius: 9px;
}

.theme-picker-compact .theme-choice-preview {
  width: 30px;
  height: 28px;
  border-radius: 6px;
}

.theme-picker-compact .theme-choice-preview span:last-child {
  margin: 4px;
}

.theme-picker-compact .theme-choice-copy strong {
  font-size: 11px;
}

.theme-picker-compact .theme-choice-copy small {
  display: none;
}

.theme-picker-compact .theme-choice-check {
  width: 16px;
  height: 16px;
}

.theme-picker-settings {
  padding: 16px;
}

.settings-theme-block {
  border-bottom: 1px solid var(--hbgs-line, var(--border-color));
}

.settings-theme-heading {
  padding: 16px 16px 0;
}

.theme-picker-toggle-caret {
  margin-left: auto;
  font-size: 16px;
  transition: transform 150ms ease;
}

.theme-picker-toggle[aria-expanded="true"] .theme-picker-toggle-caret {
  transform: rotate(180deg);
}

.header-dropdown-menu:has(.theme-picker-compact) {
  width: min(300px, calc(100vw - 24px));
}

.theme-choice-preview.is-split span:first-child {
  grid-row: auto;
}

.theme-choice-preview.is-split span:last-child {
  margin: 0;
  border-radius: 0;
}

.theme-choice-badge {
  width: fit-content;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--hbgs-accent-wash, rgba(22, 163, 74, 0.12));
  color: var(--hbgs-accent-ink, var(--primary));
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.3;
  text-transform: uppercase;
}

.theme-picker-compact .theme-choice-badge {
  font-size: 8px;
  padding: 1px 4px;
}

.login-appearance {
  position: fixed;
  z-index: calc(var(--z-modal, 1000) + 1);
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
}

.login-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--hbgs-line, var(--border-color));
  border-radius: 10px;
  background: color-mix(in srgb, var(--hbgs-surface, var(--card-bg)) 92%, transparent);
  color: var(--hbgs-ink, var(--text-primary));
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(12px);
}

.login-theme-toggle:hover,
.login-appearance.is-open .login-theme-toggle {
  border-color: var(--hbgs-accent, var(--primary));
  background: var(--hbgs-surface-2, var(--bg-secondary));
}

.login-theme-toggle:focus-visible {
  outline: 3px solid var(--hbgs-accent-ring, rgba(22, 163, 74, 0.3));
  outline-offset: 2px;
}

.login-theme-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, calc(100vw - 24px));
  padding: 10px;
  border: 1px solid var(--hbgs-line, var(--border-color));
  border-radius: 14px;
  background: var(--hbgs-surface, var(--card-bg));
  color: var(--hbgs-ink, var(--text-primary));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.24);
}

.login-theme-panel[hidden] {
  display: none;
}

.login-theme-panel-title {
  padding: 2px 6px 8px;
  color: var(--hbgs-ink-2, var(--text-secondary));
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.login-theme-panel .theme-picker-compact {
  padding: 0;
}

.motion-preference {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 14px 16px;
  border-top: 1px solid var(--hbgs-line, var(--border-color));
}

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

.motion-preference-copy strong {
  color: var(--hbgs-ink, var(--text-primary));
  font-size: 14px;
}

.motion-preference-copy small {
  color: var(--hbgs-ink-3, var(--text-muted));
  font-size: 12px;
  line-height: 1.35;
}

html[data-reduced-motion="true"] *,
html[data-reduced-motion="true"] *::before,
html[data-reduced-motion="true"] *::after {
  scroll-behavior: auto !important;
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

/* Reserve breathing room when offline feedback is visible on the sign-in
   screen so the bottom-fixed notice never hides the form actions. */
body:has(.app-offline-banner.visible) .login-wrapper {
  padding-bottom: max(92px, calc(env(safe-area-inset-bottom, 0px) + 92px));
}

@media (max-width: 768px) {
  .header-dropdown-menu {
    bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 8px);
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-choice,
  .theme-choice-check {
    transition: none;
  }
}

@media (max-width: 480px) {
  .theme-picker {
    grid-template-columns: 1fr;
  }

  .theme-picker-settings {
    padding: 12px;
  }
}
