
/* =====================================================
   FleetPro — Main Stylesheet
   ===================================================== */

/* ---- CSS Variables ---- */
:root {
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 68px;
  --navbar-height: 60px;
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --success: #28a745;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #17a2b8;
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --text: #212529;
  --text-muted: #6c757d;
  --border: #dee2e6;
  --sidebar-bg: #1e2a3a;
  --sidebar-text: #c8d6e5;
  --sidebar-active: #1a73e8;
  --sidebar-hover: rgba(255,255,255,0.08);
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.25s ease;
}

/* ---- Dark Mode ---- */
[data-theme="dark"] {
  --bg: #0f1117;
  --card-bg: #1a1d27;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --border: #2d3748;
  --sidebar-bg: #0d1117;
  --sidebar-text: #94a3b8;
  --sidebar-hover: rgba(255,255,255,0.05);
  --shadow: 0 2px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
}

[data-theme="dark"] .modal-content { background: #1a1d27; color: var(--text); }
[data-theme="dark"] .modal-header { border-color: var(--border); }
[data-theme="dark"] .modal-footer { border-color: var(--border); }
[data-theme="dark"] .form-control, [data-theme="dark"] .form-select {
  background: #2d3748; border-color: #4a5568; color: var(--text);
}
[data-theme="dark"] .form-control:focus, [data-theme="dark"] .form-select:focus {
  background: #2d3748; border-color: var(--primary); color: var(--text);
}
[data-theme="dark"] .dropdown-menu { background: #1a1d27; border-color: var(--border); }
[data-theme="dark"] .dropdown-item { color: var(--text); }
[data-theme="dark"] .dropdown-item:hover { background: rgba(255,255,255,0.05); }
[data-theme="dark"] .table { color: var(--text); }
[data-theme="dark"] .table-hover tbody tr:hover { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .breadcrumb-item a { color: var(--primary); }

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; padding: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s, color 0.3s;
  font-size: 0.9rem;
}

/* ---- Loading Screen ---- */
.loading-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #1e2a3a 0%, #1a73e8 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}
.loading-content { text-align: center; color: white; }
.loading-logo i { display: block; margin: 0 auto 12px; }
.loading-logo h2 { color: white !important; font-size: 2rem; margin: 0; }
.loading-logo p { color: rgba(255,255,255,0.7) !important; margin: 4px 0 0; }
.loading-bar { width: 260px; height: 4px; background: rgba(255,255,255,0.2); border-radius: 4px; overflow: hidden; margin: 0 auto; }
.loading-bar-fill { height: 100%; background: white; width: 0%; border-radius: 4px; transition: width 0.4s ease; }
.loading-text { color: rgba(255,255,255,0.6) !important; font-size: 0.8rem; }

/* ---- Install Prompt ---- */
.install-prompt {
  position: fixed;
  right: 18px;
  bottom: 88px;
  z-index: 1090;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto 28px;
  align-items: center;
  gap: 12px;
  width: min(520px, calc(100vw - 32px));
  padding: 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}
.install-prompt-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(26,115,232,0.12);
  color: var(--primary);
}
.install-prompt-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}
.install-prompt-copy strong {
  font-size: 0.9rem;
  line-height: 1.2;
}
.install-prompt-copy span {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.25;
}
.install-prompt-close {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
}
.install-prompt-close:hover,
.install-prompt-close:focus {
  color: var(--text);
}

/* ---- App Wrapper ---- */
.app-wrapper { display: flex; min-height: 100vh; position: relative; }

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 1000;
  display: flex; flex-direction: column;
  transition: width 0.3s ease;
  overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-collapsed-width); }
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .sidebar-label,
.sidebar.collapsed .sidebar-search,
.sidebar.collapsed .sidebar-footer-info { display: none; }
.sidebar.collapsed .sidebar-brand { justify-content: center; }

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  min-height: var(--navbar-height);
}
.sidebar-brand-icon { font-size: 1.4rem; color: var(--primary); flex-shrink: 0; }
.sidebar-brand-text { font-size: 1.1rem; font-weight: 700; color: white; white-space: nowrap; }
.sidebar-toggle-btn { color: var(--sidebar-text) !important; padding: 0; line-height: 1; }

.sidebar-search { padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.sidebar-search-input { font-size: 0.8rem; color: var(--sidebar-text) !important; padding: 4px 8px; }
.sidebar-search-input::placeholder { color: rgba(200,214,229,0.4); }
.sidebar-search-input:focus { box-shadow: none; }

.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 0; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.sidebar-menu { list-style: none; margin: 0; padding: 0; }
.sidebar-menu-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 8px 16px; }

.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 8px;
  margin: 2px 8px;
  transition: var(--transition);
  white-space: nowrap;
  font-size: 0.875rem;
}
.sidebar-link:hover { background: var(--sidebar-hover); color: white; }
.sidebar-link.active { background: var(--primary); color: white; }
.sidebar-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-badge { font-size: 0.65rem; padding: 2px 6px; }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-footer-info { display: flex; align-items: center; gap: 6px; color: var(--sidebar-text); font-size: 0.75rem; }

/* Sidebar collapsed icon tooltips */
.sidebar.collapsed .sidebar-link { justify-content: center; padding: 12px; margin: 2px 4px; }
.sidebar.collapsed .sidebar-badge { display: none; }

/* ---- MAIN CONTENT ---- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex; flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}
.main-content.sidebar-collapsed { margin-left: var(--sidebar-collapsed-width); }

/* ---- TOP NAVBAR ---- */
.top-navbar {
  height: var(--navbar-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: sticky; top: 0; z-index: 900;
  box-shadow: var(--shadow);
  transition: background 0.3s;
}
.navbar-left { display: flex; align-items: center; gap: 12px; }
.navbar-center { flex: 1; max-width: 480px; margin: 0 auto; }
.navbar-right { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.navbar-toggle-btn, .navbar-icon-btn { color: var(--text-muted) !important; font-size: 1rem; padding: 8px; border-radius: 8px; }
.navbar-icon-btn:hover { background: var(--bg); color: var(--text) !important; }

.breadcrumb { font-size: 0.8rem; }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }

/* Global Search */
.global-search-wrapper { position: relative; width: 100%; }
.global-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 0.85rem; }
.global-search-input {
  width: 100%; padding: 8px 16px 8px 36px;
  border: 1px solid var(--border); border-radius: 24px;
  background: var(--bg); color: var(--text);
  font-size: 0.85rem; outline: none;
  transition: var(--transition);
}
.global-search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,115,232,0.15); }
.global-search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  max-height: 300px; overflow-y: auto; z-index: 999; display: none;
}
.search-result-item { padding: 10px 16px; cursor: pointer; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.search-result-item:hover { background: var(--bg); }
.search-result-item:last-child { border-bottom: none; }

/* Notification Dropdown */
.notification-badge {
  position: absolute; top: 4px; right: 4px;
  background: var(--danger); color: white;
  border-radius: 50%; width: 16px; height: 16px;
  font-size: 0.6rem; display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.notification-badge:empty, .notification-badge[data-count="0"] { display: none; }
.notification-dropdown { width: 340px; max-height: 420px; overflow: hidden; }
.notification-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.notification-list { max-height: 340px; overflow-y: auto; }
.notification-item { padding: 10px 16px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 0.82rem; }
.notification-item:hover { background: var(--bg); }
.notification-item.unread { background: rgba(26,115,232,0.06); }
.notification-item .notif-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; flex-shrink: 0; }

/* User Avatar */
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; font-weight: 700; }
.user-name { font-size: 0.875rem; font-weight: 500; }

.mobile-search-bar { padding: 10px 16px; background: var(--card-bg); border-bottom: 1px solid var(--border); }

/* ---- PAGE CONTENT ---- */
.page-content { padding: 20px; flex: 1; }
.page { display: none; }
.page.active { display: block; animation: fadeInPage 0.3s ease; }
@keyframes fadeInPage { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.page-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.page-title { font-size: 1.3rem; font-weight: 700; margin: 0; color: var(--text); }
.page-subtitle { margin: 2px 0 0; font-size: 0.8rem; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---- KPI CARDS ---- */
.kpi-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  border-top: 3px solid transparent;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.kpi-icon { font-size: 1.5rem; margin-bottom: 8px; opacity: 0.85; }
.kpi-value { font-size: 1.6rem; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.kpi-label { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.7; }

.kpi-blue { border-top-color: #1a73e8; color: #1a73e8; }
.kpi-blue .kpi-icon { color: #1a73e8; }
.kpi-green { border-top-color: #28a745; color: #28a745; }
.kpi-green .kpi-icon { color: #28a745; }
.kpi-yellow { border-top-color: #fd7e14; color: #fd7e14; }
.kpi-yellow .kpi-icon { color: #fd7e14; }
.kpi-red { border-top-color: #dc3545; color: #dc3545; }
.kpi-red .kpi-icon { color: #dc3545; }
.kpi-orange { border-top-color: #e67e22; color: #e67e22; }
.kpi-orange .kpi-icon { color: #e67e22; }
.kpi-purple { border-top-color: #8b5cf6; color: #8b5cf6; }
.kpi-purple .kpi-icon { color: #8b5cf6; }
.kpi-teal { border-top-color: #20c997; color: #20c997; }
.kpi-teal .kpi-icon { color: #20c997; }
.kpi-pink { border-top-color: #e83e8c; color: #e83e8c; }
.kpi-pink .kpi-icon { color: #e83e8c; }
.kpi-indigo { border-top-color: #6610f2; color: #6610f2; }
.kpi-indigo .kpi-icon { color: #6610f2; }
.kpi-cyan { border-top-color: #17a2b8; color: #17a2b8; }
.kpi-cyan .kpi-icon { color: #17a2b8; }
.kpi-lime { border-top-color: #52c41a; color: #52c41a; }
.kpi-lime .kpi-icon { color: #52c41a; }
.kpi-brown { border-top-color: #795548; color: #795548; }
.kpi-brown .kpi-icon { color: #795548; }

.kpi-value { color: var(--text) !important; }

/* ---- CHART CARDS ---- */
.chart-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  height: 100%;
  transition: background 0.3s;
}
.chart-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.chart-title { font-size: 0.9rem; font-weight: 600; margin: 0; color: var(--text); }
.chart-body { position: relative; height: 220px; }
.chart-body canvas { max-height: 220px; }

/* ---- CONTENT CARD ---- */
.content-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: background 0.3s;
}

/* ---- MINI STAT ---- */
.mini-stat { transition: var(--transition); cursor: default; border-radius: var(--radius-sm) !important; }
.mini-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

/* ---- DATATABLES CUSTOM ---- */
.dataTables_wrapper { font-size: 0.85rem; }
.dataTables_wrapper .dataTables_filter input { border-radius: 24px; padding: 5px 14px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.dataTables_wrapper .dataTables_length select { border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); padding: 4px 8px; }
.dataTables_wrapper .dt-buttons { margin-bottom: 8px; }
.dataTables_wrapper .dt-button { border-radius: 6px !important; font-size: 0.8rem !important; padding: 5px 12px !important; margin-right: 4px !important; }
table.dataTable tbody tr { background: var(--card-bg) !important; color: var(--text); }
table.dataTable tbody tr:hover { background: var(--bg) !important; }
table.dataTable thead th { background: var(--bg); color: var(--text); border-bottom: 2px solid var(--border) !important; font-weight: 600; font-size: 0.8rem; }
.dataTables_paginate .paginate_button { border-radius: 6px !important; }
.dataTables_paginate .paginate_button.current { background: var(--primary) !important; color: white !important; border-color: var(--primary) !important; }

/* ---- ACTION BUTTONS ---- */
.btn-action { padding: 4px 8px; font-size: 0.75rem; border-radius: 6px; }
.action-group { display: flex; gap: 4px; flex-wrap: nowrap; }

/* ---- STATUS BADGES ---- */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px;
}
.status-running { background: #d4edda; color: #155724; }
.status-idle { background: #fff3cd; color: #856404; }
.status-repair { background: #f8d7da; color: #721c24; }
.status-decommissioned { background: #e2e3e5; color: #383d41; }
.status-available { background: #d4edda; color: #155724; }
.status-on-trip { background: #cce5ff; color: #004085; }
.status-on-leave { background: #fff3cd; color: #856404; }
.status-inactive { background: #e2e3e5; color: #383d41; }
.status-completed { background: #d4edda; color: #155724; }
.status-pending { background: #fff3cd; color: #856404; }
.status-in-progress { background: #cce5ff; color: #004085; }
.status-scheduled { background: #d1ecf1; color: #0c5460; }
.status-open { background: #f8d7da; color: #721c24; }
.status-closed { background: #e2e3e5; color: #383d41; }
.status-pass { background: #d4edda; color: #155724; }
.status-fail { background: #f8d7da; color: #721c24; }

/* Doc expiry status */
.doc-valid { background: #d4edda; color: #155724; }
.doc-upcoming { background: #fff3cd; color: #856404; }
.doc-expired { background: #f8d7da; color: #721c24; }

[data-theme="dark"] .status-running { background: rgba(40,167,69,0.2); color: #75dd8e; }
[data-theme="dark"] .status-idle { background: rgba(255,193,7,0.2); color: #ffd54f; }
[data-theme="dark"] .status-repair { background: rgba(220,53,69,0.2); color: #f77; }
[data-theme="dark"] .status-available { background: rgba(40,167,69,0.2); color: #75dd8e; }
[data-theme="dark"] .status-on-trip { background: rgba(23,162,184,0.2); color: #56d4e8; }
[data-theme="dark"] .status-on-leave { background: rgba(255,193,7,0.2); color: #ffd54f; }
[data-theme="dark"] .status-completed { background: rgba(40,167,69,0.2); color: #75dd8e; }
[data-theme="dark"] .status-pending { background: rgba(255,193,7,0.2); color: #ffd54f; }
[data-theme="dark"] .status-in-progress { background: rgba(23,162,184,0.2); color: #56d4e8; }
[data-theme="dark"] .doc-valid { background: rgba(40,167,69,0.2); color: #75dd8e; }
[data-theme="dark"] .doc-upcoming { background: rgba(255,193,7,0.2); color: #ffd54f; }
[data-theme="dark"] .doc-expired { background: rgba(220,53,69,0.2); color: #f77; }

/* ---- FAB ---- */
.fab-container { position: fixed; bottom: 24px; right: 24px; z-index: 1050; display: flex; flex-direction: column-reverse; align-items: center; gap: 12px; }
.fab-main {
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--primary); color: white; border: none;
  font-size: 1.2rem; box-shadow: 0 4px 14px rgba(26,115,232,0.5);
  cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.fab-main:hover { background: var(--primary-dark); transform: scale(1.05); }
.fab-main.active { transform: rotate(45deg); }
.fab-options { display: flex; flex-direction: column; align-items: center; gap: 10px; opacity: 0; visibility: hidden; transition: var(--transition); }
.fab-options.active { opacity: 1; visibility: visible; }
.fab-option {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--card-bg); color: var(--primary); border: 2px solid var(--primary);
  font-size: 0.95rem; cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
}
.fab-option:hover { background: var(--primary); color: white; }

/* ---- TOAST ---- */
.toast-container { z-index: 11000; }
.toast-custom {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  padding: 12px 16px; display: flex; align-items: center; gap: 12px;
  min-width: 280px; animation: toastSlide 0.3s ease;
  color: var(--text);
}
@keyframes toastSlide { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast-icon { font-size: 1.1rem; }
.toast-success .toast-icon { color: #28a745; }
.toast-error .toast-icon { color: #dc3545; }
.toast-warning .toast-icon { color: #ffc107; }
.toast-info .toast-icon { color: #17a2b8; }
.toast-close { margin-left: auto; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; padding: 0; }

/* ---- ANIMATE CARD ---- */
.animate-card { animation: cardIn 0.4s ease both; }
.animate-card:nth-child(1) { animation-delay: 0.05s; }
.animate-card:nth-child(2) { animation-delay: 0.10s; }
.animate-card:nth-child(3) { animation-delay: 0.15s; }
.animate-card:nth-child(4) { animation-delay: 0.20s; }
.animate-card:nth-child(5) { animation-delay: 0.25s; }
.animate-card:nth-child(6) { animation-delay: 0.30s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ---- CHECKLIST ITEMS ---- */
.checklist-item {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px;
}
.checklist-item label { font-size: 0.82rem; font-weight: 500; margin-bottom: 6px; display: block; }
.check-btn-group { display: flex; gap: 4px; }
.check-btn { padding: 3px 10px; font-size: 0.75rem; border-radius: 20px; border: 1.5px solid var(--border); background: none; cursor: pointer; transition: var(--transition); color: var(--text); }
.check-btn.ok { border-color: #28a745; }
.check-btn.ok.active { background: #28a745; color: white; border-color: #28a745; }
.check-btn.fail { border-color: #dc3545; }
.check-btn.fail.active { background: #dc3545; color: white; border-color: #dc3545; }
.check-btn.na { border-color: #6c757d; }
.check-btn.na.active { background: #6c757d; color: white; border-color: #6c757d; }

/* ---- PRINT ---- */
@media print {
  .sidebar, .top-navbar, .fab-container, .page-actions, .btn-action, .action-group,
  .dataTables_wrapper .dt-buttons, .dataTables_filter, .dataTables_length,
  .dataTables_paginate, .toast-container, #loadingScreen { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
  body { background: white !important; color: black !important; }
  .content-card, .chart-card { box-shadow: none !important; border: 1px solid #ddd; }
  @page { margin: 15mm; }
  .page { display: block !important; }
  .page:not(.active) { display: none !important; }
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-width) !important; }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 12px; }
  .kpi-value { font-size: 1.3rem; }
  .chart-body { height: 180px; }
  .chart-body canvas { max-height: 180px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .fab-container { bottom: 16px; right: 16px; }
}

/* Mobile sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}
.sidebar-overlay.active { display: block; }

/* ---- REPORT OUTPUT ---- */
#reportOutput table { font-size: 0.82rem; }
#reportOutput .report-header { padding: 16px 0; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
#reportOutput .report-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
#reportOutput .report-kpi { background: var(--bg); border-radius: var(--radius-sm); padding: 14px; text-align: center; }
#reportOutput .report-kpi-value { font-size: 1.4rem; font-weight: 700; }
#reportOutput .report-kpi-label { font-size: 0.72rem; color: var(--text-muted); }

/* ---- VEHICLE VIEW CARD ---- */
.vehicle-view-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vehicle-view-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.vehicle-view-item .label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; }
.vehicle-view-item .value { font-size: 0.9rem; font-weight: 500; }

/* ---- MISC ---- */
.text-primary { color: var(--primary) !important; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
hr { border-color: var(--border); }
a { color: var(--primary); }
.form-label { font-size: 0.82rem; font-weight: 500; margin-bottom: 4px; }
.form-control, .form-select { font-size: 0.875rem; border-radius: var(--radius-sm); }
.modal-title { font-size: 1rem; font-weight: 600; }
.table th { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.table td { vertical-align: middle; font-size: 0.85rem; }
.odometer-value { font-family: 'Courier New', monospace; font-weight: 700; }

/* Expiry indicators */
.expiry-ok { color: #28a745; }
.expiry-soon { color: #fd7e14; }
.expiry-expired { color: #dc3545; font-weight: 700; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 4px; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); }

/* =====================================================
   CHECKLIST FORM — Interactive inline styles
   ===================================================== */

/* Category header inside modal */
.checklist-form-body {
  font-size: 0.82rem;
}

.cl-cat-header {
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 5px 10px;
  letter-spacing: 0.3px;
}

.cl-col-labels {
  display: grid;
  grid-template-columns: 32px 1fr 64px 64px 1fr;
  background: #c5d9e8;
  font-weight: 700;
  font-size: 0.72rem;
  padding: 3px 0;
  border-bottom: 1px solid #aaa;
}
.cl-col-labels > div {
  padding: 2px 6px;
  border-right: 1px solid #bbb;
  text-align: center;
}
.cl-col-labels .cl-col-item { text-align: left; }

.cl-item-row {
  display: grid;
  grid-template-columns: 32px 1fr 64px 64px 1fr;
  border-bottom: 1px solid #e0e0e0;
  align-items: center;
  transition: background 0.15s;
}
.cl-item-row:nth-child(odd)  { background: #f7f9fc; }
.cl-item-row:nth-child(even) { background: white; }
.cl-item-row:hover { background: rgba(26,115,232,0.06); }

[data-theme="dark"] .cl-item-row:nth-child(odd)  { background: rgba(255,255,255,0.03); }
[data-theme="dark"] .cl-item-row:nth-child(even) { background: transparent; }
[data-theme="dark"] .cl-item-row:hover { background: rgba(255,255,255,0.06); }

.cl-col-num   { padding: 4px 6px; text-align: center; font-weight: 600; color: #555; border-right: 1px solid #e0e0e0; }
.cl-col-item  { padding: 4px 8px; border-right: 1px solid #e0e0e0; }
.cl-col-ok    { padding: 4px 6px; text-align: center; border-right: 1px solid #e0e0e0; }
.cl-col-na    { padding: 4px 6px; text-align: center; border-right: 1px solid #e0e0e0; }
.cl-col-notes { padding: 3px 6px; }

/* Styled checkboxes */
.cl-checkbox {
  width: 16px; height: 16px;
  cursor: pointer; accent-color: #1a73e8;
}
.cl-ok { accent-color: #28a745; }
.cl-na { accent-color: #dc3545; }

/* Notes input */
.cl-notes-input {
  width: 100%; border: none; background: transparent;
  font-size: 0.78rem; padding: 0 2px; outline: none;
  color: var(--text);
}
.cl-notes-input:focus { background: rgba(26,115,232,0.06); border-radius: 3px; }

[data-theme="dark"] .cl-col-labels { background: #2d3748; color: var(--text); }
[data-theme="dark"] .cl-col-num { color: var(--text-muted); }

/* ── PRINT: A4 Checklist ──────────────────────────────────────────────────── */
@media print {
  /* When printing the checklist page, hide everything except the print window
     (actual A4 content is in a separate window via js window.open) */
  .checklist-form-body .cl-cat-header,
  .checklist-form-body .cl-col-labels,
  .checklist-form-body .cl-item-row { break-inside: avoid; }
}
