@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800;900&family=Inter:wght@400;500;700&display=swap');

:root {
  /* Admin App Match Theme */
  --bg-deep: #0f1218;
  --bg-surface: rgba(20, 25, 35, 0.65);
  --bg-elevated: rgba(30, 38, 52, 0.8);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Blue Accent - Core */
  --accent-primary: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.4);
  --accent-subtle: rgba(59, 130, 246, 0.1);

  /* Info / Secondary Accent */
  --info-primary: #3b82f6;
  --info-glow: rgba(59, 130, 246, 0.15);

  /* Status Colors */
  --status-success: #10b981;
  --status-warning: #f59e0b;
  --status-danger: #ef4444;

  /* Action Buttons specific */
  --btn-yellow: #f59e0b;
  --btn-yellow-hover: #fbbf24;
  --btn-red: #ef4444;
  --btn-red-hover: #f87171;
  --btn-green: #10b981;
  --btn-green-hover: #34d399;

  /* Glassmorphism System */
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(255, 255, 255, 0.15);
  --glass-blur: blur(24px);
  /* Ogromny blur dla niesamowitego oszronienia */

  --font-display: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Gładkie "Apple-like" zaokrąglenia */
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 32px;

  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Premium Animations */
@keyframes float1 {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -50px) scale(1.1); }
  66% { transform: translate(-20px, 20px) scale(0.9); }
  100% { transform: translate(0, 0) scale(1); }
}

@keyframes float2 {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-30px, 50px) scale(1.2); }
  66% { transform: translate(20px, -20px) scale(0.8); }
  100% { transform: translate(0, 0) scale(1); }
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  z-index: -2;
  opacity: 0.6;
}

.orb-1 {
  width: 500px;
  height: 500px;
  background: rgba(59, 130, 246, 0.25);
  top: -10%;
  left: -10%;
  animation: float1 15s infinite ease-in-out;
}

.orb-2 {
  width: 400px;
  height: 400px;
  background: rgba(239, 68, 68, 0.15);
  bottom: -10%;
  right: -5%;
  animation: float2 18s infinite ease-in-out reverse;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  user-select: none;
}

h1,
h2,
h3,
h4,
.display-font {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-deep);
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

/* Content Wrappers */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px;
}

/* =========================================
   7. Leaflet Map Customizations (Premium)
========================================= */

.leaflet-container {
  font-family: var(--font-display) !important;
  background: var(--bg-deep) !important;
}

/* Premium Map Tinting (CartoDB Filter Hack) */
img.leaflet-tile {
  filter: contrast(1.1) brightness(0.8) sepia(0.2) hue-rotate(330deg) saturate(1.4);
  opacity: 0.95;
}

/* Custom Popups Dark Theme */
.custom-popup .leaflet-popup-content-wrapper {
  background: rgba(11, 14, 20, 0.95) !important;
  border: 1px solid var(--accent-primary) !important;
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.2) !important;
  backdrop-filter: blur(15px);
  color: var(--text-primary) !important;
  border-radius: var(--radius-sm) !important;
}

.custom-popup .leaflet-popup-tip {
  background: rgba(11, 14, 20, 0.95) !important;
  border-left: 1px solid var(--accent-primary) !important;
  border-bottom: 1px solid var(--accent-primary) !important;
  box-shadow: -5px 5px 15px rgba(239, 68, 68, 0.1) !important;
}

.leaflet-popup-content {
  margin: 16px !important;
  line-height: 1.4 !important;
}

/* Custom Marker Overrides */
.custom-truck {
  background: transparent !important;
  border: none !important;
}

/* Marker Pulsing Animations */
@keyframes pulseMarkerGreen {
  0% {
    box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.7);
  }

  70% {
    box-shadow: 0 0 0 15px rgba(5, 150, 105, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(5, 150, 105, 0);
  }
}

@keyframes pulseMarkerOrange {
  0% {
    box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.7);
  }

  70% {
    box-shadow: 0 0 0 15px rgba(217, 119, 6, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(217, 119, 6, 0);
  }
}

.pulse-green {
  animation: pulseMarkerGreen 2s infinite;
}

.pulse-orange {
  animation: pulseMarkerOrange 2.5s infinite;
}

.hidden {
  display: none !important;
}

/* Glass & Card System */
.glass {
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  /* Głębsze światło */
}

.card {
  background: linear-gradient(135deg, rgba(30, 38, 52, 0.7) 0%, rgba(20, 25, 35, 0.8) 100%);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Wewnętrzny cienki odblask światła na górnej krawędzi (Apple style glow) */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  opacity: 0.8;
}

.card:hover {
  border-color: var(--glass-border-hover);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.4), 0 0 24px var(--accent-subtle);
  transform: translateY(-4px);
  /* Płynne podniesienie z "oddychaniem" w nowym motywie */
}

/* Animated Glow Borders (Corporate Elegance) */
.glow-border {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.08);
  /* Zamiana czerwonego sztywnego na neutralny */
}

.glow-border::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--accent-primary), var(--info-primary), transparent);
  opacity: 0;
  z-index: -1;
  transition: opacity var(--transition-smooth);
}

.glow-border:hover::after {
  opacity: 0.15;
  filter: blur(12px);
}

/* Typography Helpers */
.label-sm {
  font-family: var(--font-display);
  font-size: 0.65rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 800;
  margin-bottom: 8px;
  display: block;
}

.value-lg {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.1;
}

/* KAWU TRANSPORT Brand Text */
.brand-text {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.05em;
  background: linear-gradient(135deg, #e2e2e2 0%, var(--accent-primary) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 5px var(--accent-glow));
  /* Spokojniejsze logo */
  margin-bottom: 8px;
  line-height: 1;
}

.monospace {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
}

/* Buttons */
button {
  cursor: pointer;
  border: none;
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--accent-primary);
  color: #fff;
  padding: 16px 32px;
  box-shadow: 0 0 15px var(--accent-subtle);
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: 0.5s ease;
}

.btn-primary:hover::before {
  left: 100%;
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-primary:hover {
  background: #60a5fa;
  /* Jaśniejszy niebieski (hover) */
  box-shadow: 0 0 25px var(--accent-glow);
}

.btn-primary:disabled {
  background: rgba(255, 255, 255, 0.05);
  /* Mniej drastyczne "disable" z widocznym cieniem szkła */
  color: var(--text-muted);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  padding: 14px 24px;
  backdrop-filter: blur(12px);
}

.btn-secondary:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.05);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.05);
  color: var(--status-danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 14px 24px;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

/* Action Mockup Buttons */
.btn-yellow {
  background: var(--btn-yellow);
  color: #111;
  padding: 24px;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 1.1rem;
  font-weight: 900;
  transition: transform 0.1s;
}

.btn-yellow:active {
  transform: scale(0.95);
}

.btn-red {
  background: var(--btn-red);
  color: #fff;
  padding: 24px;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 1.1rem;
  font-weight: 900;
  transition: transform 0.1s;
}

.btn-red:active {
  transform: scale(0.95);
}

.btn-green {
  background: var(--btn-green);
  color: #fff;
  padding: 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.2);
  width: 100%;
  font-size: 1.2rem;
  font-weight: 900;
}

/* Form Controls Customization */
input[type="text"]:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.1);
  outline: none;
}

/* Data Tables (Dispatch & Logic) */
.data-table-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  font-family: var(--font-display);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 16px 32px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.02);
}

.data-table td {
  padding: 20px 32px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background var(--transition-fast);
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.data-table tr:last-child td {
  border-bottom: none;
}

/* Dashboard Grids */
input,
textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 16px 20px;
  font-size: 0.95rem;
  font-family: var(--font-body);
  border-radius: var(--radius-sm);
  transition: var(--transition-smooth);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: rgba(0, 0, 0, 0.6);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}

/* Progress System */
.progress-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

.progress-bar {
  height: 100%;
  background: var(--accent-primary);
  box-shadow: 0 0 15px var(--accent-primary);
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 2px;
}

/* Badges / Status Pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: 100px;
  border: 1px solid currentColor;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
}

.status-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

/* Navigation - Redesigned Bottom/Side Bar */
.nav-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 32px;
}

.nav-item {
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px 8px;
  text-align: center;
  transition: var(--transition-smooth);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.nav-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--info-primary);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.nav-item:hover::before {
  opacity: 0.5;
}

.nav-item.active {
  background: rgba(255, 193, 7, 0.05);
  border-color: rgba(255, 193, 7, 0.2);
}

.nav-item.active::before {
  opacity: 1;
}

.nav-item.active .material-icons {
  color: var(--info-primary);
  filter: drop-shadow(0 0 8px var(--info-glow));
}

.nav-item .material-icons {
  font-size: 24px;
  color: var(--text-secondary);
  transition: var(--transition-fast);
}

.nav-item:hover .material-icons {
  color: #fff;
  transform: scale(1.1);
  /* Przyjemne powiększenie ikony */
}

.nav-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.nav-item.active .nav-text,
.nav-item:hover .nav-text {
  color: var(--text-primary);
}

/* Tables - Data Grid */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}

.data-table th {
  padding: 0 24px 12px 24px;
  text-align: left;
  font-family: var(--font-display);
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 800;
  border-bottom: 1px solid var(--glass-border);
}

.data-table td {
  padding: 20px 24px;
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

.data-table tr td:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  border-left: 2px solid transparent;
}

.data-table tr td:last-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.04);
}

.data-table tr:hover td:first-child {
  border-left-color: var(--accent-primary);
}

/* Authentication Screen */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.auth-wrapper::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 800px;
  height: 800px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--accent-subtle) 0%, transparent 60%);
  opacity: 0.5;
  z-index: -1;
  pointer-events: none;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 48px;
  background: rgba(14, 21, 33, 0.6);
  /* Głęboki, elegancki granat Premium */
  border: 1px solid var(--glass-border);
  box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(40px);
  border-radius: var(--radius-lg);
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 48px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--glass-border);
}

.logo-block {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--info-primary) 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px var(--accent-glow);
}

.logo-icon .material-icons {
  color: #fff;
  font-size: 24px;
}

/* Animations */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes pulseBlue {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
  }

  70% {
    box-shadow: 0 0 0 15px rgba(59, 130, 246, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-6px);
  }

  75% {
    transform: translateX(6px);
  }
}

.animate-fade-up {
  animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-delay-1 {
  animation-delay: 0.1s;
  opacity: 0;
}

.animate-delay-2 {
  animation-delay: 0.2s;
  opacity: 0;
}

.animate-delay-3 {
  animation-delay: 0.3s;
  opacity: 0;
}

.shake {
  animation: shake 0.3s cubic-bezier(.36, .07, .19, .97) both;
}

/* Modals & Overlays */
#modal-overlay,
#tutorial-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.3s ease;
}

.modal-card {
  background: rgba(14, 21, 33, 0.95);
  /* Ciemny granatowy modal */
  border: 1px solid var(--glass-border);
  border-top: 2px solid var(--accent-primary);
  max-width: 500px;
  width: 100%;
  padding: 40px;
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), 0 0 40px var(--accent-subtle);
  backdrop-filter: blur(20px);
}

/* Tutorials */
.tutorial-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 32px;
}

.tutorial-dots .dot {
  width: 32px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  transition: var(--transition-smooth);
}

.tutorial-dots .dot.active {
  background: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-glow);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  top: 32px;
  right: 32px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 16px;
  pointer-events: none;
}

.toast {
  background: rgba(14, 21, 33, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-left: 4px solid var(--accent-primary);
  color: #fff;
  padding: 24px 32px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  animation: fadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 16px;
}

.toast-error {
  border-left-color: var(--status-danger);
}

.toast-success {
  border-left-color: var(--status-success);
}

.toast-warning {
  border-left-color: var(--status-warning);
}

/* Dashboard Grids */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.boss-layout {
  display: grid;
  grid-template-columns: 2fr 1.2fr;
  gap: 32px;
  margin-bottom: 32px;
}

@media (max-width: 1200px) {
  .boss-layout {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}

/* Chat Module Enhancements */
.chat-bubble {
  padding: 16px 24px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 85%;
  position: relative;
}

.chat-bubble.sent {
  background: var(--accent-primary);
  color: #fff;
  border-bottom-right-radius: 2px;
  box-shadow: 0 10px 20px rgba(239, 68, 68, 0.2);
}

.chat-bubble.received {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-bottom-left-radius: 2px;
}

/* Responsive & Utility Classes */
.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.responsive-flex-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.responsive-flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.responsive-flex-start {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.responsive-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.responsive-flex-gap {
  display: flex;
  align-items: center;
  gap: 24px;
}

.responsive-flex-gap-start {
  display: flex;
  gap: 24px;
}

.live-map-responsive {
  min-height: 520px;
}

/* Responsive Overrides (Mobile First / Tablet) */
@media (max-width: 800px) {

  .responsive-flex-header,
  .responsive-flex-between,
  .responsive-flex-start,
  .responsive-flex-gap,
  .responsive-flex-gap-start {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 16px !important;
  }

  .responsive-grid-2 {
    grid-template-columns: 1fr !important;
  }

  .live-map-responsive {
    min-height: 300px !important;
  }


  .grid-4 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
  }

  /* BOTTOM TAB BAR FOR MOBILE (APP FEEL) */
  #mobile-nav:not(.hidden) {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    margin: 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: rgba(14, 21, 33, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    border-radius: 24px 24px 0 0;
    z-index: 9999;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
    display: flex !important;
    justify-content: space-around;
    gap: 0;
  }

  #mobile-nav .nav-item {
    border: none;
    background: transparent;
    padding: 8px 4px;
    gap: 4px;
    flex: 1;
    box-shadow: none;
    border-radius: 12px;
  }

  #mobile-nav .nav-item:hover {
    transform: translateY(0);
    box-shadow: none;
    background: rgba(255, 255, 255, 0.05);
  }

  #mobile-nav .nav-item::before {
    top: auto;
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 4px;
    border-radius: 4px 4px 0 0;
    background: var(--info-primary);
  }

  #mobile-nav .nav-text {
    font-size: 0.55rem;
    letter-spacing: 0;
  }

  #mobile-nav .nav-item .material-icons {
    font-size: 24px;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr !important;
  }

  .stats-grid {
    grid-template-columns: 1fr !important;
  }

  .container {
    padding: 16px 12px;
  }

  .app-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .app-header>div:last-child {
    width: 100%;
    justify-content: flex-end;
  }

  .value-lg {
    font-size: 1.5rem !important;
  }

  .auth-card {
    padding: 32px 20px;
    border-radius: 0;
    border: none;
    border-top: 2px solid var(--accent-primary);
    border-bottom: 2px solid var(--accent-primary);
    background: rgba(14, 21, 33, 0.95);
    /* Ciemniejsze, nieprzezroczyste na mobilki */
  }

  .card {
    padding: 20px 16px;
  }

  #toast-container {
    top: 16px;
    right: 16px;
    left: 16px;
  }

  /* Tables - Mobile Horizontal Scroll */
  .data-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table th,
  .data-table td {
    white-space: nowrap;
    padding: 16px;
  }

  /* Modals on Mobile */
  .modal-card {
    padding: 30px 20px;
  }

  /* Bottom spacing for mobile - Room for Tab Bar */
  #view-container {
    padding-bottom: 110px;
  }

  /* Make buttons more touch friendly */
  button {
    min-height: 48px;
  }
}

/* --- DOUBLE INTERFACE (PWA Mobile & Desktop 4K) --- */
@media (min-width: 801px) {
  #main-content {
    display: grid !important;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto 1fr;
    height: 100vh;
    max-width: 100%;
    padding: 0;
    margin: 0;
    overflow: hidden;
  }

  .app-header {
    grid-column: 1 / -1;
    grid-row: 1;
    margin-bottom: 0;
    border-radius: 0;
    border-bottom: 1px solid var(--glass-border);
    z-index: 10;
    padding: 16px 32px;
  }

  /* SIDEBAR (Desktop Dashboard Panel) */
  #mobile-nav:not(.hidden) {
    grid-column: 1;
    grid-row: 2;
    width: 280px;
    display: flex !important;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 32px 24px;
    border-right: 1px solid var(--glass-border);
    background: rgba(11, 14, 20, 0.4);
    height: 100%;
    overflow-y: auto;
  }

  #mobile-nav.hidden+#view-container {
    grid-column: 1 / -1;
  }

  /* View container on Desktop */
  #view-container {
    grid-column: 2;
    grid-row: 2;
    padding: 32px 48px;
    height: 100%;
    overflow-y: auto;
  }

  /* Adjust nav items for sidebar */
  #mobile-nav .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    padding: 16px 24px;
    text-align: left;
    height: auto;
  }

  #mobile-nav .nav-item::before {
    width: 4px;
    height: 100%;
    top: 0;
    left: 0;
    background: linear-gradient(180deg, var(--accent-primary), var(--info-primary));
  }

  #mobile-nav .nav-item .material-icons {
    margin-right: 16px;
    font-size: 24px;
  }

  #mobile-nav .nav-text {
    font-size: 0.8rem;
  }
}

/* --- DRIVER TOOLS: TACHOGRAPH V2 --- */
.tacho-circle {
  width: 56px;
  height: 56px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tacho-circle svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.tacho-circle circle {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
}

.tacho-circle .bg {
  stroke: rgba(255, 255, 255, 0.1);
}

.tacho-circle .progress {
  stroke-dasharray: 283;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
}

.tacho-circle.driving .progress {
  stroke: var(--status-success);
  animation: tachoPulseGreen 2s infinite;
}

.tacho-circle.resting .progress {
  stroke: var(--status-warning);
  animation: tachoPulseOrange 2.5s infinite;
}

.tacho-circle .icon {
  z-index: 2;
  font-size: 24px;
  color: #fff;
  filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.5));
}

@keyframes tachoPulseGreen {
  0% {
    filter: drop-shadow(0 0 2px var(--status-success));
  }

  50% {
    filter: drop-shadow(0 0 10px var(--status-success));
  }

  100% {
    filter: drop-shadow(0 0 2px var(--status-success));
  }
}

@keyframes tachoPulseOrange {
  0% {
    filter: drop-shadow(0 0 2px var(--status-warning));
  }

  50% {
    filter: drop-shadow(0 0 10px var(--status-warning));
  }

  100% {
    filter: drop-shadow(0 0 2px var(--status-warning));
  }
}