:root {
  --ink: #102451;
  --ink-soft: #41547c;
  --blue: #1768e8;
  --blue-deep: #0b2f73;
  --sky: #eaf3ff;
  --canvas: #f5f7fb;
  --line: #e5eaf2;
  --surface: #ffffff;
  --green: #1eae63;
  --amber: #e88617;
  --red: #df3c3c;
  --muted: #8290a9;
  --shadow: 0 12px 34px rgba(24, 49, 91, .10);
  --font: "Manrope", sans-serif;
  --mono: "DM Mono", monospace;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: var(--font); font-size: 14px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .11em; margin: 0 0 4px; text-transform: uppercase; }

.auth-gate { position: fixed; z-index: 1000; inset: 0; display: grid; place-items: center; padding: 24px; background: #f5f7fb; }
.auth-gate[hidden] { display: none; }
.auth-layout { display: grid; grid-template-columns: minmax(320px, .92fr) minmax(390px, 1.08fr); width: min(100%, 1000px); min-height: 610px; overflow: hidden; border: 1px solid rgba(20, 56, 110, .09); border-radius: 24px; background: #fff; box-shadow: 0 28px 80px rgba(23,55,100,.15); }
.auth-visual { position: relative; min-height: 100%; background: url("../../../recursos/imagenes/portada/portada-escritorio.png") center/cover; color: #fff; }
.auth-visual-overlay { position: absolute; inset: 0; background: linear-gradient(160deg, rgba(3,26,79,.91), rgba(3,26,79,.71)); }
.auth-visual-content { position: relative; z-index: 1; display: flex; height: 100%; flex-direction: column; justify-content: center; padding: 48px; }.auth-visual-logo { width: 205px; filter: brightness(0) invert(1) grayscale(1) brightness(3); }.auth-rule { width: 40px; height: 3px; margin: 54px 0 24px; border-radius: 99px; background: var(--blue); }.auth-visual-content p { margin: 0; font-size: 27px; font-weight: 700; letter-spacing: -.055em; line-height: 1.16; }.auth-visual-content em { color: #47a1ff; font-style: normal; }
.auth-card { display: grid; align-content: center; gap: 14px; padding: 72px; background: #fff; }
.auth-logo { width: 208px; height: auto; margin-bottom: 12px; }
.auth-card h1 { margin: 0; font-size: 28px; letter-spacing: -.06em; }
.auth-copy { margin: 0 0 10px; color: var(--ink-soft); line-height: 1.55; }
label { display: grid; gap: 6px; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
input, select { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; outline: none; background: #fff; color: var(--ink); transition: border-color .18s, box-shadow .18s; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23,104,232,.12); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(23,104,232,.35); outline-offset: 2px; }
.form-error { min-height: 17px; margin: 0; color: var(--red); font-size: 12px; font-weight: 700; }

.app-shell { display: grid; min-height: 100vh; grid-template-columns: 246px 1fr; }
.sidebar { display: flex; position: relative; z-index: 50; flex-direction: column; gap: 10px; padding: 27px 16px 16px; border-right: 1px solid var(--line); background: var(--surface); }
.brand { display: block; padding: 0 10px 24px; border-bottom: 1px solid var(--line); }
.brand img { display: block; width: 174px; height: auto; }
.sidebar-label { margin: 18px 10px -4px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.sidebar h1 { margin: 0 10px 12px; font-size: 15px; letter-spacing: -.035em; }
.side-nav { display: grid; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-soft); font-size: 12px; font-weight: 700; text-align: left; text-decoration: none; transition: .16s ease; }
.nav-item svg { width: 18px; height: 18px; color: var(--blue-deep); }
.nav-item b { margin-left: auto; padding: 1px 7px; border-radius: 999px; background: var(--sky); color: var(--blue); font-size: 10px; }
.nav-item:hover { background: #f4f8ff; color: var(--blue-deep); }
.nav-item.is-active { background: linear-gradient(125deg, var(--blue-deep), #164aa4); color: #fff; box-shadow: 0 9px 17px rgba(12,49,116,.18); }
.nav-item.is-active svg { color: #fff; }
.sidebar-bottom { display: grid; gap: 10px; margin-top: auto; padding: 12px 10px 2px; border-top: 1px solid var(--line); }
.account-card { display: flex; align-items: center; gap: 9px; }
.avatar { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: linear-gradient(145deg, #c3d9ff, #edf5ff); color: var(--blue-deep); font-size: 12px; font-weight: 800; }
.account-card strong, .account-card small { display: block; } .account-card strong { font-size: 11px; } .account-card small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.logout { padding: 9px 0 2px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink-soft); font-size: 11px; font-weight: 700; text-align: left; }

.workspace { display: grid; min-width: 0; grid-template-rows: 82px minmax(570px, 1fr) auto; padding: 0 20px 20px; }
.section-workspace { min-width: 0; padding: 0 32px 32px; }
.topbar { display: flex; align-items: center; gap: 16px; }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-left: auto; }
.page-heading { display: grid; gap: 2px; } .page-heading strong { font-size: 17px; letter-spacing: -.04em; }
.connection { display: flex; align-items: center; gap: 7px; margin-left: auto; padding: 7px 10px; border-radius: 999px; background: #eef8f2; color: #19874b; font-size: 11px; font-weight: 800; }
.connection i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px rgba(30,174,99,.12); }
.connection.is-offline { background: #fff3f0; color: var(--red); }
.button { border: 0; border-radius: 8px; padding: 11px 14px; font-size: 12px; font-weight: 800; transition: transform .16s, box-shadow .16s, background .16s; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: linear-gradient(130deg, var(--blue), #1453bb); color: #fff; box-shadow: 0 8px 18px rgba(23,104,232,.22); }
.button-outline { border: 1px solid #cfdcf2; background: #fff; color: var(--blue-deep); }
.button-quiet { background: #f0f5fc; color: var(--blue-deep); }
.mobile-menu { display: none; }

.map-stage { position: relative; min-height: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: #dce8f1; box-shadow: var(--shadow); }
#map { position: absolute; inset: 0; z-index: 1; }
.map-toolbar { display: flex; position: absolute; z-index: 10; top: 18px; left: 18px; gap: 9px; }
.search-control { display: flex; align-items: center; gap: 8px; width: min(290px, 30vw); padding: 0 11px; border: 1px solid #e7edf5; border-radius: 9px; background: rgba(255,255,255,.96); box-shadow: 0 7px 18px rgba(23,54,94,.09); color: var(--blue-deep); }
.search-control svg { width: 19px; height: 19px; }.search-control input { min-width: 0; padding: 11px 0; border: 0; box-shadow: none; }
.map-search-results { position: absolute; top: 48px; left: 0; width: min(400px, 62vw); padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.98); box-shadow: var(--shadow); }.place-results button, .map-search-results button { display: flex; align-items: flex-start; gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; background: #f8fbff; color: var(--ink-soft); font-size: 10px; line-height: 1.35; text-align: left; }.place-results button + button, .map-search-results button + button { margin-top: 3px; }.place-results button svg, .map-search-results button svg { flex: 0 0 14px; width: 14px; height: 14px; color: var(--blue); }.map-search-results small, .map-search-results strong { display: block; }.map-search-results small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.map-toolbar select { width: 164px; padding: 11px; border: 0; box-shadow: 0 7px 18px rgba(23,54,94,.09); }
.icon-button, .panel-close { display: grid; width: 32px; height: 32px; place-items: center; border: 0; border-radius: 8px; background: #f1f5fa; color: var(--ink-soft); font-size: 18px; line-height: 1; }.icon-button { width: 40px; height: 40px; background: #fff; box-shadow: 0 7px 18px rgba(23,54,94,.09); }
.floating-panel, .unit-drawer { position: absolute; z-index: 12; width: 238px; border: 1px solid rgba(226,232,241,.9); border-radius: 12px; background: rgba(255,255,255,.97); box-shadow: 0 14px 30px rgba(25,51,93,.13); backdrop-filter: blur(12px); transition: transform .22s ease, opacity .22s ease; }
.floating-panel.is-hidden { opacity: 0; pointer-events: none; transform: translateX(-115%); }.unit-drawer.is-hidden { opacity: 0; pointer-events: none; transform: translateX(115%); }
.summary-panel { top: 80px; left: 18px; }.fleet-panel { bottom: 18px; left: 18px; }.events-panel { top: 80px; left: 274px; max-height: 390px; overflow: auto; }
.panel-heading, .drawer-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 15px 16px 12px; border-bottom: 1px solid var(--line); }.panel-heading h2, .drawer-top h2 { margin: 0; font-size: 14px; letter-spacing: -.035em; }
.summary-list { padding: 8px 16px 12px; }.summary-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; color: var(--ink-soft); font-size: 11px; font-weight: 700; }.summary-row span { display: inline-flex; align-items: center; gap: 8px; }.summary-row svg { width: 14px; height: 14px; color: var(--blue-deep); }.summary-row strong { color: var(--ink); font-family: var(--mono); font-size: 12px; }
.unit-list, .events-list { max-height: 250px; overflow: auto; padding: 4px 9px 10px; }.unit-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; width: 100%; padding: 10px 7px; border: 0; border-bottom: 1px solid #edf0f5; background: transparent; color: inherit; text-align: left; }.unit-row:hover { background: #f6f9fd; }.unit-row:last-child { border-bottom: 0; }.unit-dot { width: 8px; height: 8px; border-radius: 50%; }.unit-row strong, .unit-row small { display: block; }.unit-row strong { font-size: 11px; }.unit-row small { color: var(--ink-soft); font-size: 10px; }.unit-row time { color: var(--muted); font-size: 9px; white-space: nowrap; }
.event-item { padding: 10px 5px; border-bottom: 1px solid #edf0f5; color: var(--ink-soft); font-size: 10px; line-height: 1.45; }.event-item:last-child { border-bottom: 0; }.event-item strong { color: var(--ink); }.event-item time { display: block; margin-top: 3px; color: var(--muted); font-family: var(--mono); font-size: 9px; }
.unit-drawer { top: 18px; right: 18px; bottom: 18px; width: 288px; overflow: auto; }.status-line { display: inline-flex; margin: 15px 16px 0; padding: 5px 8px; border-radius: 99px; background: #eff7f1; color: var(--green); font-size: 10px; font-weight: 800; }.vehicle-figure { display: grid; place-items: center; gap: 2px; height: 128px; margin: 8px 16px 4px; border-radius: 10px; background: linear-gradient(135deg, #f5f9ff, #eaf2ff); color: var(--blue-deep); }.vehicle-figure img { width: min(90%, 205px); height: 88px; object-fit: contain; }.vehicle-figure p { margin: 0; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.detail-list { margin: 8px 16px; }.detail-list div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }.detail-list dt { color: var(--muted); font-size: 10px; font-weight: 700; }.detail-list dd { max-width: 154px; margin: 0; color: var(--ink); font-size: 10px; font-weight: 800; text-align: right; }.drawer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 16px; }.drawer-actions .button { padding: 9px 6px; font-size: 10px; }.history-note { margin: 0 16px 16px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.truck-marker { display: grid; width: 35px; height: 35px; place-items: center; filter: drop-shadow(0 6px 7px rgba(10,40,85,.26)); font-style: normal; }.truck-marker svg { width: 35px; height: 35px; }.assignment-point { display: block; width: 20px; height: 20px; border: 4px solid #fff; border-radius: 50%; background: var(--blue); box-shadow: 0 4px 13px rgba(12,48,113,.36), 0 0 0 3px rgba(23,104,232,.24); }.assignment-point.is-fixed { background: var(--green); }.destination-point { background: var(--green); }.unit-callout-card { display: grid; gap: 2px; min-width: 100px; padding: 10px 11px; border: 1px solid #e8edf4; border-radius: 9px; background: rgba(255,255,255,.97); box-shadow: 0 8px 18px rgba(18,47,91,.12); color: var(--ink); font-family: var(--font); }.unit-callout-card strong { font-size: 11px; }.unit-callout-card span { font-size: 9px; font-weight: 800; }.unit-callout-card small { color: var(--ink-soft); font-size: 9px; }.dispatch-pin-controls { display: flex; gap: 6px; padding: 5px; border: 1px solid #dce7f8; border-radius: 9px; background: #fff; box-shadow: 0 7px 18px rgba(17,47,92,.18); pointer-events: auto; }.dispatch-pin-controls button { display: grid; width: 30px; height: 30px; place-items: center; border: 0; border-radius: 7px; background: #eff8f2; color: var(--green); }.dispatch-pin-controls button:first-child { background: #fff1f1; color: var(--red); }.dispatch-pin-controls svg { width: 17px; height: 17px; }.leaflet-tooltip.unit-callout, .leaflet-tooltip.dispatch-tooltip { padding: 0; background: transparent; border: 0; box-shadow: none; }.leaflet-tooltip.unit-callout::before, .leaflet-tooltip.dispatch-tooltip::before { display: none; }
.metrics-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding-top: 16px; }.metric-card { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }.metric-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: #eef5ff; color: var(--blue); font-size: 17px; }.metric-card strong, .metric-card small { display: block; }.metric-card strong { font-family: var(--mono); font-size: 18px; }.metric-card small { margin-top: 2px; color: var(--ink-soft); font-size: 10px; font-weight: 700; }
.metric-icon svg, .button svg { width: 16px; height: 16px; }.section-card { min-height: calc(100vh - 135px); padding: 28px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); }.section-intro { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 25px; border-bottom: 1px solid var(--line); }.section-intro h2 { margin: 0; font-size: 24px; letter-spacing: -.055em; }.section-intro p { margin: 7px 0 0; color: var(--ink-soft); font-size: 12px; }.section-search { display: flex; align-items: center; gap: 8px; width: min(310px, 40vw); padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; }.section-search svg { width: 17px; color: var(--blue-deep); }.section-search input { padding: 10px 0; border: 0; box-shadow: none; }.units-table-wrap { overflow: auto; }.units-table { width: 100%; border-collapse: collapse; text-align: left; }.units-table th { padding: 17px 12px 10px; color: var(--muted); font-size: 10px; letter-spacing: .07em; text-transform: uppercase; }.units-table td { padding: 14px 12px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 11px; }.units-table td:first-child strong, .units-table td:first-child small { display: block; }.units-table td:first-child strong { color: var(--ink); }.units-table td:first-child small { margin-top: 3px; color: var(--muted); font-size: 9px; }.unit-color { display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 50%; }.state-chip { padding: 5px 7px; border-radius: 99px; background: #eef4ff; color: var(--blue-deep); font-size: 9px; font-weight: 800; }.table-action { display: inline-flex; align-items: center; gap: 5px; padding: 7px 9px; border: 0; border-radius: 7px; background: #f0f5fc; color: var(--blue-deep); font-size: 10px; font-weight: 800; }.table-action svg { width: 13px; height: 13px; }.event-timeline { max-width: 850px; padding-top: 16px; }.event-timeline article { display: grid; grid-template-columns: 32px 1fr; gap: 12px; padding: 16px 4px; border-bottom: 1px solid var(--line); }.event-timeline article > svg { width: 30px; height: 30px; padding: 7px; border-radius: 50%; background: #edf4ff; color: var(--blue); }.event-timeline strong { color: var(--ink); font-size: 12px; }.event-timeline p { overflow: hidden; max-width: 640px; margin: 5px 0; color: var(--ink-soft); font-family: var(--mono); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }.event-timeline time { color: var(--muted); font-size: 10px; }
.dispatch-dialog { width: min(100% - 32px, 480px); padding: 0; border: 0; border-radius: 16px; box-shadow: 0 25px 80px rgba(17,42,84,.25); }.dispatch-dialog::backdrop { background: rgba(13,31,65,.47); backdrop-filter: blur(3px); }.dialog-card { display: grid; gap: 13px; padding: 0 22px 22px; }.dialog-card .panel-heading { margin: 0 -22px; padding: 18px 22px 14px; }.dialog-copy { margin: 0; color: var(--ink-soft); font-size: 12px; line-height: 1.5; }.dispatch-step { display: grid; gap: 13px; }.coordinate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }.place-results { display: grid; max-height: 190px; overflow: auto; }.vehicle-preview { display: block; width: min(100%, 210px); height: 110px; margin: 0 auto; object-fit: contain; }
.trip-filters { display: grid; grid-template-columns: repeat(6, minmax(118px, 1fr)); gap: 10px; align-items: end; padding: 20px 0 16px; border-bottom: 1px solid var(--line); }.trip-filters .button { height: 40px; white-space: nowrap; }.trip-count { padding: 13px 0 5px; color: var(--muted); font-family: var(--mono); font-size: 10px; }.trip-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 13px; padding: 10px 0 4px; }.trip-card { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(135deg, #fff, #fbfdff); box-shadow: 0 7px 18px rgba(24,49,91,.045); }.trip-card-main { display: grid; grid-template-columns: 11px minmax(0, 1fr) auto; gap: 10px; align-items: start; }.trip-unit-dot { width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; }.trip-card h3 { overflow: hidden; margin: 0; color: var(--ink); font-size: 14px; letter-spacing: -.035em; text-overflow: ellipsis; white-space: nowrap; }.trip-card p { overflow: hidden; margin: 4px 0 0; color: var(--ink-soft); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }.trip-state { padding: 5px 7px; border-radius: 999px; background: #edf4ff; color: var(--blue-deep); font-size: 9px; font-weight: 800; white-space: nowrap; }.state-delivered,.state-completed { background: #edf9f1; color: #19874b; }.state-exception,.state-rejected { background: #fff0f0; color: var(--red); }.state-in_transit { background: #edf9f1; color: var(--green); }.trip-meta { display: flex; flex-wrap: wrap; gap: 8px 13px; margin: 14px 0; color: var(--muted); font-size: 9px; font-weight: 700; }.trip-meta span { display: inline-flex; align-items: center; gap: 4px; }.trip-meta svg { width: 12px; height: 12px; color: var(--blue); }.trip-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 43px; padding-top: 11px; border-top: 1px solid var(--line); }.trip-photos { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; }.trip-photos img { width: 94px; height: 76px; border: 1px solid var(--line); border-radius: 8px; object-fit: cover; background: var(--sky); }.trip-photos.is-compact { gap: 0; padding: 0; }.trip-photos.is-compact img { width: 30px; height: 30px; margin-left: -7px; border: 2px solid #fff; border-radius: 50%; }.trip-photos.is-compact img:first-child { margin-left: 0; }.trip-photos.is-compact span { display: grid; width: 30px; height: 30px; margin-left: -7px; place-items: center; border: 2px solid #fff; border-radius: 50%; background: var(--blue-deep); color: #fff; font-family: var(--mono); font-size: 8px; }.trip-no-photos { color: var(--muted); font-size: 10px; }.trip-dialog { width: min(100% - 32px, 760px); }.trip-dialog .dialog-card { max-height: min(750px, calc(100vh - 46px)); overflow: auto; }.trip-card.is-detail { border: 0; border-radius: 0; box-shadow: none; }.trip-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; padding: 14px; border-radius: 10px; background: #f5f8fd; }.trip-detail-grid small,.trip-detail-grid strong { display: block; }.trip-detail-grid small { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }.trip-detail-grid strong { margin-top: 3px; color: var(--ink); font-size: 10px; }.trip-evidence { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-top: 16px; }.trip-evidence h3 { margin-top: 2px; font-size: 12px; }.trip-notes { overflow: visible!important; margin-top: 13px!important; padding: 11px; border-radius: 8px; background: #fff9eb; color: #79520f!important; white-space: normal!important; }.unit-trip-panel { margin-top: 27px; padding-top: 25px; border-top: 2px solid #dfeaff; }.unit-history-head { display: flex; align-items: start; justify-content: space-between; }.unit-history-head h3 { margin: 0; font-size: 18px; letter-spacing: -.045em; }.unit-history-head p { margin: 5px 0 0; color: var(--ink-soft); font-size: 11px; }.empty-state { grid-column: 1 / -1; padding: 38px; border: 1px dashed #cbd8ed; border-radius: 10px; color: var(--muted); text-align: center; }
.danger-action { color: var(--red); background: #fff1f1; }
.trip-photo-item { display: grid; gap: 6px; }
.trip-photo-item .table-action { justify-content: center; }
.table-action:hover, .table-action:focus-visible { background: #e4efff; }
.danger-action:hover, .danger-action:focus-visible { background: #ffe1e1; }
