/* LatigoBit Firenze - estética tipo app real (estilo inDrive)
   Hoja inferior blanca, botón lima gigante, carrusel de servicios.
   Modo claro y oscuro con variables (ver theme.js) */

:root {
  --bg: #f2f2f0;
  --surface: #ffffff;
  --surface-2: #f2f3f5;
  --text: #101828;
  --text-2: #475467;
  --text-3: #98a2b3;
  --muted: #b6bdc9;
  --border: #e4e7ec;
  --accent: #c8f31d;            /* verde lima característico */
  --accent-2: #b8e916;          /* lima oscuro para presionar */
  --accent-text: #1a2e05;
  --blue: #2f80ed;
  --chip-active-bg: #e8f1fd;    /* azulito del chip seleccionado */
  --chip-active-text: #1d4ed8;
  --handle: #d0d5dd;
  --warn-bg: #fef9c3;
  --warn-text: #713f12;
  --ok-bg: #dcfce7;
  --ok-text: #14532d;
  --card-ok-bg: #f0fdf4;
  --card-ok-border: #16a34a;
  --shadow-soft: 0 2px 14px rgba(16, 24, 40, 0.12);
  --shadow-btn: 0 3px 12px rgba(16, 24, 40, 0.16);
  --panel-shadow: 0 -6px 28px rgba(16, 24, 40, 0.14);
}

[data-theme="dark"] {
  --bg: #0b0d10;
  --surface: #171a1f;
  --surface-2: #23272e;
  --text: #f2f4f7;
  --text-2: #d0d5dd;
  --text-3: #98a2b3;
  --muted: #667085;
  --border: #344054;
  --chip-active-bg: #16233d;
  --chip-active-text: #93c5fd;
  --handle: #344054;
  --warn-bg: #3b2f06;
  --warn-text: #fde047;
  --ok-bg: #052e16;
  --ok-text: #86efac;
  --card-ok-bg: #052e16;
  --card-ok-border: #16a34a;
  --shadow-soft: 0 2px 14px rgba(0, 0, 0, 0.5);
  --shadow-btn: 0 3px 12px rgba(0, 0, 0, 0.55);
  --panel-shadow: 0 -6px 28px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior: none;
  letter-spacing: -0.01em;
}

/* ---- Botones circulares flotantes (hamburguesa / tema / ubicación) ---- */
.round-btn {
  position: absolute;
  z-index: 1000;
  width: 48px;
  height: 48px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-btn);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  border: none;
  cursor: pointer;
  transition: transform 0.08s;
}
.round-btn:active { transform: scale(0.9); }
.round-btn.top-left {
  top: calc(14px + env(safe-area-inset-top));
  left: 16px;
}
.round-btn.top-right {
  top: calc(14px + env(safe-area-inset-top));
  right: 16px;
}
.round-btn.mid-right {
  bottom: calc(46vh);
  right: 16px;
}

/* ---- Layout: mapa completo + hoja inferior ---- */
.layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#map { flex: 1; min-height: 0; background: var(--bg); }

.panel {
  flex: none;
  max-height: 62vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 16px calc(18px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-radius: 28px 28px 0 0;
  box-shadow: var(--panel-shadow);
  position: relative;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Manija para arrastrar */
.panel::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--handle);
  margin: 2px auto 4px;
  flex: none;
}

.panel h2 { font-size: 1.2rem; font-weight: 700; }
.hint { font-size: 0.85rem; color: var(--text-3); margin-top: -8px; }

/* ---- Banner informativo ---- */
.info-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border-radius: 18px;
  padding: 12px 14px;
  font-size: 0.92rem;
  color: var(--text-2);
  cursor: pointer;
}
.info-banner p { flex: 1; line-height: 1.35; }
.info-banner strong { color: var(--text); }
.info-icon {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
}
.info-banner > svg { color: var(--text-3); flex: none; }

/* ---- Carrusel de servicios ---- */
.chips {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 4px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  min-width: 92px;
  padding: 12px 10px;
  border-radius: 18px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  text-align: center;
}
.chip-icon { font-size: 1.7rem; line-height: 1; }
.chip.active {
  background: var(--chip-active-bg);
  color: var(--chip-active-text);
}
.chip.disabled { opacity: 0.45; }
.chip em { font-style: normal; font-weight: 400; color: var(--text-3); font-size: 0.68rem; }

/* ---- Filas de entrada (origen / destino / datos) ---- */
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border-radius: 16px;
  padding: 4px 8px 4px 16px;
  min-height: 56px;
}
.row-icon { color: var(--text-3); flex: none; }

.dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  flex: none;
}
.dot.green { background: #12b76a; box-shadow: 0 0 0 3.5px rgba(18, 183, 106, 0.2); }

.row input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  padding: 13px 0;
  font-size: 16px;
  color: var(--text);
}
.row input:focus { outline: none; }
.row input::placeholder { color: var(--text-3); }
.row input[readonly] { color: var(--text-2); font-weight: 600; }

/* ---- Sugerencias de dirección (autocompletado) ---- */
.suggestions {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  margin-top: -6px;
  max-height: 220px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.suggestion {
  width: 100%;
  min-height: 0;
  padding: 12px 16px;
  text-align: left;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-radius: 0;
}
.suggestion:last-child { border-bottom: none; }
.suggestion:active { background: var(--surface-2); }
.suggestion .sug-title { font-size: 0.95rem; font-weight: 600; }
.suggestion .sug-sub { font-size: 0.78rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.go-btn {
  flex: none;
  width: 42px;
  height: 42px;
  min-height: 0;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.08s;
}
.go-btn:active { transform: scale(0.9); background: var(--accent-2); }

/* ---- Campos genéricos (registro de conductor) ---- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.8rem; font-weight: 600; color: var(--text-2); }
.field input {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1.5px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  width: 100%;
}
.field input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.field input::placeholder { color: var(--text-3); }

/* Inputs de tipo archivo y fecha */
input[type="file"] {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.9rem;
  border: 1.5px dashed var(--border);
}
input[type="date"] { color: var(--text); }
select {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1.5px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  width: 100%;
}
select:focus { outline: none; border-color: var(--accent); background: var(--surface); }

/* ---- Tabs login / registro del conductor ---- */
.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.auth-tab {
  flex: 1;
  padding: 12px;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
}
.auth-tab.active { background: var(--accent); color: var(--accent-text); }

/* ---- Botones ---- */
button {
  padding: 16px;
  min-height: 56px;
  border-radius: 18px;
  border: none;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: transform 0.06s, opacity 0.15s, background 0.1s;
  font-family: inherit;
}
button:active { transform: scale(0.98); }
button.primary {
  background: var(--accent);
  color: var(--accent-text);
  letter-spacing: -0.01em;
}
button.primary:active { background: var(--accent-2); }
button.primary:disabled { background: var(--border); color: var(--muted); transform: none; }
button.secondary { background: var(--surface-2); color: var(--text); font-weight: 600; }

.cta-row { display: flex; gap: 10px; }
.cta-row .primary { flex: 1; }
.square-btn {
  flex: none;
  width: 56px;
  padding: 0;
  border-radius: 18px;
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
}
.square-btn:active { background: var(--accent-2); }

/* ---- Cotización (fila de tarifa estilo "Offer your fare") ---- */
.quote {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---- Pago con tarjeta ---- */
.payment {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.payment-header {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border-radius: 16px;
  padding: 14px 16px;
}
.payment-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}
.payment-title { font-weight: 700; font-size: 1rem; }
.payment-subtitle { color: var(--text-3); font-size: 0.85rem; }
.card-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.pay-info {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-3);
  background: var(--surface-2);
  padding: 10px 12px;
  border-radius: 12px;
}
.pay-info svg { flex: none; color: var(--ok-text); }
.pay-info.cash svg { color: var(--warn-text); }

.method-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 72px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.method-btn:active { background: var(--surface); transform: scale(0.98); }
.method-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex: none;
}
.method-text { display: flex; flex-direction: column; gap: 2px; }
.method-text strong { font-size: 1rem; }
.method-text small { color: var(--text-3); font-size: 0.82rem; }
.fare-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-2);
  border-radius: 16px;
  padding: 14px 18px;
  min-height: 64px;
}
.fare-icon {
  flex: none;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-2);
  width: 26px;
  text-align: center;
}
.fare-text { flex: 1; min-width: 0; }
.quote .price { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.03em; }
.quote .quote-detail { color: var(--text-3); font-size: 0.85rem; margin-top: 2px; }

/* ---- Estados ---- */
.status {
  border-radius: 18px;
  padding: 16px;
  font-size: 0.95rem;
  line-height: 1.6;
}
.status.waiting { background: var(--warn-bg); color: var(--warn-text); }
.status.accepted { background: var(--ok-bg); color: var(--ok-text); }
.status button { margin-top: 10px; min-height: 48px; }
.status.waiting button { background: transparent; color: var(--warn-text); border: 1.5px solid currentColor; }

/* ---- Tarjetas de carreras (conductor) ---- */
.ride-list { display: flex; flex-direction: column; gap: 12px; }
.ride-list .empty { color: var(--text-3); font-size: 0.9rem; text-align: center; padding: 12px 0; }

.ride-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.92rem;
  line-height: 1.45;
}
.ride-card.accepted { border-color: var(--card-ok-border); background: var(--card-ok-bg); }
.ride-card h3 { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.02em; }
.ride-card button { margin-top: 8px; }

.hidden { display: none !important; }

#registerBox, #dashBox { display: flex; flex-direction: column; gap: 14px; }
#dashBox.hidden, #registerBox.hidden { display: none !important; }

/* ---- Términos y condiciones (registro conductor) ---- */
.terms-box {
  background: var(--surface-2);
  border-radius: 16px;
  padding: 16px;
  border: 1.5px solid var(--border);
}
.terms-box h3 {
  font-size: 0.95rem;
  margin-bottom: 10px;
  color: var(--text);
}
.terms-content {
  max-height: 180px;
  overflow-y: auto;
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: 12px;
  padding-right: 6px;
}
.terms-content p { margin-bottom: 8px; }
.terms-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}
.terms-check input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
}

/* ---- Resumen financiero del conductor ---- */
.driver-finance {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.finance-card {
  background: var(--surface-2);
  border-radius: 16px;
  padding: 14px;
  text-align: center;
  border: 1.5px solid var(--border);
}
.finance-card.debt {
  background: var(--warn-bg);
  border-color: var(--warn-text);
}
.finance-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
}
.finance-card.debt .finance-value { color: var(--warn-text); }
.finance-label {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 4px;
  font-weight: 600;
}
.iban-box {
  background: var(--surface-2);
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: var(--text-2);
  border: 1.5px dashed var(--border);
}
.iban-box p:last-child {
  font-family: monospace;
  font-size: 0.95rem;
  color: var(--text);
  margin-top: 4px;
}

/* ---- App del conductor (sin mapa) ---- */
.driver-page {
  overflow: auto;
  background: var(--bg);
}
.driver-layout {
  display: flex;
  min-height: 100vh;
  padding-top: 60px;
}
.driver-panel {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.driver-panel h2 { font-size: 1.2rem; font-weight: 700; }

.ride-alert {
  background: var(--accent);
  color: var(--accent-text);
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  animation: slideUp 0.25s ease;
}

.ride-card .ride-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.ride-card .ride-head h3 { margin: 0; }
.ride-dist {
  background: var(--surface-2);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-2);
}
.pay-badge {
  background: var(--surface-2);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-2);
}
.verify-code {
  background: var(--blue);
  color: #fff;
  padding: 12px 16px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.verify-code span { font-size: 0.85rem; opacity: 0.9; }
.verify-code strong {
  font-size: 1.8rem;
  letter-spacing: 4px;
  font-family: monospace;
}
.ride-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.ride-actions button {
  min-height: 52px;
  font-size: 1rem;
}

.client-code {
  margin-top: 12px;
  padding: 14px;
  background: var(--blue);
  color: #fff;
  border-radius: 14px;
  text-align: center;
  font-size: 0.95rem;
}
.client-code strong {
  display: block;
  font-size: 2rem;
  letter-spacing: 6px;
  font-family: monospace;
  margin: 4px 0;
}
.client-code small { opacity: 0.85; }

/* ---- Marca flotante (panel del conductor) ---- */
.brand-pill {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  background: var(--surface);
  padding: 8px 16px 8px 12px;
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-pill .city { color: var(--text-3); font-weight: 500; }
.brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
}
.brand-pill.client {
  top: calc(14px + env(safe-area-inset-top));
}

/* ---- Etiqueta azul de ubicación sobre el mapa (tipo "Grand Parade") ---- */
.loc-label {
  background: var(--blue) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 999px !important;
  padding: 8px 16px !important;
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  font-family: inherit !important;
  box-shadow: 0 3px 12px rgba(47, 128, 237, 0.45) !important;
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.loc-label::before { display: none; } /* sin flecha */

/* ---- Panel de administración ---- */
.admin-container {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 14px;
  padding-bottom: 4px;
}
.admin-tabs .tab {
  flex: none;
  width: auto;
  min-height: 0;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.85rem;
  font-weight: 600;
}
.admin-tabs .tab.active { background: var(--accent); color: var(--accent-text); }

.admin-list { display: flex; flex-direction: column; gap: 12px; }
.admin-card { position: relative; }
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.admin-header h3 { font-size: 1rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-date { font-size: 0.75rem; color: var(--text-3); white-space: nowrap; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}
.badge.ok { background: var(--ok-bg); color: var(--ok-text); }
.badge.warn { background: var(--warn-bg); color: var(--warn-text); }
.badge.bad { background: #fee2e2; color: #991b1b; }

.admin-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.admin-actions button {
  flex: 1;
  min-height: 44px;
  padding: 10px;
  font-size: 0.9rem;
}

/* Modal de documentos */
.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal.hidden { display: none !important; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.modal-card {
  position: relative;
  z-index: 1;
  background: var(--surface);
  color: var(--text);
  border-radius: 22px;
  padding: 20px;
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--panel-shadow);
}
.modal-card h3 { margin-bottom: 12px; font-size: 1.15rem; }
.qr-wrap {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px 0;
}
.qr-wrap svg { display: block; }
.modal-card img {
  width: 100%;
  border-radius: 14px;
  margin-top: 6px;
  border: 1px solid var(--border);
}
.modal-card label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
  margin-top: 12px;
}
.doc-grid { display: flex; flex-direction: column; gap: 10px; }

/* Header admin */
header {
  position: static;
  transform: none;
  left: auto;
  border-radius: 0;
  box-shadow: none;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
}
header + .admin-container { margin-top: 0; }
.theme-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  border: none;
  font-size: 1rem;
  cursor: pointer;
}

/* ---- Panel de administración de ESCRITORIO ---- */
.admin-desktop {
  display: block;
  overflow: auto;
  background: var(--bg);
}

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--panel-shadow);
}
.login-card h1 { font-size: 1.4rem; margin-bottom: 24px; }
.login-card h1 .city { color: var(--text-3); font-weight: 500; }

/* App layout */
.admin-app {
  display: flex;
  min-height: 100vh;
}
.admin-sidebar {
  width: 240px;
  flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}
.sidebar-brand {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 28px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand img { width: 32px; height: 32px; border-radius: 9px; }
.sidebar-brand span { color: var(--accent); }

.login-card h1 { display: flex; align-items: center; gap: 10px; }
.login-card h1 img { width: 36px; height: 36px; border-radius: 10px; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.section-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  background: transparent;
  color: var(--text-2);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.section-tab:hover { background: var(--surface-2); }
.section-tab.active { background: var(--accent); color: var(--accent-text); }
.section-tab svg { flex: none; }

.sidebar-footer { margin-top: auto; padding: 0 10px; }

.admin-main {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.page-header h2 { font-size: 1.5rem; font-weight: 700; }
.page-header button { width: auto; padding: 10px 18px; min-height: 0; font-size: 0.9rem; }

/* Stats desktop */
.stats-grid.desktop {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.stats-grid.desktop .stat-card {
  padding: 22px;
  text-align: left;
  border-radius: 18px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-soft);
}
.stats-grid.desktop .stat-value { font-size: 2rem; }
.stats-grid.desktop .stat-label { font-size: 0.8rem; color: var(--text-3); margin-top: 6px; font-weight: 600; }

/* Tablas */
.table-wrap {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  overflow-x: auto;
  box-shadow: var(--shadow-soft);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.admin-table thead {
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.admin-table th, .admin-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.admin-table tbody tr:hover { background: var(--surface-2); }
.admin-table td small { color: var(--text-3); }
.admin-table .empty { text-align: center; color: var(--text-3); padding: 30px; }

.actions { white-space: nowrap; }
button.small {
  width: auto;
  min-height: 0;
  padding: 7px 12px;
  font-size: 0.8rem;
  border-radius: 8px;
  font-weight: 600;
}
button.danger { background: #fee2e2; color: #991b1b; }

/* Tarifa */
.tariff-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  max-width: 480px;
  box-shadow: var(--shadow-soft);
}
.tariff-card .field { margin-bottom: 14px; }
.tariff-card button { width: auto; padding: 12px 24px; }

/* Modal desktop */
.modal-card.wide { max-width: 720px; }
.doc-info {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 24px;
  margin-bottom: 16px;
}
.doc-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.doc-grid img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
}

/* Responsive: en pantallas pequeñas el panel se apila */
@media (max-width: 900px) {
  .admin-app { flex-direction: column; }
  .admin-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    align-items: center;
    padding: 12px;
  }
  .sidebar-brand { margin: 0 12px 0 0; font-size: 1rem; }
  .sidebar-nav { flex-direction: row; gap: 6px; flex: 1; }
  .section-tab { padding: 8px 10px; font-size: 0.8rem; }
  .section-tab svg { display: none; }
  .sidebar-footer { margin: 0; padding: 0; }
  .admin-main { padding: 16px; }
  .stats-grid.desktop { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Marcadores ---- */
.marker-origin {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--blue);
  border: 5px solid #ffffff;
  box-shadow: 0 2px 10px rgba(47, 128, 237, 0.5);
  position: relative;
}
.marker-origin::after {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: rgba(47, 128, 237, 0.22);
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

.marker-dest {
  width: 18px;
  height: 18px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: #101828;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.marker-driver {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #12b76a;
  border: 3.5px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

/* Autos cercanos decorativos (como en la captura de inDrive) */
.car-marker {
  font-size: 24px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
  transform-origin: center;
}

/* ---- Popups y controles del mapa ---- */
.leaflet-popup-content-wrapper {
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  font-family: inherit;
}
.leaflet-popup-tip { background: var(--surface); }
.leaflet-popup-content { font-size: 0.85rem; margin: 10px 14px; }

.leaflet-bar {
  border: none !important;
  box-shadow: var(--shadow-soft) !important;
  border-radius: 14px !important;
  overflow: hidden;
}
.leaflet-bar a {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-bottom: 1px solid var(--border) !important;
}
.leaflet-control-attribution {
  background: transparent !important;
  color: var(--text-3) !important;
  font-size: 9px !important;
}
.leaflet-control-attribution a { color: var(--text-3) !important; }

/* ---- Pantallas grandes ---- */
@media (min-width: 900px) {
  .layout { flex-direction: row; }
  .panel {
    flex: none;
    width: 430px;
    max-height: none;
    border-radius: 0;
    order: -1;
  }
  .panel::before { display: none; }
  .round-btn.mid-right { bottom: 40px; right: 24px; }
}
