/* ========================================
   SPKV JKR — Sistem Pengurusan Pemeriksaan Kenderaan
   Global Stylesheet
   ======================================== */

:root {
  --primary: #1a6b3c;
  --primary-dark: #0d4f2e;
  --primary-light: #e8f5ee;
  --accent: #f59e0b;
  --accent-dark: #d97706;
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 68px;
  --topbar-height: 60px;
  --font-main: "Inter", "Segoe UI", sans-serif;
  --radius: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.07), 0 4px 6px rgba(0,0,0,.05);
  --border: #e5e7eb;
  --text-muted: #6b7280;
  --bg-body: #f3f4f6;
  --bg-card: #ffffff;
}

*, *::before, *::after { box-sizing: border-box; }
body { font-family: var(--font-main); background: var(--bg-body); color: #111827; margin: 0; overflow-x: hidden; }

/* ---- TOPBAR ---- */
.topbar {
  position: fixed; top: 0; left: var(--sidebar-width); right: 0;
  height: var(--topbar-height); background: var(--bg-card);
  border-bottom: 1px solid var(--border); z-index: 100;
  display: flex; align-items: center; padding: 0 1.5rem;
  box-shadow: var(--shadow-sm); transition: left .25s;
}
.topbar .topbar-brand { display: none; }
.topbar .topbar-right { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.topbar .btn-topbar {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: var(--bg-body); cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: #374151; font-size: 1.05rem; position: relative; transition: background .15s;
}
.topbar .btn-topbar:hover { background: var(--primary-light); color: var(--primary); }
.notif-badge {
  position: absolute; top: 2px; right: 2px; background: #ef4444; color: #fff;
  font-size: .6rem; border-radius: 50%; width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center; font-weight: 700; line-height: 1;
}
.topbar-avatar {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover; cursor: pointer;
  border: 2px solid var(--primary); background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: .85rem;
}
.env-badge { background: var(--accent); color: #fff; font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 12px; letter-spacing: .5px; }
.offline-banner {
  background: #f59e0b; color: #fff; text-align: center; padding: .4rem 1rem;
  font-size: .85rem; font-weight: 600; position: fixed; top: 0; left: 0; right: 0; z-index: 200; display: none;
}
.offline-banner.show { display: block; }
.offline-banner ~ .topbar { top: 36px; }
.offline-banner ~ .sidebar { top: 36px; height: calc(100vh - 36px); }
.offline-banner ~ .main-content { margin-top: calc(var(--topbar-height) + 36px); }

/* ---- SIDEBAR ---- */
.sidebar {
  position: fixed; top: 0; left: 0; width: var(--sidebar-width);
  height: 100vh; background: var(--primary-dark); overflow-y: auto;
  overflow-x: hidden; z-index: 110; transition: width .25s;
  display: flex; flex-direction: column;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 2px; }
.sidebar-header {
  padding: 1rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; gap: .75rem; min-height: var(--topbar-height);
}
.sidebar-logo { width: 36px; height: 36px; background: #fff; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidebar-logo img { width: 28px; }
.sidebar-title { color: #fff; font-weight: 700; font-size: .9rem; line-height: 1.2; white-space: nowrap; overflow: hidden; }
.sidebar-title small { display: block; font-size: .7rem; font-weight: 400; opacity: .7; }
.sidebar-section-label {
  color: rgba(255,255,255,.4); font-size: .65rem; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; padding: 1.25rem 1.25rem .4rem; white-space: nowrap;
}
.sidebar-nav { list-style: none; padding: .5rem 0; margin: 0; }
.sidebar-nav .nav-item { margin: 1px 0; }
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: .75rem; padding: .6rem 1.25rem;
  color: rgba(255,255,255,.75); text-decoration: none; border-radius: 0;
  font-size: .875rem; white-space: nowrap; transition: all .15s; cursor: pointer;
}
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.sidebar-nav .nav-link.active { background: rgba(255,255,255,.15); color: #fff; border-right: 3px solid var(--accent); }
.sidebar-nav .nav-link .nav-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-nav .nav-link .nav-badge {
  margin-left: auto; background: #ef4444; color: #fff; font-size: .65rem;
  font-weight: 700; padding: 1px 6px; border-radius: 10px;
}
.sidebar-nav .nav-link .nav-chevron { margin-left: auto; font-size: .7rem; opacity: .6; transition: transform .2s; }
.sidebar-nav .nav-item.open > .nav-link .nav-chevron { transform: rotate(90deg); }
.sidebar-submenu { list-style: none; padding: 0; margin: 0; background: rgba(0,0,0,.15); display: none; }
.sidebar-nav .nav-item.open > .sidebar-submenu { display: block; }
.sidebar-submenu .nav-link { padding: .5rem 1.25rem .5rem 3rem; font-size: .82rem; }
.sidebar-footer { margin-top: auto; padding: 1rem; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-user { display: flex; align-items: center; gap: .75rem; }
.sidebar-user-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: .8rem; flex-shrink: 0;
}
.sidebar-user-info { white-space: nowrap; overflow: hidden; }
.sidebar-user-info .name { color: #fff; font-size: .82rem; font-weight: 600; }
.sidebar-user-info .role { color: rgba(255,255,255,.55); font-size: .72rem; }

/* ---- MAIN CONTENT ---- */
.main-content { margin-left: var(--sidebar-width); margin-top: var(--topbar-height); padding: 1.5rem; min-height: calc(100vh - var(--topbar-height)); transition: margin-left .25s; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: .75rem; }
.page-header h1 { font-size: 1.4rem; font-weight: 700; color: #111827; margin: 0; }
.breadcrumb { font-size: .8rem; }
.breadcrumb-item + .breadcrumb-item::before { content: "›"; }

/* ---- CARDS ---- */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h6 { font-size: .85rem; font-weight: 700; margin: 0; color: #374151; text-transform: uppercase; letter-spacing: .5px; }
.card-body { padding: 1.25rem; }

/* ---- STAT CARDS ---- */
.stat-card {
  border-radius: var(--radius); padding: 1.25rem; color: #fff;
  background: var(--primary); position: relative; overflow: hidden;
}
.stat-card.accent { background: var(--accent); }
.stat-card.danger { background: #ef4444; }
.stat-card.info { background: #3b82f6; }
.stat-card.warning { background: #f59e0b; }
.stat-card.purple { background: #8b5cf6; }
.stat-card .stat-icon { font-size: 2.5rem; opacity: .25; position: absolute; bottom: -8px; right: 12px; }
.stat-card .stat-value { font-size: 2rem; font-weight: 800; line-height: 1; }
.stat-card .stat-label { font-size: .78rem; opacity: .9; margin-top: .25rem; font-weight: 500; }
.stat-card .stat-change { font-size: .75rem; opacity: .85; margin-top: .5rem; }

/* ---- TABLES ---- */
.table-spkv { font-size: .85rem; }
.table-spkv th { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); background: #f9fafb; border-bottom: 2px solid var(--border); white-space: nowrap; }
.table-spkv td { vertical-align: middle; }
.table-spkv tbody tr:hover { background: #f9fafb; }
.table-spkv .action-btns { display: flex; gap: .35rem; }
.table-spkv .action-btns .btn { padding: .25rem .5rem; font-size: .75rem; }

/* ---- BADGES ---- */
.badge-status { padding: .3rem .7rem; border-radius: 12px; font-size: .72rem; font-weight: 600; }
.badge-aktif { background: #d1fae5; color: #065f46; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-gagal { background: #fee2e2; color: #991b1b; }
.badge-lulus { background: #d1fae5; color: #065f46; }
.badge-confirmed { background: #dbeafe; color: #1e40af; }
.badge-in_progress { background: #fef3c7; color: #92400e; }
.badge-completed { background: #d1fae5; color: #065f46; }
.badge-draft { background: #f3f4f6; color: #374151; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-pelupusan { background: #fee2e2; color: #991b1b; }
.badge-baiki { background: #fef3c7; color: #92400e; }

/* ---- FORMS ---- */
.form-label { font-size: .82rem; font-weight: 600; color: #374151; margin-bottom: .35rem; }
.form-control, .form-select { font-size: .875rem; border-color: #d1d5db; border-radius: 6px; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,107,60,.12); }
.form-control.is-invalid { border-color: #ef4444; }
.invalid-feedback { font-size: .78rem; }

/* ---- BUTTONS ---- */
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn-sm { font-size: .78rem; }

/* ---- TABS ---- */
.nav-tabs-spkv { border-bottom: 2px solid var(--border); }
.nav-tabs-spkv .nav-link { border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; color: var(--text-muted); font-size: .85rem; font-weight: 500; padding: .6rem 1rem; border-radius: 0; }
.nav-tabs-spkv .nav-link.active { color: var(--primary); border-bottom-color: var(--primary); background: none; font-weight: 700; }
.nav-tabs-spkv .nav-link:hover { color: var(--primary); }

/* ---- PROGRESS RINGS ---- */
.progress-ring-container { display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.progress-ring text { font-size: 14px; font-weight: 700; fill: var(--primary); }
.progress-ring-label { font-size: .75rem; color: var(--text-muted); text-align: center; }

/* ---- CHOROPLETH MAP ---- */
#malaysia-map { width: 100%; max-width: 600px; margin: 0 auto; display: block; }
#malaysia-map path { cursor: pointer; transition: opacity .15s; stroke: #fff; stroke-width: 1.5; }
#malaysia-map path:hover { opacity: .8; }
.map-legend { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; margin-top: .75rem; }
.legend-item { display: flex; align-items: center; gap: .35rem; font-size: .75rem; color: var(--text-muted); }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; }

/* ---- NOTIFICATIONS DROPDOWN ---- */
.notif-dropdown { width: 360px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.notif-dropdown-header { padding: .75rem 1rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.notif-dropdown-header h6 { font-size: .85rem; font-weight: 700; margin: 0; }
.notif-item { display: flex; gap: .75rem; padding: .75rem 1rem; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; transition: background .15s; }
.notif-item:hover { background: var(--primary-light); }
.notif-item.unread { background: #f0fdf4; }
.notif-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .9rem; flex-shrink: 0; }
.notif-icon.session { background: #dbeafe; color: #1e40af; }
.notif-icon.warning { background: #fef3c7; color: #92400e; }
.notif-icon.report { background: #d1fae5; color: #065f46; }
.notif-icon.danger { background: #fee2e2; color: #991b1b; }
.notif-body h6 { font-size: .82rem; font-weight: 600; margin: 0 0 .15rem; }
.notif-body p { font-size: .75rem; color: var(--text-muted); margin: 0; line-height: 1.4; }
.notif-body .notif-time { font-size: .7rem; color: #9ca3af; margin-top: .2rem; }

/* ---- CHECKLIST FORM ---- */
.checklist-group-header { background: var(--primary-light); border-left: 4px solid var(--primary); padding: .6rem 1rem; font-size: .8rem; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 0; border-radius: 4px 4px 0 0; }
.checklist-item { border: 1px solid var(--border); margin-bottom: .5rem; border-radius: 4px; overflow: hidden; }
.checklist-item-header { padding: .75rem 1rem; background: #f9fafb; display: flex; align-items: flex-start; gap: 1rem; }
.checklist-item-body { padding: .75rem 1rem; border-top: 1px solid var(--border); display: none; }
.checklist-item.active .checklist-item-body { display: block; }
.checklist-radio-group { display: flex; gap: 1rem; flex-wrap: wrap; }
.checklist-radio { display: flex; align-items: center; gap: .4rem; }
.checklist-radio input[type="radio"]:checked + label.lulus { color: #065f46; font-weight: 600; }
.checklist-radio input[type="radio"]:checked + label.gagal { color: #991b1b; font-weight: 600; }
.mismatch-alert { background: #fee2e2; border: 1px solid #f87171; border-radius: 6px; padding: .6rem .9rem; font-size: .82rem; color: #991b1b; display: flex; align-items: center; gap: .5rem; }

/* ---- WIZARD STEPS ---- */
.wizard-steps { display: flex; align-items: center; gap: 0; margin-bottom: 2rem; overflow-x: auto; }
.wizard-step { display: flex; align-items: center; gap: 0; flex: 1; min-width: 0; }
.wizard-step-circle {
  width: 36px; height: 36px; border-radius: 50%; background: #e5e7eb;
  display: flex; align-items: center; justify-content: center; font-size: .8rem;
  font-weight: 700; color: var(--text-muted); flex-shrink: 0; border: 2px solid #e5e7eb;
}
.wizard-step.active .wizard-step-circle { background: var(--primary); border-color: var(--primary); color: #fff; }
.wizard-step.done .wizard-step-circle { background: var(--primary); border-color: var(--primary); color: #fff; }
.wizard-step-label { font-size: .78rem; color: var(--text-muted); margin-left: .5rem; white-space: nowrap; }
.wizard-step.active .wizard-step-label { color: var(--primary); font-weight: 600; }
.wizard-step-line { flex: 1; height: 2px; background: #e5e7eb; margin: 0 .25rem; min-width: 20px; }
.wizard-step.done ~ .wizard-step-line, .wizard-step.done + .wizard-step .wizard-step-line { background: var(--primary); }

/* ---- SESSION PROGRESS ---- */
.session-progress-bar { border-radius: 4px; overflow: hidden; background: #e5e7eb; height: 8px; }
.session-progress-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width .3s; }
.report-progress { background: var(--primary-light); border: 1px solid var(--primary); border-radius: var(--radius); padding: 1.25rem; }
.report-progress .progress { height: 12px; border-radius: 6px; }
.report-progress .progress-bar { background: var(--primary); }

/* ---- COLOR PICKER ---- */
.color-picker-group { display: flex; align-items: center; gap: .75rem; }
.color-preview { width: 40px; height: 40px; border-radius: 8px; border: 2px solid var(--border); }
.color-presets { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.color-preset {
  width: 28px; height: 28px; border-radius: 6px; cursor: pointer; border: 2px solid transparent;
  transition: transform .15s; flex-shrink: 0;
}
.color-preset:hover { transform: scale(1.15); }
.color-preset.active { border-color: #111; }

/* ---- LOGIN PAGE ---- */
.login-wrapper { min-height: 100vh; display: flex; align-items: stretch; }
.login-left {
  flex: 0 0 420px; background: var(--primary-dark); display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 3rem 2.5rem; color: #fff;
}
.login-right { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 2rem; background: var(--bg-body); overflow-y: auto; }
.login-right > .login-card, .login-right > #twofa-card { width: 100%; max-width: 440px; margin: auto 0; }
.login-right > .demo-role-section { width: 100%; max-width: 440px; }
.login-right > .text-center { width: 100%; max-width: 440px; }
.login-logo { width: 80px; height: 80px; background: #fff; border-radius: 20px; display: flex; align-items: center; justify-content: center; margin-bottom: 1.5rem; }
.login-logo img { width: 60px; }
.login-card { background: #fff; border-radius: 16px; padding: 2.5rem; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); }
.login-card h2 { font-size: 1.5rem; font-weight: 800; color: #111827; margin-bottom: .5rem; }
.login-card .subtitle { color: var(--text-muted); font-size: .875rem; margin-bottom: 2rem; }

/* ---- VEHICLE PHOTO GRID ---- */
.vehicle-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
.vehicle-photo-slot { border: 2px dashed var(--border); border-radius: 8px; padding: 1rem; text-align: center; min-height: 130px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; cursor: pointer; transition: border-color .15s; }
.vehicle-photo-slot:hover { border-color: var(--primary); background: var(--primary-light); }
.vehicle-photo-slot.filled { border-style: solid; border-color: var(--border); padding: 0; overflow: hidden; }
.vehicle-photo-slot img { width: 100%; height: 130px; object-fit: cover; border-radius: 6px; display: block; }
.vehicle-photo-slot .slot-label { font-size: .72rem; color: var(--text-muted); font-weight: 600; }
.vehicle-photo-slot .required-badge { font-size: .65rem; background: #fee2e2; color: #991b1b; padding: 1px 5px; border-radius: 4px; }

/* ---- MOBILE INSPECTION ---- */
.mobile-inspection-wrapper { max-width: 480px; margin: 0 auto; padding: 1rem; }
.mobile-criterion-header { background: var(--primary); color: #fff; border-radius: var(--radius) var(--radius) 0 0; padding: 1rem; }
.mobile-criterion-body { background: #fff; border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); padding: 1.5rem; }
.mobile-radio-btn {
  display: block; width: 100%; padding: .9rem 1.25rem; border: 2px solid var(--border);
  border-radius: 8px; margin-bottom: .75rem; cursor: pointer; font-size: .95rem; font-weight: 500;
  text-align: left; background: #fff; transition: all .15s;
}
.mobile-radio-btn.selected-lulus { border-color: #16a34a; background: #f0fdf4; color: #16a34a; }
.mobile-radio-btn.selected-gagal { border-color: #dc2626; background: #fff1f2; color: #dc2626; }
.mobile-radio-btn.selected-na { border-color: #6b7280; background: #f9fafb; color: #374151; }
.mobile-sticky-footer { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--border); padding: .75rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; z-index: 50; }

/* ---- ANNOUNCEMENT ---- */
.announcement-card { border-left: 4px solid var(--primary); animation: slideIn .3s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ---- AUDIT TRAIL ---- */
.audit-item { display: flex; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--border); }
.audit-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); margin-top: 4px; flex-shrink: 0; }
.audit-content h6 { font-size: .82rem; font-weight: 600; margin: 0 0 .2rem; }
.audit-content p { font-size: .78rem; color: var(--text-muted); margin: 0; }
.audit-time { font-size: .7rem; color: #9ca3af; white-space: nowrap; margin-left: auto; }
.json-diff { background: #1e293b; color: #e2e8f0; border-radius: 6px; padding: .75rem; font-size: .75rem; font-family: monospace; overflow-x: auto; }
.json-diff .removed { color: #f87171; }
.json-diff .added { color: #4ade80; }

/* ---- IMPERSONATION BANNER ---- */
.impersonate-banner { background: #7c3aed; color: #fff; padding: .5rem 1rem; text-align: center; font-size: .85rem; font-weight: 600; }
.impersonate-banner a { color: #fbbf24; text-decoration: underline; }

/* ---- DUAL INPUT (ENGINE/CHASSIS MATCH) ---- */
.dual-compare { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.dual-compare .compare-label { font-size: .72rem; color: var(--text-muted); margin-bottom: .25rem; display: block; }
.match-ok { border-color: #16a34a !important; background: #f0fdf4; }
.match-fail { border-color: #dc2626 !important; background: #fff1f2; }

/* ---- TOOLTIPS & MISC ---- */
.tooltip-map { position: absolute; background: #111827; color: #fff; padding: .5rem .75rem; border-radius: 6px; font-size: .78rem; pointer-events: none; z-index: 999; white-space: nowrap; }
.sticky-save { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--border); padding: .75rem 1.25rem; margin-left: -1.25rem; margin-right: -1.25rem; }
.fab-save { position: fixed; bottom: 1.5rem; right: 1.5rem; width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 1.2rem; border: none; box-shadow: 0 4px 12px rgba(0,0,0,.2); cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 60; }
.fab-save:hover { background: var(--accent-dark); }
.duplicate-warning { background: #fff7ed; border: 1px solid #fb923c; border-radius: 6px; padding: .75rem 1rem; font-size: .82rem; color: #9a3412; }

/* ---- RESPONSIVE ---- */
@media (max-width: 991px) {
  .sidebar { width: var(--sidebar-collapsed-width); }
  .sidebar-title, .sidebar-section-label, .nav-link .nav-label, .nav-link .nav-badge, .nav-link .nav-chevron, .sidebar-user-info { display: none; }
  .topbar { left: var(--sidebar-collapsed-width); }
  .topbar .topbar-brand { display: block; font-weight: 700; font-size: .9rem; color: var(--primary); }
  .main-content { margin-left: var(--sidebar-collapsed-width); }
  .sidebar-header { justify-content: center; padding: 1rem .75rem; }
  .sidebar-nav .nav-link { padding: .6rem; justify-content: center; }
  .sidebar-nav .nav-link .nav-icon { margin: 0; }
  .sidebar-footer { display: none; }
}
@media (max-width: 767px) {
  .login-left { display: none; }
  .login-right { background: var(--primary-dark); }
  .login-card { border: none; }
  .stat-card .stat-value { font-size: 1.5rem; }
}

/* ---- DARK MODE ---- */
[data-theme="dark"] {
  --bg-body: #111827; --bg-card: #1f2937; --border: #374151; --text-muted: #9ca3af;
}
[data-theme="dark"] body { color: #f9fafb; }
[data-theme="dark"] .topbar, [data-theme="dark"] .notif-dropdown { background: #1f2937; }

/* ======================================================
   DEMO ROLE SELECTOR (Login Page)
   ====================================================== */
.demo-role-section { margin-top: 1.25rem; }
.demo-role-divider {
  display: flex; align-items: center; gap: .75rem;
  margin-bottom: 1rem; color: rgba(255,255,255,.45); font-size: .75rem;
}
.demo-role-divider::before,
.demo-role-divider::after { content: ""; flex: 1; border-top: 1px solid rgba(255,255,255,.2); }
.demo-role-header {
  color: rgba(255,255,255,.8); font-size: .8rem; font-weight: 600;
  margin-bottom: .75rem; letter-spacing: .3px;
}
.demo-role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.demo-role-card {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  border-left: 3px solid var(--role-color, var(--primary));
  border-radius: 8px; padding: .75rem;
  cursor: pointer; transition: background .15s, transform .1s, box-shadow .15s;
}
.demo-role-card:hover {
  background: rgba(255,255,255,.13); transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,.3); border-color: var(--role-color, var(--primary));
}
.demo-role-card-header { display: flex; align-items: flex-start; gap: .5rem; margin-bottom: .35rem; }
.demo-role-icon {
  width: 28px; height: 28px; border-radius: 6px; background: rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.demo-role-meta { flex: 1; min-width: 0; }
.demo-role-name { font-size: .72rem; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo-role-scope { font-size: .62rem; color: rgba(255,255,255,.5); margin-top: 1px; }
.demo-role-user { font-size: .68rem; color: rgba(255,255,255,.55); margin-bottom: .35rem; font-style: italic; }
.demo-role-features { list-style: none; padding: 0; margin: 0 0 .5rem; display: flex; flex-direction: column; gap: 2px; }
.demo-role-features li { font-size: .62rem; color: rgba(255,255,255,.5); display: flex; align-items: flex-start; gap: 4px; }
.demo-role-features li i { margin-top: 1px; flex-shrink: 0; }
.demo-role-btn {
  width: 100%; background: transparent; border: 1px solid currentColor;
  border-radius: 5px; padding: 3px 8px; font-size: .68rem; font-weight: 600; cursor: pointer;
  transition: background .15s, color .15s;
}
.demo-role-btn:hover { background: var(--role-color, var(--primary)); color: #fff !important; border-color: transparent; }

/* ======================================================
   ROLE CONTEXT BANNER (Inner pages)
   ====================================================== */
#role-context-banner { display: none; }

@media (max-width: 480px) {
  .demo-role-grid { grid-template-columns: 1fr; }
}
[data-theme="dark"] .table-spkv th { background: #111827; color: #9ca3af; }
[data-theme="dark"] .card { background: #1f2937; border-color: #374151; }
[data-theme="dark"] .form-control, [data-theme="dark"] .form-select { background: #111827; border-color: #374151; color: #f9fafb; }
[data-theme="dark"] .checklist-item-header { background: #111827; }
[data-theme="dark"] .nav-tabs-spkv .nav-link { color: #9ca3af; }
[data-theme="dark"] .nav-tabs-spkv .nav-link.active { color: var(--primary); }

/* ===== Utility & Additional Components ===== */
.cursor-pointer { cursor: pointer; }
.fw-700 { font-weight: 700 !important; }
.fw-800 { font-weight: 800 !important; }
.fw-600 { font-weight: 600 !important; }

.report-select-card { transition: transform .15s, box-shadow .15s; cursor: pointer; border: 2px solid transparent; }
.report-select-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,.12); border-color: var(--primary); }

.nav-tabs-spkv { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; border-bottom: 2px solid var(--border); }
.nav-tabs-spkv li button { border: none; background: none; }

.audit-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: .3rem; }
.audit-content { flex: 1; }
.audit-content h6 { margin: 0; font-size: .88rem; font-weight: 700; }
.audit-content p { margin: .15rem 0 0; font-size: .78rem; color: #64748b; }
.audit-time { font-size: .72rem; color: #94a3b8; white-space: nowrap; }
.json-diff { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; padding: .5rem; font-size: .72rem; font-family: monospace; white-space: pre; overflow-x: auto; margin-top: .5rem; max-height: 120px; }

.vehicle-photo-slot { border: 2px dashed #cbd5e1; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 160px; cursor: pointer; transition: border-color .2s, background .2s; }
.vehicle-photo-slot:hover { border-color: var(--primary); background: var(--primary-light); }
.vehicle-photo-slot.filled { border-style: solid; border-color: #86efac; background: #f0fdf4; }
.slot-label { font-size: .72rem; color: #94a3b8; margin-top: .35rem; }

.vehicle-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }

[data-theme="dark"] .json-diff { background: #1e293b; border-color: #334155; color: #e2e8f0; }
[data-theme="dark"] .vehicle-photo-slot { border-color: #334155; }
[data-theme="dark"] .vehicle-photo-slot.filled { background: #134e26; border-color: #22c55e; }
