@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;600;700;800&display=swap');

:root{
  --bg:#070b14;
  --bg-alt:#0b1324;
  --bg-glow:rgba(246,201,14,.18);
  --card:#0f172a;
  --card-soft:#121d33;
  --text:#eef3ff;
  --muted:#9fb0ce;
  --border:#24324c;
  --primary:#f6c90e;
  --danger:#ef4444;
  --ok:#22c55e;
  --warn:#f59e0b;
  --surface:#111b2f;
  --surface-alt:#0d1628;
  --notice-bg:#0f182a;
  --topbar-bg:rgba(8,13,24,.88);
  --loader-bg:rgba(5,9,18,.94);
  --menu-strip:linear-gradient(90deg,#e7ff69 0%,#8af819 42%,#c9ff53 100%);
  --menu-strip-border:rgba(171,255,64,.55);
  --menu-strip-text:#173000;
  --menu-strip-muted:rgba(23,48,0,.72);
  --menu-tab-active:rgba(255,255,255,.96);
  --menu-tab-hover:rgba(255,255,255,.2);
  --theme-toggle-bg:rgba(255,255,255,.08);
  --theme-toggle-text:var(--text);
  --attribution-bg:rgba(8,13,24,.78);
  --attribution-text:#99a9c9;
  --attribution-link:#dbe6ff;
  --shadow: 0 16px 34px rgba(0,0,0,.45);
  --radius: 18px;
}

html[data-theme="light"]{
  --bg:#ffffff;
  --bg-alt:#fff7d6;
  --bg-glow:rgba(250,204,21,.2);
  --card:#ffffff;
  --card-soft:#fffbed;
  --text:#111111;
  --muted:#3f3f3f;
  --border:#e6d38f;
  --primary:#f6c90e;
  --ok:#f2b705;
  --surface:#ffffff;
  --surface-alt:#fff3bf;
  --notice-bg:#fff1ab;
  --topbar-bg:rgba(255,255,255,.94);
  --loader-bg:rgba(255,255,255,.95);
  --menu-strip:linear-gradient(90deg,#fff6c8 0%,#f6c90e 45%,#ffe074 100%);
  --menu-strip-border:rgba(246,201,14,.52);
  --menu-strip-text:#111111;
  --menu-strip-muted:rgba(17,17,17,.72);
  --menu-tab-active:#ffffff;
  --menu-tab-hover:rgba(17,17,17,.08);
  --theme-toggle-bg:#ffffff;
  --theme-toggle-text:#111111;
  --attribution-bg:rgba(255,255,255,.92);
  --attribution-text:#2f2f2f;
  --attribution-link:#111111;
  --shadow:0 18px 38px rgba(0,0,0,.12);
}

*{box-sizing:border-box}
html,body{margin:0;padding:0;font-family:'Rubik',system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;background:radial-gradient(circle at 12% -20%,var(--bg-glow),transparent 34%),linear-gradient(180deg,var(--bg) 0%,var(--bg-alt) 100%);color:var(--text);font-size:16.5px}
a{color:var(--primary);text-decoration:none}
a:hover{text-decoration:underline;color:#ffd94b}
.container{max-width:1200px;margin:0 auto;padding:20px}
.topbar{
  position:sticky; top:0; z-index:50;
  background:var(--topbar-bg);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--border);
}
.topbar-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:0;
  padding:0 16px;
  min-height:64px;
  flex-wrap:wrap;
}
.topbar-inner.has-center{
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  align-items:stretch;
  gap:12px;
}
.brand{display:flex;flex-direction:column;line-height:1.1;padding:10px 0}
.brand strong{font-size:16px}
.brand span{font-size:12px;color:var(--muted)}
.brand-link{display:inline-flex;align-items:center;min-height:42px}
.topbar-center{min-width:0;width:100%}
.navlinks{
  display:flex;
  gap:0;
  align-items:stretch;
  flex-wrap:nowrap;
  margin-left:auto;
  align-self:stretch;
}
.topbar-inner.has-center .navlinks{margin-left:0;justify-content:flex-end}
.brand-logo{height:32px;width:auto;display:block}
.topbar .navlinks .btn{
  border:0;
  border-left:1px solid var(--border);
  border-radius:0;
  background:transparent;
  color:var(--text);
  min-width:0;
  min-height:100%;
  padding:0 16px;
  font-weight:700;
  white-space:nowrap;
}
.topbar .navlinks .btn:hover{
  transform:none;
  text-decoration:none;
  background:var(--menu-tab-hover);
}
.topbar .navlinks .btn:focus-visible{
  outline:2px solid var(--primary);
  outline-offset:-2px;
}
.app-loader{
  position:fixed;
  inset:0;
  background:var(--loader-bg);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:100;
  transition:opacity .6s ease;
}
.app-loader.is-hidden{opacity:0}
.app-loader-inner{
  display:flex;
  align-items:center;
  justify-content:center;
  animation:loader-pop .8s ease;
}
.app-loader-logo{height:90px;width:auto}
@keyframes loader-pop{
  0%{transform:scale(.9);opacity:.6}
  60%{transform:scale(1.02);opacity:1}
  100%{transform:scale(1);opacity:1}
}
.btn{
  border:1px solid var(--border);
  background:var(--card);
  color:var(--text);
  padding:10px 14px;
  border-radius:14px;
  cursor:pointer;
  font-weight:600;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  transition:background .22s ease,color .22s ease,border-color .22s ease,box-shadow .22s ease,transform .22s ease;
}
.btn:hover{transform:translateY(-1px)}
.btn.primary{background:var(--primary);border-color:var(--primary);color:#161616}
.btn.danger{background:var(--danger);border-color:var(--danger);color:#fff}
.btn.ok{background:var(--ok);border-color:var(--ok);color:#06120c}
.btn.warn{background:var(--warn);border-color:var(--warn);color:#111827}
.btn:disabled{opacity:.6;cursor:not-allowed}
.theme-toggle-btn{
  min-width:122px;
  background:transparent;
  color:var(--theme-toggle-text);
}
.theme-toggle-icon{
  font-size:15px;
  line-height:1;
}
.grid{display:grid;gap:14px}
.grid.two{grid-template-columns:1fr 1fr}
.grid.three{grid-template-columns:1fr 1fr 1fr}
@media (max-width: 900px){
  .grid.two,.grid.three{grid-template-columns:1fr}
  .topbar-inner{flex-direction:row;align-items:center;padding:0 10px}
  .topbar-inner.has-center{
    grid-template-columns:1fr;
  }
  .topbar-center{
    order:3;
  }
  .navlinks{
    width:100%;
    margin-left:0;
  }
  .topbar .navlinks .btn{
    flex:1;
    min-width:0;
    justify-content:center;
    min-height:62px;
    padding:0 14px;
    font-size:16px;
    font-weight:800;
    letter-spacing:.01em;
  }
  .theme-toggle-icon{
    font-size:18px;
  }
  .topbar-inner.has-center .navlinks{
    margin-left:0;
    justify-content:stretch;
  }
}
.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:18px;
}
.card h2{margin:0 0 12px 0;font-size:20px}
.card h3{margin:0 0 12px 0;font-size:15px;color:var(--muted)}
.muted{color:var(--muted)}
.row{display:flex;gap:12px;flex-wrap:wrap;align-items:center}
.actions-stack{display:grid;gap:8px;justify-items:start}
.scroll-box{max-height:520px;overflow:auto;padding-right:4px}
.field{display:flex;flex-direction:column;gap:6px;min-width:220px;flex:1}
label{font-size:13px;color:var(--muted)}
input,select,textarea{
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px 14px;
  font-size:14px;
  outline:none;
  background:var(--surface);
  color:var(--text);
}
input::placeholder, textarea::placeholder{
  font-style:italic;
  color:#8091b0;
}
textarea{min-height:90px;resize:vertical}
.badge{
  display:inline-flex;align-items:center;gap:6px;
  padding:6px 10px;border-radius:999px;font-size:12px;font-weight:700;
  border:1px solid var(--border); color:var(--text); background:rgba(255,255,255,.02)
}
.badge.ok{border-color:rgba(34,197,94,.34);background:rgba(34,197,94,.14);color:#bbf7d0}
.badge.danger{border-color:rgba(239,68,68,.36);background:rgba(239,68,68,.15);color:#fecaca}
.badge.warn{border-color:rgba(245,158,11,.36);background:rgba(245,158,11,.15);color:#fde68a}
.badge.info{border-color:rgba(246,201,14,.36);background:rgba(246,201,14,.14);color:#fde68a}
.table{width:100%;border-collapse:collapse}
.table th,.table td{padding:10px;border-bottom:1px solid var(--border);text-align:left;font-size:13px}
.table th{font-size:12px;color:var(--muted);font-weight:800;text-transform:uppercase;letter-spacing:.04em}
.kpi{display:flex;flex-direction:column;gap:6px}
.kpi strong{font-size:22px}
.map{
  width:100%;
  height:420px;
  border-radius:var(--radius);
  border:1px solid var(--border);
  overflow:hidden;
}
@media (max-width: 600px){
  .map{height:360px}
}
.notice{padding:10px 12px;border-radius:12px;border:1px solid var(--border);background:var(--notice-bg)}
.notice.ok{border-color:rgba(34,197,94,.34);background:rgba(34,197,94,.14)}
.notice.warn{border-color:rgba(245,158,11,.36);background:rgba(245,158,11,.15)}
.notice.danger{border-color:rgba(239,68,68,.36);background:rgba(239,68,68,.15)}
.small{font-size:13px}
hr{border:0;border-top:1px solid var(--border);margin:12px 0}

/* Time control */
.time-card{
  border:1px dashed rgba(246,201,14,.42);
  background:linear-gradient(180deg,rgba(246,201,14,.13),rgba(246,201,14,.05));
  padding:14px;
  border-radius:14px;
}
.time-row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.time-input{max-width:140px}
.time-input input{font-family:'Rubik',system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;font-size:22px;font-weight:800;text-align:center;letter-spacing:0}
.time-buttons{display:flex;gap:8px;flex-wrap:wrap}
.time-btn{
  border:1px solid rgba(246,201,14,.4);
  background:var(--surface-alt);
  color:#ffe38a;
  padding:8px 12px;
  border-radius:999px;
  font-weight:700;
  font-size:12px;
  cursor:pointer;
}
.time-btn.is-active{background:var(--primary);border-color:var(--primary);color:#fff}
.range{
  width:100%;
  accent-color: var(--primary);
}

/* Client app toggle */
.toggle-card{
  border:1px solid var(--border);
  background:var(--card-soft);
  padding:12px;
  border-radius:14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.toggle-title{font-weight:700}
.toggle-sub{font-size:13px;color:var(--muted)}
.toggle-check{
  display:inline-flex;
  align-items:center;
  gap:10px;
  border:1px solid var(--border);
  background:var(--surface-alt);
  color:var(--text);
  padding:10px 14px;
  border-radius:999px;
  font-weight:800;
  cursor:pointer;
  min-width:170px;
  justify-content:center;
}
.toggle-check input{
  width:18px;
  height:18px;
  accent-color: var(--primary);
}

/* ETA selector for driver */
.eta-box{
  margin-top:10px;
  border:1px dashed rgba(246,201,14,.42);
  background:linear-gradient(180deg,rgba(246,201,14,.11),rgba(246,201,14,.04));
  padding:12px;
  border-radius:14px;
}

/* Client ETA popup */
.toast{
  position:fixed;
  right:18px;
  bottom:18px;
  background:var(--card);
  color:var(--text);
  padding:12px 16px;
  border-radius:14px;
  box-shadow:0 12px 28px rgba(15,23,42,.25);
  font-weight:700;
  z-index:200;
  opacity:0;
  transform:translateY(8px);
  transition:all .25s ease;
}
.toast.show{
  opacity:1;
  transform:translateY(0);
}

/* Client ETA modal */
.modal{
  position:fixed;
  inset:0;
  background:rgba(3,6,12,.62);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:5000;
  padding:16px;
}
.modal.show{display:flex}
.modal-card{
  background:var(--card);
  color:var(--text);
  border:1px solid var(--border);
  border-radius:18px;
  padding:18px 20px;
  max-width:360px;
  width:100%;
  box-shadow:0 18px 40px rgba(15,23,42,.25);
  text-align:center;
}
.modal-title{font-size:18px;font-weight:800;margin-bottom:6px}
.modal-sub{color:var(--muted);font-size:14px;margin-bottom:12px}
.modal-pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  border-radius:999px;
  background:rgba(246,201,14,.2);
  color:#2a2200;
  font-weight:800;
}
.leaflet-control-attribution{
  background:var(--attribution-bg) !important;
  color:var(--attribution-text) !important;
}
.leaflet-control-attribution a{
  color:var(--attribution-link) !important;
}
.leaflet-popup-content-wrapper,
.leaflet-popup-tip{
  background:var(--card);
  color:var(--text);
  border:1px solid var(--border);
}
