/* ============================================
   Dispatcher — Enterprise CRM Styles
   Dense data tables, deep-dive panels, schedule
   ============================================ */

/* ── Layout ── */
.dispatcher-layout { display: flex; min-height: 100vh; background: var(--bg-0); }
.sidebar { position: fixed; left: 0; top: 0; width: 200px; height: 100vh; background: var(--bg-1); border-right: 1px solid var(--border-1); display: flex; flex-direction: column; z-index: 100; transition: transform 250ms ease; }
.sidebar-overlay { display: none; }
.main-content { margin-left: 200px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; transition: margin-left 250ms ease; }
.dispatcher-layout.sidebar-collapsed .sidebar { transform: translateX(-100%); }
.dispatcher-layout.sidebar-collapsed .main-content { margin-left: 0; }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); width: 240px; }
  .sidebar.open, .dispatcher-layout.sidebar-collapsed .sidebar.open { transform: translateX(0) !important; }
  .sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99; opacity: 0; pointer-events: none; transition: opacity 200ms; }
  .sidebar-overlay.open { opacity: 1; pointer-events: auto; }
  .main-content { margin-left: 0; }
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 16px; border-bottom: 1px solid var(--border-1); }
.sidebar-logo-icon { width: 36px; height: 36px; background: var(--brand); border-radius: 10px; display: flex; align-items: center; justify-content: center; overflow: hidden; box-shadow: 0 0 10px var(--brand-glow); }
.sidebar-logo-icon img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-logo-text { font-weight: 800; font-size: 1rem; color: var(--brand); }
.sidebar-logo-sub { font-size: 0.6rem; color: var(--text-4); letter-spacing: 1px; text-transform: uppercase; font-weight: 600; }
.sidebar-toggle-btn { margin-left: auto; background: transparent; border: 1px solid var(--border-1); color: var(--text-3); cursor: pointer; padding: 4px; border-radius: 6px; display: flex; align-items: center; justify-content: center; transition: all 150ms; }
.sidebar-toggle-btn:hover { background: var(--bg-3); color: var(--brand); border-color: var(--brand); }
.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.sidebar-section { font-size: 0.58rem; color: var(--text-4); text-transform: uppercase; letter-spacing: 1.5px; font-weight: 700; padding: 12px 12px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border-radius: 8px; font-size: 0.82rem; font-weight: 500; color: var(--text-2); transition: all 120ms; position: relative; }
.nav-item:hover { background: var(--bg-3); color: var(--text-0); }
.nav-item.active { background: var(--brand-light); color: var(--brand); font-weight: 700; border-left: 3px solid var(--brand); }
.nav-badge { position: absolute; right: 8px; background: var(--red); color: #fff; font-size: 0.6rem; padding: 1px 6px; border-radius: 9999px; font-weight: 700; }
.sidebar-user { padding: 12px; border-top: 1px solid var(--border-1); display: flex; align-items: center; gap: 8px; }
.sidebar-user-avatar { width: 32px; height: 32px; border-radius: 8px; background: var(--bg-4); display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 800; color: var(--brand); flex-shrink: 0; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 0.75rem; font-weight: 700; color: var(--text-0); }
.sidebar-user-role { font-size: 0.6rem; color: var(--text-4); }
.sidebar-logout { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--text-4); transition: all 120ms; }
.sidebar-logout:hover { background: var(--red-bg); color: var(--red); }

/* ── Header ── */
.main-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; border-bottom: 1px solid var(--border-1); background: var(--bg-1); }
.main-header h1 { font-size: 1.1rem; font-weight: 800; color: var(--text-0); }
.header-right { display: flex; align-items: center; gap: 14px; }
.header-clock { font-size: 0.85rem; font-weight: 700; color: var(--brand); font-family: 'Inter', monospace; }
.header-menu-btn { display: flex; width: 36px; height: 36px; border-radius: 8px; align-items: center; justify-content: center; color: var(--text-2); transition: all 120ms; background: var(--bg-2); border: 1px solid var(--border-1); cursor: pointer; }
.header-menu-btn:hover { background: var(--bg-3); color: var(--brand); border-color: var(--brand); }
.page-content { flex: 1; padding: 20px 24px; overflow-y: auto; }

/* ── Stats ── */
.stats-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--bg-2); border: 1px solid var(--border-1); border-radius: var(--r-lg); padding: 16px 18px; transition: border-color 200ms; }
.stat-card:hover { border-color: var(--border-3); }
.stat-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.stat-card-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.stat-card-icon.yellow { background: var(--brand-light); color: var(--brand); }
.stat-card-icon.blue { background: var(--blue-bg); color: var(--blue); }
.stat-card-icon.green { background: var(--green-bg); color: var(--green); }
.stat-card-icon.red { background: var(--red-bg); color: var(--red); }
.stat-card-icon.purple { background: rgba(168,85,247,0.12); color: #a855f7; }
.stat-card-icon.cyan { background: rgba(34,211,238,0.12); color: #22d3ee; }
.stat-value { font-size: 1.6rem; font-weight: 900; color: var(--text-0); letter-spacing: -0.5px; }
.stat-label { font-size: 0.68rem; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Dashboard Grid ── */
.dashboard-grid { display: grid; grid-template-columns: 1fr 360px; gap: 16px; }
@media (max-width: 1100px) { .dashboard-grid { grid-template-columns: 1fr; } }
.map-panel { background: var(--bg-2); border: 1px solid var(--border-1); border-radius: var(--r-lg); overflow: hidden; min-height: 500px; position: relative; }
.map-legend { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); background: rgba(6,9,18,0.9); border: 1px solid var(--border-2); border-radius: var(--r-md); padding: 6px 14px; display: flex; gap: 16px; z-index: 500; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 0.65rem; color: var(--text-2); font-weight: 600; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.side-panel { background: var(--bg-2); border: 1px solid var(--border-1); border-radius: var(--r-lg); display: flex; flex-direction: column; max-height: 600px; }
.side-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border-1); }
.side-panel-header h3 { font-size: 0.9rem; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.side-panel-body { flex: 1; overflow-y: auto; padding: 8px; }

/* ── Drivers Panel ── */
.drivers-panel { margin-top: 16px; background: var(--bg-2); border: 1px solid var(--border-1); border-radius: var(--r-lg); }
.drivers-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border-1); }
.drivers-panel-header h3 { font-size: 0.9rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.drivers-online-count { font-size: 0.7rem; font-weight: 600; color: var(--text-3); background: var(--bg-4); padding: 2px 10px; border-radius: 999px; }
.drivers-panel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1px; background: var(--border-1); }
.driver-status-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--bg-2); transition: background 150ms; }
.driver-status-row:hover { background: var(--bg-3); }
.driver-status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.driver-status-dot.online { background: var(--green); box-shadow: 0 0 6px var(--green); animation: pulse-dot 2s infinite; }
.driver-status-dot.offline { background: var(--text-4); opacity: 0.4; }
@keyframes pulse-dot { 0%, 100% { box-shadow: 0 0 4px var(--green); } 50% { box-shadow: 0 0 10px var(--green); } }
.driver-status-info { flex: 1; min-width: 0; }
.driver-status-name { font-size: 0.82rem; font-weight: 700; color: var(--text-0); display: block; }
.driver-status-detail { font-size: 0.68rem; color: var(--text-4); display: block; }
.driver-status-badge { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; padding: 3px 10px; border-radius: 999px; flex-shrink: 0; }
.driver-status-badge.online { background: rgba(34,197,94,0.15); color: var(--green); }
.driver-status-badge.offline { background: var(--bg-4); color: var(--text-4); }

/* ── Order Cards ── */
.order-card { background: var(--bg-3); border: 1px solid var(--border-1); border-radius: var(--r-md); padding: 12px 14px; cursor: pointer; transition: all 150ms; margin-bottom: 6px; }
.order-card:hover { border-color: var(--border-3); background: var(--bg-4); }
.order-card.pending { border-left: 3px solid var(--brand); }
.oc-top { display: flex; justify-content: space-between; margin-bottom: 4px; }
.oc-number { font-size: 0.7rem; font-weight: 700; color: var(--brand); font-family: 'Inter', monospace; }
.oc-time { font-size: 0.62rem; color: var(--text-4); }
.oc-client { font-size: 0.85rem; font-weight: 700; color: var(--text-0); margin-bottom: 2px; }
.oc-car { font-size: 0.7rem; color: var(--text-2); display: flex; align-items: center; gap: 4px; }
.oc-addr { font-size: 0.7rem; color: var(--text-3); display: flex; align-items: center; gap: 4px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oc-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.oc-truck { font-size: 0.62rem; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 4px; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; gap: 8px; }
.empty-state-icon { color: var(--text-4); }
.empty-state-text { font-size: 0.82rem; color: var(--text-4); }

/* ── Orders Toolbar ── */
.orders-toolbar { display: flex; align-items: center; gap: 8px; background: var(--bg-2); border: 1px solid var(--border-1); border-radius: var(--r-lg); padding: 12px 16px; margin-bottom: 14px; flex-wrap: wrap; }
.orders-toolbar input[type="search"] { flex: 1; min-width: 180px; }
.orders-toolbar select { max-width: 150px; }
.orders-toolbar input[type="date"] { max-width: 140px; }
.toolbar-sep { width: 1px; height: 28px; background: var(--border-2); flex-shrink: 0; }
.toolbar-right { margin-left: auto; flex-shrink: 0; }

/* ── Orders Table ── */
.orders-table-wrap { background: var(--bg-2); border: 1px solid var(--border-1); border-radius: var(--r-lg); overflow: hidden; }
.orders-table { width: 100%; border-collapse: collapse; }
.orders-table th { padding: 10px 12px; font-size: 0.62rem; font-weight: 700; color: var(--text-4); text-transform: uppercase; letter-spacing: 1px; background: var(--bg-3); border-bottom: 1px solid var(--border-1); text-align: left; white-space: nowrap; }
.orders-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-1); font-size: 0.78rem; }
.orders-table tbody tr { cursor: pointer; transition: background 100ms; }
.orders-table tbody tr:hover { background: var(--bg-3); }
.cell-order-num { font-family: 'Inter', monospace; font-weight: 700; font-size: 0.72rem; color: var(--brand); }
.cell-date { font-size: 0.68rem; color: var(--text-3); white-space: nowrap; }
.cell-client { font-weight: 600; }
.cell-phone { font-size: 0.72rem; color: var(--text-2); white-space: nowrap; }
.cell-car { font-size: 0.72rem; }
.cell-reg { font-family: monospace; font-weight: 600; font-size: 0.72rem; }
.cell-truck { font-weight: 600; font-size: 0.72rem; color: var(--brand); }
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--border-1); }
.pagination-info { font-size: 0.68rem; color: var(--text-4); }
.pagination-btns { display: flex; gap: 2px; }
.pagination-btns button { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 600; color: var(--text-2); transition: all 100ms; }
.pagination-btns button:hover:not(:disabled) { background: var(--bg-4); color: var(--text-0); }
.pagination-btns button.active { background: var(--brand); color: #000; }
.pagination-btns button:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Deep Dive Panel ── */
.deep-panel-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 6000; display: flex; justify-content: flex-end; animation: fadeIn 150ms ease; }
.deep-panel { width: 100%; max-width: 640px; background: var(--bg-1); border-left: 1px solid var(--border-2); display: flex; flex-direction: column; animation: slideInRight 250ms ease; overflow-y: auto; }
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
.deep-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border-1); position: sticky; top: 0; background: var(--bg-1); z-index: 10; }
.dp-actions { display: flex; align-items: center; gap: 6px; }
.deep-panel-body { flex: 1; padding: 16px 20px; }
.dp-section { margin-bottom: 18px; }
.dp-section-title { font-size: 0.62rem; font-weight: 700; color: var(--text-4); text-transform: uppercase; letter-spacing: 1.2px; padding-bottom: 6px; margin-bottom: 10px; border-bottom: 1px solid var(--border-1); display: flex; align-items: center; gap: 5px; }
.dp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dp-field-label { font-size: 0.58rem; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; margin-bottom: 1px; }
.dp-field-value { font-size: 0.85rem; font-weight: 600; color: var(--text-0); }
.dp-timeline { display: flex; flex-direction: column; gap: 4px; }
.dp-timeline-item { display: flex; align-items: flex-start; gap: 10px; padding: 5px 0; font-size: 0.75rem; border-left: 2px solid var(--border-2); padding-left: 10px; }
.dp-timeline-time { color: var(--text-4); font-size: 0.65rem; min-width: 110px; font-family: monospace; }
.dp-timeline-event { color: var(--text-1); }
.dp-timeline-author { color: var(--text-4); font-size: 0.65rem; }
.dp-photos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 6px; }
.dp-photo-item { border-radius: var(--r-md); overflow: hidden; aspect-ratio: 1; cursor: pointer; transition: transform 150ms; }
.dp-photo-item:hover { transform: scale(1.05); }
.dp-photo-item img { width: 100%; height: 100%; object-fit: cover; }
.dp-notes-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.dp-note { background: var(--bg-3); border-radius: var(--r-sm); padding: 10px 12px; border-left: 3px solid var(--border-2); }
.dp-note.dispatcher { border-left-color: var(--brand); }
.dp-note.driver { border-left-color: var(--green); }
.dp-note-header { display: flex; justify-content: space-between; margin-bottom: 4px; }
.dp-note-author { font-size: 0.68rem; font-weight: 700; color: var(--text-2); }
.dp-note-time { font-size: 0.6rem; color: var(--text-4); }
.dp-note-content { font-size: 0.78rem; color: var(--text-1); }
.dp-note-add { display: flex; gap: 8px; align-items: flex-end; }
.dp-note-add textarea { min-height: 48px; font-size: 0.8rem; flex: 1; }

/* ── AI Diagnosis Results ── */
.ai-diagnosis-result {
  background: var(--bg-3);
  border: 1px solid rgba(245,197,24,0.2);
  border-radius: var(--r-md);
  overflow: hidden;
}
.ai-diagnosis-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(245,197,24,0.08) 0%, rgba(245,197,24,0.02) 100%);
  border-bottom: 1px solid rgba(245,197,24,0.15);
}
.ai-diagnosis-body {
  padding: 12px 14px;
  font-size: 0.8rem;
  color: var(--text-1);
  line-height: 1.5;
}
.ai-diagnosis-body h3, .ai-diagnosis-body h4 { margin-top: 8px; }
.ai-diagnosis-body li { margin-left: 16px; }
.ai-diagnosis-body strong { color: var(--text-0); }

/* ── Fleet Cards Grid ── */
.fleet-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  padding: 16px 18px;
}
.fleet-card {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all 200ms cubic-bezier(0.4,0,0.2,1);
  position: relative;
}
.fleet-card:hover {
  border-color: var(--brand);
  box-shadow: 0 8px 32px rgba(245,197,24,0.08), 0 0 0 1px var(--brand);
  transform: translateY(-2px);
}

/* ── Photo Container — dark bg for transparent PNGs ── */
.fleet-card-photo {
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #0F172A 100%);
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.fleet-card-photo::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(245,197,24,0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 0%, rgba(59,130,246,0.04) 0%, transparent 50%);
  pointer-events: none;
}
.fleet-card-photo::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 20px;
  background: radial-gradient(ellipse, rgba(0,0,0,0.4) 0%, transparent 70%);
  filter: blur(8px);
  pointer-events: none;
}
.fleet-card-photo img {
  max-height: 88%;
  max-width: 92%;
  object-fit: contain;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.6)) drop-shadow(0 2px 8px rgba(0,0,0,0.4));
  transition: transform 350ms cubic-bezier(0.4,0,0.2,1), filter 350ms ease;
  position: relative;
  z-index: 1;
}
.fleet-card:hover .fleet-card-photo img {
  transform: scale(1.05) translateY(-4px);
  filter: drop-shadow(0 16px 40px rgba(0,0,0,0.5)) drop-shadow(0 4px 12px rgba(245,197,24,0.15));
}
.fleet-card-photo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: rgba(255,255,255,0.08);
}

/* ── Card Body ── */
.fleet-card-body {
  padding: 14px 16px 12px;
}
.fleet-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
  position: relative;
}
.fleet-card-code {
  font-family: 'Inter', monospace;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: 1px;
}
.fleet-card-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-0);
  margin-top: 1px;
}
.fleet-card-nickname {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-3);
  font-style: italic;
}
.fleet-card-reg {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: monospace;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-1);
  background: var(--bg-3);
  border: 1px solid var(--border-1);
  padding: 4px 10px;
  border-radius: var(--r-sm);
  margin-bottom: 10px;
  letter-spacing: 1px;
}

/* ── Info Grid ── */
.fleet-card-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}
.fleet-card-info {
  padding: 4px 6px;
  border-radius: var(--r-sm);
  background: var(--bg-3);
}
.fleet-card-info-label {
  display: block;
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--text-4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.fleet-card-info-value {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-1);
}

/* Alert states */
.fleet-card-info.alert-critical { background: rgba(239,68,68,0.12); }
.fleet-card-info.alert-critical .fleet-card-info-value { color: var(--red); font-weight: 800; }
.fleet-card-info.alert-warn { background: rgba(245,158,11,0.1); }
.fleet-card-info.alert-warn .fleet-card-info-value { color: var(--amber); font-weight: 700; }
.fleet-card-info.alert-caution .fleet-card-info-value { color: var(--amber); }

.fleet-card-vin {
  font-size: 0.62rem;
  color: var(--text-4);
  padding: 4px 0;
  border-top: 1px solid var(--border-1);
  margin-top: 4px;
}

.fleet-card-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-1);
}

/* ── Truck Modal Photo Preview ── */
.truck-modal-photo {
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #0F172A 100%);
  border-radius: var(--r-md);
  padding: 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.truck-modal-photo::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 15%;
  right: 15%;
  height: 16px;
  background: radial-gradient(ellipse, rgba(0,0,0,0.35) 0%, transparent 70%);
  filter: blur(6px);
}
.truck-modal-photo img {
  max-height: 140px;
  max-width: 90%;
  object-fit: contain;
  filter: drop-shadow(0 8px 20px rgba(0,0,0,0.5));
  position: relative;
  z-index: 1;
}

/* ── Fleet Tables (kept for drivers table) ── */
.fleet-section { background: var(--bg-2); border: 1px solid var(--border-1); border-radius: var(--r-lg); margin-bottom: 16px; overflow: hidden; }
.fleet-section-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border-1); }
.fleet-section-header h3 { font-size: 0.9rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.fleet-table-wrap { overflow-x: auto; }
.fleet-table { width: 100%; border-collapse: collapse; }
.fleet-table th { padding: 8px 12px; font-size: 0.58rem; font-weight: 700; color: var(--text-4); text-transform: uppercase; letter-spacing: 1px; background: var(--bg-3); border-bottom: 1px solid var(--border-1); text-align: left; white-space: nowrap; }
.fleet-table td { padding: 8px 12px; border-bottom: 1px solid var(--border-1); font-size: 0.78rem; }
.fleet-table tbody tr { transition: background 100ms; }
.fleet-table tbody tr:hover { background: var(--bg-3); }
.cell-code { font-family: monospace; font-weight: 700; font-size: 0.72rem; color: var(--brand); }
.cell-name { font-weight: 600; }
.cell-driver-name { font-weight: 600; font-size: 0.78rem; }
.cell-driver-none { color: var(--text-4); font-size: 0.72rem; }
.cell-actions { display: flex; gap: 4px; justify-content: flex-end; }
.cell-actions button { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--text-3); transition: all 100ms; }
.cell-actions button:hover { background: var(--bg-4); color: var(--text-0); }
.cell-actions .act-map:hover { color: var(--blue); background: var(--blue-bg); }
.cell-actions .act-danger:hover { color: var(--red); background: var(--red-bg); }

/* ── Status Dropdown ── */
.status-cell { position: relative; }
.status-dropdown { position: absolute; left: 0; top: 100%; background: var(--bg-3); border: 1px solid var(--border-2); border-radius: var(--r-md); box-shadow: var(--shadow-lg); z-index: 500; min-width: 140px; padding: 4px; }
.status-dropdown-item { display: flex; align-items: center; gap: 8px; padding: 6px 12px; width: 100%; font-size: 0.75rem; font-weight: 600; border-radius: var(--r-sm); transition: background 100ms; }
.status-dropdown-item:hover { background: var(--bg-4); }
.sdi-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* ── Driver Selection in Order Modal ── */
.driver-option { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--bg-3); border: 1px solid var(--border-1); border-radius: var(--r-md); cursor: pointer; transition: all 120ms; margin-bottom: 6px; }
.driver-option:hover { border-color: var(--border-3); background: var(--bg-4); }
.driver-option.selected { border-color: var(--brand); background: var(--brand-light); }
.driver-option-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.driver-option-info { flex: 1; }
.driver-option-name { font-size: 0.82rem; font-weight: 700; }
.driver-option-truck { font-size: 0.68rem; color: var(--text-3); }

/* ── Autocomplete ── */
.ac-dropdown { position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-3); border: 1px solid var(--border-2); border-radius: 0 0 var(--r-md) var(--r-md); box-shadow: var(--shadow-lg); z-index: 500; max-height: 200px; overflow-y: auto; }
.ac-item { padding: 8px 14px; font-size: 0.8rem; cursor: pointer; transition: background 80ms; }
.ac-item:hover { background: var(--bg-4); color: var(--brand); }

/* ── AI Results ── */
.ai-result-box { background: var(--bg-3); border-left: 3px solid var(--amber); border-radius: 0 var(--r-sm) var(--r-sm) 0; padding: 8px 12px; font-size: 0.8rem; color: var(--amber); }

/* ── Lightbox ── */
.lightbox-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 8000; display: flex; align-items: center; justify-content: center; animation: fadeIn 150ms ease; }
.lightbox-overlay img { max-width: 90%; max-height: 90%; object-fit: contain; border-radius: var(--r-lg); }
.lightbox-close { position: absolute; top: 20px; right: 20px; width: 40px; height: 40px; border-radius: 50%; background: var(--bg-3); display: flex; align-items: center; justify-content: center; color: var(--text-0); z-index: 10; }

/* ── Settings ── */
.settings-layout { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.settings-card { background: var(--bg-2); border: 1px solid var(--border-1); border-radius: var(--r-lg); padding: 18px; }
.settings-card h3 { font-size: 0.9rem; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.logo-upload { border: 2px dashed var(--border-2); border-radius: var(--r-md); padding: 20px; text-align: center; cursor: pointer; transition: border-color 150ms; margin-bottom: 8px; }
.logo-upload:hover { border-color: var(--brand); }
.logo-upload img { max-height: 60px; }
.logo-upload-text { font-size: 0.68rem; color: var(--text-4); margin-top: 6px; }

/* ═══════════════════════════════════════════
   V3.0: Payment Status Badges (Table)
   ═══════════════════════════════════════════ */
.badge-payment {
  display: inline-block; padding: 3px 8px; border-radius: 6px;
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.3px; white-space: nowrap;
}
.badge-payment.ps-zrealizowane { background: rgba(148,163,184,0.15); color: #94a3b8; border: 1px solid rgba(148,163,184,0.3); }
.badge-payment.ps-unpaid { background: rgba(239,68,68,0.15); color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }
.badge-payment.ps-paid { background: rgba(34,197,94,0.15); color: #22c55e; border: 1px solid rgba(34,197,94,0.3); }
.badge-payment.ps-invoice { background: rgba(34,197,94,0.15); color: #22c55e; border: 1px solid rgba(34,197,94,0.3); }
.badge-payment.ps-processed { background: rgba(168,85,247,0.15); color: #a855f7; border: 1px solid rgba(168,85,247,0.3); }
.badge-payment.ps-gratis { background: rgba(249,115,22,0.15); color: #f97316; border: 1px solid rgba(249,115,22,0.3); }

/* ═══════════════════════════════════════════
   V3.0: Payment Status Buttons (Deep Panel)
   ═══════════════════════════════════════════ */
.dp-payment-btns {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
.dp-ps-btn {
  padding: 8px 10px; border-radius: 8px; font-size: 0.68rem; font-weight: 700;
  cursor: pointer; transition: all 150ms; border: 2px solid transparent;
  text-align: center;
}
.dp-ps-btn.ps-zrealizowane { background: rgba(148,163,184,0.08); color: #94a3b8; }
.dp-ps-btn.ps-zrealizowane:hover, .dp-ps-btn.ps-zrealizowane.active { background: rgba(148,163,184,0.2); border-color: #94a3b8; }
.dp-ps-btn.ps-unpaid { background: rgba(239,68,68,0.08); color: #ef4444; }
.dp-ps-btn.ps-unpaid:hover, .dp-ps-btn.ps-unpaid.active { background: rgba(239,68,68,0.2); border-color: #ef4444; }
.dp-ps-btn.ps-paid { background: rgba(34,197,94,0.08); color: #22c55e; }
.dp-ps-btn.ps-paid:hover, .dp-ps-btn.ps-paid.active { background: rgba(34,197,94,0.2); border-color: #22c55e; }
.dp-ps-btn.ps-invoice { background: rgba(34,197,94,0.08); color: #22c55e; }
.dp-ps-btn.ps-invoice:hover, .dp-ps-btn.ps-invoice.active { background: rgba(34,197,94,0.2); border-color: #22c55e; }
.dp-ps-btn.ps-processed { background: rgba(168,85,247,0.08); color: #a855f7; }
.dp-ps-btn.ps-processed:hover, .dp-ps-btn.ps-processed.active { background: rgba(168,85,247,0.2); border-color: #a855f7; }
.dp-ps-btn.ps-gratis { background: rgba(249,115,22,0.08); color: #f97316; }
.dp-ps-btn.ps-gratis:hover, .dp-ps-btn.ps-gratis.active { background: rgba(249,115,22,0.2); border-color: #f97316; }

/* ═══════════════════════════════════════════
   V3.0: Driver Mode ("W Teresie / Pomoc")
   ═══════════════════════════════════════════ */
.driver-mode-container { max-width: 480px; margin: 0 auto; }
.driver-mode-header {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; background: var(--bg-2); border: 1px solid var(--border-1);
  border-radius: var(--r-lg); margin-bottom: 12px;
}
.driver-mode-icon {
  width: 48px; height: 48px; border-radius: 14px;
  background: rgba(245,197,24,0.1); display: flex; align-items: center; justify-content: center;
}
.driver-mode-frame {
  background: #060a14; border-radius: var(--r-lg); overflow: hidden;
  min-height: 500px; border: 1px solid rgba(255,255,255,0.08);
}
.driver-mode-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 60px 20px; color: var(--text-4); font-size: 0.82rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

/* ══════════════════════════════════════════════════════════════
   PERIOD SELECTOR & MONTH NAVIGATOR (Reusable UI Component)
   ══════════════════════════════════════════════════════════════ */
.period-bar-container {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.period-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.period-nav-group {
  display: flex;
  align-items: center;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  padding: 3px 6px;
  gap: 6px;
}
.period-nav-btn {
  background: transparent;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 150ms;
}
.period-nav-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--brand);
}
.period-current-label {
  font-size: 0.88rem;
  font-weight: 800;
  color: #ffffff;
  padding: 0 10px;
  white-space: nowrap;
  letter-spacing: 0.3px;
}
.period-custom-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.period-date-input {
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  color: var(--text-1);
  padding: 6px 10px;
  border-radius: var(--r-md);
  font-size: 0.8rem;
  font-weight: 600;
  outline: none;
}
.period-date-input:focus {
  border-color: var(--brand);
}
.period-presets-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.preset-chip {
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  color: var(--text-3);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 150ms;
}
.preset-chip:hover {
  color: #fff;
  border-color: var(--text-3);
}
.preset-chip.active {
  background: rgba(245,197,24,0.15);
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 700;
}

/* ── View Mode Switcher (Karty / Tabela) ── */
.view-mode-toggle {
  display: inline-flex;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  padding: 2px;
  gap: 2px;
}
.view-mode-btn {
  background: transparent;
  border: none;
  color: var(--text-3);
  padding: 5px 12px;
  border-radius: var(--r-sm);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 150ms;
}
.view-mode-btn.active {
  background: var(--brand);
  color: #000000;
  font-weight: 800;
}

/* ══════════════════════════════════════════════════════════════
   MANAGERIAL TABLE (Statystyki Kierowców & Ubezpieczalni)
   ══════════════════════════════════════════════════════════════ */
.manager-table-wrap {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  overflow-x: auto;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.manager-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  white-space: nowrap;
}
.manager-table th {
  background: var(--bg-3);
  padding: 12px 14px;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-3);
  border-bottom: 2px solid var(--border-2);
  position: sticky;
  top: 0;
  z-index: 2;
}
.manager-table th.num, .manager-table td.num {
  text-align: right;
}
.manager-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-1);
  color: var(--text-1);
  transition: background 120ms;
}
.manager-table tr:hover td {
  background: rgba(245,197,24,0.04);
}
.manager-table tr.total-row td {
  background: rgba(255,255,255,0.03);
  font-weight: 800;
  border-top: 2px solid var(--border-2);
  color: #ffffff;
}

/* ══════════════════════════════════════════════════════════════
   INSURANCE KPI & CARDS
   ══════════════════════════════════════════════════════════════ */
.insurance-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.insurance-kpi-card {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  padding: 14px 18px;
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  gap: 14px;
}
.insurance-kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.insurance-kpi-title {
  font-size: 0.68rem;
  color: var(--text-3);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.insurance-kpi-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  margin-top: 2px;
}

.insurance-payments-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  margin-bottom: 20px;
}
.insurance-pay-item {
  padding: 8px 12px;
  border-radius: var(--r-md);
  background: var(--bg-3);
  border: 1px solid var(--border-2);
}
.insurance-pay-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}
.insurance-pay-amount {
  font-size: 1.1rem;
  font-weight: 800;
  margin-top: 4px;
}
.insurance-pay-count {
  font-size: 0.65rem;
  color: var(--text-4);
}
