/* ============================================================
   TachoTrack Pro - Main Stylesheet
   Light / Dark Theme with CSS Variables
   ============================================================ */

/* ---- CSS Variables (Light Theme) ---- */
:root {
  --color-primary:      #1a6fc4;
  --color-primary-dark: #1459a0;
  --color-primary-light:#e8f0fb;
  --color-secondary:    #2d9e6b;
  --color-accent:       #f59e0b;
  --color-danger:       #dc2626;
  --color-danger-light: #fef2f2;
  --color-warning:      #d97706;
  --color-warning-light:#fffbeb;
  --color-success:      #16a34a;
  --color-success-light:#f0fdf4;
  --color-info:         #0369a1;
  --color-info-light:   #f0f9ff;

  --bg-base:     #f5f7fa;
  --bg-surface:  #ffffff;
  --bg-elevated: #ffffff;
  --bg-subtle:   #f0f2f5;
  --bg-overlay:  rgba(0,0,0,0.5);

  --text-primary:   #111827;
  --text-secondary: #4b5563;
  --text-muted:     #9ca3af;
  --text-inverse:   #ffffff;

  --border-color:  #e5e7eb;
  --border-radius: 8px;
  --border-radius-lg: 12px;
  --border-radius-sm: 4px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
  --shadow-md:  0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:  0 10px 30px rgba(0,0,0,.12);

  --sidebar-width: 260px;
  --topbar-height: 60px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  --transition: 0.2s ease;

  /* Timer colors */
  --timer-ok:      #16a34a;
  --timer-warn:    #d97706;
  --timer-danger:  #dc2626;
  --timer-neutral: #6b7280;
}

/* ---- Dark Theme ---- */
[data-theme="dark"] {
  --bg-base:     #0f1117;
  --bg-surface:  #1a1d27;
  --bg-elevated: #222535;
  --bg-subtle:   #2a2d3a;
  --bg-overlay:  rgba(0,0,0,0.7);

  --text-primary:   #f1f3f9;
  --text-secondary: #a0aabf;
  --text-muted:     #5a6380;
  --text-inverse:   #111827;

  --border-color:  #2e3347;

  --color-primary:      #4d9de0;
  --color-primary-dark: #3a7cc4;
  --color-primary-light:#1a2a3f;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.3);
  --shadow-md:  0 4px 12px rgba(0,0,0,.35);
  --shadow-lg:  0 10px 30px rgba(0,0,0,.4);

  --timer-ok:     #22c55e;
  --timer-warn:   #f59e0b;
  --timer-danger: #ef4444;
}

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

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

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

a { color: var(--color-primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-primary-dark); }

img { max-width: 100%; height: auto; }

/* ---- Typography ---- */
h1 { font-size: 1.875rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.5rem;   font-weight: 600; line-height: 1.3; }
h3 { font-size: 1.25rem;  font-weight: 600; }
h4 { font-size: 1.125rem; font-weight: 600; }
h5 { font-size: 1rem;     font-weight: 600; }

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

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
  box-shadow: var(--shadow-sm);
}

.sidebar-logo {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-logo img { width: 36px; height: 36px; }
.sidebar-logo span { font-size: 1.1rem; font-weight: 700; color: var(--color-primary); }

.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.75rem 1.5rem 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 0;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--bg-subtle);
  color: var(--color-primary);
}

.nav-item.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 600;
  border-right: 3px solid var(--color-primary);
}

.nav-item .nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
}

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-left { display: flex; align-items: center; gap: 1rem; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; }

.topbar-title { font-size: 1.1rem; font-weight: 600; }

.page-content {
  flex: 1;
  padding: 1.75rem;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title { font-size: 1.5rem; font-weight: 700; }
.page-subtitle { font-size: 0.875rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ---- Cards ---- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.card-title { font-size: 1rem; font-weight: 600; }

.card-body { padding: 1.25rem; }

.card-footer {
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-subtle);
}

/* ---- Stat Cards ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--border-radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 1.5rem;
}

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

.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--border-radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.5;
  font-family: var(--font-sans);
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary   { background: var(--color-primary);   color: #fff; border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }

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

.btn-success   { background: var(--color-success); color: #fff; }
.btn-success:hover { filter: brightness(0.9); }

.btn-danger    { background: var(--color-danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.9); }

.btn-warning   { background: var(--color-accent); color: #fff; }

.btn-outline   { background: transparent; border-color: var(--border-color); color: var(--text-primary); }
.btn-outline:hover { background: var(--bg-subtle); }

.btn-sm  { padding: 0.3rem 0.75rem; font-size: 0.8rem; }
.btn-lg  { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-xl  { padding: 1rem 2rem; font-size: 1.1rem; font-weight: 600; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; height: 36px; padding: 0; }

/* Activity Buttons */
.activity-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 1rem;
  border-radius: var(--border-radius-lg);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 600;
  font-size: 0.85rem;
  min-width: 90px;
  min-height: 80px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-family: var(--font-sans);
}
.activity-btn .icon { font-size: 1.75rem; }
.activity-btn:hover  { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.activity-btn.active { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: currentColor; }

.activity-btn.driving  { color: #1a6fc4; }
.activity-btn.driving.active  { background: #e8f0fb; border-color: #1a6fc4; }
.activity-btn.rest     { color: #16a34a; }
.activity-btn.rest.active     { background: #f0fdf4; border-color: #16a34a; }
.activity-btn.work     { color: #d97706; }
.activity-btn.work.active     { background: #fffbeb; border-color: #d97706; }
.activity-btn.poa      { color: #7c3aed; }
.activity-btn.poa.active      { background: #f5f3ff; border-color: #7c3aed; }
.activity-btn.oos      { color: #6b7280; }
.activity-btn.oos.active      { background: #f9fafb; border-color: #6b7280; }

[data-theme="dark"] .activity-btn.driving.active  { background: #1a2a3f; }
[data-theme="dark"] .activity-btn.rest.active     { background: #0f2a1a; }
[data-theme="dark"] .activity-btn.work.active     { background: #2a1f0a; }
[data-theme="dark"] .activity-btn.poa.active      { background: #1e1535; }

/* ---- Timer Display ---- */
.timer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.timer-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1rem;
  position: relative;
  overflow: hidden;
}

.timer-item::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--timer-ok);
  transition: width var(--transition), background var(--transition);
}
.timer-item.warn::before  { background: var(--timer-warn); }
.timer-item.danger::before { background: var(--timer-danger); }

.timer-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.timer-value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; font-family: var(--font-mono); color: var(--timer-ok); margin: 0.25rem 0; }
.timer-item.warn  .timer-value  { color: var(--timer-warn); }
.timer-item.danger .timer-value { color: var(--timer-danger); }
.timer-max { font-size: 0.75rem; color: var(--text-muted); }

.timer-progress {
  height: 4px;
  background: var(--bg-subtle);
  border-radius: 2px;
  margin-top: 0.5rem;
  overflow: hidden;
}
.timer-progress-bar {
  height: 100%;
  background: var(--timer-ok);
  border-radius: 2px;
  transition: width 1s linear, background var(--transition);
}
.timer-item.warn  .timer-progress-bar { background: var(--timer-warn); }
.timer-item.danger .timer-progress-bar { background: var(--timer-danger); }

/* ---- Speed Display ---- */
.speed-display {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 1.25rem;
  text-align: center;
}

.speed-value {
  font-size: 3rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1;
}

.speed-value.violation { color: var(--timer-danger); }
.speed-value.warning   { color: var(--timer-warn); }
.speed-unit { font-size: 0.9rem; color: var(--text-muted); }

/* ---- Forms ---- */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}
.form-label.required::after { content: ' *'; color: var(--color-danger); }

.form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  line-height: 1.5;
}

.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(26,111,196,0.12);
}

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

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.3rem; }
.form-error { font-size: 0.78rem; color: var(--color-danger); margin-top: 0.3rem; }
.form-control.is-invalid { border-color: var(--color-danger); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ---- Tables ---- */
.table-wrapper { overflow-x: auto; }

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

thead th {
  background: var(--bg-subtle);
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  color: var(--text-primary);
}

tbody tr:hover { background: var(--bg-subtle); }
tbody tr:last-child td { border-bottom: none; }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-success  { background: var(--color-success-light); color: var(--color-success); }
.badge-warning  { background: var(--color-warning-light); color: var(--color-warning); }
.badge-danger   { background: var(--color-danger-light);  color: var(--color-danger); }
.badge-info     { background: var(--color-info-light);    color: var(--color-info); }
.badge-neutral  { background: var(--bg-subtle);           color: var(--text-muted); }
.badge-primary  { background: var(--color-primary-light); color: var(--color-primary); }

/* ---- Alerts ---- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}

.alert-success { background: var(--color-success-light); color: #14532d; border-color: #bbf7d0; }
.alert-warning { background: var(--color-warning-light); color: #78350f; border-color: #fde68a; }
.alert-danger  { background: var(--color-danger-light);  color: #7f1d1d; border-color: #fecaca; }
.alert-info    { background: var(--color-info-light);    color: #075985; border-color: #bae6fd; }

/* ---- Pagination ---- */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--border-radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  transition: all var(--transition);
  cursor: pointer;
  background: var(--bg-surface);
}

.page-link:hover { background: var(--bg-subtle); color: var(--color-primary); }
.page-link.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.page-link.disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-surface);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(-20px);
  transition: transform var(--transition);
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 1.1rem; font-weight: 600; }
.modal-body  { padding: 1.25rem; }
.modal-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border-color); display: flex; gap: 0.75rem; justify-content: flex-end; }

/* ---- Auth Pages ---- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  padding: 1rem;
}

.auth-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
}

.auth-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-logo img { width: 56px; height: 56px; margin-bottom: 0.75rem; }
.auth-logo h1  { font-size: 1.5rem; font-weight: 700; color: var(--color-primary); }
.auth-logo p   { font-size: 0.875rem; color: var(--text-muted); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

/* ---- Public / Landing ---- */
.public-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.public-logo { display: flex; align-items: center; gap: 0.75rem; }
.public-logo img { width: 36px; }
.public-logo span { font-size: 1.15rem; font-weight: 700; color: var(--color-primary); }

.public-nav { display: flex; align-items: center; gap: 1rem; }

.hero {
  padding: 2.5rem 2rem 2rem;
  text-align: center;
  max-width: 760px;
  margin: 0 auto;
}

.hero h1 { font-size: 2rem; margin-bottom: 0.6rem; }
.hero p   { font-size: 1rem; color: var(--text-secondary); margin-bottom: 1.25rem; }

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  padding: 1.5rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.feature-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 1.1rem 1.25rem;
  text-align: center;
}

.feature-icon { font-size: 1.75rem; margin-bottom: 0.5rem; }
.feature-card h3 { margin-bottom: 0.3rem; font-size: .95rem; }
.feature-card p  { color: var(--text-secondary); font-size: 0.82rem; line-height: 1.5; }

/* ---- Driver Panel Specifics ---- */
.driver-panel {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1.25rem;
}

.activity-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.shift-status {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.shift-info { display: flex; flex-direction: column; gap: 0.25rem; }
.shift-info .label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; }
.shift-info .value { font-size: 1rem; font-weight: 600; }

.location-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 99px;
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
}

/* ---- Warning Toast ---- */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 360px;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 0.875rem 1rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  animation: slideIn 0.3s ease;
  border-left: 4px solid var(--border-color);
}

.toast.warn    { border-left-color: var(--color-warning); }
.toast.danger  { border-left-color: var(--color-danger);  }
.toast.success { border-left-color: var(--color-success); }
.toast.info    { border-left-color: var(--color-info);    }

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

/* ---- Theme Toggle ---- */
.theme-toggle {
  width: 40px; height: 22px;
  background: var(--border-color);
  border-radius: 99px;
  position: relative;
  cursor: pointer;
  transition: background var(--transition);
  border: none;
}

.theme-toggle.on { background: var(--color-primary); }

.theme-toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition);
}

.theme-toggle.on::after { transform: translateX(18px); }

/* ---- Misc Utilities ---- */
.text-muted    { color: var(--text-muted) !important; }
.text-primary  { color: var(--color-primary) !important; }
.text-success  { color: var(--color-success) !important; }
.text-warning  { color: var(--color-warning) !important; }
.text-danger   { color: var(--color-danger) !important; }
.text-sm       { font-size: 0.875rem; }
.text-xs       { font-size: 0.75rem; }
.text-lg       { font-size: 1.125rem; }
.font-bold     { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-mono     { font-family: var(--font-mono); }

.d-flex       { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.p-0  { padding: 0; }

.w-full  { width: 100%; }
.hidden  { display: none !important; }
.visible { display: block !important; }

.cursor-pointer { cursor: pointer; }
.select-none    { user-select: none; }

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

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .driver-panel { grid-template-columns: 1fr; }
}

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

  .sidebar {
    transform: translateX(-260px);
    width: 260px;
  }

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

  .main-content { margin-left: 0; }

  .page-content { padding: 1rem; }

  .form-row { grid-template-columns: 1fr; }
  .form-row.cols-3 { grid-template-columns: 1fr; }

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

  h1 { font-size: 1.5rem; }

  .auth-card { padding: 1.5rem; }

  .hero h1 { font-size: 1.875rem; }
}

@media (max-width: 480px) {
  .timer-grid { grid-template-columns: 1fr; }
  .stat-grid  { grid-template-columns: 1fr 1fr; }
  .activity-bar { justify-content: center; }
}

/* ---- Print Styles (56-Day Report) ---- */
@media print {
  .sidebar, .topbar, .btn, .no-print { display: none !important; }
  .main-content { margin-left: 0 !important; }
  body { background: white; color: black; font-size: 11px; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  .page-break { page-break-before: always; }
}
