/* ERS Chauffeurs admin dashboard — navy / gold */
:root {
  --page: #EDF0F5;
  --navy: #0E1424;
  --navy-deep: #0A0E1A;
  --navy-2: #161D33;
  --gold: #D4B25A;
  --gold-bright: #E0C070;
  --bronze: #B98A3E;
  --ink: #141A2C;
  --muted: #5B6580;
  --line: #DDE2EC;
  --field: #CBD2E0;
  --white: #FFFFFF;
  --amber-bg: #FFF1CC;
  --amber-ink: #6B4700;
  --green-bg: #D8F3E6;
  --green-ink: #0B5B3E;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.4;
}
button, select, input { font-family: inherit; }
a { text-decoration: none; }
:focus-visible { outline: 2px solid var(--bronze); outline-offset: 2px; }
[hidden] { display: none !important; }

.app { min-height: 100vh; display: flex; flex-wrap: wrap; align-items: stretch; }

/* Sidebar */
.sidebar {
  flex: 1 1 248px;
  max-width: 100%;
  background: var(--navy-deep);
  padding: 26px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.brand { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 0 12px; }
.brand img { display: block; width: 188px; max-width: 100%; height: auto; }
.brand-sub { font-size: 10px; letter-spacing: 0.2em; color: #8089A4; font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  min-height: 42px; padding: 0 14px; border-radius: 10px;
  color: #AEB6CA; font-size: 14px; font-weight: 500;
}
.nav-item:hover { background: var(--navy-2); color: #F2EEE3; }
.nav-item[aria-current="page"] { background: var(--gold); color: #14100A; font-weight: 800; }
.nav-item span.label { flex: 1; }
.nav-badge {
  min-width: 22px; padding: 2px 7px; border-radius: 999px;
  background: var(--gold); color: #14100A; font-size: 12px; font-weight: 800; text-align: center;
}
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }

/* Main */
.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--navy-deep);
  padding: 14px clamp(16px, 3vw, 32px);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
}
.search { position: relative; flex: 1 1 320px; max-width: 640px; color: var(--muted); }
.search svg { position: absolute; left: 14px; top: 13px; }
.search input {
  width: 100%; height: 44px; padding: 0 16px 0 44px;
  border: 0; border-radius: 10px; background: #F4F6FA; color: var(--ink); font-size: 14px;
}
.user { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: #1B2136; color: var(--gold-bright);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px;
}
.user-name { font-size: 14px; font-weight: 700; color: #F2EEE3; }
.user-role { font-size: 12px; color: #8089A4; }

.content {
  width: 100%; max-width: 1320px;
  padding: 24px clamp(16px, 3vw, 32px) 56px;
  display: flex; flex-direction: column; gap: 20px;
}
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.eyebrow { font-size: 12px; letter-spacing: 0.14em; color: var(--muted); font-weight: 700; text-transform: uppercase; }
h1 { margin: 4px 0 0; font-size: 30px; line-height: 1.1; font-weight: 800; color: var(--navy); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 10px; border: 0;
  font-size: 14px; font-weight: 700; cursor: pointer;
}
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-gold { background: var(--gold); color: #14100A; font-weight: 800; }
.btn-bronze { background: var(--bronze); color: #14100A; font-weight: 800; }
.btn-outline { background: var(--white); color: var(--ink); border: 1px solid var(--field); }
.btn-ghost-dark { background: transparent; color: #C5CBDB; border: 1px solid #2A3250; font-weight: 600; }

/* KPI cards */
.kpis { display: flex; flex-wrap: wrap; gap: 14px; }
.kpi {
  flex: 1 1 190px; min-width: 0; padding: 16px 18px; border-radius: 14px;
  background: var(--navy); border: 1.5px solid #1F2740;
  display: flex; align-items: center; gap: 14px;
}
.kpi.emphasis { border-color: var(--bronze); }
.kpi-icon { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.kpi-icon.blue { background: #1B2440; color: #9DB4FF; }
.kpi-icon.gold { background: #3A2E12; color: var(--gold-bright); }
.kpi-icon.green { background: #143327; color: #7FD6B8; }
.kpi-value { font-size: 30px; font-weight: 800; line-height: 1; color: #fff; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 13px; color: #C5CBDB; margin-top: 4px; font-weight: 600; }
.kpi-sub { font-size: 12px; color: #9AA3BC; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* Filters */
.filters { padding: 18px; border-radius: 14px; background: var(--white); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11px; letter-spacing: 0.1em; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.field select {
  height: 44px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--field);
  background: var(--white); color: var(--ink); font-size: 14px;
}
.field select:disabled { background: #F4F6FA; color: var(--muted); }
.field-active select { border: 1.5px solid var(--bronze); font-weight: 600; }
.filter-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.check {
  width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--muted);
  display: inline-flex; align-items: center; justify-content: center; color: #14100A;
}
#toggle-tests[aria-pressed="true"] .check { background: var(--gold); border-color: var(--gold); }
#toggle-tests[aria-pressed="true"] .check::after { content: ""; width: 9px; height: 5px; border-left: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(-45deg) translate(1px, -1px); }

/* Job groups */
.groups { display: flex; flex-direction: column; gap: 18px; }
.group { display: flex; flex-direction: column; gap: 10px; }
.group-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 20px;
  padding: 13px 18px; border-radius: 12px; background: var(--navy); border-bottom: 3px solid var(--bronze); color: #fff;
}
.group-head h2 { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 800; }
.group-meta { font-size: 12px; letter-spacing: 0.08em; font-weight: 700; color: #C5CBDB; text-transform: uppercase; }
.group-meta .tag { color: var(--gold-bright); }

.job { border-radius: 14px; background: var(--white); border: 1px solid var(--line); overflow: hidden; }
.job-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; padding: 18px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.col-job { flex: 0 0 118px; }
.col-client { flex: 0 0 128px; }
.col-when { flex: 0 0 100px; }
.col-route { flex: 1 1 220px; min-width: 0; }
.col-driver { flex: 0 0 176px; }
.col-extra { flex: 0 0 80px; }
.col-actions { flex: 0 0 96px; }
.lbl { font-size: 11px; letter-spacing: 0.1em; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.ref { font-size: 16px; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }
.client { font-size: 14px; font-weight: 700; color: var(--navy); line-height: 1.3; overflow-wrap: anywhere; }
.date { font-size: 13px; color: #3A4460; font-weight: 600; }
.time { font-size: 20px; font-weight: 800; line-height: 1; color: var(--navy); font-variant-numeric: tabular-nums; }
.dim { font-size: 13px; color: var(--muted); }
.stop { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; font-weight: 600; color: var(--navy); line-height: 1.35; overflow-wrap: anywhere; }
.stop svg { flex: 0 0 14px; margin-top: 3px; }

.badge { align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.badge-open { background: var(--amber-bg); color: var(--amber-ink); }
.badge-done { background: var(--green-bg); color: var(--green-ink); }
.badge-test { padding: 2px 8px; border-radius: 6px; border: 1px solid #98A1B8; color: var(--muted); font-size: 11px; letter-spacing: 0.08em; }

.driver-line { display: flex; align-items: center; gap: 10px; }
.driver-avatar {
  flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: var(--gold-bright);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800;
}
.driver-name { font-size: 14px; font-weight: 700; color: var(--navy); line-height: 1.25; }

.picker { padding: 16px 18px 20px; background: #F4F6FA; border-top: 1px solid var(--line); }
.picker-title { font-size: 11px; letter-spacing: 0.1em; color: var(--muted); font-weight: 700; margin-bottom: 10px; text-transform: uppercase; }
.picker-list { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  min-height: 44px; display: inline-flex; align-items: center; gap: 10px; padding: 5px 16px 5px 6px;
  border-radius: 999px; border: 1px solid var(--field); background: var(--white); color: var(--ink);
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.chip:hover { border-color: var(--bronze); }
.chip .driver-avatar { width: 32px; height: 32px; flex-basis: 32px; }
.chip-dashed { padding: 0 18px; border-style: dashed; background: transparent; color: #3A4460; }

.empty { padding: 48px 24px; text-align: center; border-radius: 14px; background: var(--white); border: 1px solid var(--line); color: #3A4460; font-size: 15px; }
.error { padding: 16px 18px; border-radius: 12px; background: #FDECEC; color: #7A1D1D; font-weight: 600; }

.badge-await { background: #E8ECF5; color: #2E3A5C; border: 1px solid #B9C2D8; }
[hidden] { display: none !important; }
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy); padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--white); border-radius: 16px; padding: 32px 28px; display: flex; flex-direction: column; gap: 10px; }
.login-card h1 { margin: 8px 0 4px; font-size: 22px; }
.login-card label { font-size: 13px; font-weight: 700; color: var(--muted); }
.login-card input { height: 44px; border: 1px solid var(--field); border-radius: 10px; padding: 0 12px; font: inherit; }
.login-card .btn { height: 46px; margin-top: 8px; }

/* ---- Bookings view (stage 1) ---- */
.view-bookings { display: flex; flex-direction: column; gap: 18px; }
.view-bookings .filter-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.field input[type="date"], .edit-form input, .edit-form textarea {
  height: 44px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--field);
  background: var(--white); color: var(--ink); font-size: 14px; width: 100%;
}
.edit-form textarea { height: auto; padding: 10px; resize: vertical; }
.badge-cancel { background: #FDECEC; color: #7A1D1D; }
.badge-unpaid { background: #FFF1CC; color: #6B4700; }
.notice { padding: 12px 14px; border-radius: 10px; background: var(--green-bg); color: var(--green-ink); font-weight: 700; }
.btn-danger { background: #B3261E; color: #fff; font-weight: 800; }
.drawer-back { position: fixed; inset: 0; background: rgba(10, 14, 26, 0.55); z-index: 50; display: flex; justify-content: flex-end; }
.drawer { width: min(560px, 100%); height: 100%; background: var(--page); display: flex; flex-direction: column; box-shadow: -8px 0 32px rgba(0,0,0,.35); }
.drawer-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; background: var(--navy); color: #F2EEE3; }
.drawer-title { font-size: 17px; font-weight: 800; overflow-wrap: anywhere; }
.drawer-body { padding: 16px 20px 40px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; flex: 1; }
.drawer #d-msg { padding: 0 20px; }
.drawer #d-msg > div { margin-top: 12px; }
.d-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.d-sec { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.d-sec h3 { margin: 0 0 4px; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: #2B344F; }
.kv { display: flex; gap: 12px; }
.kv-k { flex: 0 0 120px; font-size: 13px; color: #2B344F; font-weight: 700; }
.kv-v { flex: 1; font-size: 14px; color: var(--navy); font-weight: 600; overflow-wrap: anywhere; }
.d-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.edit-form { display: flex; flex-direction: column; gap: 12px; }
.modal-back { position: fixed; inset: 0; background: rgba(10, 14, 26, 0.6); z-index: 80; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--white); border-radius: 14px; padding: 22px; width: min(440px, 100%); display: flex; flex-direction: column; gap: 10px; }
.modal h3 { margin: 0; font-size: 18px; color: var(--navy); }
.modal p { margin: 0; color: #2B344F; font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
@media (max-width: 640px) { .kv { flex-direction: column; gap: 2px; } .kv-k { flex-basis: auto; } }
/* ---- Pages view (stages 2-4) ---- */
#view-page { display: flex; flex-direction: column; gap: 18px; }
#view-page .pg-body { display: flex; flex-direction: column; gap: 16px; }
.pg-sub { font-size: 13px; color: #2B344F; }
.pg-h2 { margin: 6px 0 0; font-size: 15px; font-weight: 800; color: var(--navy); }
.empty-card { padding: 22px; border-radius: 12px; background: var(--white); border: 1px solid var(--line); color: #2B344F; font-weight: 600; display: flex; flex-direction: column; gap: 12px; }
.tbl-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--line); border-radius: 12px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; color: var(--ink); }
.tbl th { text-align: left; padding: 11px 14px; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: #2B344F; background: #F4F6FA; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
.tbl tr:last-child td { border-bottom: 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab { height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--field); background: var(--white); color: var(--ink); font-weight: 700; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--gold); border-color: var(--gold); color: #14100A; font-weight: 800; }
.notice-bad { background: #FDECEC; color: #7A1D1D; }
.hint { font-size: 12px; color: #2B344F; }
.form-err { color: #7A1D1D; font-weight: 700; font-size: 13px; min-height: 0; }
.modal select, .modal .field input { height: 44px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--field); background: var(--white); color: var(--ink); font-size: 14px; width: 100%; }
.sd-year { max-width: 160px; }
.sd-year input { height: 44px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--field); width: 100%; }
.fn-cards .kpi { flex: 1 1 200px; }
/* Pages view (stage 5) */
.pg-warn { color: #B42318; font-weight: 700; }

/* Pages view (stage 6) */
.nb-form { display: flex; flex-direction: column; gap: 14px; max-width: 900px; }
.nb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.nb-wide { grid-column: 1 / -1; }
.nb-field input:not([type="checkbox"]), .nb-field select, .nb-field textarea { width: 100%; box-sizing: border-box; }
.nb-check { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.nb-notify { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1px solid var(--line, #d6dbe6); border-radius: 12px; }
.nb-line { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; border-bottom: 1px solid var(--line, #d6dbe6); }
.nb-total { font-size: 16px; }
.nb-breakdown { max-width: 420px; }
.nb-price { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.nb-actions { padding-top: 6px; }
