/* ==========================================================================
   QuickTrans Vodici — Driver Management Dashboard
   Pure CSS, no frameworks
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties
   -------------------------------------------------------------------------- */
:root {
  /* Brand / Chrome */
  --sidebar-bg: #1a2332;
  --sidebar-width: 260px;
  --sidebar-hover: #232f42;
  --sidebar-active: #2563eb;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;

  /* Accent */
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #dbeafe;

  /* Semantic */
  --success: #10b981;
  --success-light: #d1fae5;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;

  /* Surfaces */
  --bg: #f5f7fa;
  --card-bg: #ffffff;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.10);
  --card-radius: 8px;

  /* Text */
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  /* Borders */
  --border: #e2e8f0;
  --border-focus: var(--accent);

  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo,
    monospace;

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition: 250ms ease;

  /* Z-index layers */
  --z-sidebar: 100;
  --z-modal: 200;
  --z-toast: 300;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: 0.9375rem; /* 15px */
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
}

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

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

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

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

/* --------------------------------------------------------------------------
   3. App Layout
   -------------------------------------------------------------------------- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* --------------------------------------------------------------------------
   4. Sidebar
   -------------------------------------------------------------------------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sidebar);
  overflow-y: auto;
  transition: transform var(--transition);
}

/* Logo / brand */
.sidebar-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-6) var(--sp-5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.sidebar-logo img {
  width: 100%;
  max-width: 200px;
  height: auto;
  border-radius: 0;
}

.sidebar-logo span {
  font-size: 1.125rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.sidebar-logo .logo-sub {
  display: block;
  font-size: 0.6875rem;
  font-weight: 400;
  color: var(--sidebar-text);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 1px;
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  padding: var(--sp-4) 0;
  list-style: none;
}

.sidebar-nav li {
  margin: 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  color: var(--sidebar-text);
  font-size: 0.875rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all var(--transition-fast);
}

.sidebar-nav a:hover {
  color: var(--sidebar-text-active);
  background: var(--sidebar-hover);
}

.sidebar-nav a.active {
  color: var(--sidebar-text-active);
  background: rgba(37, 99, 235, 0.15);
  border-left-color: var(--sidebar-active);
}

.sidebar-nav a .nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-nav a.active .nav-icon,
.sidebar-nav a:hover .nav-icon {
  opacity: 1;
}

.sidebar-nav .nav-section-title {
  padding: var(--sp-5) var(--sp-5) var(--sp-2);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* User info at bottom */
.sidebar-user {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 600;
  flex-shrink: 0;
}

.sidebar-user-info {
  overflow: hidden;
}

.sidebar-user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.6875rem;
  color: var(--sidebar-text);
}

/* Mobile sidebar toggle */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: var(--sp-3);
  left: var(--sp-3);
  z-index: calc(var(--z-sidebar) + 1);
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 8px;
  background: var(--sidebar-bg);
  color: #ffffff;
  font-size: 1.25rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--card-shadow);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: calc(var(--z-sidebar) - 1);
}

/* --------------------------------------------------------------------------
   5. Main Content
   -------------------------------------------------------------------------- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: var(--sp-8);
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
}

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: var(--sp-1);
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* --------------------------------------------------------------------------
   6. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  user-select: none;
}

.btn:hover {
  background: var(--bg);
  border-color: var(--text-muted);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: #e8ecf1;
  border-color: var(--text-muted);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.btn-success {
  background: var(--success);
  color: #ffffff;
  border-color: var(--success);
}

.btn-success:hover {
  background: #059669;
  border-color: #059669;
}

.btn-sm {
  padding: var(--sp-1) var(--sp-3);
  font-size: 0.8125rem;
}

.btn-lg {
  padding: var(--sp-3) var(--sp-6);
  font-size: 1rem;
}

.btn-icon {
  padding: var(--sp-2);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 6px;
}

.btn-icon:hover {
  background: var(--bg);
  color: var(--text);
}

.btn[disabled],
.btn.disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   7. Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.card:hover {
  box-shadow: var(--card-shadow-hover);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
}

.card-header h2,
.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.card-body {
  padding: var(--sp-6);
}

.card-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border);
  background: var(--bg);
}

/* --------------------------------------------------------------------------
   8. Stats Grid
   -------------------------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-5);
  margin-bottom: var(--sp-6);
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: var(--sp-5) var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  transition: box-shadow var(--transition), transform var(--transition);
}

.stat-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
}

.stat-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: var(--sp-1);
}

.stat-card-icon.blue  { background: var(--accent-light); color: var(--accent); }
.stat-card-icon.green { background: var(--success-light); color: var(--success); }
.stat-card-icon.red   { background: var(--danger-light); color: var(--danger); }
.stat-card-icon.amber { background: var(--warning-light); color: var(--warning); }

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.stat-change {
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* --------------------------------------------------------------------------
   9. Data Tables
   -------------------------------------------------------------------------- */
.data-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  font-size: 0.875rem;
}

.data-table thead th {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: var(--bg);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  user-select: none;
}

.data-table thead th.sortable {
  cursor: pointer;
}

.data-table thead th.sortable:hover {
  color: var(--text);
}

.data-table thead th.sorted-asc::after,
.data-table thead th.sorted-desc::after {
  margin-left: 4px;
  font-size: 0.625rem;
}

.data-table thead th.sorted-asc::after { content: '\25B2'; }
.data-table thead th.sorted-desc::after { content: '\25BC'; }

.data-table tbody td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

.data-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.data-table tbody tr:hover {
  background: var(--accent-light);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table .cell-actions {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
}

.data-table .cell-number {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.data-table .cell-positive { color: var(--success); font-weight: 600; }
.data-table .cell-negative { color: var(--danger); font-weight: 600; }

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

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--sp-2);
}

.form-group .form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--sp-1);
}

.form-group .form-error {
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: var(--sp-1);
}

.form-row {
  display: flex;
  gap: var(--sp-4);
}

.form-row .form-group {
  flex: 1;
  min-width: 0;
}

.form-control {
  display: block;
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  appearance: none;
}

.form-control:hover {
  border-color: var(--text-muted);
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-control.is-invalid {
  border-color: var(--danger);
}

.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.form-control::placeholder {
  color: var(--text-muted);
}

select.form-control {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px 10px;
  padding-right: 32px;
}

textarea.form-control {
  min-height: 80px;
  resize: vertical;
}

.form-check {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.form-check label {
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   11. Modal
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
}

.modal {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-lg {
  max-width: 720px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h2,
.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  border-radius: 6px;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg);
  color: var(--text);
}

.modal-body {
  padding: var(--sp-6);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   12. Toast Notifications
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  top: var(--sp-6);
  right: var(--sp-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  min-width: 280px;
  max-width: 420px;
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  border-left: 4px solid var(--border);
  font-size: 0.875rem;
  pointer-events: auto;
  animation: toast-slide-in 300ms ease forwards;
}

.toast.removing {
  animation: toast-slide-out 250ms ease forwards;
}

.toast-icon {
  flex-shrink: 0;
  font-size: 1.125rem;
}

.toast-message {
  flex: 1;
  min-width: 0;
}

.toast-dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--sp-1);
  font-size: 1rem;
  line-height: 1;
}

.toast-dismiss:hover {
  color: var(--text);
}

.toast-success {
  border-left-color: var(--success);
}

.toast-success .toast-icon {
  color: var(--success);
}

.toast-error {
  border-left-color: var(--danger);
}

.toast-error .toast-icon {
  color: var(--danger);
}

.toast-warning {
  border-left-color: var(--warning);
}

.toast-warning .toast-icon {
  color: var(--warning);
}

@keyframes toast-slide-in {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-slide-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

/* --------------------------------------------------------------------------
   13. Badges
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-radius: 999px;
  line-height: 1.6;
  white-space: nowrap;
  background: var(--bg);
  color: var(--text-secondary);
}

.badge-success {
  background: var(--success-light);
  color: #065f46;
}

.badge-warning {
  background: var(--warning-light);
  color: #92400e;
}

.badge-danger {
  background: var(--danger-light);
  color: #991b1b;
}

.badge-info {
  background: var(--accent-light);
  color: #1e40af;
}

/* --------------------------------------------------------------------------
   14. Bonus Breakdown
   -------------------------------------------------------------------------- */
.bonus-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--sp-4);
}

.bonus-item {
  padding: var(--sp-4);
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.bonus-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-2);
}

.bonus-item-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.bonus-item-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.bonus-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: var(--sp-2);
}

.bonus-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width var(--transition);
}

.bonus-bar-fill.good    { background: var(--success); }
.bonus-bar-fill.warning { background: var(--warning); }
.bonus-bar-fill.bad     { background: var(--danger); }

/* --------------------------------------------------------------------------
   15. Charts
   -------------------------------------------------------------------------- */
.chart-container {
  position: relative;
  padding: var(--sp-4) 0;
}

.chart-container canvas {
  width: 100% !important;
  max-height: 360px;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-5);
  margin-bottom: var(--sp-6);
}

/* --------------------------------------------------------------------------
   16. Filter Bar
   -------------------------------------------------------------------------- */
.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

.filter-bar .form-control {
  width: auto;
  min-width: 160px;
}

.filter-bar .filter-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   17. Empty State
   -------------------------------------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12) var(--sp-6);
  text-align: center;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--sp-4);
  opacity: 0.4;
}

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--sp-2);
}

.empty-state-text {
  font-size: 0.875rem;
  max-width: 360px;
  margin-bottom: var(--sp-5);
}

/* --------------------------------------------------------------------------
   18. Login Page
   -------------------------------------------------------------------------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar-bg);
  padding: var(--sp-6);
}

.login-card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 400px;
  padding: var(--sp-10);
}

.login-card .login-logo {
  text-align: center;
  margin-bottom: var(--sp-8);
}

.login-card .login-logo h1 {
  font-size: 1.5rem;
  color: var(--text);
}

.login-card .login-logo p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: var(--sp-1);
}

.login-card .btn-primary {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
}

.login-card .login-error {
  background: var(--danger-light);
  color: #991b1b;
  padding: var(--sp-3) var(--sp-4);
  border-radius: 6px;
  font-size: 0.8125rem;
  margin-bottom: var(--sp-4);
}

/* --------------------------------------------------------------------------
   19. Loading Spinner
   -------------------------------------------------------------------------- */
.loading-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spinner-rotate 0.7s linear infinite;
}

.loading-spinner.lg {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-12);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

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

/* --------------------------------------------------------------------------
   20. Utility Classes
   -------------------------------------------------------------------------- */
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger)  !important; }
.text-warning { color: var(--warning) !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-right   { text-align: right !important; }
.text-center  { text-align: center !important; }

.font-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.mb-0 { margin-bottom: 0 !important; }
.mb-4 { margin-bottom: var(--sp-4) !important; }
.mb-6 { margin-bottom: var(--sp-6) !important; }
.mt-4 { margin-top: var(--sp-4) !important; }
.mt-6 { margin-top: var(--sp-6) !important; }

.d-flex    { display: flex; }
.gap-2     { gap: var(--sp-2); }
.gap-3     { gap: var(--sp-3); }
.gap-4     { gap: var(--sp-4); }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

/* --------------------------------------------------------------------------
   21. Scrollbar Styling (Webkit)
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* --------------------------------------------------------------------------
   22. Pagination
   -------------------------------------------------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  padding: var(--sp-4) 0;
  list-style: none;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 var(--sp-2);
  font-size: 0.8125rem;
  border-radius: 6px;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.pagination a:hover {
  background: var(--bg);
  color: var(--text);
}

.pagination .active a,
.pagination .active span {
  background: var(--accent);
  color: #ffffff;
}

.pagination .disabled a,
.pagination .disabled span {
  opacity: 0.4;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   23. Responsive — Tablet (< 1200px)
   -------------------------------------------------------------------------- */
@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   24. Responsive — Mobile (< 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 260px;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.show {
    display: block;
  }

  .sidebar-toggle {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    padding: var(--sp-5) var(--sp-4);
    padding-top: 60px; /* space for toggle button */
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-title {
    font-size: 1.25rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-3);
  }

  .stat-value {
    font-size: 1.375rem;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .filter-bar {
    padding: var(--sp-3) var(--sp-4);
  }

  .filter-bar .form-control {
    min-width: 0;
    flex: 1;
  }

  .modal-overlay {
    padding: var(--sp-3);
    align-items: flex-end;
  }

  .modal {
    max-height: 85vh;
    border-radius: var(--card-radius) var(--card-radius) 0 0;
  }

  .toast-container {
    top: auto;
    bottom: var(--sp-4);
    right: var(--sp-4);
    left: var(--sp-4);
  }

  .toast {
    min-width: 0;
    max-width: none;
  }

  .bonus-breakdown {
    grid-template-columns: 1fr;
  }

  .data-table {
    font-size: 0.8125rem;
  }

  .data-table thead th,
  .data-table tbody td {
    padding: var(--sp-2) var(--sp-3);
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   25. Responsive — Small phones (< 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .page-header-actions {
    width: 100%;
  }

  .page-header-actions .btn {
    flex: 1;
  }

  .login-card {
    padding: var(--sp-6);
  }
}

/* --------------------------------------------------------------------------
   26. Print Styles
   -------------------------------------------------------------------------- */
@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    font-size: 11pt;
    line-height: 1.5;
  }

  .sidebar,
  .sidebar-toggle,
  .sidebar-overlay,
  .toast-container,
  .modal-overlay,
  .btn,
  .filter-bar,
  .page-header-actions,
  .cell-actions,
  .loading-spinner,
  .loading-overlay,
  .pagination {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
  }

  .card {
    break-inside: avoid;
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }

  .page-title {
    font-size: 18pt;
    margin-bottom: 12pt;
  }

  .data-table {
    font-size: 9pt;
  }

  .data-table thead th {
    background: #eee !important;
    font-weight: bold;
  }

  .data-table tbody tr:nth-child(even) {
    background: #f5f5f5 !important;
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 8pt;
  }

  .stat-card {
    border: 1px solid #ccc;
    padding: 8pt;
  }

  .stat-value {
    font-size: 14pt;
  }

  .badge {
    border: 1px solid #999;
    padding: 1px 4px;
  }

  .badge-success { border-color: #059669; }
  .badge-danger  { border-color: #dc2626; }
  .badge-warning { border-color: #d97706; }

  a[href]::after {
    content: none;
  }

  .chart-container {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* --------------------------------------------------------------------------
   27. Additional classes (JS compatibility)
   -------------------------------------------------------------------------- */
.btn-block { display: block; width: 100%; }

.bonus-total {
  text-align: center;
  margin-bottom: var(--sp-6);
  padding: var(--sp-6);
  background: var(--accent-light);
  border-radius: 8px;
}

.bonus-total-amount {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.2;
}

.bonus-total-label {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-top: var(--sp-2);
}

.bonus-item-pct {
  font-size: 1.125rem;
  font-weight: 700;
}

.bonus-item-detail {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  margin-top: var(--sp-2);
  color: var(--text);
}

.bonus-bar-fill.fill-success { background: var(--success); }
.bonus-bar-fill.fill-danger  { background: var(--danger); }

.chart-container-large canvas {
  max-height: 500px;
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.toast-show {
  opacity: 1;
  transform: translateX(0);
}

.filter-bar {
  border-radius: 6px;
  border: none;
}

.page-header .filter-bar {
  padding: 0;
  background: transparent;
}

/* --------------------------------------------------------------------------
   28. Stats Filters & Ranking Table
   -------------------------------------------------------------------------- */
.stats-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
}

.stats-filters .form-control {
  width: auto;
  min-width: 140px;
}

.ranking-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color var(--transition-fast);
}

.ranking-table th.sortable:hover {
  color: var(--accent);
}

.ranking-table th .sort-icon {
  font-size: 0.625rem;
  margin-left: 4px;
  opacity: 0.4;
}

.ranking-table th.sorted .sort-icon {
  opacity: 1;
  color: var(--accent);
}

.ranking-table .highlight-top td {
  background: rgba(37, 99, 235, 0.04);
  font-weight: 600;
}

.ranking-table .highlight-top:first-child td {
  background: rgba(37, 99, 235, 0.08);
}

.ranking-table .consumption-good {
  color: var(--success);
  font-weight: 600;
}

.ranking-table .consumption-bad {
  color: var(--danger);
  font-weight: 600;
}

.stats-grid-6 {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--sp-4);
}

@media (max-width: 1200px) {
  .stats-grid-6 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .stats-grid-6 {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-filters .form-control {
    min-width: 0;
    flex: 1 1 120px;
  }
}

/* --------------------------------------------------------------------------
   18. Approval Status
   -------------------------------------------------------------------------- */
.approval-bar {
  margin-bottom: 1rem;
}

.approval-status {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
}

.approval-status.approved {
  background: var(--success-bg, #ecfdf5);
  border: 1px solid var(--success);
  color: var(--success);
}

.approval-status.draft {
  background: #fffbeb;
  border: 1px solid var(--warning);
  color: var(--text-secondary);
}

.approval-icon {
  font-size: 1.2rem;
}

/* --------------------------------------------------------------------------
   19. Bulk Entry Table
   -------------------------------------------------------------------------- */
.bulk-table .form-control {
  padding: 0.3rem 0.4rem;
  font-size: 0.85rem;
  min-width: 70px;
}

.bulk-table td {
  padding: 0.3rem 0.25rem;
}

.bulk-table input[type="date"] {
  min-width: 120px;
}

.bulk-table input[type="number"] {
  min-width: 65px;
}

/* --------------------------------------------------------------------------
   20. Inline Field Warnings
   -------------------------------------------------------------------------- */
.input-warning {
  border-color: var(--warning) !important;
  background-color: #fffbeb !important;
}

.field-warning {
  display: block;
  color: var(--warning);
  font-size: 0.75rem;
  margin-top: 0.2rem;
}

/* --------------------------------------------------------------------------
   21. Pagination
   -------------------------------------------------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* --------------------------------------------------------------------------
   22. Text utilities
   -------------------------------------------------------------------------- */
.text-muted {
  color: var(--text-muted);
  font-size: 0.85em;
}

.badge-secondary {
  background: var(--bg-tertiary, #e5e7eb);
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   23. Status Page Badges + Rows
   -------------------------------------------------------------------------- */
.badge-hotovo { background: #ecfdf5; color: #065f46; }
.badge-rozpracovane { background: #fffbeb; color: #92400e; }
.badge-chyba { background: #fef2f2; color: #991b1b; }
.row-hotovo { background: rgba(16, 185, 129, 0.04); }
.row-chyba { background: rgba(239, 68, 68, 0.04); }

/* --------------------------------------------------------------------------
   24. Trend Arrows
   -------------------------------------------------------------------------- */
.trend-up { color: var(--success); font-size: 0.75rem; }
.trend-down { color: var(--danger); font-size: 0.75rem; }
.trend-same { color: var(--text-muted); font-size: 0.75rem; }

/* --------------------------------------------------------------------------
   25. Warnings Panel
   -------------------------------------------------------------------------- */
.warnings-panel {
  background: #fffbeb;
  border: 1px solid #fbbf24;
  border-radius: var(--card-radius);
  padding: var(--sp-4);
  margin-bottom: 1rem;
}

.warning-item {
  font-size: 0.8125rem;
  padding: 4px 0;
  border-bottom: 1px solid rgba(245, 158, 11, 0.2);
}

.warning-item:last-child {
  border-bottom: none;
}

/* --------------------------------------------------------------------------
   26. Vehicle Type Badges
   -------------------------------------------------------------------------- */
.badge-skrina { background: #dbeafe; color: #1e40af; }
.badge-plachta { background: #fef3c7; color: #92400e; }
.badge-chladiacka { background: #d1fae5; color: #065f46; }
.badge-fiat_doblo { background: #cffafe; color: #155e75; }

/* --------------------------------------------------------------------------
   27. Ticket System — Podpora
   -------------------------------------------------------------------------- */

/* Category badges */
.badge-kat-otazka { background: var(--accent-light); color: #1e40af; }
.badge-kat-chyba { background: var(--danger-light); color: #991b1b; }
.badge-kat-nezrovnalost { background: #fef3c7; color: #92400e; }
.badge-kat-ine { background: var(--bg); color: var(--text-secondary); }

/* Status badges */
.badge-stav-nova { background: #dbeafe; color: #1e40af; }
.badge-stav-rozpracovana { background: #fffbeb; color: #92400e; }
.badge-stav-uzavreta { background: #ecfdf5; color: #065f46; }

/* Priority badges */
.badge-prio-nizka { background: #ecfdf5; color: #065f46; }
.badge-prio-stredna { background: #fffbeb; color: #92400e; }
.badge-prio-vysoka { background: var(--danger-light); color: #991b1b; }

/* Closed ticket rows */
.row-ticket-closed td { opacity: 0.6; }

/* Filter tabs */
.filter-tabs {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.filter-tab {
  padding: var(--sp-2) var(--sp-4);
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-tab:hover {
  background: var(--bg);
  color: var(--text);
}

.filter-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Sidebar badge counter */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 0.6875rem;
  font-weight: 700;
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  margin-left: auto;
}

/* Ticket detail / description */
.ticket-description {
  background: var(--bg);
  padding: var(--sp-4);
  border-radius: 6px;
  font-size: 0.875rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* Comment thread */
.comment-thread {
  border-top: 1px solid var(--border);
  padding-top: var(--sp-4);
}

.comment-item {
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-2);
  border-radius: 6px;
  background: var(--bg);
  border-left: 3px solid var(--border);
}

.comment-item.comment-admin {
  border-left-color: var(--accent);
  background: rgba(37, 99, 235, 0.04);
}

.comment-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: var(--sp-1);
}

.comment-text {
  font-size: 0.875rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* ==========================================================================
   KARTOTÉKA — Driver Registry
   ========================================================================== */

/* ---------- Page header actions ---------- */
.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

/* ---------- View toggle ---------- */
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 34px;
  background: var(--card-bg);
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.view-btn:hover { background: var(--bg); }
.view-btn.active { background: var(--accent); color: #fff; }
.view-btn + .view-btn { border-left: 1px solid var(--border); }

/* ---------- Driver cards grid ---------- */
.driver-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: var(--sp-5);
}

.driver-card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.driver-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
}

.driver-card-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-4) var(--sp-2);
}

.driver-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9375rem;
  flex-shrink: 0;
  color: var(--accent);
  background: var(--accent-light);
}

.driver-card-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.3;
}

.driver-card-status {
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}
.driver-card-status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.dot-active { background: var(--success); }
.dot-inactive { background: var(--text-muted); }

.driver-card-body {
  padding: var(--sp-2) var(--sp-4);
  flex: 1;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px var(--sp-3);
  font-size: 0.8125rem;
  align-content: start;
}
.driver-card-body .label {
  color: var(--text-muted);
  white-space: nowrap;
}
.driver-card-body .value {
  color: var(--text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.driver-card-footer {
  padding: var(--sp-2) var(--sp-4) var(--sp-3);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-top: auto;
}

/* ---------- MACRON badges ---------- */
.macron-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  white-space: nowrap;
}
.macron-ok      { background: var(--success-light); color: #047857; }
.macron-warning { background: var(--warning-light); color: #92400e; }
.macron-danger  { background: var(--danger-light);  color: #b91c1c; }
.macron-expired { background: #f1f5f9; color: #64748b; }
.macron-none    { background: #f8fafc; color: #94a3b8; }

.doc-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ---------- Driver profile ---------- */
.driver-profile {
  max-width: 1000px;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  padding: var(--sp-6);
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  margin-bottom: var(--sp-5);
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.5rem;
  flex-shrink: 0;
  color: var(--accent);
  background: var(--accent-light);
}

.profile-info { flex: 1; }
.profile-name {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.profile-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.profile-actions {
  display: flex;
  gap: var(--sp-2);
  flex-shrink: 0;
}

/* ---------- Profile tabs ---------- */
.profile-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: var(--sp-5);
  overflow-x: auto;
}
.profile-tab {
  padding: var(--sp-3) var(--sp-5);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}
.profile-tab:hover { color: var(--text); }
.profile-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.profile-tab-content {
  display: none;
}
.profile-tab-content.active {
  display: block;
}

/* ---------- Info grid (profile detail) ---------- */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-4);
}
.info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.info-item .label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.info-item .value {
  font-size: 0.9375rem;
  color: var(--text);
  font-weight: 500;
}

/* ---------- MACRON status card (big) ---------- */
.macron-status-card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: var(--sp-6);
  margin-bottom: var(--sp-5);
  display: flex;
  align-items: center;
  gap: var(--sp-6);
}
.macron-countdown {
  text-align: center;
  min-width: 100px;
}
.macron-countdown .days {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
}
.macron-countdown .days-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.macron-details {
  flex: 1;
}
.macron-details .ref {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: var(--sp-2);
}
.macron-details .dates {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* ---------- Document upload zone ---------- */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--card-radius);
  padding: var(--sp-6);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: var(--sp-5);
  background: var(--bg);
}
.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.upload-zone-icon {
  font-size: 2rem;
  margin-bottom: var(--sp-2);
  color: var(--text-muted);
}
.upload-zone-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.upload-zone-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--sp-1);
}

/* ---------- Document cards ---------- */
.doc-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-4);
}
.doc-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.doc-card:hover {
  box-shadow: var(--card-shadow-hover);
}
.doc-card-preview {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  overflow: hidden;
}
.doc-card-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
}
.doc-card-preview .pdf-icon {
  font-size: 2.5rem;
  color: var(--danger);
}
.doc-card-info {
  padding: var(--sp-3);
}
.doc-card-name {
  font-size: 0.8125rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}
.doc-card-meta {
  font-size: 0.6875rem;
  color: var(--text-muted);
}
.doc-card-actions {
  display: flex;
  gap: var(--sp-2);
  padding: 0 var(--sp-3) var(--sp-3);
}

/* ---------- Modal wide variant ---------- */
.modal-wide {
  max-width: 640px;
}

/* ---------- Modal collapsible sections ---------- */
.modal-section {
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: var(--sp-3);
  overflow: hidden;
}
.modal-section > summary {
  padding: var(--sp-3) var(--sp-4);
  font-weight: 600;
  font-size: 0.8125rem;
  cursor: pointer;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.modal-section > summary::before {
  content: '\25B6';
  font-size: 0.625rem;
  transition: transform 0.2s;
}
.modal-section[open] > summary::before {
  transform: rotate(90deg);
}
.modal-section[open] > summary {
  border-bottom-color: var(--border);
}
.modal-section > summary::-webkit-details-marker { display: none; }
.modal-section > :not(summary) {
  padding: var(--sp-3) var(--sp-4);
}

/* ---------- Profile back button ---------- */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: var(--sp-2) var(--sp-3);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: var(--sp-4);
}
.btn-back:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .driver-cards-grid {
    grid-template-columns: 1fr;
  }
  .profile-header {
    flex-direction: column;
    text-align: center;
  }
  .profile-actions {
    justify-content: center;
  }
  .info-grid {
    grid-template-columns: 1fr;
  }
  .page-header-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .view-toggle { align-self: flex-end; }
}

/* ── Fleet: Date warning classes ─────────────────────── */
.date-expired {
  background-color: rgba(239, 68, 68, 0.15);
  color: #dc2626;
  font-weight: 600;
}
.date-warning-30 {
  background-color: rgba(234, 179, 8, 0.15);
  color: #a16207;
  font-weight: 600;
}
.date-warning-60 {
  background-color: rgba(249, 115, 22, 0.12);
  color: #c2410c;
}
.zaruka-off {
  opacity: 0.5;
  text-decoration: line-through;
}
.badge-zaruka-off {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.1em 0.4em;
  border-radius: 3px;
  background: #e5e7eb;
  color: #6b7280;
  vertical-align: middle;
  margin-left: 0.3em;
  text-decoration: none;
}
.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 0.4em;
  cursor: pointer;
}
.checkbox-inline input[type="checkbox"] {
  margin: 0;
}

/* ── Fleet: Stav badges ──────────────────────────────── */
.badge-stav-nova {
  background-color: #dbeafe;
  color: #1e40af;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
}
.badge-stav-rozpracovana {
  background-color: #fef3c7;
  color: #92400e;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
}
.badge-stav-ukoncena {
  background-color: #d1fae5;
  color: #065f46;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* ── Fleet: Alert cards ──────────────────────────────── */
.fleet-alert-cards {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}
.alert-card {
  flex: 1;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface-card);
}
.alert-card-danger {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
}
.alert-card-warning {
  background: rgba(234, 179, 8, 0.08);
  border-color: rgba(234, 179, 8, 0.3);
}
.alert-card-ok {
  background: rgba(34, 197, 94, 0.06);
  border-color: rgba(34, 197, 94, 0.2);
}
.alert-card-count {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
}
.alert-card-danger .alert-card-count { color: #dc2626; }
.alert-card-warning .alert-card-count { color: #d97706; }
.alert-card-ok .alert-card-count { color: #16a34a; }
.alert-card-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ── Fleet: Sidebar badge ────────────────────────────── */
.fleet-badge {
  background: #ef4444;
  color: #fff;
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 9999px;
  margin-left: 0.5rem;
  font-weight: 600;
}

/* ── Fleet: Workflow timeline ────────────────────────── */
.pu-timeline {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin: 1rem 0;
  position: relative;
}
.timeline-step {
  flex: 1;
  text-align: center;
  position: relative;
  padding-top: 2rem;
}
.timeline-step::before {
  content: '';
  position: absolute;
  top: 0.75rem;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
}
.timeline-step:first-child::before { left: 50%; }
.timeline-step:last-child::before { right: 50%; }
.timeline-step.done::before { background: #22c55e; }
.timeline-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid #fff;
  position: absolute;
  top: calc(0.75rem - 7px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
}
.timeline-step.done .timeline-dot {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}
.timeline-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}
.timeline-date {
  font-size: 0.8rem;
  font-weight: 500;
}
.timeline-step.done .timeline-date { color: #15803d; }
.timeline-step.pending .timeline-date { color: var(--text-muted); }

/* ── Fleet: 3-column stats grid ──────────────────────── */
.stats-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

/* ── Fleet: Vehicle detail ───────────────────────────── */
.vehicle-detail .info-item .label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}
.vehicle-detail .info-item .value {
  display: block;
  font-size: 0.9rem;
}
.vehicle-incidents-mini {
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .fleet-alert-cards { flex-direction: column; }
  .pu-timeline { flex-direction: column; gap: 0.5rem; }
  .timeline-step { padding-top: 0; padding-left: 2rem; text-align: left; }
  .timeline-step::before { top: 0; bottom: 0; left: 0.75rem; width: 2px; height: auto; right: auto; }
  .timeline-step:first-child::before { top: 50%; }
  .timeline-step:last-child::before { bottom: 50%; }
  .timeline-dot { top: 50%; left: calc(0.75rem - 7px); transform: translateY(-50%); }
  .stats-grid-3 { grid-template-columns: 1fr; }
}

/* ---------- Drivers table compact ---------- */
.drivers-table-compact {
  font-size: 0.8125rem;
}
.drivers-table-compact th,
.drivers-table-compact td {
  padding: 0.5rem 0.625rem;
  white-space: nowrap;
}
.drivers-table-compact td:first-child {
  white-space: normal;
  min-width: 140px;
}
.drivers-table-compact tr:hover {
  background: var(--accent-light);
}
.drivers-table-compact .macron-badge {
  font-size: 0.6875rem;
  padding: 2px 6px;
}

/* ---------- PHM cards grid (vehicle detail) ---------- */
.phm-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}
.phm-card-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.phm-provider {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.phm-number {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  font-family: var(--font-mono);
}

/* ---------- Vignette checkmark ---------- */
.vignette-ok {
  color: var(--success);
  font-weight: 700;
  font-size: 1.1rem;
}

/* ---------- Driver card (karta vodiča) badges ---------- */
.badge-karta-ma {
  background: var(--success-light);
  color: #065f46;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}
.badge-karta-ziadost {
  background: var(--warning-light);
  color: #92400e;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

/* ── PU: Condensed Excel-like table ──────────────────── */

/* 6-column stats grid */
.pu-stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.pu-stats-grid .stat-card {
  padding: 0.75rem;
}
.pu-stats-grid .stat-value {
  font-size: 1.25rem;
}
.pu-stats-grid .stat-label {
  font-size: 0.6875rem;
}

/* Summary card accents */
.pu-card-nova { border-left: 3px solid #3b82f6; }
.pu-card-rozpracovana { border-left: 3px solid #f59e0b; }
.pu-card-ukoncena { border-left: 3px solid #22c55e; }
.pu-card-overdue { border-left: 3px solid #ef4444; background: #fef2f2; }
.pu-card-overdue .stat-value { color: #dc2626; }

/* Compact spreadsheet table */
.pu-table-compact {
  font-size: 0.75rem;
  border-collapse: collapse;
  width: 100%;
}
.pu-table-compact th,
.pu-table-compact td {
  padding: 0.3rem 0.5rem;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.pu-table-compact thead th {
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 2;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  padding: 0.4rem 0.5rem;
}
.pu-table-compact .pu-th-wf {
  text-align: center;
  min-width: 60px;
}
.pu-table-compact .pu-th-note {
  min-width: 120px;
  max-width: 200px;
}
.pu-table-compact .pu-th-actions {
  width: 50px;
}

/* Row styling */
.pu-row:hover {
  background: var(--accent-light, #f0f9ff);
}
.pu-row-done {
  opacity: 0.7;
}
.pu-row-done:hover {
  opacity: 1;
}

/* Cell types */
.pu-cell-date {
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}
.pu-cell-mono {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.6875rem;
}
.pu-cell-ecv {
  letter-spacing: 0.03em;
}
.pu-cell-cost {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.pu-cell-note {
  max-width: 200px;
  overflow: hidden;
}
.pu-cell-actions {
  white-space: nowrap;
  text-align: center;
}

/* Note trigger — resembles Excel comment indicator */
.pu-note-trigger {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
  cursor: pointer;
  position: relative;
  padding-right: 8px;
  font-size: 0.6875rem;
  color: var(--text-secondary);
}
.pu-note-trigger::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-top: 6px solid #ef4444;
}
.pu-note-trigger.pu-note-expanded {
  white-space: pre-wrap;
  max-width: none;
  overflow: visible;
  background: #fffbeb;
  padding: 0.25rem 0.4rem;
  border-radius: 3px;
  border: 1px solid #fcd34d;
  z-index: 5;
  position: relative;
}

/* Inline date editing */
.pu-inline-date {
  cursor: pointer;
}
.pu-inline-date:hover {
  outline: 2px solid var(--accent, #3b82f6);
  outline-offset: -2px;
  border-radius: 2px;
}
.pu-inline-input {
  width: 100%;
  min-width: 110px;
  padding: 0.15rem 0.25rem;
  font-size: 0.75rem;
  border: 2px solid var(--accent, #3b82f6);
  border-radius: 3px;
  background: #fff;
  font-family: inherit;
  box-sizing: border-box;
}
.pu-inline-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}
.pu-inline-note {
  cursor: pointer;
}
.pu-inline-note:hover {
  outline: 2px solid var(--accent, #3b82f6);
  outline-offset: -2px;
  border-radius: 2px;
}
.pu-inline-textarea {
  width: 100%;
  min-width: 160px;
  padding: 0.2rem 0.3rem;
  font-size: 0.75rem;
  border: 2px solid var(--accent, #3b82f6);
  border-radius: 3px;
  background: #fff;
  font-family: inherit;
  box-sizing: border-box;
  resize: vertical;
  white-space: pre-wrap;
}
.pu-inline-textarea:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}
.pu-note-empty {
  color: var(--text-muted, #94a3b8);
}

/* Excel-style comment indicator (blue triangle) */
.pu-has-comment {
  position: relative;
}
.pu-comment-indicator {
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-right: 8px solid #3b82f6;
  border-bottom: 8px solid transparent;
  cursor: pointer;
  z-index: 3;
}
.pu-comment-indicator:hover {
  border-right-color: #1d4ed8;
}

/* Comment popup (attached to body, no overflow issues) */
.pu-comment-popup {
  position: fixed;
  z-index: 1000;
  width: 340px;
  background: #fefce8;
  border: 1px solid #d4a017;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  font-size: 0.8125rem;
}
.pu-comment-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #e5d08c;
  font-size: 0.75rem;
}
.pu-comment-popup-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-secondary);
  line-height: 1;
  padding: 0 0.25rem;
}
.pu-comment-popup-close:hover {
  color: var(--text);
}
.pu-comment-popup-text {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  box-sizing: border-box;
  white-space: pre-wrap;
}
.pu-comment-popup-text:focus {
  outline: none;
  background: #fff;
}
.pu-comment-popup-footer {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 0.4rem 0.75rem;
  border-top: 1px solid #e5d08c;
}

/* Conditional formatting — workflow date cells */
.pu-wf-done {
  background: #d1fae5 !important;
  color: #065f46;
  text-align: center;
  font-weight: 500;
}
.pu-wf-warning {
  background: #fef3c7 !important;
  color: #92400e;
  text-align: center;
  font-weight: 600;
}
.pu-wf-danger {
  background: #fee2e2 !important;
  color: #991b1b;
  text-align: center;
  font-weight: 700;
}

/* Icon-size action buttons */
.btn-xs {
  padding: 0.125rem 0.375rem;
  font-size: 0.75rem;
  line-height: 1;
  border-radius: 3px;
}
.btn-icon {
  background: none;
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-secondary);
  opacity: 0.5;
  transition: opacity 0.15s;
}
.btn-icon:hover {
  opacity: 1;
  background: var(--bg-secondary);
}
.btn-icon-danger:hover {
  color: #dc2626;
  border-color: #fca5a5;
  background: #fef2f2;
}
.pu-row:hover .btn-icon {
  opacity: 0.8;
}

@media (max-width: 1200px) {
  .pu-stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 768px) {
  .pu-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .pu-table-compact {
    font-size: 0.6875rem;
  }
  .pu-table-compact th,
  .pu-table-compact td {
    padding: 0.25rem 0.3rem;
  }
}
