:root {
  --brand:        #2563eb;
  --brand-dark:   #1d4ed8;
  --brand-light:  #eaf1ff;
  --navy:         #0f1b2d;
  --navy-2:       #16273f;
  --bg:           #f4f6f8;
  --surface:      #ffffff;
  --border:       #e3e8ee;
  --text:         #1a2233;
  --text-muted:   #647189;
  --text-soft:    #94a0b3;
  --success:      #16a34a;
  --success-bg:   #e9f8ef;
  --warning:      #d97706;
  --warning-bg:   #fef3e2;
  --danger:       #dc2626;
  --danger-bg:    #fdecec;
  --info:         #2563eb;
  --info-bg:      #eaf1ff;
  --radius:       10px;
  --radius-sm:    7px;
  --shadow:       0 1px 2px rgba(15,27,45,.04), 0 4px 16px rgba(15,27,45,.06);
  --sidebar-w:    240px;
  --topbar-h:     60px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ── Login ── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--navy);
}
.login-card {
  width: 360px; background: var(--surface); border-radius: 14px; padding: 32px;
  box-shadow: var(--shadow);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.login-brand .dot { width: 30px; height: 30px; border-radius: 8px; background: var(--brand);
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; }
.login-brand span { font-size: 19px; font-weight: 700; letter-spacing: -0.3px; }
.login-sub { color: var(--text-muted); font-size: 13px; margin: 4px 0 22px; }
.portal-toggle { display: flex; background: var(--bg); border-radius: 8px; padding: 3px; margin-bottom: 18px; }
.portal-toggle button {
  flex: 1; border: none; background: transparent; padding: 8px; border-radius: 6px;
  font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer;
}
.portal-toggle button.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.field-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); margin: 0 0 6px; font-weight: 600; }
.field { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 14px; margin-bottom: 14px; background: var(--bg); }
.field:focus { outline: none; border-color: var(--brand); background: var(--surface); }
.btn { border: none; border-radius: var(--radius-sm); padding: 10px 16px; font-size: 14px; font-weight: 600;
  cursor: pointer; }
.btn-primary { background: var(--brand); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.login-error { background: var(--danger-bg); color: var(--danger); font-size: 13px; padding: 8px 12px;
  border-radius: var(--radius-sm); margin-bottom: 14px; display: none; }

/* ── App shell ── */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--navy); color: #cdd6e3; flex-shrink: 0; padding: 18px 14px; }
.sidebar .login-brand span { color: #fff; }
.sidebar .login-brand .dot { background: var(--brand); }
.sidebar-section { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: #5b6b85;
  margin: 22px 0 8px 6px; font-weight: 700; }
.sidebar-item { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 8px;
  font-size: 13.5px; color: #aebbd0; cursor: pointer; margin-bottom: 2px; }
.sidebar-item:hover, .sidebar-item.active { background: var(--navy-2); color: #fff; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: var(--topbar-h); border-bottom: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px; }
.topbar-title { font-size: 16px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--text-muted); }
.content { padding: 22px; flex: 1; overflow-y: auto; }

/* ── Cards / table bits ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card-title { font-size: 14px; font-weight: 700; margin: 0 0 12px; }
.grid-2 { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; }
@media (max-width: 920px) { .grid-2 { grid-template-columns: 1fr; } }

.trip-row { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px;
  margin-bottom: 10px; cursor: pointer; }
.trip-row:hover { border-color: var(--brand); }
.trip-row.active { border-color: var(--brand); background: var(--brand-light); }
.trip-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.trip-code { font-family: ui-monospace, monospace; font-size: 12px; font-weight: 700; color: var(--text); }
.trip-route { font-size: 13.5px; font-weight: 600; }
.trip-meta { font-size: 11.5px; color: var(--text-soft); margin-top: 3px; }

.badge { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  padding: 3px 8px; border-radius: 100px; display: inline-flex; align-items: center; gap: 5px; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-requested { background: var(--warning-bg); color: var(--warning); }
.badge-accepted, .badge-assigned { background: var(--info-bg); color: var(--info); }
.badge-in_transit { background: var(--success-bg); color: var(--success); }
.badge-completed { background: var(--bg); color: var(--text-soft); }
.badge-cancelled { background: var(--danger-bg); color: var(--danger); }

#map { width: 100%; height: 100%; min-height: 420px; border-radius: var(--radius); overflow: hidden; }
.map-wrap { height: 480px; }

.empty-state { text-align: center; padding: 40px 16px; color: var(--text-soft); font-size: 13.5px; }
.select, textarea.field { font-family: inherit; }
select.field { background: var(--bg); }
.btn-row { display: flex; gap: 8px; margin-top: 10px; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
