:root {
  --bg: #040914;
  --panel: #0d1730;
  --panel-2: #132347;
  --line: rgba(126, 211, 255, 0.25);
  --accent: #7ed3ff;
  --accent-2: #3da8dd;
  --text: #f3f9ff;
  --muted: rgba(243, 249, 255, 0.65);
  --ok: #65d28a;
  --warn: #f5c96b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #17325f 0%, #071022 45%, #03070f 100%);
}

.topbar {
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  backdrop-filter: blur(8px);
}

.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 12px;
  margin: 0 0 6px;
}

h1, h2 { margin: 0; }
h1 { font-size: clamp(1.4rem, 2vw, 2rem); }
h2 { font-size: 1.1rem; }

.layout {
  padding: 22px;
  display: grid;
  gap: 20px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.stat-card {
  background: linear-gradient(150deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 1.7rem; margin-top: 5px; font-weight: 700; }

.panel {
  background: linear-gradient(150deg, rgba(19,35,71,0.75), rgba(12,22,44,0.75));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

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

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.filters input,
.filters select {
  min-height: 36px;
}

.filters input[type="text"] {
  min-width: 240px;
  background: #0f1c37;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

th, td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid rgba(126, 211, 255, 0.12);
  font-size: 14px;
}

th { color: var(--muted); font-weight: 600; }

.badge {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
}

.badge.ok { color: var(--ok); border-color: rgba(101, 210, 138, 0.5); }
.badge.warn { color: var(--warn); border-color: rgba(245, 201, 107, 0.5); }

.card-list {
  display: grid;
  gap: 10px;
}

.item-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: rgba(8, 15, 30, 0.65);
}

.muted { color: var(--muted); font-size: 13px; }

.btn-sm {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}
.btn-sm:hover { border-color: var(--accent); color: var(--accent); }

.btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #00101d;
  border-color: transparent;
  font-weight: 700;
}

select {
  background: #0f1c37;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

@media (max-width: 950px) {
  .two-col { grid-template-columns: 1fr; }
}

/* ─── Dispatch Modal ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 13, 0.82);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.hidden { display: none; }

.modal {
  background: linear-gradient(150deg, #0f1e3d, #091629);
  border: 1px solid var(--line);
  border-radius: 18px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 32px 80px rgba(0,0,0,0.7);
}

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

.modal-head h2 { font-size: 1.15rem; }

.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 20px; }

.dispatch-summary {
  background: rgba(126, 211, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
  font-size: 13px;
}

.dispatch-summary .ds-row { display: flex; flex-direction: column; gap: 2px; }
.dispatch-summary .ds-label { color: var(--accent); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; }
.dispatch-summary .ds-val { font-weight: 600; }
.dispatch-summary .ds-full { grid-column: 1 / -1; }

.dispatch-section { display: flex; flex-direction: column; gap: 8px; }
.dispatch-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }

.dispatch-select {
  width: 100%;
  background: #0d1e3a;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
}

.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-pill {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Space Grotesk', sans-serif;
}

.status-pill:hover { border-color: var(--accent); color: var(--accent); }
.status-pill.active { background: var(--accent); color: #001a2e; border-color: var(--accent); font-weight: 700; }

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

/* ─── Table action buttons ─── */
.action-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  font-family: 'Space Grotesk', sans-serif;
  white-space: nowrap;
  transition: all 0.2s;
}

.action-btn:hover { border-color: var(--accent); color: var(--accent); }
.action-btn.dispatch { background: rgba(111, 207, 255, 0.1); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.action-btn.complete { border-color: var(--ok); color: var(--ok); }
.action-btn.cancel { border-color: #ff6b6b; color: #ff6b6b; }

/* ─── Payout controls row ─── */
.payout-controls {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.payout-control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 200px;
}

/* ─── Driver payout card ─── */
.payout-driver-card {
  background: linear-gradient(135deg, rgba(126,211,255,0.07), rgba(9,22,41,0.4));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.payout-driver-card.hidden { display: none; }

.pdc-section { display: flex; flex-direction: column; gap: 14px; }
.pdc-section.full { grid-column: 1 / -1; }

.pdc-block { display: flex; flex-direction: column; gap: 3px; }
.pdc-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); }
.pdc-value { font-size: 15px; font-weight: 600; }
.pdc-value.big { font-size: 1.8rem; color: var(--ok); }
.pdc-value.warn { color: #f5c96b; }
.pdc-value.muted-val { color: var(--muted); font-weight: 400; }

.pdc-divider { grid-column: 1 / -1; height: 1px; background: var(--line); }

.pdc-actions { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 4px; }

/* ─── Payout table ─── */
.payout-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.payout-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--line);
}

.payout-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.payout-table tr:last-child td { border-bottom: none; }
.payout-amount { font-size: 1rem; font-weight: 700; color: var(--ok); }
.payout-rate { font-size: 11px; color: var(--muted); }

/* bank account modal inputs */
#bankModal input, #bankModal select { width: 100%; box-sizing: border-box; }
