:root {
  --bg: #121214; --panel: #1b1b1f; --panel-2: #232328; --line: #2e2e35; --text: #f1efe9; --muted: #9b978f;
  --greige: #cbb79c; --greige-2: #e2d3bb; --accent: #f08a4b; --accent-2: #ffb07c;
  --green: #45c26b; --red: #f26d6d; --amber: #f2b84b; --blue: #5ab0ff; --teal: #3ec9c0; --purple: #b78cff;
  --radius: 14px; --shadow: 0 8px 28px rgba(0,0,0,.4);
  --brand: var(--greige);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); line-height: 1.4; -webkit-font-smoothing: antialiased; padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--greige-2); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0 0 8px; line-height: 1.2; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; } h4 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .tiny { font-size: 11px; } .bold { font-weight: 700; } .right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; } .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 14px 90px; }
.wide { max-width: 1400px; }

header.top { position: sticky; top: 0; z-index: 30; background: rgba(18,18,20,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
header.top .bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; max-width: 1400px; margin: 0 auto; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: .02em; }
.logo .mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--greige), #8d7c62); display: grid; place-items: center; color: #17171a; font-weight: 900; font-size: 14px; }
.logo small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; letter-spacing: 0; }
.spacer { flex: 1; }
.userchip { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.userchip b { color: var(--text); }
nav.doors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 6px 10px 8px; max-width: 1400px; margin: 0 auto; }
nav.doors a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 10px; color: var(--muted); font-size: 12px; font-weight: 600; }
nav.doors a .ic { font-size: 20px; line-height: 1; }
nav.doors a.active { background: var(--panel-2); color: var(--text); }
nav.doors a.locked { opacity: .35; }
@media (min-width: 720px) { nav.doors { grid-template-columns: repeat(6, minmax(0, 140px)); justify-content: start; padding-left: 14px; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 12px 0; }
.card.tight { padding: 10px 12px; }
.card h3 { display: flex; align-items: center; gap: 8px; }
.card h3 .spacer { flex: 1; }
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: 1fr; } .grid.three { grid-template-columns: 1fr; } .grid.four { grid-template-columns: 1fr 1fr; }
@media (min-width: 760px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } .grid.four { grid-template-columns: repeat(4, 1fr); } }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 560px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1000px) { .kpis.six { grid-template-columns: repeat(6, 1fr); } }
.kpi { background: var(--panel-2); border-radius: 12px; padding: 10px 12px; }
.kpi .v { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.kpi .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.kpi.warn .v { color: var(--amber); } .kpi.bad .v { color: var(--red); } .kpi.good .v { color: var(--green); } .kpi.accent .v { color: var(--accent-2); }

label.f { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
input, select, textarea { width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--text); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--greige); }
input[type=checkbox] { width: auto; }
textarea { min-height: 70px; resize: vertical; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > * { min-width: 0; }
.row.between { justify-content: space-between; }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.f3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
@media (max-width: 480px) { .f3 { grid-template-columns: 1fr 1fr; } }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); padding: 9px 14px; border-radius: 11px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.btn:hover { border-color: var(--greige); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #17120c; }
.btn.brand { background: var(--brand); border-color: var(--brand); color: #17120c; }
.btn.green { background: var(--green); border-color: var(--green); color: #0d1b10; }
.btn.red { background: transparent; border-color: var(--red); color: var(--red); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.btn.xs { padding: 3px 8px; font-size: 12px; border-radius: 8px; }
.btn.big { padding: 14px 18px; font-size: 16px; width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.icon { padding: 8px 10px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.chip.new { color: var(--blue); border-color: rgba(90,176,255,.35); }
.chip.picked_up { color: var(--teal); border-color: rgba(62,201,192,.35); }
.chip.assigned { color: var(--blue); border-color: rgba(90,176,255,.35); }
.chip.out { color: var(--accent-2); border-color: rgba(240,138,75,.45); }
.chip.delivered { color: var(--green); border-color: rgba(69,194,107,.4); }
.chip.failed { color: var(--red); border-color: rgba(242,109,109,.4); }
.chip.returning, .chip.returned { color: var(--purple); border-color: rgba(183,140,255,.4); }
.chip.cancelled { color: var(--muted); text-decoration: line-through; }
.chip.zone { color: var(--greige-2); }
.chip.top { background: var(--accent); color: #17120c; border-color: var(--accent); }
.chip.fit5 { color: var(--green); } .chip.fit4 { color: var(--teal); } .chip.fit3 { color: var(--amber); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.money { font-variant-numeric: tabular-nums; font-weight: 700; }

.list { display: flex; flex-direction: column; gap: 6px; }
.item { display: flex; gap: 10px; align-items: center; background: var(--panel-2); border-radius: 12px; padding: 10px 12px; border: 1px solid transparent; }
.item:hover { border-color: var(--line); }
.item.sel { border-color: var(--greige); }
.item .main { flex: 1; min-width: 0; }
.item .t { font-weight: 600; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.item .s { font-size: 12px; color: var(--muted); }
.item .num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--panel); flex: none; }
.item.done { opacity: .55; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.empty { text-align: center; color: var(--muted); padding: 24px 10px; }
.empty .big { font-size: 34px; }

.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; border: 1px solid var(--line); background: var(--panel); color: var(--muted); padding: 7px 12px; border-radius: 999px; font-weight: 600; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.tabs button.active { background: var(--panel-2); color: var(--text); border-color: var(--greige); }
.tabs button .n { background: var(--panel-2); border-radius: 999px; padding: 0 6px; font-size: 11px; }
.tabs button .dot { width: 8px; height: 8px; }

.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 700px) { .modal-back { align-items: center; } }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 18px 18px 0 0; width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; padding: 16px; box-shadow: var(--shadow); }
@media (min-width: 700px) { .modal { border-radius: 18px; } }
.modal h3 { display: flex; align-items: center; gap: 8px; }
.modal .close { margin-left: auto; background: transparent; border: none; color: var(--muted); font-size: 20px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #2a2a31; color: var(--text); padding: 10px 16px; border-radius: 12px; z-index: 200; box-shadow: var(--shadow); font-size: 14px; max-width: 92vw; border: 1px solid var(--line); }
.toast.err { border-color: var(--red); } .toast.ok { border-color: var(--green); }

.map { width: 100%; height: 340px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #0d0d0f; }
.map.tall { height: 60vh; min-height: 400px; }
.leaflet-container { background: #0e0e10; font: inherit; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.leaflet-popup-content { margin: 10px 12px; font-size: 13px; }
.pin { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #111; box-shadow: 0 2px 8px rgba(0,0,0,.5); }
.pin.sq { border-radius: 5px; } .pin.done { opacity: .45; } .pin.home { border-radius: 30% 30% 50% 50%; background: var(--greige); }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }

.login { max-width: 400px; margin: 10vh auto; }
.login .logo { justify-content: center; margin-bottom: 18px; font-size: 20px; }
.login .logo .mark { width: 46px; height: 46px; font-size: 20px; border-radius: 14px; }
.progress { height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--green); border-radius: 999px; transition: width .3s; }
.stepper { display: flex; gap: 6px; align-items: center; }
.qr { background: #fff; padding: 8px; border-radius: 10px; display: inline-block; }
.hero { background: linear-gradient(135deg, #24211d, #1b1b1f); border: 1px solid var(--line); border-radius: 18px; padding: 18px; margin: 12px 0; }
.hero h2 { font-size: 20px; }
details summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
details { border-bottom: 1px solid var(--line); }
.prose p, .prose li { font-size: 14px; }
.prose h3 { margin-top: 18px; }
.prose ol, .prose ul { padding-left: 20px; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 14px 0 8px; display: flex; gap: 8px; z-index: 5; }
.badge { min-width: 18px; height: 18px; border-radius: 9px; background: var(--accent); color: #17120c; font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; padding: 0 5px; }
.bar-h { display: flex; gap: 2px; align-items: flex-end; height: 60px; }
.bar-h div { flex: 1; background: var(--greige); border-radius: 3px 3px 0 0; min-height: 2px; }
.bar-h div.d { background: var(--green); }
.driver-card { border-left: 4px solid var(--muted); }
.hide { display: none !important; }
.scanner { position: relative; width: 100%; aspect-ratio: 1; background: #000; border-radius: 14px; overflow: hidden; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner .frame { position: absolute; inset: 14%; border: 2px solid var(--accent); border-radius: 14px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.pull { text-align: center; color: var(--muted); font-size: 12px; padding: 6px; }
@media print { header.top, nav.doors, .no-print, .toast, .sticky-actions { display: none !important; } body { background: #fff; color: #000; } .card { border-color: #ccc; break-inside: avoid; } }
