@font-face { font-family: "Inter"; src: url("/assets/InterVariable.woff2") format("woff2"); font-style: normal; font-weight: 100 900; font-display: swap; }
:root { --review-font: "Inter", "Segoe UI Variable", Aptos, "Segoe UI", system-ui, sans-serif; }
html, body, body * { font-family: var(--review-font) !important; font-synthesis: none; }
body { -webkit-font-smoothing: antialiased; }.nav-brand { display: none; }
.driver-trip-overview,#proofStopSummary { display:none; }
.mobile-brand-title { display:none; }
.driver-title-icon { width:24px; height:24px; vertical-align:middle; }
@media screen and (min-width: 901px) {
  body.admin-workspace {
    --review-ink: #273248;
    --review-olive: #647a2e;
    --review-line: #e1e6ec;
    --review-soft: #f6f8fa;
    background: #f3f5f8;
  }
  body.admin-workspace .topbar {
    width: calc(100% - 228px);
    margin-left: 228px;
    justify-content: flex-end;
  }
  body.admin-workspace .topbar .brand { display: none; }
  body.admin-workspace .admin-navigation {
    top: 0;
    left: 0;
    bottom: 0;
    width: 228px;
    padding: 20px 13px 18px;
    border-radius: 0;
    z-index: 25;
  }
  body.admin-workspace .nav-brand {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
    min-height: 0;
    margin: 0 3px 22px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,.2);
  }
  body.admin-workspace .nav-brand-logo {
    display: block;
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    overflow: visible;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 8px rgba(9,16,30,.16);
  }
  body.admin-workspace .nav-brand-logo img { display: block; width: 100%; max-width: 100%; height: auto; object-fit: contain; border-radius: inherit; }
  body.admin-workspace .nav-brand-copy strong,
  body.admin-workspace .nav-brand-copy small { display: block; color: #fff; }
  body.admin-workspace .nav-brand-copy strong { display: none; }
  body.admin-workspace .nav-brand-copy small { margin: 0 2px; color: #cbd1dd; font-size: 12px; }

  body.admin-workspace .heading-row {
    padding: 5px 0 2px;
    margin-bottom: 22px;
  }
  body.admin-workspace .heading-row h1 { font-size: clamp(31px, 2.25vw, 39px); }
  body.admin-workspace .heading-row .eyebrow { letter-spacing: .16em; }
  body.admin-workspace .panel,
  body.admin-workspace .delivery-map-page,
  body.admin-workspace .dash-block,
  body.admin-workspace .dash-route {
    box-shadow: 0 8px 24px rgba(28, 39, 60, .045);
  }

  /* Rutas: mandos compactos arriba; la lista de paradas se desplaza sola. */
  body.admin-workspace #routesPage { min-width: 0; }
  body.admin-workspace #routesPage .route-tool-tabs {
    position: static;
    display: inline-flex;
    gap: 5px;
    padding: 5px;
    margin-bottom: 18px;
    background: #e9edf0;
  }
  body.admin-workspace #routesPage .route-tool-tabs button { min-height: 40px; padding: 9px 16px; }
  body.admin-workspace #routesPage .planner-panel,
  body.admin-workspace #routesPage .route-assignment-panel { padding: 24px; }
  body.admin-workspace #routesPage .planner-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--review-line);
    background: var(--review-soft);
  }
  body.admin-workspace #routesPage .planner-toolbar label { flex: 1 1 220px; min-width: 190px; }
  body.admin-workspace #routesPage .planner-toolbar .button { min-height: 42px; }
  body.admin-workspace #routesPage .planner-hint { margin: 14px 0; }
  body.admin-workspace #routesPage #plannerStops {
    display: block;
    max-height: min(60vh, 650px);
    min-height: 140px;
    overflow-y: auto;
    padding: 8px 12px 8px 0;
    border-radius: 13px;
  }
  body.admin-workspace #routesPage #plannerStops > li {
    margin: 0 0 9px;
    border: 1px solid var(--review-line);
    border-radius: 11px;
    background: #fff;
  }
  body.admin-workspace #routesPage .route-assignment-panel .extra-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 13px;
    padding: 15px;
    margin: 12px 0;
    border: 1px solid var(--review-line);
    border-radius: 12px;
    background: var(--review-soft);
  }
  body.admin-workspace #routesPage #expressStopChoices {
    max-height: 48vh;
    border: 1px solid var(--review-line);
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 14px;
    background: #fff;
  }

  /* Mapa: panel lateral fijo al alto visible y lista interna. */
  body.admin-workspace #deliveryMapPage {
    padding: 24px;
    border: 1px solid var(--review-line);
    background: #fff;
  }
  body.admin-workspace #deliveryMapPage .delivery-map-heading { margin-bottom: 18px; }
  body.admin-workspace #deliveryMapPage .delivery-map-filters {
    padding: 14px;
    margin-bottom: 16px;
    border: 1px solid var(--review-line);
    border-radius: 12px;
    background: var(--review-soft);
  }
  body.admin-workspace #deliveryMapPage .delivery-map-layout {
    grid-template-columns: minmax(0, 1.9fr) minmax(320px, .8fr);
    min-height: min(70vh, 720px);
    gap: 15px;
  }
  body.admin-workspace #deliveryMapPage .delivery-map-canvas { min-height: min(70vh, 720px); }
  body.admin-workspace #deliveryMapPage .delivery-map-side {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: min(70vh, 720px);
    overflow: hidden;
    border: 1px solid var(--review-line);
    background: #fbfcfa;
  }
  body.admin-workspace #deliveryMapPage #deliveryMapList {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  /* Historial: arregla las filas comprimidas que ocultaban fechas y rutas. */
  body.admin-workspace #historyView { min-height: 0; max-height: none; }
  body.admin-workspace #historyList {
    display: block;
    min-height: 180px;
    max-height: min(54vh, 620px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2px 20px 8px;
  }
  body.admin-workspace #historyList > .history-group {
    display: block;
    width: auto;
    min-height: 44px;
    margin: 0 0 9px;
    overflow: hidden;
  }
  body.admin-workspace #historyList > .history-group > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
    padding: 11px 14px;
    color: var(--review-ink);
    line-height: 1.35;
    cursor: pointer;
  }
  body.admin-workspace #historyList > .history-group > summary span {
    color: #65718a;
    white-space: normal;
    text-align: right;
  }
  body.admin-workspace #historyView .history-mileage-panel { margin-top: 18px; }

  /* Vehículos: tarjetas y registros independientes de la altura de la página. */
  body.admin-workspace #fleetAdmin { padding: 24px; }
  body.admin-workspace #fleetAdmin > summary { font-size: 23px; }
  body.admin-workspace #fleetOverview {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0 20px;
  }
  body.admin-workspace .fleet-overview-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 18px;
    border: 1px solid var(--review-line);
    border-radius: 13px;
    background: #fff;
  }
  body.admin-workspace .fleet-overview-card span { color: #68748a; font-size: 12px; }
  body.admin-workspace .fleet-overview-card strong { color: var(--review-ink); font-size: 27px; }
  body.admin-workspace #fleetCards {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 13px;
  }
  body.admin-workspace #fleetCards .fleet-card { padding: 18px; }
  body.admin-workspace #fleetCards .fleet-card h3 { font-size: 18px; }
  body.admin-workspace #fleetCards .fleet-card > p { margin: 10px 0; }
  body.admin-workspace #fleetCards .fleet-card > button { margin: 5px 5px 0 0; }
  body.admin-workspace #fleetCards .fleet-card-km small { display: block; color: #6b7890; font-size: 11px; }
  body.admin-workspace #fleetCards .fleet-card-km strong { display: block; margin-top: 5px; font-size: 22px; }
  body.admin-workspace #fleetCards .fleet-card-details {
    margin-top: 13px;
    padding-top: 12px;
    border-top: 1px solid var(--review-line);
  }
  body.admin-workspace #fleetCards .fleet-card-details > summary {
    cursor: pointer;
    color: var(--review-olive);
    font-size: 12px;
    font-weight: 700;
  }
  body.admin-workspace #fleetAdmin .fleet-filters {
    grid-template-columns: minmax(170px, 1fr) minmax(170px, 1fr) auto;
    align-items: end;
    margin-top: 12px;
  }
  body.admin-workspace #fleetHistory {
    max-height: min(45vh, 470px);
    min-height: 80px;
    overflow-y: auto;
    margin-top: 12px;
  }
  body.admin-workspace #fleetEventDialog[open] {
    position: fixed !important;
    inset: 0 0 0 auto !important;
    box-sizing: border-box;
    width: min(470px, 100vw);
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 28px;
    border: 0;
    border-radius: 16px 0 0 16px;
    box-shadow: -14px 0 40px rgba(20, 30, 45, .15);
  }
  body.admin-workspace #fleetEventDialog .fleet-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.admin-workspace #fleetEventDialog .fleet-buttons { justify-content: flex-end; }

  /* Usuarios: formulario claro y lista propia para consultar más cuentas. */
  body.admin-workspace #usersView .user-form { background: #f7f9f8; }
  body.admin-workspace #usersView #userList {
    max-height: min(54vh, 630px);
    min-height: 160px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 8px;
  }
  body.admin-workspace #usersView .user-card { min-height: 64px; background: #fff; }

  /* Historial: resumen superior, filtros visibles y recorridos en un panel desplazable. */
  body.admin-workspace #historyView {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    min-height: 520px;
    max-height: calc(100vh - 170px);
    padding: 0 0 12px;
    overflow: hidden;
  }
  body.admin-workspace #historyView > .list-heading { flex: 0 0 auto; padding: 18px 22px 13px; }
  body.admin-workspace #historyView > .list-heading h2 { font-size: 21px; }
  body.admin-workspace #historyView > .list-heading { order: 0; }
  body.admin-workspace #historyView > .history-overview { order: 1; flex: 0 0 auto; margin: 12px 22px 10px; }
  body.admin-workspace #historyView .history-overview-cards { gap: 10px; }
  body.admin-workspace #historyView .history-overview-card { min-height: 70px; padding: 11px 14px; }
  body.admin-workspace #historyView .history-overview-card strong { font-size: 23px; }
  body.admin-workspace #historyView .history-overview-routes > summary { padding: 9px 13px; }
  body.admin-workspace #historyView .history-filters {
    order: 2;
    position: static;
    flex: 0 0 auto;
    grid-template-columns: minmax(125px,.8fr) minmax(125px,.8fr) minmax(145px,.95fr) minmax(150px,.95fr) minmax(190px,1.2fr) auto;
    gap: 10px;
    padding: 11px 13px;
    margin: 0 22px 11px;
    background: #fff;
  }
  body.admin-workspace #historyView .history-filters label { gap: 5px; }
  body.admin-workspace #historyView .history-filters input,
  body.admin-workspace #historyView .history-filters select { height: 40px; }
  body.admin-workspace .history-records-panel {
    order: 3;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    margin: 0 22px;
    overflow: hidden;
    border: 1px solid var(--review-line);
    border-radius: 14px;
    background: #fff;
  }
  body.admin-workspace .history-records-heading {
    display: flex;
    flex: 0 0 auto;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px 8px;
  }
  body.admin-workspace .history-records-heading h2 { margin: 0; color: var(--review-ink); font-size: 17px; }
  body.admin-workspace .history-records-heading p { margin: 0; font-size: 11px; }
  body.admin-workspace .history-records-scroll {
    flex: 1 1 auto;
    min-height: 72px;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 0 10px 9px;
    scrollbar-color: #a8b47b #f1f3ec;
    scrollbar-width: thin;
  }
  body.admin-workspace .history-records-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
  body.admin-workspace .history-records-scroll::-webkit-scrollbar-thumb { border: 2px solid #f1f3ec; border-radius: 10px; background: #a8b47b; }
  body.admin-workspace #historyList { display: block; max-height: none; min-height: 0; margin: 0; padding: 0; overflow: visible; }
  body.admin-workspace #historyList > .history-group { margin: 5px 0 8px; border: 1px solid #dfe5e9; border-radius: 10px; background: #fff; }
  body.admin-workspace #historyList > .history-group > summary { min-height: 41px; padding: 8px 12px; background: linear-gradient(90deg,#eef2df,#f6f7f4); }
  body.admin-workspace #historyList > .history-group > summary strong { font-size: 13px; }
  body.admin-workspace #historyList > .history-group > summary span { color: #637086; font-size: 11px; white-space: nowrap; }
  body.admin-workspace .history-group-items { display: block; padding: 0 9px 8px; }
  body.admin-workspace .history-table-head,
  body.admin-workspace .history-table-row {
    display: grid;
    grid-template-columns: minmax(90px,.75fr) minmax(155px,1.25fr) minmax(180px,1.45fr) minmax(130px,.85fr) minmax(125px,.9fr) minmax(155px,1.2fr);
    align-items: center;
    gap: 10px;
  }
  body.admin-workspace .history-table-head { position: sticky; top: 0; z-index: 1; min-height: 34px; padding: 0 9px; background: #f1f3f5; color: #4c5869; font-size: 11px; font-weight: 700; }
  body.admin-workspace .history-table-row { min-height: 43px; padding: 5px 9px; border-top: 1px solid #e4e8eb; font-size: 11px; }
  body.admin-workspace .history-table-cell { min-width: 0; overflow-wrap: anywhere; }
  body.admin-workspace .history-table-cell strong,
  body.admin-workspace .history-table-cell small { display: block; }
  body.admin-workspace .history-table-cell strong { color: var(--review-ink); font-size: 11px; }
  body.admin-workspace .history-table-cell small { margin-top: 3px; color: #778195; font-size: 9px; line-height: 1.35; }
  body.admin-workspace .history-status .history-result { display: inline-flex; padding: 5px 9px; font-size: 10px; }
  body.admin-workspace .history-observations .delivery-log { margin: 3px 0 0; }
  body.admin-workspace .history-observations .delivery-log > summary { color: var(--review-olive); font-size: 10px; }
  body.admin-workspace .history-report-footer { position: sticky; bottom: 0; flex: 0 0 auto; grid-template-columns:minmax(190px,1fr) minmax(130px,.45fr) minmax(170px,.6fr) auto; gap: 10px; margin: 0; padding: 10px 14px; border: 0; border-top: 1px solid var(--review-line); border-radius: 0; background: #fff; }
  body.admin-workspace .history-report-footer .report-copy strong { font-size: 12px; }
  body.admin-workspace .history-report-footer .report-copy span { font-size: 10px; }
  body.admin-workspace .history-report-footer label { gap: 4px; font-size: 10px; }
  body.admin-workspace .history-report-footer input,
  body.admin-workspace .history-report-footer select,
  body.admin-workspace .history-report-footer .button { height: 38px; }
  body.admin-workspace #historyView > .history-mileage-panel { order: 4; flex: 0 0 auto; margin: 8px 22px 0; }
}

/* Route stop controls: keep the six-dot drag handle and stop number side by side,
   with comfortable inset around the move buttons. */
body.admin-workspace .planner-stop {
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px 16px;
}
body.admin-workspace .planner-grip {
  flex-direction: row;
  justify-content: flex-start;
  gap: 9px;
  min-width: 0;
}
body.admin-workspace .planner-grip-dots {
  display: grid;
  grid-template-columns: repeat(2, 4px);
  grid-template-rows: repeat(3, 4px);
  gap: 3px;
  flex: 0 0 auto;
  padding: 5px 2px;
  border-radius: 6px;
  cursor: grab;
}
body.admin-workspace .planner-grip-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #718096;
}
body.admin-workspace .planner-grip-dots:hover { background: #eef2e6; }
body.admin-workspace .planner-stop .stop-number {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
}
body.admin-workspace .planner-moves {
  justify-content: flex-end;
  gap: 9px;
  padding: 0 4px 0 12px;
}
body.admin-workspace .planner-moves .button { min-width: 82px; }
@media (max-width: 700px) {
  body.admin-workspace .planner-stop {
    grid-template-columns: 64px minmax(0, 1fr);
    padding: 13px 12px;
  }
  body.admin-workspace .planner-moves {
    grid-column: 2;
    justify-content: flex-start;
    padding: 5px 0 0;
  }
}

/* Dashboard route card includes a Google proposal panel before its action bar.
   Give all five pieces an explicit track so the action cannot fall onto a stray row. */
@media screen and (min-width: 901px) {
  body.admin-workspace .dash-route {
    grid-template-columns:minmax(150px,.9fr) minmax(165px,1fr) minmax(150px,1fr) minmax(190px,1.1fr) minmax(100px,auto);
  }
  body.admin-workspace .dash-google { min-width:0; margin-top:0; }
  body.admin-workspace .dash-route-footer { justify-content:flex-end; padding-right:4px; }
}
@media screen and (max-width: 900px) {
  body.admin-workspace .dash-route { grid-template-columns:minmax(0,1fr) auto; }
  body.admin-workspace .dash-route-head { grid-column:1/-1; grid-row:1; }
  body.admin-workspace .dash-route-person { grid-column:1/-1; grid-row:2; }
  body.admin-workspace .dash-route-progress { grid-column:1; grid-row:3; }
  body.admin-workspace .dash-route-footer {
    grid-column:2;
    grid-row:3;
    justify-self:end;
    align-self:center;
    justify-content:flex-end;
    padding:0 8px 0 12px;
  }
  body.admin-workspace .dash-google { grid-column:1/-1; grid-row:4; min-width:0; margin-top:0; }
}
@media screen and (max-width: 540px) {
  body.admin-workspace .dash-route { grid-template-columns:minmax(0,1fr); }
  body.admin-workspace .dash-route-head,
  body.admin-workspace .dash-route-person,
  body.admin-workspace .dash-route-progress,
  body.admin-workspace .dash-route-footer,
  body.admin-workspace .dash-google { grid-column:1; }
  body.admin-workspace .dash-route-head { grid-row:1; }
  body.admin-workspace .dash-route-person { grid-row:2; }
  body.admin-workspace .dash-route-progress { grid-row:3; }
  body.admin-workspace .dash-route-footer { grid-row:4; justify-self:stretch; padding:0 8px; }
  body.admin-workspace .dash-google { grid-row:5; }
}

/* Encabezado de la vista del conductor: título legible y selector bien agrupado. */
body:has(#driverView:not(.hidden)) .driver-toolbar {
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(190px,240px);
  align-items:center;
  gap:24px;
  min-height:112px;
  padding:20px 24px;
}
body:has(#driverView:not(.hidden)) .driver-toolbar>div { min-width:0; }
body:has(#driverView:not(.hidden)) .driver-toolbar .eyebrow { margin:0 0 5px; color:#667d2e; font-size:11px; letter-spacing:.16em; }
body:has(#driverView:not(.hidden)) .driver-toolbar h2 { display:flex; align-items:center; gap:11px; margin:0 0 6px; color:#273247; font-size:24px; line-height:1.15; letter-spacing:-.035em; }
body:has(#driverView:not(.hidden)) .driver-title-icon { display:block; width:38px; height:38px; flex:0 0 38px; padding:6px; border-radius:11px; background:#eef3e2; color:#607a2b; }
body:has(#driverView:not(.hidden)) .driver-toolbar .muted { max-width:720px; color:#69758a; font-size:14px; line-height:1.45; }
body:has(#driverView:not(.hidden)) .driver-toolbar label { display:grid; gap:7px; min-width:0; color:#526078; font-size:12px; font-weight:700; }
body:has(#driverView:not(.hidden)) .driver-toolbar select { width:100%; min-height:44px; padding:0 12px; border-color:#d8dfd2; border-radius:10px; background:#fbfcf8; color:#283349; font-size:14px; font-weight:650; }
@media screen and (max-width:760px) {
  body:has(#driverView:not(.hidden)) .driver-toolbar { grid-template-columns:minmax(0,1fr); gap:11px; min-height:0; margin:0 12px 10px; padding:15px 17px; border:1px solid #dfe4d8; border-radius:14px; background:#fff; color:#263044; }
  body:has(#driverView:not(.hidden)) .driver-toolbar>div { display:block; }
  body:has(#driverView:not(.hidden)) .driver-toolbar .eyebrow,
  body:has(#driverView:not(.hidden)) .driver-toolbar .muted { display:block; }
  body:has(#driverView:not(.hidden)) .driver-toolbar .eyebrow { margin-bottom:4px; font-size:10px; }
  body:has(#driverView:not(.hidden)) .driver-toolbar h2 { justify-content:flex-start; margin:0 0 5px; color:#273247; font-size:21px; }
  body:has(#driverView:not(.hidden)) .driver-title-icon { width:34px; height:34px; flex-basis:34px; }
  body:has(#driverView:not(.hidden)) .driver-toolbar .muted { font-size:12px; }
  body:has(#driverView:not(.hidden)) .driver-toolbar label { grid-template-columns:1fr; gap:5px; color:#526078; font-size:11px; }
  body:has(#driverView:not(.hidden)) .driver-toolbar select { min-height:42px; max-width:none; border-color:#d8dfd2; background:#fbfcf8; font-size:14px; }
}

@media screen and (min-width: 901px) and (max-width: 1250px) {
  body.admin-workspace #historyView .history-filters { grid-template-columns: repeat(3,minmax(0,1fr)); }
  body.admin-workspace .history-table-head,
  body.admin-workspace .history-table-row { grid-template-columns:minmax(85px,.7fr) minmax(140px,1.1fr) minmax(150px,1.2fr) minmax(120px,.8fr) minmax(115px,.8fr) minmax(130px,1fr); gap:7px; }
}
@media screen and (max-width: 900px) {
  body.admin-workspace #historyView { height:auto; min-height:0; max-height:none; overflow:visible; }
  body.admin-workspace .history-records-panel { display:block; margin:0 16px; overflow:visible; }
  body.admin-workspace .history-records-scroll { max-height:60vh; min-height:180px; }
  body.admin-workspace .history-table-head { display:none; }
  body.admin-workspace .history-table-row { grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; gap:8px; }
  body.admin-workspace .history-table-cell::before { display:block; margin-bottom:3px; color:#778195; content:attr(data-label); font-size:9px; font-weight:700; }
  body.admin-workspace .history-report-footer { position:static; grid-template-columns:repeat(2,minmax(0,1fr)); }
  body.admin-workspace .history-report-footer .report-copy,
  body.admin-workspace .history-report-footer .button { grid-column:1/-1; }
}

@media screen and (min-width: 901px) and (max-width: 1220px) {
  body.admin-workspace #fleetOverview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.admin-workspace #deliveryMapPage .delivery-map-layout { grid-template-columns: minmax(0, 1fr) minmax(280px, .65fr); }
}

/* Asignación Express: bandejas de selección separadas y controles visibles. */
@media screen and (min-width: 901px) {
  body.admin-workspace:has([data-admin-section="dispatches"].active) .heading-row { min-height:0; margin:0 0 12px; padding:0; justify-content:flex-end; }
  body.admin-workspace:has([data-admin-section="dispatches"].active) .heading-row > div:first-child { display:none; }
  body.admin-workspace #dispatchOperations > .route-assignment-panel { order: 0; padding: 0; overflow: hidden; }
  body.admin-workspace #dispatchOperations > .planner-panel { order: 5; }
  body.admin-workspace .express-assignment-heading { display:flex; align-items:center; justify-content:space-between; gap:20px; padding:18px 22px 10px; }
  body.admin-workspace .express-assignment-heading .eyebrow { margin:0 0 4px; font-size:10px; font-weight:750; letter-spacing:.16em; }
  body.admin-workspace .express-assignment-heading h2 { margin:0; color:var(--review-ink); font-size:23px; }
  body.admin-workspace .express-assignment-heading .muted { margin:5px 0 0; font-size:12px; }
  body.admin-workspace .express-assignment-message { margin:0; color:var(--review-olive); font-size:12px; }
  body.admin-workspace .express-assignment-message:not(:empty) { padding:9px 12px; border:1px solid #c8e0bb; border-radius:9px; background:#e8f5df; color:#31542c; font-weight:700; }
  body.admin-workspace .express-route-meta { display:grid; grid-template-columns:minmax(0,1.35fr) minmax(0,1fr); gap:16px; align-items:stretch; padding:16px 18px; margin:0 16px 14px; border:1px solid var(--review-line); border-radius:13px; background:#f8f9fa; }
  body.admin-workspace .express-context-fields,body.admin-workspace .express-crew-fields { display:grid; gap:12px; align-items:end; min-width:0; }
  body.admin-workspace .express-context-fields { grid-template-columns:minmax(150px,.8fr) minmax(150px,.8fr) minmax(220px,1.25fr); }
  body.admin-workspace .express-crew-fields { grid-template-columns:minmax(180px,1fr) minmax(170px,.9fr); padding-left:16px; border-left:1px solid #dfe4ea; }
  body.admin-workspace .express-route-meta label,body.admin-workspace .express-date-meta { display:flex; flex-direction:column; gap:7px; min-width:0; color:#4d596d; font-size:13px; font-weight:700; }
  body.admin-workspace .express-route-meta input,body.admin-workspace .express-route-meta select { width:100%; height:50px; min-width:0; padding:0 13px; border:1px solid #cdd5df; border-radius:10px; background:white; color:var(--review-ink); font:inherit; font-size:15px; }
  body.admin-workspace .express-date-meta strong { display:flex; align-items:center; height:50px; padding:0 13px; border:1px solid #cdd5df; border-radius:10px; background:white; color:var(--review-ink); font-size:16px; }
  body.admin-workspace #expressAssignmentShift select:disabled { opacity:1; background:#f1f3ed; color:#3e4a31; }
  body.admin-workspace #expressStopChoices { margin:0 16px; }
  body.admin-workspace .express-count-cards { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin-bottom:14px; }
  body.admin-workspace .express-count-cards article { display:grid; grid-template-columns:40px 1fr; column-gap:10px; align-content:center; min-height:76px; padding:12px 15px; border:1px solid var(--review-line); border-radius:13px; background:#fafbfc; }
  body.admin-workspace .express-count-cards article::before { grid-row:span 2; align-self:center; display:grid; place-items:center; width:38px; height:38px; border-radius:11px; background:#edf0f4; color:#3a4659; content:'▣'; font-size:18px; }
  body.admin-workspace .express-count-cards article.is-active { border-color:#a6b56b; background:#f3f7e9; }
  body.admin-workspace .express-count-cards article.is-active::before { background:#e2ecc8; color:#566a2d; content:'✓'; font-weight:800; }
  body.admin-workspace .express-count-cards article span { color:var(--review-ink); font-size:13px; font-weight:750; }
  body.admin-workspace .express-count-cards article strong { color:var(--review-ink); font-size:22px; line-height:1.05; }
  body.admin-workspace .express-count-cards article small { grid-column:2; color:#69758a; font-size:10px; }
  body.admin-workspace .express-assignment-columns { display:grid; grid-template-columns:minmax(0,1fr) 142px minmax(0,1fr); gap:12px; align-items:stretch; }
  body.admin-workspace .express-available-list,.express-selected-list { min-width:0; overflow:hidden; border:1px solid var(--review-line); border-radius:13px; background:#fff; }
  body.admin-workspace .express-available-list>header,.express-selected-list>header { display:flex; align-items:center; justify-content:space-between; gap:9px; min-height:46px; padding:10px 14px; background:#778f3c; color:#fff; }
  body.admin-workspace .express-selected-list>header { background:#343d53; }
  body.admin-workspace .express-available-list>header strong,.express-selected-list>header strong { font-size:14px; }
  body.admin-workspace .express-available-list>header span,.express-selected-list>header span { font-size:11px; }
  body.admin-workspace .express-list-tools { padding:9px 10px; border-bottom:1px solid #edf0f2; }
  body.admin-workspace .express-list-tools input { width:100%; height:38px; padding:0 12px; border:1px solid #d6dce5; border-radius:9px; color:var(--review-ink); font:inherit; font-size:11px; }
  body.admin-workspace .express-choice-scroll,.express-selected-scroll { max-height:min(39vh,400px); min-height:230px; overflow:auto; overscroll-behavior:contain; padding:0 9px 10px; scrollbar-color:#a8b47b #f1f3ec; scrollbar-width:thin; }
  body.admin-workspace .express-choice-head { display:grid; grid-template-columns:85px minmax(0,1fr) 82px; gap:9px; position:sticky; top:0; z-index:1; padding:9px 8px; background:#f0f2f5; color:#414d60; font-size:10px; font-weight:750; }
  body.admin-workspace .express-stop-choice { display:grid!important; grid-template-columns:22px 78px minmax(0,1fr) 78px; gap:8px; align-items:center; min-height:48px; margin:0; padding:7px 8px; border-bottom:1px solid #e8ebef; color:#2d384b; font-size:11px; cursor:pointer; }
  body.admin-workspace .express-stop-choice input { width:16px; height:16px; accent-color:#6d8535; }
  body.admin-workspace .express-stop-choice strong { font-size:11px; }
  body.admin-workspace .express-stop-choice span { min-width:0; font-weight:650; }
  body.admin-workspace .express-stop-choice small,.express-selected-item small,.express-already-list small { display:block; margin-top:3px; overflow:hidden; color:#68758a; font-size:9px; font-weight:400; text-overflow:ellipsis; white-space:nowrap; }
  body.admin-workspace .express-stop-choice em { justify-self:end; padding:4px 7px; border-radius:20px; background:#eef0f3; color:#586477; font-size:9px; font-style:normal; }
  body.admin-workspace .express-add-button { align-self:center; min-height:62px; padding:10px; border:0; border-radius:11px; background:#748d39; color:#fff; font:inherit; font-size:13px; font-weight:750; cursor:pointer; }
  body.admin-workspace .express-add-button span { display:block; font-size:22px; line-height:1; }
  body.admin-workspace .express-add-button:disabled { background:#c9d0bb; cursor:not-allowed; }
  body.admin-workspace .express-selected-item { display:grid; grid-template-columns:30px minmax(0,1fr) auto; align-items:center; gap:8px; min-height:62px; margin:9px 0; padding:9px; border:1px solid #dfe4ea; border-radius:10px; background:#fff; }
  body.admin-workspace .express-sequence { display:grid; place-items:center; width:27px; height:27px; border-radius:50%; background:#edf2df; color:#52672a; font-weight:800; }
  body.admin-workspace .express-selected-item>div { min-width:0; }
  body.admin-workspace .express-selected-item>div strong { display:block; color:#273248; font-size:11px; }
  body.admin-workspace .express-selected-item .button { padding:6px 8px; font-size:10px; }
  body.admin-workspace .express-selection-empty,.express-empty { padding:22px 12px; color:#788397; font-size:11px; text-align:center; }
  body.admin-workspace .express-already-list { margin-top:18px; border-radius:10px; background:#f1f3f6; }
  body.admin-workspace .express-already-list summary { display:flex; justify-content:space-between; gap:8px; padding:12px; color:#2d384b; font-weight:750; cursor:pointer; }
  body.admin-workspace .express-already-list summary span { color:#68758a; font-size:10px; font-weight:500; }
  body.admin-workspace .express-already-list>div { padding:0 10px 10px; }
  body.admin-workspace .express-already-list article { padding:8px 4px; border-top:1px solid #dfe4ea; font-size:10px; }
  body.admin-workspace .express-assignment-submit { position:sticky; bottom:12px; z-index:2; display:flex; align-items:center; justify-content:space-between; gap:15px; margin:12px 16px 14px; padding:14px 18px; border:1px solid rgba(255,255,255,.12); border-radius:13px; background:#343d53; color:#fff; box-shadow:0 8px 22px rgba(28,39,60,.12); }
  body.admin-workspace .express-assignment-submit>span { font-size:12px; }
  body.admin-workspace .express-assignment-submit .button { min-height:42px; padding:10px 20px; background:#829d42; border-color:#829d42; }
  body.admin-workspace .express-nonexpress-note { padding:20px; border:1px dashed #d8dee5; border-radius:12px; color:#657086; font-size:12px; text-align:center; }
}
@media screen and (max-width: 900px) {
  body.admin-workspace .express-assignment-heading { padding:16px; }
  body.admin-workspace .express-route-meta { display:grid; grid-template-columns:1fr; gap:12px; padding:12px; margin:0 12px 12px; }
  body.admin-workspace .express-context-fields { grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; }
  body.admin-workspace .express-crew-fields { grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; padding:12px 0 0; border-top:1px solid #dfe4ea; border-left:0; }
  body.admin-workspace .express-route-meta label { min-width:0; }
  body.admin-workspace #expressStopChoices { margin:0 12px; }
  body.admin-workspace .express-count-cards { display:grid; grid-template-columns:1fr; gap:7px; }
  body.admin-workspace .express-count-cards article { min-height:60px; }
  body.admin-workspace .express-assignment-columns { display:grid; grid-template-columns:1fr; gap:9px; }
  body.admin-workspace .express-add-button { justify-self:center; min-width:180px; min-height:42px; }
  body.admin-workspace .express-add-button span { display:inline; margin-left:6px; }
  body.admin-workspace .express-choice-scroll,.express-selected-scroll { max-height:38vh; min-height:150px; }
  body.admin-workspace .express-assignment-submit { display:flex; flex-direction:column; align-items:stretch; gap:10px; margin:12px 12px 12px; padding:14px; border:1px solid rgba(255,255,255,.12); border-radius:12px; background:#343d53; color:#fff; box-shadow:0 6px 18px rgba(28,39,60,.1); }
  body.admin-workspace .express-assignment-submit .button { width:100%; }
  body.admin-workspace .express-assignment-message { margin:0 16px 10px; }
}
@media screen and (max-width: 560px) {
  body.admin-workspace .express-context-fields { grid-template-columns:repeat(2,minmax(0,1fr)); }
  body.admin-workspace .express-context-fields label:last-child { grid-column:1 / -1; }
  body.admin-workspace .express-route-meta input,body.admin-workspace .express-route-meta select,body.admin-workspace .express-date-meta strong { height:46px; font-size:14px; }
}
@media screen and (max-width: 380px) {
  body:has(#driverView:not(.hidden)) .brand { left:calc(50% - 20px); }
}

/* Vista móvil del chofer inspirada en la referencia de Tres Olivos. */
@media screen and (max-width: 760px) {
  body:has(#driverView:not(.hidden)) { background:#f1f2f5; }
  body:has(#driverView:not(.hidden)) .topbar { position:sticky; top:0; z-index:10; height:58px; justify-content:center; padding:0 8px; border-bottom:1px solid #e4e7e1; background:#fff; box-shadow:0 2px 8px #14203912; }
  body:has(#driverView:not(.hidden)) .brand { position:absolute; left:50%; min-width:0; justify-content:center; transform:translateX(-50%); color:#fff; }
  body:has(#driverView:not(.hidden)) .brand-logo { display:block; width:max(104px,min(154px,calc(50vw - 76px))); height:40px; padding:0; border-radius:0; background:transparent; object-fit:contain; filter:none; }
  body:has(#driverView:not(.hidden)) .top-actions { position:absolute; right:8px; gap:4px; }
  body:has(#driverView:not(.hidden)) .top-actions .button { min-height:32px; padding:5px 6px; border:1px solid #627a31; border-radius:8px; background:#718a35; color:#fff; font-size:9px; font-weight:700; }
  body:has(#driverView:not(.hidden)) .shell { width:100%; max-width:none; padding:0 0 24px; }
  body:has(#driverView:not(.hidden)) .shell > .heading-row { display:none; }
  body:has(#driverView:not(.hidden)) .date-toolbar { display:flex; align-items:center; gap:10px; margin:10px 12px; padding:9px 11px; border:1px solid #e0e3e9; border-radius:11px; background:#fff; }
  body:has(#driverView:not(.hidden)) .date-toolbar label { display:flex; align-items:center; gap:8px; color:#596477; font-size:12px; font-weight:700; white-space:nowrap; }
  body:has(#driverView:not(.hidden)) .date-toolbar input { width:100%; min-width:0; height:38px; padding:0 8px; font-size:13px; }
  body:has(#driverView:not(.hidden)) .date-toolbar .date-actions,body:has(#driverView:not(.hidden)) .date-toolbar #dateSummary { display:none; }
  body:has(#driverView:not(.hidden)) #driverView { display:flex; flex-direction:column; gap:0; }
  body:has(#driverView:not(.hidden)) .driver-toolbar { order:0; display:flex; align-items:center; flex-direction:row; justify-content:space-between; gap:10px; min-height:64px; margin:0 0 10px; padding:12px 16px; border:0; border-radius:0; background:#343d53; color:#fff; box-shadow:none; }
  body:has(#driverView:not(.hidden)) .driver-toolbar>div { display:flex; align-items:center; min-width:0; }
  body:has(#driverView:not(.hidden)) .driver-toolbar .eyebrow,body:has(#driverView:not(.hidden)) .driver-toolbar .muted { display:none; }
  body:has(#driverView:not(.hidden)) .driver-toolbar h2 { display:flex; align-items:center; gap:10px; margin:0; color:#fff; font-size:20px; letter-spacing:-.02em; }
  body:has(#driverView:not(.hidden)) .driver-title-icon { display:block; width:28px; height:28px; flex:0 0 auto; color:#fff; }
  body:has(#driverView:not(.hidden)) .driver-toolbar label { display:flex; align-items:center; gap:6px; margin:0; color:#dbe0ea; font-size:10px; }
  body:has(#driverView:not(.hidden)) .driver-toolbar select { width:auto; max-width:120px; min-height:38px; border-color:#737c8f; background:#fff; color:#273248; font-size:12px; }
  body:has(#driverView:not(.hidden)) .driver-route-picker { order:1; display:grid; grid-template-columns:1fr; gap:5px; margin:0 12px 10px; padding:12px 14px; border-radius:12px; background:#fff; }
  body:has(#driverView:not(.hidden)) .driver-route-picker label { display:flex; align-items:center; gap:9px; color:#5a6678; font-size:12px; font-weight:700; }
  body:has(#driverView:not(.hidden)) .driver-route-picker select { min-height:44px; border-color:#e1e4e9; border-radius:10px; font-size:13px; }
  body:has(#driverView:not(.hidden)) #driverRouteDetails { margin:0; color:#536174; font-size:12px; }
  body:has(#driverView:not(.hidden)) #expressAvailable { order:2; margin:0 12px 10px; padding:14px; }
  body:has(#driverView:not(.hidden)) #nextRouteNotice { order:2; margin:0 12px 10px; padding:12px; border-radius:11px; background:#edf2df; color:#43572a; }
  body:has(#driverView:not(.hidden)) #nextRouteNotice .route-status-copy { min-width:0; }
  body:has(#driverView:not(.hidden)) #nextRouteNotice .button { min-height:44px; }
  body:has(#driverView:not(.hidden)) .driver-trip-overview { order:3; display:block; margin:0 12px 12px; padding:14px; border:1px solid #e3e6eb; border-radius:13px; background:#fff; box-shadow:0 4px 14px #1d293c0a; }
  body:has(#driverView:not(.hidden)) .driver-trip-overview.hidden { display:none; }
  body:has(#driverView:not(.hidden)) .driver-overview-meta { display:flex; align-items:center; flex-wrap:wrap; gap:8px; padding:4px 0 12px; border-bottom:1px solid #e5e8ed; color:#4d596c; font-size:12px; }
  body:has(#driverView:not(.hidden)) .driver-overview-meta>span:not(:first-child) { padding-left:9px; border-left:1px solid #d9dee6; }
  body:has(#driverView:not(.hidden)) .driver-route-badge { padding:6px 9px; border-radius:8px; background:#e8f1df; color:#344c2b; font-weight:800; }
  body:has(#driverView:not(.hidden)) .driver-progress-heading { display:flex; justify-content:space-between; gap:9px; margin:12px 0 7px; color:#30394b; font-size:13px; }
  body:has(#driverView:not(.hidden)) .driver-progress-track { height:12px; overflow:hidden; border-radius:20px; background:#e2e4e7; }
  body:has(#driverView:not(.hidden)) .driver-progress-track span { display:block; height:100%; border-radius:inherit; background:#78913b; transition:width .2s ease; }
  body:has(#driverView:not(.hidden)) .driver-next-stop { display:grid; gap:6px; margin-top:13px; padding:13px; border:1px solid #e0e8d1; border-radius:12px; background:#f4f7ec; }
  body:has(#driverView:not(.hidden)) .driver-next-stop p { margin:0; color:#526b2a; font-size:13px; font-weight:800; }
  body:has(#driverView:not(.hidden)) .driver-next-stop strong { color:#202837; font-size:18px; }
  body:has(#driverView:not(.hidden)) .driver-next-stop>span { color:#4d596b; font-size:14px; line-height:1.35; }
  body:has(#driverView:not(.hidden)) .driver-next-stop .button { min-height:46px; margin-top:5px; font-size:15px; font-weight:750; }
  body:has(#driverView:not(.hidden)) .driver-route-complete { margin:12px 0 0; color:#4c672c; font-weight:700; }
  body:has(#driverView:not(.hidden)) #driverList { order:4; margin:0; padding:0 12px; }
  body:has(#driverView:not(.hidden)) #driverList::before { content:'Paradas del recorrido'; display:block; margin:2px 2px 8px; color:#263044; font-size:16px; font-weight:800; }
  body:has(#driverView:not(.hidden)) .driver-list .dispatch-card { display:grid; grid-template-columns:32px minmax(0,1fr); gap:7px 9px; margin:0 0 8px; padding:10px; border:1px solid #e1e4e9; border-radius:11px; background:#fff; box-shadow:none; }
  body:has(#driverView:not(.hidden)) .driver-list .stop-number { grid-column:1; grid-row:1 / span 3; display:grid; place-items:center; width:30px; height:30px; border-radius:50%; background:#edf0f4; color:#344056; font-weight:800; }
  body:has(#driverView:not(.hidden)) .driver-list .dispatch-main { grid-column:2; min-width:0; }
  body:has(#driverView:not(.hidden)) .driver-list .invoice-line { color:#667287; font-size:10px; line-height:1.4; }
  body:has(#driverView:not(.hidden)) .driver-list .dispatch-name { margin:3px 0; color:#202838; font-size:15px; font-weight:800; }
  body:has(#driverView:not(.hidden)) .driver-list .dispatch-address { color:#5a6678; font-size:12px; line-height:1.4; }
  body:has(#driverView:not(.hidden)) .driver-list .dispatch-items { grid-column:2; }
  body:has(#driverView:not(.hidden)) .driver-list .card-actions { grid-column:2; display:grid; grid-template-columns:.7fr 1fr; gap:8px; }
  body:has(#driverView:not(.hidden)) .driver-list .card-actions .button { display:flex; min-height:42px; align-items:center; justify-content:center; }
  body:has(#driverView:not(.hidden)) .driver-list .card-actions [data-proof] { min-height:46px; font-size:14px; font-weight:750; }
  body:has(#driverView:not(.hidden)) #emptyDriver { order:5; margin:0 12px; }
  body:has(#driverView:not(.hidden)) #fleetDriver { order:6; margin:10px 12px; padding:14px; }
  body:has(#driverView:not(.hidden)) #fleetDriver h2 { font-size:16px; }
  body:has(#driverView:not(.hidden)) .footer { display:none; }

  body:has(#driverView:not(.hidden)) #proofDialog { position:fixed; inset:0; width:100vw; max-width:none; height:100dvh; max-height:100dvh; margin:0; padding:0; overflow-x:hidden; overflow-y:auto; border:0; border-radius:0; background:#f5f6f8; }
  body:has(#driverView:not(.hidden)) #proofDialog form { display:flex; flex-direction:column; min-height:100%; gap:10px; padding:0 14px 18px; }
  body:has(#driverView:not(.hidden)) #proofDialog .dialog-heading { position:sticky; top:0; z-index:2; align-items:center; margin:0 -14px 2px; padding:14px 16px; background:#343d53; color:#fff; }
  body:has(#driverView:not(.hidden)) #proofDialog .dialog-heading .eyebrow { display:none; }
  body:has(#driverView:not(.hidden)) #proofDialog .dialog-heading h2 { margin:0; color:#fff; font-size:20px; }
  body:has(#driverView:not(.hidden)) #proofDialog .close-button { color:#fff; font-size:29px; }
  body:has(#driverView:not(.hidden)) .proof-stop-summary { display:grid; gap:0; padding:4px 12px; border:1px solid #dfe3e9; border-radius:11px; background:#fff; }
  body:has(#driverView:not(.hidden)) .proof-stop-summary>div { display:grid; grid-template-columns:76px minmax(0,1fr); gap:8px; padding:8px 0; border-bottom:1px solid #e7e9ed; }
  body:has(#driverView:not(.hidden)) .proof-stop-summary>div:last-child { border-bottom:0; }
  body:has(#driverView:not(.hidden)) .proof-stop-summary span { color:#667286; font-size:12px; }
  body:has(#driverView:not(.hidden)) .proof-stop-summary strong { color:#202838; font-size:14px; overflow-wrap:anywhere; }
  body:has(#driverView:not(.hidden)) #proofDialog form>label { margin:0; gap:6px; color:#30394b; font-size:13px; font-weight:750; }
  body:has(#driverView:not(.hidden)) #proofDialog form>label input:not([type=file]),body:has(#driverView:not(.hidden)) #proofDialog form>label select,body:has(#driverView:not(.hidden)) #proofDialog textarea { min-height:44px; padding:10px 12px; border:1px solid #d4d9e1; border-radius:10px; background:#fff; font-size:14px; }
  body:has(#driverView:not(.hidden)) #proofDialog .proof-grid { display:flex; flex-direction:column; gap:10px; margin:0; }
  body:has(#driverView:not(.hidden)) #proofDialog .signature-heading { color:#30394b; font-size:13px; font-weight:750; }
  body:has(#driverView:not(.hidden)) #proofDialog #signatureCanvas { height:74px; }
  body:has(#driverView:not(.hidden)) #proofDialog .photo-picker { order:-1; }
  body:has(#driverView:not(.hidden)) #proofDialog .photo-box { display:flex; flex-direction:row; gap:8px; height:52px; border:1.5px solid #6f8735; border-radius:10px; background:#fff; color:#566f2b; font-size:20px; font-weight:750; }
  body:has(#driverView:not(.hidden)) #proofDialog .photo-box small { color:#566f2b; font-size:15px; font-weight:750; }
  body:has(#driverView:not(.hidden)) #proofDialog .gps-row { display:flex; flex-wrap:wrap; gap:8px; border:1px solid #e1e5e9; border-radius:10px; background:#fff; font-size:12px; }
  body:has(#driverView:not(.hidden)) #proofDialog .gps-row .button { min-height:40px; }
  body:has(#driverView:not(.hidden)) #proofDialog .dialog-footer { position:sticky; bottom:0; z-index:2; display:grid; grid-template-columns:1fr; gap:7px; margin:0 -14px -18px; padding:10px 14px max(12px,env(safe-area-inset-bottom)); background:#f5f6f8; }
  body:has(#driverView:not(.hidden)) #proofDialog #cancelProof { min-height:38px; order:2; }
  body:has(#driverView:not(.hidden)) #proofDialog .dialog-footer .button-primary { min-height:50px; background:#718a35; border-color:#718a35; font-size:16px; font-weight:800; }
  body:has(#driverView:not(.hidden)) #proofDialog.incident-mode .dialog-heading { background:#343d53; }
}

/* Dashboard: resumen compacto y rutas en una sola línea como la referencia. */
@media screen and (min-width: 901px) {
  body.admin-workspace:has([data-admin-section="dashboard"].active) .shell { display:grid; grid-template-columns:minmax(0,1fr) 270px; align-items:center; column-gap:20px; }
  body.admin-workspace:has([data-admin-section="dashboard"].active) .heading-row { grid-column:1; margin:0 0 14px; }
  body.admin-workspace:has([data-admin-section="dashboard"].active) .heading-row .eyebrow,
  body.admin-workspace:has([data-admin-section="dashboard"].active) .heading-row #pageSubtitle { display:none; }
  body.admin-workspace:has([data-admin-section="dashboard"].active) .heading-row h1 { font-size:40px; }
  body.admin-workspace:has([data-admin-section="dashboard"].active) .date-toolbar { grid-column:2; width:270px; display:grid; grid-template-columns:1fr; gap:6px; margin:0 0 14px; padding:9px 11px; box-shadow:none; }
  body.admin-workspace:has([data-admin-section="dashboard"].active) .date-toolbar label { gap:3px; font-size:10px; }
  body.admin-workspace:has([data-admin-section="dashboard"].active) .date-toolbar input { height:37px; padding:7px 10px; }
  body.admin-workspace:has([data-admin-section="dashboard"].active) .date-toolbar .date-actions { display:flex; gap:6px; }
  body.admin-workspace:has([data-admin-section="dashboard"].active) .date-toolbar .date-actions .button { min-height:31px; padding:5px 9px; font-size:10px; }
  body.admin-workspace:has([data-admin-section="dashboard"].active) .date-toolbar #dateSummary { margin:0; font-size:10px; }
  body.admin-workspace:has([data-admin-section="dashboard"].active) #adminView,
  body.admin-workspace:has([data-admin-section="dashboard"].active) #historyView,
  body.admin-workspace:has([data-admin-section="dashboard"].active) #usersView { grid-column:1/-1; min-width:0; }
  body.admin-workspace:has([data-admin-section="dashboard"].active) #deliveryMapDashboard { display:none; }
  body.admin-workspace #operationsDashboard > .dash-heading { display:none; }
  body.admin-workspace .dash-metrics { gap:14px; margin:0 0 20px; }
  body.admin-workspace .dash-metric { display:flex; min-height:104px; align-items:center; justify-content:flex-start; gap:17px; padding:18px; border-radius:13px; box-shadow:0 3px 10px rgba(36,47,67,.08); }
  body.admin-workspace .dash-icon { flex:0 0 auto; padding:0; background:transparent; color:#647d2e; }
  body.admin-workspace .dash-icon svg { width:38px; height:38px; stroke-width:1.8; }
  body.admin-workspace .dash-metric:nth-child(2) .dash-icon { color:#ba850e; }
  body.admin-workspace .dash-metric:nth-child(3) .dash-icon { color:#2176cf; }
  body.admin-workspace .dash-metric:nth-child(4) .dash-icon { color:#548d37; }
  body.admin-workspace .dash-metric:nth-child(5) .dash-icon { color:#c4574e; }
  body.admin-workspace .dash-metric>div { display:grid; gap:3px; justify-items:start; }
  body.admin-workspace .dash-metric>div>span { color:#536076; font-size:14px; font-weight:500; }
  body.admin-workspace .dash-metric>div>strong { color:#273248; font-size:35px; line-height:1; letter-spacing:-.6px; }
  body.admin-workspace .dash-statistics { margin:0 0 11px; border-radius:12px; box-shadow:0 3px 10px rgba(36,47,67,.06); }
  body.admin-workspace .dash-statistics>summary { min-height:67px; padding:13px 18px; background:#fff; }
  body.admin-workspace .dash-statistics>summary>span:first-child strong { font-size:17px; }
  body.admin-workspace .dash-statistics>summary>span:first-child small { display:none; }
  body.admin-workspace .dash-statistics .dash-statistics-content { padding:16px; }
  body.admin-workspace .dash-layout { grid-template-columns:minmax(0,1fr); gap:13px; margin-top:20px; }
  body.admin-workspace .dash-routes { grid-template-columns:minmax(0,1fr); gap:5px; }
  body.admin-workspace .dash-section-head { margin-bottom:10px; }
  body.admin-workspace .dash-route { display:grid; grid-template-columns:minmax(190px,1fr) minmax(190px,1.25fr) minmax(170px,1.1fr) minmax(160px,auto); align-items:center; gap:12px; min-height:76px; padding:10px 12px; border-radius:12px; box-shadow:none; }
  body.admin-workspace .dash-route-head { justify-content:flex-start; gap:8px; }
  body.admin-workspace .dash-route-head>div { display:flex; align-items:center; gap:9px; }
  body.admin-workspace .dash-route-head h3 { margin:0; font-size:14px; }
  body.admin-workspace .dash-route-head .dash-shift { display:inline-block; padding-right:8px; border-right:1px solid #dce1e8; color:#536076; font-size:11px; letter-spacing:0; text-transform:none; white-space:nowrap; }
  body.admin-workspace .dash-route-head h3 { padding:7px 10px; border-radius:8px; background:#e7f1e0; color:#314b2d; white-space:nowrap; }
  body.admin-workspace .dash-route-person { margin:0; padding:0; border:0; gap:7px; color:#465064; }
  body.admin-workspace .dash-route-person svg { width:19px; height:19px; flex:0 0 auto; }
  body.admin-workspace .dash-route-person>div { display:flex; flex-direction:row; align-items:center; gap:9px; }
  body.admin-workspace .dash-route-person strong { font-size:12px; white-space:nowrap; }
  body.admin-workspace .dash-route-person small { display:flex; align-items:center; gap:5px; color:#465064; font-size:12px; white-space:nowrap; }
  body.admin-workspace .dash-route-progress { min-width:0; }
  body.admin-workspace .dash-route-progress .dash-progress-label { margin:0 0 5px; color:#303b50; font-size:12px; }
  body.admin-workspace .dash-route-progress .dash-progress-label strong { display:block; }
  body.admin-workspace .dash-route-progress .dash-progress { height:8px; }
  body.admin-workspace .dash-route-footer { display:flex; align-items:center; gap:7px; margin:0; }
  body.admin-workspace .dash-route-footer>span { display:none; }
  body.admin-workspace .dash-route-footer button { white-space:nowrap; font-size:11px; }
  body.admin-workspace .dash-route-footer .button { padding:8px 10px; }
  body.admin-workspace .dash-pill { font-size:11px; }
  body.admin-workspace .dash-pill.needs-assignment { background:#fff0c2; color:#85590a; }
}
@media screen and (max-width: 900px) {
  body.admin-workspace .dash-route { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; }
  body.admin-workspace .dash-route-head { grid-column:1/-1; }
  body.admin-workspace .dash-route-person { grid-column:1/-1; }
  body.admin-workspace .dash-route-progress { grid-column:1; grid-row:3; }
  body.admin-workspace .dash-route-footer {
    grid-column:2;
    grid-row:3;
    justify-self:end;
    align-self:center;
    justify-content:flex-end;
    padding-right:4px;
  }
}

/* Ajustes de lectura y encuadre para teléfonos estrechos. */
@media screen and (max-width: 760px) {
  body:has(#driverView:not(.hidden)) .topbar {
    display:grid;
    grid-template-columns:minmax(0,1fr);
    grid-template-rows:38px 34px;
    justify-items:center;
    align-content:center;
    gap:5px;
    height:auto;
    min-height:86px;
    padding:7px 12px 8px;
  }
  body:has(#driverView:not(.hidden)) .brand {
    position:static;
    grid-row:1;
    left:auto;
    justify-content:center;
    min-width:0;
    transform:none;
  }
  body:has(#driverView:not(.hidden)) .brand-logo {
    width:min(138px,42vw);
    height:36px;
  }
  body:has(#driverView:not(.hidden)) .top-actions {
    position:static;
    grid-row:2;
    right:auto;
    display:flex;
    justify-content:center;
    align-items:center;
    flex-wrap:wrap;
    width:100%;
    max-width:100%;
    gap:6px;
  }
  body:has(#driverView:not(.hidden)) .top-actions .button {
    min-height:32px;
    padding:5px 10px;
    font-size:10px;
    white-space:nowrap;
  }
  body:has(#driverView:not(.hidden)) .driver-toolbar {
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(128px,.9fr);
    align-items:center;
    gap:8px;
    min-height:68px;
    padding:10px 12px;
  }
  body:has(#driverView:not(.hidden)) .driver-toolbar>div { display:block; min-width:0; }
  body:has(#driverView:not(.hidden)) .driver-toolbar h2 {
    gap:7px;
    font-size:18px;
    line-height:1.1;
    white-space:nowrap;
  }
  body:has(#driverView:not(.hidden)) .driver-title-icon { width:24px; height:24px; }
  body:has(#driverView:not(.hidden)) .driver-toolbar label {
    display:grid;
    grid-template-columns:minmax(0,1fr);
    gap:3px;
    min-width:0;
    font-size:10px;
  }
  body:has(#driverView:not(.hidden)) .driver-toolbar select {
    width:100%;
    min-width:0;
    max-width:none;
    min-height:36px;
    padding:0 7px;
    font-size:12px;
  }
  body:has(#driverView:not(.hidden)) .driver-route-picker {
    gap:7px;
    margin-bottom:8px;
    padding:10px 12px;
  }
  body:has(#driverView:not(.hidden)) .driver-route-picker label {
    display:grid;
    grid-template-columns:minmax(0,1fr);
    gap:6px;
    font-size:12px;
  }
  body:has(#driverView:not(.hidden)) .driver-route-picker select { width:100%; min-width:0; }
  body:has(#driverView:not(.hidden)) #driverRouteDetails { display:none; }
  body:has(#driverView:not(.hidden)) #nextRouteNotice {
    display:flex;
    align-items:center;
    gap:9px;
    margin-bottom:8px;
    padding:9px 12px;
  }
  body:has(#driverView:not(.hidden)) #nextRouteNotice .route-status-copy { flex:1 1 auto; }
  body:has(#driverView:not(.hidden)) #nextRouteNotice .route-status-copy span { font-size:12px; }
  body:has(#driverView:not(.hidden)) #nextRouteNotice .button { flex:0 0 auto; min-height:40px; }
  body:has(#driverView:not(.hidden)) .driver-trip-overview { margin-bottom:9px; padding:11px; }
  body:has(#driverView:not(.hidden)) .driver-overview-meta { gap:6px; padding:2px 0 8px; }
  body:has(#driverView:not(.hidden)) .driver-progress-heading { margin:9px 0 6px; }
  body:has(#driverView:not(.hidden)) .driver-next-stop { gap:5px; margin-top:9px; padding:11px; }
  body:has(#driverView:not(.hidden)) .driver-next-stop strong { font-size:17px; line-height:1.2; }
  body:has(#driverView:not(.hidden)) .driver-next-stop .button { min-height:44px; }
  body:has(#driverView:not(.hidden)) #driverList { padding-inline:10px; }
  body:has(#driverView:not(.hidden)) #driverList::before { margin-bottom:7px; }
}
@media screen and (max-width: 760px) {
  body:has(#driverView:not(.hidden)):has(#driverTripOverview:not(.hidden)) #nextRouteNotice .route-status-copy strong,
  body:has(#driverView:not(.hidden)) #nextRouteNotice:has([data-mileage-action]) .route-status-copy strong { display:none; }
  body:has(#driverView:not(.hidden)) .driver-overview-meta .driver-route-badge,
  body:has(#driverView:not(.hidden)) .driver-overview-meta>span:nth-child(2) { display:none; }
}
@media screen and (max-width: 380px) {
  body:has(#driverView:not(.hidden)) .driver-toolbar { grid-template-columns:minmax(0,1fr); gap:7px; }
  body:has(#driverView:not(.hidden)) .driver-toolbar h2 { justify-content:center; }
  body:has(#driverView:not(.hidden)) .driver-toolbar label { grid-template-columns:auto minmax(0,1fr); align-items:center; }
}

/* Encabezado y fecha alineados con el croquis móvil. */
@media screen and (max-width: 760px) {
  body:has(#driverView:not(.hidden)) .topbar {
    display:flex;
    flex-direction:row;
    justify-content:space-between;
    align-items:center;
    gap:8px;
    min-height:58px;
    height:auto;
    padding:7px 10px;
  }
  body:has(#driverView:not(.hidden)) .brand {
    position:static;
    flex:0 1 auto;
    justify-content:flex-start;
    min-width:0;
    left:auto;
    transform:none;
  }
  body:has(#driverView:not(.hidden)) .brand-logo { width:min(144px,38vw); height:40px; }
  body:has(#driverView:not(.hidden)) .top-actions {
    position:static;
    flex:0 0 auto;
    justify-content:flex-end;
    width:auto;
    max-width:none;
    margin-left:auto;
    gap:4px;
  }
  body:has(#driverView:not(.hidden)) .top-actions .button { padding:5px 7px; font-size:9px; }
  body:has(#driverView:not(.hidden)) .date-toolbar {
    width:auto;
    min-height:96px;
    margin:12px;
    padding:16px;
  }
  body:has(#driverView:not(.hidden)) .date-toolbar label {
    display:grid;
    grid-template-columns:minmax(112px,.45fr) minmax(0,1fr);
    align-items:center;
    gap:12px;
    width:100%;
    white-space:nowrap;
  }
  body:has(#driverView:not(.hidden)) .date-toolbar input {
    width:100%;
    max-width:none;
    justify-self:stretch;
    text-align:center;
  }
}
@media screen and (max-width: 380px) {
  body:has(#driverView:not(.hidden)) .brand-logo { width:min(124px,36vw); }
  body:has(#driverView:not(.hidden)) .topbar { gap:5px; padding-inline:8px; }
  body:has(#driverView:not(.hidden)) .top-actions .button { padding:4px 5px; font-size:8px; }
  body:has(#driverView:not(.hidden)) .date-toolbar { padding:12px; }
  body:has(#driverView:not(.hidden)) .date-toolbar label { grid-template-columns:minmax(96px,.42fr) minmax(0,1fr); gap:8px; font-size:11px; }
}

/* Croquis móvil: marca a la izquierda, acciones a la derecha y fecha en una sola fila. */
@media screen and (max-width: 760px) {
  body:has(#driverView:not(.hidden)) .topbar {
    display:flex !important;
    flex-direction:row !important;
    justify-content:space-between !important;
    align-items:center !important;
    width:100%;
    min-height:64px;
    box-sizing:border-box;
    padding:8px 14px !important;
    gap:10px;
    background:#fff !important;
  }
  body:has(#driverView:not(.hidden)) .brand {
    position:static !important;
    order:0;
    flex:0 1 auto;
    min-width:0;
    margin:0 auto 0 0;
    transform:none !important;
    justify-content:flex-start !important;
  }
  body:has(#driverView:not(.hidden)) .brand-logo {
    width:min(190px,40vw) !important;
    height:44px !important;
    object-fit:contain;
    object-position:left center;
  }
  body:has(#driverView:not(.hidden)) .top-actions {
    position:static !important;
    order:1;
    display:flex;
    flex:0 0 auto;
    width:auto;
    max-width:none;
    margin:0 0 0 auto;
    justify-content:flex-end;
    gap:6px;
  }
  body:has(#driverView:not(.hidden)) .top-actions .connection,
  body:has(#driverView:not(.hidden)) .top-actions .signed-in,
  body:has(#driverView:not(.hidden)) #installBtn { display:none !important; }
  body:has(#driverView:not(.hidden)) .top-actions .button {
    display:inline-flex;
    min-height:38px;
    align-items:center;
    justify-content:center;
    padding:7px 10px !important;
    border:1px solid #6f8735 !important;
    border-radius:9px;
    background:#718a35 !important;
    color:#fff !important;
    font-size:12px !important;
    line-height:1.1;
    white-space:nowrap;
  }
  body:has(#driverView:not(.hidden)) .date-toolbar {
    display:block !important;
    min-height:0;
    margin:12px 14px 16px !important;
    padding:16px 18px !important;
    box-sizing:border-box;
    border:1px solid #e0e3e9;
    border-radius:14px;
    background:#fff;
  }
  body:has(#driverView:not(.hidden)) .date-toolbar label {
    display:grid !important;
    grid-template-columns:minmax(130px,.42fr) minmax(0,1fr);
    align-items:center;
    gap:14px;
    width:100%;
    color:#596477;
    font-size:15px;
    font-weight:750;
    white-space:normal;
  }
  body:has(#driverView:not(.hidden)) .date-toolbar input {
    width:100% !important;
    min-width:0;
    height:52px !important;
    box-sizing:border-box;
    padding:0 12px;
    text-align:center;
    font-size:17px !important;
    font-weight:700;
  }
}
@media screen and (max-width: 420px) {
  body:has(#driverView:not(.hidden)) .topbar { min-height:60px; padding:7px 9px !important; gap:5px; }
  body:has(#driverView:not(.hidden)) .brand-logo { width:min(150px,37vw) !important; height:40px !important; }
  body:has(#driverView:not(.hidden)) .top-actions { gap:4px; }
  body:has(#driverView:not(.hidden)) .top-actions .button { min-height:36px; padding:6px 7px !important; font-size:10px !important; }
  body:has(#driverView:not(.hidden)) .date-toolbar { margin:10px 10px 14px !important; padding:13px !important; }
  body:has(#driverView:not(.hidden)) .date-toolbar label { grid-template-columns:minmax(105px,.38fr) minmax(0,1fr); gap:8px; font-size:13px; }
  body:has(#driverView:not(.hidden)) .date-toolbar input { height:46px !important; font-size:15px !important; }
}
/* Historial por secciones: separa la lista, el kilometraje y el informe. */
body.admin-workspace .view-switch:not(.hidden) { display:flex; }
body.admin-workspace .heading-row .view-switch { flex:0 0 auto; min-width:260px; }
body.admin-workspace .view-switch button { min-height:40px; padding:9px 18px; font-size:13px; font-weight:650; }
body.admin-workspace .view-switch button.active { background:#343d53; color:#fff; }
body.admin-workspace #historyView { gap:0; }
body.admin-workspace #historyView > .list-heading { width:100%; box-sizing:border-box; }
body.admin-workspace #historyView .history-overview { width:auto; min-width:0; }
body.admin-workspace #historyView .history-tabs {
  display:flex; flex-wrap:wrap; align-items:center; gap:8px;
  margin:4px 22px 14px; padding:5px; border:1px solid #dfe4e9;
  border-radius:12px; background:#f4f6f7;
}
body.admin-workspace #historyView .history-tabs button {
  min-height:42px; padding:9px 17px; border:1px solid transparent;
  border-radius:9px; background:transparent; color:#515d70;
  font-family:inherit; font-size:13px; font-weight:650; line-height:1.2; cursor:pointer;
}
body.admin-workspace #historyView .history-tabs button.active {
  border-color:#dfe4e9; background:#fff; color:#30384d;
  box-shadow:0 2px 7px rgba(35,45,65,.08);
}
body.admin-workspace #historyView .history-tab-panel { min-width:0; width:100%; box-sizing:border-box; }
body.admin-workspace #historyView .history-tab-panel.hidden,
body.admin-workspace #historyView .history-tab-panel[hidden] { display:none !important; }
body.admin-workspace #historyView #historyTabDeliveries { display:flex; flex:1 1 auto; flex-direction:column; min-height:0; }
body.admin-workspace #historyView #historyTabDeliveries .history-filters { margin-top:0; }
body.admin-workspace #historyView #historyTabDeliveries .history-records-panel { margin-bottom:12px; }
body.admin-workspace #historyView #historyTabMileage > .history-mileage-panel {
  display:block; margin:0 22px 16px; padding:15px;
  border:1px solid #dfe4e9; border-radius:14px; background:#fff;
}
body.admin-workspace #historyView #historyTabMileage .history-mileage-panel > summary {
  padding:2px 0 12px; border-bottom:1px solid #e7eaee; color:#30384d;
  font-size:17px; font-weight:700; list-style:none; cursor:pointer;
}
body.admin-workspace #historyView #historyTabMileage .history-mileage-panel > summary::-webkit-details-marker { display:none; }
body.admin-workspace #historyView #historyTabMileage .mileage-list { max-height:min(58vh,680px); overflow:auto; margin:12px 0 0; padding:2px 4px 4px; }
body.admin-workspace #historyView #historyTabMileage .mileage-card { grid-template-columns:minmax(180px,1.25fr) repeat(3,minmax(100px,.7fr)) auto; }
body.admin-workspace #historyView #historyTabReport .history-report-footer {
  display:grid; position:static; grid-template-columns:minmax(200px,1fr) minmax(150px,.55fr) minmax(190px,.65fr) auto;
  align-items:end; gap:14px; margin:0 22px 16px; padding:20px;
  border:1px solid #dfe4e9; border-radius:14px; background:#fff;
}
body.admin-workspace #historyView #historyTabReport .report-copy { display:grid; gap:6px; }
body.admin-workspace #historyView #historyTabReport .report-copy strong { color:#30384d; font-size:17px; }
body.admin-workspace #historyView #historyTabReport .report-copy span { color:#66728a; font-size:12px; line-height:1.5; }
body.admin-workspace #historyView #historyTabReport label { display:grid; gap:6px; min-width:0; color:#536076; font-size:12px; font-weight:650; }
body.admin-workspace #historyView #historyTabReport input,
body.admin-workspace #historyView #historyTabReport select { width:100%; min-width:0; height:44px; }

@media screen and (max-width:900px) {
  body.admin-workspace .heading-row { align-items:flex-start; }
  body.admin-workspace .heading-row .view-switch { display:flex; width:100%; min-width:0; }
  body.admin-workspace #historyView { height:auto; min-height:0; max-height:none; overflow:visible; padding:0 0 12px; }
  body.admin-workspace #historyView #historyTabDeliveries { display:block; }
  body.admin-workspace #historyView .history-tabs { margin:4px 16px 12px; }
  body.admin-workspace #historyView .history-tabs button { flex:1 1 135px; }
  body.admin-workspace #historyView #historyTabDeliveries .history-filters { margin:0 16px 12px; }
  body.admin-workspace #historyView #historyTabDeliveries .history-records-panel { margin:0 16px 14px; }
  body.admin-workspace #historyView #historyTabMileage > .history-mileage-panel { margin:0 16px 14px; }
  body.admin-workspace #historyView #historyTabMileage .mileage-list { max-height:none; overflow:visible; }
  body.admin-workspace #historyView #historyTabMileage .mileage-card { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; padding:13px; }
  body.admin-workspace #historyView #historyTabMileage .mileage-card > div:first-child,
  body.admin-workspace #historyView #historyTabMileage .mileage-card .report-button { grid-column:1/-1; }
  body.admin-workspace #historyView #historyTabReport .history-report-footer { grid-template-columns:repeat(2,minmax(0,1fr)); margin:0 16px 14px; padding:16px; }
  body.admin-workspace #historyView #historyTabReport .report-copy,
  body.admin-workspace #historyView #historyTabReport .history-report-footer > .button { grid-column:1/-1; }
  body.admin-workspace #historyView #historyTabReport .history-report-footer > .button { width:100%; min-height:44px; }
}
@media screen and (max-width:560px) {
  body.admin-workspace .heading-row .view-switch { width:100%; }
  body.admin-workspace .view-switch button { flex:1; min-width:0; }
  body.admin-workspace #historyView .history-overview-cards { grid-template-columns:repeat(2,minmax(0,1fr)); margin:0 16px; }
  body.admin-workspace #historyView .history-overview-card { min-width:0; }
  body.admin-workspace #historyView .history-tabs { display:grid; grid-template-columns:1fr; }
  body.admin-workspace #historyView .history-tabs button { width:100%; text-align:left; }
  body.admin-workspace #historyView #historyTabDeliveries .history-records-panel { display:flex; flex-direction:column; }
  body.admin-workspace #historyView #historyTabDeliveries .history-records-scroll { max-height:56vh; min-height:150px; overflow:auto; }
  body.admin-workspace #historyView #historyTabMileage .mileage-card { grid-template-columns:1fr 1fr; }
  body.admin-workspace #historyView #historyTabReport .history-report-footer { grid-template-columns:1fr; }
  body.admin-workspace #historyView #historyTabReport .report-copy,
  body.admin-workspace #historyView #historyTabReport .history-report-footer > .button { grid-column:1; }
}

@media screen and (max-width:760px) {
  body:has(#driverView:not(.hidden)) .topbar {
    display:grid !important; grid-template-columns:minmax(0,1fr) !important;
    grid-template-rows:44px 38px !important; justify-items:center !important;
    align-content:center !important; gap:4px !important; height:auto !important;
    min-height:94px !important; padding:6px 12px 7px !important;
  }
  body:has(#driverView:not(.hidden)) .topbar .brand {
    position:static !important; grid-row:1 !important; left:auto !important;
    justify-self:center !important; justify-content:center !important; width:100% !important;
    min-width:0 !important; transform:none !important;
  }
  body:has(#driverView:not(.hidden)) .topbar .brand-logo { width:min(170px,54vw) !important; height:40px !important; }
  body:has(#driverView:not(.hidden)) .topbar .top-actions {
    position:static !important; grid-row:2 !important; right:auto !important;
    justify-content:center !important; width:100% !important; max-width:100% !important;
  }
}

/* Pase final de coherencia visual para las pruebas locales: dashboard, despachos,
   historial y vista de chofer con márgenes seguros y orden de lectura estable. */
@media screen and (min-width: 901px) {
  body.admin-workspace .shell { max-width: 1640px; padding: 26px 34px 44px; }
  body.admin-workspace .heading-row { gap:24px; align-items:center; margin-bottom:14px; }
  body.admin-workspace .heading-row > div:first-child { min-width:0; }
  body.admin-workspace .heading-row h1 { letter-spacing:-.035em; }
  body.admin-workspace .view-switch { flex:0 0 auto; }

  body.admin-workspace:has([data-admin-section="dashboard"].active) .shell {
    grid-template-columns:minmax(0,1fr) 310px; column-gap:24px; padding-right:38px;
  }
  body.admin-workspace:has([data-admin-section="dashboard"].active) .heading-row { align-items:end; }
  body.admin-workspace:has([data-admin-section="dashboard"].active) .heading-row h1 { font-size:clamp(34px,3vw,46px); }
  body.admin-workspace:has([data-admin-section="dashboard"].active) .date-toolbar {
    width:auto; box-sizing:border-box; grid-template-columns:minmax(0,1fr) auto;
    align-items:end; gap:8px 12px; padding:12px 14px; border-radius:14px;
  }
  body.admin-workspace:has([data-admin-section="dashboard"].active) .date-toolbar label { grid-column:1/-1; font-size:12px; }
  body.admin-workspace:has([data-admin-section="dashboard"].active) .date-toolbar input { height:42px; font-size:15px; }
  body.admin-workspace:has([data-admin-section="dashboard"].active) .date-toolbar .date-actions .button { min-height:36px; font-size:12px; }
  body.admin-workspace:has([data-admin-section="dashboard"].active) .date-toolbar #dateSummary { grid-column:1/-1; font-size:11px; }

  body.admin-workspace #operationsDashboard { display:flex; flex-direction:column; min-width:0; gap:0; }
  body.admin-workspace #operationsDashboard > .dash-heading { display:none; }
  body.admin-workspace #operationsDashboard > .dash-metrics { order:1; grid-template-columns:repeat(5,minmax(0,1fr)); gap:13px; margin:0 0 22px; }
  body.admin-workspace #operationsDashboard > .dash-layout { order:2; display:grid; grid-template-columns:minmax(0,1fr); gap:16px; margin:0 0 16px; }
  body.admin-workspace #operationsDashboard > #dashboardStatistics { order:3; margin:0 0 11px; }
  body.admin-workspace #operationsDashboard > .dash-bottom { order:4; margin-top:10px; }
  body.admin-workspace .dash-metric { min-width:0; min-height:112px; gap:13px; padding:15px; }
  body.admin-workspace .dash-metric>div>span { font-size:13px; }
  body.admin-workspace .dash-metric>div>strong { font-size:32px; }
  body.admin-workspace .dash-routes { grid-template-columns:minmax(0,1fr); gap:8px; }
  body.admin-workspace .dash-route { grid-template-columns:minmax(170px,1.05fr) minmax(190px,1.1fr) minmax(175px,1.1fr) minmax(170px,auto); min-height:78px; padding:11px 15px; }
  body.admin-workspace .dash-route-head h3 { font-size:14px; }
  body.admin-workspace .dash-route-progress .dash-progress-label { display:flex; justify-content:space-between; gap:8px; }
  body.admin-workspace .dash-route-progress .dash-progress-label strong { white-space:nowrap; }
  body.admin-workspace .dash-side { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
  body.admin-workspace .dash-block { min-width:0; margin:0; }
  body.admin-workspace .dash-statistics>summary { min-height:60px; }
  body.admin-workspace #dashboardStatistics[open] .dash-statistics-content { display:grid; grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr); gap:16px; }
  body.admin-workspace .dash-mileage-section,
  body.admin-workspace .dash-delivery-summary { min-width:0; margin:0; }

  body.admin-workspace #dispatchOperations { display:flex; flex-direction:column; gap:15px; min-width:0; }
  body.admin-workspace #dispatchOperations > .route-assignment-panel { order:0; margin:0 0 2px; border-radius:16px; }
  body.admin-workspace #dispatchOperations > .metrics { order:1; grid-template-columns:repeat(4,minmax(0,1fr)); gap:13px; margin:0; }
  body.admin-workspace #dispatchOperations > .metrics .metric { min-width:0; min-height:94px; padding:16px 18px; }
  body.admin-workspace #dispatchOperations > .dispatch-review-note,
  body.admin-workspace #dispatchOperations > .shift-strip { order:2; margin:0; }
  body.admin-workspace #dispatchOperations > .list-panel { order:3; display:flex; flex-direction:column; min-height:0; max-height:calc(100vh - 210px); overflow:hidden; padding:0; }
  body.admin-workspace #dispatchOperations > .list-panel .list-heading { flex:0 0 auto; padding:20px 22px 13px; margin:0; }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-filterbar { flex:0 0 auto; display:grid; grid-template-columns:150px 155px 170px 190px minmax(210px,1fr); gap:10px; margin:0 18px 12px; padding:13px; border:1px solid var(--review-line); border-radius:13px; background:#f7f9fa; }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-filterbar label { min-width:0; }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-table-head { flex:0 0 auto; display:grid; grid-template-columns:minmax(245px,1.1fr) minmax(105px,.55fr) minmax(150px,.75fr) minmax(205px,1.1fr) minmax(110px,.55fr) minmax(250px,1.2fr); gap:12px; margin:0 18px; padding:13px 15px; border-radius:10px 10px 0 0; background:#f0f2f5; color:#354057; font-weight:750; }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-table-count { flex:0 0 auto; margin:7px 20px; }
  body.admin-workspace #dispatchOperations > .list-panel #adminDesktopList { display:block; flex:1 1 auto; min-height:150px; overflow:auto; overscroll-behavior:contain; scrollbar-gutter:stable; margin:0 18px 16px; border:1px solid var(--review-line); border-radius:0 0 12px 12px; }
  body.admin-workspace #dispatchOperations > .planner-panel { order:4; }
  body.admin-workspace #dispatchOperations > .add-panel { order:5; }

  body.admin-workspace #historyView { margin:0; padding:0 0 20px; overflow:hidden; border-radius:16px; }
  body.admin-workspace #historyView > .list-heading { margin:0; padding:20px 24px 16px; }
  body.admin-workspace #historyView .history-overview { margin:0 22px 14px; }
  body.admin-workspace #historyView > .history-tabs { order:2; flex:0 0 auto; }
  body.admin-workspace #historyView > .history-tab-panel { order:3; flex:1 1 auto; min-height:0; }
  body.admin-workspace #historyView .history-tabs { margin:0 22px 14px; }
  body.admin-workspace #historyView #historyTabDeliveries .history-filters { margin:0 22px 12px; padding:14px; }
  body.admin-workspace #historyView .history-records-panel { min-width:0; margin:0 22px 14px; overflow:hidden; }
  body.admin-workspace #historyView .history-records-scroll { max-height:min(48vh,540px); min-height:170px; overflow:auto; overscroll-behavior:contain; scrollbar-gutter:stable; }
  body.admin-workspace #historyView #historyList { max-height:none; min-height:0; overflow:visible; padding:3px 10px 10px; }
  body.admin-workspace #historyView #historyTabMileage > .history-mileage-panel { margin:0 22px 14px; }
  body.admin-workspace #historyView #historyTabReport .history-report-footer { margin:0 22px 14px; }
}

@media screen and (max-width: 900px) {
  html, body { max-width:100%; overflow-x:clip; }
  body.admin-workspace .shell,
  body.admin-workspace #adminView,
  body.admin-workspace #operationsDashboard,
  body.admin-workspace #dispatchOperations,
  body.admin-workspace #historyView { box-sizing:border-box; width:100%; max-width:100%; min-width:0; }
  body.admin-workspace .shell { width:auto; max-width:none; margin:0; padding:16px 16px calc(28px + env(safe-area-inset-bottom)); }
  body.admin-workspace .heading-row { display:flex; flex-direction:column; align-items:stretch; gap:12px; margin:0 0 13px; }
  body.admin-workspace .heading-row h1 { font-size:clamp(27px,7vw,36px); }
  body.admin-workspace .heading-row .view-switch { display:flex; flex:0 0 auto; width:100%; min-width:0; }
  body.admin-workspace .view-switch button { min-height:42px; }
  body.admin-workspace .date-toolbar { margin:0 0 15px; padding:14px; }
  body.admin-workspace .date-toolbar label { font-size:13px; }
  body.admin-workspace .date-toolbar input { min-width:0; height:44px; font-size:15px; }
  body.admin-workspace .dash-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
  body.admin-workspace .dash-metric { display:grid; grid-template-columns:38px minmax(0,1fr); align-items:center; min-width:0; min-height:82px; padding:12px; gap:8px 10px; }
  body.admin-workspace .dash-metric .dash-icon { grid-column:1; grid-row:1; display:grid; place-items:center; width:36px; height:36px; box-sizing:border-box; padding:7px; border-radius:10px; }
  body.admin-workspace .dash-metric .dash-icon svg { display:block; width:23px; height:23px; }
  body.admin-workspace .dash-metric>div { grid-column:2; grid-row:1; display:grid; justify-items:start; align-content:center; min-width:0; gap:3px; }
  body.admin-workspace .dash-metric>div>span { overflow-wrap:anywhere; font-size:12px; }
  body.admin-workspace .dash-metric>div>strong { font-size:27px; line-height:1.05; }
  body.admin-workspace .dash-layout { display:grid; grid-template-columns:minmax(0,1fr); gap:13px; }
  body.admin-workspace .dash-side { display:grid; grid-template-columns:minmax(0,1fr); gap:12px; }
  body.admin-workspace .dash-route { min-width:0; }
  body.admin-workspace #dispatchOperations > .list-panel { max-height:none; overflow:visible; }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-filterbar { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin:0 14px 12px; }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-filterbar .dispatch-search-label { grid-column:1/-1; }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-table-head,
  body.admin-workspace #dispatchOperations > .list-panel #adminDesktopList { display:none; }
  body.admin-workspace #dispatchOperations > .list-panel #adminList { display:grid; gap:10px; max-height:64vh; overflow:auto; overscroll-behavior:contain; margin:0 14px 16px; padding:2px 3px 5px; }
  body.admin-workspace #historyView { padding-bottom:12px; }
  body.admin-workspace #historyView .history-overview { margin:0 16px 12px; }
  body.admin-workspace #historyView > .history-tabs { order:2; }
  body.admin-workspace #historyView > .history-tab-panel { order:3; }
  body.admin-workspace #historyView .history-tabs { margin:0 16px 12px; }
  body.admin-workspace #historyView #historyTabDeliveries .history-filters { margin:0 16px 12px; }
  body.admin-workspace #historyView .history-records-panel { margin:0 16px 12px; }

  body:has(#driverView:not(.hidden)) .topbar { background:#fff; border-bottom:1px solid #e2e6e8; }
  body:has(#driverView:not(.hidden)) .brand { justify-self:center; }
  body:has(#driverView:not(.hidden)) .top-actions .button { background:#6e8836; border-color:#6e8836; color:#fff; }
  body:has(#driverView:not(.hidden)) .top-actions .button:hover { background:#596f2c; border-color:#596f2c; color:#fff; }
  body:has(#driverView:not(.hidden)) .driver-toolbar { margin:0 12px 13px; border-radius:0 0 15px 15px; }
  body:has(#driverView:not(.hidden)) #driverView { padding-inline:12px; }
  body:has(#driverView:not(.hidden)) #driverView .panel,
  body:has(#driverView:not(.hidden)) #driverView .driver-card { margin-inline:0; }
  body:has(#driverView:not(.hidden)) #driverView h2,
  body:has(#driverView:not(.hidden)) #driverView h3 { overflow-wrap:anywhere; }
  body:has(#driverView:not(.hidden)) #driverView,
  body:has(#driverView:not(.hidden)) #driverView > * { box-sizing:border-box; max-width:100%; min-width:0; }
}

@media screen and (max-width:560px) {
  body.admin-workspace .shell { padding-inline:12px; }
  body.admin-workspace .dash-metric { min-height:78px; }
  body.admin-workspace .dash-icon svg { width:27px; height:27px; }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-filterbar { grid-template-columns:1fr; }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-filterbar .dispatch-search-label { grid-column:auto; }
  body.admin-workspace #dispatchOperations > .list-panel #adminList { max-height:58vh; }
  body:has(#driverView:not(.hidden)) .topbar { padding-inline:10px; }
  body:has(#driverView:not(.hidden)) .brand-logo { width:min(170px,52vw); }
}
/* Acciones de factura visibles directamente en la fila de escritorio. */
@media (min-width: 901px) {
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-table-row {
    grid-template-columns: minmax(190px,1.15fr) minmax(95px,.55fr) minmax(130px,.75fr) minmax(190px,1.05fr) minmax(112px,.55fr) minmax(250px,1.35fr);
  }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-table-head {
    grid-template-columns: minmax(190px,1.15fr) minmax(95px,.55fr) minmax(130px,.75fr) minmax(190px,1.05fr) minmax(112px,.55fr) minmax(250px,1.35fr);
  }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-table-entry { min-width:1120px; }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-table-actions {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    justify-content:stretch;
    gap:6px;
  }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-table-actions .button {
    width:100%;
    min-width:0;
    min-height:34px;
    padding:6px 7px;
    white-space:normal;
    line-height:1.2;
    text-align:center;
  }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-table-client strong,
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-table-route strong,
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-table-emission strong {
    font-size:14px;
    line-height:1.4;
  }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-table-client span,
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-table-route span,
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-table-emission span,
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-table-address {
    font-size:13px;
    line-height:1.45;
  }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-table-row { min-height:88px; }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-inline-assign {
    grid-column:1/-1;
    display:flex;
    flex-direction:column;
    gap:3px;
    color:#526078;
    font-size:10px;
    font-weight:700;
  }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-inline-assign select {
    width:100%;
    min-height:34px;
    padding:5px 7px;
    border:1px solid #d5dce6;
    border-radius:8px;
    background:#fff;
    color:#29344a;
    font:inherit;
  }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-detail-content {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px 14px;
    padding:12px 14px;
    border:1px solid var(--review-line);
    border-radius:10px;
    background:#fff;
    color:#354057;
    font-size:12px;
  }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-detail-content > div { min-width:0; }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-detail-content strong,
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-detail-content span { display:block; }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-detail-content strong { margin-bottom:3px; font-size:11px; }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-detail-content span { overflow-wrap:anywhere; }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-detail-address,
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-detail-log,
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-detail-warning,
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-detail-empty { grid-column:1/-1; }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-detail-warning { padding:8px 10px; border-radius:8px; background:#fff7e9; color:#8a5416; }
  body.admin-workspace #dispatchOperations > .list-panel .dispatch-detail-empty { margin:0; color:#68748a; }
}

/* Final dashboard grid override: include the dynamic Google proposal column. */
body.admin-workspace #operationsDashboard .dash-route-head .dash-shift { font-size:12px; }
body.admin-workspace #operationsDashboard .dash-route-head h3 { font-size:19px; }
body.admin-workspace #operationsDashboard .dash-route-head .dash-pill { font-size:12px; padding:7px 11px; }
body.admin-workspace #operationsDashboard .dash-route-person { gap:10px; }
body.admin-workspace #operationsDashboard .dash-route-person strong { font-size:15px; }
body.admin-workspace #operationsDashboard .dash-route-person small { font-size:13px; }
body.admin-workspace #operationsDashboard .dash-route-progress .dash-progress-label { font-size:13px; }
body.admin-workspace #operationsDashboard .dash-route-footer button { font-size:14px; padding:10px 14px; }
@media screen and (min-width: 901px) {
  body.admin-workspace #operationsDashboard .dash-route {
    grid-template-columns:minmax(150px,.9fr) minmax(165px,1fr) minmax(150px,1fr) minmax(190px,1.1fr) minmax(100px,auto);
  }
  body.admin-workspace #operationsDashboard .dash-google { min-width:0; margin-top:0; }
  body.admin-workspace #operationsDashboard .dash-route-footer { justify-content:flex-end; padding-right:4px; }
}
@media screen and (max-width: 900px) {
  body.admin-workspace #operationsDashboard .dash-route { grid-template-columns:minmax(0,1fr) auto; }
  body.admin-workspace #operationsDashboard .dash-route-head { grid-column:1/-1; grid-row:1; }
  body.admin-workspace #operationsDashboard .dash-route-person { grid-column:1/-1; grid-row:2; }
  body.admin-workspace #operationsDashboard .dash-route-progress { grid-column:1; grid-row:3; }
  body.admin-workspace #operationsDashboard .dash-route-footer {
    grid-column:2;
    grid-row:3;
    justify-self:end;
    align-self:center;
    justify-content:flex-end;
    padding:0 8px 0 12px;
  }
  body.admin-workspace #operationsDashboard .dash-google { grid-column:1/-1; grid-row:4; min-width:0; margin-top:0; }
}
@media screen and (max-width: 540px) {
  body.admin-workspace #operationsDashboard .dash-route-head h3 { font-size:18px; }
  body.admin-workspace #operationsDashboard .dash-route-footer button { width:100%; font-size:14px; }
  body.admin-workspace #operationsDashboard .dash-route { grid-template-columns:minmax(0,1fr); }
  body.admin-workspace #operationsDashboard .dash-route-head,
  body.admin-workspace #operationsDashboard .dash-route-person,
  body.admin-workspace #operationsDashboard .dash-route-progress,
  body.admin-workspace #operationsDashboard .dash-route-footer,
  body.admin-workspace #operationsDashboard .dash-google { grid-column:1; }
  body.admin-workspace #operationsDashboard .dash-route-head { grid-row:1; }
  body.admin-workspace #operationsDashboard .dash-route-person { grid-row:2; }
  body.admin-workspace #operationsDashboard .dash-route-progress { grid-row:3; }
  body.admin-workspace #operationsDashboard .dash-route-footer { grid-row:4; justify-self:stretch; padding:0 8px; }
  body.admin-workspace #operationsDashboard .dash-google { grid-row:5; }
}

/* Encabezado de la vista del conductor: título legible y selector bien agrupado. */
body:has(#driverView:not(.hidden)) .driver-toolbar {
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(190px,240px);
  align-items:center;
  gap:24px;
  min-height:112px;
  padding:20px 24px;
}
body:has(#driverView:not(.hidden)) .driver-toolbar>div { min-width:0; }
body:has(#driverView:not(.hidden)) .driver-toolbar .eyebrow { margin:0 0 5px; color:#667d2e; font-size:11px; letter-spacing:.16em; }
body:has(#driverView:not(.hidden)) .driver-toolbar h2 { display:flex; align-items:center; gap:11px; margin:0 0 6px; color:#273247; font-size:24px; line-height:1.15; letter-spacing:-.035em; }
body:has(#driverView:not(.hidden)) .driver-title-icon { display:block; width:38px; height:38px; flex:0 0 38px; padding:6px; border-radius:11px; background:#eef3e2; color:#607a2b; }
body:has(#driverView:not(.hidden)) .driver-toolbar .muted { max-width:720px; color:#69758a; font-size:14px; line-height:1.45; }
body:has(#driverView:not(.hidden)) .driver-toolbar label { display:grid; gap:7px; min-width:0; color:#526078; font-size:12px; font-weight:700; }
body:has(#driverView:not(.hidden)) .driver-toolbar select { width:100%; min-height:44px; padding:0 12px; border-color:#d8dfd2; border-radius:10px; background:#fbfcf8; color:#283349; font-size:14px; font-weight:650; }
@media screen and (max-width:760px) {
  body:has(#driverView:not(.hidden)) .driver-toolbar { grid-template-columns:minmax(0,1fr); gap:11px; min-height:0; margin:0 12px 10px; padding:15px 17px; border:1px solid #dfe4d8; border-radius:14px; background:#fff; color:#263044; }
  body:has(#driverView:not(.hidden)) .driver-toolbar>div { display:block; }
  body:has(#driverView:not(.hidden)) .driver-toolbar .eyebrow,
  body:has(#driverView:not(.hidden)) .driver-toolbar .muted { display:block; }
  body:has(#driverView:not(.hidden)) .driver-toolbar .eyebrow { margin-bottom:4px; font-size:10px; }
  body:has(#driverView:not(.hidden)) .driver-toolbar h2 { justify-content:flex-start; margin:0 0 5px; color:#273247; font-size:21px; }
  body:has(#driverView:not(.hidden)) .driver-title-icon { width:34px; height:34px; flex-basis:34px; }
  body:has(#driverView:not(.hidden)) .driver-toolbar .muted { font-size:12px; }
  body:has(#driverView:not(.hidden)) .driver-toolbar label { grid-template-columns:1fr; gap:5px; color:#526078; font-size:11px; }
  body:has(#driverView:not(.hidden)) .driver-toolbar select { min-height:42px; max-width:none; border-color:#d8dfd2; background:#fbfcf8; font-size:14px; }
}
