/* ============================================================
   MOGG — Dark Enterprise Theme
   Next-Gen UI/UX Redesign
============================================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
  /* ═══════════════════════════════════════════
     LAYER 1: Primitive tokens (raw values)
     ═══════════════════════════════════════════ */

  /* Gray ramp (neutral) */
  --gray-50:  #F8F9FA;
  --gray-100: #F1F3F5;
  --gray-200: #E9ECEF;
  --gray-300: #DEE2E6;
  --gray-400: #CED4DA;
  --gray-500: #ADB5BD;
  --gray-600: #868E96;
  --gray-700: #495057;
  --gray-800: #343A40;
  --gray-900: #212529;

  /* Dark surface ramp (sidebar) */
  --slate-700: #2C3E50;
  --slate-800: #1E2A3A;
  --slate-850: #172231;
  --slate-900: #0F1923;

  /* Brand accent: Warm Gold (evolved from amber) */
  --gold-100: #FFF3D1;
  --gold-200: #FFE9B2;
  --gold-300: #FFDC8A;
  --gold-400: #D4A855;
  --gold-500: #C8963E;
  --gold-600: #A87830;
  --gold-700: #8A6128;

  /* Semantic colours */
  --green-500:  #4E8B6E;  --green-600: #3E7A5A;  --green-100: #E8F5ED;
  --red-500:    #B0544F;  --red-600:   #963F3A;  --red-100:   #FDECEB;
  --blue-500:   #5B7FA5;  --blue-600:  #4A6E91;  --blue-100:  #EEF3F8;
  --teal-500:   #6B8F71;  --teal-100:  #EDF7F0;

  /* Typography */
  --font-sans: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Type scale */
  --text-xs:   0.75rem;
  --text-sm:   0.8125rem;
  --text-base: 0.875rem;
  --text-md:   0.9375rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;

  /* Spacing (4px base) */
  --space-0:  0;       --space-1:  0.25rem;  --space-2:  0.5rem;
  --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;

  /* Radii */
  --radius-xs: 4px;  --radius-sm: 6px;  --radius-md: 8px;
  --radius-lg: 12px; --radius-xl: 16px; --radius-full: 9999px;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(0,0,0,.05);
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg:  0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.04);
  --shadow-xl:  0 20px 25px rgba(0,0,0,.1), 0 8px 10px rgba(0,0,0,.04);
  --shadow-sidebar: 4px 0 12px rgba(0,0,0,.15);

  /* Transitions */
  --ease-default: cubic-bezier(.4, 0, .2, 1);
  --ease-in:      cubic-bezier(.4, 0, 1, 1);
  --ease-out:     cubic-bezier(0, 0, .2, 1);
  --ease-spring:  cubic-bezier(.34, 1.56, .64, 1);
  --dur-fast: 150ms;  --dur-normal: 250ms;  --dur-slow: 350ms;

  /* ═══════════════════════════════════════════
     LAYER 2: Semantic tokens (role-based)
     ═══════════════════════════════════════════ */

  /* Surfaces */
  --bg-app:            var(--gray-50);
  --bg-sidebar:        var(--slate-900);
  --bg-sidebar-hover:  var(--slate-850);
  --bg-sidebar-active: var(--slate-800);
  --bg-card:           #FFFFFF;
  --bg-card-hover:     var(--gray-50);
  --bg-elevated:       #FFFFFF;
  --bg-subtle:         var(--gray-100);
  --bg-inverse:        var(--slate-900);

  /* Text */
  --text-primary:      var(--gray-900);
  --text-secondary:    var(--gray-700);
  --text-tertiary:     var(--gray-600);
  --text-muted:        var(--gray-500);
  --text-inverse:      #FFFFFF;
  --text-inverse-muted: rgba(255,255,255,.55);
  --text-link:         var(--gold-500);
  --text-link-hover:   var(--gold-600);

  /* Borders */
  --border-default:    var(--gray-300);
  --border-subtle:     var(--gray-200);
  --border-strong:     var(--gray-400);
  --border-focus:      var(--gold-500);
  --border-sidebar:    rgba(255,255,255,.08);

  /* Interactive */
  --accent:            var(--gold-500);
  --accent-hover:      var(--gold-600);
  --accent-light:      rgba(200,150,62,.10);

  /* Status (semantic) */
  --status-new:       var(--teal-500);
  --status-follow-up: var(--gold-500);
  --status-qualified: var(--blue-500);
  --status-converted: var(--green-500);
  --status-lost:      var(--red-500);
  --status-pending:   var(--gold-500);
  --status-progress:  var(--blue-500);
  --status-completed: var(--green-500);
  --status-cancelled: var(--red-500);
  --status-scheduled: var(--blue-500);
  --status-upcoming:  var(--gold-500);
  --status-overdue:   var(--red-500);
  --status-high:      var(--red-500);
  --status-medium:    var(--gold-500);
  --status-low:       var(--gray-500);

  /* Status backgrounds */
  --status-new-bg:       var(--teal-100);
  --status-follow-up-bg: var(--gold-100);
  --status-qualified-bg: var(--blue-100);
  --status-converted-bg: var(--green-100);
  --status-lost-bg:      var(--red-100);
  --status-pending-bg:   var(--gold-100);
  --status-progress-bg:  var(--blue-100);
  --status-completed-bg: var(--green-100);
  --status-cancelled-bg: var(--red-100);
  --status-overdue-bg:   var(--red-100);

  /* Layout */
  --sidebar-width:     260px;
  --sidebar-collapsed: 68px;
  --sidebar-transition: width var(--dur-slow) var(--ease-default);
  --topbar-height:     56px;
}

/* ---------- Base Resets ---------- */
*,*::before,*::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  background: var(--bg-app);
  color: var(--text-primary);
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  overflow-x: hidden;
}

/* ---------- Monospace data values ---------- */
.font-data {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---------- Page Enter Animation ---------- */
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.page-enter { animation: pageEnter var(--dur-slow) var(--ease-out) both; }

@keyframes staggerIn {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.stagger > * { animation: staggerIn var(--dur-normal) var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: 30ms; }
.stagger > *:nth-child(2) { animation-delay: 60ms; }
.stagger > *:nth-child(3) { animation-delay: 90ms; }
.stagger > *:nth-child(4) { animation-delay: 120ms; }
.stagger > *:nth-child(5) { animation-delay: 150ms; }
.stagger > *:nth-child(6) { animation-delay: 180ms; }
.stagger > *:nth-child(7) { animation-delay: 210ms; }
.stagger > *:nth-child(8) { animation-delay: 240ms; }
.stagger > *:nth-child(9) { animation-delay: 270ms; }
.stagger > *:nth-child(10) { animation-delay: 300ms; }

/* ═══════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════ */
.app-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  z-index: 1040;
  transition: var(--sidebar-transition);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5);
  border-bottom: 1px solid var(--border-sidebar);
  flex-shrink: 0;
}
.sidebar-brand-icon {
  font-size: 1.75rem;
  color: var(--accent);
  flex-shrink: 0;
}
.sidebar-brand-name {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text-inverse);
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.sidebar-brand-sub {
  font-size: var(--text-xs);
  color: var(--text-inverse-muted);
  display: block;
}

/* Nav list */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3) 0;
}
.sidebar-nav-list {
  list-style: none;
  padding: 0 var(--space-3);
  margin: 0;
}
.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-inverse-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  transition: all var(--dur-fast) var(--ease-default);
  position: relative;
  white-space: nowrap;
}
.sidebar-nav-link:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-inverse);
}
.sidebar-nav-link.active {
  background: var(--bg-sidebar-active);
  color: var(--text-inverse);
}
.sidebar-nav-link.active::before {
  content: '';
  position: absolute;
  left: calc(-1 * var(--space-3));
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  background: var(--accent);
}
.sidebar-nav-link .material-icons {
  font-size: 1.25rem;
  flex-shrink: 0;
}

/* Divider */
.sidebar-nav-divider {
  height: 1px;
  background: var(--border-sidebar);
  margin: var(--space-2) var(--space-4);
}

/* Sidebar footer */
.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-sidebar);
  flex-shrink: 0;
}
.sidebar-lang {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-inverse-muted);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: color var(--dur-fast);
}
.sidebar-lang:hover { color: var(--text-inverse); }
.sidebar-lang .material-icons { font-size: 1.1rem; }
.sidebar-toggle {
  background: transparent;
  border: 1px solid var(--border-sidebar);
  border-radius: var(--radius-sm);
  color: var(--text-inverse-muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--dur-fast);
}
.sidebar-toggle:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-inverse);
}
.sidebar-toggle .material-icons {
  font-size: 1.15rem;
  transition: transform var(--dur-normal) var(--ease-default);
}

/* Collapsed state */
.app-sidebar.collapsed { width: var(--sidebar-collapsed); }
.app-sidebar.collapsed .sidebar-brand-text,
.app-sidebar.collapsed .sidebar-nav-label,
.app-sidebar.collapsed .sidebar-brand-sub { display: none; }
.app-sidebar.collapsed .sidebar-brand { justify-content: center; padding: var(--space-4) 0; }
.app-sidebar.collapsed .sidebar-nav-link { justify-content: center; padding: var(--space-3) 0; }
.app-sidebar.collapsed .sidebar-toggle .material-icons { transform: rotate(180deg); }
.app-sidebar.collapsed .sidebar-footer { justify-content: center; }
.app-sidebar.collapsed .sidebar-lang-text { display: none; }

/* Collapsed tooltips */
.app-sidebar.collapsed .sidebar-nav-link { position: relative; }
.app-sidebar.collapsed .sidebar-nav-link::after {
  content: attr(aria-label);
  position: absolute;
  left: calc(100% + var(--space-2));
  top: 50%;
  transform: translateY(-50%);
  background: var(--slate-800);
  color: white;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast);
  box-shadow: var(--shadow-md);
  z-index: 1050;
}
.app-sidebar.collapsed .sidebar-nav-link:hover::after { opacity: 1; }

/* ═══════════════════════════════════════════
   APP WRAPPER + TOPBAR
   ═══════════════════════════════════════════ */
.app-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--dur-slow) var(--ease-default);
  flex: 1;
}
.app-sidebar.collapsed ~ .app-wrapper {
  margin-left: var(--sidebar-collapsed);
}

/* Topbar */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}

/* Hamburger (mobile only) */
.topbar-hamburger {
  display: none;
  width: 36px; height: 36px;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-right: var(--space-2);
  transition: all var(--dur-fast);
}
.topbar-hamburger:hover { background: var(--bg-subtle); color: var(--text-primary); }

/* Breadcrumbs */
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0;
}
.topbar-breadcrumb a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color var(--dur-fast);
}
.topbar-breadcrumb a:hover { color: var(--accent); }
.topbar-breadcrumb .separator {
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.topbar-breadcrumb .current {
  color: var(--text-primary);
  font-weight: 600;
}

/* Topbar search */
.topbar-search {
  position: relative;
  flex: 0 1 320px;
  margin-left: auto;
}
.topbar-search input {
  width: 100%;
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-8);
  background: var(--bg-subtle);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--text-primary);
  transition: all var(--dur-fast);
}
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-search input:focus {
  background: var(--bg-card);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-light);
  outline: none;
}
.topbar-search .material-icons {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.15rem;
  color: var(--text-muted);
  pointer-events: none;
}

/* Topbar right section */
.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: var(--space-4);
}

/* Notification bell */
.topbar-notifications {
  position: relative;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  transition: all var(--dur-fast);
  cursor: pointer;
  background: transparent;
  border: none;
}
.topbar-notifications:hover { background: var(--bg-subtle); color: var(--text-primary); }
.topbar-badge-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--red-500);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-card);
}

/* User dropdown */
.topbar-user {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--dur-fast);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
}
.topbar-user:hover { background: var(--bg-subtle); color: var(--text-primary); }
.topbar-user .material-icons { font-size: 1.25rem; }
.topbar-user-name { display: inline; }

/* User dropdown menu */
.topbar-dropdown {
  position: absolute;
  top: calc(100% + var(--space-1));
  right: 0;
  min-width: 200px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2) 0;
  z-index: 1060;
  display: none;
}
.topbar-dropdown.show { display: block; }
.topbar-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--dur-fast);
}
.topbar-dropdown-item:hover { background: var(--bg-subtle); color: var(--text-primary); }
.topbar-dropdown-item .material-icons { font-size: 1.1rem; }
.topbar-dropdown-item--muted { color: var(--text-muted); font-size: var(--text-xs); }
.topbar-dropdown-divider { height: 1px; background: var(--border-subtle); margin: var(--space-1) 0; }
.topbar-dropdown-item--danger:hover { background: var(--red-100); color: var(--red-500); }

/* ═══════════════════════════════════════════
   CONTENT AREA
   ═══════════════════════════════════════════ */
.app-content {
  flex: 1;
  padding: var(--space-6);
  max-width: 1440px;
  width: 100%;
}

/* ═══════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--dur-normal) var(--ease-default),
              border-color var(--dur-normal) var(--ease-default);
}
.card--interactive:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}
.card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.card-body { padding: var(--space-5); }

/* ═══════════════════════════════════════════
   STAT CARDS
   ═══════════════════════════════════════════ */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--dur-normal), border-color var(--dur-normal);
  text-decoration: none;
  display: block;
  color: inherit;
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: inherit;
}
.stat-card__value {
  font-size: var(--text-4xl);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.stat-card__label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}
.stat-card__icon {
  position: absolute;
  right: var(--space-4);
  bottom: var(--space-4);
  font-size: 2.5rem;
  color: var(--border-subtle);
}
.stat-card--gold   { border-left-color: var(--gold-500); }
.stat-card--blue   { border-left-color: var(--blue-500); }
.stat-card--green  { border-left-color: var(--green-500); }
.stat-card--red    { border-left-color: var(--red-500); }
.stat-card--teal   { border-left-color: var(--teal-500); }
.stat-card--waiting { border-left-color: var(--gold-500); }
.stat-card--in-service { border-left-color: var(--blue-500); }
.stat-card--ready { border-left-color: var(--green-500); }
.stat-card--checked-out { border-left-color: var(--gray-500); }

.stat-icon { font-size: 1.5rem; margin-bottom: var(--space-2); }
.stat-icon--waiting { color: var(--gold-500); }
.stat-icon--in-service { color: var(--blue-500); }
.stat-icon--ready { color: var(--green-500); }
.stat-icon--checked-out { color: var(--gray-500); }

.stat-label { font-size: var(--text-sm); font-weight: 500; color: var(--text-tertiary); margin-top: var(--space-1); }
.stat-value { font-size: var(--text-4xl); font-weight: 800; color: var(--text-primary); letter-spacing: -0.03em; line-height: 1; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Card header icon helper */
.card-header-icon { font-size: 1rem; vertical-align: -2px; color: var(--accent); margin-right: var(--space-1); }

/* ═══════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════ */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.data-table thead th {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-tertiary);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}
.data-table tbody td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.data-table tbody tr {
  transition: background var(--dur-fast);
}
.data-table tbody tr:hover {
  background: var(--accent-light);
}
.data-table .row-link {
  color: var(--text-primary);
  font-weight: 600;
  text-decoration: none;
  transition: color var(--dur-fast);
}
.data-table .row-link:hover {
  color: var(--accent);
}

/* Row action icon buttons */
.row-actions { display: flex; gap: var(--space-1); }
.row-action-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  background: transparent; color: var(--text-muted);
  transition: all var(--dur-fast); cursor: pointer;
  padding: 0;
}
.row-action-btn:hover {
  background: var(--bg-subtle); color: var(--text-primary);
  border-color: var(--border-subtle);
}
.row-action-btn--danger:hover {
  background: var(--red-100); color: var(--red-500);
  border-color: rgba(176,84,79,.25);
}
.row-action-btn .material-icons { font-size: 1.1rem; }

/* Overdue rows */
.row-overdue {
  background: rgba(176,84,79,.04) !important;
  border-left: 3px solid var(--red-500);
}

/* Legacy Bootstrap table support (transition) */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table thead th {
  background: var(--bg-subtle); color: var(--text-tertiary);
  font-weight: 600; font-size: var(--text-xs);
  text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border-default);
  padding: var(--space-3) var(--space-4);
  white-space: nowrap;
}
.table tbody tr { transition: background var(--dur-fast); }
.table tbody tr:hover { background: var(--accent-light); }
.table tbody td {
  padding: var(--space-3) var(--space-4);
  vertical-align: middle;
  border-color: var(--border-subtle);
  font-size: var(--text-base);
}
.table-danger {
  background: rgba(176,84,79,.04) !important;
  border-left: 3px solid var(--red-500);
}

/* ═══════════════════════════════════════════
   BADGES — Pill style
   ═══════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  letter-spacing: .02em;
  line-height: 1.4;
}

/* New semantic lane badges */
.badge--success  { color: var(--green-500);  background: var(--green-100); }
.badge--warning  { color: var(--gold-500);   background: var(--gold-100); }
.badge--info     { color: var(--blue-500);   background: var(--blue-100); }
.badge--danger   { color: var(--red-500);    background: var(--red-100); }
.badge--neutral  { color: var(--gray-600);   background: var(--gray-100); }

/* Legacy status badge mapping (backward compatible) */
.badge-status-new                { color: var(--teal-500);  background: var(--teal-100); }
.badge-status-follow-up          { color: var(--gold-500);  background: var(--gold-100); }
.badge-status-qualified          { color: var(--blue-500);  background: var(--blue-100); }
.badge-status-converted          { color: var(--green-500); background: var(--green-100); }
.badge-status-lost               { color: var(--red-500);   background: var(--red-100); }
.badge-status-pending            { color: var(--gold-500);  background: var(--gold-100); }
.badge-status-progress           { color: var(--blue-500);  background: var(--blue-100); }
.badge-status-completed          { color: var(--green-500); background: var(--green-100); }
.badge-status-cancelled          { color: var(--red-500);   background: var(--red-100); }
.badge-status-scheduled          { color: var(--blue-500);  background: var(--blue-100); }
.badge-status-upcoming           { color: var(--gold-500);  background: var(--gold-100); }
.badge-status-overdue            { color: var(--red-500);   background: var(--red-100); }
.badge-status-pending-confirmation { color: var(--gold-500); background: var(--gold-100); }
.badge-status-checked-in         { color: var(--blue-500);  background: var(--blue-100); }
.badge-status-in-progress        { color: var(--blue-500);  background: var(--blue-100); }
.badge-status-ready              { color: var(--green-500); background: var(--green-100); }
.badge-status-checked-out        { color: var(--gray-600);  background: var(--gray-100); }
.badge-status-delayed            { color: var(--red-500);   background: var(--red-100); }
.badge-status-in-service         { color: var(--blue-500);  background: var(--blue-100); }
.badge-status-waiting            { color: var(--gold-500);  background: var(--gold-100); }

/* Priority badges */
.badge-priority-high   { color: var(--red-500);   background: var(--red-100); }
.badge-priority-medium { color: var(--gold-500);  background: var(--gold-100); }
.badge-priority-low    { color: var(--gray-600);  background: var(--gray-100); }

/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-weight: 600;
  font-size: var(--text-sm);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-4);
  transition: all var(--dur-fast) var(--ease-default);
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.5;
  font-family: var(--font-sans);
}

/* Primary (gold accent) */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
  box-shadow: 0 2px 8px rgba(200,150,62,.3);
}

/* Ghost (replaces outline-dark) */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}
.btn-ghost:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* Outline accent */
.btn-outline-accent {
  color: var(--accent);
  border-color: var(--accent);
  background: transparent;
}
.btn-outline-accent:hover {
  background: var(--accent);
  color: #fff;
}

/* Danger */
.btn-danger {
  background: var(--red-500);
  color: #fff;
  border: 1px solid var(--red-500);
}
.btn-danger:hover {
  background: var(--red-600);
  border-color: var(--red-600);
  box-shadow: 0 2px 8px rgba(176,84,79,.3);
  color: #fff;
}

/* Success */
.btn-success {
  background: var(--green-500);
  color: #fff;
  border: 1px solid var(--green-500);
}
.btn-success:hover {
  background: var(--green-600);
  border-color: var(--green-600);
  box-shadow: 0 2px 8px rgba(78,139,110,.3);
  color: #fff;
}

/* Icon button (square, icon only) */
.btn-icon {
  width: 36px; height: 36px;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
}

/* Small variant */
.btn-sm {
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
}

/* ═══════════════════════════════════════════
   FORMS — Floating Labels
   ═══════════════════════════════════════════ */
.form-group {
  position: relative;
  margin-bottom: var(--space-5);
}
.form-group .form-control,
.form-group .form-select {
  padding: 1.1rem var(--space-3) .45rem;
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  font-family: var(--font-sans);
}
.form-group .form-control:focus,
.form-group .form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-light);
  outline: none;
  color: var(--text-primary);
}
.form-group .form-label {
  position: absolute;
  top: 50%;
  left: var(--space-3);
  transform: translateY(-50%);
  font-size: var(--text-base);
  color: var(--text-muted);
  pointer-events: none;
  transition: all var(--dur-fast) var(--ease-default);
  background: var(--bg-card);
  padding: 0 var(--space-1);
  transform-origin: left center;
}
/* Float up when focused or has value */
.form-group .form-control:focus + .form-label,
.form-group .form-control:not(:placeholder-shown) + .form-label,
.form-group .form-select:focus + .form-label,
.form-group .form-select:has(option:selected:not(:disabled)) + .form-label {
  top: 0;
  transform: translateY(-50%);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent);
  letter-spacing: .02em;
}
/* Validation */
.form-group .form-control.is-invalid {
  border-color: var(--red-500);
  box-shadow: 0 0 0 3px rgba(176,84,79,.1);
}
.form-group .form-control.is-invalid + .form-label { color: var(--red-500); }
.invalid-feedback {
  font-size: var(--text-xs);
  color: var(--red-500);
  margin-top: var(--space-1);
}

/* Standard (non-floating) form controls — keep Bootstrap compatibility */
.form-control, .form-select {
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  font-family: var(--font-sans);
}
.form-control:focus, .form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-light);
  outline: none;
  color: var(--text-primary);
}
.form-label {
  font-weight: 600;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: var(--space-1);
}
.form-control.is-invalid {
  border-color: var(--red-500);
  box-shadow: 0 0 0 3px rgba(176,84,79,.1);
}

/* Form sections */
.form-section {
  padding: var(--space-5) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.form-section:last-child { border-bottom: none; }
.form-section-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: var(--space-4);
}

/* Select chevron */
.form-select {
  appearance: none;
  color: var(--text-primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23495057' d='M6 8.825L1.175 4 2.238 2.938 6 6.7 9.763 2.937 10.825 4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-8);
}

/* Small form controls */
.form-control-sm, .form-select-sm {
  border-radius: var(--radius-sm);
  border-color: var(--border-default);
  font-size: var(--text-sm);
  color: var(--text-primary);
}
.form-control-sm:focus, .form-select-sm:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--accent-light);
}

/* Textarea + placeholder + select option overrides */
textarea.form-control {
  color: var(--text-primary);
  min-height: unset;
}
.form-control::placeholder {
  color: var(--text-muted);
  opacity: 1;
}
.form-control::-ms-input-placeholder {
  color: var(--text-muted);
}
select option {
  color: var(--text-primary);
  background: var(--bg-card);
}

/* ═══════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════ */
.alert {
  border-radius: var(--radius-md);
  border: none;
  font-weight: 500;
  font-size: var(--text-sm);
  box-shadow: var(--shadow-sm);
}
.alert-success { background: var(--green-100); color: var(--green-600); border-left: 4px solid var(--green-500); }
.alert-danger  { background: var(--red-100);   color: var(--red-600);   border-left: 4px solid var(--red-500); }
.alert-info    { background: var(--blue-100);  color: var(--blue-600);  border-left: 4px solid var(--blue-500); }
.alert-warning { background: var(--gold-100);  color: var(--gold-700);  border-left: 4px solid var(--gold-500); }

/* ═══════════════════════════════════════════
   PAGE HEADER
   ═══════════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  gap: var(--space-4);
}
.page-header h1 {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.page-header-actions {
  display: flex;
  gap: var(--space-2);
}

/* Section headings */
.section-heading {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.section-heading .material-icons {
  color: var(--accent);
  font-size: 1.15rem;
}

/* ═══════════════════════════════════════════
   FILTER BAR
   ═══════════════════════════════════════════ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
}

/* ═══════════════════════════════════════════
   QUICK ACTIONS
   ═══════════════════════════════════════════ */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-3);
}
.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: all var(--dur-fast) var(--ease-default);
}
.quick-action:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.quick-action .material-icons {
  font-size: 1.75rem;
  color: var(--accent);
}

/* Legacy quick action button support */
.quick-action-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--text-sm);
  text-align: left;
  transition: all var(--dur-fast) var(--ease-default);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  width: 100%;
  text-decoration: none;
}
.quick-action-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent-hover);
  text-decoration: none;
}
.quick-action-btn .material-icons { font-size: 1.25rem; }

/* ═══════════════════════════════════════════
   TOAST — Bottom-right with progress bar
   ═══════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-2);
}
.mogg-toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 300px;
  max-width: 420px;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  animation: toastSlideIn var(--dur-normal) var(--ease-spring);
  position: relative;
  overflow: hidden;
}
.mogg-toast .material-icons { font-size: 1.15rem; flex-shrink: 0; }
.mogg-toast.toast-success .material-icons { color: var(--green-500); }
.mogg-toast.toast-danger  .material-icons { color: var(--red-500); }
.mogg-toast.toast-info    .material-icons { color: var(--blue-500); }
.mogg-toast.toast-warning .material-icons { color: var(--gold-500); }

/* Progress bar */
.mogg-toast::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  height: 3px;
  background: var(--accent);
  animation: toastProgress 3s linear forwards;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}
.mogg-toast.toast-success::after { background: var(--green-500); }
.mogg-toast.toast-danger::after  { background: var(--red-500); }

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(20px) scale(.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastSlideOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(20px) scale(.95); }
}
@keyframes toastProgress {
  from { width: 100%; }
  to   { width: 0%; }
}

/* ═══════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════ */
.modal-mogg .modal-content {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
}
.modal-mogg .modal-header {
  background: transparent;
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-mogg .modal-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}
.modal-mogg .modal-title .material-icons {
  color: var(--red-500);
  font-size: 1.3rem;
}
.modal-mogg .modal-body {
  padding: var(--space-5) var(--space-6);
  font-size: var(--text-base);
  color: var(--text-secondary);
}
.modal-mogg .modal-footer {
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-4) var(--space-6);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ═══════════════════════════════════════════
   DETAIL VIEWS — Info Grid
   ═══════════════════════════════════════════ */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-5);
}
.detail-field { display: flex; flex-direction: column; }
.detail-field__label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: var(--space-1);
}
.detail-field__value {
  font-size: var(--text-base);
  color: var(--text-primary);
  font-weight: 500;
}

/* Legacy detail-info (backward compatible) */
.detail-info p { margin-bottom: var(--space-2); font-size: var(--text-base); }
.detail-info strong {
  color: var(--text-tertiary);
  font-weight: 600;
  display: inline-block;
  min-width: 110px;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .03em;
}

/* ═══════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--text-muted);
}
.empty-state .material-icons {
  font-size: 4rem;
  color: var(--border-default);
  margin-bottom: var(--space-4);
}
.empty-state p {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
}
.empty-state__title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}
.empty-state__description {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-5);
}

/* ═══════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--slate-900) 0%, var(--slate-800) 100%);
  background-image:
    linear-gradient(135deg, var(--slate-900) 0%, var(--slate-800) 100%),
    repeating-linear-gradient(0deg, transparent, transparent 40px, rgba(255,255,255,.015) 40px, rgba(255,255,255,.015) 41px),
    repeating-linear-gradient(90deg, transparent, transparent 40px, rgba(255,255,255,.015) 40px, rgba(255,255,255,.015) 41px);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl) !important;
  box-shadow: var(--shadow-xl) !important;
  padding: var(--space-8);
  overflow: hidden;
}
.login-card .brand-icon {
  display: block;
  text-align: center;
  font-size: 2.5rem;
  color: var(--accent);
  margin-bottom: var(--space-2);
}
.login-card h3, .login-card h1 {
  text-align: center;
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: var(--space-6);
  letter-spacing: -0.02em;
}
.login-card .form-group { margin-bottom: var(--space-4); }
.login-card .form-control {
  color: var(--text-primary);
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
}
.login-card .form-control:focus {
  background: var(--bg-card);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.login-card .btn-primary {
  width: 100%;
  justify-content: center;
  padding: var(--space-3);
  font-size: var(--text-base);
}
.login-card .login-lang {
  color: var(--text-muted);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: color var(--dur-fast);
}
.login-card .login-lang:hover { color: var(--accent); }

/* ═══════════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-400); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-500); }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); }
.app-sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.25); }

/* ═══════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════ */
.app-footer {
  margin-top: var(--space-8);
  padding: var(--space-4) var(--space-6);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-xs);
  border-top: 1px solid var(--border-subtle);
}

/* ═══════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════ */
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(200,150,62,.4); }
  70%  { box-shadow: 0 0 0 10px rgba(200,150,62,0); }
  100% { box-shadow: 0 0 0 0 rgba(200,150,62,0); }
}
.pulse-new { animation: pulse .6s var(--ease-default); }

@keyframes rowFade {
  to { opacity: 0; transform: translateX(-20px); height: 0; padding: 0; overflow: hidden; }
}
.row-fading { animation: rowFade var(--dur-normal) var(--ease-default) forwards; }

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

/* ═══════════════════════════════════════════
   MOBILE OVERLAY
   ═══════════════════════════════════════════ */
.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1035;
  display: none;
}
.mobile-overlay.show { display: block; }

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */

/* Mobile */
@media (max-width: 767px) {
  .app-sidebar {
    transform: translateX(-100%);
    transition: transform var(--dur-slow) var(--ease-default);
    width: var(--sidebar-width) !important;
  }
  .app-sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: var(--shadow-sidebar);
  }
  .app-sidebar.mobile-open ~ .mobile-overlay { display: block; }
  .app-wrapper { margin-left: 0 !important; }
  .topbar-hamburger { display: flex; }
  .app-content { padding: var(--space-4); }
  .page-header { flex-direction: column; align-items: flex-start; gap: var(--space-3); }
  .page-header h1 { font-size: var(--text-xl); }
  .stat-card__value { font-size: var(--text-3xl); }
  .detail-grid { grid-template-columns: 1fr; }
  .filter-bar { flex-wrap: wrap; }
  .topbar-search { display: none; }
  .topbar-user-name { display: none; }
  .quick-actions-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .toast-container { bottom: var(--space-4); right: var(--space-4); left: var(--space-4); }
  .mogg-toast { min-width: unset; width: 100%; }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 1023px) {
  .app-sidebar { width: var(--sidebar-collapsed); }
  .app-sidebar .sidebar-brand-text,
  .app-sidebar .sidebar-nav-label,
  .app-sidebar .sidebar-brand-sub { display: none; }
  .app-sidebar .sidebar-brand { justify-content: center; padding: var(--space-4) 0; }
  .app-sidebar .sidebar-nav-link { justify-content: center; padding: var(--space-3) 0; }
  .app-sidebar .sidebar-toggle { display: none; }
  .app-sidebar .sidebar-lang-text { display: none; }
  .app-wrapper { margin-left: var(--sidebar-collapsed) !important; }
  .stat-card__value { font-size: var(--text-3xl); }
}

/* Desktop */
@media (min-width: 1024px) {
  .topbar-hamburger { display: none; }
}

/* ═══════════════════════════════════════════
   FOCUS VISIBLE (Accessibility)
   ═══════════════════════════════════════════ */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════
   LINKS
   ═══════════════════════════════════════════ */
a { transition: color var(--dur-fast); }

/* ═══════════════════════════════════════════
   UTILITY OVERRIDES
   ═══════════════════════════════════════════ */
.text-accent { color: var(--accent) !important; }
.text-muted-custom { color: var(--text-muted) !important; }
.border-accent { border-color: var(--accent) !important; }
.bg-subtle { background: var(--bg-subtle) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-nowrap { white-space: nowrap !important; }
.col-narrow { width: 50px; }
.row-link { color: var(--text-primary); font-weight: 600; text-decoration: none; transition: color var(--dur-fast); }
.row-link:hover { color: var(--accent); }

/* ── Pagination ── */
.pagination {
  --pg-bg: var(--bg-subtle);
  --pg-border: var(--border-subtle);
  --pg-text: var(--text-secondary);
  --pg-active-bg: var(--accent);
  --pg-active-border: var(--accent);
  --pg-active-text: var(--bg-primary);
  --pg-hover-bg: var(--bg-elevated);
  --pg-hover-border: var(--border-default);
  --pg-hover-text: var(--text-primary);
  --pg-disabled-text: var(--text-muted);
}
.pagination .page-item .page-link {
  background: var(--pg-bg);
  border-color: var(--pg-border);
  color: var(--pg-text);
  font-size: var(--text-sm);
  min-width: 2rem;
  padding: 0.25rem 0.5rem;
}
.pagination .page-item .page-link:hover {
  background: var(--pg-hover-bg);
  border-color: var(--pg-hover-border);
  color: var(--pg-hover-text);
}
.pagination .page-item.active .page-link,
.pagination .page-item.active .page-link:hover {
  background: var(--pg-active-bg);
  border-color: var(--pg-active-border);
  color: var(--pg-active-text);
  font-weight: 600;
}
.pagination .page-item.disabled .page-link {
  background: var(--pg-bg);
  border-color: var(--pg-border);
  color: var(--pg-disabled-text);
  opacity: 0.5;
}
.pagination .page-item .page-link .material-icons {
  font-size: 1rem;
  vertical-align: -2px;
}

/* ============================================================
   CHATBOT WIDGET
   ============================================================ */

.chatbot {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1050;
  font-family: var(--font-sans);
}

/* ─── Toggle Button ─────────────────────────────────────── */

.chatbot-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  transition: transform 0.2s var(--ease-default), box-shadow 0.2s var(--ease-default);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(0,0,0,0.4);
}

.chatbot-toggle.active {
  transform: scale(0.95);
}

.chatbot-toggle-icon {
  font-size: 28px;
}

.chatbot-toggle-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--red-500);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: chatbotBadgePulse 2s infinite;
}

@keyframes chatbotBadgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ─── Panel ─────────────────────────────────────────────── */

.chatbot-panel {
  position: absolute;
  bottom: 68px;
  right: 0;
  width: 380px;
  max-height: 520px;
  border-radius: 16px;
  background: var(--slate-800);
  border: 1px solid var(--gray-700);
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(12px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s var(--ease-default), opacity 0.2s var(--ease-default);
}

.chatbot-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* ─── Header ────────────────────────────────────────────── */

.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--slate-850);
  border-bottom: 1px solid var(--gray-700);
}

.chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--gold-400);
}

.chatbot-header-info .material-icons {
  font-size: 24px;
}

.chatbot-header-title {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--gray-100);
}

.chatbot-header-sub {
  font-size: var(--text-xs);
  color: var(--green-500);
}

.chatbot-header-actions {
  display: flex;
  gap: 0.25rem;
}

.chatbot-header-btn {
  background: none;
  border: none;
  color: var(--gray-500);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
}

.chatbot-header-btn:hover {
  color: var(--gray-200);
  background: rgba(255,255,255,0.05);
}

.chatbot-header-btn .material-icons {
  font-size: 18px;
}

/* ─── Messages ──────────────────────────────────────────── */

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 280px;
  max-height: 360px;
  scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
  width: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: var(--gray-700);
  border-radius: 2px;
}

/* ─── Message Bubbles ───────────────────────────────────── */

.chatbot-msg {
  display: flex;
  gap: 0.5rem;
  max-width: 90%;
  animation: chatbotMsgIn 0.25s var(--ease-default);
}

@keyframes chatbotMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chatbot-msg--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chatbot-msg--bot {
  align-self: flex-start;
}

.chatbot-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chatbot-msg--bot .chatbot-msg-avatar {
  background: var(--slate-700);
  color: var(--gold-400);
}

.chatbot-msg--user .chatbot-msg-avatar {
  background: var(--blue-600);
  color: #fff;
}

.chatbot-msg-avatar .material-icons {
  font-size: 16px;
}

.chatbot-msg-content {
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  font-size: var(--text-sm);
  line-height: 1.5;
}

.chatbot-msg--bot .chatbot-msg-content {
  background: var(--slate-700);
  color: var(--gray-100);
  border-bottom-left-radius: 4px;
}

.chatbot-msg--user .chatbot-msg-content {
  background: var(--blue-600);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chatbot-msg-text ul {
  margin: 0.25rem 0;
  padding-left: 1.25rem;
}

.chatbot-msg-text li {
  margin-bottom: 0.15rem;
}

.chatbot-msg-text code {
  background: rgba(255,255,255,0.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.8em;
}

.chatbot-msg-text--success {
  color: var(--green-500);
}

.chatbot-msg-text--error {
  color: var(--red-500);
}

.chatbot-error {
  color: var(--red-500);
  font-size: var(--text-xs);
  margin-top: 0.25rem;
  padding: 0.35rem 0.5rem;
  background: var(--red-100);
  border-radius: 6px;
}

/* Typing indicator */
.chatbot-typing {
  display: flex;
  gap: 4px;
  padding: 0.5rem 0;
}

.chatbot-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gray-500);
  animation: chatbotTypingBounce 1.4s infinite;
}

.chatbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatbotTypingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ─── Action Confirmation ───────────────────────────────── */

.chatbot-confirm {
  padding: 0.5rem 0.75rem;
  background: rgba(212,168,85,0.1);
  border-top: 1px solid var(--gold-700);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.chatbot-confirm-text {
  flex: 1;
  font-size: var(--text-xs);
  color: var(--gold-300);
  min-width: 0;
}

.chatbot-confirm-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

/* ─── Input Area ────────────────────────────────────────── */

.chatbot-input-wrap {
  padding: 0.5rem 0.75rem 0.75rem;
  background: var(--slate-850);
  border-top: 1px solid var(--gray-700);
}

.chatbot-input-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.chatbot-input {
  flex: 1;
  background: var(--slate-900);
  border: 1px solid var(--gray-700);
  border-radius: 24px;
  padding: 0.5rem 1rem;
  color: var(--gray-100);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.15s;
}

.chatbot-input:focus {
  border-color: var(--gold-500);
}

.chatbot-input::placeholder {
  color: var(--gray-600);
}

.chatbot-input:disabled {
  opacity: 0.5;
}

.chatbot-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--gold-500);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}

.chatbot-send:hover:not(:disabled) {
  background: var(--gold-600);
}

.chatbot-send:active:not(:disabled) {
  transform: scale(0.92);
}

.chatbot-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.chatbot-send .material-icons {
  font-size: 18px;
}

.chatbot-rate-notice {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--gray-600);
  margin-top: 4px;
  padding-left: 4px;
}

/* ─── Responsive ────────────────────────────────────────── */

@media (max-width: 480px) {
  .chatbot-panel {
    width: calc(100vw - 2rem);
    right: -0.5rem;
    max-height: 70vh;
  }
}

@media (max-width: 768px) {
  .chatbot {
    bottom: 1rem;
    right: 1rem;
  }
}