/* ═══════════════════════════════════════════════════════════
   Credentik Credentialing Ops v2 — Design System
   Version 2.0 — Investor-Ready SaaS UI
   ═══════════════════════════════════════════════════════════ */

/* ─── Design Tokens ─── */
:root {
  /* Brand */
  --brand-50: #ecfeff;
  --brand-100: #cffafe;
  --brand-200: #a5f3fc;
  --brand-300: #67e8f9;
  --brand-400: #22d3ee;
  --brand-500: #06b6d4;
  --brand-600: #0891b2;
  --brand-700: #0e7490;
  --brand-800: #155e75;
  --brand-900: #164e63;
  --brand-950: #083344;

  /* Neutral */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --gray-950: #020617;

  /* Semantic Status */
  --success-50: #f0fdf4;
  --success-100: #dcfce7;
  --success-500: #22c55e;
  --success-600: #16a34a;
  --success-700: #15803d;
  --warning-50: #fffbeb;
  --warning-100: #fef3c7;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  --warning-700: #b45309;
  --danger-50: #fef2f2;
  --danger-100: #fee2e2;
  --danger-500: #ef4444;
  --danger-600: #dc2626;
  --danger-700: #b91c1c;
  --info-50: #eff6ff;
  --info-100: #dbeafe;
  --info-500: #3b82f6;
  --info-600: #2563eb;
  --info-700: #1d4ed8;
  --purple-50: #faf5ff;
  --purple-100: #f3e8ff;
  --purple-500: #a855f7;
  --purple-600: #9333ea;
  --purple-700: #7c3aed;

  /* Legacy compat aliases */
  --teal: var(--brand-700);
  --teal-dark: var(--gray-900);
  --teal-light: var(--brand-600);
  --gold: #e0a830;
  --gold-hover: #ca9520;
  --sage: var(--brand-600);
  --sage-hover: var(--brand-700);
  --slate: var(--gray-500);
  --light: var(--gray-50);
  --white: #ffffff;
  --border: var(--gray-200);
  --border-dark: var(--gray-300);
  --red: var(--danger-500);
  --red-bg: var(--danger-100);
  --green: var(--success-500);
  --green-bg: var(--success-100);
  --amber: var(--warning-500);
  --amber-bg: var(--warning-100);
  --blue: var(--info-500);
  --blue-bg: var(--info-100);
  --purple: var(--purple-500);
  --purple-bg: var(--purple-100);
  --text: var(--gray-800);
  --text-muted: var(--gray-500);
  --text-light: var(--gray-400);

  /* Layout */
  --sidebar-width: 260px;
  --sidebar-bg: var(--gray-900);
  --sidebar-border: rgba(255,255,255,0.06);
  --header-height: 64px;

  /* Spacing Scale (4px base) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 9999px;

  /* Shadows — multi-layer for depth */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.06);
  --shadow-2xl: 0 25px 50px -12px rgba(0,0,0,0.2);
  --shadow-inner: inset 0 2px 4px rgba(0,0,0,0.04);
  --shadow-ring: 0 0 0 3px rgba(8,145,178,0.15);
  --shadow-ring-danger: 0 0 0 3px rgba(239,68,68,0.15);

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 120ms;
  --duration: 200ms;
  --duration-slow: 300ms;
}

/* ─── Reset & Base ─── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  color: var(--text);
  background: var(--gray-100);
  line-height: 1.6;
  font-size: 14px;
  overflow-x: hidden;
}

/* Modern sans-serif headings for SaaS */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

::selection {
  background: var(--brand-200);
  color: var(--brand-900);
}

/* Better scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ═══════════════════════════════════════════
   AUTH GATE
   ═══════════════════════════════════════════ */

.auth-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--gray-950);
  position: relative;
  overflow: hidden;
}
.auth-gate::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(8,145,178,0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(6,182,212,0.1) 0%, transparent 40%),
    radial-gradient(ellipse at 60% 80%, rgba(139,92,246,0.08) 0%, transparent 40%);
  animation: auroraFloat 20s ease-in-out infinite;
}
@keyframes auroraFloat {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(20px, -30px) rotate(1deg); }
  66% { transform: translate(-15px, 20px) rotate(-1deg); }
}

.auth-box {
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-2xl);
  padding: 48px 44px;
  text-align: center;
  max-width: 420px;
  width: 90%;
  position: relative;
  z-index: 1;
  animation: authFadeIn 0.6s var(--ease-out);
}
@keyframes authFadeIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-box .logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
.auth-box .logo img {
  border-radius: var(--radius-lg) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.auth-box h2 {
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}
.auth-box p {
  color: var(--gray-400);
  font-size: 14px;
  margin-bottom: 28px;
  line-height: 1.5;
}
.auth-box input {
  width: 100%;
  padding: 14px 18px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  font-size: 15px;
  text-align: center;
  letter-spacing: 3px;
  font-family: inherit;
  font-weight: 500;
  background: rgba(255,255,255,0.05);
  color: #ffffff;
  transition: all var(--duration) var(--ease);
}
.auth-box input::placeholder {
  color: var(--gray-500);
  letter-spacing: 1px;
}
.auth-box input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: var(--shadow-ring), 0 0 20px rgba(6,182,212,0.1);
  background: rgba(255,255,255,0.07);
}
.auth-box .btn-enter {
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.02em;
  transition: all var(--duration) var(--ease);
  position: relative;
  overflow: hidden;
}
.auth-box .btn-enter:hover {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(6,182,212,0.3);
}
.auth-box .btn-enter:active {
  transform: translateY(0);
}
.auth-box .error {
  color: var(--danger-500);
  font-size: 13px;
  margin-top: 12px;
  display: none;
  padding: 8px 12px;
  background: rgba(239,68,68,0.1);
  border-radius: var(--radius-sm);
}

/* ─── Login / Register Form ─── */
.auth-form-group {
  margin-bottom: 16px;
  text-align: left;
}
.auth-form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-400);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.auth-form-group input {
  text-align: left;
  letter-spacing: normal;
  padding: 12px 16px;
  font-size: 14px;
}
.auth-form-group input[type="password"] {
  letter-spacing: 2px;
}

.auth-toggle {
  margin-top: 24px;
  font-size: 13px;
  color: var(--gray-500);
}
.auth-toggle a,
.auth-toggle button {
  color: var(--brand-400);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease);
}
.auth-toggle a:hover,
.auth-toggle button:hover {
  color: var(--brand-300);
  text-decoration: underline;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: var(--gray-500);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.1);
}

.auth-forgot {
  display: block;
  margin-top: 12px;
  font-size: 12px;
  color: var(--gray-500);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease);
}
.auth-forgot:hover {
  color: var(--brand-400);
}

@media (max-width: 480px) {
  .auth-box { padding: 36px 24px; }
}

/* ═══════════════════════════════════════════
   APP LAYOUT
   ═══════════════════════════════════════════ */

.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--gray-100);
}

/* ─── SIDEBAR ─── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--duration-slow) var(--ease);
  border-right: 1px solid rgba(255,255,255,0.04);
}

.sidebar-header {
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-header h1 {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}
.sidebar-header .version {
  font-size: 11px;
  color: var(--brand-400);
  margin-top: 1px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

.nav-section {
  padding: 16px 20px 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--gray-500);
  font-weight: 600;
}
.nav-section:first-child {
  padding-top: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px 9px 20px;
  color: var(--gray-400);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: all var(--duration-fast) var(--ease);
  border-radius: 0;
  margin: 1px 0;
  position: relative;
}
.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--gray-200);
}
.nav-item.active {
  background: rgba(6,182,212,0.1);
  color: var(--brand-300);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--brand-400);
  border-radius: 0 3px 3px 0;
}
.nav-item .icon {
  width: 20px;
  text-align: center;
  font-size: 15px;
  opacity: 0.7;
  flex-shrink: 0;
}
.nav-item.active .icon {
  opacity: 1;
}
.nav-item .badge {
  margin-left: auto;
  background: var(--danger-500);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
  line-height: 16px;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--sidebar-border);
}
.sidebar-footer a {
  color: var(--gray-500);
  text-decoration: none;
  font-size: 12px;
  transition: color var(--duration-fast);
}
.sidebar-footer a:hover { color: var(--gray-300); }

.btn-logout {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--gray-400);
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: all var(--duration-fast) var(--ease);
}
.btn-logout:hover {
  color: var(--gray-200);
  border-color: rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
}

.sync-indicator {
  display: block;
  font-size: 11px;
  margin-bottom: 8px;
  font-weight: 500;
}
.sync-indicator.syncing { color: var(--brand-400); }
.sync-indicator.error { color: var(--danger-400); cursor: help; }

/* ─── MAIN CONTENT AREA ─── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── PAGE HEADER ─── */
.page-header {
  background: #ffffff;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 var(--sp-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--header-height);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.page-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.02em;
}
.page-header .subtitle {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 1px;
  font-weight: 400;
}

.header-actions-group {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-left: auto;
}
.page-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ─── HEADER ICON BAR ─── */
.header-icon-bar {
  display: flex;
  gap: 4px;
  align-items: center;
}
.header-icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  background: #ffffff;
  cursor: pointer;
  font-size: 16px;
  color: var(--gray-600);
  transition: all var(--duration-fast) var(--ease);
}
.header-icon-btn:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
  color: var(--gray-800);
  box-shadow: var(--shadow-xs);
}
.header-icon-btn:active {
  transform: scale(0.95);
}
.header-icon-btn .notification-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--danger-500);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 0 0 2px #fff;
}

/* ─── TOOLS DROPDOWN ─── */
.header-icon-dropdown {
  position: relative;
}
.tools-dropdown-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  background: #ffffff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(0,0,0,0.04);
  z-index: 200;
  overflow: hidden;
  animation: dropdownIn 0.15s var(--ease-out);
}
@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.tools-dropdown-panel.active {
  display: block;
}
.tools-dropdown-header {
  padding: 14px 18px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--gray-100);
}
.tools-dropdown-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 6px;
}
.tools-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  background: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--gray-700);
  transition: all var(--duration-fast) var(--ease);
  text-align: left;
}
.tools-dropdown-item:hover {
  background: var(--gray-50);
  color: var(--gray-900);
}
.tools-dropdown-item .tdi-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: var(--gray-100);
  font-size: 15px;
  flex-shrink: 0;
  transition: all var(--duration-fast) var(--ease);
}
.tools-dropdown-item:hover .tdi-icon {
  background: var(--brand-100);
  color: var(--brand-700);
}
.tools-dropdown-item .tdi-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tools-dropdown-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 199;
}
.tools-dropdown-overlay.active {
  display: block;
}

/* ─── PAGE BODY ─── */
.page-body {
  padding: var(--sp-6) var(--sp-8);
  flex: 1;
  animation: pageContentIn 0.25s var(--ease-out);
}
@keyframes pageContentIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════
   STAT CARDS
   ═══════════════════════════════════════════ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  position: relative;
  overflow: hidden;
  transition: all var(--duration) var(--ease);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gray-200);
  transition: background var(--duration) var(--ease);
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--gray-300);
}
.stat-card .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--gray-500);
  margin-bottom: 6px;
  font-weight: 600;
}
.stat-card .value {
  font-size: 28px;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.stat-card .value.green { color: var(--success-600); }
.stat-card .value.amber { color: var(--warning-600); }
.stat-card .value.blue { color: var(--info-600); }
.stat-card .value.red { color: var(--danger-600); }
.stat-card .value.purple { color: var(--purple-600); }

/* Colored top bars for stat cards with colored values */
.stat-card:has(.value.green)::before { background: var(--success-500); }
.stat-card:has(.value.amber)::before { background: var(--warning-500); }
.stat-card:has(.value.blue)::before { background: var(--info-500); }
.stat-card:has(.value.red)::before { background: var(--danger-500); }
.stat-card:has(.value.purple)::before { background: var(--purple-500); }

.stat-card .sub {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 4px;
  font-weight: 400;
}

/* ═══════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════ */

.card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  margin-bottom: 20px;
  transition: box-shadow var(--duration) var(--ease);
}
.card:hover {
  box-shadow: var(--shadow);
}
.card-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.01em;
}
.card-body {
  padding: 20px 22px;
}
.card-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ═══════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════ */

.table-wrap {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  background: var(--gray-50);
  color: var(--gray-600);
  padding: 10px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  position: sticky;
  top: 0;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--gray-200);
  transition: background var(--duration-fast);
}
thead th:first-child { border-radius: var(--radius-lg) 0 0 0; }
thead th:last-child { border-radius: 0 var(--radius-lg) 0 0; }
thead th:hover { background: var(--gray-100); color: var(--gray-800); }
thead th .sort-arrow {
  margin-left: 4px;
  opacity: 0.3;
  font-size: 10px;
}
thead th.sorted .sort-arrow { opacity: 1; color: var(--brand-600); }
tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
  color: var(--gray-700);
}
tbody tr {
  transition: background var(--duration-fast);
}
tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child td { border-bottom: none; }
tbody tr.overdue { background: var(--danger-50); }
tbody tr.overdue:hover { background: var(--danger-100); }

/* ═══════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

/* Status badges — with dot indicator */
.badge-not_started { background: var(--gray-100); color: var(--gray-600); }
.badge-submitted { background: var(--info-100); color: var(--info-700); }
.badge-in_review { background: var(--warning-100); color: var(--warning-700); }
.badge-pending_info { background: var(--purple-100); color: var(--purple-700); }
.badge-approved { background: var(--success-100); color: var(--success-700); }
.badge-denied { background: var(--danger-100); color: var(--danger-700); }
.badge-withdrawn { background: var(--gray-100); color: var(--gray-500); }

.badge-active { background: var(--success-100); color: var(--success-700); }
.badge-pending { background: var(--warning-100); color: var(--warning-700); }
.badge-expired { background: var(--danger-100); color: var(--danger-700); }
.badge-inactive { background: var(--gray-100); color: var(--gray-500); }

.wave-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.wave-1 { background: var(--brand-100); color: var(--brand-800); }
.wave-2 { background: var(--info-100); color: var(--info-700); }
.wave-3 { background: var(--gray-100); color: var(--gray-600); }

/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--gray-200);
  background: #ffffff;
  color: var(--gray-700);
  font-family: inherit;
  transition: all var(--duration-fast) var(--ease);
  white-space: nowrap;
  line-height: 1.4;
  letter-spacing: 0.005em;
}
.btn:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
  color: var(--gray-900);
  box-shadow: var(--shadow-xs);
}
.btn:active {
  transform: translateY(1px);
  box-shadow: none;
}
.btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-ring);
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: white;
  border-color: var(--brand-600);
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
  border-color: var(--brand-700);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-gold {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: white;
  border-color: var(--brand-600);
  font-weight: 700;
  box-shadow: var(--shadow-xs);
}
.btn-gold:hover {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
  border-color: var(--brand-700);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-danger {
  background: var(--danger-500);
  color: white;
  border-color: var(--danger-500);
}
.btn-danger:hover {
  background: var(--danger-600);
  border-color: var(--danger-600);
  color: white;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}
.btn-icon {
  padding: 6px 8px;
  min-width: 32px;
  justify-content: center;
}
.btn-group {
  display: flex;
  gap: 0;
}
.btn-group .btn {
  border-radius: 0;
  margin-left: -1px;
}
.btn-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }

/* ═══════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════ */

.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--gray-800);
  background: #ffffff;
  transition: all var(--duration-fast) var(--ease);
  line-height: 1.5;
}
.form-control::placeholder {
  color: var(--gray-400);
}
.form-control:hover {
  border-color: var(--gray-400);
}
.form-control:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: var(--shadow-ring);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
textarea.form-control {
  min-height: 88px;
  resize: vertical;
}
select.form-control {
  appearance: auto;
  cursor: pointer;
}

/* ─── Filters Bar ─── */
.filters-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.filters-bar .form-control {
  width: auto;
  min-width: 150px;
  font-size: 13px;
  padding: 8px 12px;
}
.filters-bar .search-input {
  flex: 1;
  min-width: 200px;
}

/* ═══════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════ */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}
.modal-overlay.active {
  display: flex;
  animation: overlayIn 0.2s var(--ease-out);
}
@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: #ffffff;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 640px;
  box-shadow: var(--shadow-2xl);
  animation: modalIn 0.25s var(--ease-spring);
  border: 1px solid var(--gray-200);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.01em;
}
.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--gray-400);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast);
  line-height: 1;
}
.modal-close:hover {
  color: var(--gray-700);
  background: var(--gray-100);
}
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ═══════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════ */

.tabs {
  display: flex;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 24px;
  gap: 0;
}
.tab {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--duration-fast) var(--ease);
  white-space: nowrap;
}
.tab:hover {
  color: var(--gray-800);
}
.tab.active {
  color: var(--brand-700);
  border-bottom-color: var(--brand-500);
}

/* ═══════════════════════════════════════════
   NOTIFICATIONS
   ═══════════════════════════════════════════ */

.btn-notification {
  position: relative;
  background: none;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  display: none;
}
.notification-overlay {
  position: fixed;
  inset: 0;
  z-index: 199;
}
.notification-panel {
  position: fixed;
  top: var(--header-height);
  right: 16px;
  width: 400px;
  max-height: 520px;
  background: #ffffff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(0,0,0,0.04);
  z-index: 200;
  overflow: hidden;
  animation: dropdownIn 0.15s var(--ease-out);
}
.notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--gray-100);
}
.notification-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-900);
}
.notification-body {
  max-height: 460px;
  overflow-y: auto;
  padding: 4px 0;
}
.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--gray-50);
  cursor: pointer;
  transition: background var(--duration-fast);
}
.notif-item:hover { background: var(--gray-50); }
.notif-item:last-child { border-bottom: none; }
.notif-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.notif-icon.red { background: var(--danger-100); color: var(--danger-600); }
.notif-icon.amber { background: var(--warning-100); color: var(--warning-600); }
.notif-icon.blue { background: var(--info-100); color: var(--info-600); }
.notif-icon.green { background: var(--success-100); color: var(--success-600); }
.notif-text { flex: 1; min-width: 0; }
.notif-text .title { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.notif-text .desc { font-size: 12px; color: var(--gray-500); margin-top: 2px; line-height: 1.4; }

/* ─── Bulk Actions Bar ─── */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--info-50);
  border: 1px solid var(--info-100);
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.bulk-bar .count { font-size: 13px; font-weight: 600; color: var(--info-700); }

/* ═══════════════════════════════════════════
   CALENDAR GRID
   ═══════════════════════════════════════════ */

.cal-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 6px;
}
.cal-month {
  padding: 10px 8px;
  border-radius: var(--radius);
  background: #ffffff;
  border: 1px solid var(--gray-200);
  text-align: center;
  font-size: 11px;
  min-height: 80px;
  transition: box-shadow var(--duration-fast);
}
.cal-month:hover {
  box-shadow: var(--shadow-sm);
}
.cal-month .month-label {
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--gray-600);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cal-event {
  display: block;
  padding: 2px 4px;
  margin: 2px 0;
  border-radius: 3px;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-event.expiring { background: var(--warning-100); color: var(--warning-700); }
.cal-event.expired { background: var(--danger-100); color: var(--danger-700); }
.cal-event.renewal { background: var(--success-100); color: var(--success-700); }
.cal-event.cred-renewal { background: var(--purple-100); color: var(--purple-700); }
.cal-event.cred-estimated { background: var(--warning-50); color: var(--warning-700); border: 1px dashed var(--warning-500); }

/* ═══════════════════════════════════════════
   REIMBURSEMENT TABLE
   ═══════════════════════════════════════════ */

.reimb-cell {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
}
.reimb-high { background: var(--success-100); color: var(--success-700); }
.reimb-mid { background: var(--warning-100); color: var(--warning-700); }
.reimb-low { background: var(--danger-100); color: var(--danger-700); }
.reimb-none { background: var(--gray-100); color: var(--gray-400); }

/* ═══════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════ */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--gray-900);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 500;
  z-index: 300;
  display: none;
  box-shadow: var(--shadow-lg);
  max-width: 380px;
  line-height: 1.5;
}
.toast.show {
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastSlideUp 0.3s var(--ease-spring);
}
/* Onboarding org search dropdown */
.onboard-org-item:hover { background: rgba(8, 145, 178, 0.15) !important; }

@keyframes toastSlideUp {
  from { transform: translateY(16px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ═══════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--gray-500);
}
.empty-state h3 {
  font-size: 17px;
  color: var(--gray-700);
  margin-bottom: 8px;
  font-weight: 700;
}
.empty-state p {
  font-size: 14px;
  max-width: 400px;
  margin: 0 auto 24px;
  color: var(--gray-500);
  line-height: 1.6;
}

/* ═══════════════════════════════════════════
   LOADING / SPINNER
   ═══════════════════════════════════════════ */

.spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--gray-200);
  border-top-color: var(--brand-500);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  margin: 24px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════
   EMAIL PREVIEW
   ═══════════════════════════════════════════ */

.email-preview {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', Consolas, monospace;
  font-size: 12.5px;
  white-space: pre-wrap;
  line-height: 1.7;
  max-height: 400px;
  overflow-y: auto;
  color: var(--gray-700);
}
.email-preview .subject-line {
  font-family: inherit;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-200);
}

/* ═══════════════════════════════════════════
   ALERTS / NOTICES
   ═══════════════════════════════════════════ */

.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid transparent;
  line-height: 1.5;
}
.alert-info {
  background: var(--info-50);
  color: var(--info-700);
  border-color: var(--info-100);
}
.alert-warning {
  background: var(--warning-50);
  color: var(--warning-700);
  border-color: var(--warning-100);
}
.alert-success {
  background: var(--success-50);
  color: var(--success-700);
  border-color: var(--success-100);
}
.alert-danger {
  background: var(--danger-50);
  color: var(--danger-700);
  border-color: var(--danger-100);
}

/* ═══════════════════════════════════════════
   ACTIVITY TIMELINE
   ═══════════════════════════════════════════ */

.activity-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.activity-entry {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--gray-100);
  transition: background var(--duration-fast);
}
.activity-entry:last-child { border-bottom: none; }
.activity-entry:hover { background: var(--gray-50); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: var(--radius); }
.activity-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  background: var(--gray-100);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}
.activity-content { flex: 1; min-width: 0; }
.activity-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.activity-body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--gray-700);
  margin-bottom: 4px;
}

/* ═══════════════════════════════════════════
   ACTION BUTTONS
   ═══════════════════════════════════════════ */

.action-btns {
  flex-wrap: nowrap;
  white-space: nowrap;
}

/* ─── MOBILE MENU BUTTON ─── */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--gray-700);
  cursor: pointer;
  padding: 6px 8px;
  margin-right: 8px;
  border-radius: var(--radius);
  transition: all var(--duration-fast);
}
.mobile-menu-btn:hover { background: var(--gray-100); }

/* ─── OFFLINE BAR ─── */
.offline-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--warning-500);
  color: var(--gray-900);
  text-align: center;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  z-index: 301;
}

/* ─── SIDEBAR OVERLAY ─── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(2px);
  z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ─── POLICY ROW ─── */
.policy-row { cursor: pointer; transition: background var(--duration-fast); }
.policy-row:hover { background: var(--brand-50) !important; }

/* ═══════════════════════════════════════════
   RESPONSIVE — TABLET (1024px)
   ═══════════════════════════════════════════ */

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .mobile-menu-btn { display: block; }
  .page-header { padding: 14px 20px; }
}

/* ═══════════════════════════════════════════
   RESPONSIVE — MOBILE (768px)
   ═══════════════════════════════════════════ */

@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
    padding: 14px 16px;
    min-height: auto;
  }
  .header-icon-bar { gap: 3px; }
  .header-icon-btn { width: 34px; height: 34px; font-size: 15px; }
  .tools-dropdown-panel {
    width: 300px;
    right: -60px;
  }
  .tools-dropdown-grid { grid-template-columns: 1fr; }
  .page-body { padding: 16px; }
  .page-header h2 { font-size: 16px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 16px; }
  .stat-card .value { font-size: 22px; }
  .stat-card .label { font-size: 10px; }
  .filters-bar { flex-direction: column; }
  .filters-bar .form-control { width: 100%; }
  .modal { max-width: 100%; margin: 0 8px; border-radius: var(--radius-lg); }
  .modal-overlay { padding: 16px 8px; }
  .modal-body { padding: 18px; }
  .modal-header { padding: 16px 18px; }
  .modal-footer { padding: 14px 18px; }
  table { font-size: 12px; }
  thead th, tbody td { padding: 8px 10px; }
  .toast { left: 16px; right: 16px; text-align: center; }
  .card-header { flex-direction: column; gap: 8px; align-items: flex-start; }
  .card-body { padding: 16px; }
  .action-btns { flex-wrap: wrap; gap: 4px !important; }
  .action-btns .btn { padding: 4px 8px; font-size: 11px; }
  .btn { min-height: 36px; }
  .nav-item { padding: 12px 20px; font-size: 15px; }
  .activity-header { flex-direction: column; align-items: flex-start; gap: 2px; }
  .truncate { max-width: 100px; }
  .cal-grid { grid-template-columns: repeat(4, 1fr); }
  .notification-panel { width: calc(100vw - 32px); right: 16px; left: 16px; }
}

/* ═══════════════════════════════════════════
   RESPONSIVE — SMALL PHONE (480px)
   ═══════════════════════════════════════════ */

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-body { padding: 12px; }
  .btn { padding: 8px 12px; font-size: 12px; }
  .stat-card .value { font-size: 20px; }
  .page-header-actions { width: 100%; }
  .page-header-actions .btn { width: 100%; justify-content: center; }
  .cal-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ─── Chart Grid Responsive ─── */
@media (max-width: 900px) {
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* ═══════════════════════════════════════════
   MOBILE EXCELLENCE — TOUCH, TABLES, LAYOUT
   ═══════════════════════════════════════════ */

/* Safe area insets for notched phones */
@supports (padding-top: env(safe-area-inset-top)) {
  .sidebar { padding-top: env(safe-area-inset-top); }
  .page-header { padding-top: max(14px, env(safe-area-inset-top)); }
  .page-body { padding-bottom: env(safe-area-inset-bottom); }
}

@media (max-width: 768px) {
  /* Touch-friendly nav items (44px min tap target) */
  .nav-item { min-height: 44px; display: flex; align-items: center; }
  .sidebar-footer { padding-bottom: max(16px, env(safe-area-inset-bottom, 16px)); }

  /* Horizontal scrollable tables on mobile */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 600px; }

  /* Touch-friendly form inputs */
  .form-control, input, select, textarea {
    min-height: 44px;
    font-size: 16px !important; /* Prevents iOS zoom on focus */
  }

  /* Better modals on mobile — full screen */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100%;
    margin: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 92vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Prevent body scroll when modal is open */
  body.modal-open { overflow: hidden; position: fixed; width: 100%; }

  /* Touch-friendly buttons */
  .btn { min-height: 44px; padding: 10px 16px; }
  .btn-sm { min-height: 36px; }

  /* Better card headers on mobile */
  .card-header h3 { font-size: 15px; }

  /* Sidebar slide animation */
  .sidebar {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
  }
  .sidebar-overlay {
    transition: opacity 0.25s ease;
    opacity: 0;
    pointer-events: none;
  }
  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  /* Compact stat cards */
  .stat-card { padding: 12px; }
  .stat-card .sub { font-size: 9px; }

  /* Better badge readability */
  .badge { font-size: 10px; padding: 3px 8px; }
}

@media (max-width: 480px) {
  /* Full-width action buttons on small phones */
  .page-header-actions {
    display: flex;
    flex-direction: column;
    width: 100%;
  }
  .page-header-actions .btn { width: 100%; justify-content: center; }

  /* Stack filter chips */
  .filters-bar { gap: 8px; }
  .filters-bar .form-control { min-width: 0; }

  /* Compact table cells */
  thead th, tbody td { padding: 6px 8px; font-size: 11px; }

  /* Mobile-optimized header */
  .page-header h2 { font-size: 15px; }
  .page-header .page-subtitle { font-size: 11px; }

  /* Better toast on small screens */
  .toast {
    left: 8px;
    right: 8px;
    bottom: max(20px, env(safe-area-inset-bottom, 20px));
    font-size: 13px;
  }
}

/* ─── Pull-to-refresh visual cue ─── */
@media (max-width: 1024px) {
  .page-body { overscroll-behavior-y: contain; }
}

/* ─── Smooth scrolling on mobile ─── */
.page-body, .modal-body, .sidebar-nav {
  -webkit-overflow-scrolling: touch;
}

/* ─── Active state feedback for mobile taps ─── */
@media (hover: none) and (pointer: coarse) {
  .nav-item:active { background: var(--brand-100); transform: scale(0.98); }
  .btn:active { transform: scale(0.97); }
  .stat-card:active { transform: scale(0.98); }
  tbody tr:active { background: var(--brand-50) !important; }
}

/* ═══════════════════════════════════════════
   PRINT
   ═══════════════════════════════════════════ */

@media print {
  body { background: white; font-size: 11px; color: #000; }
  .sidebar, .sidebar-overlay, .mobile-menu-btn,
  .toast, .modal-overlay, .no-print, .header-icon-bar,
  .offline-bar { display: none !important; }
  .main-content { margin-left: 0; }
  .page-header {
    position: static;
    border-bottom: 2px solid #333;
    padding: 12px 0;
    backdrop-filter: none;
  }
  .page-header-actions { display: none !important; }
  .page-body { padding: 12px 0; animation: none; }
  .card { box-shadow: none; border: 1px solid #ddd; page-break-inside: avoid; }
  .stat-card { box-shadow: none; border: 1px solid #ddd; }
  .stat-card::before { display: none; }
  .table-wrap { box-shadow: none; border: 1px solid #ddd; }
  table { font-size: 10px; }
  thead th {
    background: #333 !important;
    color: white !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  tbody td { padding: 6px 8px; }
  .badge, .wave-badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .btn { display: none !important; }
  .filters-bar { display: none !important; }
  .action-btns { display: none !important; }
  .stats-grid { grid-template-columns: repeat(5, 1fr); }
  a { text-decoration: none; color: inherit; }
  .print-header { display: block !important; text-align: center; margin-bottom: 12px; font-size: 10px; color: #666; }
}
.print-header { display: none; }

/* ═══════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════ */

.hidden { display: none !important; }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 12px; }
.text-mono { font-family: 'SF Mono', 'JetBrains Mono', Consolas, monospace; font-size: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

/* Skeleton loading animation */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite linear;
  border-radius: var(--radius);
}
@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Focus-visible for keyboard navigation */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}
