/* Blitz — hoja de estilo única para las tres apps (cliente, conductor, admin). */
:root {
  --bg: #0a0b0f;
  --bg-2: #12141c;
  --card: #171a24;
  --card-2: #1e222e;
  --line: #262b3a;
  --text: #eef1f7;
  --muted: #99a1b3;
  --dim: #666e82;
  --brand: #ffc91d;
  --brand-ink: #1a1400;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --info: #60a5fa;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior-y: none;
}

body { display: flex; flex-direction: column; }

a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 .4em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
small { color: var(--muted); }

/* ------------------------------------------------------------- marca ---- */
.brand { display: flex; align-items: center; gap: .5rem; }
.brand .wordmark { height: 26px; width: auto; display: block; }
.brand .isotipo { height: 30px; width: auto; display: block; }
.hero-logo { width: min(78vw, 330px); height: auto; display: block; margin: 0 auto; }
.hero-iso { width: 108px; height: auto; display: block; margin: 0 auto .9rem; }

/* ------------------------------------------------------------ layout ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .85rem 1rem; background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.topbar .right { display: flex; align-items: center; gap: .5rem; }

main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.wrap { max-width: 780px; margin: 0 auto; padding: 1rem 1rem calc(1rem + var(--safe-b)); }
.wrap.wide { max-width: 1200px; }

.tabbar {
  display: flex; background: var(--bg-2); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b); position: sticky; bottom: 0; z-index: 40;
}
.tabbar button {
  flex: 1; background: none; border: 0; color: var(--dim);
  padding: .6rem .2rem .7rem; font: inherit; font-size: .72rem;
  display: flex; flex-direction: column; align-items: center; gap: .2rem; cursor: pointer;
}
.tabbar button .ico { font-size: 1.15rem; line-height: 1; }
.tabbar button.on { color: var(--brand); }

/* -------------------------------------------------------------- cards --- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem; margin-bottom: .85rem;
}
.card.tight { padding: .75rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .6rem; }
.stack > * + * { margin-top: .7rem; }
.row { display: flex; gap: .6rem; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap-r { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: .7rem; }
.grid.g2 { grid-template-columns: repeat(2, 1fr); }
.grid.g3 { grid-template-columns: repeat(3, 1fr); }
.grid.g4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
@media (max-width: 520px) { .grid.g3 { grid-template-columns: repeat(2, 1fr); } }

.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .8rem; }
.stat .k { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; }
.stat .v { font-size: 1.35rem; font-weight: 800; margin-top: .15rem; }
.stat .v.sm { font-size: 1.05rem; }

/* ------------------------------------------------------------ botones --- */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--card-2);
  color: var(--text); font: inherit; font-weight: 600;
  padding: .72rem 1rem; border-radius: 12px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  transition: transform .06s ease, filter .15s ease;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; color: var(--bad); border-color: #4a2530; }
.btn.ok { background: var(--ok); color: #06281c; border-color: var(--ok); }
.btn.block { width: 100%; }
.btn.sm { padding: .45rem .7rem; font-size: .85rem; border-radius: 10px; }
.btn.lg { padding: .95rem 1rem; font-size: 1.02rem; }

/* ------------------------------------------------------------ formas ---- */
label.field { display: block; margin-bottom: .7rem; }
label.field > span { display: block; font-size: .78rem; color: var(--muted); margin-bottom: .3rem; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; padding: .7rem .8rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
textarea { resize: vertical; min-height: 72px; }
input::placeholder, textarea::placeholder { color: var(--dim); }
select { appearance: none; background-image: linear-gradient(transparent, transparent); }

.seg { display: flex; gap: .4rem; background: var(--bg-2); padding: .3rem; border-radius: 13px; border: 1px solid var(--line); }
.seg button {
  flex: 1; background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600;
  padding: .55rem .4rem; border-radius: 10px; cursor: pointer; font-size: .88rem;
}
.seg button.on { background: var(--brand); color: var(--brand-ink); }

.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--bg-2); color: var(--muted);
  padding: .35rem .7rem; border-radius: 999px; font-size: .8rem; cursor: pointer;
}
.chip.on { border-color: var(--brand); color: var(--brand); }

/* ------------------------------------------------------------- badges --- */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 700;
  background: var(--card-2); color: var(--muted); border: 1px solid var(--line);
  white-space: nowrap;
}
.badge.ok { color: var(--ok); border-color: #1d4b3c; background: #0f2a20; }
.badge.warn { color: var(--warn); border-color: #4b3c14; background: #2a2110; }
.badge.bad { color: var(--bad); border-color: #4b2020; background: #2a1212; }
.badge.info { color: var(--info); border-color: #1e3a5c; background: #101f31; }
.badge.brand { color: var(--brand-ink); background: var(--brand); border-color: var(--brand); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); display: inline-block; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(52, 211, 153, .18); }

/* --------------------------------------------------------------- mapa --- */
.map { width: 100%; height: 300px; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; background: var(--bg-2); }
.map.tall { height: 46vh; min-height: 260px; }
.map.full { height: 100%; border-radius: 0; border: 0; }
.leaflet-container { background: #10131b !important; font: inherit !important; }
.leaflet-control-attribution { background: rgba(0,0,0,.5) !important; color: #8a91a3 !important; font-size: 10px !important; }
.leaflet-control-attribution a { color: #aab2c5 !important; }
.leaflet-bar a { background: var(--card) !important; color: var(--text) !important; border-color: var(--line) !important; }
.pin { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-size: 15px; box-shadow: 0 2px 8px rgba(0,0,0,.5); }
.pin.a { background: var(--ok); color: #04231a; }
.pin.b { background: var(--brand); color: var(--brand-ink); }
.pin.drv { background: var(--info); color: #04182e; }

/* ------------------------------------------------------------- listas --- */
.list { list-style: none; margin: 0; padding: 0; }
.item {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: .8rem; margin-bottom: .6rem; cursor: pointer;
}
.item:active { background: var(--card-2); }
.item.flat { cursor: default; }
.item .title { font-weight: 700; }
.item .sub { color: var(--muted); font-size: .84rem; }

.route { display: grid; grid-template-columns: 14px 1fr; gap: .1rem .6rem; align-items: start; font-size: .88rem; }
.route .mark { display: grid; place-items: center; padding-top: 3px; }
.route .mark i { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); display: block; }
.route .mark.b i { background: var(--brand); border-radius: 2px; }
.route .bar { width: 2px; height: 14px; background: var(--line); margin: 2px auto; }
.route .txt { color: var(--text); overflow: hidden; text-overflow: ellipsis; }

.price { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; }
.price small { font-size: .7rem; font-weight: 600; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }

hr.sep { border: 0; border-top: 1px solid var(--line); margin: .9rem 0; }

/* ---------------------------------------------------------- timeline ---- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.1rem; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 .8rem .4rem; font-size: .86rem; }
.timeline li::before {
  content: ''; position: absolute; left: -1.52rem; top: .35rem;
  width: 9px; height: 9px; border-radius: 50%; background: var(--line);
}
.timeline li.done::before { background: var(--ok); }
.timeline li.now::before { background: var(--brand); box-shadow: 0 0 0 4px rgba(255, 201, 29, .18); }

/* ------------------------------------------------------------ modales --- */
.sheet-bg {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .6); backdrop-filter: blur(2px);
  display: flex; align-items: flex-end; justify-content: center; z-index: 100;
}
.sheet {
  background: var(--card); width: 100%; max-width: 560px;
  border-radius: 20px 20px 0 0; padding: 1.1rem 1rem calc(1.2rem + var(--safe-b));
  box-shadow: var(--shadow); max-height: 88vh; overflow-y: auto;
  animation: up .18s ease-out;
}
@media (min-width: 640px) {
  .sheet-bg { align-items: center; }
  .sheet { border-radius: 20px; }
}
@keyframes up { from { transform: translateY(18px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet .handle { width: 40px; height: 4px; background: var(--line); border-radius: 4px; margin: -.4rem auto .8rem; }

/* ------------------------------------------------------------- toasts --- */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); top: .7rem; z-index: 200; display: flex; flex-direction: column; gap: .4rem; width: min(94vw, 460px); }
.toast {
  background: var(--card-2); border: 1px solid var(--line); color: var(--text);
  padding: .7rem .9rem; border-radius: 12px; box-shadow: var(--shadow);
  font-size: .9rem; animation: up .16s ease-out;
}
.toast.ok { border-color: #1d4b3c; }
.toast.bad { border-color: #4b2020; }
.toast.brand { border-color: var(--brand); }

/* ------------------------------------------------------------- varios --- */
.empty { text-align: center; color: var(--dim); padding: 2.2rem 1rem; }
.empty .big { font-size: 2.2rem; margin-bottom: .4rem; }
.spinner {
  width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { padding: .55rem .6rem; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; background: var(--bg-2); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--card-2); }

.suggest { position: relative; }
.suggest-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 60;
  background: var(--card-2); border: 1px solid var(--line); border-radius: 12px;
  max-height: 240px; overflow-y: auto; box-shadow: var(--shadow);
}
.suggest-list div { padding: .6rem .7rem; cursor: pointer; font-size: .87rem; border-bottom: 1px solid var(--line); }
.suggest-list div:last-child { border-bottom: 0; }
.suggest-list div:hover { background: var(--card); }
.suggest-list .hint { color: var(--dim); font-size: .78rem; cursor: default; }
