/* ATLAS Operations: una sola apariencia para consola y Android.
   Grafito, superficies claras y verde operativo para distinguir cada acción. */
:root {
  --canvas: #f5f6f4;
  --paper: #fff;
  --graphite: #161b22;
  --deep: #10151b;
  --ink: #202a28;
  --muted: #64706a;
  --line: #e2e7e1;
  --line-strong: #cbd4ca;
  --accent: #157453;
  --accent-strong: #0d5a40;
  --silver: #dce2dc;
  --titanium: #8b958e;
  --green: #157453;
  --red: #b23840;
  --amber: #936415;
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

/* Esta base conserva campos legibles y evita desbordes con teclado y pantalla táctil. */
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); line-height: 1.55; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { opacity: .46; cursor: not-allowed; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #86b5a2; outline-offset: 3px; }
input, select, textarea { min-width: 0; min-height: 48px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--ink); background: #fff; font-size: 16px; transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: #86938b; opacity: 1; }
input[readonly] { background: #fafbf9; color: #46564d; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #1574530d; }
label { display: block; color: #46564d; font-size: 14px; font-weight: 600; }
textarea { width: 100%; resize: vertical; line-height: 1.7; }
pre, code { font-family: ui-monospace, Consolas, monospace; }
.icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; flex-shrink: 0; }
.icon.small { width: 16px; height: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted, .small-note { color: var(--muted); }
.small-note { font-size: 14px; line-height: 1.8; }
.eyebrow { display: block; margin-bottom: 10px; color: #6b7870; font-size: 10px; font-weight: 700; letter-spacing: 1.65px; line-height: 1.7; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 46px; padding: 11px 17px; border: 1px solid transparent; border-radius: 9px; font-size: 14px; font-weight: 650; line-height: 1.5; text-decoration: none; transition: background .15s, border-color .15s, box-shadow .15s; }
.button:hover { text-decoration: none; }
.button.primary { border-color: var(--accent); color: #fff; background: var(--accent); box-shadow: 0 2px 3px #0d5a4014; }
.button.primary:hover:not(:disabled) { border-color: var(--accent-strong); background: var(--accent-strong); }
.button.secondary { border-color: var(--line-strong); color: #35463d; background: #fff; }
.button.secondary:hover:not(:disabled) { border-color: #86938b; background: #f1f4f0; }
.button .icon { flex-shrink: 0; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 44px; height: 44px; padding: 10px; border: 1px solid transparent; border-radius: 9px; color: #53645a; background: transparent; }
.icon-button:hover { background: #edf1eb; color: var(--accent); }
.text-link, .panel-link { display: inline-flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; color: var(--accent); font-size: 14px; font-weight: 600; }
.mobile-only { display: none; }

/* La marca tiene su propio espacio y el formulario conserva su lugar. */
.login-screen { display: grid; grid-template-columns: 53% 47%; min-height: 100svh; background: #fff; }
.login-story { display: flex; flex-direction: column; min-width: 0; min-height: 100svh; padding: 44px clamp(32px, 5vw, 76px) 30px; border-right: 1px solid #2c3638; color: #eaf0eb; background: radial-gradient(ellipse at 100% 0%, #25423955, transparent 58%), #161b22; }
.brand { display: inline-flex; align-items: center; gap: 12px; width: fit-content; color: inherit; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 31px; height: 35px; fill: none; stroke: #79c3a5; stroke-width: 1.8; }
.brand-wordmark { display: flex; flex-direction: column; font-size: 26px; font-weight: 780; line-height: 1; letter-spacing: 1px; }
.brand-wordmark small { margin-top: 8px; color: #8c9b98; font-size: 9px; font-weight: 600; letter-spacing: 2.5px; }
.login-story .brand-mark { stroke: #a4d9c0; }
.login-story .brand-wordmark { letter-spacing: 1.4px; }
.login-story .brand-wordmark small { color: #a3b4ac; }
.login-story .login-edition { display: flex; align-items: center; gap: 10px; margin-top: 32px; color: #a0b0a9; font-size: 9px; font-weight: 650; letter-spacing: 1.6px; line-height: 1.8; }
.login-story .login-edition::before { content: ""; width: 24px; height: 1px; background: #79b59a; }
.login-story .login-message { width: 100%; min-width: 0; margin-top: auto; margin-bottom: auto; padding: clamp(48px, 9vh, 92px) 0; text-align: center; }
.login-story .login-message .eyebrow { margin-bottom: 17px; color: #a6d3ba; font-size: 10px; letter-spacing: 1.8px; }
/* Usamos el logo de siempre, con un acabado claro sobre grafito y tamaño cómodo en cada pantalla. */
.login-story .login-identity { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; }
.login-story .login-identity-mark { flex-shrink: 0; width: clamp(120px, 13vw, 190px); height: clamp(120px, 13vw, 190px); fill: #d6e0da08; stroke: #cddbd3; stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 14px 22px #00000030); }
.login-story .login-identity-name { color: #edf2ee; font-size: clamp(48px, 6.5vw, 94px); font-weight: 780; line-height: 1; letter-spacing: 3px; }
.login-story .login-identity-name span { display: block; margin-top: 19px; padding-left: 7px; color: #a3b4ac; font-size: 12px; font-weight: 600; letter-spacing: 7px; }
/* La brújula responde al sensor. No tiene vueltas automáticas ni un rumbo inventado. */
.login-compass { position: relative; display: grid; place-items: center; width: clamp(150px, 16vw, 222px); height: clamp(150px, 16vw, 222px); border: 1px solid #b4c5bb24; border-radius: 50%; background: radial-gradient(circle, #ffffff04 55%, #c3d3c909 56%, transparent 58%); }
.login-compass::after { position: absolute; inset: 8px; border: 1px solid #b4c5bb12; border-radius: inherit; content: ""; pointer-events: none; }
.login-compass-north { position: absolute; top: 6px; left: 50%; color: #93b6a2; font-size: 9px; font-weight: 700; line-height: 1; transform: translateX(-50%); }
.login-story .login-compass .login-identity-mark { width: 70%; height: 70%; transform-origin: center; transition: transform .18s ease-out; }
.login-compass-controls { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 24px; }
.login-compass-reading { color: #cad9cf; font-size: 13px; font-variant-numeric: tabular-nums; font-weight: 600; letter-spacing: 1.1px; }
.login-compass-status { max-width: 310px; min-height: 19px; color: #a3b4ac; font-size: 12px; line-height: 1.6; }
.login-compass-enable { min-height: 44px; padding: 9px 16px; border: 1px solid #b5c7bc33; border-radius: 8px; color: #d5e4da; background: #ffffff06; font-size: 12px; font-weight: 600; }
.login-compass-enable:hover:not(:disabled) { border-color: #b5c7bc75; background: #ffffff0c; }
.login-compass-enable[aria-pressed="true"] { border-color: #82b49b60; color: #ccead9; background: #6eab8d13; }
@media (prefers-reduced-motion: reduce) { .login-story .login-compass .login-identity-mark { transition: none; } }
.login-story .login-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-top: auto; padding-top: 22px; border-top: 1px solid #ffffff14; color: #a0b0a6; font-size: 10px; }
.login-story .login-footer span:first-child { display: flex; align-items: center; gap: 7px; }
.login-story .login-footer span:last-child { font-size: 8px; font-weight: 650; letter-spacing: 1px; }
.login-form-wrap { display: flex; align-items: center; justify-content: center; min-width: 0; padding: 44px; }
.auth-panel { width: 100%; max-width: 420px; }
.auth-panel > .eyebrow { margin-bottom: 28px; }
.auth-tabs { display: flex; gap: 5px; margin-bottom: 34px; padding: 5px; border: 1px solid #e5eae3; border-radius: 11px; background: #f3f5f1; }
.auth-tabs button { position: relative; flex: 1; min-height: 43px; padding: 9px 12px; border: 0; border-radius: 7px; color: #6b776f; background: none; font-size: 14px; font-weight: 600; }
.auth-tabs [aria-selected="true"] { color: #203d30; background: #fff; box-shadow: 0 1px 4px #25372e14; }
.auth-tabs [aria-selected="true"]::after { content: none; }
.auth-step { display: none; }
.auth-heading h2 { color: var(--ink); font-size: 35px; font-weight: 650; line-height: 1.2; letter-spacing: -1.1px; }
.auth-heading > p { margin-top: 15px; color: var(--muted); font-size: 16px; line-height: 1.8; }
.login-form { margin-top: 27px; }
.login-form label { margin: 20px 0 9px; }
.login-form input { display: block; width: 100%; min-height: 49px; }
.password-field { position: relative; }
.password-field input { padding-right: 53px; }
.password-toggle { position: absolute; top: 3px; right: 3px; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 7px; color: #6a7a70; background: none; }
.password-toggle:hover { background: #f1f4f0; }
.field-hint { margin-top: 8px; color: var(--muted); font-size: 14px; }
.login-submit { position: relative; justify-content: center; width: 100%; margin-top: 27px; padding: 13px 46px; text-align: center; }
.login-submit > .icon { position: absolute; top: 50%; right: 17px; transform: translateY(-50%); }
.auth-switch { margin-top: 22px; color: var(--muted); font-size: 14px; line-height: 1.8; text-align: center; }
.auth-switch a { font-weight: 600; }
.security-note { display: flex; align-items: center; gap: 9px; margin-top: 32px; padding-top: 23px; border-top: 1px solid var(--line); color: #65736b; font-size: 12px; line-height: 1.7; }
.security-note .icon { flex-shrink: 0; width: 17px; height: 17px; }
.auth-footer { display: block; margin-top: 26px; color: #86938b; font-size: 10px; letter-spacing: 1.3px; }

/* La navegación utiliza una banda compacta; el mapa y la evidencia ocupan la parte principal. */
.app-shell { min-height: 100svh; }
.sidebar { position: fixed; z-index: 1100; top: 0; bottom: 0; left: 0; display: flex; flex-direction: column; width: 224px; min-width: 0; padding: 32px 16px 18px; overflow-y: auto; border-right: 1px solid #202830; color: #e9eeeb; background: var(--graphite); overscroll-behavior: contain; }
.sidebar > .brand { margin-left: 9px; }
.sidebar .brand-mark { width: 25px; height: 31px; }
.sidebar .brand-wordmark { font-size: 23px; }
.sidebar .brand-wordmark small { font-size: 8px; letter-spacing: 2px; }
.workspace-label { margin: 39px 12px 13px; color: #778a80; font-size: 9px; font-weight: 650; letter-spacing: 1.7px; }
.sidebar nav { display: grid; gap: 7px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; min-height: 47px; padding: 11px 13px; border: 1px solid transparent; border-radius: 9px; color: #a1afa9; font-size: 14px; font-weight: 500; }
.nav-item:hover { color: #f0f7f1; background: #232f32; text-decoration: none; }
.nav-item.active { border-color: #28654e; color: #d5f6e5; background: #1a4033; }
.nav-item.active::before { content: none; }
.nav-item .icon { width: 19px; height: 19px; }
.nav-count { min-width: 22px; margin-left: auto; padding: 1px 5px; border-radius: 10px; color: #9bb3a6; background: #ffffff0a; font-size: 11px; text-align: center; font-variant-numeric: tabular-nums; }
.sidebar-bottom { margin-top: auto; padding-top: 40px; }
.connection-card { display: flex; gap: 9px; margin: 0 7px 22px; padding: 15px 0; border-top: 1px solid #303a3b; border-bottom: 1px solid #303a3b; }
.connection-orbit { display: none; }
.connection-card strong { display: block; color: #c0cdc5; font-size: 11px; font-weight: 600; }
.connection-card div > span { display: block; margin-top: 6px; color: #8c9e95; font-size: 11px; line-height: 1.7; }
.account { display: grid; grid-template-columns: 31px minmax(0, 1fr) 34px; align-items: center; gap: 8px; padding: 0 2px; }
.avatar { display: flex; align-items: center; justify-content: center; width: 31px; height: 35px; border: 1px solid #3e5147; border-radius: 8px; color: #a4d8bc; background: #263a30; font-size: 11px; font-weight: 650; }
.account-copy { min-width: 0; }
.account-copy strong { display: block; overflow: hidden; color: #d2dbd5; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.account-copy span { display: block; margin-top: 4px; overflow: hidden; color: #889c90; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.account .icon-button { width: 34px; min-height: 44px; padding: 7px; }
.sidebar-footnote { margin: 25px 9px 0; color: #657a6e; font-size: 8px; letter-spacing: 1.6px; }
.sidebar-backdrop { position: fixed; z-index: 1090; inset: 0; background: #192c4366; }
.main-shell { min-width: 0; min-height: 100svh; margin-left: 224px; }
.topbar { position: sticky; z-index: 900; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 76px; padding: 12px 32px; border-bottom: 1px solid var(--line); background: #fffffffa; backdrop-filter: blur(12px); }
.breadcrumb { display: flex; align-items: center; gap: 13px; min-width: 0; color: #65736b; font-size: 13px; }
.breadcrumb > .icon { width: 11px; height: 11px; }
.breadcrumb strong { overflow: hidden; color: #46564d; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 15px; flex-shrink: 0; }
.today { color: #65736b; font-size: 12px; }
.live-badge { display: inline-flex; align-items: center; gap: 7px; min-height: 29px; padding: 5px 8px; border-radius: 10px; color: #6a756e; background: #f0f3ee; font-size: 11px; font-weight: 600; white-space: nowrap; }
.live-badge i { width: 6px; height: 6px; border-radius: 50%; background: #8c9c91; }
.live-badge.online { color: #356e4f; }
.live-badge.online i { background: #4a8662; }
.live-badge.offline { color: #975b57; }
.live-badge.offline i { background: #aa6c66; }
#main-content { width: 100%; max-width: 1800px; min-width: 0; margin: 0 auto; padding: 31px 32px 0; }
.view { min-width: 0; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-heading > div { min-width: 0; }
.page-heading h1 { color: var(--ink); font-size: 32px; font-weight: 680; line-height: 1.2; letter-spacing: -1.15px; }
.page-heading p { margin-top: 9px; color: var(--muted); font-size: 15px; line-height: 1.7; }
.page-heading .eyebrow { margin-bottom: 9px; }
.page-heading > .button { flex-shrink: 0; }
.summary-heading { padding: 0; border: 0; background: transparent; }
.main-footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 32px; padding: 22px 0; border-top: 1px solid #e5eae4; color: #65736b; font-size: 11px; }

/* Los indicadores muestran información recibida. El diseño no rellena valores operativos ausentes. */
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.metric-card { min-width: 0; padding: 21px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 2px 4px #20302403; }
.metric-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.metric-icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 34px; height: 34px; border-radius: 9px; color: #39785a; background: #edf4ee; }
.metric-icon .icon { width: 18px; height: 18px; }
.metric-value { margin-top: 13px; color: var(--ink); font-size: 36px; font-weight: 650; letter-spacing: -1.4px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.metric-unit { margin-left: 7px; color: var(--muted); font-size: 16px; font-weight: 400; letter-spacing: 0; }
.metric-caption { margin-top: 11px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.tiny-dot { display: inline-block; width: 5px; height: 5px; margin-right: 6px; border-radius: 50%; background: var(--accent); vertical-align: 2px; }
.panel { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 2px 4px #20302403; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 84px; padding: 20px 22px; border-bottom: 1px solid #edf0eb; }
.panel-heading > div { min-width: 0; }
.panel-heading h2 { color: var(--ink); font-size: 16px; font-weight: 650; line-height: 1.5; }
.panel-heading p { margin-top: 5px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.panel-heading select { min-width: 160px; max-width: 48%; min-height: 44px; color: #46564d; background: #fafbf9; font-size: 14px; }
.soft-icon { color: #86938b; }
.panel-link { width: 100%; padding: 15px 21px; border-top: 1px solid #e5eae4; background: #fafbf9; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 2.3fr) minmax(255px, 1fr); gap: 20px; align-items: stretch; margin-bottom: 22px; }
.activity-panel { display: flex; flex-direction: column; }
.recent-alerts { flex: 1; min-width: 0; }

/* El mapa ocupa el centro de la operación; sus marcadores se dibujan solo con coordenadas de la API. */
.map-tools { display: flex; align-items: center; gap: 7px; padding: 11px 16px; border-bottom: 1px solid #e5eae4; background: #fafbf9; }
.map-tool { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 9px 11px; border: 1px solid #dce4da; border-radius: 7px; color: #5c6d60; background: #fff; font-size: 12px; font-weight: 600; }
.map-tool .icon { width: 15px; height: 15px; }
.map-tool.is-active { border-color: #bbd6c3; color: var(--accent); background: #edf5ef; }
.map-provider { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.map-container { position: relative; isolation: isolate; min-height: 360px; background: #e5eae4; }
#fleet-map { width: 100%; height: 360px; }
.map-empty { position: absolute; z-index: 500; top: 50%; left: 50%; display: flex; flex-direction: column; align-items: center; gap: 10px; width: calc(100% - 70px); max-width: 320px; padding: 25px; transform: translate(-50%, -50%); border: 1px solid #dce4d8; border-radius: 12px; color: #68766b; background: #fffffff5; box-shadow: 0 8px 28px #2238290d; text-align: center; pointer-events: none; }
.map-empty-icon { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; margin-bottom: 2px; border-radius: 12px; color: var(--accent); background: #edf4ed; }
.map-empty strong { color: #46564d; font-size: 16px; font-weight: 600; }
.map-empty > span:last-child { font-size: 14px; line-height: 1.8; }
.map-live-label { position: absolute; z-index: 450; top: 13px; right: 13px; display: flex; align-items: center; padding: 7px 9px; border: 1px solid #dce4d8; border-radius: 10px; color: #657569; background: #ffffffed; font-size: 9px; font-weight: 600; letter-spacing: .5px; pointer-events: none; }
.map-live-label .tiny-dot { background: #86938b; }
.map-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 14px 18px; border-top: 1px solid #e5eae4; color: var(--muted); font-size: 12px; }
.map-footer > span { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 6px; height: 6px; border-radius: 50%; background: #4d835f; }
.legend-dot.offline { background: #86938b; }
.last-updated { margin-left: auto; }
.map-marker { width: 20px; height: 20px; border: 4px solid #fff; border-radius: 50%; background: #467b5e; box-shadow: 0 1px 5px #20364f44; }
.map-marker.offline, .map-marker.pending { background: #86938b; }
.leaflet-control-zoom a { width: 44px !important; height: 44px !important; color: #46564d !important; line-height: 44px !important; }
.leaflet-control-attribution { font-size: 10px !important; }
.leaflet-popup-content { color: #46564d; font-size: 13px; line-height: 1.8; }
.leaflet-popup-content span { display: block; margin-top: 4px; }
.map-gps-details { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 15px; padding: 18px 21px; border-top: 1px solid #e5eae4; background: #fafbf9; }
.gps-summary, .gps-coordinates { display: grid; gap: 5px; font-size: 14px; }
.gps-summary strong { color: #46564d; font-size: 16px; }
.map-gps-details > strong, .map-gps-details > span { display: block; }
.gps-fresh { color: #417752; }
.gps-stale { color: #8a704b; }
.gps-coordinates { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.gps-map-link { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; }

/* Cada estado se distingue por texto y color: la operación se puede leer sin depender del color. */
.status-pill, .mobility-status, .trip-status { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 28px; padding: 4px 9px; border: 1px solid #dce4d8; border-radius: 10px; color: #65746a; background: #f2f5ef; font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.status-pill.online, .mobility-status.in_transit, .trip-status.active { border-color: #cae0cf; color: #157453; background: #edf6ee; }
.status-pill.offline, .status-pill.unknown, .mobility-status.unknown { border-color: #e5eae4; color: #65736b; background: #f1f4f0; }
.status-pill.warning, .mobility-status.stopped { border-color: #e4d5b6; color: #896b36; background: #fbf6e9; }
.status-pill.pending, .status-pill.neutral, .trip-status.completed { border-color: #e5eae4; color: #65736b; background: #fafbf9; }
.status-dot { display: block; flex: 0 0 7px; width: 7px; height: 7px; margin-left: auto; border-radius: 50%; background: #86938b; }
.status-dot.online { background: #568367; }
.status-dot.offline { background: #86938b; }
.status-dot.unknown { background: #9b845f; }

/* La duración confirmada de una unidad permanece separada de la frescura del GPS. */
.mobility-panel { margin-bottom: 24px; scroll-margin-top: 90px; }
.mobility-heading { flex-wrap: wrap; }
.mobility-context { display: grid; gap: 6px; padding: 18px 22px 0; color: var(--muted); font-size: 14px; line-height: 1.8; }
.mobility-error { margin: 16px 21px 0; }
.mobility-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; padding: 20px 22px 24px; }
.mobility-stat { display: flex; flex-direction: column; min-width: 0; padding: 4px 20px; border-right: 1px solid #e5eae4; }
.mobility-stat:first-child { padding-left: 0; }
.mobility-stat:last-child { border-right: 0; }
.mobility-stat > span { min-height: 38px; color: var(--muted); font-size: 14px; }
.mobility-stat > strong { display: block; margin: 14px 0 9px; color: var(--ink); font-size: 28px; font-weight: 600; line-height: 1.3; letter-spacing: -.8px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.mobility-stat > .mobility-time-value { font-size: 17px; line-height: 1.65; letter-spacing: 0; }
.mobility-stat > small { color: var(--muted); font-size: 13px; line-height: 1.8; }
.mobility-history-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 21px; border-top: 1px solid #e5eae4; }
.mobility-history-heading h3 { color: var(--ink); font-size: 17px; }
.mobility-history-heading p { margin-top: 6px; color: var(--muted); font-size: 13px; }
.mobility-history-heading > span { font-size: 13px; }
.mobility-empty { padding: 30px 20px; }
.mobility-note { padding: 17px 21px; border-top: 1px solid #e5eae4; color: var(--muted); font-size: 13px; line-height: 1.9; }
.mobility-location { display: block; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mobility-map-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 9px; }
.mobility-map-actions .button { min-height: 44px; padding: 8px 11px; font-size: 14px; }
.mobility-map-actions a { display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; text-decoration: underline; }

/* Cada tarjeta conserva la hora de sus sensores y el acceso a su posición real. */
.vehicle-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; padding: 20px; }
.vehicle-cards > .empty-state { grid-column: 1 / -1; }
.vehicle-card { min-width: 0; border: 1px solid #e0e6dc; border-radius: 10px; background: #fff; }
.vehicle-card-head { display: flex; align-items: center; gap: 10px; padding: 17px 16px; border-bottom: 1px solid #f1f4f0; }
.vehicle-card-head > div { min-width: 0; }
.vehicle-card-head strong { display: block; color: #46564d; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.plate { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.vehicle-temp { padding: 17px 17px 0; color: #46564d; font-size: 33px; font-weight: 600; line-height: 1.3; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.vehicle-temp > small { margin-left: 5px; color: #65736b; font-size: 18px; font-weight: 400; }
.vehicle-temp.outside, .temperature-outside { color: #a65850; }
.vehicle-speed { padding: 13px 17px 17px; color: #65736b; font-size: 21px; font-weight: 500; font-variant-numeric: tabular-nums; }
.vehicle-reading-time { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; font-weight: 400; letter-spacing: 0; line-height: 1.7; }
.vehicle-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; border-top: 1px solid #f1f4f0; background: #fafbf9; }
.vehicle-card-foot > span { color: var(--muted); font-size: 12px; }
.vehicle-card-foot button { min-height: 44px; padding: 0; border: 0; color: var(--accent); background: none; font-size: 13px; font-weight: 600; }

/* La tabla desplaza su contenido dentro del panel; position relative ancla las etiquetas accesibles. */
.table-scroll { position: relative; width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
th { padding: 15px 19px; border-bottom: 1px solid #e5eae4; color: #65736b; background: #fafbf9; font-size: 13px; font-weight: 600; white-space: nowrap; }
td { padding: 18px 19px; border-bottom: 1px solid #e5eae4; color: #65736b; font-size: 14px; line-height: 1.8; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbf9; }
td strong { color: #46564d; font-weight: 600; }
.subline { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.table-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.table-actions .button { min-height: 44px; padding: 8px 12px; font-size: 13px; white-space: nowrap; }
#view-flota table { min-width: 930px; }

/* Las incidencias muestran su evidencia y una acción real para registrar que fueron revisadas. */
.alert-item { display: flex; align-items: flex-start; gap: 13px; padding: 21px; border-bottom: 1px solid #e5eae4; }
.alert-item:last-child { border-bottom: 0; }
.alert-symbol { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 34px; height: 34px; border-radius: 9px; color: #986d20; background: #fbf3e3; }
.alert-symbol .icon { width: 18px; height: 18px; }
.alert-symbol.critical { color: #a26a65; background: #fbefed; }
.alert-copy { flex: 1; min-width: 0; }
.alert-copy strong { display: block; color: #46564d; font-size: 15px; font-weight: 600; }
.alert-copy p { margin-top: 7px; color: var(--muted); font-size: 14px; line-height: 1.85; overflow-wrap: anywhere; }
.alert-copy time { display: block; margin-top: 9px; color: #86938b; font-size: 12px; }
.alert-item > .button { flex-shrink: 0; min-height: 44px; margin-left: auto; padding: 8px 12px; font-size: 13px; }
.events-list .alert-item { padding: 23px; }
#event-total { font-size: 14px; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; padding: 43px 28px; text-align: center; }
.empty-icon { display: inline-flex; align-items: center; justify-content: center; width: 45px; height: 45px; margin-bottom: 18px; border-radius: 12px; color: #6c8d73; background: #eff4ed; }
.empty-icon .icon { width: 23px; height: 23px; }
.empty-state h3 { color: #46564d; font-size: 18px; font-weight: 600; line-height: 1.6; }
.empty-state p { max-width: 440px; margin-top: 10px; color: var(--muted); font-size: 14px; line-height: 1.9; }
.empty-state .button { margin-top: 22px; }
.mini-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 210px; padding: 28px 22px; text-align: center; }
.mini-empty .empty-icon { width: 38px; height: 38px; margin-bottom: 14px; }
.mini-empty strong { color: #65736b; font-size: 16px; font-weight: 500; }
.mini-empty p { max-width: 300px; margin-top: 10px; color: var(--muted); font-size: 14px; line-height: 1.9; }

/* La auditoría distingue el informe por reglas del análisis opcional con un servicio de IA. */
.audit-controls { display: grid; grid-template-columns: minmax(200px, 1.4fr) minmax(180px, 1fr) auto auto; align-items: end; gap: 17px; margin-bottom: 22px; padding: 22px; }
.audit-controls label { min-width: 0; color: var(--muted); font-size: 14px; }
.audit-controls select { width: 100%; margin-top: 9px; font-size: 16px; }
.audit-controls .button { font-size: 14px; }
.audit-empty { min-height: 330px; }
.audit-result-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 29px 0 24px; }
.audit-result-top h2 { margin-top: 8px; color: var(--ink); font-size: 26px; font-weight: 600; }
.audit-result-top p { margin-top: 9px; font-size: 14px; }
/* Los dictámenes completos deben poder leerse también en el ancho de un teléfono. */
#audit-verdict { max-width: 100%; white-space: normal; overflow-wrap: anywhere; text-align: left; }
.reading-history-panel { margin-top: 24px; }
.reading-history-panel table { min-width: 930px; }
.reading-history-panel .small-note { padding: 17px 21px; font-size: 13px; }
.audit-bottom { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; margin-top: 24px; }
.audit-findings, .ai-content { padding: 23px; }
.finding { display: flex; align-items: flex-start; gap: 12px; padding: 14px 0; color: var(--muted); font-size: 15px; line-height: 1.9; }
.finding:first-child { padding-top: 0; }
.finding .icon { flex: 0 0 18px; width: 18px; height: 18px; margin-top: 4px; color: #65736b; }
.ai-content > .muted { font-size: 15px; line-height: 1.9; }
.ai-content > .button { margin-top: 21px; }
.ai-tag { padding: 4px 7px; border: 1px solid #d7ded6; color: #65736b; font-size: 12px; }
.ai-output { margin-top: 22px; padding: 18px; border-left: 2px solid #bac5bb; color: #46564d; background: #fafbf9; font-size: 15px; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; }
.temperature-chart { min-height: 275px; padding: 24px; }
.temperature-chart svg { display: block; width: 100%; height: auto; min-height: 220px; }
.chart-key { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.line-key { width: 20px; height: 2px; background: #65736b; }
.chart-grid { stroke: #e5eae4; stroke-width: 1; }
.chart-axis-text { fill: #65736b; font-family: inherit; font-size: 11px; }
.chart-limit { stroke: #ac9671; stroke-width: 1; stroke-dasharray: 5 5; }
.chart-line { fill: none; stroke: #347c55; stroke-width: 2; stroke-linejoin: round; }
.chart-point { fill: #347c55; stroke: #fff; stroke-width: 1.3; }

/* La conexión documenta recursos reales del equipo y reserva sus claves al operador autenticado. */
.connection-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; margin-bottom: 24px; }
.connection-content { padding: 24px; }
.connection-content > p { color: var(--muted); font-size: 15px; line-height: 1.9; }
.connection-content label { margin: 2px 0 10px; font-size: 14px; font-weight: 600; }
.connection-content select { width: 100%; }
#connection-key { width: 100%; margin: 24px 0 13px; }
.copy-field { display: flex; gap: 9px; min-width: 0; }
.copy-field input { flex: 1; width: 0; min-width: 0; font-size: 14px; }
.copy-field .button { flex-shrink: 0; font-size: 14px; }
/* Estas preferencias pertenecen al operador; los detalles del circuito se consultan en LEEME. */
.setting-title { display: flex; align-items: center; gap: 13px; }
.setting-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 43px; width: 43px; height: 43px; border: 1px solid #deeadf; border-radius: 12px; color: var(--accent); background: #f0f6ee; }
.setting-title h2 { margin: 0; }
.setting-title p { margin-top: 3px; font-size: 13px; }
.connection-details { margin-top: 23px; border-top: 1px solid var(--line); }
.connection-details summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; color: #526459; cursor: pointer; font-size: 13px; font-weight: 600; list-style: none; }
.connection-details summary::-webkit-details-marker { display: none; }
.connection-details[open] summary .icon { transform: rotate(90deg); }
.connection-details label { margin-top: 10px; font-size: 13px; }
.connection-details .small-note { margin-top: 11px; }
.notification-preview { display: flex; align-items: flex-start; gap: 13px; margin: 24px 0; padding: 17px; border: 1px solid #e2e9de; border-radius: 11px; background: #f7faf3; }
.notification-preview-mark { display: flex; align-items: center; justify-content: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 9px; color: #fff; background: #26704b; }
.notification-preview strong { display: block; margin: 0 0 5px; color: #354b3c; font-size: 13px; font-weight: 650; }
.notification-preview div > span { display: block; color: #6c7a6e; font-size: 13px; line-height: 1.7; }
.notifications-state { margin-bottom: 15px; font-size: 13px !important; }
#notifications-enable { width: 100%; }
#notifications-help { margin-top: 13px; font-size: 13px; }
.notification-shortcut { border: 1px solid #e1e7dc; background: #fff; }
.notification-shortcut.is-active, .notification-shortcut[aria-pressed="true"] { color: #157453; background: #edf5ec; border-color: #d3e3d3; }
.sidebar .icon-button { color: #899e91; }
.sidebar .icon-button:hover { color: #e7f4e9; background: #2a3c31; }
.login-story .eyebrow { color: #77b898; }

/* Los filtros de viajes operan sobre fechas de inicio y estado administrativo, no sobre movimiento. */
.trips-page-heading { align-items: center; }
.trip-list-note { color: var(--muted); font-size: 13px; }
/* El acabado titanio distingue los filtros; los campos y su distribución siguen siendo los mismos. */
.trip-filters { display: grid; grid-template-columns: minmax(170px, 1.5fr) repeat(4, minmax(0, 1fr)) auto; align-items: end; gap: 13px; padding: 21px; border-bottom: 1px solid #d4d9de; background: linear-gradient(125deg, #f7f8f9, #eceff1 60%, #f4f5f6); box-shadow: inset 0 1px 0 #fff; }
.trip-filters > div { min-width: 0; }
.trip-filters label { margin-bottom: 9px; color: #47515b; font-size: 13px; }
.trip-filters input, .trip-filters select { width: 100%; min-width: 0; min-height: 46px; padding: 10px 11px; border-color: #c7ced4; color: #28313a; background: linear-gradient(180deg, #fff, #f8f9fa); box-shadow: 0 1px 2px #27323c08, inset 0 1px 0 #fff; font-size: 16px; }
.trip-filters input:hover, .trip-filters select:hover { border-color: #9ca7b1; }
.trip-filters input:focus, .trip-filters select:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px #15745314; }
.trip-filters input::placeholder { color: #66737e; }
.trip-filters input[type="date"] { inline-size: 100%; }
.search-input { position: relative; min-width: 0; }
.search-input > .icon { position: absolute; top: 15px; left: 11px; width: 16px; height: 16px; color: #86938b; pointer-events: none; }
.search-input input { padding-left: 35px; }
.trip-filters .button { min-height: 46px; border-color: #aeb7c0; color: #35414d; background: linear-gradient(180deg, #f9fafb, #e0e5e9); box-shadow: 0 1px 2px #27323c12, inset 0 1px 0 #fff; font-size: 14px; }
.trip-filters .button:hover:not(:disabled) { border-color: #87939f; background: linear-gradient(180deg, #fff, #d7dfe5); }
.trips-inline-message { margin: 17px 21px; }
.trips-loading { padding: 33px 23px; color: var(--muted); font-size: 16px; text-align: center; }
.trips-range-note { margin: 0; padding: 17px 21px; border-top: 1px solid #e5eae4; color: var(--muted); font-size: 13px; line-height: 1.9; }
.trips-table { min-width: 1030px; }
.trips-table td { vertical-align: middle; }
.trips-table td:first-child strong { display: block; max-width: 230px; overflow-wrap: anywhere; }
.trips-table .button { min-height: 44px; padding: 9px 12px; font-size: 14px; white-space: nowrap; }
.trip-route-cell { max-width: 230px; overflow-wrap: anywhere; }
.trip-route-destination { display: flex; align-items: center; gap: 7px; margin-top: 8px; color: #65736b; }
.trip-route-destination .icon { flex: 0 0 12px; width: 12px; height: 12px; }
.optional-label { color: var(--muted); font-weight: 400; }
#trip-form select, #trip-form textarea { display: block; width: 100%; margin-top: 8px; }
#trip-form textarea { min-height: 92px; }
.trip-source-box { display: flex; align-items: flex-start; gap: 12px; margin-top: 22px; padding: 17px; border: 1px solid #e5eae4; border-radius: 8px; background: #fafbf9; }
.trip-source-box > .icon { flex: 0 0 20px; margin-top: 2px; color: #86938b; }
.trip-source-box strong { display: block; color: #65736b; font-size: 14px; font-weight: 600; }
.trip-source-box p { margin-top: 7px; font-size: 14px; }
.trip-tracking-button { width: 100%; margin-top: 13px; }
.tracking-explanation { display: flex; align-items: flex-start; gap: 14px; padding: 18px; border: 1px solid #e5eae4; background: #fafbf9; }
.tracking-explanation .metric-icon { flex-shrink: 0; }
.tracking-dialog-actions { flex-wrap: wrap; }
.tracking-dialog-actions .button:first-child { margin-right: auto; }

/* El detalle coloca ruta y sensores lado a lado. Las horas y los gráficos corresponden a evidencia real. */
.trip-detail-dialog { width: calc(100% - 56px); max-width: 1220px; max-height: calc(100svh - 56px); padding: 0; border-color: #c2cec0; border-radius: 14px; background: #f5f7f2; }
.trip-detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; padding: 23px 27px; border-bottom: 1px solid #e5eae4; background: #fff; }
.trip-detail-header > div:first-child { min-width: 0; }
.trip-detail-header .eyebrow { font-size: 11px; }
.trip-detail-header h2 { color: #46564d; font-size: 27px; font-weight: 600; letter-spacing: -.7px; overflow-wrap: anywhere; }
.trip-detail-header p { margin-top: 9px; color: var(--muted); font-size: 14px; }
.trip-detail-header-actions { display: flex; align-items: center; gap: 17px; }
.trip-detail-header-actions .icon-button { flex: 0 0 44px; margin: -2px -7px 0 0; font-size: 26px; }
.trip-detail-error { margin: 18px 25px; }
.trip-detail-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(340px, 1fr); gap: 0; background: #fff; }
.trip-map-section { min-width: 0; border-right: 1px solid #e5eae4; }
.trip-route-heading { display: flex; align-items: center; gap: 16px; min-height: 93px; padding: 19px 24px; }
.trip-route-heading > .icon { flex: 0 0 17px; color: #bac5bb; }
.trip-route-point { flex: 1; min-width: 0; }
.trip-route-point small { display: block; margin-bottom: 8px; color: #65736b; font-size: 10px; letter-spacing: 1.3px; }
.trip-route-point strong { color: #65736b; font-size: 16px; font-weight: 600; line-height: 1.7; overflow-wrap: anywhere; }
.trip-map-container { position: relative; isolation: isolate; min-height: 390px; background: #f1f4f0; }
#trip-detail-map { width: 100%; height: 390px; }
.trip-map-empty { position: absolute; z-index: 500; top: 50%; left: 50%; display: flex; flex-direction: column; align-items: center; gap: 12px; width: calc(100% - 48px); max-width: 330px; padding: 23px; transform: translate(-50%, -50%); border: 1px solid #e5eae4; border-radius: 8px; background: #fffffff2; text-align: center; pointer-events: none; }
.trip-map-empty > .icon { color: #86938b; }
.trip-map-empty strong { color: #65736b; font-size: 16px; font-weight: 600; }
.trip-map-empty span { color: var(--muted); font-size: 14px; line-height: 1.9; }
.trip-map-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 20px 6px; }
.trip-map-tools .button { min-height: 44px; padding: 9px 12px; font-size: 14px; }
.trip-map-tools [aria-pressed="true"] { border-color: #bac5bb; color: #65736b; background: #f1f4f0; }
.trip-map-tools a { display: inline-flex; align-items: center; min-height: 44px; margin-left: auto; font-size: 13px; text-decoration: underline; }
.trip-map-state { margin: 0; padding: 7px 23px 18px; color: var(--muted); font-size: 13px; line-height: 1.9; overflow-wrap: anywhere; }
.trip-telemetry { min-width: 0; padding: 23px; }
.trip-unit-heading { display: flex; align-items: center; gap: 12px; }
.trip-unit-heading > div { min-width: 0; }
.trip-unit-heading strong { display: block; color: #46564d; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.trip-unit-heading span:not(.metric-icon) { display: block; margin-top: 5px; color: var(--muted); font-size: 13px; }
.trip-tracking-state { margin-top: 17px; padding: 9px 11px; border-left: 2px solid #bac5bb; color: #65736b; background: #fafbf9; font-size: 14px; }
.trip-movement-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 17px; }
.trip-movement-heading > span:last-child { color: var(--muted); font-size: 12px; line-height: 1.8; }
.trip-motion-reason { margin-top: 9px; color: var(--muted); font-size: 14px; line-height: 1.9; }
.trip-live-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 17px; }
.trip-sensor-card { min-width: 0; padding: 14px 12px 10px; border: 1px solid #dce5d8; border-radius: 10px; background: #fafcf8; }
.trip-sensor-card > div:first-child, .trip-stop-card > div { display: flex; align-items: center; gap: 7px; color: #65736b; font-size: 13px; line-height: 1.7; }
.trip-sensor-card .icon, .trip-stop-card .icon { flex: 0 0 16px; width: 16px; height: 16px; }
.trip-sensor-card > strong { display: block; margin-top: 10px; color: #46564d; font-size: 28px; font-weight: 600; line-height: 1.3; letter-spacing: -.9px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.trip-sensor-card > small { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.trip-mini-chart { min-height: 76px; margin-top: 7px; }
.trip-mini-chart svg { display: block; width: 100%; height: 61px; overflow: visible; }
.trip-chart-axis { stroke: #e5eae4; stroke-width: 1; }
.trip-chart-line { fill: none; stroke: #347c55; stroke-width: 2; stroke-linejoin: round; }
.trip-chart-point { fill: #347c55; }
.trip-chart-range, .trip-chart-empty { display: block; color: var(--muted); font-size: 11px; line-height: 1.7; }
.trip-chart-empty { padding-top: 20px; text-align: center; }
.trip-stop-card { margin-top: 14px; padding: 17px; border: 1px solid #dce5d8; border-radius: 10px; background: #f2f7ef; }
.trip-stop-card > strong { display: block; margin: 12px 0 9px; color: #65736b; font-size: 28px; font-weight: 600; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.trip-stop-card p { margin-top: 6px; color: var(--muted); font-size: 13px; }
.trip-time-list { margin-top: 16px; }
.trip-time-list > div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-top: 1px solid #e5eae4; font-size: 13px; line-height: 1.8; }
.trip-time-list dt { color: var(--muted); }
.trip-time-list dd { max-width: 57%; margin: 0; color: #65736b; text-align: right; font-variant-numeric: tabular-nums; }
.trip-evidence-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(250px, 1fr); gap: 20px; padding: 21px; border-top: 1px solid #e5eae4; }
.trip-stops-section, .trip-events-section { min-width: 0; overflow: hidden; border: 1px solid #e5eae4; border-radius: 8px; background: #fff; }
.trip-section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px; border-bottom: 1px solid #e5eae4; }
.trip-section-heading h3 { color: #65736b; font-size: 16px; font-weight: 600; }
.trip-section-heading > span { color: var(--muted); font-size: 14px; }
.trip-stops-section table { min-width: 850px; }
.trip-stops-section td { vertical-align: top; }
.trip-stops-section td .button { display: flex; min-height: 44px; margin-top: 8px; padding: 8px 11px; font-size: 13px; }
.trip-events { max-height: 390px; overflow-y: auto; }
.trip-event { display: flex; align-items: flex-start; gap: 11px; padding: 17px; border-bottom: 1px solid #f1f4f0; }
.trip-event:last-child { border-bottom: 0; }
.trip-event-icon { display: flex; align-items: center; justify-content: center; flex: 0 0 28px; width: 28px; height: 28px; color: #86938b; background: #fafbf9; }
.trip-event > div { min-width: 0; }
.trip-event strong { display: block; color: #65736b; font-size: 14px; font-weight: 500; line-height: 1.8; overflow-wrap: anywhere; }
.trip-event div > span { display: block; margin-top: 7px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.trip-detail-notes { margin: 0 23px 17px; padding: 16px 18px; border: 1px solid #e5eae4; color: var(--muted); background: #fff; overflow-wrap: anywhere; white-space: pre-wrap; }
.trip-detail-disclaimer { margin: 0 !important; padding: 0 24px 23px; color: var(--muted); font-size: 13px; line-height: 1.9; }
.trip-detail-actions { position: sticky; z-index: 1000; bottom: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; padding: 16px 24px; border-top: 1px solid #e5eae4; background: #fffffffa; }
.trip-detail-actions .button { min-height: 46px; font-size: 14px; }
.trip-detail-actions .button:first-child { margin-right: auto; }

/* Los formularios nativos conservan confirmación, teclado y cierre accesibles en PC y Android. */
dialog { width: calc(100% - 36px); max-width: 560px; max-height: calc(100svh - 36px); padding: 28px; overflow-y: auto; border: 1px solid #c4d0c0; border-radius: 14px; color: var(--ink); background: #fff; box-shadow: 0 24px 80px #1022183d; overscroll-behavior: contain; }
dialog::backdrop { background: #101b20a8; backdrop-filter: blur(4px); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 25px; }
.dialog-heading > div { min-width: 0; }
.dialog-heading .eyebrow { font-size: 11px; }
.dialog-heading h2 { color: var(--ink); font-size: 27px; font-weight: 650; letter-spacing: -.7px; }
.dialog-heading .icon-button { margin: -8px -8px 0 0; font-size: 26px; }
dialog form > label { margin: 20px 0 9px; font-size: 14px; }
dialog input, dialog select, dialog textarea { width: 100%; font-size: 16px; }
dialog p { color: var(--muted); font-size: 15px; line-height: 1.9; }
dialog > p { margin-bottom: 20px; }
dialog .small-note { margin-top: 18px; font-size: 14px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; min-width: 0; margin-top: 20px; }
.form-row > div { min-width: 0; }
.form-row label { margin-bottom: 9px; font-size: 14px; }
.dialog-actions { display: flex; align-items: center; justify-content: flex-end; gap: 11px; margin-top: 26px; padding-top: 22px; border-top: 1px solid #e5eae4; }
.dialog-actions .button { font-size: 15px; }
#device-key { font: 14px ui-monospace, Consolas, monospace; }
.form-error { margin-top: 16px; padding: 12px 14px; border-left: 2px solid #b7817d; color: #965b53; background: #fcf4f2; font-size: 14px; line-height: 1.8; overflow-wrap: anywhere; }
.error-banner { margin-bottom: 22px; padding: 15px 18px; border: 1px solid #e4ccc6; border-radius: 8px; color: #9e6558; background: #fff6f2; font-size: 15px; line-height: 1.8; }
.error-banner button { min-height: 44px; margin-left: 9px; padding: 0; border: 0; color: inherit; background: none; text-decoration: underline; }
.toast { position: fixed; z-index: 3000; right: 24px; bottom: 24px; max-width: 430px; padding: 16px 20px; border: 1px solid #3b604c; border-radius: 10px; color: #f3f8f0; background: #193a2b; box-shadow: 0 8px 30px #10221826; font-size: 14px; line-height: 1.8; }
.initial-loading { position: fixed; z-index: 4000; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 21px; color: #46634f; background: #f5f6f4; font-size: 16px; }
.loading-symbol { width: 32px; height: 37px; fill: none; stroke: #86938b; stroke-width: 1.2; }
noscript { display: block; padding: 24px; color: #8a3b35; background: #fff; }

/* La tableta conserva el menú y redistribuye filtros sin comprimir campos ni controles. */
@media (max-width: 1280px) {
  .trip-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .trip-filters .button { justify-self: stretch; }
  .audit-controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .audit-controls .button { width: 100%; }
  .metric-card { padding: 18px; }
  .map-provider { display: none; }
}

@media (max-width: 1100px) {
  .login-story { padding: 38px 32px 26px; }
  .login-form-wrap { padding: 38px 30px; }
  .sidebar { width: 204px; padding-right: 12px; padding-left: 12px; }
  .main-shell { margin-left: 204px; }
  .topbar { padding-right: 23px; padding-left: 23px; }
  #main-content { padding: 25px 23px 0; }
  .today { display: none; }
  .topbar-right { gap: 13px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .activity-panel .mini-empty { min-height: 160px; }
  .recent-alerts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .recent-alerts > .mini-empty { grid-column: 1 / -1; }
  .recent-alerts .alert-item { padding: 20px; border-right: 1px solid #e5eae4; border-bottom: 0; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vehicle-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mobility-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 23px 0; }
  .mobility-stat:nth-child(3) { padding-left: 0; }
  .mobility-stat:nth-child(2) { border-right: 0; }
  .connection-grid { grid-template-columns: minmax(0, 1fr); }
  .audit-bottom { grid-template-columns: minmax(0, 1fr); }
  .trip-detail-grid { grid-template-columns: minmax(0, 1.2fr) minmax(330px, 1fr); }
  .trip-telemetry { padding: 18px; }
  .trip-evidence-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (min-width: 761px) and (max-width: 900px) {
  .page-heading { flex-wrap: wrap; align-items: flex-start; }
  .page-heading h1 { font-size: 28px; }
  .trip-detail-grid { grid-template-columns: minmax(0, 1fr); }
  .trip-map-section { border-right: 0; border-bottom: 1px solid #e5eae4; }
  .trip-map-container { min-height: 320px; }
  #trip-detail-map { height: 320px; }
  .login-story { padding-right: 25px; padding-left: 25px; }
  .login-story .login-footer { flex-direction: column; align-items: flex-start; }
  .auth-heading h2 { font-size: 30px; }
}

/* En teléfono el menú se abre como cajón. Las tablas siguen dentro de su propio contenedor. */
@media (max-width: 760px) {
  .mobile-only { display: inline-flex; }
  .login-screen { grid-template-columns: minmax(0, 1fr); min-height: 100svh; }
  .login-story { align-items: center; min-height: 0; padding: 22px 24px; border-right: 0; border-bottom: 1px solid #2e3c35; background: #161b22; }
  .login-story .brand-mark { width: 26px; height: 31px; }
  .login-story .brand-wordmark { font-size: 23px; }
  .login-story .brand-wordmark small { font-size: 9px; }
  .login-story .login-edition, .login-story .login-footer { display: none; }
  .login-story .login-message { margin-top: 24px; margin-bottom: 0; padding: 0; }
  .login-story .login-message .eyebrow { display: none; }
  .login-story .login-identity { flex-direction: row; gap: 16px; }
  .login-story .login-identity-mark { width: 72px; height: 72px; }
  .login-compass { flex-shrink: 0; width: 84px; height: 84px; }
  .login-compass-north { top: 4px; font-size: 8px; }
  .login-compass-controls { gap: 7px; margin-top: 17px; }
  .login-compass-status { max-width: 280px; }
  .login-compass-reading { font-size: 12px; }
  .login-story .login-identity-name { font-size: clamp(44px, 10vw, 60px); letter-spacing: 1.5px; }
  .login-story .login-identity-name span { margin-top: 12px; padding-left: 4px; font-size: 9px; letter-spacing: 4px; }
  .login-form-wrap { align-items: flex-start; padding: 29px 24px 35px; }
  .auth-panel { max-width: 430px; }
  .auth-panel > .eyebrow { margin-bottom: 18px; text-align: center; }
  .auth-tabs { gap: 5px; margin-bottom: 27px; }
  .auth-tabs button { min-height: 44px; padding-right: 8px; padding-left: 8px; font-size: 15px; }
  .auth-heading { text-align: center; }
  .auth-heading h2 { font-size: 32px; }
  .auth-heading > p { margin-top: 12px; font-size: 16px; }
  .auth-panel .security-note { justify-content: center; }
  .auth-panel .auth-footer { text-align: center; }
  .auth-footer { margin-top: 22px; }
  .sidebar { width: min(290px, calc(100% - 52px)); padding: 29px 17px 22px; transform: translateX(-100%); transition: transform .18s ease; }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar .brand-wordmark { font-size: 25px; }
  .sidebar .brand-wordmark small { font-size: 9px; }
  .sidebar .brand-mark { width: 28px; height: 32px; }
  .workspace-label { font-size: 10px; }
  .nav-item { min-height: 49px; font-size: 16px; }
  .nav-item .icon { width: 21px; height: 21px; }
  .connection-card strong { font-size: 14px; }
  .connection-card div > span { font-size: 13px; }
  .account { grid-template-columns: 35px minmax(0, 1fr) 44px; gap: 11px; }
  .avatar { width: 35px; height: 40px; font-size: 13px; }
  .account-copy strong { font-size: 14px; }
  .account-copy span { font-size: 12px; }
  .account .icon-button { width: 44px; height: 44px; }
  .main-shell { margin-left: 0; }
  .topbar { min-height: 66px; gap: 7px; padding: 9px 14px; }
  .breadcrumb { gap: 7px; }
  .breadcrumb > span, .breadcrumb > .icon { display: none; }
  .breadcrumb strong { font-size: 15px; }
  .topbar-right { gap: 8px; }
  .live-badge { gap: 6px; font-size: 12px; }
  .topbar .icon-button { width: 42px; min-height: 44px; }
  #main-content { padding: 24px 16px 0; }
  .page-heading { flex-wrap: wrap; align-items: flex-start; gap: 17px; margin-bottom: 23px; }
  .page-heading h1 { font-size: 28px; }
  .page-heading p { font-size: 15px; }
  .page-heading > .button { min-height: 46px; padding: 11px 15px; font-size: 15px; }
  .page-heading > .status-pill { display: none; }
  .metric-grid { gap: 12px; margin-bottom: 20px; }
  .metric-card { padding: 16px 14px; }
  .metric-top { align-items: flex-start; gap: 6px; font-size: 12px; }
  .metric-icon { width: 26px; height: 26px; }
  .metric-icon .icon { width: 16px; height: 16px; }
  .metric-value { margin-top: 12px; font-size: 32px; }
  .metric-caption { min-height: 39px; margin-top: 10px; font-size: 12px; }
  .metric-unit { margin-left: 5px; font-size: 14px; }
  .dashboard-grid { gap: 19px; margin-bottom: 20px; }
  .panel-heading { min-height: 78px; flex-wrap: wrap; gap: 13px; padding: 18px 17px; }
  .panel-heading h2 { font-size: 17px; }
  .panel-heading p { font-size: 14px; }
  .panel-heading select { max-width: 100%; min-height: 46px; font-size: 16px; }
  .map-panel .panel-heading { display: block; }
  .map-panel .panel-heading select { width: 100%; margin-top: 15px; }
  .map-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 10px 12px; }
  .map-tool { min-width: 0; min-height: 44px; padding: 8px 4px; font-size: 12px; }
  .map-tool .icon { display: none; }
  .map-container { min-height: 315px; }
  #fleet-map { height: 315px; }
  .map-empty { width: calc(100% - 42px); max-width: 300px; padding: 22px; }
  .map-empty strong { font-size: 15px; }
  .map-empty > span:last-child { font-size: 13px; }
  .map-live-label { top: 12px; right: 12px; font-size: 8px; }
  .map-footer { gap: 10px 13px; padding: 14px; font-size: 12px; }
  .last-updated { width: 100%; margin-left: 0; }
  .map-gps-details { display: block; padding: 17px; }
  .gps-coordinates { margin-top: 12px; }
  .gps-map-link { margin-top: 7px; }
  .recent-alerts { display: block; }
  .recent-alerts .alert-item { border-right: 0; border-bottom: 1px solid #e5eae4; }
  .recent-alerts .mini-empty { min-height: 170px; }
  .panel-link { padding: 13px 17px; }
  .mobility-panel { margin-bottom: 20px; }
  .mobility-context { padding: 16px 17px 0; }
  .mobility-stats { gap: 24px 0; padding: 22px 17px; }
  .mobility-stat { padding: 0 13px; }
  .mobility-stat > span { min-height: 40px; font-size: 13px; }
  .mobility-stat > strong { font-size: 26px; }
  .mobility-stat > small { font-size: 12px; }
  .mobility-stat > .mobility-time-value { font-size: 15px; }
  .mobility-history-heading { padding: 17px; }
  .mobility-history-heading h3 { font-size: 16px; }
  .mobility-note { padding: 17px; }
  .mobility-error { margin-right: 16px; margin-left: 16px; }
  .vehicle-cards { grid-template-columns: minmax(0, 1fr); gap: 15px; padding: 17px; }
  .vehicle-card-head .metric-icon { width: 32px; height: 32px; }
  .vehicle-temp { font-size: 35px; }
  .vehicle-card-foot > span { font-size: 12px; }
  .vehicle-card-foot button { font-size: 13px; }
  .empty-state { padding: 34px 20px; }
  .events-list .alert-item { flex-wrap: wrap; gap: 12px; padding: 20px 17px; }
  .events-list .alert-item > .button, .events-list .alert-item > .status-pill { margin-left: 44px; }
  .audit-controls { gap: 17px 12px; padding: 17px; }
  .audit-controls label { font-size: 13px; }
  .audit-controls .button { min-width: 0; padding: 10px 7px; font-size: 14px; }
  .audit-controls .button .icon { display: none; }
  .audit-controls select { min-width: 0; font-size: 16px; }
  .audit-result-top { flex-wrap: wrap; }
  .audit-result-top h2 { font-size: 24px; }
  .temperature-chart { min-height: 215px; padding: 20px 12px; }
  .temperature-chart svg { min-height: 180px; }
  .chart-key { font-size: 12px; }
  .audit-findings, .ai-content { padding: 19px 17px; }
  .connection-content { padding: 20px 17px; }
  .copy-field { gap: 7px; }
  .copy-field .button { padding: 9px 12px; font-size: 14px; }
  .trip-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 12px; padding: 17px; }
  .trip-search-field, .trip-filters > .button { grid-column: 1 / -1; }
  .trip-filters input, .trip-filters select { min-height: 46px; padding: 11px 9px; font-size: 16px; }
  .search-input input { padding-left: 35px; }
  .trip-list-note { display: none; }
  .trips-range-note { padding: 17px; }
  .trips-inline-message { margin: 16px; }

  /* En el detalle móvil, los sensores aparecen primero y el mapa conserva un alto compacto. */
  .trip-detail-dialog { width: calc(100% - 16px); max-height: calc(100svh - 16px); border-radius: 10px; }
  .trip-detail-header { gap: 12px; padding: 20px 17px; }
  .trip-detail-header h2 { font-size: 24px; }
  .trip-detail-header .eyebrow { margin-bottom: 8px; font-size: 10px; }
  .trip-detail-header p { font-size: 12px; }
  .trip-detail-header-actions { flex-direction: column-reverse; align-items: flex-end; gap: 11px; }
  .trip-detail-header-actions .trip-status { font-size: 12px; }
  .trip-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 18px; }
  .trip-telemetry { display: contents; }
  .trip-unit-heading { order: 1; margin: 0 17px 15px; }
  .trip-unit-heading .metric-icon { width: 32px; height: 32px; }
  .trip-movement-heading { order: 2; margin: 0 17px 14px; }
  .trip-live-metrics { order: 3; gap: 11px; margin: 0 17px 18px; }
  .trip-sensor-card { padding: 12px 10px 8px; }
  .trip-sensor-card > div:first-child { font-size: 12px; }
  .trip-sensor-card > strong { font-size: 27px; }
  .trip-sensor-card > small { font-size: 11px; }
  .trip-mini-chart { min-height: 54px; }
  .trip-mini-chart svg { height: 43px; }
  .trip-chart-range, .trip-chart-empty { font-size: 11px; }
  .trip-chart-empty { padding: 12px 0; }
  .trip-map-section { order: 4; border: 0; border-top: 1px solid #e5eae4; border-bottom: 1px solid #e5eae4; }
  .trip-route-heading { min-height: 74px; padding: 16px 17px; gap: 10px; }
  .trip-route-point small { margin-bottom: 6px; font-size: 10px; }
  .trip-route-point strong { font-size: 15px; }
  .trip-map-container { min-height: 230px; }
  #trip-detail-map { height: 230px; }
  .trip-map-empty { width: calc(100% - 50px); max-width: 290px; padding: 17px; gap: 8px; }
  .trip-map-empty > .icon { width: 18px; height: 18px; }
  .trip-map-empty strong { font-size: 14px; }
  .trip-map-empty span { font-size: 12px; }
  .trip-map-tools { gap: 7px; padding: 13px 16px 5px; }
  .trip-map-tools .button { flex: 1; min-width: 0; padding: 9px 7px; font-size: 14px; }
  .trip-map-tools a { justify-content: center; width: 100%; margin: 0; font-size: 14px; }
  .trip-map-state { padding: 7px 17px 17px; font-size: 13px; }
  .trip-tracking-state { order: 5; margin: 20px 17px 0; }
  .trip-motion-reason { order: 6; margin: 12px 17px 19px; }
  .trip-stop-card { order: 7; margin: 0 17px 18px; padding: 17px; }
  .trip-stop-card > strong { font-size: 29px; }
  .trip-time-list { order: 8; margin: 0 17px 19px; }
  .trip-evidence-grid { gap: 17px; padding: 17px; }
  .trip-detail-notes { margin: 0 17px 16px; }
  .trip-detail-disclaimer { padding: 0 18px 20px; }
  .trip-detail-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 13px 16px; }
  .trip-detail-actions .button { width: 100%; margin: 0; padding: 10px 7px; font-size: 13px; }
  .trip-detail-actions .button:first-child { margin-right: 0; }
  dialog { width: calc(100% - 26px); max-height: calc(100svh - 26px); padding: 22px; }
  .dialog-heading h2 { font-size: 25px; }
  .dialog-heading .eyebrow { font-size: 10px; }
  .dialog-actions { flex-wrap: wrap; gap: 9px; }
  .dialog-actions .button { flex: 1; min-width: 0; padding: 11px 12px; font-size: 14px; }
  .tracking-dialog-actions .button:first-child { flex-basis: 100%; margin-right: 0; }
  .form-row { gap: 12px; }
  .form-row label { min-height: 43px; font-size: 14px; }
  .error-banner { padding: 14px 16px; }
  .toast { right: 16px; bottom: 16px; left: 16px; width: auto; min-width: 0; max-width: calc(100% - 32px); padding: 15px 17px; font-size: 14px; overflow-wrap: anywhere; }
  .main-footer { flex-wrap: wrap; gap: 10px; margin-top: 26px; font-size: 12px; }
}

/* Se respetan las preferencias de movimiento sin alterar la actualización de las lecturas. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
