/* ============================================================
   RSBV1 Design System — Design Tokens & Component Library
   Source: brain/Design System/Design System.md
   ============================================================ */

/* --- Design Tokens (Base / Admin Navy Theme) --- */
:root {
  /* Primary Colors */
  --primary: #0a314d;
  --primary-light: #98d9f5;
  --primary-dark: #062135;

  /* Accent Colors */
  --accent: #8B6914;
  --accent-light: #B8941E;

  /* Defense / Success Palette */
  --defense: #065f46;
  --defense-light: #a7f3d0;
  --defense-bg: #d1fae5;

  /* Background Colors */
  --bg-main: #f8fafc;
  --bg-alt: #ffffff;
  --bg-dark: #062135;

  /* Text Colors */
  --text-main: #0f172a;
  --text-muted: #334155;
  --text-light: #64748b;
  --text-inverse: #ffffff;

  /* Border Colors */
  --border-color: #94a3b8;
  --border-light: #cbd5e1;
  --border-dark: #475569;

  /* Status Colors */
  --success: #059669;
  --success-light: #d1fae5;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --info: #2563eb;
  --info-light: #dbeafe;

  /* Component Colors */
  --card-bg: #ffffff;
  --card-shadow: 0 0 0 1px rgba(148,163,184,0.15), 0 1px 3px 0 rgba(0,0,0,0.04), 0 4px 12px -2px rgba(0,0,0,0.03);
  --card-shadow-hover: 0 0 0 1px rgba(148,163,184,0.2), 0 4px 12px 0 rgba(0,0,0,0.06), 0 12px 28px -4px rgba(0,0,0,0.05);
  --input-bg: #ffffff;
  --input-border: #94a3b8;
  --input-focus: #0a314d;
  --button-primary: #1e40af;
  --button-secondary: #334155;
  --nav-bg: #0a314d;
  --nav-text: #98d9f5;
  --footer-bg: #062135;
  --footer-text: #94a3b8;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.03);
  --shadow: 0 0 0 1px rgba(148,163,184,0.08), 0 1px 3px 0 rgba(0,0,0,0.04), 0 1px 2px -1px rgba(0,0,0,0.04);
  --shadow-md: 0 0 0 1px rgba(148,163,184,0.12), 0 4px 8px -2px rgba(0,0,0,0.05), 0 8px 24px -4px rgba(0,0,0,0.04);
  --shadow-lg: 0 0 0 1px rgba(148,163,184,0.15), 0 8px 20px -4px rgba(0,0,0,0.06), 0 20px 48px -8px rgba(0,0,0,0.05);
  --shadow-xl: 0 0 0 1px rgba(148,163,184,0.2), 0 16px 40px -8px rgba(0,0,0,0.07), 0 32px 80px -16px rgba(0,0,0,0.06);

  /* Typography */
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-family-mono: 'Courier New', Courier, monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.75;
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;

  /* Spacing */
  --space-0: 0;
  --space-1: 0.25rem;
  --space-1-5: 0.375rem;
  --space-2: 0.5rem;
  --space-2-5: 0.625rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Border Radius */
  --radius-none: 0;
  --radius-sm: 0.125rem;
  --radius: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-2xl: 1rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 120ms cubic-bezier(0.4,0,0.2,1);
  --transition-base: 200ms cubic-bezier(0.4,0,0.2,1);
  --transition-slow: 300ms cubic-bezier(0.4,0,0.2,1);
  --transition-spring: 350ms cubic-bezier(0.34,1.56,0.64,1);

  /* Z-Index */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
}

/* --- Operator / Defense Theme --- */
[data-theme="operator"] {
  --primary: #065f46;
  --primary-light: #a7f3d0;
  --primary-dark: #047857;
  --input-focus: #065f46;
  --button-primary: #059669;
  --nav-bg: #065f46;
  --nav-text: #a7f3d0;
  --footer-bg: #047857;
  --footer-text: #a7f3d0;
  --bg-dark: #047857;
}

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

body {
  font-family: var(--font-family);
  background: var(--bg-main);
  color: var(--text-main);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}

/* --- Focus States --- */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

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

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

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 20px; height: 40px;
  font-size: var(--text-sm); font-weight: 500;
  font-family: var(--font-family);
  line-height: 1;
  border-radius: var(--radius-lg); cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none; border: 1px solid transparent;
  gap: var(--space-2); white-space: nowrap;
  letter-spacing: 0.01em;
}
.btn .material-icons { font-size: 18px; }

.btn-primary {
  background: var(--button-primary); color: var(--text-inverse);
  border-color: var(--button-primary);
}
.btn-primary:hover { background: #1e3a8a; border-color: #1e3a8a; box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.06); }

.btn-secondary {
  background: var(--button-secondary); color: var(--text-inverse);
  border-color: var(--button-secondary);
}
.btn-secondary:hover { background: #1e293b; }

.btn-outline {
  background: transparent; color: var(--text-main);
  border-color: var(--border-color);
}
.btn-outline:hover { background: #f8fafc; border-color: #64748b; }

.btn-danger {
  background: var(--danger); color: var(--text-inverse);
  border-color: var(--danger);
}
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

.btn-success {
  background: var(--success); color: var(--text-inverse);
  border-color: var(--success);
}
.btn-success:hover { background: #047857; border-color: #047857; }

.btn:disabled {
  opacity: 0.6; cursor: not-allowed;
  background: #f3f4f6; color: #9ca3af; border-color: #d1d5db;
}

.btn-sm { height: 34px; padding: 0 14px; font-size: var(--text-xs); }
.btn-lg { height: 48px; padding: 0 28px; font-size: var(--text-base); }
.btn-wide { width: 100%; justify-content: center; }
.btn-block-mobile { display: inline-flex; }

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

.form-label {
  display: block; margin-bottom: var(--space-2);
  font-size: var(--text-sm); font-weight: 500;
  color: var(--text-main); letter-spacing: 0.01em;
}

.form-input {
  display: block; width: 100%; height: 48px;
  padding: 0 var(--space-4);
  font-size: var(--text-base); font-family: var(--font-family);
  color: var(--text-main); background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-sizing: border-box;
}
.form-input:focus {
  outline: none; border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(10,49,77,0.08);
}
.form-input::placeholder { color: #9ca3af; opacity: 1; }
.form-input.error { border-color: var(--danger); }
.form-input.success { border-color: var(--success); }
.form-input:disabled {
  background: #f3f4f6; cursor: not-allowed;
  color: #9ca3af; border-color: #d1d5db;
}

.form-error { display:flex; align-items:center; gap:var(--space-1); margin-top: var(--space-1-5); font-size: var(--text-xs); color: var(--danger); }
.form-error::before { content:'info'; font-family:'Material Icons'; font-size:14px; }
.form-hint { display:block; margin-top: var(--space-1-5); font-size: var(--text-xs); color: #6b7280; }

.form-select {
  display: block; width: 100%; height: 48px;
  padding: 0 var(--space-4);
  padding-right: 44px;
  font-size: var(--text-base); font-family: var(--font-family);
  color: var(--text-main); background: var(--input-bg);
  border: 1px solid var(--input-border); border-radius: var(--radius-lg);
  cursor: pointer; box-sizing: border-box;
  appearance: none; -webkit-appearance: none;
  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' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
}
.form-select:focus {
  outline: none; border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(10,49,77,0.08);
}

.form-textarea {
  display: block; width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base); font-family: var(--font-family);
  color: var(--text-main); background: var(--input-bg);
  border: 1px solid var(--input-border); border-radius: var(--radius-lg);
  resize: vertical; min-height: 80px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-textarea:focus {
  outline: none; border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(10,49,77,0.08);
}

.form-checkbox { display: inline-flex; align-items: center; cursor: pointer; }
.form-checkbox input { margin-right: var(--space-2); }
.form-radio { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; font-size: var(--text-sm); }
.form-inline-group { display: flex; gap: var(--space-3); align-items: flex-start; }

/* --- Cards --- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}
.card-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h2 { font-size: var(--text-lg); font-weight: var(--font-semibold); }
.card-body { padding: var(--space-6); }
.card-footer {
  padding: var(--space-4) var(--space-6);
  background: var(--bg-main);
  border-top: 1px solid var(--border-light);
}

/* --- Stats Card (Dashboard) --- */
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--card-shadow);
  padding: var(--space-5);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}
.stat-icon {
  width: 48px; height: 48px; border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon .material-icons { font-size: 24px; }
.stat-icon.primary { background: var(--info-light); color: var(--info); }
.stat-icon.success { background: #f0fdf4; color: #166534; }
.stat-icon.warning { background: var(--warning-light); color: #92400e; }
.stat-icon.danger  { background: var(--danger-light); color: #991b1b; }
.stat-info h3 { font-size: var(--text-2xl); font-weight: var(--font-bold); line-height: var(--leading-tight); margin-bottom: var(--space-1); }
.stat-info p  { font-size: var(--text-sm); color: var(--text-muted); }

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

/* --- Navigation Bar --- */
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--space-6); height: 64px;
  background: var(--nav-bg); color: var(--nav-text);
  position: sticky; top: 0; z-index: var(--z-sticky);
}
.navbar-brand {
  display: flex; align-items: center; gap: var(--space-3);
  font-size: var(--text-lg); font-weight: var(--font-bold);
  color: var(--nav-text); text-decoration: none;
}
.navbar-brand .material-icons { font-size: 24px; }
.navbar-right { display: flex; align-items: center; gap: var(--space-4); }
.navbar-user {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-sm); color: var(--nav-text);
}
.navbar-user .material-icons { font-size: 20px; }
.navbar-nav { display: flex; gap: var(--space-6); list-style: none; margin: 0; padding: 0; }
.navbar-link {
  color: var(--nav-text); text-decoration: none;
  font-weight: var(--font-medium);
  transition: color var(--transition-fast);
}
.navbar-link:hover { color: var(--accent); }
.navbar-link.active { color: var(--accent); border-bottom: 2px solid var(--accent); }

/* --- Logout Button (Navbar variant) --- */
.btn-logout {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm); font-weight: var(--font-medium);
  font-family: var(--font-family);
  color: var(--text-inverse);
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius); cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-fast);
}
.btn-logout:hover { background: rgba(255,255,255,0.2); }
.btn-logout .material-icons { font-size: 16px; }

/* --- Sidebar --- */
.sidebar {
  width: 250px;
  background: var(--bg-alt);
  border-right: 1px solid var(--border-light);
  padding: var(--space-4) 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-label {
  padding: 0 var(--space-5);
  margin-bottom: var(--space-2);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
}
.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0 var(--space-3);
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2-5) var(--space-3);
  margin-bottom: 1px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  border-radius: var(--radius-lg);
  transition: background var(--transition-fast), color var(--transition-fast);
  cursor: pointer;
  position: relative;
}
.sidebar-item .material-icons {
  font-size: 20px;
  color: var(--text-light);
  width: 20px;
  transition: color var(--transition-fast);
}
.sidebar-item:hover {
  background: #f1f5f9;
  color: var(--text-main);
}
.sidebar-item:hover .material-icons {
  color: var(--primary);
}
.sidebar-item.active {
  background: #eff6ff;
  color: var(--primary);
  font-weight: var(--font-semibold);
}
.sidebar-item.active .material-icons {
  color: var(--primary);
}
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
[data-theme="operator"] .sidebar-item.active {
  background: #ecfdf5;
}
[data-theme="operator"] .sidebar-item.active .material-icons {
  color: var(--primary);
}
[data-theme="operator"] .sidebar-item.active::before {
  background: var(--primary);
}
[data-theme="operator"] .sidebar-item:hover .material-icons {
  color: var(--primary);
}

/* --- Tables --- */
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th, .table td {
  padding: var(--space-3) var(--space-4);
  text-align: left; border-bottom: 1px solid var(--border-light);
}
.table th {
  background: var(--bg-main); font-weight: var(--font-semibold); color: var(--text-main);
}
.table tbody tr:hover { background: var(--bg-main); }
.table-compact { font-size: var(--text-sm); }
.table-compact th, .table-compact td { padding: var(--space-2) var(--space-3); }
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* --- Badges --- */
.badge {
  display: inline-flex; align-items: center;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs); font-weight: var(--font-medium);
  border-radius: var(--radius-full);
  text-transform: uppercase; letter-spacing: var(--tracking-wide);
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger  { background: var(--danger-light); color: var(--danger); }
.badge-info    { background: var(--info-light); color: var(--info); }
.badge-primary { background: var(--primary); color: var(--text-inverse); }

/* --- Alerts --- */
.alert {
  display: flex; align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
}
.alert .material-icons { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-error { background: var(--danger-light); color: #991b1b; }
.alert-success { background: var(--success-light); color: #065f46; }
.alert-warning { background: var(--warning-light); color: #92400e; }
.alert-info { background: var(--info-light); color: #1e40af; }

/* --- Page Header --- */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-6); flex-wrap: wrap; gap: var(--space-3);
}
.page-header h1 { font-size: var(--text-2xl); font-weight: var(--font-bold); }
.page-header p  { font-size: var(--text-sm); color: var(--text-muted); }

/* --- Login Page (Centered Card) --- */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: var(--space-4);
}
.login-card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--card-shadow);
  width: 100%; max-width: 400px;
  padding: var(--space-10);
}
.login-brand {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: var(--space-8);
}
.login-brand-icon {
  width: 56px; height: 56px; border-radius: var(--radius-full);
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--space-4);
}
.login-brand-icon .material-icons { font-size: 28px; color: var(--primary-light); }
.login-brand h1 { font-size: var(--text-xl); font-weight: var(--font-bold); margin-bottom: var(--space-1); }
.login-brand p  { font-size: var(--text-sm); color: var(--text-muted); }
.login-footer {
  text-align: center; margin-top: var(--space-6);
  font-size: var(--text-xs); color: var(--text-light);
}

/* --- Layout (Dashboard) --- */
.layout { display: flex; height: calc(100vh - 64px); overflow: hidden; }
.main { flex: 1; padding: var(--space-6); min-width: 0; overflow-y: auto; overflow-x: hidden; }

/* --- Mobile Menu Toggle --- */
.mobile-menu-toggle {
  display: none; background: none; border: none;
  color: var(--nav-text); cursor: pointer; padding: var(--space-2);
}
.mobile-menu-toggle .material-icons { font-size: 24px; }

/* --- Flex / Grid Utilities --- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.min-width-0 { min-width: 0; }

/* Grid */
.grid { display: grid; gap: var(--space-6); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Container */
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 var(--space-4); }

/* --- Text Utilities --- */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.text-muted   { color: var(--text-muted); }
.text-light   { color: var(--text-light); }
.font-bold    { font-weight: var(--font-bold); }
.font-medium  { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.text-xs  { font-size: var(--text-xs); }
.text-sm  { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg  { font-size: var(--text-lg); }
.text-xl  { font-size: var(--text-xl); }

/* --- Spacing Utilities --- */
.m-0 { margin: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.p-0 { padding: 0; }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.pt-4 { padding-top: var(--space-4); }
.pb-4 { padding-bottom: var(--space-4); }

/* --- Display Utilities --- */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }
.hide-mobile { display: inline; }
.show-mobile { display: none; }

/* --- Spinner --- */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: var(--radius-full);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Breadcrumb --- */
.breadcrumb {
  display: flex; gap: var(--space-2); align-items: center;
  font-size: var(--text-sm); color: var(--text-muted);
}
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--border-color); }

/* --- Tabs --- */
.tabs {
  display: flex; border-bottom: 2px solid var(--border-light); gap: 0;
}
.tab-item {
  padding: var(--space-3) var(--space-5); cursor: pointer;
  font-size: var(--text-sm); font-weight: var(--font-medium);
  color: var(--text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.tab-item:hover { color: var(--primary); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-item.disabled { color: var(--text-light); cursor: not-allowed; opacity: 0.5; }
.tab-content { padding: var(--space-4) 0; display: none; }
.tab-content.active { display: block; }
.tabs-icon .tab-item.has-icon {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.tab-item.has-icon .material-icons { font-size: 18px; }

/* --- Pagination --- */
.pagination {
  display: flex; gap: var(--space-1); align-items: center;
}
.page-item {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px;
  border: 1px solid var(--border-color); border-radius: var(--radius);
  cursor: pointer; font-size: var(--text-sm);
  background: var(--bg-alt);
  transition: background var(--transition-fast);
}
.page-item:hover { background: var(--bg-main); }
.page-item.active {
  background: var(--primary); color: var(--text-inverse);
  border-color: var(--primary);
}
.page-item:disabled {
  opacity: 1; cursor: not-allowed;
  background: #f1f5f9; color: #64748b; border-color: #cbd5e1;
}

/* --- Progress Bar --- */
.progress {
  height: var(--space-2); background: var(--bg-main);
  border-radius: var(--radius-full); overflow: hidden;
}
.progress-bar { height: 100%; border-radius: var(--radius-full); transition: width var(--transition-slow); }

/* --- Modals (Base) --- */
.modal-backdrop { display: none; }
.modal-backdrop.active { display: flex; }
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(6,33,53,0.65);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  align-items: center; justify-content: center;
}
.modal {
  background: var(--bg-alt); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 500px; width: 90%;
  max-height: 90vh; overflow-y: auto;
  z-index: var(--z-modal);
  animation: modalZoom 0.2s ease;
}
@keyframes modalZoom {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.modal-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-body { padding: var(--space-6); }
.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-light);
  display: flex; justify-content: flex-end; gap: var(--space-3);
}

/* --- Skip Link (Accessibility) --- */
.skip-link {
  position: absolute; top: -40px; left: 0;
  background: var(--primary); color: var(--text-inverse);
  padding: var(--space-2) var(--space-4);
  z-index: var(--z-tooltip);
  transition: top var(--transition-fast);
}
.skip-link:focus { top: 0; }

/* --- Hover Lift --- */
.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* --- Premium Alerts (Borderless Cards with Icon) --- */
.alert-premium {
  padding: var(--space-4) var(--space-5);
  border-radius: 14px;
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03), 0 4px 8px rgba(0,0,0,0.03), 0 8px 24px rgba(0,0,0,0.04);
  line-height: 1.6;
}
.alert-premium-icon {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}
.alert-premium-icon .material-icons { font-size: 18px; }
.alert-premium-success .alert-premium-icon { background: #f0fdf4; color: #166534; }
.alert-premium-warning .alert-premium-icon { background: #fffbeb; color: #92400e; }
.alert-premium-danger .alert-premium-icon  { background: #fef2f2; color: #991b1b; }
.alert-premium-info .alert-premium-icon    { background: #eff6ff; color: #1e40af; }
.alert-premium-body { flex: 1; min-width: 0; }
.alert-premium-title {
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: 2px;
  line-height: 1.4;
}
.alert-premium-success .alert-premium-title { color: #0a3d1e; }
.alert-premium-warning .alert-premium-title { color: #5c2a00; }
.alert-premium-danger .alert-premium-title  { color: #6b1212; }
.alert-premium-info .alert-premium-title    { color: #112b6b; }
.alert-premium-text {
  font-size: var(--text-xs);
  color: #64748b;
  line-height: 1.6;
}
.alert-premium-text strong { color: var(--text-main); }

/* --- Select Wrapper (for custom select arrow) --- */
.select-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
}
.select-wrapper .material-icons {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--text-muted);
  pointer-events: none;
}

/* --- Date Picker Wrapper --- */
.date-picker-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.date-picker-wrapper .material-icons {
  position: absolute;
  left: var(--space-3);
  color: var(--text-muted);
  pointer-events: none;
}
.date-picker-wrapper input[type="date"] {
  padding-left: var(--space-8);
}

/* --- iPhone-Style Y/N Toggle --- */
.toggle-container {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.toggle {
  position: relative;
  width: 58px; height: 32px;
  background: #b0b8c1;
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.35s cubic-bezier(0.4,0,0.2,1), box-shadow 0.2s ease;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.15);
  flex-shrink: 0;
}
.toggle:focus-visible {
  outline: 3px solid rgba(10,49,77,0.35);
  outline-offset: 2px;
}
.toggle.active {
  background: var(--success);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.12);
}
.toggle:active { box-shadow: inset 0 1px 4px rgba(0,0,0,0.25); }
.toggle:active .toggle-knob { width: 26px; }
.toggle-knob {
  position: absolute;
  top: 5px; left: 3px;
  width: 22px; height: 22px;
  background: #ffffff;
  border-radius: 50%;
  transition: left 0.35s cubic-bezier(0.4,0,0.2,1), width 0.2s ease, box-shadow 0.2s ease;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.5px;
  color: #6b7280;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.12);
  text-transform: uppercase; user-select: none; overflow: hidden;
}
.toggle.active .toggle-knob {
  left: 33px;
  color: var(--success);
  box-shadow: 0 2px 4px rgba(0,0,0,0.18), 0 1px 2px rgba(0,0,0,0.1);
}
.toggle-label { font-size: var(--text-sm); color: var(--text-main); }

/* --- Accordion --- */
.accordion {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.accordion-item { border-bottom: 1px solid var(--border-light); }
.accordion-item:last-child { border-bottom: none; }
.accordion-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  background: var(--bg-alt);
  font-size: var(--text-sm); font-weight: var(--font-medium);
  transition: background var(--transition-fast);
}
.accordion-header:hover { background: var(--bg-main); }
.accordion-header.open { color: var(--primary); }
.accordion-header .material-icons { transition: transform var(--transition-base); }
.accordion-header.open .material-icons { transform: rotate(180deg); }
.accordion-body {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm); color: var(--text-muted);
  display: none;
}
.accordion-body.open { display: block; }

/* --- Search Widget --- */
.search-widget {
  background: var(--bg-alt);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-6);
}
.search-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
}
.search-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

/* --- Dropdown Menu --- */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  z-index: var(--z-dropdown);
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 200px;
  padding: var(--space-1) 0;
  display: none;
  overflow: hidden;
}
.dropdown-menu.open { display: block; }
.dropdown-menu-item {
  display: flex; align-items: center; gap: var(--space-3);
  width: 100%;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm); color: var(--text-main);
  background: none; border: none; cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast);
  text-decoration: none;
}
.dropdown-menu-item:hover { background: var(--bg-main); }
.dropdown-menu-item .material-icons { font-size: 18px; color: var(--text-muted); }
.dropdown-menu-item.dropdown-danger { color: var(--danger); }
.dropdown-menu-item.dropdown-danger .material-icons { color: var(--danger); }
.dropdown-divider {
  height: 1px;
  background: var(--border-light);
  margin: var(--space-1) 0;
}
.dropdown-menu.dropdown-top  { bottom: calc(100% + 4px); top: auto; }
.dropdown-menu.dropdown-left { right: 0; left: auto; }
@media (max-width: 640px) {
  .dropdown-menu {
    position: fixed; bottom: 0; left: 0; right: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    min-width: auto;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    max-height: 80vh; overflow-y: auto;
  }
}

/* --- Tooltip --- */
.tooltip-wrap { position: relative; display: inline-block; cursor: pointer; }
.tooltip-text {
  visibility: hidden;
  background: var(--bg-dark); color: var(--text-inverse);
  text-align: center;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius);
  font-size: var(--text-xs);
  position: absolute;
  bottom: 125%; left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  z-index: var(--z-tooltip);
}
.tooltip-wrap:hover .tooltip-text { visibility: visible; }

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-tooltip);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start;
  gap: var(--space-4);
  min-width: 340px; max-width: 400px;
  padding: var(--space-5) var(--space-5) var(--space-5) var(--space-4);
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.06);
  border-top: 2px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.02), 0 1px 2px rgba(0,0,0,0.04), 0 4px 8px rgba(0,0,0,0.04), 0 12px 24px rgba(0,0,0,0.06), 0 24px 48px rgba(0,0,0,0.04);
  pointer-events: auto;
  animation: toastSlideIn 0.4s cubic-bezier(0.16,1,0.3,1);
  position: relative;
  overflow: hidden;
}
.toast.toast-success { border-top-color: #166534; }
.toast.toast-warning { border-top-color: #92400e; }
.toast.toast-danger  { border-top-color: #991b1b; }
.toast.toast-info    { border-top-color: #1e40af; }
.toast-icon {
  flex-shrink: 0;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  margin-top: 1px;
}
.toast-icon .material-icons { font-size: 20px; }
.toast-success .toast-icon { background: #f0fdf4; color: #166534; }
.toast-warning .toast-icon { background: #fffbeb; color: #92400e; }
.toast-danger  .toast-icon { background: #fef2f2; color: #991b1b; }
.toast-info    .toast-icon { background: #eff6ff; color: #1e40af; }
.toast-body { flex: 1; min-width: 0; padding-top: 2px; }
.toast-title {
  font-size: 13px; font-weight: 600;
  color: #0f172a;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-bottom: 3px;
}
.toast-message {
  font-size: 12.5px;
  color: #64748b;
  line-height: 1.55;
}
.toast-close {
  position: absolute;
  top: 12px; right: 12px;
  flex-shrink: 0;
  background: none; border: none; cursor: pointer;
  color: #94a3b8;
  padding: 4px; margin: -4px;
  border-radius: 8px;
  transition: all 0.15s ease;
  display: flex; align-items: center; justify-content: center;
}
.toast-close:hover { color: #475569; background: #f1f5f9; }
.toast-close .material-icons { font-size: 16px; }
@keyframes toastSlideIn {
  from { transform: translateX(calc(100% + 24px)); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@media (max-width: 640px) {
  .toast-container { top: unset; left: var(--space-3); right: var(--space-3); bottom: var(--space-3); }
  .toast { min-width: 0; max-width: 100%; padding: var(--space-4); border-radius: 12px; }
}

/* --- Popover --- */
.popover-wrap { position: relative; display: inline-block; }
.popover {
  position: absolute;
  z-index: var(--z-popover);
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: var(--space-4);
  min-width: 240px; max-width: 320px;
  display: none;
}
.popover.open { display: block; }
.popover-title {
  font-size: var(--text-sm); font-weight: var(--font-semibold);
  color: var(--text-main);
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-light);
}
.popover-body {
  font-size: var(--text-sm); color: var(--text-muted);
  line-height: var(--leading-normal);
}
.popover-footer {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-light);
  display: flex; justify-content: flex-end; gap: var(--space-2);
}
.popover.popover-top    { bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); }
.popover.popover-bottom { top: calc(100% + 10px); left: 50%; transform: translateX(-50%); }
.popover.popover-left   { right: calc(100% + 10px); top: 50%; transform: translateY(-50%); }
.popover.popover-right  { left: calc(100% + 10px); top: 50%; transform: translateY(-50%); }

/* --- Bottom Sheet (Mobile) --- */
.bottom-sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
  z-index: calc(var(--z-modal) - 1);
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.bottom-sheet-overlay.open { display: flex; }
.bottom-sheet {
  width: 100%; max-width: 640px;
  max-height: 85vh;
  background: var(--bg-alt);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
  z-index: var(--z-modal);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32,0.72,0,1);
  overflow-y: auto;
}
.bottom-sheet-overlay.open .bottom-sheet { transform: translateY(0); }
.bottom-sheet-handle {
  width: 36px; height: 4px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  margin: var(--space-3) auto var(--space-2);
}
.bottom-sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--space-5) var(--space-3);
}
.bottom-sheet-header h3 { font-size: var(--text-lg); font-weight: var(--font-semibold); }
.bottom-sheet-body { padding: 0 var(--space-5) var(--space-5); }
.bottom-sheet-footer {
  padding: var(--space-3) var(--space-5) var(--space-5);
  display: flex; gap: var(--space-3);
}
.bottom-sheet-footer .btn { flex: 1; }

/* --- Modal Variants --- */
.modal-icon-badge {
  background: #eff6ff;
  border-radius: 50%;
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto var(--space-3);
}
.modal-icon-badge .material-icons { font-size: 24px; color: var(--info); }
.modal-success .modal-icon-badge {
  width: 64px; height: 64px;
  background: #f0fdf4;
}
.modal-success .modal-icon-badge .material-icons { font-size: 36px; color: var(--success); }
.modal-warning .modal-icon-badge {
  width: 64px; height: 64px;
  background: #fffbeb;
}
.modal-warning .modal-icon-badge .material-icons { font-size: 36px; color: var(--warning); }
.modal-danger .modal-icon-badge {
  width: 64px; height: 64px;
  background: #fef2f2;
}
.modal-danger .modal-icon-badge .material-icons { font-size: 36px; color: var(--danger); }
.modal-confirm .modal-icon-badge {
  width: 48px; height: 48px;
  background: #fef2f2;
}
.modal-confirm .modal-icon-badge .material-icons { font-size: 24px; color: var(--danger); }

/* --- OTP Input Fields --- */
.otp-container { display: flex; gap: var(--space-2); }
.otp-input {
  width: 48px; height: 56px;
  text-align: center;
  font-size: var(--text-xl); font-weight: var(--font-bold);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.otp-input:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.otp-input.error { border-color: var(--danger); }
.otp-timer { font-size: var(--text-sm); color: var(--text-muted); margin-top: var(--space-2); }
.otp-timer.success { color: var(--success); }
.otp-timer.error { color: var(--danger); }
@media (max-width: 1024px) {
  .otp-input { width: 44px; height: 50px; font-size: var(--text-lg); }
}
@media (max-width: 640px) {
  .otp-container { gap: var(--space-1); justify-content: center; }
  .otp-input { width: 40px; height: 44px; font-size: var(--text-base); }
}
@media (max-width: 480px) {
  .otp-input { width: 36px; height: 40px; font-size: var(--text-sm); }
}

/* --- Guest Selector --- */
.guest-selector {
  display: flex; align-items: center; gap: var(--space-2);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  padding: var(--space-1) var(--space-2);
  background: var(--input-bg);
}
.guest-selector button {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-alt);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-lg); font-weight: var(--font-bold);
  color: var(--primary);
}
.guest-selector button:hover { background: var(--bg-main); }
.guest-selector span {
  min-width: 24px;
  text-align: center;
  font-weight: var(--font-medium);
}

/* --- Skeleton Loading --- */
.skeleton {
  background: #e2e8f0;
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.skeleton::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.6) 20%, rgba(255,255,255,0.85) 50%, rgba(255,255,255,0.6) 80%, transparent 100%);
  transform: translateX(-100%);
  animation: skeleton-shimmer 1.8s ease-in-out infinite;
  z-index: 1;
}
@keyframes skeleton-shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.skeleton-pulse {
  background: #e2e8f0;
  border-radius: var(--radius-lg);
  animation: skeleton-pulse 2s cubic-bezier(0.4,0,0.6,1) infinite;
}
@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}
.skeleton-circle    { border-radius: var(--radius-full); }
.skeleton-rounded-sm { border-radius: var(--radius); }
.skeleton-rounded    { border-radius: var(--radius-lg); }
.skeleton-rounded-xl { border-radius: var(--radius-xl); }
.skeleton-card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.skeleton-card-body { padding: var(--space-4); }
.skeleton-card-footer {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-light);
  display: flex; justify-content: space-between; align-items: center;
}
.skeleton-row {
  display: flex; align-items: flex-start; gap: var(--space-4);
  padding: var(--space-4);
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
}
.skeleton-field-group { display: flex; flex-direction: column; gap: var(--space-2); }
.skeleton-input  { height: 44px; width: 100%; }
.skeleton-textarea { width: 100%; min-height: 80px; }
@media (prefers-reduced-motion: reduce) {
  .skeleton::after { animation: none; }
  .skeleton-pulse  { animation: none; }
}

/* --- Right-Floating Slider --- */
.slider-popup { display: none; }
.slider-popup.open { display: block; }
.slider-popup {
  position: fixed;
  top: var(--space-8); right: var(--space-8); bottom: var(--space-8);
  width: 400px;
  background: var(--bg-alt);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-modal);
  animation: sliderSlide 0.3s ease;
  overflow-y: auto;
}
@keyframes sliderSlide {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
.slider-backdrop { display: none; }
.slider-backdrop.open { display: block; }
.slider-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(3px);
  z-index: calc(var(--z-modal) - 1);
}
.slider-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
}
.slider-body { padding: var(--space-6); }

/* --- High Contrast Mode --- */
.high-contrast {
  --primary: #0000cc;
  --primary-light: #0000ff;
  --accent: #7a5c10;
  --bg-main: #ffffff;
  --bg-alt: #ffffff;
  --text-main: #000000;
  --text-muted: #1a1a1a;
  --border-color: #000000;
  --border-light: #333333;
  --border-dark: #000000;
  --success: #006600;
  --warning: #994d00;
  --danger: #cc0000;
  --nav-bg: #000000;
  --nav-text: #ffffff;
  --footer-bg: #000000;
  --footer-text: #ffffff;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet (max-width: 1024px) */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed; top: 64px; left: 0;
    height: calc(100vh - 64px);
    transform: translateX(-100%);
    transition: transform var(--transition-base);
    z-index: var(--z-fixed);
    box-shadow: var(--shadow-md);
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu-toggle { display: flex; align-items: center; justify-content: center; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .search-row { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab-item { white-space: nowrap; flex-shrink: 0; }
}

/* Mobile (max-width: 640px) */
@media (max-width: 640px) {
  body { font-size: var(--text-sm); }
  .hide-mobile { display: none !important; }
  .show-mobile { display: block !important; }
  .btn { padding: var(--space-2) var(--space-4); font-size: var(--text-sm); }
  .btn-lg { padding: var(--space-3) var(--space-5); font-size: var(--text-base); }
  .btn-block-mobile { width: 100%; justify-content: center; }
  .navbar { padding: 0 var(--space-4); }
  .main { padding: var(--space-4); }
  .login-card { padding: var(--space-6); }
  .stats-grid { grid-template-columns: 1fr; }
  .sidebar { width: 260px; }
  .card-body { padding: var(--space-4); }
  .card-header { padding: var(--space-3) var(--space-4); }
  .page-header { flex-direction: column; align-items: flex-start; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-group { margin-bottom: var(--space-4); }
  .form-inline-group { flex-direction: column; gap: 0; }
  .table-responsive { margin: 0 calc(-1 * var(--space-3)); width: calc(100% + var(--space-6)); }
  .table { font-size: var(--text-xs); }
  .table th, .table td { padding: var(--space-2) var(--space-3); white-space: nowrap; }
  .modal-box { width: 95%; border-radius: var(--radius); }
  .modal-header { padding: var(--space-3) var(--space-4); }
  .modal-body { padding: var(--space-4); }
  .modal-footer { padding: var(--space-3) var(--space-4); }
  .tab-item { padding: var(--space-2) var(--space-3); font-size: var(--text-xs); }
  .pagination { gap: var(--space-1); flex-wrap: wrap; justify-content: center; }
  .page-item { min-width: 32px; height: 32px; font-size: var(--text-xs); }
  .search-widget { padding: var(--space-4); }
  .search-actions { flex-direction: column; }
  .search-actions .btn { width: 100%; }
}

/* --- Searchable Select --- */
.search-select {
  position: relative; width: 100%;
}
.search-select-trigger {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; height: 48px;
  padding: 0 var(--space-4);
  font-size: var(--text-base); font-family: var(--font-family);
  color: var(--text-main); background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-lg); cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-sizing: border-box; text-align: left;
  gap: var(--space-2); user-select: none;
}
.search-select-trigger:hover { border-color: #9ca3af; }
.search-select-trigger:focus,
.search-select.open .search-select-trigger {
  outline: none; border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(10,49,77,0.08);
}
.search-select-trigger .material-icons {
  font-size: 20px; color: #9ca3af; flex-shrink: 0;
  transition: transform var(--transition-fast);
}
.search-select.open .search-select-trigger .material-icons {
  transform: rotate(180deg);
}
.search-select-trigger .placeholder { color: #9ca3af; }
.search-select-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #fff; border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.04);
  z-index: 1060; display: none; overflow: hidden;
}
.search-select.open .search-select-dropdown { display: block; }
.search-select-search {
  width: 100%; padding: var(--space-3);
  border: none; border-bottom: 1px solid var(--border-light);
  font-size: var(--text-sm); font-family: var(--font-family);
  outline: none; box-sizing: border-box;
}
.search-select-search:focus { border-bottom-color: var(--input-focus); }
.search-select-options {
  max-height: 220px; overflow-y: auto;
}
.search-select-option {
  display: block; width: 100%;
  padding: var(--space-2-5) var(--space-4);
  font-size: var(--text-sm); font-family: var(--font-family);
  color: var(--text-main); background: none;
  border: none; text-align: left; cursor: pointer;
  transition: background var(--transition-fast);
}
.search-select-option:hover { background: #f1f5f9; }
.search-select-option.selected { background: #eff6ff; color: var(--primary); font-weight: 500; }
.search-select-option.hidden { display: none; }
.search-select-no-results {
  padding: var(--space-4); text-align: center;
  font-size: var(--text-sm); color: #9ca3af;
}

/* --- Step Tabs (Wizard) --- */
.steps { display: flex; gap: 0; margin-bottom: var(--space-8); position: relative; }
.step-tab {
  flex: 1; display: flex; align-items: center; gap: var(--space-2-5);
  padding: var(--space-3) var(--space-4);
  background: none; border: none; cursor: pointer;
  font-size: var(--text-sm); font-weight: 500; font-family: var(--font-family);
  color: #9ca3af; position: relative; text-align: left;
  transition: color var(--transition-fast);
}
.step-tab::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: #e5e7eb; border-radius: 2px 2px 0 0;
  transition: background var(--transition-fast);
}
.step-tab.active { color: var(--primary); }
.step-tab.active::after { background: var(--primary); }
.step-tab.completed { color: var(--success); }
.step-tab.completed::after { background: var(--success); }
.step-number {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  font-size: var(--text-xs); font-weight: 600;
  background: #e5e7eb; color: #9ca3af; flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.step-tab.active .step-number { background: var(--primary); color: #fff; }
.step-tab.completed .step-number { background: var(--success); color: #fff; }
.step-pane { display: none; }
.step-pane.active { display: block; }

/* Small Phone (max-width: 480px) */
@media (max-width: 480px) {
  .sidebar { width: 240px; }
  .page-header h1 { font-size: var(--text-xl); }
  .modal { width: 100%; border-radius: 0; min-height: 100vh; max-height: 100vh; }
  .modal-footer { flex-direction: column; }
  .modal-footer .btn { width: 100%; justify-content: center; }
}
