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

  /* 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;
  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 {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  animation: betaPulse 2s ease-in-out infinite;
}

@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;
}

/* 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-user-avatar {
  width: 32px;
  height: 32px;
  background: var(--hbgs-green-600);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.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: 200px;
  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-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;
}

/* Type-specific notification icon backgrounds */
.notification-icon.attendance { background: rgba(34, 197, 94, 0.15); }
.notification-icon.bathroom { background: rgba(59, 130, 246, 0.15); }
.notification-icon.copies { background: rgba(168, 85, 247, 0.15); }
.notification-icon.supplies { background: rgba(249, 115, 22, 0.15); }
.notification-icon.tech { background: rgba(99, 102, 241, 0.15); }
.notification-icon.unblock { background: rgba(236, 72, 153, 0.15); }
.notification-icon.timeoff { background: rgba(20, 184, 166, 0.15); }
.notification-icon.calendar { background: rgba(245, 158, 11, 0.15); }
.notification-icon.other { background: rgba(107, 114, 128, 0.15); }

.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: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

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

.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 4px 0 0;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 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(--bg-primary); /* v4.7.2: Use CSS variable for dark mode compat */
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}

.btn-secondary:hover:not(:disabled),
.btn-outline:hover:not(:disabled) {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--gray-100);
  color: var(--gray-900);
}

.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: 6px 12px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 24px;
  font-size: 16px;
}

.btn-icon {
  padding: 8px;
  min-width: 36px;
}

/* Cards */
.card {
  background: var(--card-bg); /* v4.7.2: Use CSS variable for dark mode compat */
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin-bottom: 24px;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
}

.card-subtitle {
  font-size: 13px;
  color: var(--gray-500);
  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: 20px 24px;
}

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

.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
}

/* Card Controls - filter row below header */
.card-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-100);
  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 {
  overflow-x: auto;
}

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

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 14px;
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

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

.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: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  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%;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  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-900);
  transition: all 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-green-500);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.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 {
  padding: 24px;
  text-align: center;
  color: var(--gray-500);
  font-size: 14px;
}

/* Enhanced Empty States */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin-bottom: 16px;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-700);
  margin: 0 0 8px 0;
}

.empty-state-text {
  font-size: 14px;
  color: var(--gray-500);
  margin: 0;
  max-width: 280px;
}

.empty-state-action {
  margin-top: 20px;
}

/* 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: -40px;
  left: 0;
  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 {
  top: 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;
}

/* ===== 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;
  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;
}

.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;
}

/* 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;
  }
}

/* ============================================
   Offline Banner Styles (extracted from index.html for caching)
   ============================================ */
.header-offline-indicator {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  animation: offline-pulse 2s ease-in-out infinite;
}
.header-offline-indicator.visible {
  display: flex;
}
@keyframes offline-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.app-offline-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-toast);
  transform: translateY(100%);
  transition: transform 0.3s ease;
}
.app-offline-banner.visible {
  transform: translateY(0);
}
.offline-banner-content {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: white;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}
.app-offline-banner.syncing .offline-banner-content {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}
.app-offline-banner.cached .offline-banner-content {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}
.offline-banner-icon {
  font-size: 24px;
  animation: pulse-offline 2s ease-in-out infinite;
}
@keyframes pulse-offline {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(0.95); }
}
.offline-banner-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.offline-banner-text strong {
  font-size: 14px;
  font-weight: 600;
}
.offline-banner-text span {
  font-size: 12px;
  opacity: 0.9;
}
.offline-banner-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.offline-pending-count {
  font-size: 12px;
  background: rgba(255,255,255,0.2);
  padding: 4px 10px;
  border-radius: 12px;
}
.offline-banner-dismiss {
  background: none;
  border: 1px solid rgba(255,255,255,0.4);
  color: inherit;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 4px;
  line-height: 1;
  opacity: 0.8;
}
.offline-banner-dismiss:hover {
  opacity: 1;
  background: rgba(255,255,255,0.15);
}
.app-offline-banner.visible ~ .layout .sidebar {
  padding-bottom: 70px;
}
@media (max-width: 768px) {
  .offline-banner-content {
    padding: 10px 16px;
  }
  .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);
}

/* ===== dashboard.css ===== */
/* HBGS Design System v2.1 - Dashboard */

/* ============================================
   Dashboard Layout
   ============================================ */

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

/* ============================================
   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
   ============================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal-backdrop); /* v4.7.2: Use z-index variable instead of 100 */
  padding: 24px;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
}

.modal-lg {
  max-width: 640px;
}

.modal-xl {
  max-width: 900px;
  width: 95%;
}

/* ============================================
   Modal Header
   ============================================ */

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

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.modal-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: 24px;
  overflow-y: auto;
}

.modal-help {
  font-size: 14px;
  color: var(--gray-600);
  margin: 0 0 16px 0;
}

/* ============================================
   Modal Footer
   ============================================ */

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ============================================
   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: 16px 16px 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) {
  /* 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 out on mobile */
  /* v4.14.0: Use CSS variable z-index so modals/toasts layer above sidebar */
  .sidebar {
    position: fixed;
    z-index: var(--z-sidebar);
    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;
  }

  /* 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;
  }

  /* Toast positioning - above bottom nav if present */
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 16px;
  }

  .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) {
  /* 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)) {
  /* Only toast needs safe area - it floats at the bottom */
  .toast-container {
    bottom: calc(16px + 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) {
  /* 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) {
  /* 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) {
  .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) {
  /* 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) {
  /* 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;
    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) {
  .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) {
  /* 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) {
  .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) {
  /* 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; }
  }
}

/* ============================================
   STAFF LOG MODULE - Mobile Optimizations
   ============================================ */
@media (max-width: 768px) {
  /* Make data-shell scrollable on mobile (used as table wrapper in staff-log) */
  .data-shell {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -14px;
    padding: 0 14px;
  }

  .data-shell .data-table {
    min-width: 420px;
  }

  /* Staff Log tab content - reduce padding on mobile */
  #slContent {
    padding: 12px !important;
  }

  /* Staff Log tab buttons - allow wrapping */
  #slTabs {
    flex-wrap: wrap;
  }

  /* Staff Log card header - stack on mobile */
  #slContent .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  /* Staff Log 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) {
  /* Staff Log 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) {
  /* --- 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) {
  .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) {
  :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 {
    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) {
  .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) {
  .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) {
  .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: #f4f6f5;            /* app background */
  --hbgs-surface: #ffffff;       /* cards / panels */
  --hbgs-surface-2: #f8fafc;     /* headers / subtle fills */
  --hbgs-surface-3: #eef2f6;     /* inputs / hover wells */

  /* Ink */
  --hbgs-ink: #111827;           /* primary text */
  --hbgs-ink-2: #475569;         /* secondary text */
  --hbgs-ink-3: #6b7280;         /* muted text / labels */

  /* Lines */
  --hbgs-line: #e3e8ee;          /* borders / dividers */
  --hbgs-line-strong: #cbd5e1;

  /* Single accent (the only color that "speaks") */
  --hbgs-accent: #16a34a;
  --hbgs-accent-hover: #15803d;
  --hbgs-accent-ink: #166534;    /* accent text on light surfaces */
  --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);

  /* 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 slate, layered by lightness not by color */
  --hbgs-bg: #0f141b;            /* deepest: app background */
  --hbgs-surface: #1a212b;       /* cards / panels */
  --hbgs-surface-2: #212a36;     /* headers / subtle fills */
  --hbgs-surface-3: #2a3543;     /* inputs / hover wells */

  /* Ink — near-white, no colored numerals */
  --hbgs-ink: #e8edf3;
  --hbgs-ink-2: #aab6c4;
  --hbgs-ink-3: #7e8b9a;

  /* Lines — low-contrast hairlines */
  --hbgs-line: rgba(148, 163, 184, 0.16);
  --hbgs-line-strong: rgba(148, 163, 184, 0.28);

  /* Single accent */
  --hbgs-accent: #34d399;
  --hbgs-accent-hover: #4ade80;
  --hbgs-accent-ink: #6ee7b7;
  --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);

  /* 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: 18px 16px 16px;
  padding-top: calc(14px + var(--safe-top));
  border-bottom: 1px solid var(--hbgs-hero-line);
}

.sidebar-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  box-shadow: none;
}

.sidebar-title {
  font-size: 14px;
  letter-spacing: -0.01em;
}

.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: 16px;
}

/* 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-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: 12px;
}

.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-beta-notice {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--hbgs-accent) 24%, var(--hbgs-line));
  border-left: 4px solid var(--hbgs-accent);
  border-radius: var(--hbgs-radius-lg);
  background: var(--hbgs-surface);
  color: var(--hbgs-ink);
  box-shadow: none;
}

.dash-beta-notice strong {
  font-size: 14px;
  font-weight: 750;
}

.dash-beta-notice span {
  color: var(--hbgs-ink-2);
  font-size: 13px;
  line-height: 1.45;
}

.dash-widgets {
  display: grid !important;
  grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
  gap: 16px !important;
  align-items: start;
}

.dash-zone-heading {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(130px, max-content) 1fr;
  align-items: baseline;
  gap: 12px;
  margin: 14px 0 -2px;
  padding-top: 10px;
  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: block;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dash-zone-heading small {
  display: block;
  color: var(--hbgs-ink-3);
  font-size: 12px;
  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;
}

/* Structural fallback if JavaScript data attributes are unavailable. */
#widgetAlerts,
#widgetQuickActions,
#widgetCharts,
#widgetClassInsights {
  grid-column: span 7;
}

#widgetTodayAttendance,
#widgetAnnouncements,
#widgetWeeklySummary,
#widgetDistribution {
  grid-column: span 5;
}

#widgetStats {
  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: 12px;
  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 {
  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(112px, 1fr));
  gap: 1px;
  background: var(--hbgs-line);
  border: 1px solid var(--hbgs-line);
  border-radius: var(--hbgs-radius-lg);
  overflow: hidden;
}

.dash-stat-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 16px 10px;
  background: var(--hbgs-surface);
  border: 0;
  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;
}

/* ============================================================
   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;
}

@media (max-width: 1100px) {
  .dash-ops-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .dash-widgets {
    grid-template-columns: 1fr !important;
  }

  .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;
  }

  .dash-zone-heading {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

@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 {
  width: 280px;
  max-width: 80%;
  height: auto;
  margin-bottom: 32px;
  filter: none;
}

.hbgs-splash-status {
  color: rgba(255, 255, 255, 0.62);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hbgs-splash-dots {
  display: flex;
  gap: 8px;
  margin-top: 40px;
}

.hbgs-splash-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--hbgs-radius-pill);
  background: var(--hbgs-accent);
  animation: none;
}

.hbgs-splash-dot:nth-child(2) { animation-delay: 0.2s; }
.hbgs-splash-dot:nth-child(3) { animation-delay: 0.4s; }

/* 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;
}

.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;
}

/* ============================================================
   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;
}

/* 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;
  }

  .page-header-actions,
  .card-actions,
  .card-controls,
  .students-toolbar,
  .attendance-toolbar,
  .copy-requests-toolbar,
  .tech-support-toolbar,
  .controls-bar,
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .page-header-actions > *,
  .card-actions > *,
  .card-controls > *,
  .students-toolbar > *,
  .attendance-toolbar > *,
  .copy-requests-toolbar > *,
  .tech-support-toolbar > *,
  .controls-bar > *,
  .filter-bar > * {
    width: 100%;
  }

  .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: 10px 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%;
  }
}

@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 > *,
  .page-header-actions > * {
    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;
  }
}
