@font-face {
  font-family: "Jakarta";
  src: url("../../shared/fonts/plus-jakarta-sans-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --green-900:#062e1b;
  --green-700:#0b663a;
  --green-600:#0f7f47;
  --green-500:#17a05a;
  --green-400:#2db36e;
  --green-100:#d9f2e3;
  --green-050:#edf9f1;
  --ink-900:#0e1c15;
  --ink-700:#33463b;
  --ink-500:#62766a;
  --ink-300:#a3b2a9;
  --line:#e5ebe7;
  --bg-app:#f5f7f5;
  --white: #ffffff;
  --danger:#c9362c;
  --danger-100:#fcebe9;
  --amber:#9a6208;
  --amber-100:#fdf1d8;
  --info:#1f57c3;
  --info-100:#e6eefc;
  --radius-lg:18px;
  --radius-md:14px;
  --radius-sm:10px;
  --shadow-card: 0 4px 14px rgba(14, 77, 43, 0.06);
  --shadow-modal: 0 30px 60px rgba(14, 36, 26, 0.28);
  --font-display: "Jakarta", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg-app);
  color: var(--ink-900);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Buttons & fields (shared) ---------- */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  transition: transform 0.08s ease, box-shadow 0.15s ease;
}

.btn-primary {
  background: linear-gradient(145deg, var(--green-500), var(--green-700));
  color: white;
  box-shadow: 0 8px 18px rgba(21, 150, 71, 0.25);
}

.btn-primary:active { transform: translateY(1px); }

.btn-ghost {
  background: var(--white);
  color: var(--green-700);
  border: 1.5px solid var(--line);
  margin-top: 8px;
}

.btn-inline {
  width: auto;
  margin-top: 14px;
  padding: 10px 22px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-700);
  margin-bottom: 14px;
}

.field input, .select-input {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  font-weight: 400;
  font-family: inherit;
  color: var(--ink-900);
  background: var(--white);
  outline: none;
}

.field input:focus, .select-input:focus {
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px var(--green-100);
}

.field-error {
  color: var(--danger);
  font-size: 12px;
  margin: -8px 0 10px;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-700);
  margin-bottom: 12px;
}

.checkbox-field input {
  width: 16px;
  height: 16px;
  accent-color: var(--green-600);
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink-700);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.icon-btn:hover { background: var(--green-050); color: var(--green-700); }

/* ---------- Login screen ---------- */
.login-screen {
  height: 100vh;
  display: flex;
}

.login-card {
  width: 420px;
  max-width: 100%;
  flex-shrink: 0;
  padding: 60px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--white);
  overflow-y: auto;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
}

.login-brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--green-900);
}

.login-brand span {
  font-size: 11px;
  color: var(--ink-500);
  font-weight: 600;
}

.brand-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--green-500), var(--green-700));
  color: white;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 6px 14px rgba(21, 150, 71, 0.3);
}

.login-card h1 {
  font-family: var(--font-display);
  font-size: 26px;
  margin: 0 0 8px;
  color: var(--ink-900);
}

.login-lead {
  color: var(--ink-500);
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0 0 28px;
}

.login-art {
  flex: 1;
  background-image:
    linear-gradient(160deg, rgba(8, 40, 22, 0.35), rgba(7, 43, 24, 0.85)),
    url("../../tuktuk.jpg");
  background-size: cover;
  background-position: center 55%;
}

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

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px 20px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.sidebar-brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--green-900);
}

.sidebar-brand span {
  font-size: 10.5px;
  color: var(--ink-500);
  font-weight: 600;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  border: none;
  background: none;
  text-align: left;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-700);
  cursor: pointer;
}

.nav-link svg { flex-shrink: 0; color: var(--ink-300); }

.nav-link:hover { background: var(--green-050); }

.nav-link.is-active {
  background: var(--green-100);
  color: var(--green-900);
  font-weight: 700;
}

.nav-link.is-active svg { color: var(--green-700); }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px 4px;
  border-top: 1px solid var(--line);
  margin-top: 10px;
}

.avatar-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--green-400), var(--green-700));
  color: white;
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.sidebar-user-text strong { font-size: 12.5px; color: var(--ink-900); }
.sidebar-user-text span { font-size: 11px; color: var(--ink-500); }

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: 64px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 0;
  color: var(--ink-900);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-app);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  color: var(--ink-500);
  width: 280px;
}

.topbar-search input {
  border: none;
  background: none;
  outline: none;
  font-size: 13px;
  width: 100%;
  color: var(--ink-900);
}

.topbar-badge {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-500);
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

.page { display: none; }
.page.active { display: block; }

/* ---------- Stat cards ---------- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}

.stat-card .stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--ink-900);
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--ink-500);
  font-weight: 600;
}

.stat-card.accent-amber .stat-value { color: var(--amber); }
.stat-card.accent-info .stat-value { color: var(--info); }
.stat-card.accent-green .stat-value { color: var(--green-700); }
.stat-card.accent-danger .stat-value { color: var(--danger); }

/* ---------- Panels & grids ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
  align-items: start;
}

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}

.panel:last-child { margin-bottom: 0; }
.grid-2 .panel { margin-bottom: 0; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-head h3 {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink-900);
}

.panel-sub {
  font-size: 12px;
  color: var(--ink-500);
  font-weight: 600;
}

.legend {
  display: flex;
  gap: 12px;
  font-size: 11.5px;
  color: var(--ink-500);
  font-weight: 600;
}

.legend span { display: flex; align-items: center; gap: 5px; }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-online { background: var(--green-500); }
.dot-delivery { background: var(--info); }
.dot-offline { background: var(--ink-300); }

/* ---------- Lists (jobs / drivers) ---------- */
.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.list-item-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--green-050);
  color: var(--green-700);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.list-item-icon .dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  border: 2px solid white;
  width: 10px;
  height: 10px;
}

.list-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.list-item-text strong {
  font-size: 13px;
  color: var(--ink-900);
  cursor: pointer;
}

.list-item-text strong:hover { color: var(--green-700); }

.list-item-text span { font-size: 11.5px; color: var(--ink-500); font-weight: 600; }

.list-item-action {
  flex-shrink: 0;
}

.list-item-action .btn {
  width: auto;
  padding: 7px 14px;
  font-size: 12px;
}

.empty-state {
  text-align: center;
  padding: 20px 10px;
  color: var(--ink-300);
  font-size: 12.5px;
  font-weight: 600;
}

/* ---------- Maps ---------- */
.map-box {
  isolation: isolate;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #dff2e4;
  border: 1px solid var(--line);
}

.map-box-small { height: 260px; }
.map-box-large { height: 440px; margin-bottom: 24px; }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.toolbar .topbar-search { width: 320px; background: var(--white); }

/* ---------- Data tables ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--ink-500);
  font-weight: 700;
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--line);
}

.data-table tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-700);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--green-050); }

.data-table strong { color: var(--ink-900); cursor: pointer; }
.data-table strong:hover { color: var(--green-700); }

.table-action-btn {
  border: 1.5px solid var(--line);
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--green-700);
  cursor: pointer;
}

/* ---------- Status badges ---------- */
.status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--green-100);
  color: var(--green-700);
}

.status-badge.is-unassigned { background: var(--amber-100); color: var(--amber); }
.status-badge.is-in_transit { background: var(--info-100); color: var(--info); }
.status-badge.is-delivered { background: var(--green-100); color: var(--green-700); }
.status-badge.is-failed { background: var(--danger-100); color: var(--danger); }
.status-badge.is-online { background: var(--green-100); color: var(--green-700); }
.status-badge.is-on_delivery { background: var(--info-100); color: var(--info); }
.status-badge.is-offline { background: var(--line); color: var(--ink-500); }

/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 20, 14, 0.45);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal-overlay.is-open .modal-backdrop { opacity: 1; }

.modal-card {
  position: relative;
  width: 480px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-modal);
  transform: scale(0.96) translateY(8px);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.modal-overlay.is-open .modal-card {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.modal-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.modal-card-head h3 {
  margin: 0;
  font-size: 16px;
  color: var(--ink-900);
}

.modal-order-summary {
  font-size: 12.5px;
  color: var(--ink-500);
  font-weight: 600;
  margin: 0 0 16px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 16px 0;
}

.detail-grid div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.detail-grid span {
  font-size: 11px;
  color: var(--ink-500);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.detail-grid strong { font-size: 13.5px; color: var(--ink-900); }

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 10px;
}

.timeline-step {
  position: relative;
  display: flex;
  gap: 12px;
  padding-bottom: 18px;
}

.timeline-step:last-child { padding-bottom: 0; }

.timeline-step::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 14px;
  bottom: -2px;
  width: 2px;
  background: var(--line);
}

.timeline-step:last-child::after { display: none; }

.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green-500);
  flex-shrink: 0;
  margin-top: 2px;
}

.timeline-step.is-pending .timeline-dot { background: var(--ink-300); }

.timeline-text strong { display: block; font-size: 13px; color: var(--ink-900); }
.timeline-text span { font-size: 11.5px; color: var(--ink-500); font-weight: 600; }

/* ---------- Settings ---------- */
.settings-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.settings-tabs {
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 10px;
}

.settings-tab {
  text-align: left;
  border: none;
  background: none;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-700);
  cursor: pointer;
}

.settings-tab:hover { background: var(--green-050); }
.settings-tab.is-active { background: var(--green-100); color: var(--green-900); font-weight: 700; }

.settings-panel { flex: 1; min-width: 0; }
.settings-pane { display: none; }
.settings-pane.is-active { display: block; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 20px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: var(--ink-900);
  color: white;
  padding: 12px 20px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 200;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 760px) {
  .login-art { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .settings-layout { flex-direction: column; }
  .settings-tabs { width: 100%; flex-direction: row; flex-wrap: wrap; }
}

/* ---------- Feedback round: rate card + failed deliveries ---------- */
.status-badge.is-returned { background: var(--line); color: var(--ink-700); }

.rate-preview {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-500);
  line-height: 1.7;
}

.btn-ghost.btn-inline { margin-left: 8px; }

.field input:disabled { background: var(--bg-app); color: var(--ink-500); }

.failed-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--danger-100);
  border: 1px solid #f3c9c5;
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 14px;
}

.failed-box strong { color: var(--danger); font-size: 13px; }
.failed-box span { font-size: 12.5px; color: var(--ink-700); font-weight: 600; }
.failed-actions { display: flex; margin-top: 8px; }
.failed-actions .btn-inline { margin-top: 0; }
.failed-actions .btn-ghost.btn-inline { margin-left: 8px; }

/* ---------- Driver detail: recent deliveries trip list ---------- */
.modal-card .panel-head {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.trip-amount {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-900);
  white-space: nowrap;
}

/* ---------- Refinements ---------- */
button, input, select, textarea { font-family: inherit; }
.btn { border-radius: 12px; }
.btn-primary { background: var(--green-700); box-shadow: 0 8px 18px -8px rgba(11, 102, 58, 0.6); }
.brand-badge, .avatar-badge { background: var(--green-900); color: #c5f06a; box-shadow: none; }
.sidebar { background: #072f1c; border-right: 0; color: #fff; }
.sidebar .brand-badge { background: #c5f06a; color: #072f1c; }
.sidebar-brand { border-bottom-color: rgba(255,255,255,0.1); }
.sidebar-brand strong { color: #fff; }
.sidebar-brand span, .sidebar-user-text span { color: rgba(255,255,255,0.6); }
.nav-link { color: rgba(255,255,255,0.78); }
.nav-link svg { color: rgba(255,255,255,0.5); }
.nav-link:hover { background: rgba(255,255,255,0.07); }
.nav-link.is-active { background: #c5f06a; color: #072f1c; }
.nav-link.is-active svg { color: #072f1c; }
.sidebar-user { border-top-color: rgba(255,255,255,0.1); }
.sidebar-user-text strong { color: #fff; }
.sidebar .avatar-badge { background: rgba(255,255,255,0.12); }
.sidebar .icon-btn { background: transparent; border-color: rgba(255,255,255,0.18); color: #fff; }
.topbar h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.stat-card .stat-value { font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--ink-900); }
.panel { overflow-x: auto; }
.panel-head h3 { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.data-table { font-variant-numeric: tabular-nums; }
.stat-card .stat-value { white-space: nowrap; font-size: 22px; }
.rule-banner { margin: 0 0 24px; padding: 14px 18px; border-radius: 14px; background: var(--green-050); border: 1px solid var(--green-100); font-size: 13px; font-weight: 600; line-height: 1.55; color: var(--ink-700); }
.table-note { margin: 12px 0 0; font-size: 11.5px; color: var(--ink-500); }
.field select { width: 100%; }
