/* ─── DispatchHQ Admin Dashboard ─────────────────────────────────────────── */

/* Subnav (sits below the main site header) */
.sub-header {
  background: var(--bg-dark);
  border-bottom: 1px solid rgba(245,240,232,0.08);
  padding: 0 40px;
}
.sub-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 48px;
  gap: 8px;
}
.sub-tab {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(245,240,232,0.5);
  text-decoration: none;
  padding: 4px 16px;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
  cursor: pointer;
  border: none;
  background: none;
}
.sub-tab:hover { color: var(--fg-light); background: rgba(245,240,232,0.06); }
.sub-tab.active { color: var(--accent); background: rgba(245,166,35,0.12); }

/* Dashboard layout */
.dash-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 40px 80px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 40px;
  align-items: start;
}

/* Sidebar */
.dash-sidebar { position: sticky; top: 108px; }
.sidebar-section { margin-bottom: 32px; }
.sidebar-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
  padding-left: 4px;
}
.sidebar-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--fg);
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
  margin-bottom: 8px;
}
.sidebar-btn:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(245,166,35,0.15); }
.sidebar-btn .icon { font-size: 1.1rem; }
.sidebar-count {
  margin-left: auto;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
}

/* Main content */
.dash-main { min-width: 0; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.4rem;
  letter-spacing: 0.06em;
  color: var(--fg);
}
.btn-primary {
  background: var(--accent);
  color: var(--bg-dark);
  border: none;
  padding: 8px 18px;
  border-radius: 4px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent-dark); }

/* Status board columns */
.status-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.status-col { background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.status-col-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.status-col-title {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.badge {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 10px;
}
.badge-pending { background: #fff3cd; color: #856404; }
.badge-in-progress { background: #cce5ff; color: #004085; }
.badge-delivered { background: #d4edda; color: #155724; }
.status-col-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 120px; }

/* Delivery card */
.delivery-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.delivery-card:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(245,166,35,0.12); }
.delivery-card-id {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}
.delivery-card-route {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.delivery-card-route svg { flex-shrink: 0; margin-top: 2px; color: var(--accent); }
.delivery-card-driver {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.delivery-card-driver .driver-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #28a745;
  flex-shrink: 0;
}
.delivery-card-driver.unassigned .driver-dot { background: var(--muted); }
.delivery-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  font-size: 0.82rem;
  color: var(--border);
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.05em;
  text-align: center;
  padding: 0 12px;
}

/* Driver table */
.driver-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.driver-table th {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 16px;
  text-align: left;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.driver-table td {
  padding: 14px 16px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.driver-table tr:last-child td { border-bottom: none; }
.driver-table tr:hover td { background: var(--bg); }
.avail-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; }
.avail-dot.available { background: #28a745; }
.avail-dot.busy { background: #ffc107; }
.avail-dot.offline { background: #ccc; }
.avail-badge {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 3px;
}
.avail-badge.available { background: #d4edda; color: #155724; }
.avail-badge.busy { background: #fff3cd; color: #856404; }
.avail-badge.offline { background: #e9ecef; color: var(--muted); }
.actions-cell { display: flex; gap: 8px; }
.btn-icon {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: none;
  cursor: pointer;
  font-size: 0.8rem;
  transition: border-color 0.15s, color 0.15s;
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }
.btn-icon.delete:hover { border-color: #dc3545; color: #dc3545; }

/* Modal overlay */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,26,46,0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card-bg);
  border-radius: 12px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-head {
  padding: 24px 28px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.3rem;
  letter-spacing: 0.06em;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 4px;
}
.modal-close:hover { color: var(--fg); }
.modal-body { padding: 24px 28px; }
.modal-foot { padding: 0 28px 24px; display: flex; gap: 10px; justify-content: flex-end; }

/* Form elements */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--fg);
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  background: var(--bg);
  color: var(--fg);
  transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.form-textarea { resize: vertical; min-height: 70px; }
.btn-secondary {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 8px 18px;
  border-radius: 4px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s;
}
.btn-secondary:hover { border-color: var(--accent); }
.btn-danger {
  background: #dc3545;
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 4px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.btn-danger:hover { background: #bd2130; }

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-dark);
  color: var(--fg-light);
  padding: 14px 20px;
  border-radius: 8px;
  font-size: 0.88rem;
  z-index: 300;
  display: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  border-left: 3px solid var(--accent);
}
.toast.show { display: block; }

/* Mobile */
@media (max-width: 900px) {
  .dash-wrap { grid-template-columns: 1fr; padding: 24px; }
  .dash-sidebar { position: static; }
  .status-board { grid-template-columns: 1fr; }
}