:root {
  /* Dark shell (sidebar + topbar) */
  --shell-bg: #0f1522;
  --shell-bg-2: #161e2e;
  --shell-border: #263049;
  --shell-text: #cbd5e1;
  --shell-text-dim: #7c8aa5;

  /* Light content area */
  --bg: #f4f6fb;
  --panel: #ffffff;
  --panel-2: #f0f2f8;
  --border: #e2e6f0;
  --text: #1c2434;
  --text-dim: #6b7690;

  /* Smart accent palette */
  --primary: #4f5bd5;        /* indigo — main brand accent */
  --primary-dim: #3c47ad;
  --primary-soft: #eef0fd;
  --secondary: #f59e0b;      /* amber — highlights / warnings */
  --secondary-dim: #c97e08;
  --danger: #e11d48;         /* rose — errors / reject */
  --danger-dim: #b3123a;
  --success: #16a34a;
  --warning: #f59e0b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 800px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.stat { background: var(--panel); border-radius: 10px; padding: 14px; border-left: 3px solid var(--primary); }
.stat .num { font-size: 1.7rem; font-weight: 700; color: var(--text); }
.stat .label { color: var(--text-dim); font-size: 0.8rem; text-transform: uppercase; letter-spacing: .04em; }
.stat.coral { border-left-color: var(--danger); }

h1, h2, h3 { color: var(--text); }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.05rem; color: var(--primary-dim); }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; font-size: 0.88rem; }
th { color: var(--text-dim); font-weight: 600; text-transform: uppercase; font-size: 0.72rem; }
tr:hover td { background: var(--panel-2); }

.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
}
.btn-azure { background: var(--primary); color: #fff; }
.btn-azure:hover { background: var(--primary-dim); text-decoration: none; }
.btn-coral { background: var(--danger); color: #fff; }
.btn-coral:hover { background: var(--danger-dim); text-decoration: none; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--panel-2); text-decoration: none; }
.btn-sm { padding: 4px 10px; font-size: 0.78rem; }
.btn-amber { background: var(--secondary); color: #241800; }
.btn-amber:hover { background: var(--secondary-dim); text-decoration: none; }

/* Card-system polish */
.card { position: relative; overflow: hidden; }
.card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--primary), var(--secondary));
  opacity: .85;
}
.card.card-flat::before { display: none; }
.stat { display: flex; align-items: center; gap: 12px; }
.stat .stat-icon {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; background: var(--primary-soft);
}
.stat.coral .stat-icon { background: rgba(225,29,72,.1); }
.stat .stat-body { min-width: 0; }

.badge { padding: 3px 9px; border-radius: 999px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; }
.badge-pending { background: rgba(245,158,11,.14); color: var(--secondary-dim); }
.badge-approved, .badge-active, .badge-completed { background: rgba(22,163,74,.12); color: var(--success); }
.badge-rejected, .badge-inactive { background: rgba(225,29,72,.1); color: var(--danger); }
.badge-in_progress { background: var(--primary-soft); color: var(--primary-dim); }

form p { margin: 10px 0; }
label { display: block; margin-bottom: 4px; color: var(--text-dim); font-size: 0.85rem; }
input, select, textarea {
  width: 100%;
  padding: 9px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 0.92rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.messages { list-style: none; padding: 0; margin: 0 0 16px 0; }
.messages li { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; font-size: 0.88rem; }
.messages .success { background: rgba(22,163,74,.08); color: var(--success); border: 1px solid rgba(22,163,74,.25); }
.messages .error { background: rgba(225,29,72,.08); color: var(--danger); border: 1px solid rgba(225,29,72,.25); }
.messages .warning { background: rgba(245,158,11,.1); color: var(--secondary-dim); border: 1px solid rgba(245,158,11,.3); }

.alert-strip { background: rgba(225,29,72,.06); border: 1px solid var(--danger); border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; }

/* ---------------- Login page: car-themed split screen ---------------- */

.login-wrap {
  display: flex; min-height: 100vh; background: var(--shell-bg);
}
.login-visual {
  flex: 1.2; display: flex; flex-direction: column; justify-content: center;
  padding: 60px; color: #fff;
  background: radial-gradient(circle at 20% 20%, #2b3470 0%, var(--shell-bg) 60%);
  position: relative; overflow: hidden;
}
.login-visual .brand-mark { font-size: 2.2rem; font-weight: 800; margin-bottom: 12px; }
.login-visual .tagline { color: #aab4d6; font-size: 1.05rem; max-width: 420px; line-height: 1.6; }
.login-visual .car-emoji { font-size: 6rem; margin-top: 30px; filter: drop-shadow(0 8px 20px rgba(0,0,0,.4)); }
.login-form-side {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-box {
  width: 360px; background: var(--panel); border-radius: 16px; padding: 32px;
  box-shadow: 0 10px 40px rgba(16,24,40,.12); border: 1px solid var(--border);
}
.login-box h1 { margin-top: 0; }
@media (max-width: 860px) {
  .login-visual { display: none; }
}

/* ---------------- App shell: sidebar + topbar (kept dark) ---------------- */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px;
  flex-shrink: 0;
  background: var(--shell-bg);
  border-right: 1px solid var(--shell-border);
  padding: 18px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; color: #fff; font-size: 1.05rem;
  padding: 0 18px 16px 18px;
  border-bottom: 1px solid var(--shell-border);
  margin-bottom: 10px;
}
.sidebar .section-label {
  color: var(--shell-text-dim); font-size: 0.68rem; text-transform: uppercase;
  letter-spacing: .06em; padding: 14px 18px 6px 18px;
}
.sidebar a.menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px;
  color: var(--shell-text);
  font-size: 0.87rem;
  border-left: 3px solid transparent;
}
.sidebar a.menu-item:hover { background: var(--shell-bg-2); color: #fff; text-decoration: none; }
.sidebar a.menu-item.active {
  background: var(--shell-bg-2); color: #93a2ff;
  border-left-color: var(--primary); font-weight: 600;
}
.sidebar .icon { width: 18px; text-align: center; opacity: .9; }

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

.topbar2 {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px;
  background: var(--shell-bg);
  border-bottom: 1px solid var(--shell-border);
  position: sticky; top: 0; z-index: 5;
  gap: 14px;
}
.topbar2 .page-title { font-size: 1rem; font-weight: 600; color: #fff; }
.topbar2 .spacer { flex: 1; }

.topbar2 .icon-btn {
  position: relative; width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--shell-bg-2); border: 1px solid var(--shell-border);
  cursor: pointer; font-size: 1rem; color: var(--shell-text);
}
.topbar2 .icon-btn:hover { color: #fff; }
.topbar2 .badge-count {
  position: absolute; top: -5px; right: -5px;
  background: var(--danger); color: #fff; font-size: 0.65rem; font-weight: 700;
  border-radius: 999px; min-width: 16px; height: 16px; line-height: 16px; text-align: center; padding: 0 3px;
}

.topbar2 .user-menu { position: relative; }
.topbar2 .user-chip {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 6px 12px; border-radius: 20px; background: var(--shell-bg-2);
  border: 1px solid var(--shell-border); font-size: 0.85rem; color: var(--shell-text);
}
.topbar2 .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--danger));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.75rem; color: #fff;
}
.topbar2 .dropdown, .topbar2 .notif-dropdown {
  display: none; position: absolute; right: 0; top: 42px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; z-index: 10;
  box-shadow: 0 10px 30px rgba(16,24,40,.18);
}
.topbar2 .dropdown { min-width: 160px; }
.topbar2 .notif-dropdown { min-width: 320px; max-height: 400px; overflow-y: auto; }
.topbar2 .dropdown.open, .topbar2 .notif-dropdown.open { display: block; }
.topbar2 .dropdown a {
  display: block; padding: 10px 14px; font-size: 0.85rem; color: var(--text);
}
.topbar2 .dropdown a:hover { background: var(--panel-2); text-decoration: none; }
.notif-item { display: block; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text); font-size: 0.82rem; }
.notif-item:hover { background: var(--panel-2); text-decoration: none; }
.notif-item .notif-title { font-weight: 600; margin-bottom: 2px; }
.notif-item .notif-time { color: var(--text-dim); font-size: 0.72rem; }
.notif-empty { padding: 16px; color: var(--text-dim); font-size: 0.85rem; text-align: center; }
.notif-footer { padding: 8px 14px; text-align: center; border-top: 1px solid var(--border); }

.page-body { padding: 22px 24px; flex: 1; }

/* Location status pill used on the driver dashboard */
.loc-status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; padding: 5px 10px; border-radius: 999px; }
.loc-status.ok { background: rgba(22,163,74,.1); color: var(--success); }
.loc-status.bad { background: rgba(225,29,72,.1); color: var(--danger); }

@media (max-width: 860px) {
  .sidebar { position: fixed; left: -240px; z-index: 20; transition: left .2s; height: 100vh; }
  .sidebar.open { left: 0; }
  .app-shell { display: block; }
}
