:root{
  --bg:#f4f7f8;
  --card:#fff;
  --text:#111820;
  --muted:#66727e;
  --line:#dde4e8;
  --dark:#081822;
  --accent:#0e9f75;
  --danger:#c73f4a;
  --warn:#d58b1a;
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--text);font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif}
a{color:inherit}
.topbar{height:70px;background:var(--dark);color:#fff;display:flex;align-items:center;justify-content:space-between;padding:0 max(18px,calc((100vw - 1180px)/2));position:sticky;top:0;z-index:20}
.brand{display:flex;align-items:center;gap:10px;text-decoration:none;font-weight:900;letter-spacing:.05em}
.brand-icon{display:grid;place-items:center;width:34px;height:34px;border-radius:10px;background:#fff;color:var(--dark)}
.top-actions{display:flex;align-items:center;gap:10px}.user-chip{opacity:.85}
.nav{background:#fff;border-bottom:1px solid var(--line);display:flex;gap:6px;padding:10px max(18px,calc((100vw - 1180px)/2));overflow:auto;white-space:nowrap}
.nav a{text-decoration:none;padding:10px 12px;border-radius:10px}.nav a:hover{background:#eef3f5}
.container{max-width:1180px;margin:0 auto;padding:24px 18px 60px}
h1{margin:0 0 22px;font-size:1.8rem}h2{font-size:1.18rem;margin:0 0 14px}
.grid{display:grid;gap:16px}.cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.card{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:18px}
.kpi{font-size:2rem;font-weight:900}.muted{color:var(--muted)}.small{font-size:.85rem}
.btn{border:0;border-radius:10px;padding:10px 14px;background:var(--dark);color:#fff;text-decoration:none;display:inline-flex;align-items:center;justify-content:center;font-weight:700;cursor:pointer}
.btn.accent{background:var(--accent)}.btn.danger{background:var(--danger)}.btn.light{background:#eef3f5;color:var(--text)}.btn.ghost{background:transparent;border:1px solid rgba(255,255,255,.3)}.btn.small{padding:7px 10px;font-size:.84rem}
.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.field{display:flex;flex-direction:column;gap:6px}.field.full{grid-column:1/-1}
label{font-size:.87rem;color:var(--muted);font-weight:700}
input,select,textarea{width:100%;padding:11px 12px;border:1px solid #cfd8dd;border-radius:10px;background:#fff;font:inherit}textarea{min-height:150px;resize:vertical}
.table-wrap{overflow:auto}table{width:100%;border-collapse:collapse}.table th,.table td{padding:11px 10px;border-bottom:1px solid var(--line);text-align:left;white-space:nowrap}.table th{font-size:.8rem;color:var(--muted);text-transform:uppercase}
.badge{display:inline-flex;padding:5px 8px;border-radius:999px;background:#eef3f5;font-size:.78rem;font-weight:800}.badge.ok{background:#e3f6ef;color:#087052}.badge.bad{background:#fde9eb;color:#a62c38}.badge.warn{background:#fff1d8;color:#9a5d00}
.alert{padding:12px 14px;border-radius:10px;margin-bottom:14px;border:1px solid}.alert.success{background:#e6f6ef;border-color:#bfe8d9}.alert.error{background:#fdebed;border-color:#f2c3c8}.alert.warning{background:#fff3dc;border-color:#f2d49e}
.actions{display:flex;gap:8px;flex-wrap:wrap}
.driver-shell{max-width:720px;margin:0 auto}.driver-hero{background:var(--dark);color:#fff;border-radius:18px;padding:20px;margin-bottom:16px}
.route-stop{display:grid;grid-template-columns:54px 1fr auto;gap:12px;align-items:center;padding:12px;border:1px solid var(--line);border-radius:12px;background:#fff;margin-bottom:10px}.route-stop.done{opacity:.55}.stop-no{font-size:1.3rem;font-weight:900}
.optim-wrap{display:grid;grid-template-columns:1.1fr .9fr;gap:16px}
@media(max-width:850px){.cols-4,.cols-2,.form-grid,.optim-wrap{grid-template-columns:1fr}.user-chip{display:none}.route-stop{grid-template-columns:44px 1fr}.route-stop .actions{grid-column:1/-1}}


/* Driver App V4 */
.driver-v4{max-width:760px}
.driver-v4-hero{display:flex;justify-content:space-between;gap:16px;align-items:flex-end;background:linear-gradient(135deg,#081822,#102c39)}
.driver-v4-hero h2{font-size:2rem;margin:4px 0 0}
.driver-eyebrow{font-size:.72rem;font-weight:900;letter-spacing:.14em;color:#7ee2c1}
.driver-eyebrow.dark{color:#55717d}
.driver-route-chip{text-align:right;display:flex;flex-direction:column;gap:3px}
.driver-route-chip strong{font-size:1rem}.driver-route-chip span{font-size:.82rem;color:#b9c8cf}
.driver-progress-card{background:#fff;border:1px solid var(--line);border-radius:16px;padding:16px;margin-bottom:16px}
.driver-progress-top{display:flex;justify-content:space-between;gap:14px;align-items:end}
.driver-progress-top>div:first-child{display:flex;flex-direction:column;gap:3px;min-width:0}
.driver-progress-top strong{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.driver-progress-number{font-size:1.35rem;font-weight:900}
.driver-progress-track{height:10px;border-radius:999px;background:#e9eef1;overflow:hidden;margin:13px 0 9px}
.driver-progress-track span{display:block;height:100%;background:var(--accent);border-radius:999px}
.driver-meta-row{display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap;color:var(--muted);font-size:.82rem}
.driver-section-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.driver-section-head h2{margin:3px 0 0}
.driver-wide-btn{width:100%;min-height:50px}
.driver-depot-status{background:#e3f6ef;color:#087052;border-radius:10px;padding:10px 12px;font-weight:800;margin-bottom:10px}
.driver-empty-card{text-align:center;padding:34px 18px}.driver-empty-icon{width:58px;height:58px;border-radius:18px;background:#e3f6ef;color:#087052;display:grid;place-items:center;font-size:1.7rem;font-weight:900;margin:0 auto 14px}
.driver-start-card{background:#081822;color:#fff;border-radius:18px;padding:22px;margin-top:16px}
.driver-start-card h2{font-size:1.55rem;margin:7px 0}.driver-start-card p{color:#c3d0d6;line-height:1.55}
.driver-primary-action,.driver-map-action,.driver-done-action{width:100%;border:0;border-radius:14px;min-height:58px;padding:14px 16px;font:inherit;font-weight:900;letter-spacing:.02em;cursor:pointer}
.driver-primary-action{background:#19b886;color:#06140f;margin-top:10px}
.driver-current-stop{background:#fff;border:2px solid #0e9f75;border-radius:20px;padding:20px;margin-top:16px;box-shadow:0 10px 30px rgba(7,31,40,.06)}
.driver-current-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}
.driver-stop-counter{font-size:.88rem;font-weight:900;margin-top:5px;color:#31434b}
.driver-eta{background:#eef3f5;border-radius:12px;padding:8px 12px;text-align:center;display:flex;flex-direction:column}
.driver-eta span{font-size:.68rem;color:var(--muted);font-weight:800;text-transform:uppercase}.driver-eta strong{font-size:1.2rem}
.driver-current-stop h2{font-size:1.4rem;line-height:1.25;margin:18px 0 7px}
.driver-address{font-size:1.05rem;color:#35444b;line-height:1.45}
.driver-reference{margin-top:12px;background:#f2f5f6;border-radius:10px;padding:10px 12px;font-size:.85rem;font-weight:700}
.driver-action-grid{display:grid;grid-template-columns:1fr 1.25fr;gap:10px;margin-top:18px}
.driver-action-grid form{margin:0}
.driver-map-action{background:#eaf0f3;color:#111820}
.driver-done-action{background:#0e9f75;color:#fff}
.driver-list-card{margin-top:16px}
.driver-route-list{display:flex;flex-direction:column;gap:8px}
.driver-list-stop{display:grid;grid-template-columns:38px 1fr auto;gap:10px;align-items:center;padding:10px;border:1px solid var(--line);border-radius:11px}
.driver-list-stop.done{opacity:.48;background:#f4f7f8}
.driver-list-stop.current{border-color:#0e9f75;background:#f1fbf7}
.driver-list-number{width:32px;height:32px;display:grid;place-items:center;border-radius:9px;background:#eef3f5;font-weight:900}
.driver-list-stop strong{display:block;font-size:.9rem}.driver-list-stop span{display:block;color:var(--muted);font-size:.78rem;margin-top:2px}
.mapping-form{align-items:center}
@media(max-width:650px){
  .driver-v4-hero{align-items:flex-start}.driver-v4-hero h2{font-size:1.6rem}.driver-route-chip{max-width:44%}
  .driver-action-grid{grid-template-columns:1fr}
  .driver-current-stop{padding:16px}
  .driver-list-stop{grid-template-columns:34px 1fr auto}
}
