/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: #eef0f5; color: #1f2937; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; }
input, select, textarea, button { font-family: inherit; }

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

/* ── Sidebar ── */
.sidebar {
  width: 210px;
  min-height: 100vh;
  background: #fff;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #f1f3f8;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px 18px;
}
.logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, #4dd9c0, #34d399);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-name { font-size: 13px; font-weight: 700; color: #111827; line-height: 1.2; }
.logo-sub  { font-size: 10px; color: #9ca3af; font-weight: 500; }
.sidebar-divider-line { width: 2px; background: #f1f3f8; margin: 0 20px 16px; height: 1px; }

/* ── Navigation ── */
.sidebar-nav { flex: 1; padding: 0 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: #6b7280;
  transition: all .18s;
}
.nav-item:hover { background: #f9fafb; color: #374151; }
.nav-item.active { background: #f0fdf9; color: #059669; font-weight: 600; }
.nav-item.active .nav-icon { color: #10b981; }
.nav-icon { display: flex; align-items: center; width: 22px; flex-shrink: 0; }

/* ── Sidebar User ── */
.sidebar-user {
  display: flex; align-items: center; gap: 9px;
  padding: 14px 16px;
  border-top: 1px solid #f1f3f8;
  margin-top: auto;
}
.user-avatar { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12.5px; font-weight: 600; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: #9ca3af; text-transform: capitalize; }
.logout-btn { color: #9ca3af; display: flex; align-items: center; padding: 4px; border-radius: 6px; transition: color .15s; }
.logout-btn:hover { color: #ef4444; }

/* ── Main Content ── */
.main-content { flex: 1; padding: 28px 30px; overflow-x: hidden; }

/* ── Page Header ── */
.page-header { margin-bottom: 24px; }
.page-title { font-size: 20px; font-weight: 700; color: #111827; }
.page-sub   { font-size: 13px; color: #9ca3af; margin-top: 2px; }

/* ── Metric Cards ── */
.cards-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }

.metric-card {
  border-radius: 18px;
  padding: 20px 18px;
  position: relative;
  overflow: hidden;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.metric-card-1 { background: linear-gradient(135deg, #4dd9c0 0%, #52e5a5 100%); }
.metric-card-2 { background: linear-gradient(135deg, #ff8c6b 0%, #ffb85e 100%); }
.metric-card-3 { background: linear-gradient(135deg, #a78bfa 0%, #c4b5fd 100%); }
.metric-card-4 { background: linear-gradient(135deg, #6ee7b7 0%, #34d399 100%); }

.card-blob {
  position: absolute;
  border-radius: 50% 30% 60% 40% / 40% 60% 30% 70%;
  opacity: .25;
  pointer-events: none;
}
.metric-card-1 .card-blob { width: 90px; height: 80px; background: #fff; top: -20px; right: -10px; }
.metric-card-2 .card-blob { width: 90px; height: 80px; background: #fff; top: -15px; right: -5px; }
.metric-card-3 .card-blob { width: 90px; height: 80px; background: #fff; top: -18px; right: -8px; }
.metric-card-4 .card-blob { width: 90px; height: 80px; background: #fff; top: -20px; right: -10px; }

.card-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: rgba(255,255,255,.8); }
.card-value { font-size: 32px; font-weight: 700; color: #fff; line-height: 1.1; margin-top: 6px; }
.card-sub   { font-size: 11px; color: rgba(255,255,255,.7); margin-top: 2px; }
.card-icon  {
  position: absolute; bottom: 14px; right: 16px;
  width: 36px; height: 36px;
  background: rgba(255,255,255,.2);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.85);
}

/* ── White Card ── */
.card {
  background: #fff;
  border-radius: 18px;
  padding: 22px 24px;
  box-shadow: 0 1px 8px rgba(0,0,0,.05);
  border: 1px solid #f1f3f8;
}

/* ── Dashboard Grid ── */
.dashboard-grid { display: grid; grid-template-columns: 1fr 320px; gap: 18px; margin-bottom: 18px; }

/* ── Hero Banner ── */
.hero-banner {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-radius: 18px;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  position: relative;
  margin-bottom: 20px;
}
.hero-text h2 { font-size: 19px; font-weight: 700; color: #065f46; }
.hero-text p  { font-size: 13px; color: #6ee7b7; margin-top: 4px; }
.hero-truck svg { opacity: .7; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: #9ca3af;
  padding: 0 12px 12px; text-align: left; white-space: nowrap;
}
tbody tr { border-bottom: 1px solid #f9fafb; transition: background .12s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #fafafa; }
tbody td { padding: 12px; font-size: 13.5px; color: #374151; }
.td-mono { font-family: 'Courier New', monospace; font-size: 12px; font-weight: 700; color: #059669; }

/* ── Status Dots (table) ── */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot-green  { background: #10b981; }
.dot-orange { background: #f59e0b; }
.dot-purple { background: #8b5cf6; }
.dot-blue   { background: #3b82f6; }
.dot-red    { background: #ef4444; }
.dot-gray   { background: #9ca3af; }

/* ── Bar Chart ── */
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 64px; padding-top: 8px; }
.bar {
  flex: 1; border-radius: 4px 4px 0 0;
  transition: opacity .2s;
}
.bar:hover { opacity: .8; }
.bar-green { background: linear-gradient(to top, #10b981, #6ee7b7); }
.bar-gray  { background: #e5e7eb; }

/* ── Form Styles ── */
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 5px; }
.form-group label span.req { color: #ef4444; }
.form-control {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid #e5e7eb; border-radius: 10px;
  font-size: 13.5px; color: #111827;
  outline: none; transition: border-color .15s, box-shadow .15s;
  background: #fff;
}
.form-control:focus { border-color: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,.1); }
.form-control.error { border-color: #ef4444; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 10px; border: none;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.btn-primary { background: #10b981; color: #fff; }
.btn-primary:hover { background: #059669; }
.btn-secondary { background: #fff; color: #374151; border: 1.5px solid #e5e7eb; }
.btn-secondary:hover { background: #f9fafb; }
.btn-danger { background: #fef2f2; color: #dc2626; border: 1.5px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ── Alert ── */
.alert { padding: 12px 16px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Section Header ── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.section-title  { font-size: 15px; font-weight: 700; color: #111827; }
.section-link   { font-size: 12.5px; color: #10b981; font-weight: 500; }
.section-link:hover { text-decoration: underline; }

/* ── Badge ── */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-orange { background: #fef3c7; color: #92400e; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-purple { background: #ede9fe; color: #4c1d95; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-gray   { background: #f3f4f6; color: #374151; }

/* ── Filter Bar ── */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 20px; }
.filter-bar .form-control { min-width: 160px; }

/* ── Pagination ── */
.pagination { display: flex; gap: 4px; align-items: center; justify-content: flex-end; padding-top: 16px; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: #6b7280; border: 1.5px solid #e5e7eb;
  transition: all .15s;
}
.pagination a:hover { background: #f9fafb; border-color: #d1d5db; color: #111827; }
.pagination .current { background: #10b981; color: #fff; border-color: #10b981; }

/* ── Login Page ── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 40%, #ede9fe 100%);
  padding: 20px;
}
.login-box { background: #fff; border-radius: 20px; padding: 40px; width: 100%; max-width: 400px; box-shadow: 0 8px 40px rgba(0,0,0,.1); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 12px; }
.login-logo h1 { font-size: 22px; font-weight: 700; color: #111827; }
.login-logo p  { font-size: 13px; color: #6b7280; margin-top: 4px; }

/* ── Tracking Page ── */
.track-page { max-width: 560px; margin: 0 auto; padding: 40px 16px; }
.track-status-card { border-radius: 20px; padding: 24px; text-align: center; color: #fff; margin-bottom: 20px; }
.track-status-delivered { background: linear-gradient(135deg, #10b981, #34d399); }
.track-status-transit   { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.track-status-pending   { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.timeline-item { display: flex; gap: 14px; padding: 10px 0; }
.timeline-dot  { width: 12px; height: 12px; border-radius: 50%; background: #10b981; flex-shrink: 0; margin-top: 3px; }
.timeline-line { width: 2px; background: #e5e7eb; margin: 0 auto; }

/* ── Driver Grid ── */
.drivers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.driver-card { background: #fff; border-radius: 16px; padding: 20px; border: 1px solid #f1f3f8; box-shadow: 0 1px 6px rgba(0,0,0,.04); transition: box-shadow .2s; }
.driver-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.09); }
.driver-avatar { width: 52px; height: 52px; border-radius: 14px; object-fit: cover; margin-bottom: 12px; }
.driver-name { font-size: 14px; font-weight: 700; color: #111827; }
.driver-phone { font-size: 12px; color: #6b7280; margin-top: 2px; }
.driver-meta  { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.driver-actions { display: flex; gap: 8px; margin-top: 14px; }
.driver-actions a { flex: 1; text-align: center; padding: 7px; border: 1.5px solid #e5e7eb; border-radius: 8px; font-size: 12px; font-weight: 600; color: #6b7280; transition: all .15s; }
.driver-actions a:hover { background: #f9fafb; color: #374151; }

/* ── Progress Bar ── */
.progress { background: #e5e7eb; border-radius: 4px; height: 6px; overflow: hidden; }
.progress-bar { background: linear-gradient(90deg, #10b981, #34d399); height: 100%; border-radius: 4px; transition: width .4s; }

/* ── Analytics ── */
.analytics-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi-card { background: #fff; border-radius: 14px; padding: 18px 20px; border: 1px solid #f1f3f8; }
.kpi-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: #9ca3af; }
.kpi-value { font-size: 28px; font-weight: 700; color: #111827; margin-top: 4px; line-height: 1; }
.kpi-sub   { font-size: 12px; color: #6b7280; margin-top: 4px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .cards-grid { grid-template-columns: 1fr 1fr; }
  .analytics-kpis { grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}
