:root {
  --black: #000000;
  --near-black: #111111;
  --gray-900: #1a1a1a;
  --gray-800: #242424;
  --gray-700: #333333;
  --gray-600: #545454;
  --gray-500: #6b6b6b;
  --gray-400: #9a9a9a;
  --gray-300: #d5d5d5;
  --gray-200: #e5e5e5;
  --gray-150: #ececec;
  --gray-100: #f0f0f0;
  --gray-50: #f6f6f6;
  --white: #ffffff;

  --green: #06c167;
  --green-dark: #048848;
  --green-tint: #e8faf1;
  --orange: #ff9500;
  --orange-tint: #fff4e0;
  --blue: #276ef1;
  --blue-tint: #eaf1ff;
  --red: #e11900;
  --red-dark: #b91500;
  --red-tint: #fdeceb;
  --whatsapp: #25d366;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 999px;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.10), 0 2px 6px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.35);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--black);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden { display: none !important; }

button, input { font-family: inherit; }

/* ---------- Alertas de operación ---------- */
.operation-alerts-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: var(--radius-full);
  padding: 8px 12px;
  background: rgba(255,255,255,.08);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.operation-alerts-button:hover { background: rgba(255,255,255,.16); }
.operation-alerts-button.has-alerts { border-color: #ff6b5c; color: #ffd8d3; }
.operation-alerts-badge {
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--red);
  color: white;
  font-size: 10px;
}
.operation-alerts-panel {
  position: fixed;
  z-index: 30;
  top: 76px;
  right: 22px;
  width: min(420px, calc(100vw - 28px));
  max-height: calc(100vh - 96px);
  overflow: auto;
  padding: 18px;
  border: 1px solid #f4c4bf;
  border-radius: 18px;
  background: #fffafa;
  box-shadow: 0 18px 45px rgba(8, 22, 24, .22);
}
.operation-alerts-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.operation-alerts-panel-heading span { color: var(--red); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.operation-alerts-panel-heading h2 { margin-top: 3px; color: #081618; font-size: 20px; letter-spacing: -.03em; }
.operation-alerts-panel-heading button { border: 0; background: transparent; color: #6c7775; font-size: 25px; line-height: 1; cursor: pointer; }
.operation-alerts-list { display: grid; gap: 10px; }
.operation-alert-card { padding: 13px; border-left: 4px solid var(--red); border-radius: 10px; background: #fff; box-shadow: var(--shadow-xs); }
.operation-alert-card-title { display: flex; align-items: center; gap: 6px; color: #9b1c13; font-size: 12px; }
.operation-alert-card-title time { margin-left: auto; color: #788783; font-size: 10px; font-weight: 500; }
.operation-alert-card p { margin-top: 8px; color: #253a37; font-size: 13px; line-height: 1.45; }
.operation-alert-card small { display: block; margin-top: 7px; color: #7b8985; font-size: 11px; }
.operation-alert-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.operation-alert-actions button { border: 1px solid #e5b4af; border-radius: 7px; padding: 7px 9px; background: #fff7f6; color: #9b1c13; font-size: 11px; font-weight: 700; cursor: pointer; }
.operation-alert-actions button:hover { background: #fee5e2; }
.operation-alerts-empty { padding: 18px 8px; color: #71807c; font-size: 13px; text-align: center; }
.operation-alert-toast-region { position: fixed; z-index: 40; top: 78px; left: 50%; width: min(440px, calc(100vw - 30px)); transform: translateX(-50%); display: grid; gap: 10px; pointer-events: none; }
.operation-alert-toast { pointer-events: auto; padding: 13px 15px; border: 1px solid #f2aba3; border-left: 5px solid var(--red); border-radius: 12px; background: #fff7f6; color: #351311; box-shadow: var(--shadow-md); animation: operationAlertIn .22s ease-out; cursor: pointer; }
.operation-alert-toast > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #9b1c13; font-size: 13px; }
.operation-alert-toast > div button { border: 0; background: transparent; color: #9b1c13; font-size: 20px; cursor: pointer; }
.operation-alert-toast p { margin-top: 7px; font-size: 12px; line-height: 1.4; }
@keyframes operationAlertIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.driver-connection-box { margin: 14px 0; padding: 13px; border: 1px solid #d7e2dc; border-radius: 12px; background: #f8fbf9; }
.driver-connection-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.driver-connection-heading b { display: block; color: #081618; font-size: 13px; }
.driver-connection-heading small { display: block; margin-top: 4px; color: #70817c; font-size: 11px; }
.connection-state { border-radius: 999px; padding: 4px 7px; font-size: 10px; font-weight: 800; }
.connection-state.online { background: #dff7e9; color: #08783e; }
.connection-state.offline { background: #edf1ef; color: #667572; }
.connection-note { display: block; margin-top: 8px; color: #72817d; font-size: 11px; line-height: 1.4; }

/* Scrollbars: delgados, discretos */
.sidebar::-webkit-scrollbar,
.drivers-admin-view::-webkit-scrollbar,
.driver-list::-webkit-scrollbar {
  width: 8px;
}
.sidebar::-webkit-scrollbar-thumb,
.drivers-admin-view::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: var(--radius-full);
}
.sidebar::-webkit-scrollbar-track,
.drivers-admin-view::-webkit-scrollbar-track { background: transparent; }

/* ---------- Marca ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-home { padding: 0; border: 0; background: transparent; cursor: pointer; text-align: left; }
.brand-home:focus-visible { outline: 2px solid var(--white); outline-offset: 5px; border-radius: var(--radius-sm); }

.brand-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
  background: var(--black);
  color: var(--white);
}

.brand-text {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
  color: var(--black);
}

.brand-text small {
  display: block;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--gray-500);
}

/* ---------- Login ---------- */
.login-screen {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 15% 15%, rgba(255, 255, 255, 0.06), transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(255, 255, 255, 0.05), transparent 45%),
    var(--black);
  padding: 20px;
}

.login-card {
  background: var(--white);
  padding: 40px 36px 32px;
  border-radius: var(--radius-lg);
  width: 360px;
  max-width: 100%;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-card .brand { margin-bottom: 6px; }

.login-card h1 {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.login-card .subtitle { color: var(--gray-500); font-size: 13.5px; margin-bottom: 4px; line-height: 1.4; }

.login-card input {
  padding: 13px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-card input:focus {
  outline: none;
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.login-card input::placeholder { color: var(--gray-400); }

.login-card button {
  padding: 13px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--black);
  color: var(--white);
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

.login-card button:hover { background: var(--gray-800); }
.login-card button:active { transform: scale(0.99); }

.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 2px;
  background: var(--gray-100);
  padding: 4px;
  border-radius: var(--radius-sm);
}

.login-card .auth-tab {
  flex: 1;
  padding: 9px;
  background: transparent;
  color: var(--gray-600);
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.login-card .auth-tab:hover { color: var(--black); }

.login-card .auth-tab.active {
  background: var(--white);
  color: var(--black);
  box-shadow: var(--shadow-xs);
}

.login-card .auth-tab.active:hover { background: var(--white); }

.login-error { color: var(--red); font-size: 13px; min-height: 16px; font-weight: 500; }

/* ---------- App shell ---------- */
.app { height: 100vh; display: flex; flex-direction: column; }

.topbar {
  height: 64px;
  background: var(--black);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  flex-shrink: 0;
}

.topbar .brand-icon { background: var(--white); color: var(--black); }
.topbar .brand-text { color: var(--white); }

.topbar h1 { display: none; } /* la marca reemplaza el titulo textual */

.top-nav {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px;
  border-radius: var(--radius-full);
}

.nav-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nav-tab:hover { color: var(--white); }

.nav-tab.active { background: var(--white); color: var(--black); }

.pending-badge {
  background: var(--red);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

.topbar-right { display: flex; align-items: center; gap: 16px; }

.badge {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 600;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(6, 193, 103, 0.6);
  animation: live-pulse 1.6s ease-in-out infinite;
}

@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(6, 193, 103, 0.55); opacity: 1; }
  70% { box-shadow: 0 0 0 6px rgba(6, 193, 103, 0); opacity: 0.6; }
  100% { box-shadow: 0 0 0 0 rgba(6, 193, 103, 0); opacity: 1; }
}

.logout-btn {
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  color: var(--white);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
}

.logout-btn:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.4); }

.layout { flex: 1; display: flex; overflow: hidden; }

.sidebar {
  width: 320px;
  background: var(--white);
  border-right: 1px solid var(--gray-150);
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;
  flex-shrink: 0;
}

#search-input {
  padding: 11px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 12px;
  background: var(--gray-50);
  transition: border-color 0.15s, background 0.15s;
}

#search-input:focus {
  outline: none;
  border-color: var(--black);
  background: var(--white);
}

.status-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.filter-pill {
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-600);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}

.filter-pill:hover { border-color: var(--gray-400); color: var(--black); }

.filter-pill.active {
  background: var(--black);
  border-color: var(--black);
  color: var(--white);
}

.driver-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }

.empty-list { font-size: 13px; color: var(--gray-500); padding: 20px 4px; text-align: center; }

.driver-card {
  border: 1.5px solid var(--gray-150);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
  background: var(--white);
}

.driver-card:hover { box-shadow: var(--shadow-xs); }

.driver-card.expanded { border-color: var(--black); box-shadow: var(--shadow-sm); }

.driver-card-header {
  padding: 12px 14px;
  cursor: pointer;
  transition: background .15s;
}

.driver-card-header:hover { background: var(--gray-50); }

.driver-card .name { font-weight: 700; font-size: 14px; display: flex; align-items: center; letter-spacing: -0.01em; }
.driver-card .meta { font-size: 12px; color: var(--gray-500); margin-top: 3px; margin-left: 17px; }

.driver-card .status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 9px;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}

.status-dot.state-available, .legend-dot.state-available { background: var(--green); }
.status-dot.state-to_pickup, .legend-dot.state-to_pickup { background: var(--orange); }
.status-dot.state-on_trip, .legend-dot.state-on_trip { background: var(--blue); }
.status-dot.state-offline, .legend-dot.state-offline { background: var(--gray-400); }
.status-dot.is-stale { opacity: 0.5; }

.detail-section {
  padding: 12px 14px;
  border-top: 1px solid var(--gray-100);
  font-size: 13px;
}

.detail-section .row { margin: 4px 0; color: var(--gray-700); }
.detail-section .row b { color: var(--black); font-weight: 600; }

.trip-section h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--blue);
  margin-bottom: 8px;
}

.map-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

#map { flex: 1; }

.mapbox-domain-marker {
  cursor: pointer;
  display: block;
  transform: translateZ(0);
  will-change: transform, opacity;
}

.map-fallback {
  height: 100%;
  min-height: 320px;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #4b5563;
  text-align: center;
  background: #eef2f1;
}

.map-legend {
  flex-shrink: 0;
  height: 42px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  background: var(--white);
  border-top: 1px solid var(--gray-150);
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-700);
}

.legend-title { color: var(--gray-900); font-weight: 700; }
.legend-item { display: flex; align-items: center; gap: 7px; white-space: nowrap; }

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.contact-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.call-btn,
.whatsapp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 9px 14px;
  color: var(--white);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  transition: filter 0.15s;
}

.call-btn:hover, .whatsapp-btn:hover { filter: brightness(0.92); }

.call-btn { background: var(--green); }

.cancel-trip-btn {
  width: 100%;
  margin-top: 12px;
  padding: 9px 12px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  color: var(--red);
  background: var(--red-tint);
  transition: background 0.15s;
}
.cancel-trip-btn:hover { background: #fbdad7; }

.whatsapp-btn { background: var(--whatsapp); }

/* ---------- Conductores (admin) ---------- */
.drivers-admin-view {
  flex: 1;
  overflow-y: auto;
  padding: 26px 28px;
  background: var(--gray-50);
}

.drivers-admin-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.drivers-admin-toolbar .filter-pill { cursor: pointer; }

.drivers-admin-empty {
  font-size: 14px;
  color: var(--gray-500);
  padding: 60px 0;
  text-align: center;
}

.driver-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 16px;
}

.driver-admin-card {
  background: #ffffff;
  border: 2px solid #d8dde5;
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: 0 3px 10px rgba(16, 24, 40, 0.08);
  overflow: hidden;
  transition: box-shadow .15s, border-color .15s;
}

.driver-admin-card:hover { box-shadow: 0 8px 20px rgba(16, 24, 40, 0.13); border-color: var(--black); }

.driver-admin-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.driver-admin-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--gray-150);
  flex-shrink: 0;
  border: 1px solid var(--gray-200);
}

.driver-admin-name { font-weight: 700; font-size: 14.5px; letter-spacing: -0.01em; }
.driver-admin-meta { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

.status-badge {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 800;
  padding: 5px 11px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.status-badge.pending_review { background: var(--orange-tint); color: #8a5300; }
.status-badge.approved { background: var(--green-tint); color: #04703f; }
.status-badge.rejected { background: var(--red-tint); color: #a3150a; }

.driver-admin-card .detail-section { padding: 10px 0; border-top: 1px solid var(--gray-100); }

.rejection-note {
  background: var(--red-tint);
  border: 1px solid #f6c4bd;
  color: #a3150a;
  font-size: 12.5px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  margin: 8px 0;
  font-weight: 500;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 12px 0;
}

.doc-item { text-align: center; }

.doc-thumb {
  width: 100%;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
  cursor: pointer;
  transition: opacity 0.15s;
}
.doc-thumb:hover { opacity: 0.85; }

.doc-pdf-link {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 64px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
  color: var(--blue);
  text-decoration: none;
  font-size: 20px;
}

.doc-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 64px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--gray-300);
  color: var(--gray-300);
  font-size: 18px;
}

.doc-label { font-size: 10.5px; color: var(--gray-500); margin-top: 5px; font-weight: 500; }

.driver-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.assign-place-select { flex: 1 1 180px; min-width: 0; padding: 8px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); }
.delete-driver-btn { flex: 1 1 145px; border: 1px solid var(--red); border-radius: var(--radius-sm); background: var(--white); color: var(--red); padding: 8px 10px; font-weight: 700; cursor: pointer; }
.delete-driver-btn:hover { background: var(--red-tint); }
.map-place-assignment { display: flex; gap: 8px; margin: 12px 0 0; }
.map-place-assignment select { flex: 1; min-width: 0; padding: 9px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); }
.map-place-assignment button { border: 0; border-radius: var(--radius-sm); padding: 9px 11px; background: var(--black); color: var(--white); font-weight: 700; cursor: pointer; }

.approve-btn, .reject-btn {
  flex: 1;
  padding: 9px 12px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  color: var(--white);
  transition: filter 0.15s;
}

.approve-btn:hover, .reject-btn:hover { filter: brightness(0.92); }

.approve-btn { background: var(--green); }
.reject-btn { background: var(--red); }

.view-file-btn {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--gray-700);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.view-file-btn:hover { background: var(--gray-50); border-color: var(--gray-300); }
.view-file-btn:disabled { opacity: 0.6; cursor: wait; }

.reject-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.reject-fields {
  padding: 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
  font-size: 13px;
}

.reject-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  margin-top: 8px;
}

.reject-fields-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gray-700);
  font-weight: 600;
}

.reject-fields-grid input[type="checkbox"] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
}

.reject-form input {
  flex: 1;
  padding: 9px 11px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.reject-form input:focus {
  outline: none;
  border-color: var(--black);
}

/* ---------- Configuracion ---------- */
.settings-view {
  flex: 1;
  overflow-y: auto;
  padding: 26px 28px;
  background: var(--gray-50);
}

.settings-card {
  background: var(--white);
  border: 1.5px solid var(--gray-150);
  border-radius: var(--radius-lg);
  padding: 22px;
  max-width: 420px;
}

.settings-home-heading { margin: 4px 0 20px; }
.settings-home-heading h2 { margin: 0; font-size: 20px; letter-spacing: -0.02em; }
.settings-home-heading p { margin: 6px 0 0; color: var(--gray-500); font-size: 14px; }

.settings-shortcuts,
.settings-home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 16px;
  max-width: 1160px;
}
.settings-shortcuts { margin-bottom: 16px; }
.settings-shortcuts .settings-section-link {
  min-height: 112px;
  margin: 0;
  padding: 20px;
  background: var(--white);
  border-radius: var(--radius-lg);
}
.settings-home-grid .settings-card { max-width: none; margin: 0; }

.dashboard-users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 16px;
  max-width: 1160px;
}
.dashboard-users-grid .settings-card { max-width: none; margin: 0; }

.dashboard-users-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 4px 0 16px;
}
.dashboard-users-toolbar > div { flex: 1; }
.dashboard-users-toolbar h2 { margin: 0; font-size: 20px; letter-spacing: -0.02em; }
.dashboard-users-toolbar p { margin: 4px 0 0; color: var(--gray-500); font-size: 13px; }
.dashboard-add-user-btn {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  background: var(--black);
  color: var(--white);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.dashboard-add-user-btn:hover { background: var(--gray-800); }
.dashboard-create-panel { max-width: 520px; margin-bottom: 16px; }
.dashboard-user-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.38);
}
.dashboard-user-modal-card {
  position: relative;
  width: min(100%, 580px);
  padding: 30px 36px;
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.24);
}
.dashboard-user-modal-card h3 { margin: 0 0 22px; font-size: 21px; }
.dashboard-user-modal-card .app-branding-form { gap: 14px; }
.dashboard-user-modal-card label { display: grid; gap: 7px; font-size: 14px; font-weight: 700; }
.dashboard-user-modal-card input,
.dashboard-user-modal-card select { width: 100%; box-sizing: border-box; padding: 12px 14px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font: inherit; }
.dashboard-user-modal-card .app-branding-form button[type="submit"] { align-self: flex-end; min-width: 90px; }
.dashboard-modal-close { position: absolute; top: 16px; right: 18px; border: 0; background: none; color: var(--gray-500); font-size: 29px; line-height: 1; cursor: pointer; }
.dashboard-modal-close:hover { color: var(--black); }
.dashboard-users-table-wrap {
  max-width: 1160px;
  overflow-x: auto;
  border: 1.5px solid var(--gray-150);
  border-radius: var(--radius-lg);
  background: var(--white);
}
.dashboard-users-table { width: 100%; min-width: 840px; border-collapse: collapse; }
.dashboard-users-table th, .dashboard-users-table td { padding: 15px 18px; border-bottom: 1px solid var(--gray-150); text-align: left; font-size: 13px; }
.dashboard-users-table th { color: var(--gray-500); font-weight: 700; background: var(--gray-50); }
.dashboard-users-table tr:last-child td { border-bottom: 0; }
.dashboard-users-table td small { color: var(--gray-500); }
.dashboard-role-select, .dashboard-role-static { min-width: 126px; padding: 8px 10px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); background: var(--white); font: inherit; }
.dashboard-role-static { display: inline-block; color: var(--gray-500); background: var(--gray-50); }
.dashboard-status { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.dashboard-status.active { background: #e8f8ee; color: var(--green-dark); }
.dashboard-status.inactive { background: var(--gray-100); color: var(--gray-500); }
.dashboard-user-actions { white-space: nowrap; }
.dashboard-table-action { padding: 3px 5px; border: 0; background: none; color: var(--gray-600); font: inherit; font-weight: 600; cursor: pointer; }
.dashboard-table-action:hover { color: var(--black); text-decoration: underline; }
.dashboard-table-action.danger { color: var(--red); }
.dashboard-empty-row { padding: 28px !important; text-align: center !important; color: var(--gray-500); }
.hidden { display: none; }

.settings-card h3 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.settings-hint {
  font-size: 12.5px;
  color: var(--gray-500);
  line-height: 1.5;
  margin-bottom: 16px;
}

.settings-field-label {
  display: block;
  margin: 14px 0 7px;
  font-size: 13px;
  font-weight: 700;
}

.settings-form {
  display: flex;
  gap: 8px;
}

.settings-form input {
  flex: 1;
  padding: 11px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  background: var(--gray-50);
  transition: border-color 0.15s, background 0.15s;
}

.settings-form input:focus {
  outline: none;
  border-color: var(--black);
  background: var(--white);
}

.settings-form button {
  padding: 11px 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--black);
  color: var(--white);
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s;
}

.settings-form button:hover { background: var(--gray-800); }

.settings-feedback {
  margin-top: 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--gray-500);
  min-height: 16px;
}

.settings-feedback.success { color: var(--green-dark); }
.settings-feedback.error { color: var(--red); }

.settings-card + .settings-card { margin-top: 20px; }
.settings-home-grid .settings-card + .settings-card { margin-top: 0; }

.settings-section-link {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
  color: var(--black);
  text-align: left;
  cursor: pointer;
}

.settings-section-link:hover { border-color: var(--black); background: var(--white); }
.settings-section-link + .settings-section-link { margin-top: 8px; }
.settings-section-link b, .settings-section-link small { display: block; }
.settings-section-link b { font-size: 13.5px; }
.settings-section-link small { margin-top: 3px; color: var(--gray-500); font-size: 12px; }
.settings-section-link > span:last-child { font-size: 24px; line-height: 1; }

@media (max-width: 620px) {
  .settings-shortcuts, .settings-home-grid, .dashboard-users-grid { grid-template-columns: 1fr; }
  .settings-card { padding: 20px; }
  .dashboard-users-toolbar { align-items: flex-start; flex-direction: column; }
}

.settings-back {
  margin-bottom: 14px;
  padding: 0;
  border: none;
  background: none;
  color: var(--black);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.settings-back:hover { text-decoration: underline; }

.apps-settings-card { max-width: none; width: min(100%, 1180px); }

.apps-branding-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.apps-branding-grid .app-branding-block {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--gray-150);
  border-radius: var(--radius-md);
  background: var(--gray-50);
}

@media (max-width: 760px) {
  .apps-branding-grid { grid-template-columns: 1fr; }
}

.app-branding-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 13.5px;
}

.app-branding-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--black);
}

.app-branding-icon-placeholder {
  display: grid;
  place-items: center;
  color: var(--white);
  font-size: 21px;
}

.app-branding-form {
  display: grid;
  gap: 7px;
}

.app-branding-form label {
  margin-top: 4px;
  font-size: 12.5px;
  font-weight: 700;
}

.app-branding-form input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
  font: inherit;
  font-size: 13.5px;
}

.app-branding-form input:focus { outline: none; border-color: var(--black); background: var(--white); }

.app-branding-form button {
  justify-self: start;
  margin-top: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--black);
  color: var(--white);
  font-weight: 700;
  cursor: pointer;
}

.build-branded-app-btn {
  margin-top: 12px;
  padding: 10px 16px;
  border: 1.5px solid var(--black);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--black);
  font-weight: 700;
  cursor: pointer;
}

.build-branded-app-btn:hover { background: var(--gray-100); }

.app-download-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  padding: 13px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: var(--gray-50);
}

.app-download-card div { display: grid; gap: 3px; }
.app-download-card small { color: var(--gray-500); font-size: 12px; }
.app-download-btn,
.app-download-disabled {
  flex-shrink: 0;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 700;
}
.app-download-btn {
  background: var(--black);
  color: var(--white);
  text-decoration: none;
  transition: transform 160ms ease-out;
}
.app-download-btn:active { transform: scale(0.97); }
.app-download-disabled { color: var(--gray-400); background: var(--gray-200); }

.settings-divider {
  border: none;
  border-top: 1px solid var(--gray-150);
  margin: 18px 0;
}

.place-list {
  list-style: none;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-150);
}
.place-settings-card { max-width: none; width: min(100%, 1100px); }

.place-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  font-size: 13.5px;
}

.place-row + .place-row { border-top: 1px solid var(--gray-100); }

.place-address { font-size: 12px; color: var(--gray-500); }

.place-delete-btn {
  background: none;
  border: none;
  color: var(--red);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  flex-shrink: 0;
}

.place-delete-btn:hover { text-decoration: underline; }

.update-app-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13.5px;
}
.updates-page { max-width: 1100px; }
.updates-heading { margin-bottom: 16px; }
.updates-heading h3 { margin: 0 0 8px; font-size: 20px; }
.updates-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.update-app-block { min-height: 250px; padding: 22px; border: 1.5px solid var(--gray-150); border-radius: var(--radius-lg); background: var(--white); }
.update-app-block .build-branded-app-btn { margin-top: 4px; }
.manual-update-form { display: grid; grid-template-columns: 1fr 130px auto; gap: 8px; align-items: center; }
.manual-update-form input { min-width: 0; box-sizing: border-box; padding: 10px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); background: var(--gray-50); font: inherit; }
.manual-update-form button { padding: 11px 14px; border: 0; border-radius: var(--radius-sm); background: var(--black); color: var(--white); font-weight: 700; cursor: pointer; }
.update-or { margin: 12px 0; color: var(--gray-500); font-size: 12px; text-align: center; }
@media (max-width: 620px) { .manual-update-form { grid-template-columns: 1fr; } }

.update-current-build { color: var(--gray-500); font-size: 12px; }

.update-form input[type='file'] {
  flex: 1;
  padding: 9px 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  background: var(--gray-50);
}

.update-build-input { flex: 0 0 120px !important; }

/* Emil design refresh: visual polish only, behavior and selectors unchanged. */
:root {
  --surface: #f4f5f7;
  --surface-raised: rgba(255, 255, 255, 0.94);
  --ink: #111214;
  --muted-ink: #68707c;
  --line: #e3e6eb;
  --shadow-soft: 0 18px 50px rgba(21, 24, 32, 0.08);
  --shadow-card: 0 8px 24px rgba(21, 24, 32, 0.06);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
}

html { background: var(--surface); }
body {
  background: radial-gradient(circle at 88% -10%, #ffffff 0, var(--surface) 42%, #eef0f3 100%);
  color: var(--ink);
  letter-spacing: -0.01em;
}

button, a, .nav-tab, .filter-pill, .driver-card, .settings-section-link,
.settings-shortcut, .app-download-card, .place-row { transition: transform 180ms var(--ease-out), background-color 180ms var(--ease-out), border-color 180ms var(--ease-out), box-shadow 180ms var(--ease-out), color 180ms var(--ease-out); }
button:active, .nav-tab:active, .filter-pill:active, .settings-shortcut:active { transform: scale(.975); }

.login-shell { background: radial-gradient(circle at 50% 0, #32353c, #101113 65%); }
.login-card {
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 28px;
  box-shadow: 0 30px 90px rgba(0,0,0,.34);
  backdrop-filter: blur(18px);
}
.login-card input:focus { border-color: #111214; box-shadow: 0 0 0 4px rgba(17,18,20,.08); }

.topbar {
  height: 72px;
  padding: 0 26px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 8px 25px rgba(0,0,0,.12);
}
.brand-mark { border-radius: 12px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.22); }
.top-nav { padding: 5px; border: 1px solid rgba(255,255,255,.12); border-radius: 18px; background: rgba(255,255,255,.08); }
.nav-tab { border-radius: 13px; color: #aeb4bd; }
.nav-tab:hover { color: #fff; background: rgba(255,255,255,.1); }
.nav-tab.active { box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.logout-btn { border-color: rgba(255,255,255,.3); border-radius: 13px; }
.logout-btn:hover { border-color: #fff; background: rgba(255,255,255,.1); }

.layout { gap: 14px; padding: 14px; background: var(--surface); }
.sidebar {
  width: 334px;
  padding: 18px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-card);
}
#search-input { border: 1px solid var(--line); border-radius: 14px; background: #f8f9fa; }
#search-input:focus { border-color: #9ba3af; box-shadow: 0 0 0 4px rgba(80,90,105,.1); }
.status-filters { gap: 7px; margin: 14px 2px 17px; }
.filter-pill { border-color: var(--line); border-radius: 999px; background: #fff; }
.filter-pill:hover { border-color: #afb6c0; background: #f6f7f8; }
.filter-pill.active { box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.driver-list { gap: 10px; }
.driver-card { border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 2px 5px rgba(21,24,32,.02); }
.driver-card:hover { border-color: #b8bec8; box-shadow: 0 10px 24px rgba(21,24,32,.08); transform: translateY(-2px); }
.driver-card.selected { border-color: #8d96a3; box-shadow: 0 0 0 3px rgba(17,18,20,.07), 0 10px 24px rgba(21,24,32,.08); }
.map-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-soft); }
#map { min-height: 520px; }
.map-fullscreen-btn, .map-center-btn { position: absolute; z-index: 5; right: 14px; width: 42px; height: 42px; border: 1px solid rgba(210,216,224,.9); border-radius: 10px; background: rgba(255,255,255,.94); color: var(--ink); box-shadow: 0 5px 16px rgba(21,24,32,.14); line-height: 1; cursor: pointer; }
.map-fullscreen-btn { top: 14px; font-size: 24px; }
.map-center-btn { top: 64px; font-size: 25px; }
.map-fullscreen-btn:hover, .map-center-btn:hover { background: #fff; box-shadow: 0 8px 22px rgba(21,24,32,.2); transform: translateY(-1px); }
#map-view:fullscreen, #map-view.map-fullscreen-fallback { display: grid; grid-template-columns: minmax(280px, 334px) minmax(0, 1fr); width: 100vw; height: 100vh; box-sizing: border-box; padding: 14px; gap: 14px; background: var(--surface); }
#map-view:fullscreen .sidebar, #map-view.map-fullscreen-fallback .sidebar { width: auto; min-height: 0; }
#map-view:fullscreen .map-panel, #map-view.map-fullscreen-fallback .map-panel { min-height: 0; }
#map-view:fullscreen #map, #map-view.map-fullscreen-fallback #map { min-height: 0; height: 100%; }
#map-view:fullscreen .map-legend, #map-view.map-fullscreen-fallback .map-legend { bottom: 18px; }
.map-legend { right: 18px; bottom: 18px; padding: 10px 14px; border: 1px solid rgba(255,255,255,.75); border-radius: 14px; background: rgba(255,255,255,.9); box-shadow: 0 8px 24px rgba(0,0,0,.12); backdrop-filter: blur(12px); }

.drivers-admin-view, .settings-view { padding: 30px clamp(18px, 4vw, 56px) 52px; }
.drivers-admin-view > h2, .settings-view > h2 { letter-spacing: -.035em; font-size: clamp(26px, 3vw, 38px); }
.driver-admin-card, .settings-card, .settings-shortcut, .update-app-block { border: 1px solid var(--line); border-radius: 20px; background: var(--surface-raised); box-shadow: var(--shadow-card); }
.driver-admin-card:hover, .settings-shortcut:hover, .update-app-block:hover { border-color: #c4c9d1; box-shadow: var(--shadow-soft); transform: translateY(-2px); }
.settings-shortcuts { gap: 14px; }
.settings-section-link { border-radius: 15px; }
.settings-section-link:hover { background: #f2f4f6; }
.settings-card { padding: clamp(20px, 3vw, 30px); }
.settings-card h3 { letter-spacing: -.025em; }
.settings-card input, .settings-card select, .manual-update-form input, .update-form input[type='file'] { border-color: var(--line); border-radius: 12px; background: #fafbfc; }
.settings-card input:focus, .settings-card select:focus, .manual-update-form input:focus { border-color: #8d96a3; box-shadow: 0 0 0 4px rgba(80,90,105,.1); outline: none; }
.primary-btn, .build-branded-app-btn, .manual-update-form button, .app-download-btn { border-radius: 12px; box-shadow: 0 5px 12px rgba(0,0,0,.12); }
.primary-btn:hover, .build-branded-app-btn:hover, .manual-update-form button:hover, .app-download-btn:hover { box-shadow: 0 8px 18px rgba(0,0,0,.18); transform: translateY(-1px); }
.users-table-wrap { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; }
.users-table th { background: #f4f5f7; color: var(--muted-ink); }
.apps-branding-grid { gap: 20px; }
.apps-branding-grid .app-branding-block { border-color: var(--line); border-radius: 18px; background: #fafbfc; }
.app-download-card { border-color: var(--line); border-radius: 14px; background: #fff; }
.app-download-card:hover { border-color: #adb5c0; box-shadow: 0 8px 20px rgba(21,24,32,.08); }

@media (max-width: 900px) {
  .topbar { padding: 0 14px; }
  .top-nav { overflow-x: auto; max-width: 48vw; }
  .layout { padding: 10px; }
  .sidebar { width: 294px; }
}
@media (max-width: 680px) {
  .topbar { height: auto; min-height: 68px; flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .top-nav { order: 3; width: 100%; max-width: none; justify-content: center; }
  .topbar-right { margin-left: auto; }
  .layout { display: block; }
  .sidebar { width: auto; margin-bottom: 10px; }
  .map-panel { min-height: 440px; }
  #map { min-height: 440px; }
  .map-legend { left: 12px; right: 12px; justify-content: center; overflow-x: auto; }
  .apps-branding-grid { grid-template-columns: 1fr; }
}

/* Conductores > Asistencia */
.attendance-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 24px 0 16px;
}
.attendance-heading h3 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.03em; }
.attendance-heading p { margin: 0; color: var(--muted-ink); font-size: 14px; }
.attendance-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.attendance-date-picker { position: relative; }
.attendance-date-toggle { display: inline-flex; align-items: center; gap: 9px; min-width: 205px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; text-align: left; }
.attendance-date-toggle:hover { border-color: #adb5c0; background: #f8f9fa; }
.attendance-date-popover { position: absolute; z-index: 20; top: calc(100% + 8px); right: 0; display: flex; gap: 18px; min-width: 650px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 18px 45px rgba(21,24,32,.16); }
.attendance-presets { display: grid; align-content: start; gap: 3px; min-width: 118px; }
.attendance-presets button { padding: 8px 9px; border: 0; border-radius: 7px; background: transparent; color: var(--muted-ink); font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.attendance-presets button:hover { background: #eef1f4; color: var(--ink); }
.attendance-range-fields { display: flex; align-items: end; gap: 7px; }
.attendance-range-fields > span { padding-bottom: 10px; color: var(--muted-ink); font-size: 12px; }
.attendance-calendar { min-width: 470px; }
.attendance-calendar-toolbar { display: grid; grid-template-columns: 28px 1fr 1fr 28px; align-items: center; gap: 8px; margin-bottom: 12px; color: var(--muted-ink); text-align: center; }
.attendance-calendar-toolbar strong { font-size: 13px; text-transform: capitalize; }
.attendance-calendar-toolbar button { width: 28px; height: 28px; border: 0; border-radius: 50%; background: #f0f3f6; color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer; }
.attendance-calendar-toolbar button:hover { background: #e2e7ec; }
.attendance-calendar-months { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.attendance-month h4 { margin: 0 0 7px; color: var(--muted-ink); font-size: 12px; text-align: center; text-transform: capitalize; }
.attendance-calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.attendance-weekday { padding: 3px 0; color: #9aa2ad; font-size: 10px; font-weight: 700; text-align: center; text-transform: uppercase; }
.attendance-day { min-height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--ink); font-size: 12px; cursor: pointer; }
.attendance-day:hover { background: #e8edf2; }
.attendance-day.empty { pointer-events: none; }
.attendance-day.between { border-radius: 0; background: #e9edf3; }
.attendance-day.preview { border-radius: 0; background: #e9edf3; }
.attendance-day.selected { background: #5b6fc4; color: #fff; font-weight: 800; }
.history-search-row { display: flex; align-items: center; gap: 10px; margin: 20px 0 12px; }
.history-search-row label { color: var(--muted-ink); font-size: 12px; font-weight: 700; }
.history-search-row input { width: min(100%, 340px); padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; background: #fff; font: inherit; }
.history-search-row input:focus { border-color: #8d96a3; box-shadow: 0 0 0 3px rgba(80,90,105,.1); outline: none; }
.trip-history-report-card { max-width: 1160px; margin: 20px 0 16px; padding: 22px; border: 1.5px solid #dfe9e3; border-radius: 18px; background: #fff; box-shadow: 0 10px 28px rgba(8, 22, 24, .05); }
.trip-history-report-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.trip-history-report-heading h3 { margin: 4px 0 5px; color: #081618; font-size: 21px; letter-spacing: -.025em; }
.trip-history-report-heading p { margin: 0; color: #6b8078; font-size: 13px; }
.trip-history-total { padding: 8px 12px; border-radius: 999px; background: #edf6f1; color: #00874a; font-weight: 800; white-space: nowrap; }
.trip-history-report-controls { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.trip-history-report-controls label { display: grid; gap: 7px; min-width: 220px; color: #526861; font-size: 12px; font-weight: 800; }
.trip-history-date-field { display: grid; gap: 7px; min-width: 260px; color: #526861; font-size: 12px; font-weight: 800; }
.trip-history-date-field .attendance-date-picker { width: 100%; }
.trip-history-date-field .attendance-date-toggle { width: 100%; min-width: 260px; box-sizing: border-box; }
.trip-history-date-field .attendance-date-popover { left: 0; right: auto; min-width: min(650px, calc(100vw - 42px)); }
.trip-history-report-controls select, .trip-history-report-controls input { min-height: 42px; box-sizing: border-box; padding: 0 12px; border: 1px solid #cddbd3; border-radius: 11px; background: #fbfdfc; color: #081618; font: inherit; }
.trip-history-report-controls select:focus, .trip-history-report-controls input:focus { outline: none; border-color: #00874a; box-shadow: 0 0 0 3px rgba(0, 135, 74, .12); }
.trip-history-pdf-btn { min-height: 42px; padding: 0 17px; border: 0; border-radius: 11px; background: #081618; color: #fff; font-weight: 800; cursor: pointer; }
.trip-history-pdf-btn:hover { background: #173e3e; }
.trip-history-pdf-btn:disabled { opacity: .45; cursor: not-allowed; }
.trip-history-table { min-width: 1120px; }
.trip-history-table td { vertical-align: middle; }
.trip-history-table td small { display: block; margin-top: 4px; color: #6b8078; font-size: 11px; }
.trip-history-status { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.trip-history-status.completed { background: #e8f8ef; color: #00874a; }
.trip-history-status.cancelled { background: #fff0ef; color: #b84b44; }
.trip-history-map-link { display: inline-flex; width: 84px; height: 48px; overflow: hidden; border: 1px solid #d7e4dc; border-radius: 8px; background: #eef4f0; }
.trip-history-map-link img { width: 100%; height: 100%; object-fit: cover; }
.trip-history-map-pending { color: #80918b; font-size: 11px; white-space: nowrap; }
.dashboard-users-table td small { display: block; margin-top: 3px; color: var(--muted-ink); font-size: 11px; }

/* Tipografía dashboard ampliada para lectura cómoda. */
body { font-size: 15px; }
.brand-name { font-size: 21px; }
.nav-tab { font-size: 15px; }
.topbar-right { font-size: 15px; }
#search-input { font-size: 15px; }
.filter-pill { font-size: 14px; }
.driver-card .name { font-size: 15px; }
.driver-card .meta { font-size: 13px; }
.driver-card .detail { font-size: 14px; }
.map-legend { font-size: 14px; }
.drivers-admin-toolbar .filter-pill { font-size: 14px; }
.driver-admin-name { font-size: 16px; }
.driver-admin-meta { font-size: 13px; }
.driver-admin-card .row { font-size: 14px; }
.settings-view, .drivers-admin-view { font-size: 15px; }
.settings-section-link { font-size: 15px; }
.settings-card input, .settings-card select, .settings-card button { font-size: 14px; }
.dashboard-users-table th, .dashboard-users-table td { font-size: 14px; }
.dashboard-users-table td small { font-size: 12px; }
.attendance-heading p { font-size: 15px; }
.attendance-table td { font-size: 14px; }
.attendance-controls input, .attendance-date-toggle, .attendance-clear-btn { font-size: 14px; }
.history-search-row input { font-size: 15px; }
.history-search-row label, .attendance-search-label { font-size: 13px; }
.attendance-controls label { display: grid; gap: 5px; color: var(--muted-ink); font-size: 11px; font-weight: 700; }
.attendance-search-label { flex: 0 0 340px; }
.attendance-search-label input { width: 100%; box-sizing: border-box; }
.attendance-controls input { min-width: 136px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font: inherit; }
.attendance-controls input:focus { border-color: #8d96a3; box-shadow: 0 0 0 3px rgba(80,90,105,.1); outline: none; }
.attendance-range-separator { padding-bottom: 10px; color: var(--muted-ink); font-size: 12px; }
.attendance-clear-btn { padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--muted-ink); font-size: 12px; font-weight: 700; cursor: pointer; }
.attendance-clear-btn:hover { border-color: #adb5c0; background: #f4f5f7; color: var(--ink); }
.attendance-count {
  flex-shrink: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted-ink);
  font-size: 12px;
  font-weight: 700;
}
.attendance-table-wrap { overflow-x: auto; }
.attendance-table { min-width: 760px; }
.attendance-table td:first-child { min-width: 150px; }
.attendance-table td:first-child strong,
.attendance-table td:first-child small { display: block; }
.attendance-table td:first-child small { margin-top: 3px; color: var(--muted-ink); font-size: 11px; }
.attendance-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}
.attendance-status::before { width: 7px; height: 7px; border-radius: 50%; content: ''; }
.attendance-status.active { color: #087443; }
.attendance-status.active::before { background: #12a86b; box-shadow: 0 0 0 4px rgba(18,168,107,.12); }
.attendance-status.closed { color: var(--muted-ink); }
.attendance-status.closed::before { background: #9ba2ac; }
@media (max-width: 680px) {
  .attendance-heading { align-items: flex-start; flex-direction: column; }
  .attendance-date-popover { left: 0; right: auto; min-width: min(390px, calc(100vw - 42px)); flex-direction: column; }
  .attendance-calendar { min-width: 0; }
  .attendance-calendar-months { gap: 8px; }
  .attendance-calendar-months .attendance-month:nth-child(2) { display: none; }
  .attendance-range-fields { justify-content: space-between; }
  .attendance-search-label { flex-basis: 100%; }
}

/* Industrial Premium: superficie clara unica, con paneles de control oscuros.
   No es un modo alternable: es la identidad fija del sistema. */
:root {
  --surface: #edf2ee;
  --surface-raised: #f8faf7;
  --ink: #081618;
  --muted-ink: #6c7b7a;
  --line: #d7e2dc;
  --green: #20b879;
  --green-dark: #138b5a;
  --orange: #f5b94c;
  --blue: #78a7ff;
  --red: #e96b61;
  --red-dark: #b84b43;
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  background: radial-gradient(circle at 92% -8%, #ffffff 0, var(--surface) 44%, #e2ebe5 100%);
  color: var(--ink);
}

.topbar {
  min-height: 76px;
  background: #081618;
  border-bottom: 1px solid rgba(245, 247, 243, .16);
  box-shadow: 0 12px 28px rgba(8, 22, 24, .18);
}
.topbar .brand-icon { background: #f5f7f3; color: #081618; }
.topbar .brand-text { font-family: 'Instrument Sans', var(--font); letter-spacing: -.02em; }
.top-nav { background: #102426; border-color: rgba(245, 247, 243, .16); }
.nav-tab { color: #9eb0ad; }
.nav-tab:hover { color: #f5f7f3; background: rgba(245, 247, 243, .08); }
.nav-tab.active { background: #f5f7f3; color: #081618; }
.badge { background: rgba(245, 247, 243, .08); border-color: rgba(245, 247, 243, .24); color: #f5f7f3; }
.live-indicator { color: #d5e2dc; }
.live-dot { background: #20b879; }
.logout-btn { border-color: rgba(245, 247, 243, .28); color: #f5f7f3; }
.logout-btn:hover { border-color: #f5f7f3; background: rgba(245, 247, 243, .1); }

.layout { gap: 16px; padding: 16px; background: transparent; }
.sidebar {
  width: 338px;
  padding: 18px 15px;
  border: 1px solid rgba(245, 247, 243, .14);
  border-radius: 22px;
  background: #102426;
  color: #f5f7f3;
  box-shadow: 0 18px 42px rgba(8, 22, 24, .16);
}
#search-input { border-color: rgba(245, 247, 243, .18); background: #173033; color: #f5f7f3; }
#search-input::placeholder { color: #91a39f; }
#search-input:focus { border-color: #f5f7f3; background: #173033; box-shadow: 0 0 0 4px rgba(245, 247, 243, .12); }
.filter-pill { border-color: rgba(245, 247, 243, .2); background: transparent; color: #b8c7c2; }
.filter-pill:hover { border-color: rgba(245, 247, 243, .6); background: rgba(245, 247, 243, .08); color: #f5f7f3; }
.filter-pill.active { border-color: #f5f7f3; background: #f5f7f3; color: #081618; box-shadow: 0 8px 18px rgba(245, 247, 243, .16); }
.empty-list { color: #91a39f; }
.driver-card { border-color: rgba(245, 247, 243, .14); background: #173033; box-shadow: none; }
.driver-card:hover { border-color: rgba(245, 247, 243, .52); box-shadow: 0 12px 24px rgba(0, 0, 0, .16); }
.driver-card.expanded, .driver-card.selected { border-color: #f5f7f3; box-shadow: 0 0 0 3px rgba(245, 247, 243, .1); }
.driver-card-header:hover { background: rgba(245, 247, 243, .06); }
.driver-card .name { color: #f5f7f3; }
.driver-card .meta { color: #a9bab5; }
.detail-section { border-top-color: rgba(245, 247, 243, .12); }
.detail-section .row { color: #b8c7c2; }
.detail-section .row b { color: #f5f7f3; }
.trip-section h4 { color: #f5f7f3; }
.driver-card .status-dot { box-shadow: 0 0 0 3px rgba(245, 247, 243, .08); }

.map-panel { border-color: #d7e2dc; border-radius: 22px; box-shadow: 0 18px 42px rgba(8, 22, 24, .12); }
.map-fullscreen-btn, .map-center-btn { border-color: #d7e2dc; border-radius: 13px; color: #081618; }
.map-fullscreen-btn:hover, .map-center-btn:hover { border-color: #f5f7f3; background: #f5f7f3; }
.map-legend { border-color: rgba(255,255,255,.8); border-radius: 15px; background: rgba(248,250,247,.92); color: #081618; }

.drivers-admin-view, .settings-view { color: #081618; }
.driver-admin-card, .settings-card, .settings-shortcut, .update-app-block { border-color: #d7e2dc; border-radius: 22px; background: #f8faf7; box-shadow: 0 10px 26px rgba(8, 22, 24, .07); }
.driver-admin-card:hover, .settings-shortcut:hover, .update-app-block:hover { border-color: #b8c7c2; box-shadow: 0 16px 30px rgba(8, 22, 24, .1); }
.settings-section-link:hover { background: #eef6e7; }
.settings-card input, .settings-card select, .manual-update-form input, .update-form input[type='file'] { border-color: #d7e2dc; background: #ffffff; }
.settings-card input:focus, .settings-card select:focus, .manual-update-form input:focus { border-color: #20b879; box-shadow: 0 0 0 4px rgba(32, 184, 121, .12); }
.primary-btn, .build-branded-app-btn, .manual-update-form button, .app-download-btn { border-radius: 13px; background: #081618; color: #f5f7f3; }
.primary-btn:hover, .build-branded-app-btn:hover, .manual-update-form button:hover, .app-download-btn:hover { background: #173033; box-shadow: 0 10px 20px rgba(8, 22, 24, .18); }
.dashboard-add-user-btn { background: #f5f7f3; color: #081618; }
.dashboard-add-user-btn:hover { background: #ffffff; }
.users-table-wrap, .app-download-card { border-color: #d7e2dc; }
.users-table th { background: #e9f0eb; color: #49605d; }
.apps-branding-grid .app-branding-block { border-color: #d7e2dc; background: #f1f6f2; }

@media (max-width: 680px) {
  .sidebar { width: auto; }
  .layout { padding: 10px; }
}

/* Composición aprobada: la referencia de APL Logistic. El mapa sigue siendo
   el mismo componente funcional; solo cambia su jerarquía visual. */
.app {
  display: grid;
  grid-template-columns: 294px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  padding: 0;
  background: #ffffff;
}

.topbar {
  grid-column: 1;
  grid-row: 1;
  min-height: 0;
  height: auto;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  padding: 28px 26px 24px;
  border: 0;
  border-radius: 0;
  background: #081618;
  box-shadow: none;
}
.topbar .brand-home { align-items: center; gap: 14px; }
.topbar .brand-icon { width: 52px; height: 52px; border-radius: 15px; background: #081618; background-image: url('../assets/apl-mark.png'); background-size: cover; background-position: center; color: transparent; font-size: 0; }
.topbar .brand-icon::before { content: ''; }
.topbar .brand-text { font-family: 'Instrument Sans', var(--font); font-size: 21px; line-height: 1.05; }
.topbar .brand-home::after { content: 'Operaciones'; position: absolute; margin: 38px 0 0 66px; color: #76918d; font-size: 12px; letter-spacing: .02em; }
.control-copy { display: flex; flex-direction: column; gap: 8px; margin-top: 68px; }
.control-eyebrow { color: #7c9a95; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.control-copy strong { color: #f5f7f3; font-family: 'Instrument Sans', var(--font); font-size: 29px; line-height: .98; letter-spacing: -.06em; }
.top-nav { display: flex; flex-direction: column; gap: 6px; margin-top: 34px; padding: 0; border: 0; border-radius: 0; background: transparent; }
.nav-tab { width: 100%; justify-content: flex-start; padding: 15px 16px; border-radius: 14px; color: #a4bbb5; font-size: 16px; font-weight: 600; text-align: left; }
.nav-tab::after { margin-left: auto; color: #6c8984; font: 600 11px 'IBM Plex Mono', monospace; }
.nav-tab:nth-child(1)::after { content: '01'; }
.nav-tab:nth-child(2)::after { content: '02'; }
.nav-tab:nth-child(3)::after { content: '03'; }
.nav-tab:nth-child(4)::after { content: '04'; }
.nav-tab:hover { color: #f5f7f3; background: rgba(245,247,243,.08); }
.nav-tab.active { background: #193d42; color: #f5f7f3; box-shadow: none; }
.nav-tab.active::after { color: #f5f7f3; }
.topbar-right { margin-top: auto; align-items: stretch; flex-direction: column; gap: 12px; padding-top: 22px; border-top: 1px solid rgba(245,247,243,.12); }
.topbar-right .badge { order: 2; text-align: center; }
.topbar-right .live-indicator { order: 1; }
.logout-btn { order: 3; text-align: left; }

.layout {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 350px);
  grid-template-rows: minmax(0, 1fr);
  gap: 20px;
  padding: 28px;
  overflow: hidden;
  border-radius: 0;
  background: #f5f7f3;
}
.map-panel {
  grid-column: 1;
  grid-row: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.overview-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.overview-eyebrow { color: #6c7b7a; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.overview-heading h2 { margin-top: 3px; color: #081618; font-family: 'Instrument Sans', var(--font); font-size: 34px; line-height: 1; letter-spacing: -.06em; }
#overview-clock { color: #54706b; font: 600 12px 'IBM Plex Mono', monospace; letter-spacing: .04em; text-transform: uppercase; }
.overview-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-card { min-height: 105px; display: flex; flex-direction: column; justify-content: space-between; padding: 17px 18px; border: 1px solid #d5dfd9; border-radius: 18px; background: #fff; }
.stat-card span { color: #6c7b7a; font-size: 12px; }
.stat-card strong { color: #081618; font-family: 'Instrument Sans', var(--font); font-size: 29px; line-height: 1; letter-spacing: -.04em; }
.stat-card em { color: #20b879; font-size: 11px; font-style: normal; font-weight: 700; }
.stat-card:nth-child(4) em { color: #6c7b7a; }
#map { min-height: 0; height: auto; border-radius: 22px; overflow: hidden; background: #b8cbc4; }
.map-fullscreen-btn, .map-center-btn { top: 20px; right: 20px; }
.map-center-btn { top: 72px; }
.map-legend {
  display: flex;
  min-height: 42px;
  height: auto;
  flex-wrap: wrap;
  align-content: center;
  gap: 8px 18px;
  padding: 8px 12px;
  border: 1px solid rgba(213,223,217,.9);
  border-radius: 14px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}

.sidebar {
  grid-column: 2;
  grid-row: 1;
  width: auto;
  min-width: 0;
  min-height: 0;
  padding: 24px 22px;
  border: 0;
  border-radius: 22px;
  background: #081618;
  box-shadow: none;
}
.fleet-heading { display: flex; align-items: end; justify-content: space-between; gap: 8px; padding-bottom: 19px; border-bottom: 1px solid rgba(245,247,243,.14); }
.fleet-heading h2 { color: #f5f7f3; font-family: 'Instrument Sans', var(--font); font-size: 22px; line-height: 1; letter-spacing: -.05em; }
.fleet-heading span { color: #f5f7f3; font: 600 10px 'IBM Plex Mono', monospace; text-transform: uppercase; }
.fleet-filter-drawer { margin: 14px 0; color: #9eb0ad; font-size: 12px; }
.fleet-filter-drawer summary { cursor: pointer; list-style: none; }
.fleet-filter-drawer summary::-webkit-details-marker { display: none; }
.fleet-filter-drawer summary::after { content: '+'; float: right; color: #f5f7f3; font-size: 18px; line-height: .7; }
.fleet-filter-drawer[open] summary::after { content: '–'; }
.fleet-filter-drawer #search-input { width: 100%; margin: 14px 0 8px; }
.fleet-filter-drawer .status-filters { margin: 0; }
.fleet-filter-drawer .filter-pill { padding: 5px 9px; font-size: 11px; }
.driver-list { min-height: 0; overflow-y: auto; gap: 0; }
.driver-card { border: 0; border-bottom: 1px solid rgba(245,247,243,.14); border-radius: 0; background: transparent; box-shadow: none; }
.driver-card:hover { border-color: rgba(245,247,243,.14); background: rgba(200,242,103,.05); box-shadow: none; transform: none; }
.driver-card.expanded, .driver-card.selected { border-color: rgba(200,242,103,.28); box-shadow: none; }
.driver-card-header { padding: 16px 0; }
.driver-card-header:hover { background: transparent; }
.driver-card .name { font-size: 14px; }
.driver-card .meta { margin-left: 18px; color: #8fa6a1; }
.driver-card .status-dot { width: 9px; height: 9px; }
.detail-section { padding: 14px 0; }
.map-place-assignment { padding: 12px 0; }
.contact-actions { padding-bottom: 14px; }
.empty-list { padding: 28px 0; }

.drivers-admin-view, .settings-view { grid-column: 2; grid-row: 1; min-width: 0; min-height: 0; overflow-y: auto; border-radius: 0; background: #f5f7f3; }

@media (max-width: 1050px) {
  .app { grid-template-columns: 245px minmax(0, 1fr); }
  .layout { grid-template-columns: minmax(0, 1fr) 290px; padding: 20px; }
  .overview-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .control-copy strong { font-size: 24px; }
}
@media (max-width: 760px) {
  .app { display: flex; min-height: 100vh; height: auto; padding: 0; }
  .topbar { min-height: auto; border-radius: 0; padding: 18px; }
  .control-copy { display: none; }
  .top-nav { flex-direction: row; overflow-x: auto; margin-top: 22px; }
  .nav-tab { min-width: max-content; padding: 11px 14px; font-size: 13px; }
  .nav-tab::after { display: none; }
  .topbar-right { display: none; }
  .layout { display: flex; flex-direction: column; min-height: 900px; border-radius: 0; padding: 14px; }
  .map-panel { min-height: 560px; }
  .overview-heading h2 { font-size: 29px; }
  .overview-stats { gap: 8px; }
  .stat-card { min-height: 92px; padding: 13px; }
  .stat-card strong { font-size: 23px; }
  .sidebar { order: 2; min-height: 420px; }
  .drivers-admin-view, .settings-view { border-radius: 0; }
}

/* Marca APL compartida con la app del conductor. El estilo en línea que
   aplica settings.js sigue teniendo prioridad cuando el administrador carga
   un logo personalizado desde Configuración. */
.brand-icon {
  background-color: #081618;
  background-image: url('../assets/apl-mark.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: transparent;
  font-size: 0;
}

/* Correcciones de legibilidad y controles del mapa. */
.drivers-admin-view .driver-admin-meta { color: #5d716d; }
.drivers-admin-view .driver-admin-card .detail-section { border-top-color: #d7e2dc; }
.drivers-admin-view .driver-admin-card .detail-section .row { color: #526864; }
.drivers-admin-view .driver-admin-card .detail-section .row b { color: #081618; }
.drivers-admin-view .doc-label { color: #607772; }
.drivers-admin-view .doc-missing { color: #91a39f; border-color: #bbc9c3; }

.map-panel { gap: 16px; }
.overview-stats { gap: 10px; }
.stat-card { min-height: 92px; padding: 15px 17px; }
.map-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border-radius: 22px;
  background: #b8cbc4;
  box-shadow: 0 16px 34px rgba(8, 22, 24, .12);
}
.map-stage #map { width: 100%; height: 100%; min-height: 0; border-radius: 0; }
.map-fullscreen-btn,
.map-center-btn {
  z-index: 5;
  right: 18px;
  width: 48px;
  height: 48px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(210, 222, 216, .96);
  border-radius: 14px;
  background: rgba(255, 255, 255, .94);
  color: #081618;
  box-shadow: 0 8px 20px rgba(8, 22, 24, .18);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.map-fullscreen-btn { top: 18px; font-size: 27px; line-height: 1; }
.map-center-btn { top: 78px; font-size: 29px; line-height: 1; }
.map-fullscreen-btn:hover, .map-center-btn:hover {
  border-color: #b8c7c2;
  background: #ffffff;
  box-shadow: 0 12px 25px rgba(8, 22, 24, .22);
  transform: translateY(-2px);
}
.map-fullscreen-btn:focus-visible, .map-center-btn:focus-visible {
  outline: 3px solid rgba(245, 247, 243, .9);
  outline-offset: 3px;
}
#map-view:fullscreen .map-stage,
#map-view.map-fullscreen-fallback .map-stage { min-height: 0; }
#map-view:fullscreen .map-stage #map,
#map-view.map-fullscreen-fallback .map-stage #map { min-height: 0; height: 100%; }

/* Pulido visual: sombras neutras y hover sin velo verdoso. El verde queda
   reservado para estados operativos y acciones, no para superficies. */
body { background: #f1f2f1; }
.layout,
.drivers-admin-view,
.settings-view { background: #f5f6f5; }
.driver-card,
.driver-card:hover,
.driver-card-header:hover { background: transparent; }
.driver-card { flex: 0 0 auto; }
.driver-card.expanded,
.driver-card.selected { border-color: rgba(245, 247, 243, .18); }
.map-stage { box-shadow: 0 16px 34px rgba(0, 0, 0, .10); }
.map-fullscreen-btn,
.map-center-btn { box-shadow: 0 8px 20px rgba(0, 0, 0, .14); }
.map-fullscreen-btn:hover,
.map-center-btn:hover { box-shadow: 0 12px 25px rgba(0, 0, 0, .18); }
.settings-section-link:hover { background: #eef0ef; }

/* Ficha de conductor: una sola columna de lectura para etiquetas, valores y acciones. */
.driver-card .detail-section,
.driver-card .map-place-assignment,
.driver-card .contact-actions { padding-left: 18px; }
.driver-card .detail-section .row {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 8px;
  align-items: baseline;
}
.driver-card .map-place-assignment {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 10px;
}
.driver-card .map-place-assignment select,
.driver-card .map-place-assignment button { min-height: 46px; box-sizing: border-box; }
.driver-card .map-place-assignment select { width: 100%; }
.driver-card .map-place-assignment button { white-space: nowrap; padding-inline: 14px; }
.driver-card .contact-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.driver-card .call-btn,
.driver-card .whatsapp-btn { min-height: 42px; box-sizing: border-box; }

/* Fallback real para navegadores que bloquean la Fullscreen API: ocupa toda la ventana */
#map-view.map-fullscreen-fallback {
  position: fixed !important;
  inset: 0 !important;
  z-index: 1000 !important;
  width: auto !important;
  height: auto !important;
  min-height: 100vh !important;
  box-sizing: border-box !important;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 350px) !important;
  gap: 18px !important;
  padding: 0 !important;
  border-radius: 0 !important;
  background: #f5f7f3 !important;
}
#map-view.map-fullscreen-fallback .sidebar { width: auto; }
#map-view.map-fullscreen-fallback .map-panel { min-width: 0; min-height: 0; }

/* La Fullscreen API nativa usa una regla distinta al fallback. Mantener el
   mapa como columna principal también en Chrome/Edge reales. */
#map-view:fullscreen {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 350px) !important;
  grid-template-rows: minmax(0, 1fr) !important;
  gap: 18px !important;
  padding: 0 !important;
  background: #f5f7f3 !important;
}
#map-view:fullscreen .sidebar { width: auto; min-width: 0; }
#map-view:fullscreen .map-panel { min-width: 0; min-height: 0; }
#map-view:fullscreen .map-stage { min-height: 0; }

@media (max-width: 760px) {
  .map-stage { min-height: 520px; }
  .map-fullscreen-btn, .map-center-btn { right: 14px; }
  .map-fullscreen-btn { top: 14px; }
  .map-center-btn { top: 72px; }
  #map-view.map-fullscreen-fallback { grid-template-columns: 1fr !important; padding: 0 !important; }
  #map-view.map-fullscreen-fallback .sidebar { display: none; }
}

/* Panel de despacho exclusivo para coordinadores: sin mapa ni metricas de flota. */
.coordinator-app { min-height: 100vh; background: #f5f6f5; color: #081618; }
.coordinator-topbar { min-height: 76px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 28px; padding: 14px 28px; background: #081618; color: #f5f7f3; }
.coordinator-topbar .brand { color: #f5f7f3; }
.coordinator-heading { display: flex; flex-direction: column; gap: 4px; }
.coordinator-heading span { color: #9fb3ae; font: 600 10px 'IBM Plex Mono', monospace; letter-spacing: .12em; text-transform: uppercase; }
.coordinator-heading strong { font: 700 18px 'Instrument Sans', var(--font); }
.coordinator-account { display: flex; align-items: center; gap: 18px; color: #cbd8d3; font-size: 13px; }
.coordinator-account .logout-btn { color: #f5f7f3; border-color: rgba(245,247,243,.35); }
.coordinator-dispatch-layout { width: min(1320px, calc(100% - 48px)); min-height: calc(100vh - 76px); margin: 0 auto; display: grid; grid-template-columns: minmax(320px, 390px) minmax(0, 1fr); align-items: start; gap: 24px; padding: 32px 0 48px; }
.coordinator-request-card, .coordinator-trips-card { border: 1px solid #d7e2dc; border-radius: 24px; background: #fff; box-shadow: 0 16px 36px rgba(8,22,24,.08); }
.coordinator-request-card { padding: 28px; }
.coordinator-trips-card { min-height: 610px; overflow: hidden; }
.coordinator-section-heading h1, .coordinator-section-heading h2 { margin: 7px 0 6px; color: #081618; font-family: 'Instrument Sans', var(--font); letter-spacing: -.045em; }
.coordinator-section-heading h1 { font-size: 30px; }
.coordinator-section-heading h2 { font-size: 26px; }
.coordinator-section-heading p { margin: 0; color: #6d7d79; font-size: 13px; line-height: 1.5; }
.coordinator-request-form { display: grid; gap: 16px; margin-top: 26px; }
.coordinator-request-form label { display: grid; gap: 7px; color: #344b46; font-size: 12px; font-weight: 700; }
.coordinator-request-form input { width: 100%; min-height: 46px; box-sizing: border-box; padding: 0 13px; border: 1px solid #cbd8d3; border-radius: 12px; background: #fff; color: #081618; font: inherit; }
.coordinator-request-form input:focus { outline: 3px solid rgba(6,193,103,.15); border-color: #06c167; }
.coordinator-request-form input[readonly] { background: #eef3f0; color: #526864; }
.coordinator-destination-field { position: relative; display: grid; gap: 7px; }
.coordinator-passenger-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.coordinator-preview-panel { display: grid; gap: 9px; padding: 13px; border: 1px solid #d7e2dc; border-radius: 16px; background: #f8fbf9; }
.coordinator-preview-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.coordinator-preview-title { display: block; color: #344b46; font-size: 12px; font-weight: 800; }
.coordinator-preview-heading small { display: block; margin-top: 3px; color: #778984; font-size: 11px; line-height: 1.35; }
.coordinator-preview-badge { padding: 4px 7px; border-radius: 999px; background: #e8f8ef; color: #00874a; font: 800 9px 'IBM Plex Mono', monospace; letter-spacing: .08em; }
.coordinator-map-preview { position: relative; height: 205px; overflow: hidden; border-radius: 12px; background: #e4ece8; }
.coordinator-map-preview .mapboxgl-map { width: 100%; height: 100%; }
.coordinator-map-preview .mapboxgl-ctrl-logo { margin: 0 0 4px 4px; }
.coordinator-map-preview .mapboxgl-ctrl-attrib { max-width: calc(100% - 8px); font-size: 9px; }
.coordinator-map-preview-message { margin: 0; color: #6d7d79; font-size: 11px; line-height: 1.4; }
.coordinator-primary-btn { min-height: 50px; border: 0; border-radius: 13px; background: #06c167; color: #fff; font-weight: 800; cursor: pointer; box-shadow: 0 8px 18px rgba(6,193,103,.2); }
.coordinator-primary-btn:hover { background: #05aa5b; }
.coordinator-primary-btn:disabled { opacity: .55; cursor: wait; }
.coordinator-suggestions { position: absolute; z-index: 20; top: 74px; left: 0; right: 0; overflow: hidden; border: 1px solid #cbd8d3; border-radius: 13px; background: #fff; box-shadow: 0 14px 30px rgba(8,22,24,.14); }
.coordinator-suggestion { width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 0; border-bottom: 1px solid #edf1ef; background: #fff; color: #344b46; text-align: left; cursor: pointer; }
.coordinator-suggestion:last-child { border-bottom: 0; }
.coordinator-suggestion:hover { background: #f1f8f4; }
.coordinator-suggestion span:first-child { color: #06c167; font-size: 18px; }
.coordinator-suggestion-empty { padding: 14px; color: #7b8b87; font-size: 13px; }
.coordinator-trips-heading { display: flex; align-items: center; justify-content: space-between; padding: 28px 30px 22px; border-bottom: 1px solid #e1e9e5; }
.coordinator-trip-count { display: inline-grid; min-width: 34px; height: 34px; place-items: center; border-radius: 50%; background: #e8f8ef; color: #00874a; font-weight: 800; }
.coordinator-trips-list { display: grid; }
.coordinator-trip-row { display: grid; gap: 11px; padding: 20px 30px; border: 0; border-bottom: 1px solid #e7eeea; background: #fff; color: #081618; text-align: left; cursor: pointer; }
.coordinator-trip-row:hover { background: #f6faf7; }
.coordinator-trip-row-top, .coordinator-trip-row-bottom { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.coordinator-trip-row-top b { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.coordinator-trip-row-top time, .coordinator-trip-row-bottom > span:last-child { color: #6c7b78; font-size: 12px; }
.coordinator-trip-row-bottom { justify-content: flex-start; }
.coordinator-trip-row-bottom > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coordinator-status-pill { display: inline-flex; align-items: center; gap: 7px; width: max-content; padding: 5px 9px; border-radius: 999px; background: #edf2f0; color: #5c6d68; font-size: 11px; font-weight: 800; white-space: nowrap; }
.coordinator-status-pill i { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: #84958f; }
.coordinator-status-pill.searching { background: #fff5dc; color: #9a6a00; }.coordinator-status-pill.searching i { background: #e0a51a; }
.coordinator-status-pill.assigned { background: #eaf1ff; color: #2764c7; }.coordinator-status-pill.assigned i { background: #276ef1; }
.coordinator-status-pill.on-route { background: #efeaff; color: #6642b4; }.coordinator-status-pill.on-route i { background: #7c3aed; }
.coordinator-status-pill.completed { background: #e7f8ef; color: #00874a; }.coordinator-status-pill.completed i { background: #06c167; }
.coordinator-status-pill.cancelled { background: #fff0ef; color: #b84b44; }.coordinator-status-pill.cancelled i { background: #ef6a63; }
.coordinator-empty-state { padding: 58px 30px; color: #778984; text-align: center; }
.coordinator-trip-modal { position: fixed; z-index: 2000; inset: 0; display: grid; place-items: center; padding: 20px; }
.coordinator-trip-modal-backdrop { position: absolute; inset: 0; background: rgba(8,22,24,.5); backdrop-filter: blur(3px); }
.coordinator-trip-modal-card { position: relative; width: min(560px, 100%); max-height: min(760px, calc(100vh - 40px)); overflow-y: auto; padding: 30px; border-radius: 24px; background: #fff; box-shadow: 0 24px 70px rgba(8,22,24,.25); }
.coordinator-modal-close { position: absolute; top: 15px; right: 17px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: #eef2ef; color: #435a54; font-size: 24px; line-height: 1; cursor: pointer; }
.coordinator-trip-modal-card h2 { margin: 8px 0 20px; font: 700 28px 'Instrument Sans', var(--font); letter-spacing: -.05em; }
.coordinator-modal-status { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; color: #72837e; font-size: 12px; }
.coordinator-detail-block { margin-top: 16px; padding: 16px; border: 1px solid #e0e9e4; border-radius: 16px; }
.coordinator-detail-block h3 { margin: 0 0 12px; color: #081618; font-size: 13px; }
.coordinator-detail-row { display: grid; grid-template-columns: 145px minmax(0,1fr); gap: 10px; padding: 8px 0; border-top: 1px solid #edf1ef; color: #778984; font-size: 12px; }
.coordinator-detail-row:first-of-type { border-top: 0; }
.coordinator-detail-row b { overflow-wrap: anywhere; color: #344b46; font-weight: 700; }
.coordinator-detail-row a { color: #00874a; }
.coordinator-detail-row small { display: block; color: #8a9995; font-size: 10px; font-weight: 500; }
.coordinator-trip-map-block { margin-top: 16px; padding: 14px; border: 1px solid #e0e9e4; border-radius: 16px; background: #f7faf8; }
.coordinator-trip-map-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.coordinator-trip-map-heading h3 { margin: 0; color: #081618; font-size: 13px; }
.coordinator-trip-map-heading small { display: block; margin-top: 3px; color: #778984; font-size: 11px; }
.coordinator-trip-map-badge { padding: 4px 7px; border-radius: 999px; background: #e8f8ef; color: #00874a; font: 800 9px 'IBM Plex Mono', monospace; letter-spacing: .08em; }
.coordinator-trip-map-badge.terminal { background: #edf1ef; color: #6d7d79; }
.coordinator-trip-map { position: relative; height: 220px; overflow: hidden; border-radius: 12px; background: #e4ece8; }
.coordinator-trip-map .mapboxgl-map { width: 100%; height: 100%; }
.coordinator-trip-map .mapboxgl-ctrl-logo { margin: 0 0 4px 4px; }
.coordinator-trip-map .mapboxgl-ctrl-attrib { max-width: calc(100% - 8px); font-size: 9px; }
.coordinator-trip-map-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 9px; color: #61736d; font-size: 10px; }
.coordinator-trip-map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.coordinator-trip-map-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #081618; }
.coordinator-trip-map-legend i.vehicle { background: #f5b94c; }
.coordinator-trip-map-legend i.pickup { background: #1d4ed8; }
.coordinator-trip-map-legend i.destination { background: #7c3aed; }
.coordinator-trip-map-caption { margin: 9px 0 0; color: #61736d; font-size: 11px; line-height: 1.4; }
.coordinator-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.coordinator-danger-btn { min-height: 44px; padding: 0 16px; border: 1px solid #ef6a63; border-radius: 11px; background: #fff5f4; color: #bf4a43; font-weight: 800; cursor: pointer; }
.coordinator-danger-btn:hover { background: #ffe8e6; }
.coordinator-danger-btn:disabled { opacity: .55; cursor: wait; }

@media (max-width: 820px) {
  .coordinator-topbar { grid-template-columns: 1fr auto; gap: 15px; padding: 14px 18px; }
  .coordinator-heading { grid-column: 1 / -1; grid-row: 2; }
  .coordinator-account { justify-content: flex-end; }
  .coordinator-account > span { display: none; }
  .coordinator-dispatch-layout { width: calc(100% - 28px); grid-template-columns: 1fr; padding: 18px 0 30px; }
  .coordinator-trips-card { min-height: 420px; }
  .coordinator-trips-heading, .coordinator-trip-row { padding-left: 20px; padding-right: 20px; }
}

@media (max-width: 520px) {
  .coordinator-request-card { padding: 21px; }
  .coordinator-passenger-grid { grid-template-columns: 1fr; }
  .coordinator-trip-row-top { align-items: flex-start; flex-direction: column; gap: 5px; }
  .coordinator-trip-modal-card { padding: 24px 18px; }
  .coordinator-trip-map { height: 190px; }
  .coordinator-detail-row { grid-template-columns: 1fr; gap: 3px; }
}

/* Escritorio compacto: libera altura para el mapa sin ocultar métricas,
   controles, flota ni leyenda. En móvil se conserva la composición apilada. */
@media (min-width: 761px) {
  .layout {
    gap: 16px;
    padding: 16px 18px 10px;
  }

  .map-panel { gap: 10px; }
  .overview-heading h2 { font-size: 31px; }
  .overview-stats { gap: 8px; }
  .stat-card {
    min-height: 76px;
    padding: 12px 14px;
    border-radius: 15px;
  }
  .stat-card strong { font-size: 26px; }
  .map-legend {
    min-height: 36px;
    padding: 6px 11px;
  }
  .sidebar { padding: 18px; }
  .fleet-heading { padding-bottom: 15px; }
  .fleet-filter-drawer { margin: 10px 0; }
}

/* Segunda propuesta de escritorio: el mapa es la superficie principal y los
   datos siguen visibles en una franja de resumen más baja. */
@media (min-width: 1200px) {
  .app { grid-template-columns: 260px minmax(0, 1fr); }

  .layout {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 318px);
    gap: 12px;
    padding: 10px 12px 8px;
  }

  .map-panel { gap: 8px; }
  .overview-heading h2 { font-size: 29px; }
  .overview-stats { gap: 6px; }
  .stat-card {
    min-height: 62px;
    padding: 8px 12px;
    border-radius: 12px;
  }
  .stat-card span { font-size: 11px; }
  .stat-card strong { font-size: 23px; }
  .stat-card em { font-size: 10px; }
  .map-legend {
    min-height: 32px;
    gap: 6px 14px;
    padding: 4px 10px;
  }
  .sidebar {
    padding: 14px 16px;
    border-radius: 18px;
  }
  .fleet-heading { padding-bottom: 12px; }
  .fleet-heading h2 { font-size: 20px; }
  .fleet-filter-drawer { margin: 8px 0; }
  .driver-card-header { padding: 13px 0; }
}

/* Estados de interacción en vistas claras: no heredar el estilo de filtros
   del panel oscuro, porque vuelve el texto casi invisible al pasar el cursor. */
.drivers-admin-toolbar .filter-pill {
  border-color: #d7e2dc;
  background: #ffffff;
  color: #526861;
  opacity: 1;
}
.drivers-admin-toolbar .filter-pill:hover {
  border-color: #20b879;
  background: #eef8f2;
  color: #081618;
  opacity: 1;
}
.drivers-admin-toolbar .filter-pill.active,
.drivers-admin-toolbar .filter-pill.active:hover {
  border-color: #20b879;
  background: #e8f8ef;
  color: #087443;
  box-shadow: 0 5px 14px rgba(32, 184, 121, .14);
  opacity: 1;
}
.drivers-admin-toolbar .filter-pill:focus-visible {
  outline: 3px solid rgba(32, 184, 121, .24);
  outline-offset: 2px;
}
.doc-thumb:hover { opacity: 1; filter: brightness(.98); }
