/* VOLT RIDER · Panel de administración */
:root {
  --bg: #08080a;
  --panel: #121215;
  --panel-2: #18181c;
  --line: #24242a;
  --line-2: #2e2e35;
  --text: #f4f4f5;
  --muted: #9a9aa3;
  --dim: #6b6b74;
  --yellow: #ffd60a;
  --yellow-2: #ffe55c;
  --yellow-ink: #141100;
  --green: #34d399;
  --red: #f87171;
  --blue: #60a5fa;
  --radius: 14px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
.num { font-variant-numeric: tabular-nums; }

/* Estructura */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 22px 16px; border-right: 1px solid var(--line); background: #0b0b0d; display: flex; flex-direction: column; gap: 22px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand img { width: 38px; height: 38px; border-radius: 9px; }
.brand b { font-size: 19px; letter-spacing: .5px; font-weight: 800; }
.brand b span { color: var(--yellow); }
.brand small { display: block; color: var(--yellow); font-size: 9.5px; letter-spacing: 2.4px; font-weight: 700; margin-top: 1px; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #c9c9cf; font-weight: 500; }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a.on { background: var(--yellow); color: var(--yellow-ink); font-weight: 700; }
.nav .badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.nav a.on .badge { background: var(--yellow-ink); color: var(--yellow); }
.side .foot { margin-top: auto; padding: 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.side .foot b { color: var(--text); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 16px; padding: 14px 28px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(8,8,10,.86); backdrop-filter: blur(10px); z-index: 1000; }
.search { flex: 1; max-width: 440px; display: flex; align-items: center; gap: 9px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; color: var(--muted); }
.search input { background: none; border: 0; outline: 0; color: var(--text); flex: 1; font: inherit; }
.live-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; background: rgba(52,211,153,.1); color: var(--green); font-size: 12px; font-weight: 600; border: 1px solid rgba(52,211,153,.25); }
.live-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(52,211,153,.6); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(52,211,153,0); } 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); } }
.top .spacer { flex: 1; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); display: grid; place-items: center; position: relative; cursor: pointer; }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); }
.me { display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--yellow); color: var(--yellow-ink); flex: none; }
.avatar.sm { width: 30px; height: 30px; font-size: 11.5px; }
.avatar.ghost { background: var(--panel-2); color: var(--yellow); border: 1px solid var(--line-2); }
.me b { display: block; font-size: 13px; }
.me small { color: var(--muted); font-size: 11.5px; }
.me form button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0; }
.me form button:hover { color: var(--yellow); }

.page { padding: 24px 28px 40px; display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.3px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.date-chip { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: #d4d4d8; }

/* Tarjetas */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.card-h h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card-h small { color: var(--muted); }
.link { color: var(--yellow); font-weight: 600; font-size: 13px; }
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, 1fr); }
.kpi { position: relative; overflow: hidden; }
.kpi .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,214,10,.1); color: var(--yellow); border: 1px solid rgba(255,214,10,.25); }
.kpi .delta { position: absolute; top: 18px; right: 18px; font-size: 12.5px; font-weight: 600; color: var(--green); }
.kpi .delta.neg { color: var(--red); }
.kpi .v { font-size: 32px; font-weight: 800; margin-top: 14px; letter-spacing: -.5px; }
.kpi .l { color: #c9c9cf; margin-top: 2px; }
.kpi .s { color: var(--muted); font-size: 12px; margin-top: 10px; display: flex; align-items: center; gap: 6px; }
.kpi .s i { width: 6px; height: 6px; border-radius: 50%; background: var(--yellow); }
.kpi.flash .v { animation: flash .9s ease; }
@keyframes flash { 0% { color: var(--yellow); } 100% { color: var(--text); } }

.row-2 { grid-template-columns: 1.65fr 1fr; }
.row-c { grid-template-columns: 1fr 1fr; }
.chart-box { position: relative; height: 230px; }

/* Mapa */
.map { height: 420px; border-radius: 11px; overflow: hidden; border: 1px solid var(--line); background: #0d0f12; }
.map.full { height: calc(100vh - 190px); min-height: 480px; }
.legend { display: flex; gap: 16px; color: var(--muted); font-size: 12px; margin-top: 10px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.leaflet-container { background: #0d0f12; font-family: var(--font); }
.leaflet-control-attribution { background: rgba(0,0,0,.55) !important; color: #888 !important; font-size: 10px !important; }
.leaflet-control-attribution a { color: #bbb !important; }
.leaflet-bar a { background: #17171b !important; color: #eee !important; border-color: #2a2a30 !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #17171b; color: var(--text); border: 1px solid #2e2e35; }
.leaflet-popup-content { margin: 12px 14px; font-size: 12.5px; line-height: 1.5; }
.anim .leaflet-marker-icon.veh { transition: transform 2.4s linear; }
.veh-ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #111; border: 2px solid var(--yellow); box-shadow: 0 0 0 3px rgba(255,214,10,.15), 0 2px 8px rgba(0,0,0,.6); color: var(--yellow); }
.veh-ic svg { width: 15px; height: 15px; }
.veh-ic.trip { background: var(--yellow); color: #111; border-color: #fff8c4; }
.veh-ic.real { border-color: var(--green); color: var(--green); box-shadow: 0 0 0 4px rgba(52,211,153,.25); }
.veh-ic.real.trip { background: var(--green); color: #052; }
.pin { width: 14px; height: 14px; border-radius: 50%; border: 3px solid #fff; }
.pin.o { background: var(--green); }
.pin.d { background: var(--yellow); }

/* Feed */
.feed { display: flex; flex-direction: column; gap: 2px; max-height: 420px; overflow: auto; }
.feed .it { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: start; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.feed .it:last-child { border: 0; }
.feed .it i { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; background: var(--muted); }
.feed .it i.searching { background: var(--blue); }
.feed .it i.accepted, .feed .it i.arrived { background: var(--yellow); }
.feed .it i.in_progress { background: var(--green); }
.feed .it i.completed { background: #a3a3a3; }
.feed .it i.cancelled { background: var(--red); }
.feed .it b { font-size: 12.5px; color: var(--yellow); font-weight: 600; }
.feed .it p { margin: 2px 0 0; color: #d4d4d8; font-size: 12.5px; line-height: 1.35; }
.feed .it time { color: var(--dim); font-size: 11.5px; }
.feed .it.new { animation: slide .5s ease; }
@keyframes slide { from { background: rgba(255,214,10,.12); } to { background: transparent; } }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.mini-stats div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.mini-stats b { display: block; font-size: 20px; }
.mini-stats small { color: var(--muted); font-size: 11.5px; }

/* Tablas */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12.5px; padding: 0 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255,255,255,.015); }
.who { display: flex; align-items: center; gap: 10px; }
.who b { display: block; font-weight: 600; font-size: 13px; }
.who small { color: var(--dim); font-size: 11.5px; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--panel-2); color: #c9c9cf; border: 1px solid var(--line-2); }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.plain::before { display: none; }
.tag.libre, .tag.completed, .tag.pagado, .tag.approved { color: var(--green); background: rgba(52,211,153,.08); border-color: rgba(52,211,153,.25); }
.tag.en_viaje, .tag.in_progress, .tag.accepted, .tag.arrived { color: var(--blue); background: rgba(96,165,250,.08); border-color: rgba(96,165,250,.25); }
.tag.pendiente, .tag.pending, .tag.searching { color: var(--yellow); background: rgba(255,214,10,.08); border-color: rgba(255,214,10,.3); }
.tag.bloqueado, .tag.blocked, .tag.cancelled, .tag.anulado { color: var(--red); background: rgba(248,113,113,.08); border-color: rgba(248,113,113,.25); }
.tag.desconectado { color: var(--dim); }
.method { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 11.5px; font-weight: 600; background: rgba(255,214,10,.1); color: var(--yellow); border: 1px solid rgba(255,214,10,.2); text-transform: capitalize; }
.method.efectivo { background: rgba(52,211,153,.08); color: var(--green); border-color: rgba(52,211,153,.2); }
.method.transferencia { background: rgba(96,165,250,.08); color: var(--blue); border-color: rgba(96,165,250,.2); }
.rating { color: #e4e4e7; font-weight: 600; }
.rating::after { content: " ★"; color: var(--yellow); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); font-weight: 600; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #44444c; }
.btn.y { background: var(--yellow); color: var(--yellow-ink); border-color: var(--yellow); }
.btn.y:hover { background: var(--yellow-2); }
.btn.r { color: var(--red); }
.btn:disabled { opacity: .35; cursor: default; }
.actions { display: flex; gap: 6px; }

/* Filtros / formularios */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select, .field input { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; color: var(--text); padding: 9px 12px; font: inherit; outline: 0; }
.filters input:focus, .field input:focus { border-color: var(--yellow); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips a { padding: 7px 13px; border-radius: 99px; border: 1px solid var(--line); color: #c9c9cf; font-size: 12.5px; font-weight: 500; }
.chips a.on { background: var(--yellow); color: var(--yellow-ink); border-color: var(--yellow); font-weight: 700; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-row .card b { font-size: 24px; display: block; margin-top: 4px; }
.stat-row .card small { color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { color: var(--muted); font-size: 12.5px; }
.field .in { display: flex; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; }
.field .in span { padding: 0 0 0 12px; color: var(--muted); font-size: 12.5px; }
.field .in input { border: 0; flex: 1; min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.notice { padding: 12px 16px; border-radius: 10px; background: rgba(52,211,153,.08); border: 1px solid rgba(52,211,153,.25); color: var(--green); }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; color: var(--muted); font-size: 12.5px; }
.pager .actions a, .pager .actions span { padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); }
.pager .actions span { opacity: .35; }
.route-cell { max-width: 320px; }
.route-cell div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.route-cell .o::before, .route-cell .d::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; }
.route-cell .o::before { background: var(--green); }
.route-cell .d::before { background: var(--yellow); }
.route-cell .d { color: var(--muted); }
.bar-row { display: grid; grid-template-columns: 120px 1fr 120px; gap: 12px; align-items: center; padding: 8px 0; }
.bar-row .bar { height: 10px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.bar-row .bar i { display: block; height: 100%; background: var(--yellow); border-radius: 99px; }
.empty { color: var(--muted); text-align: center; padding: 30px; }

@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .row-2, .row-c { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .stat-row, .form-grid { grid-template-columns: 1fr 1fr; }
}

/* MapLibre */
.maplibregl-map { font-family: var(--font); }
.maplibregl-popup-content { background: #17171b; color: var(--text); border: 1px solid #2e2e35; border-radius: 10px; font-size: 12.5px; line-height: 1.5; padding: 10px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.maplibregl-popup-tip { border-top-color: #17171b !important; border-bottom-color: #17171b !important; }
.maplibregl-popup-close-button { color: #888; }
.maplibregl-ctrl-group { background: #17171b !important; border: 1px solid #2a2a30; }
.maplibregl-ctrl-group button + button { border-top: 1px solid #2a2a30 !important; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1); }
.maplibregl-ctrl-attrib { background: rgba(0,0,0,.55) !important; color: #888; font-size: 10px; }
.maplibregl-ctrl-attrib a { color: #bbb !important; }
.maplibregl-ctrl-attrib-button { filter: invert(1); }
.veh-ic { cursor: pointer; }
