/* WayRide: estilos compartidos por las 3 apps. Modo claro/oscuro automático. */
:root {
  --brand: #0f766e;
  --brand-strong: #115e59;
  --brand-soft: #ccfbf1;
  --on-brand: #ffffff;
  --accent: #f59e0b;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --line: #d9e0e6;
  --text: #0f1b24;
  --muted: #5b6b78;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --info: #1d4ed8;
  --info-soft: #dbeafe;
  --shadow: 0 1px 2px rgba(15, 27, 36, .06), 0 6px 20px rgba(15, 27, 36, .08);
  --radius: 16px;
  --radius-sm: 10px;
  --tap: 52px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #2dd4bf;
    --brand-strong: #5eead4;
    --brand-soft: #134e4a;
    --on-brand: #04201d;
    --bg: #0b1217;
    --surface: #131d24;
    --surface-2: #1b2831;
    --line: #2a3a45;
    --text: #e8eef2;
    --muted: #9aabb8;
    --ok: #4ade80;
    --ok-soft: #14361f;
    --warn: #fbbf24;
    --warn-soft: #3b2a07;
    --danger: #f87171;
    --danger-soft: #3f1515;
    --info: #93c5fd;
    --info-soft: #172a4a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #2dd4bf; --brand-strong: #5eead4; --brand-soft: #134e4a; --on-brand: #04201d;
  --bg: #0b1217; --surface: #131d24; --surface-2: #1b2831; --line: #2a3a45; --text: #e8eef2; --muted: #9aabb8;
  --ok: #4ade80; --ok-soft: #14361f; --warn: #fbbf24; --warn-soft: #3b2a07; --danger: #f87171; --danger-soft: #3f1515;
  --info: #93c5fd; --info-soft: #172a4a; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35);
  color-scheme: dark;
}
:root[data-size="big"] { font-size: 118%; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.center { text-align: center; }
.row { display: flex; gap: .75rem; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- botones */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  min-height: 44px;
  padding: .6rem 1rem;
  border-radius: 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  text-decoration: none;
  transition: transform .05s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent);
  outline-offset: 2px;
}
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-big { min-height: var(--tap); font-size: 1.08rem; width: 100%; border-radius: 14px; }
.btn-sm { min-height: 36px; padding: .35rem .75rem; font-size: .9rem; border-radius: 10px; }
.btn-block { width: 100%; }

/* ---------- formularios */
.field { display: flex; flex-direction: column; gap: .35rem; }
.field > span { font-weight: 600; font-size: .92rem; }
.field small { color: var(--muted); }
input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 48px;
  padding: .6rem .8rem;
  width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button {
  flex: 1; border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 600;
  min-height: 42px; border-radius: 9px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: var(--shadow); color: var(--brand); }

/* ---------- tarjetas y listas */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.list { display: flex; flex-direction: column; }
.list > .item { display: flex; gap: .75rem; align-items: center; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.list > .item:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }
.divider { height: 1px; background: var(--line); margin: .75rem 0; }

/* ---------- badges y banners */
.badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px;
  font-size: .78rem; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.banner { border-radius: 14px; padding: .75rem 1rem; display: flex; gap: .75rem; align-items: center; font-weight: 600; }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.danger { background: var(--danger-soft); color: var(--danger); }
.banner.info { background: var(--info-soft); color: var(--info); }
.banner .grow { color: inherit; }

/* Patente argentina (Mercosur) */
.plate {
  display: inline-flex; flex-direction: column; align-items: center; border: 3px solid #111; border-radius: 8px;
  background: #fff; color: #111; font-weight: 800; letter-spacing: .12em; font-size: 1.35rem; line-height: 1;
  overflow: hidden; min-width: 150px; font-family: "Arial Black", Arial, sans-serif;
}
.plate::before { content: "ARGENTINA"; display: block; width: 100%; background: #1d4ed8; color: #fff; font-size: .55rem; letter-spacing: .2em; padding: 3px 0; text-align: center; font-family: var(--font); }
.plate span { padding: 6px 10px; }

/* ---------- avatar */
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--surface-2); flex: none; display: grid; place-items: center; font-weight: 700; color: var(--muted); }
.avatar.lg { width: 72px; height: 72px; }
.avatar.xl { width: 140px; height: 140px; border: 4px solid var(--surface); box-shadow: var(--shadow); }

/* ---------- app shell móvil */
.app { display: flex; flex-direction: column; min-height: 100dvh; max-width: 560px; margin: 0 auto; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem;
  padding: .7rem 1rem; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
}
.logo { font-weight: 800; letter-spacing: -.02em; font-size: 1.2rem; display: flex; align-items: center; gap: .4rem; }
.logo i { width: 26px; height: 26px; border-radius: 8px; background: var(--brand); display: inline-grid; place-items: center; color: var(--on-brand); font-style: normal; font-size: .9rem; }
.page { flex: 1; padding: 0 1rem 6rem; display: flex; flex-direction: column; gap: 1rem; }
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center;
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav .inner { display: flex; width: 100%; max-width: 560px; }
.bottomnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .55rem 0 .5rem;
  color: var(--muted); text-decoration: none; font-size: .75rem; font-weight: 600;
}
.bottomnav a svg { width: 24px; height: 24px; }
.bottomnav a[aria-current="page"] { color: var(--brand); }

/* ---------- mapa a pantalla completa con hoja inferior */
.mapwrap { position: relative; flex: 1; min-height: 60dvh; }
.mapwrap .map { position: absolute; inset: 0; }
.mapwrap .leaflet-bottom.leaflet-right { margin-bottom: 26px; }
/* Viaje en curso: mapa más bajo para que la cara del chofer entre en pantalla. */
.mapwrap.short { flex: none; min-height: 0; height: 34dvh; }
.map { background: var(--surface-2); }
.sheet {
  position: relative; z-index: 10; margin-top: -24px; background: var(--surface); border-radius: 22px 22px 0 0;
  box-shadow: 0 -6px 24px rgba(0,0,0,.12); padding: 1rem 1rem 6rem; display: flex; flex-direction: column; gap: .8rem;
}
.sheet .grip { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: -.3rem auto .2rem; }
.overlay-top { position: absolute; z-index: 500; left: 12px; right: 12px; top: 12px; }

/* ---------- modal y toast */
.modal-bg { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 700px) { .modal-bg { align-items: center; } }
.modal {
  background: var(--surface); color: var(--text); width: 100%; max-width: 520px; max-height: 92dvh; overflow: auto;
  border-radius: 22px 22px 0 0; padding: 1.2rem 1rem calc(1rem + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: .9rem;
}
@media (min-width: 700px) { .modal { border-radius: 22px; } }
.toasts { position: fixed; z-index: 2000; left: 0; right: 0; top: 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; max-width: 92vw; background: var(--text); color: var(--bg); padding: .7rem 1rem; border-radius: 12px;
  font-weight: 600; box-shadow: var(--shadow); animation: toastIn .2s ease;
}
.toast.error { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } }

/* ---------- fotos (cámara) */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; }
.photo-tile {
  position: relative; border: 2px dashed var(--line); border-radius: 14px; min-height: 130px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .3rem; text-align: center; padding: .6rem; cursor: pointer; background: var(--surface-2); overflow: hidden;
}
.photo-tile.done { border-style: solid; border-color: var(--ok); }
.photo-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-tile .lbl { position: relative; z-index: 1; font-weight: 700; font-size: .88rem; }
.photo-tile.done .lbl { background: rgba(0,0,0,.6); color: #fff; padding: .15rem .5rem; border-radius: 8px; margin-top: auto; }
.photo-tile .hint { position: relative; z-index: 1; font-size: .75rem; color: var(--muted); }
.photo-tile.done .hint { display: none; }
.photo-tile input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- varios */
.stars { display: flex; gap: .3rem; justify-content: center; }
.stars button { border: 0; background: transparent; font-size: 2.3rem; line-height: 1; cursor: pointer; color: var(--line); padding: 0 .1rem; }
.stars button.on { color: var(--accent); }
.pin { font-size: 2.4rem; font-weight: 800; letter-spacing: .35em; font-variant-numeric: tabular-nums; }
.bigcode { font-size: 2rem; font-weight: 800; letter-spacing: .1em; font-variant-numeric: tabular-nums; }
.pulse { width: 96px; height: 96px; border-radius: 50%; background: var(--brand); margin: 1rem auto; position: relative; }
.pulse::before, .pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--brand); animation: pulse 1.8s ease-out infinite; }
.pulse::after { animation-delay: .9s; }
@keyframes pulse { from { transform: scale(1); opacity: .5; } to { transform: scale(2.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pulse::before, .pulse::after { animation: none; } }
.meter { height: 12px; border-radius: 6px; background: var(--surface-2); overflow: hidden; position: relative; }
.meter > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; }
.meter-ticks { position: relative; height: 18px; font-size: .72rem; color: var(--muted); }
.meter-ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.meter-ticks span:last-child { transform: translateX(-100%); }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.suggest { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.suggest button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); font: inherit; padding: .7rem .8rem; cursor: pointer; }
.suggest button:last-child { border-bottom: 0; }
.suggest button:hover { background: var(--surface-2); }

/* Tipos de vehículo al pedir */
.vt-list { display: flex; flex-direction: column; gap: .45rem; }
.vt {
  display: flex; align-items: center; gap: .75rem; width: 100%; text-align: left; font: inherit; color: var(--text);
  background: var(--surface); border: 2px solid var(--line); border-radius: 14px; padding: .55rem .8rem; cursor: pointer;
}
.vt.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }
.vt-ico { font-size: 1.6rem; width: 2rem; text-align: center; }

/* Contador (mensajes sin leer, pendientes) */
.count { background: var(--danger); color: #fff; border-radius: 999px; font-size: .72rem; padding: 0 .45rem; min-width: 1.4rem; text-align: center; font-weight: 700; }

/* Chat del viaje */
.chat-list { display: flex; flex-direction: column; gap: .45rem; max-height: 46dvh; min-height: 160px; overflow: auto; padding: .25rem; background: var(--surface-2); border-radius: 14px; }
.bubble { max-width: 80%; padding: .5rem .75rem; border-radius: 14px 14px 14px 4px; background: var(--surface); border: 1px solid var(--line); align-self: flex-start; }
.bubble.mine { align-self: flex-end; background: var(--brand-soft); border-color: transparent; border-radius: 14px 14px 4px 14px; }

/* Marcadores del mapa */
.wr-car { transition: transform .9s linear; }
.wr-pin { display: grid; place-items: center; }
.leaflet-container { font-family: var(--font); background: var(--surface-2); }

/* Código de verificación y PIN (lo usan las dos apps móviles) */
.pin-input { font-size: 2rem; text-align: center; letter-spacing: .5em; font-weight: 800; }
/* Barra de avance (metas de los choferes) */
.progress { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--brand); border-radius: 5px; }
.progress.done i { background: var(--ok); }
/* Salidas fijas */
.seat-row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.seat-row .pin-input { font-size: 1.3rem; width: 7.5rem; letter-spacing: .3em; padding: .35rem; }
