/* ============================================================
   TRUCKER SAAS - FUTURISTIC FLEET MANAGEMENT UI
   style.css — Complete Design System
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* ============================================================
   1. CSS VARIABLES
   ============================================================ */
:root {
  /* Colors */
  --bg:           #050a14;
  --surface:      #0d1829;
  --surface-2:    #111e35;
  --card:         rgba(13, 24, 41, 0.80);
  --card-hover:   rgba(13, 24, 41, 0.95);
  --border:       rgba(0, 212, 255, 0.15);
  --border-strong:rgba(0, 212, 255, 0.35);

  /* Accent palette */
  --cyan:         #00d4ff;
  --cyan-dim:     rgba(0, 212, 255, 0.15);
  --cyan-glow:    rgba(0, 212, 255, 0.4);
  --purple:       #7c3aed;
  --purple-dim:   rgba(124, 58, 237, 0.15);
  --purple-glow:  rgba(124, 58, 237, 0.4);
  --green:        #00ff88;
  --green-dim:    rgba(0, 255, 136, 0.15);
  --green-glow:   rgba(0, 255, 136, 0.4);
  --orange:       #ff8c00;
  --orange-dim:   rgba(255, 140, 0, 0.15);
  --orange-glow:  rgba(255, 140, 0, 0.4);
  --red:          #ff4466;
  --red-dim:      rgba(255, 68, 102, 0.15);
  --red-glow:     rgba(255, 68, 102, 0.4);

  /* Typography */
  --text:         #e2e8f0;
  --text-muted:   #64748b;
  --text-faint:   #334155;
  --font:         'Space Grotesk', sans-serif;
  --mono:         'JetBrains Mono', monospace;

  /* Sizing */
  --sidebar-w:    260px;
  --topbar-h:     64px;
  --radius:       12px;
  --radius-sm:    8px;
  --radius-lg:    16px;
  --radius-xl:    24px;

  /* Shadows */
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:    0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg:    0 8px 40px rgba(0,0,0,0.7);
  --shadow-cyan:  0 0 20px var(--cyan-glow), 0 0 60px rgba(0,212,255,0.1);
  --shadow-purple:0 0 20px var(--purple-glow);
  --shadow-green: 0 0 20px var(--green-glow);
  --shadow-red:   0 0 20px var(--red-glow);
  --shadow-orange:0 0 20px var(--orange-glow);

  /* Transitions */
  --tr:           all 0.3s ease;
  --tr-fast:      all 0.15s ease;
  --tr-slow:      all 0.5s ease;
}

/* ============================================================
   2. RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--surface);
}
::-webkit-scrollbar-thumb {
  background: rgba(0,212,255,0.25);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0,212,255,0.5);
}

a {
  color: var(--cyan);
  text-decoration: none;
  transition: var(--tr);
}
a:hover {
  color: #fff;
}

ul, ol { list-style: none; }

img { display: block; max-width: 100%; }

input, button, select, textarea {
  font-family: var(--font);
  font-size: 0.9rem;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

/* ============================================================
   3. ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px var(--cyan); }
  50%       { box-shadow: 0 0 20px var(--cyan), 0 0 40px rgba(0,212,255,0.3); }
}

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

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}

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

@keyframes slideInRight {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes slideOutRight {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(110%); opacity: 0; }
}

@keyframes slideInTop {
  from { transform: translateY(-30px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
  20%, 40%, 60%, 80%      { transform: translateX(8px); }
}

@keyframes orbFloat {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(60px, -80px) scale(1.1); }
  66%  { transform: translate(-40px, 40px) scale(0.95); }
  100% { transform: translate(0, 0) scale(1); }
}

@keyframes orbFloat2 {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(-80px, 60px) scale(1.05); }
  66%  { transform: translate(50px, -30px) scale(0.9); }
  100% { transform: translate(0, 0) scale(1); }
}

@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}

@keyframes borderGlow {
  0%, 100% { border-color: rgba(0,212,255,0.15); }
  50%       { border-color: rgba(0,212,255,0.5); }
}

@keyframes dashboardCardIn {
  from { opacity: 0; transform: translateY(30px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes particleDrift {
  0%   { transform: translateY(0) translateX(0); opacity: 0.6; }
  50%  { opacity: 1; }
  100% { transform: translateY(-100vh) translateX(20px); opacity: 0; }
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.fade-in {
  animation: fadeIn 0.5s ease both;
}

.fade-in-scale {
  animation: fadeInScale 0.4s ease both;
}

/* Stagger children */
.stagger-children > * {
  animation: fadeIn 0.4s ease both;
}
.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.10s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.20s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.30s; }

/* ============================================================
   4. LOGIN PAGE
   ============================================================ */
#login-page {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 9999;
  overflow: hidden;
}

/* Animated background */
.login-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Gradient orbs */
.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
}
.login-orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, var(--cyan) 0%, transparent 70%);
  top: -100px; left: -100px;
  animation: orbFloat 15s ease-in-out infinite;
}
.login-orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, var(--purple) 0%, transparent 70%);
  bottom: -80px; right: -80px;
  animation: orbFloat2 18s ease-in-out infinite;
}
.login-orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, var(--green) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: orbFloat 22s ease-in-out infinite reverse;
  opacity: 0.15;
}

/* Particle dots */
.login-particles {
  position: absolute;
  inset: 0;
}
.login-particles::before,
.login-particles::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 10% 20%, rgba(0,212,255,0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 30% 60%, rgba(0,212,255,0.4) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 55% 15%, rgba(124,58,237,0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 70% 45%, rgba(0,255,136,0.5) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 85% 70%, rgba(0,212,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 20% 80%, rgba(124,58,237,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 45% 35%, rgba(0,255,136,0.3) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 90% 10%, rgba(0,212,255,0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 60% 85%, rgba(255,140,0,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 15% 50%, rgba(0,212,255,0.3) 0%, transparent 100%);
  animation: glowPulse 4s ease-in-out infinite;
}
.login-particles::after {
  background-image:
    radial-gradient(1px 1px at 25% 10%, rgba(0,212,255,0.5) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 40% 75%, rgba(124,58,237,0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 65% 30%, rgba(0,255,136,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 80% 55%, rgba(0,212,255,0.5) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 5% 90%, rgba(255,68,102,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 50% 50%, rgba(0,212,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 92% 35%, rgba(124,58,237,0.5) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 35% 90%, rgba(0,212,255,0.4) 0%, transparent 100%);
  animation: glowPulse 6s ease-in-out infinite reverse;
}

/* Grid overlay */
.login-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,212,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* Login card */
.login-card {
  position: relative;
  z-index: 10;
  width: 420px;
  background: rgba(13, 24, 41, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.05);
  animation: fadeInScale 0.6s ease both;
}

/* Shimmer top border */
.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--purple), var(--cyan), transparent);
  background-size: 200% auto;
  animation: shimmer 3s linear infinite;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px; height: 72px;
  background: linear-gradient(135deg, var(--cyan-dim), var(--purple-dim));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  box-shadow: var(--shadow-cyan);
  animation: float 4s ease-in-out infinite;
}
.login-logo-icon svg {
  width: 36px; height: 36px;
  color: var(--cyan);
  filter: drop-shadow(0 0 8px var(--cyan));
}

.login-logo h1 {
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}
.login-logo p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4px;
  font-family: var(--mono);
}

.login-form { display: flex; flex-direction: column; gap: 20px; }

.form-group-login {
  position: relative;
}
.form-group-login label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.form-group-login .input-wrapper {
  position: relative;
}
.form-group-login .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  transition: var(--tr);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.form-group-login input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px 12px 44px;
  color: var(--text);
  outline: none;
  transition: var(--tr);
}
.form-group-login input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-dim), var(--shadow-cyan);
  background: rgba(0,212,255,0.04);
}
.form-group-login input:focus + .input-icon,
.form-group-login .input-wrapper:focus-within .input-icon {
  color: var(--cyan);
}
.form-group-login input::placeholder { color: var(--text-faint); }

.login-error {
  display: none;
  background: var(--red-dim);
  border: 1px solid rgba(255,68,102,0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 4px;
  font-size: 0.85rem;
  color: var(--red);
  text-align: center;
}
.login-error.visible { display: block; animation: shake 0.5s ease; }

.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--mono);
}

.btn-login {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  background-size: 200% 200%;
  animation: gradientShift 4s ease infinite;
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: var(--tr);
  letter-spacing: 0.5px;
}
.btn-login::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: var(--tr);
}
.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,212,255,0.4), 0 4px 15px rgba(124,58,237,0.3);
}
.btn-login:hover::before { opacity: 1; }
.btn-login:active { transform: translateY(0); }
.btn-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ============================================================
   5. APP SHELL
   ============================================================ */
#app-shell {
  display: none;
  min-height: 100vh;
}
#app-shell.visible { display: flex; }

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.35s cubic-bezier(.4,0,.2,1);
}

/* Sidebar shimmer */
.sidebar::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 1px; height: 100%;
  background: linear-gradient(180deg, transparent, var(--cyan), var(--purple), transparent);
  opacity: 0.4;
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--cyan-dim), var(--purple-dim));
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 12px var(--cyan-dim);
}
.sidebar-logo-icon svg {
  width: 22px; height: 22px;
  color: var(--cyan);
}
.sidebar-logo-text {
  display: flex; flex-direction: column;
}
.sidebar-logo-text span:first-child {
  font-size: 1.05rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sidebar-logo-text span:last-child {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--mono);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
}
.sidebar-nav::-webkit-scrollbar { width: 0; }

.nav-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-faint);
  padding: 8px 8px 4px;
  margin-top: 8px;
  font-family: var(--mono);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: var(--tr);
  margin-bottom: 2px;
  border: 1px solid transparent;
  text-decoration: none;
  user-select: none;
}
.nav-item::before {
  content: '';
  position: absolute;
  left: 0; top: 25%; bottom: 25%;
  width: 3px;
  background: var(--cyan);
  border-radius: 0 3px 3px 0;
  opacity: 0;
  transition: var(--tr);
}
.nav-item:hover {
  color: var(--text);
  background: rgba(255,255,255,0.03);
  border-color: var(--border);
}
.nav-item.active {
  color: var(--cyan);
  background: var(--cyan-dim);
  border-color: var(--border-strong);
  box-shadow: inset 0 0 20px rgba(0,212,255,0.05);
  text-shadow: 0 0 10px rgba(0,212,255,0.5);
}
.nav-item.active::before { opacity: 1; }
.nav-item svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  transition: var(--tr);
}
.nav-item.active svg { filter: drop-shadow(0 0 5px var(--cyan)); }
.nav-item span.nav-label {
  font-size: 0.88rem;
  font-weight: 500;
}
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
  font-family: var(--mono);
  box-shadow: 0 0 8px var(--red-glow);
}

/* Sidebar user area */
.sidebar-user {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}
.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--tr);
}
.sidebar-user-card:hover {
  background: rgba(255,255,255,0.06);
  border-color: var(--border-strong);
}
.sidebar-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info .user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-info .user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--mono);
}
.sidebar-user-card svg {
  color: var(--text-muted);
  width: 16px; height: 16px;
  transition: var(--tr);
}
.sidebar-user-card:hover svg { color: var(--red); }

/* ── Main content ── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: rgba(5,10,20,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 50;
}

.topbar-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: var(--tr);
}
.topbar-hamburger:hover { color: var(--cyan); }
.topbar-hamburger svg { width: 22px; height: 22px; }

.topbar-title {
  flex: 1;
}
.topbar-title h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
}
.topbar-title p {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--mono);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-btn {
  width: 38px; height: 38px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--tr);
  position: relative;
}
.topbar-btn:hover {
  color: var(--cyan);
  border-color: var(--border-strong);
  background: var(--cyan-dim);
  box-shadow: 0 0 12px var(--cyan-dim);
}
.topbar-btn svg { width: 18px; height: 18px; }
.topbar-btn .notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--red);
  animation: glowPulse 2s ease-in-out infinite;
}

.topbar-time {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 6px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* Content area */
.content-area {
  flex: 1;
  padding: 28px;
  overflow-y: auto;
}

/* ============================================================
   6. KPI CARDS
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: var(--tr);
  cursor: default;
  animation: dashboardCardIn 0.5s ease both;
}
.kpi-card:nth-child(1) { animation-delay: 0.05s; }
.kpi-card:nth-child(2) { animation-delay: 0.10s; }
.kpi-card:nth-child(3) { animation-delay: 0.15s; }
.kpi-card:nth-child(4) { animation-delay: 0.20s; }

.kpi-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-from, rgba(0,212,255,0.05)), transparent 60%);
  pointer-events: none;
}
.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-color, var(--cyan)), transparent);
  opacity: 0.6;
}

.kpi-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md), 0 0 30px var(--accent-glow, var(--cyan-dim));
}

.kpi-card.cyan   { --accent-from: rgba(0,212,255,0.08); --accent-color: var(--cyan); --accent-glow: var(--cyan-dim); }
.kpi-card.green  { --accent-from: rgba(0,255,136,0.08); --accent-color: var(--green); --accent-glow: var(--green-dim); }
.kpi-card.orange { --accent-from: rgba(255,140,0,0.08); --accent-color: var(--orange); --accent-glow: var(--orange-dim); }
.kpi-card.purple { --accent-from: rgba(124,58,237,0.08); --accent-color: var(--purple); --accent-glow: var(--purple-dim); }

.kpi-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}
.kpi-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  position: relative;
}
.kpi-icon svg { width: 24px; height: 24px; }
.kpi-icon.cyan   { background: var(--cyan-dim);   color: var(--cyan);   box-shadow: 0 0 16px var(--cyan-dim); }
.kpi-icon.green  { background: var(--green-dim);  color: var(--green);  box-shadow: 0 0 16px var(--green-dim); }
.kpi-icon.orange { background: var(--orange-dim); color: var(--orange); box-shadow: 0 0 16px var(--orange-dim); }
.kpi-icon.purple { background: var(--purple-dim); color: var(--purple); box-shadow: 0 0 16px var(--purple-dim); }

.kpi-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-family: var(--mono);
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 99px;
}
.kpi-trend.up   { color: var(--green); background: var(--green-dim); }
.kpi-trend.down { color: var(--red);   background: var(--red-dim);   }
.kpi-trend.flat { color: var(--text-muted); background: rgba(255,255,255,0.05); }
.kpi-trend svg  { width: 12px; height: 12px; }

.kpi-value {
  font-size: 2.2rem;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--text);
  line-height: 1;
  margin-bottom: 6px;
}
.kpi-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ============================================================
   7. SECTION / PANEL CARDS
   ============================================================ */
.panel {
  background: var(--card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
  animation: fadeIn 0.4s ease both;
}

.panel-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-header h3 svg {
  width: 16px; height: 16px;
  color: var(--cyan);
}
.panel-body { padding: 24px; }
.panel-body.no-pad { padding: 0; }

/* ============================================================
   8. DATA TABLES
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead {
  position: sticky;
  top: 0;
  z-index: 5;
}
thead th {
  background: rgba(5,10,20,0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
thead th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }

tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.03);
  transition: var(--tr-fast);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.01);
}
tbody tr:hover {
  background: rgba(0,212,255,0.04);
  box-shadow: inset 3px 0 0 var(--cyan);
}

td {
  padding: 13px 16px;
  color: var(--text);
  vertical-align: middle;
}

td.mono { font-family: var(--mono); font-size: 0.82rem; }
td.muted { color: var(--text-muted); }

/* Table action buttons */
.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.action-btn {
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--tr);
  font-size: 0.8rem;
}
.action-btn svg { width: 14px; height: 14px; }
.action-btn.edit:hover {
  color: var(--cyan);
  border-color: var(--cyan);
  background: var(--cyan-dim);
  box-shadow: 0 0 10px var(--cyan-dim);
}
.action-btn.delete:hover {
  color: var(--red);
  border-color: var(--red);
  background: var(--red-dim);
  box-shadow: 0 0 10px var(--red-dim);
}
.action-btn.view:hover {
  color: var(--purple);
  border-color: var(--purple);
  background: var(--purple-dim);
  box-shadow: 0 0 10px var(--purple-dim);
}

/* ============================================================
   9. STATUS BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-success {
  color: var(--green);
  background: var(--green-dim);
  border: 1px solid rgba(0,255,136,0.2);
  box-shadow: 0 0 8px rgba(0,255,136,0.1);
}
.badge-danger {
  color: var(--red);
  background: var(--red-dim);
  border: 1px solid rgba(255,68,102,0.2);
  box-shadow: 0 0 8px rgba(255,68,102,0.1);
}
.badge-warning {
  color: var(--orange);
  background: var(--orange-dim);
  border: 1px solid rgba(255,140,0,0.2);
  box-shadow: 0 0 8px rgba(255,140,0,0.1);
}
.badge-info {
  color: var(--cyan);
  background: var(--cyan-dim);
  border: 1px solid rgba(0,212,255,0.2);
  box-shadow: 0 0 8px rgba(0,212,255,0.1);
}
.badge-secondary {
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}
.badge-purple {
  color: #a78bfa;
  background: var(--purple-dim);
  border: 1px solid rgba(124,58,237,0.2);
  box-shadow: 0 0 8px rgba(124,58,237,0.1);
}

/* ============================================================
   10. BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--tr);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.1);
  opacity: 0;
  transition: var(--tr);
}
.btn:hover::before { opacity: 1; }
.btn:active { transform: scale(0.97); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Primary */
.btn-primary {
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(0,212,255,0.2);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,212,255,0.4), 0 2px 10px rgba(124,58,237,0.3);
}

/* Secondary / outlined */
.btn-secondary {
  background: transparent;
  color: var(--cyan);
  border-color: var(--border-strong);
  box-shadow: inset 0 0 0 0 var(--cyan-dim);
}
.btn-secondary:hover {
  background: var(--cyan-dim);
  border-color: var(--cyan);
  box-shadow: 0 0 16px var(--cyan-dim);
}

/* Danger */
.btn-danger {
  background: linear-gradient(135deg, #ff4466, #cc0033);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(255,68,102,0.2);
}
.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(255,68,102,0.4);
}

/* Ghost */
.btn-ghost {
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border-color: rgba(255,255,255,0.15);
}

/* Small */
.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}
.btn-sm svg { width: 14px; height: 14px; }

/* ============================================================
   11. FORMS
   ============================================================ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-full { grid-column: 1 / -1; }

.form-group {
  position: relative;
}

/* Floating label */
.form-group.floating { position: relative; }
.form-group.floating label {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  font-size: 0.88rem;
  color: var(--text-muted);
  transition: var(--tr);
  pointer-events: none;
  background: var(--surface);
  padding: 0 4px;
}
.form-group.floating input:focus ~ label,
.form-group.floating input:not(:placeholder-shown) ~ label {
  top: 0;
  font-size: 0.72rem;
  color: var(--cyan);
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.form-control {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  outline: none;
  transition: var(--tr);
  appearance: none;
}
.form-control:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-dim);
  background: rgba(0,212,255,0.03);
}
.form-control::placeholder { color: var(--text-faint); }
.form-control:invalid:not(:placeholder-shown) {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-dim);
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}
select.form-control option {
  background: var(--surface);
  color: var(--text);
}

textarea.form-control {
  resize: vertical;
  min-height: 90px;
  line-height: 1.6;
}

.form-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 5px;
}
.form-error {
  font-size: 0.72rem;
  color: var(--red);
  margin-top: 5px;
  display: none;
}
.form-group.has-error .form-error { display: block; }
.form-group.has-error .form-control {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-dim);
}

/* ============================================================
   12. MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5,10,20,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.25s ease;
}
.modal-overlay.closing { animation: none; opacity: 0; transition: opacity 0.2s ease; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(0,212,255,0.08);
  animation: slideInTop 0.35s cubic-bezier(.34,1.56,.64,1) both;
  position: relative;
}
.modal-sm { max-width: 420px; }
.modal-lg { max-width: 780px; }

.modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--purple), transparent);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-header {
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky; top: 0;
  background: var(--surface);
  z-index: 5;
}
.modal-header h2 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-header h2 svg { color: var(--cyan); width: 18px; height: 18px; }

.modal-close {
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--tr);
  flex-shrink: 0;
}
.modal-close:hover {
  background: var(--red-dim);
  color: var(--red);
  border-color: rgba(255,68,102,0.3);
  box-shadow: 0 0 12px var(--red-dim);
}
.modal-close svg { width: 16px; height: 16px; }

.modal-body { padding: 26px; }

.modal-footer {
  padding: 18px 26px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: rgba(255,255,255,0.01);
}

/* Confirm modal */
.confirm-modal .modal-body {
  text-align: center;
  padding: 32px 26px;
}
.confirm-icon {
  width: 64px; height: 64px;
  margin: 0 auto 20px;
  background: var(--red-dim);
  border: 1px solid rgba(255,68,102,0.3);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 24px var(--red-dim);
  animation: float 3s ease-in-out infinite;
}
.confirm-icon svg { width: 30px; height: 30px; color: var(--red); }
.confirm-modal h3 { font-size: 1.1rem; margin-bottom: 8px; }
.confirm-modal p  { font-size: 0.875rem; color: var(--text-muted); }

/* ============================================================
   13. TOOLBAR (above tables)
   ============================================================ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 220px;
  position: relative;
}
.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-box input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px 9px 38px;
  color: var(--text);
  outline: none;
  transition: var(--tr);
  font-family: var(--font);
  font-size: 0.875rem;
}
.search-box input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-dim);
  background: rgba(0,212,255,0.03);
}
.search-box input::placeholder { color: var(--text-faint); }

.filter-select {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 32px 9px 12px;
  color: var(--text);
  outline: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.875rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: var(--tr);
}
.filter-select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-dim);
}
.filter-select option { background: var(--surface); }

/* ============================================================
   14. ALERTS / NOTIFICATIONS LIST
   ============================================================ */
.alert-list { display: flex; flex-direction: column; gap: 10px; }

.alert-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  transition: var(--tr);
  animation: fadeIn 0.4s ease both;
}
.alert-item:hover { background: rgba(255,255,255,0.04); }

.alert-item.danger  { border-color: rgba(255,68,102,0.25); background: rgba(255,68,102,0.04); }
.alert-item.warning { border-color: rgba(255,140,0,0.25);  background: rgba(255,140,0,0.04); }
.alert-item.info    { border-color: rgba(0,212,255,0.25);  background: rgba(0,212,255,0.04); }

.alert-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.alert-icon svg { width: 18px; height: 18px; }
.alert-item.danger  .alert-icon { background: var(--red-dim);    color: var(--red);    }
.alert-item.warning .alert-icon { background: var(--orange-dim); color: var(--orange); }
.alert-item.info    .alert-icon { background: var(--cyan-dim);   color: var(--cyan);   }

.alert-content { flex: 1; }
.alert-content strong { font-size: 0.875rem; font-weight: 600; display: block; margin-bottom: 2px; }
.alert-content span   { font-size: 0.78rem; color: var(--text-muted); }
.alert-meta { font-family: var(--mono); font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }

/* ============================================================
   15. TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 380px;
  pointer-events: all;
  animation: slideInRight 0.4s cubic-bezier(.34,1.56,.64,1) both;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  cursor: pointer;
}
.toast.removing { animation: slideOutRight 0.3s ease both; }

.toast-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.toast-icon svg { width: 16px; height: 16px; }

.toast.success { border-color: rgba(0,255,136,0.25); }
.toast.success .toast-icon { background: var(--green-dim); color: var(--green); }
.toast.error   { border-color: rgba(255,68,102,0.25); }
.toast.error   .toast-icon { background: var(--red-dim);   color: var(--red);   }
.toast.warning { border-color: rgba(255,140,0,0.25); }
.toast.warning .toast-icon { background: var(--orange-dim); color: var(--orange); }
.toast.info    { border-color: rgba(0,212,255,0.25); }
.toast.info    .toast-icon { background: var(--cyan-dim);  color: var(--cyan);  }

.toast-content { flex: 1; min-width: 0; }
.toast-title   { font-size: 0.85rem; font-weight: 600; margin-bottom: 2px; }
.toast-message { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.toast-progress {
  position: absolute;
  bottom: 0; left: 0;
  height: 2px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  animation: none;
}
.toast.success .toast-progress { background: var(--green); }
.toast.error   .toast-progress { background: var(--red); }
.toast.warning .toast-progress { background: var(--orange); }
.toast.info    .toast-progress { background: var(--cyan); }

/* ============================================================
   16. LOADING SPINNER
   ============================================================ */
.loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5,10,20,0.7);
  backdrop-filter: blur(4px);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.loader-overlay.hidden { display: none; }

.spinner-ring {
  width: 56px; height: 56px;
  position: relative;
}
.spinner-ring::before,
.spinner-ring::after {
  content: '';
  position: absolute;
  border-radius: 50%;
}
.spinner-ring::before {
  inset: 0;
  border: 2px solid rgba(0,212,255,0.1);
}
.spinner-ring::after {
  inset: 0;
  border: 2px solid transparent;
  border-top-color: var(--cyan);
  animation: spin 0.8s linear infinite;
  box-shadow: 0 0 12px var(--cyan-glow);
}

.spinner-inner {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--purple);
  animation: spin 1.2s linear infinite reverse;
}

.loader-text {
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

/* Page inline loader */
.page-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  gap: 16px;
}

/* ============================================================
   17. EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  animation: fadeIn 0.4s ease;
}
.empty-state-icon {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, var(--cyan-dim), var(--purple-dim));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 24px;
  animation: float 4s ease-in-out infinite;
  box-shadow: 0 0 30px rgba(0,212,255,0.08);
}
.empty-state-icon svg { width: 36px; height: 36px; color: var(--cyan); }
.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.empty-state p {
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 300px;
  margin: 0 auto 24px;
}

/* ============================================================
   18. DASHBOARD SPECIFIC
   ============================================================ */
.dashboard-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.dashboard-grid-3 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

/* Mini stat row */
.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.mini-stat {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}
.mini-stat-value {
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.mini-stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* Progress bars */
.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 1s ease;
}
.progress-fill.cyan   { background: linear-gradient(90deg, var(--cyan), var(--purple)); box-shadow: 0 0 8px var(--cyan-dim); }
.progress-fill.green  { background: linear-gradient(90deg, var(--green), #00cc66); box-shadow: 0 0 8px var(--green-dim); }
.progress-fill.orange { background: linear-gradient(90deg, var(--orange), #e67700); box-shadow: 0 0 8px var(--orange-dim); }
.progress-fill.red    { background: linear-gradient(90deg, var(--red), #cc0033); box-shadow: 0 0 8px var(--red-dim); }

/* Status distribution */
.status-dist { display: flex; flex-direction: column; gap: 12px; }
.status-dist-item {
  display: flex;
  align-items: center;
  gap: 12px;
}
.status-dist-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dist-label { flex: 1; font-size: 0.83rem; }
.status-dist-count {
  font-family: var(--mono);
  font-size: 0.83rem;
  color: var(--text-muted);
}
.status-dist-bar {
  width: 80px; height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 99px;
  overflow: hidden;
}
.status-dist-bar-fill {
  height: 100%;
  border-radius: 99px;
}

/* ============================================================
   19. DOCUMENT EXPIRY INDICATORS
   ============================================================ */
.doc-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.doc-cell .doc-date {
  font-family: var(--mono);
  font-size: 0.78rem;
}
.doc-cell .doc-days {
  font-size: 0.7rem;
}

/* ============================================================
   20. MOBILE OVERLAY
   ============================================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5,10,20,0.7);
  z-index: 99;
  backdrop-filter: blur(4px);
}
.sidebar-overlay.active { display: block; }

/* ============================================================
   21. RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid-2 { grid-template-columns: 1fr; }
  .dashboard-grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    width: 260px;
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .main-wrapper { margin-left: 0; }
  .topbar-hamburger { display: flex; }

  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .content-area { padding: 16px; }
  .topbar { padding: 0 16px; }

  .modal { max-width: calc(100vw - 32px); }
  .login-card { width: calc(100vw - 40px); max-width: 420px; padding: 32px 24px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .topbar-time { display: none; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-box { min-width: unset; }
}

/* ============================================================
   22. MISC UTILITIES
   ============================================================ */
.text-cyan    { color: var(--cyan); }
.text-green   { color: var(--green); }
.text-orange  { color: var(--orange); }
.text-red     { color: var(--red); }
.text-purple  { color: #a78bfa; }
.text-muted   { color: var(--text-muted); }
.text-right   { text-align: right; }
.text-center  { text-align: center; }

.font-mono { font-family: var(--mono); }
.font-sm   { font-size: 0.8rem; }
.font-lg   { font-size: 1.1rem; }

.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.d-flex { display: flex; }
.d-grid { display: grid; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.mb-0  { margin-bottom: 0; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.mt-0  { margin-top: 0; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

.p-0   { padding: 0; }
.w-100 { width: 100%; }

.separator {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* Glow text */
.glow-text {
  text-shadow: 0 0 10px currentColor;
}

/* Neon chip/tag */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-family: var(--mono);
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Truncate text */
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Clickable row */
.clickable { cursor: pointer; }

/* Divider with label */
.divider-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}
.divider-label::before,
.divider-label::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border);
}
.divider-label span {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}

/* Highlight cell */
.cell-highlight {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-weight: 600;
}
.cell-highlight.positive { color: var(--green); }
.cell-highlight.negative { color: var(--red); }

/* ── Shimmer skeleton ── */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% auto;
  animation: shimmer 1.5s linear infinite;
  border-radius: var(--radius-sm);
}
.skeleton-line { height: 14px; margin-bottom: 8px; }
.skeleton-line:last-child { width: 70%; }

/* Sidebar mobile close button */
.sidebar-mobile-close {
  display: none;
  position: absolute;
  top: 12px; right: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 30px; height: 30px;
  align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  z-index: 10;
}
@media(max-width:768px){ .sidebar-mobile-close { display: flex; } }

/* Alert indicator on table cell */
.alert-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.alert-indicator svg { width: 13px; height: 13px; }

/* ============================================================
   23. ROUTE DISPLAY (missions)
   ============================================================ */
.route-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.83rem;
}
.route-cell .route-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.route-cell .route-dot.start { background: var(--green); box-shadow: 0 0 6px var(--green); }
.route-cell .route-dot.end   { background: var(--red);   box-shadow: 0 0 6px var(--red); }
.route-cell .route-arrow { color: var(--text-muted); font-size: 0.7rem; }

/* ============================================================
   24. COST/CURRENCY DISPLAY
   ============================================================ */
.currency {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.875rem;
}
.currency.positive { color: var(--green); }
.currency.negative { color: var(--red); }
.currency.large { font-size: 1.4rem; }

/* ============================================================
   25. PAGE HEADER
   ============================================================ */
.page-header {
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header-left h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.page-header-left p {
  font-size: 0.83rem;
  color: var(--text-muted);
  font-family: var(--mono);
}
.page-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============================================================
   26. SCROLLABLE TABLE CONTAINER
   ============================================================ */
.table-container {
  background: var(--card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  animation: fadeIn 0.4s ease both;
}

.table-container-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.table-container-header h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
}
.table-record-count {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  padding: 3px 10px;
  border-radius: 99px;
  border: 1px solid var(--border);
}

/* ============================================================
   27. FORM SECTION DIVIDERS
   ============================================================ */
.form-section {
  margin-bottom: 24px;
}
.form-section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--cyan);
  font-family: var(--mono);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-section-title svg { width: 14px; height: 14px; }

/* ============================================================
   28. DETAIL VIEW ROWS
   ============================================================ */
.detail-row {
  display: flex;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-row .detail-key {
  width: 160px;
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-family: var(--mono);
  padding-top: 1px;
}
.detail-row .detail-val { flex: 1; color: var(--text); font-weight: 500; }

/* ============================================================
   29. FLOATING BACKGROUND GRID (app background)
   ============================================================ */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,212,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,0.015) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
  z-index: 0;
}

/* Ambient orb in app background */
body::after {
  content: '';
  position: fixed;
  width: 600px; height: 600px;
  top: -200px; right: -200px;
  background: radial-gradient(circle, rgba(124,58,237,0.06) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  animation: orbFloat 20s ease-in-out infinite;
}

.main-wrapper { position: relative; z-index: 1; }
.sidebar { position: fixed; z-index: 100; }

/* ============================================================
   30. NUMBER COUNTER ANIMATION
   ============================================================ */
.counter {
  display: inline-block;
  transition: var(--tr);
}

/* ============================================================
   31. QUICK ACTION BUTTONS (dashboard)
   ============================================================ */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text);
  transition: var(--tr);
  font-family: var(--font);
  font-size: 0.83rem;
  font-weight: 500;
  text-align: left;
}
.quick-action-btn:hover {
  background: var(--cyan-dim);
  border-color: var(--border-strong);
  color: var(--cyan);
  box-shadow: 0 0 16px var(--cyan-dim);
}
.quick-action-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ============================================================
   32. REPAIR/MAINTENANCE SPECIFIC
   ============================================================ */
.repair-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text);
}

/* ============================================================
   33. GRADIENT HEADINGS
   ============================================================ */
.gradient-text {
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-text-green {
  background: linear-gradient(135deg, var(--green), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================================
   34. TOOLTIP (pure CSS)
   ============================================================ */
[data-tooltip] {
  position: relative;
  cursor: help;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 0.72rem;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 999;
  box-shadow: var(--shadow-md);
}
[data-tooltip]:hover::after { opacity: 1; }

/* ============================================================
   35. SELECTION COLORS
   ============================================================ */
::selection {
  background: rgba(0,212,255,0.25);
  color: var(--text);
}

/* ============================================================
   36. CARTE INTERACTIVE (MAP) SPECIFIC STYLES
   ============================================================ */
.map-layout {
  display: flex;
  height: calc(100vh - var(--topbar-h) - 48px);
  gap: 20px;
  animation: fadeIn 0.4s ease both;
}

.map-sidebar {
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}

.map-sidebar-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.01);
}

.map-sidebar-header h3 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.map-search-wrapper {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.map-search-wrapper .input-icon {
  position: absolute;
  left: 32px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  width: 16px;
  height: 16px;
}

.map-search-input {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px 8px 34px;
  color: var(--text);
  outline: none;
  font-size: 0.85rem;
  transition: var(--tr);
}

.map-search-input:focus {
  border-color: var(--cyan);
  background: rgba(0,212,255,0.04);
}

.map-filter-bar {
  display: flex;
  gap: 6px;
  padding: 10px 20px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.1);
}

.map-filter-bar::-webkit-scrollbar {
  height: 2px;
}

.map-filter-btn {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--tr);
}

.map-filter-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.map-filter-btn.active {
  background: var(--cyan-dim);
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 10px rgba(0,212,255,0.15);
}

.map-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.map-list-item {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--tr);
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.map-list-item:hover {
  background: rgba(255,255,255,0.05);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.map-list-item.active {
  border-color: var(--cyan);
  background: rgba(0,212,255,0.04);
  box-shadow: inset 0 0 15px rgba(0,212,255,0.03);
}

.map-item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.map-item-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-item-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.map-item-route {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text);
  margin-top: 2px;
}

.map-item-route span {
  font-weight: 500;
}

.map-item-route-arrow {
  color: var(--cyan);
  font-family: var(--mono);
}

.map-container-wrapper {
  flex: 1;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
  background: #050a14;
}

/* Custom Leaflet Styling Overrides */
.leaflet-container {
  font-family: var(--font) !important;
}

.leaflet-bar {
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-sm) !important;
}

.leaflet-bar a {
  background-color: var(--surface) !important;
  color: var(--text) !important;
  border-bottom: 1px solid var(--border) !important;
  transition: var(--tr);
}

.leaflet-bar a:hover {
  background-color: var(--surface-2) !important;
  color: var(--cyan) !important;
}

.leaflet-popup-content-wrapper {
  background: rgba(13, 24, 41, 0.90) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid var(--border-strong) !important;
  color: var(--text) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 4px;
}

.leaflet-popup-tip {
  background: var(--surface-2) !important;
  border-left: 1px solid var(--border-strong) !important;
  border-bottom: 1px solid var(--border-strong) !important;
}

.leaflet-popup-content {
  margin: 12px 14px !important;
  line-height: 1.4 !important;
  font-size: 0.82rem !important;
  color: var(--text) !important;
}

.leaflet-popup-content h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--cyan);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

.leaflet-popup-content p {
  margin: 4px 0 !important;
}

.leaflet-popup-close-button {
  color: var(--text-muted) !important;
  padding: 6px 8px 0 0 !important;
}

.leaflet-popup-close-button:hover {
  color: var(--red) !important;
}

/* Custom DivIcons */
.custom-marker {
  background: none;
  border: none;
}

/* Truck Marker */
.truck-marker-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
  position: relative;
  transition: transform 0.25s ease;
}

.truck-marker-icon.disponible {
  border-color: var(--green);
  color: var(--green);
  box-shadow: 0 0 10px var(--green-glow);
}

.truck-marker-icon.en_mission {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
}

.truck-marker-icon.en_panne {
  border-color: var(--red);
  color: var(--red);
  box-shadow: 0 0 10px var(--red-glow);
}

.truck-marker-icon.en_entretien {
  border-color: var(--orange);
  color: var(--orange);
  box-shadow: 0 0 10px var(--orange-glow);
}

/* Marker animated pulse */
.truck-marker-icon::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid;
  border-color: inherit;
  opacity: 0.4;
  animation: markerPulse 2s infinite ease-out;
  pointer-events: none;
}

/* City dots (depart/arrivee) */
.dot-marker-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #fff;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.dot-marker-icon.depart {
  background: var(--green);
  border-color: rgba(0, 255, 136, 0.8);
  box-shadow: 0 0 8px var(--green-glow);
}

.dot-marker-icon.depart::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px solid var(--green);
  opacity: 0.6;
  animation: markerPulse 2s infinite ease-out;
}

.dot-marker-icon.arrivee {
  background: var(--purple);
  border-color: rgba(124, 58, 237, 0.8);
  box-shadow: 0 0 8px var(--purple-glow);
}

.dot-marker-icon.arrivee::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px solid var(--purple);
  opacity: 0.6;
  animation: markerPulse 2.5s infinite ease-out;
}

@keyframes markerPulse {
  0% {
    transform: scale(0.8);
    opacity: 0.8;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* Leaflet Attribution styling to match dark theme */
.leaflet-container .leaflet-control-attribution {
  background: rgba(5, 10, 20, 0.8) !important;
  color: var(--text-muted) !important;
  border-radius: var(--radius-sm) 0 0 0;
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
}

.leaflet-container .leaflet-control-attribution a {
  color: var(--cyan) !important;
}

/* ============================================================
   37. EXTENSIONS FONCTIONNELLES: FUEL, INVOICING, REPORTS, PLANNING
   ============================================================ */

/* ── REPORTS & CHARTS ── */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.chart-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chart-container {
  position: relative;
  height: 320px;
  width: 100%;
}

/* ── FUEL TRACKER ── */
.fuel-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.fuel-stats-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.fuel-stats-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--orange-dim);
  color: var(--orange);
  border: 1px solid var(--orange-glow);
}

.fuel-stats-icon.green {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid var(--green-glow);
}

.fuel-stats-info {
  display: flex;
  flex-direction: column;
}

.fuel-stats-val {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--mono);
}

.fuel-stats-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ── INVOICING & BILLING ── */
.invoice-card-preview {
  background: #ffffff;
  color: #1e293b;
  border-radius: var(--radius-md);
  padding: 40px;
  font-size: 0.9rem;
  line-height: 1.5;
  box-shadow: var(--shadow-lg);
  position: relative;
  max-width: 800px;
  margin: 0 auto;
}

.invoice-preview-header {
  display: flex;
  justify-content: space-between;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 24px;
  margin-bottom: 24px;
}

.invoice-preview-logo h2 {
  color: #0f172a;
  font-weight: 800;
  font-size: 1.8rem;
  letter-spacing: -0.5px;
}

.invoice-preview-logo p {
  color: #64748b;
  font-size: 0.8rem;
  font-family: var(--mono);
}

.invoice-preview-meta {
  text-align: right;
}

.invoice-preview-meta h3 {
  color: #0f172a;
  font-size: 1.25rem;
  margin-bottom: 6px;
}

.invoice-preview-meta p {
  color: #475569;
  font-size: 0.85rem;
}

.invoice-preview-addresses {
  display: flex;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 30px;
}

.invoice-address-col {
  flex: 0 0 48%;
  max-width: 48%;
}

.invoice-address-col h4 {
  color: #475569;
  font-size: 0.8rem;
  text-transform: uppercase;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.invoice-address-col p {
  color: #0f172a;
  font-weight: 500;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.invoice-table-wrapper {
  margin-bottom: 30px;
}

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

.invoice-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.invoice-table td {
  padding: 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

/* Grouped Invoices layout styles matching user request */
.invoice-grouped-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  margin-bottom: 20px;
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #000000;
}

.invoice-grouped-table th, 
.invoice-grouped-table td {
  border: 1px solid #000000;
  padding: 10px 12px;
  font-size: 0.85rem;
  color: #000000;
}

.invoice-grouped-table th {
  font-weight: bold;
  text-align: center;
  background-color: #f8fafc;
  text-transform: uppercase;
  color: #000000;
}

.invoice-grouped-table td {
  color: #000000;
}

@media print {
  .invoice-grouped-table th {
    background-color: #ffffff !important;
    color: #000000 !important;
  }
}

.invoice-summary-box {
  display: flex;
  justify-content: flex-end;
}

.invoice-summary-table {
  width: 300px;
  font-size: 0.95rem;
}

.invoice-summary-table td {
  padding: 8px 12px;
  text-align: right;
}

.invoice-summary-table tr:last-child td {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  border-top: 2px solid #e2e8f0;
}

/* Payment badges on invoice */
.inv-status-badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.inv-status-badge.paye {
  background: rgba(0, 255, 136, 0.15);
  color: #16a34a;
}

.inv-status-badge.non_paye {
  background: rgba(255, 68, 102, 0.15);
  color: #dc2626;
}

.inv-status-badge.partiellement_paye {
  background: rgba(255, 140, 0, 0.15);
  color: #d97706;
}

/* Print stylesheets styles */
@media print {
  @page {
    size: auto;
    margin: 0 !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    margin: 1.6cm 1.2cm !important;
    padding: 0 !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    overflow: visible !important;
  }

  /* Hide navigation, sidebar, topbar, toast, loader, and interactive buttons */
  .sidebar, .topbar, .toast-container, .loader-overlay, .global-loader, .modal-backdrop, .topbar-actions, header, .btn, button {
    display: none !important;
  }

  /* Hide all other sections in main content, leaving only the preview modal active */
  #main-content > div:not(#modal-invoice-preview) {
    display: none !important;
  }

  /* Clean Reset for all parent layout containers to prevent clipping, fixed widths, and scroll overflow */
  #app-shell, 
  .main-wrapper, 
  .main-content, 
  #main-content, 
  #modal-invoice-preview, 
  #modal-invoice-preview .modal, 
  #modal-invoice-preview .modal-body {
    display: block !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border: none !important;
    overflow: visible !important;
    float: none !important;
    background: transparent !important;
  }

  /* Style the invoice preview container specifically for paper print */
  .invoice-card-preview {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border: none !important;
    overflow: visible !important;
  }
}

/* ── TIMELINE SCHEDULER ── */
.scheduler-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.scheduler-view-selector {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.scheduler-view-btn {
  padding: 6px 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--tr);
}

.scheduler-view-btn.active {
  background: var(--cyan-dim);
  color: var(--cyan);
}

.scheduler-board {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-md);
}

.scheduler-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1200px;
}

.scheduler-table th, .scheduler-table td {
  border: 1px solid rgba(0, 212, 255, 0.08);
}

.scheduler-table th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  padding: 10px 4px;
  text-align: center;
}

.scheduler-table th.resource-col {
  width: 200px;
  text-align: left;
  padding: 10px 16px;
  font-size: 0.85rem;
  color: var(--text);
  background: rgba(255,255,255,0.03);
}

.scheduler-table td.resource-cell {
  background: rgba(255,255,255,0.01);
  padding: 14px 16px;
  font-weight: 600;
  font-size: 0.82rem;
}

.scheduler-table td.day-cell {
  padding: 0;
  position: relative;
  height: 54px;
  vertical-align: middle;
}

.scheduler-task-block {
  position: absolute;
  top: 6px;
  bottom: 6px;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: transform 0.15s ease, filter 0.15s ease;
  z-index: 10;
}

.scheduler-task-block:hover {
  transform: scaleY(1.05);
  filter: brightness(1.15);
}

.scheduler-task-block.en_cours {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border: 1px solid rgba(0, 212, 255, 0.3);
}

.scheduler-task-block.planifiee {
  background: linear-gradient(135deg, #6d28d9, #5b21b6);
  border: 1px solid rgba(124, 58, 237, 0.3);
}

.scheduler-task-block.terminee {
  background: linear-gradient(135deg, #047857, #065f46);
  border: 1px solid rgba(0, 255, 136, 0.3);
}

.scheduler-task-block.annulee {
  background: linear-gradient(135deg, #b91c1c, #991b1b);
  border: 1px solid rgba(255, 68, 102, 0.3);
}

/* ============================================================
   17. SETTINGS PAGE STYLES
   ============================================================ */
.settings-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
  align-items: start;
}

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

/* Logo Upload Container */
.logo-upload-container {
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 24px;
  transition: var(--tr);
}
.logo-upload-container:hover {
  border-color: var(--cyan);
  background: rgba(0, 212, 255, 0.02);
}

.logo-preview-box {
  width: 90px;
  height: 90px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.logo-preview-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.logo-upload-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

