/* ============================================
   i-LPG Design System
   Enterprise LPG Distribution Management
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Variables ── */
:root {
  /* Brand Palette */
  --primary:        #E85D04;
  --primary-dark:   #C44D03;
  --primary-light:  #FF7B2B;
  --primary-alpha:  rgba(232, 93, 4, 0.12);

  --accent:         #F48C06;
  --accent-light:   #FAA307;

  --success:        #2DC653;
  --warning:        #FFB703;
  --danger:         #E63946;
  --info:           #4361EE;

  /* Light Mode */
  --bg:             #F7F7F8;
  --bg-card:        #FFFFFF;
  --bg-sidebar:     #1A1A2E;
  --bg-sidebar-sec: #16213E;
  --bg-input:       #F0F0F3;

  --text-primary:   #0D0D0D;
  --text-secondary: #6B6B80;
  --text-muted:     #9999AA;
  --text-on-dark:   #FFFFFF;
  --text-sidebar:   rgba(255,255,255,0.85);

  --border:         rgba(0,0,0,0.08);
  --border-focus:   var(--primary);

  --shadow-sm:      0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:      0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:      0 8px 32px rgba(0,0,0,0.14);
  --shadow-card:    0 2px 8px rgba(0,0,0,0.06);

  /* Layout */
  --sidebar-w:      260px;
  --sidebar-w-col:  68px;
  --topbar-h:       64px;
  --radius:         12px;
  --radius-sm:      8px;
  --radius-lg:      16px;
  --radius-pill:    999px;

  /* Type */
  --font-main:      'Inter', system-ui, sans-serif;
  --font-mono:      'JetBrains Mono', monospace;

  /* Transitions */
  --t-fast:         0.15s ease;
  --t-med:          0.25s ease;
  --t-slow:         0.4s ease;
}

/* Dark Mode */
[data-theme="dark"] {
  --bg:             #0F0F14;
  --bg-card:        #1A1A24;
  --bg-sidebar:     #0D0D12;
  --bg-sidebar-sec: #111118;
  --bg-input:       #222230;

  --text-primary:   #F0F0F5;
  --text-secondary: #9090A8;
  --text-muted:     #6060780;

  --border:         rgba(255,255,255,0.08);
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:      0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:      0 8px 32px rgba(0,0,0,0.5);
  --shadow-card:    0 2px 8px rgba(0,0,0,0.3);
}

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

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

body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background var(--t-slow), color var(--t-slow);
}

/* ── Scrollbar ── */
::-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); }

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

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0;
  z-index: 1000;
  transition: width var(--t-med), transform var(--t-med);
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-w-col); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  min-height: var(--topbar-h);
  text-decoration: none;
}

.brand-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
  font-weight: 800;
  color: white;
  letter-spacing: -1px;
}

.brand-text {
  overflow: hidden;
  transition: opacity var(--t-med), width var(--t-med);
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-on-dark);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.brand-sub {
  font-size: 10px;
  color: var(--primary-light);
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar.collapsed .brand-text { opacity: 0; width: 0; }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .menu-label,
.sidebar.collapsed .sidebar-footer-text { opacity: 0; width: 0; overflow: hidden; }

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 10px;
}

.menu-section {
  margin-bottom: 4px;
}

.menu-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 12px 8px 4px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--t-med);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-sidebar);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
  position: relative;
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-main);
  font-size: 14px;
}

.nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: var(--text-on-dark);
}

.nav-item.active {
  background: var(--primary-alpha);
  color: var(--primary-light);
}

.nav-item.active .nav-icon { color: var(--primary-light); }

.nav-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.nav-label {
  flex: 1;
  transition: opacity var(--t-med);
}

.nav-badge {
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  min-width: 18px;
  text-align: center;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  color: white;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-footer-text { overflow: hidden; transition: opacity var(--t-med); }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-on-dark); }
.user-role { font-size: 11px; color: var(--text-muted); }

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

.sidebar.collapsed ~ .main-content,
.main-content.expanded { margin-left: var(--sidebar-w-col); }

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar-left { display: flex; align-items: center; gap: 12px; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.sidebar-toggle {
  width: 38px; height: 38px;
  border: none;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background var(--t-fast);
}

.sidebar-toggle:hover { background: var(--primary-alpha); color: var(--primary); }

.page-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.breadcrumb-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.breadcrumb-nav a { color: var(--primary); text-decoration: none; }
.breadcrumb-nav a:hover { text-decoration: underline; }

/* Topbar Actions */
.topbar-btn {
  width: 38px; height: 38px;
  border: none;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  position: relative;
  transition: background var(--t-fast);
  text-decoration: none;
}

.topbar-btn:hover { background: var(--primary-alpha); color: var(--primary); }

.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

/* ── Page Content ── */
.page-content {
  flex: 1;
  padding: 24px;
  overflow-x: hidden;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow var(--t-fast);
}

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

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

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .icon { color: var(--primary); }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--bg); }

/* ── Stat Cards ── */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}

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

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

.stat-icon.orange { background: rgba(232, 93, 4, 0.12); color: var(--primary); }
.stat-icon.green  { background: rgba(45, 198, 83, 0.12); color: var(--success); }
.stat-icon.yellow { background: rgba(255, 183, 3, 0.12); color: var(--warning); }
.stat-icon.blue   { background: rgba(67, 97, 238, 0.12); color: var(--info); }
.stat-icon.red    { background: rgba(230, 57, 70, 0.12); color: var(--danger); }

.stat-body { flex: 1; min-width: 0; }
.stat-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.4px; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text-primary); line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-change { font-size: 12px; margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--t-fast);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

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

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

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

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

.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-danger  { background: var(--danger);  color: white; border-color: var(--danger); }
.btn-warning { background: var(--warning); color: var(--text-primary); border-color: var(--warning); }
.btn-info    { background: var(--info);    color: white; border-color: var(--info); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-icon { width: 36px; height: 36px; padding: 0; justify-content: center; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}
.form-label .required { color: var(--danger); margin-left: 3px; }

.form-control,
.form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-main);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  appearance: none;
  -webkit-appearance: none;
}

.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-alpha);
  background: var(--bg-card);
}

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

.select-wrapper { position: relative; }
.select-wrapper::after {
  content: '▾';
  position: absolute;
  right: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 12px;
}

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

.form-text { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

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

/* ── Tables ── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead tr {
  background: var(--bg-input);
  border-bottom: 2px solid var(--border);
}

thead th {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  white-space: nowrap;
  text-align: left;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--primary-alpha); }

tbody td {
  padding: 12px 16px;
  color: var(--text-primary);
  vertical-align: middle;
}

/* ── Badges / Status ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.badge-success { background: rgba(45,198,83,.15); color: var(--success); }
.badge-warning { background: rgba(255,183,3,.15);  color: #CC8800; }
.badge-danger  { background: rgba(230,57,70,.15);  color: var(--danger); }
.badge-info    { background: rgba(67,97,238,.15);  color: var(--info); }
.badge-orange  { background: var(--primary-alpha);  color: var(--primary); }
.badge-gray    { background: rgba(150,150,170,.12); color: var(--text-secondary); }

.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ── Search Bar ── */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box .search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 15px;
  pointer-events: none;
}

.search-box input {
  padding-left: 36px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-main);
  height: 38px;
  min-width: 240px;
  transition: border-color var(--t-fast);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-alpha);
}

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

/* ── Toast Notifications ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: toastIn 0.3s ease;
  position: relative;
  overflow: hidden;
}

.toast::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
}

.toast.success::before { background: var(--success); }
.toast.error::before   { background: var(--danger); }
.toast.warning::before { background: var(--warning); }
.toast.info::before    { background: var(--info); }

.toast-icon { font-size: 18px; margin-top: 1px; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--success); }
.toast.error   .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info    .toast-icon { color: var(--info); }

.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.toast-msg { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

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

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(40px); }
}

/* ── Modals ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.25s ease;
  border: 1px solid var(--border);
}

.modal-sm { max-width: 420px; }
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 960px; }

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

.modal-title { font-size: 17px; font-weight: 700; color: var(--text-primary); }

.modal-close {
  width: 32px; height: 32px;
  border: none;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: background var(--t-fast);
}

.modal-close:hover { background: var(--danger); color: white; }

.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Camera / Canvas ── */
.camera-container {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4/3;
  max-height: 350px;
}

.camera-container video,
.camera-container canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.camera-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  pointer-events: none;
}

.camera-watermark {
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.15);
}

.camera-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  pointer-events: all;
}

.capture-btn {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: white;
  border: 4px solid rgba(255,255,255,0.4);
  cursor: pointer;
  transition: transform var(--t-fast);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}

.capture-btn:hover { transform: scale(1.05); }
.capture-btn:active { transform: scale(0.95); }

/* Photo preview */
.photo-preview {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
}

.photo-preview img {
  width: 100%;
  border-radius: var(--radius);
  border: 2px solid var(--border);
}

.photo-retake {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(0,0,0,0.7);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
}

/* ── GPS Widget ── */
.gps-widget {
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.gps-icon {
  width: 40px; height: 40px;
  background: rgba(67,97,238,.1);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  color: var(--info);
  flex-shrink: 0;
}

.gps-info { flex: 1; min-width: 0; }
.gps-label { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; }
.gps-coords {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
  margin-top: 2px;
}

.gps-status {
  font-size: 11px;
  display: flex; align-items: center; gap: 5px;
}

.gps-status.loading { color: var(--warning); }
.gps-status.ready   { color: var(--success); }
.gps-status.error   { color: var(--danger); }

/* ── Notification Panel ── */
.notif-panel {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  width: 360px;
  height: calc(100vh - var(--topbar-h));
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--t-med);
}

.notif-panel.open { transform: translateX(0); }

.notif-panel-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notif-list { flex: 1; overflow-y: auto; }

.notif-item {
  display: flex;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--t-fast);
}

.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: var(--primary-alpha); }

.notif-dot-badge {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  margin-top: 6px;
}

.notif-content { flex: 1; }
.notif-text { font-size: 13px; color: var(--text-primary); line-height: 1.4; }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ── Progress & Loading ── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.loading-spinner {
  width: 48px; height: 48px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--border) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

.progress-bar-wrap {
  background: var(--bg-input);
  border-radius: var(--radius-pill);
  overflow: hidden;
  height: 6px;
}

.progress-bar {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.4s ease;
}

/* ── Login Page ── */
.login-page {
  min-height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(232,93,4,0.15) 0%, transparent 70%);
  top: -200px; right: -200px;
  border-radius: 50%;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(244,140,6,0.08) 0%, transparent 70%);
  bottom: -100px; left: -100px;
  border-radius: 50%;
}

.login-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  backdrop-filter: blur(20px);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-icon {
  width: 64px; height: 64px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
  font-size: 28px;
  font-weight: 900;
  color: white;
  box-shadow: 0 8px 24px rgba(232,93,4,0.4);
}

.login-logo h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-on-dark);
  letter-spacing: -0.5px;
}

.login-logo p {
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  margin-top: 4px;
}

.login-form .form-label { color: rgba(255,255,255,0.6); }
.login-form .form-control {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.1);
  color: white;
}

.login-form .form-control:focus {
  background: rgba(255,255,255,0.12);
  border-color: var(--primary);
}

.login-form .form-control::placeholder { color: rgba(255,255,255,0.3); }

.login-btn {
  width: 100%;
  padding: 13px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--t-fast), transform var(--t-fast);
  margin-top: 8px;
  font-family: var(--font-main);
}

.login-btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.login-btn:active { transform: translateY(0); }

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 12px;
  color: rgba(255,255,255,0.3);
}

/* ── Dashboard Charts Area ── */
.chart-container {
  position: relative;
  height: 240px;
}

/* ── Page Header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header-left .page-h { font-size: 22px; font-weight: 800; color: var(--text-primary); }
.page-header-left .page-sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.tab {
  flex: 1;
  padding: 8px 16px;
  border: none;
  background: transparent;
  border-radius: calc(var(--radius-sm) - 2px);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
  font-family: var(--font-main);
  white-space: nowrap;
  text-align: center;
}

.tab.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

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

/* ── Timeline / Log ── */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 8px; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

.timeline-dot {
  position: absolute;
  left: -20px; top: 4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-card);
}

.timeline-dot.success { background: var(--success); }
.timeline-dot.warning { background: var(--warning); }
.timeline-dot.danger  { background: var(--danger); }

.timeline-time { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; font-family: var(--font-mono); }
.timeline-content { font-size: 13px; color: var(--text-primary); }
.timeline-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ── Upload Zone ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-alpha);
}

.upload-icon { font-size: 36px; color: var(--text-muted); margin-bottom: 8px; }
.upload-text { font-size: 14px; color: var(--text-secondary); }
.upload-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Map Embed ── */
.map-container {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-input);
  position: relative;
}

.map-placeholder {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Alert Boxes ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  border-left: 4px solid;
}

.alert-info    { background: rgba(67,97,238,.08);  border-color: var(--info);    color: var(--info); }
.alert-success { background: rgba(45,198,83,.08);  border-color: var(--success); color: var(--success); }
.alert-warning { background: rgba(255,183,3,.1);   border-color: var(--warning); color: #CC8800; }
.alert-danger  { background: rgba(230,57,70,.08);  border-color: var(--danger);  color: var(--danger); }

.alert-icon { flex-shrink: 0; margin-top: 1px; }
.alert-body { color: var(--text-primary); }
.alert-body strong { color: inherit; }

/* ── Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.empty-icon { font-size: 48px; color: var(--text-muted); margin-bottom: 12px; }
.empty-title { font-size: 16px; font-weight: 700; color: var(--text-secondary); }
.empty-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; max-width: 280px; }

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  padding: 16px;
}

.page-btn {
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t-fast);
  font-family: var(--font-main);
}

.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

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

/* ── Responsive ── */
@media (max-width: 768px) {
  :root {
    --topbar-h: 56px;
  }

  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
    box-shadow: var(--shadow-lg);
  }

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

  .sidebar-overlay {
    display: block;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-med);
  }

  .sidebar.mobile-open ~ .sidebar-overlay {
    opacity: 1;
    pointer-events: all;
  }

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

  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }

  .stat-card { padding: 16px; }
  .stat-value { font-size: 22px; }

  .notif-panel { width: 100%; }

  .modal-overlay { padding: 16px; align-items: flex-end; }
  .modal { max-height: 85vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }

  .filter-bar { padding: 10px 16px; }
  .search-box input { min-width: 180px; }

  .toast-container { bottom: 16px; right: 16px; left: 16px; max-width: none; }

  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header-right { width: 100%; }
  .page-header-right .btn { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  .login-card { padding: 28px 20px; }
  .stat-card { flex-direction: column; }
  .stat-icon { width: 40px; height: 40px; font-size: 18px; }
}

/* ── Print ── */
@media print {
  .sidebar, .topbar, .toast-container, .notif-panel { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 0; }
}

/* ── Utility ── */
.d-none  { display: none !important; }
.d-flex  { display: flex !important; }
.d-grid  { display: grid !important; }
.d-block { display: block !important; }

.flex-1    { flex: 1; }
.gap-1     { gap: 4px; }
.gap-2     { gap: 8px; }
.gap-3     { gap: 12px; }
.gap-4     { gap: 16px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mt-6 { margin-top: 24px; }

.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }

.p-0  { padding: 0; }
.p-4  { padding: 16px; }

.text-center { text-align: center; }
.text-right  { text-align: right; }

.text-sm      { font-size: 12px; }
.text-base    { font-size: 14px; }
.text-lg      { font-size: 16px; }
.text-xl      { font-size: 20px; }
.text-2xl     { font-size: 24px; }

.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }

.text-primary-c  { color: var(--primary); }
.text-success    { color: var(--success); }
.text-warning    { color: var(--warning); }
.text-danger     { color: var(--danger); }
.text-info       { color: var(--info); }
.text-muted      { color: var(--text-muted); }
.text-secondary  { color: var(--text-secondary); }

.bg-card { background: var(--bg-card); }

.w-full  { width: 100%; }
.h-full  { height: 100%; }

.rounded   { border-radius: var(--radius); }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-full { border-radius: var(--radius-pill); }

.border { border: 1px solid var(--border); }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

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

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

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* Dark mode toggle */
.theme-toggle {
  width: 38px; height: 38px;
  border: none;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  transition: background var(--t-fast);
}

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

/* ── SweetAlert Override ── */
.swal2-popup {
  border-radius: var(--radius-lg) !important;
  font-family: var(--font-main) !important;
}

[data-theme="dark"] .swal2-popup {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .swal2-title { color: var(--text-primary) !important; }
[data-theme="dark"] .swal2-content { color: var(--text-secondary) !important; }
