:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #eef3f8;
  --text: #17202a;
  --muted: #667085;
  --line: #d9e1ea;
  --primary: #1769aa;
  --primary-dark: #0f4f84;
  --accent: #d96c22;
  --danger: #b42318;
  --success: #1f7a4d;
  --shadow: 0 8px 24px rgba(20, 31, 46, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: var(--primary); text-decoration: none; }
input, select, textarea, button { font: inherit; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 11px;
  background: #fff;
  color: var(--text);
}
textarea { min-height: 92px; resize: vertical; }
label { display: block; margin: 0 0 5px; font-weight: 700; font-size: 13px; color: #344054; }

.app { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.side { background: #101820; color: #fff; padding: 26px 16px; }
.side-logo { display: block; max-width: 150px; max-height: 80px; object-fit: contain; margin: 0 0 14px; }
.brand { font-size: 20px; font-weight: 800; }
.tag { color: #b8c4d2; font-size: 13px; margin: 3px 0 20px; }
.nav { display: grid; gap: 5px; }
.nav a { color: #d7e2ee; padding: 12px 12px; border-radius: 7px; font-weight: 750; }
.nav a.active, .nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.main { min-width: 0; padding: 28px 26px; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.topbar h1 { margin: 0; font-size: 26px; line-height: 1.15; }
.muted, .userbar, .small { color: var(--muted); }
.userbar { margin-top: 4px; font-size: 13px; }
.logout { font-weight: 700; }
.card, .empty-state {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  background: linear-gradient(135deg, #101820, #24465f);
}
.login-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 8px;
  padding: 26px;
  box-shadow: 0 18px 50px rgba(0,0,0,.22);
}
.login-card .brand { color: var(--text); }
.login-card .tag { color: var(--muted); margin-bottom: 18px; }
.section-title { margin: 0 0 12px; font-size: 18px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.report-cards, .kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.report-card, .kpi-card, .kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.report-card strong, .kpi-card strong, .metric { display: block; font-size: 22px; font-weight: 850; line-height: 1.2; margin-top: 4px; }
.label { color: #2f3a47; font-weight: 800; }
.search-card, .report-filter { margin-bottom: 16px; }
.notice, .error {
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: #e8f5ee;
  color: #145237;
  border: 1px solid #b7dec9;
}
.error { background: #fff0f0; color: #8f1f17; border-color: #f0b8b3; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 0;
  border-radius: 7px;
  padding: 12px 18px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
  gap: 6px;
}
.btn:hover { background: var(--primary-dark); color: #fff; }
.btn.orange { background: var(--accent); }
.btn.secondary { background: #24465f; }
.btn.light { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--danger); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.smallbtn { min-height: 38px; padding: 8px 12px; font-size: 14px; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.form .full, .full { grid-column: 1 / -1; }
.inline, .actions, .driver-actions, .inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions { margin-bottom: 14px; }
.report-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 16px;
}
.report-tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 7px;
  padding: 9px 13px;
  background: #e8eef5;
  color: #24465f;
  font-weight: 850;
  border: 1px solid #d2dde8;
}
.report-tabs a.active,
.report-tabs a:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.report-quick-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); }
.table th, .table td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { background: #eef3f8; font-size: 13px; color: #475467; }
.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 800; background: #eaf1f8; color: #27506d; }
.pill.paid { background: #e7f6ee; color: var(--success); }
.pill.unpaid { background: #fff0f0; color: var(--danger); }
.pill.progress { background: #fff4e6; color: #9a4f13; }
.settings-logo { max-width: 220px; max-height: 120px; object-fit: contain; display: block; }
.uploaded-file, .upload-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
  margin: 4px;
  background: #fff;
}
.uploaded-file img, .upload-item img { max-width: 120px; max-height: 90px; border-radius: 6px; object-fit: cover; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16,24,32,.52);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 20;
}
.modal-backdrop.active, .modal-backdrop[aria-hidden="false"] { display: flex; }
.modal-card {
  width: min(680px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.26);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.modal-head h2 { margin: 0; }
.modal-close {
  border: 0;
  background: var(--surface-2);
  border-radius: 7px;
  min-width: 38px;
  min-height: 38px;
  font-size: 24px;
  cursor: pointer;
}
.modal-actions { justify-content: flex-end; }

.driver-job {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.driver-job-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.driver-job-kicker {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}
.driver-job h2 { margin: 2px 0 4px; font-size: 24px; line-height: 1.15; }
.driver-job p { margin: 0; color: var(--muted); }
.driver-primary-action { margin: 16px 0; }
.driver-next-btn {
  width: 100%;
  min-height: 64px;
  font-size: 20px;
  background: var(--accent);
}
.driver-complete {
  margin: 16px 0;
  border-radius: 8px;
  padding: 16px;
  background: #e7f6ee;
  color: var(--success);
  font-weight: 900;
  text-align: center;
}
.driver-location-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.driver-location {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}
.driver-location span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.driver-location strong { display: block; line-height: 1.3; }
.driver-location p { margin-top: 8px; font-size: 13px; }
.driver-link { width: 100%; margin-top: 10px; }
.driver-call-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin: 12px 0; }
.driver-call-row .btn { width: 100%; }
.driver-progress {
  display: grid;
  grid-template-columns: repeat(6, minmax(0,1fr));
  gap: 7px;
  margin: 14px 0;
}
.progress-step {
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
  font-size: 13px;
  font-weight: 800;
}
.progress-step span, .progress-step small { display: block; }
.progress-step span { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.progress-step small { color: var(--muted); margin-top: 3px; font-size: 11px; font-weight: 600; }
.progress-step.done { border-color: #b7dec9; background: #edf8f2; color: var(--success); }
.driver-details {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}
.driver-details summary {
  cursor: pointer;
  font-weight: 900;
  min-height: 40px;
  display: flex;
  align-items: center;
}
.driver-update-form { margin-top: 8px; }
.driver-uploads { margin-top: 8px; }

@media (max-width: 780px) {
  .app { display: block; }
  .side { padding: 14px; }
  .side-logo { max-height: 54px; }
  .brand { font-size: 18px; }
  .tag { margin-bottom: 10px; }
  .nav { grid-template-columns: 1fr; }
  .main { padding: 14px; }
  .topbar { align-items: stretch; }
  .topbar h1 { font-size: 22px; }
  .topbar > .btn { display: none; }
  .form { grid-template-columns: 1fr; }
  .grid.two, .grid.three, .report-cards, .kpi-grid { grid-template-columns: 1fr; }
  .report-tabs { display: grid; grid-template-columns: 1fr 1fr; }
  .report-tabs a { width: 100%; }
  .report-quick-links { display: grid; grid-template-columns: 1fr; }
  .detail-head { display: block; }
  .table { display: block; overflow-x: auto; }
  .driver-job { padding: 14px; margin-left: -2px; margin-right: -2px; }
  .driver-job h2 { font-size: 22px; }
  .driver-job-head { align-items: flex-start; }
  .driver-location-grid, .driver-call-row { grid-template-columns: 1fr; }
  .driver-progress { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .driver-actions { display: grid; grid-template-columns: 1fr; }
  .driver-actions .inline-form, .driver-actions .btn { width: 100%; }
  .btn { width: 100%; }
  .inline { align-items: stretch; }
  .inline input { min-width: 0; }
}
