:root {
  color-scheme: light;
  --ink: #1a1a1a;
  --muted: #536276;
  --line: #cbd3df;
  --surface: #ffffff;
  --canvas: #e4e6f2;
  /* Denim Slate is the primary Vialtec interface color. */
  --navy: #2f4560;
  --blue: #2f4560;
  --teal: #1e2d44;
  --green: #16a65a;
  --yellow: #e5aa00;
  --orange: #ed6a18;
  --red: #df3f3f;
  --red-soft: #f7e7e7;
  --shadow: 0 2px 5px rgb(30 45 68 / 8%), 0 12px 28px rgb(30 45 68 / 8%);
  font-family: "Neue Haas Grotesk Text Pro", "Neue Haas Grotesk Display Pro", "Neue Haas Grotesk", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; overflow-x: hidden; background: var(--canvas); color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }

.daily-assignment-form { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)) auto; gap: 12px; align-items: end; }
.daily-assignment-form label { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }
.daily-assignment-form input, .daily-assignment-form select { min-height: 38px; border: 1px solid var(--line); border-radius: 4px; padding: 7px 9px; background: #fff; color: var(--ink); }
.daily-assignment-load-control { display: flex; gap: 6px; align-items: center; }
.daily-assignment-load-control select { min-width: 0; flex: 1; }
.daily-assignment-load-control .button { white-space: nowrap; padding-inline: 9px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 14px; background: var(--navy); color: #fff; display: flex; flex-direction: column; gap: 24px; }
.brand { display: flex; gap: 11px; align-items: center; padding: 0 7px 20px; border-bottom: 1px solid rgb(228 230 242 / 20%); }
.brand-logo { width: 44px; height: 44px; object-fit: cover; border-radius: 5px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 7px; background: #2b628c; font-size: 13px; font-weight: 800; letter-spacing: .04em; }
.brand strong, .brand span { display: block; }
.brand strong { font-family: "Neue Haas Grotesk Display Pro", "Neue Haas Grotesk Text Pro", "Helvetica Neue", Arial, sans-serif; font-size: 13px; letter-spacing: .035em; text-transform: uppercase; }
.brand span { margin-top: 3px; color: #c9d0df; font-size: 10px; }
nav { display: grid; gap: 5px; }
.nav-item { color: #c9d0df; text-decoration: none; padding: 11px; border-left: 2px solid transparent; border-radius: 4px; font-size: 13px; transition: .15s ease; display: flex; align-items: center;}
.nav-item span { display: inline-block; width: 22px; color: #aeb9cc}
.nav-item:hover, .nav-item.active { color: #fff; border-left-color: #e4e6f2; background: rgb(228 230 242 / 12%); }
.nav-icon {width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain; filter:brightness(0) saturate(100%) invert(100%);}
.method-card { margin-top: auto; padding: 14px; border: 1px solid rgb(228 230 242 / 18%); border-radius: 4px; background: rgb(255 255 255 / 5%); }
.method-card strong { display: block; margin: 4px 0 7px; font-size: 13px; }
.method-card p { margin: 0 0 12px; color: #b9cbd8; font-size: 11px; line-height: 1.45; }
.method-card code { color: #fff; }
.legend { display: flex; align-items: center; gap: 7px; margin-top: 6px; color: #cfdae3; font-size: 10px; }
.dot { width: 8px; height: 8px; border-radius: 2px; }
.dot.leve { background: var(--green); }.dot.media, .dot.moderado { background: var(--yellow); }.dot.grave { background: var(--orange); }.dot.gravisima, .dot.critico { background: var(--red); }
.dot.morning-night { background: #5746a3; }.dot.morning-early { background: #d97706; }
.dot.truck-moved { background: var(--green); }.dot.truck-stationary { background: var(--blue); }.dot.truck-stale { background: var(--red); }
.dot.stay-open { background: var(--orange); }.dot.stay-closed { background: var(--teal); }
.dot.overnight-enabled { background: var(--green); }.dot.overnight-disabled { background: var(--red); }

body[data-dashboard-view="speed"] [data-dashboard]:not([data-dashboard~="speed"]),
body[data-dashboard-view="morning"] [data-dashboard]:not([data-dashboard~="morning"]),
body[data-dashboard-view="camera"] [data-dashboard]:not([data-dashboard~="camera"]),
body[data-dashboard-view="stays"] [data-dashboard]:not([data-dashboard~="stays"]),
body[data-dashboard-view="overnights"] [data-dashboard]:not([data-dashboard~="overnights"]),
body[data-dashboard-view="fuel"] [data-dashboard]:not([data-dashboard~="fuel"]),
body[data-dashboard-view="status"] [data-dashboard]:not([data-dashboard~="status"]) { display: none !important; }

main { min-width: 0; padding: 22px 26px 36px; }
.topbar { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
h1, h2, p { margin-top: 0; }
h1, h2, h3 { font-family: "Neue Haas Grotesk Display Pro", "Neue Haas Grotesk Text Pro", "Neue Haas Grotesk", "Helvetica Neue", Arial, sans-serif; }
h1 { margin-bottom: 0; font-size: clamp(24px, 2.5vw, 32px); letter-spacing: -.015em; text-transform: uppercase; }
h2 { margin-bottom: 0; font-size: 15px; letter-spacing: .015em; text-transform: uppercase; }
.eyebrow { margin-bottom: 5px; color: var(--navy); font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.user-menu { display: flex; align-items: center; gap: 7px; max-width: 150px; color: var(--muted); font-size: 11px; }
.user-menu span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-avatar { color: var(--teal); font-size: 9px; }
.freshness { display: flex; align-items: center; gap: 7px; margin-right: 5px; color: var(--muted); font-size: 11px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 0 3px #fff3cc; }
.freshness.ok .status-dot { background: var(--green); box-shadow: 0 0 0 3px #dff4e6; }
.freshness.stale .status-dot { background: var(--orange); box-shadow: 0 0 0 3px #ffe5d2; }
.button { min-height: 36px; border-radius: 4px; border: 1px solid transparent; padding: 0 13px; font-size: 11px; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; }
.button.primary { background: var(--navy); color: #fff; }
.button.secondary { border-color: var(--line); background: #fff; color: var(--ink); }
.button.success { border-color: #258348; background: #e7f6eb; color: #176235; }
.button.danger { border-color: #be3b3b; background: #fff0f0; color: #9f2525; }
.button.ghost { align-self: end; border-color: transparent; background: transparent; color: var(--blue); }
.button:hover { filter: brightness(.97); }
.button:focus-visible, input:focus-visible, select:focus-visible, .tab:focus-visible { outline: 3px solid rgb(36 92 136 / 22%); outline-offset: 1px; }

.filter-panel { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: minmax(210px, 1.3fr) minmax(125px, .9fr) minmax(145px, 1.05fr) minmax(135px, .95fr) minmax(110px, .8fr) minmax(145px, 1fr) minmax(130px, .9fr) auto; gap: 10px; align-items: end; margin-bottom: 16px; padding: 13px; border: 1px solid var(--line); border-radius: 4px; background: rgb(255 255 255 / 96%); box-shadow: 0 6px 18px rgb(30 45 68 / 8%); backdrop-filter: blur(8px); }
body[data-dashboard-view="morning"] .filter-panel { grid-template-columns: minmax(210px, 1.3fr) minmax(135px, 1fr) minmax(165px, 1.2fr) auto; }
body[data-dashboard-view="camera"] .filter-panel { grid-template-columns: minmax(210px, 1.3fr) minmax(135px, 1fr) minmax(165px, 1.2fr) minmax(120px, .9fr) minmax(170px, 1.2fr) auto; }
body[data-dashboard-view="stays"] .filter-panel { grid-template-columns: minmax(210px, 1.3fr) minmax(135px, 1fr) minmax(165px, 1.2fr) minmax(150px, 1.1fr) minmax(115px, .8fr) auto; }
body[data-dashboard-view="overnights"] .filter-panel { grid-template-columns: minmax(210px, 1.3fr) minmax(135px, 1fr) minmax(165px, 1.2fr) auto; }
.date-range-filter { position: relative; display: grid; gap: 5px; min-width: 0; }
.date-range-label { color: var(--muted); font-size: 10px; font-weight: 700; }
.date-range-trigger { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 35px; border: 1px solid #b9c4d3; border-radius: 3px; background: #fff; color: var(--ink); padding: 0 9px; font: inherit; font-size: 12px; text-align: left; }
.date-range-trigger:focus-visible { outline: 3px solid rgb(36 92 136 / 22%); outline-offset: 1px; }
.date-range-menu { position: absolute; z-index: 30; top: calc(100% + 5px); left: 0; width: min(330px, 90vw); padding: 10px; border: 1px solid #ccd7e2; border-radius: 6px; background: #fff; box-shadow: 0 12px 28px rgb(16 39 64 / 18%); }
.date-range-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.date-range-presets button, .date-range-actions button { min-height: 30px; border: 1px solid #ccd7e2; border-radius: 4px; background: #f7f9fb; color: var(--ink); font: inherit; font-size: 11px; cursor: pointer; }
.date-range-presets button:hover, .date-range-actions button:hover { background: #eaf1f8; }
.date-range-custom { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.date-range-help { margin: 10px 0 7px; color: var(--muted); font-size: 10px; }
.date-range-calendar { border-top: 1px solid var(--line); padding-top: 8px; }
.date-range-calendar-head { display: grid; grid-template-columns: 30px 1fr 30px; align-items: center; margin-bottom: 7px; text-align: center; }
.date-range-calendar-head strong { font-size: 12px; text-transform: capitalize; }
.date-range-calendar-head button { width: 28px; height: 26px; border: 0; border-radius: 4px; background: #f1f4f7; color: var(--blue); font-size: 19px; line-height: 1; }
.date-range-weekdays, .date-range-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.date-range-weekdays { margin-bottom: 3px; color: var(--muted); font-size: 9px; font-weight: 800; }
.date-range-day, .date-range-day-empty { min-height: 31px; border: 0; border-radius: 4px; background: transparent; color: var(--ink); font: inherit; font-size: 11px; }
.date-range-day:hover { background: #eaf1f8; }
.date-range-day.today { box-shadow: inset 0 0 0 1px var(--blue); color: var(--blue); font-weight: 800; }
.date-range-day.inside { border-radius: 0; background: #e2edf6; }
.date-range-day.start, .date-range-day.end, .date-range-day.preview-end { border-radius: 15%; background: var(--navy); color: #fff; font-weight: 800; }
.date-range-day.today.start, .date-range-day.today.end, .date-range-day.today.preview-end { box-shadow: inset 0 0 0 2px #fff; }
.date-range-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; }
.date-range-actions button:last-child { min-width: 82px; border-color: var(--navy); background: var(--navy); color: #fff; }
label { display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 700; }
input, select { width: 100%; height: 35px; border: 1px solid #b9c4d3; border-radius: 3px; background: #fff; color: var(--ink); padding: 0 9px; font-size: 12px; }
.vehicle-filter-label { min-width: 0; }
.multi-select { position: relative; min-width: 0; }
.multi-select-trigger { width: 100%; height: 35px; overflow: hidden; border: 1px solid #ccd7e2; border-radius: 5px; padding: 0 28px 0 9px; background: #fff; color: var(--ink); font-size: 12px; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.multi-select-trigger::after { content: "⌄"; position: absolute; right: 9px; color: var(--muted); }
.multi-select-menu { position: absolute; z-index: 20; top: calc(100% + 5px); left: 0; width: max(235px, 100%); padding: 8px; border: 1px solid #ccd7e2; border-radius: 6px; background: #fff; box-shadow: 0 12px 28px rgb(16 39 64 / 18%); }
.multi-select-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.multi-select-actions button { min-height: 29px; border: 0; border-radius: 4px; background: #edf2f6; color: var(--blue); font-size: 9px; font-weight: 800; }
.multi-select-options { max-height: 250px; overflow-y: auto; padding-top: 5px; }
.multi-select-option { display: flex; grid: none; align-items: center; gap: 8px; min-height: 29px; padding: 4px 6px; border-radius: 4px; color: #314356; font-size: 11px; cursor: pointer; }
.multi-select-option:hover { background: #f3f6f9; }
.multi-select-option input { flex: 0 0 auto; width: 15px; height: 15px; margin: 0; padding: 0; accent-color: var(--blue); }

.state-banner { margin-bottom: 14px; padding: 11px 13px; border-radius: 6px; border: 1px solid #f0d790; background: #fff9e8; color: #725917; font-size: 12px; }
.state-banner.error { border-color: #efb1b1; background: #fff1f1; color: #8f2929; }
.hidden, [hidden] { display: none !important; }

.load-dialog { width: min(720px, calc(100% - 28px)); max-height: calc(100vh - 36px); padding: 0; overflow: auto; border: 1px solid #ccd7e2; border-radius: 8px; color: var(--ink); box-shadow: 0 24px 70px rgb(16 39 64 / 24%); }
.load-dialog::backdrop { background: rgb(12 28 44 / 52%); backdrop-filter: blur(2px); }
.load-dialog form { padding: 20px; }
.driver-report-dialog { width: min(820px, calc(100% - 28px)); }
.fuel-detail-dialog { width: min(760px, calc(100% - 28px)); }
.fuel-detail-content { padding: 20px; }
.fuel-detail-title-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 16px; }
.fuel-detail-title-row h2 { margin: 0; }
.fuel-detail-totals { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: 10px; }
.fuel-detail-totals strong { margin-left: 3px; color: var(--ink); font-size: 12px; }
.fuel-detail-input { width: 95px; min-height: 27px; padding: 3px 5px; border: 1px solid #aebfce; border-radius: 4px; font: inherit; text-align: right; }
.fuel-partial-delete { border: 0; border-radius: 4px; padding: 3px 7px; background: #f8e5e5; color: #8f2929; font: inherit; font-size: 10px; font-weight: 700; }
.fuel-closure-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 18px; margin: 14px 0 18px; border-top: 1px solid var(--line); }
.fuel-closure-summary div { display: flex; justify-content: space-between; gap: 8px; min-width: 0; padding: 8px 0; border-bottom: 1px solid var(--line); }
.fuel-closure-summary dt { color: var(--muted); font-size: 10px; font-weight: 700; }
.fuel-closure-summary dd { margin: 0; overflow-wrap: anywhere; font-size: 11px; font-weight: 700; text-align: right; }
.fuel-partials-section h3 { margin: 0 0 9px; font-size: 13px; }
.fuel-detail-button { min-height: 28px; border: 1px solid #b8c9d8; border-radius: 4px; padding: 3px 8px; background: #edf3f8; color: var(--blue); font: inherit; font-size: 10px; font-weight: 800; white-space: nowrap; }
.fuel-trip-form-grid { grid-template-columns: minmax(180px, 1.5fr) 1fr 1fr; }
.fuel-partial-form-grid { grid-template-columns: minmax(220px, 1.4fr) 1fr minmax(220px, 1.4fr); }
.fuel-trip-edit { border: 0; border-radius: 4px; padding: 3px 7px; background: #e5edf5; color: var(--blue); font: inherit; font-size: 10px; font-weight: 700; }
.fuel-partial-edit { border: 0; border-radius: 4px; padding: 3px 7px; background: #e5edf5; color: var(--blue); font: inherit; font-size: 10px; font-weight: 700; }
.fuel-current-load-bar { display: flex; align-items: center; min-width: 130px; gap: 7px; }
.fuel-current-load-track { flex: 1; height: 8px; overflow: hidden; border-radius: 999px; background: #e7edf3; }
.fuel-current-load-fill { height: 100%; min-width: 2px; background: #2f7eae; }
.fuel-current-load-value { color: var(--muted); font-size: 10px; font-weight: 700; white-space: nowrap; }
.fuel-trip-delete { border: 0; border-radius: 4px; padding: 3px 7px; background: #f8e5e5; color: #8f2929; font: inherit; font-size: 10px; font-weight: 700; }
@media (max-width: 620px) { .fuel-closure-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fuel-detail-totals { width: 100%; } .fuel-partial-form-grid { grid-template-columns: 1fr; } }
.report-severity { display:flex; flex-wrap:wrap; gap:12px; margin:16px 0; padding:10px; border:1px solid var(--line); border-radius:6px; }
.report-severity legend { padding:0 4px; color:var(--muted); font-size:10px; font-weight:700; }
.report-severity label { display:flex; align-items:center; gap:5px; font-size:11px; }
.report-severity input { width:15px; height:15px; }
.driver-report-result { display:grid; gap:9px; margin-top:14px; }
.driver-report-result textarea { width:100%; min-height:220px; resize:vertical; padding:10px; border:1px solid #ccd7e2; border-radius:6px; background:#f8fafc; color:var(--ink); font:12px/1.45 "Segoe UI",sans-serif; }
.driver-report-actions { display:flex; justify-content:flex-end; gap:8px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.dialog-head h2 { font-size: 20px; }
.dialog-close { width: 32px; height: 32px; border: 0; border-radius: 5px; background: #edf2f6; color: #43566a; font-size: 21px; line-height: 1; }
.dialog-help { margin: 10px 0 16px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.load-mode-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -4px 0 12px; padding: 7px 9px; border-radius: 5px; background: #eef3f7; color: var(--blue); font-size: 10px; }
.load-mode-bar .button { min-height: 27px; padding: 4px 9px; font-size: 10px; }
.load-form-grid { display: grid; grid-template-columns: 1.2fr 1fr .8fr 1.15fr; gap: 10px; }
.load-name-field { grid-column: 1 / -1; }
.load-sequence { margin-top: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: #f8fafc; }
.load-sequence h3 { margin: 0 0 8px; font-size: 11px; }
.load-event-history { max-height: 260px; overflow: auto; color: var(--muted); font-size: 10px; line-height: 1.55; }
.load-history-title { margin: 8px 0 3px; color: var(--ink); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.load-history-title:first-child { margin-top: 0; }
.load-event-row { display: grid; grid-template-columns: 125px 1fr auto; align-items: center; gap: 10px; padding: 4px 0; border-bottom: 1px solid #e8edf2; }
.load-event-row:last-child { border-bottom: 0; }
.load-event-edit { border: 0; border-radius: 4px; padding: 3px 7px; background: #e5edf5; color: var(--blue); font: inherit; font-weight: 700; }
.load-event-actions { display: flex; gap: 4px; }
.load-event-delete { border: 0; border-radius: 4px; padding: 3px 7px; background: #f8e5e5; color: #8f2929; font: inherit; font-weight: 700; }
.load-event-result { margin-top: 13px; padding: 11px 12px; border: 1px solid #acd9ba; border-radius: 6px; background: #eef9f1; color: #245f37; font-size: 11px; line-height: 1.5; }
.load-event-result.error { border-color: #efb1b1; background: #fff1f1; color: #8f2929; }
.load-event-result strong { display: block; margin-bottom: 4px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dialog-actions button:disabled { cursor: not-allowed; opacity: .55; }

.auth-page { min-height: 100vh; background: var(--canvas); }
.auth-layout { width: min(960px, calc(100% - 32px)); min-height: 580px; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(340px, .92fr); margin: clamp(24px, 6vh, 70px) auto; padding: 0; overflow: hidden; border: 1px solid #bfc9d8; border-radius: 4px; background: #fff; box-shadow: 0 24px 60px rgb(30 45 68 / 16%); }
.auth-context { display: flex; flex-direction: column; padding: 42px; color: #fff; background: linear-gradient(145deg, #1a1a1a 0%, #2f4560 58%, #1e2d44 100%); }
.auth-logo { width: 450px;  height: 150px;  object-fit: contain;  object-position: center;  display: block;  margin: 0 auto;  border-radius: 3px;}
.auth-brand { display: flex; align-items: center; gap: 11px; }
.auth-brand strong, .auth-brand span { display: block; }
.auth-brand strong { font-size: 14px; }
.auth-brand span { margin-top: 2px; color: #b9ccda; font-size: 11px; }
.auth-context-copy { margin: auto 0; }
.auth-context-copy .eyebrow { color: #e4e6f2; }
.auth-context-copy h1 { max-width: 420px; font-size: clamp(28px, 4vw, 42px); line-height: 1.08; }
.auth-context-copy > p:last-child { max-width: 410px; margin: 20px 0 0; color: #c9d8e3; font-size: 14px; line-height: 1.65; }
.auth-notice { display: flex; align-items: center; gap: 9px; margin: 0; color: #bad0dc; font-size: 11px; }
.auth-form-side { display: grid; place-items: center; padding: 42px; }
.auth-card { width: min(100%, 320px); display: grid; gap: 19px; }
.auth-card h2 { font-size: 25px; }
.auth-help { margin: 9px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.auth-card label { gap: 7px; color: #43566a; font-size: 11px; }
.auth-card input { height: 42px; font-size: 14px; }
.auth-submit { width: 100%; min-height: 42px; margin-top: 2px; }
.auth-submit:disabled { cursor: wait; opacity: .68; }
.auth-error { padding: 10px 12px; border: 1px solid #efb1b1; border-radius: 6px; background: #fff1f1; color: #8f2929; font-size: 11px; line-height: 1.45; }
.auth-support { margin: -4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; text-align: center; }

.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(126px, 1fr)); gap: 11px; margin-bottom: 12px; }
.kpi { min-height: 105px; padding: 15px; border: 1px solid var(--line); border-top: 3px solid var(--blue); border-radius: 4px; background: var(--surface); box-shadow: var(--shadow); }
.kpi span, .kpi small { display: block; color: var(--muted); font-size: 10px; }
.kpi span { font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.kpi strong { display: block; margin: 10px 0 7px; font-size: 25px; letter-spacing: -.03em; }
.kpi.danger { border-color: #f1c4c4; background: linear-gradient(135deg, #fff 25%, var(--red-soft)); }
.kpi.danger strong { color: var(--red); }

.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.panel { min-width: 0; min-height: 285px; padding: 18px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); box-shadow: var(--shadow); }
.panel.wide { grid-column: 1 / -1; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; min-height: 40px; }
.panel-note { color: var(--muted); font-size: 10px; white-space: nowrap; }
.excess-panel-head { align-items: center; }
.chart-controls { display: flex; align-items: end; gap: 8px; }
.chart-control { display: grid; gap: 3px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.chart-control select { width: auto; min-width: 88px; height: 29px; padding: 0 7px; font-size: 10px; }
.segmented-control { display: flex; height: 29px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: #f4f7fa; }
.segmented-control button { min-width: 60px; border: 0; border-radius: 4px; padding: 0 7px; background: transparent; color: var(--muted); font-size: 10px; }
.segmented-control button.active { background: #fff; color: var(--blue); font-weight: 700; box-shadow: 0 1px 3px rgb(26 42 58 / 14%); }
.segmented-control button:focus-visible { outline: 3px solid rgb(36 92 136 / 22%); outline-offset: 1px; }
.stacked-bar-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin-top: 4px; color: var(--muted); font-size: 10px; }
.stacked-bar-legend span { display: inline-flex; align-items: center; gap: 5px; }
.stacked-bar-legend i { width: 9px; height: 9px; border-radius: 2px; }
.chart-canvas-wrap { position: relative; }
.chart-canvas-wrap .bar-chart { display: block; }
.chart-tooltip { position: absolute; z-index: 4; min-width: 135px; max-width: 210px; padding: 8px 10px; border: 1px solid rgb(255 255 255 / 18%); border-radius: 5px; background: rgb(21 34 53 / 95%); color: #fff; box-shadow: 0 5px 15px rgb(21 34 53 / 22%); font-size: 10px; line-height: 1.35; pointer-events: none; }
.chart-tooltip strong, .chart-tooltip span { display: block; }
.chart-tooltip span { margin-top: 2px; color: #d9e2ea; }
.donut-layout { height: 210px; display: grid; grid-template-columns: minmax(170px, .95fr) minmax(145px, 1.05fr); align-items: center; gap: 10px; }
#severityChart { width: 100%; height: 190px; }
#cameraSeverityChart { width: 100%; height: 190px; }
.chart-legend { display: grid; gap: 10px; }
.legend-row { display: grid; grid-template-columns: 9px 1fr auto; gap: 8px; align-items: center; font-size: 11px; }
.legend-row i { width: 9px; height: 9px; border-radius: 2px; }
.legend-row span { color: var(--muted); }
.legend-row strong { font-size: 12px; }
.insights { display: grid; gap: 9px; margin: 5px 0 17px; padding: 0; list-style: none; }
.insights li { position: relative; padding: 10px 11px 10px 29px; border-radius: 5px; background: #f6f8fb; color: #394b5f; font-size: 11px; line-height: 1.45; }
.insights li::before { content: "→"; position: absolute; left: 11px; top: 10px; color: var(--blue); font-weight: 800; }
.quality-strip { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); padding-top: 13px; }
.quality-strip div { padding: 0 9px; border-right: 1px solid var(--line); }
.quality-strip div:last-child { border: 0; }
.quality-strip span, .quality-strip strong { display: block; }
.quality-strip span { color: var(--muted); font-size: 9px; }
.quality-strip strong { margin-top: 4px; font-size: 15px; }
.bar-chart { width: 100%; height: 245px; }
.chart-slider { display: grid; grid-template-columns: 30px minmax(140px, 1fr) 30px 92px; align-items: center; gap: 8px; min-height: 34px; margin-top: 2px; padding: 0 4px; }
.chart-slider button { width: 30px; height: 28px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--blue); font-size: 18px; line-height: 1; }
.chart-slider button:disabled { cursor: not-allowed; opacity: .4; }
.chart-slider input[type="range"] { height: 24px; padding: 0; border: 0; accent-color: var(--blue); }
.chart-slider span { color: var(--muted); font-size: 10px; text-align: right; white-space: nowrap; }
.line-chart { width: 100%; height: 220px; }
.morning-panel { min-height: 430px; }
.morning-kpis { display: grid; grid-template-columns: repeat(4, 1fr); margin: 8px 0 14px; border: 1px solid var(--line); border-radius: 6px; background: #f8fafc; }
.morning-kpis div { padding: 10px 13px; border-right: 1px solid var(--line); }
.morning-kpis div:last-child { border-right: 0; }
.morning-kpis span, .morning-kpis strong { display: block; }
.morning-kpis span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; }
.morning-kpis strong { margin-top: 5px; font-size: 18px; font-variant-numeric: tabular-nums; }
.morning-kpis div:nth-child(2) strong { color: #5746a3; }
.morning-kpis div:nth-child(3) strong { color: #b65e08; }
.morning-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.morning-chart-card { min-width: 0; padding: 11px 12px 6px; border: 1px solid var(--line); border-radius: 6px; }
.morning-chart-card h3 { margin: 0 0 3px; color: #43566a; font-size: 11px; }
.morning-chart-toolbar { min-height: 29px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.morning-chart-toolbar h3 { margin: 0; }
.morning-chart-controls { display: flex; align-items: center; gap: 7px; }
.morning-breakdown { display: flex; grid: none; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.morning-breakdown select { width: auto; min-width: 82px; height: 27px; padding: 0 7px; font-size: 10px; }
.morning-chart { width: 100%; height: 220px; }
.morning-meta { margin: 9px 0 0; color: var(--muted); font-size: 9px; }
.camera-driver-panel { min-height: 360px; }
.camera-driver-panel .bar-chart { height: 285px; }
.ranking { display: grid; gap: 9px; margin-top: 8px; }
.stay-ranking { margin-top: 16px; }
.stay-ranking .rank-fill { background: var(--teal); }
.overnight-chart-panel { min-height: 260px; }
.overnight-ranking { margin-top: 15px; }
.overnight-place-fill { background: #2f4560; }
.overnight-status-track { display: flex; }
.overnight-status-enabled { height: 100%; background: var(--green); }
.overnight-status-disabled { height: 100%; background: var(--red); }
.overnight-legend { display: inline-block; width: 8px; height: 8px; margin: 0 3px 0 7px; border-radius: 2px; vertical-align: -1px; }
.overnight-legend:first-child { margin-left: 0; }
.overnight-legend.enabled { background: var(--green); }
.overnight-legend.disabled { background: var(--red); }
.stay-highlight { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 12px; padding: 12px; border-top: 1px solid var(--line); background: #f8fafc; }
.stay-highlight span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.stay-highlight strong { color: var(--teal); font-size: 20px; }
.stay-trend-panel { min-height: 330px; }
.stay-trend-chart { display: block; width: 100%; height: 245px; }
.stay-entity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 8px; }
.stay-entity-grid h3 { margin: 0; font-size: 11px; color: #43566a; }
.stay-accounting-detail-content { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 0; color: #43566a; font-size: 10px; line-height: 1.2; }
.stay-accounting-detail-content .stay-status { margin-right: 2px; }
.stay-accounting-row td { padding: 4px 10px 4px 30px; background: #f7fafc; color: #43566a; }
.stay-accounting-row .stay-period-time { white-space: nowrap; }
.stay-accounting-row .button { min-height: 24px; padding: 4px 7px; font-size: 9px; }
.stay-period-edit { margin-left: auto; }
.stay-period-form-grid textarea { min-height: 92px; resize: vertical; }
.stay-period-cancel-option { display: flex; align-items: center; gap: 7px; margin-top: 14px; font-size: 12px; font-weight: 700; color: #43566a; }
.stay-period-cancel-option input { width: 15px; height: 15px; }
.compact-table-wrap { max-height: 310px; margin: 8px 0 0; border: 1px solid var(--line); border-radius: 5px; }
.stay-detail-panel { min-height: 400px; margin-top: 12px; }
.stay-status { display: inline-flex; min-width: 58px; justify-content: center; padding: 3px 7px; border: 1px solid transparent; border-radius: 4px; font-size: 9px; font-weight: 800; }
.stay-status.open { color: #91430e; border-color: #efc19f; background: #ffe2cf; }
.stay-status.closed { color: #17655f; border-color: #acd9d4; background: #e1f4f1; }
.rank-row { display: grid; grid-template-columns: minmax(105px, 1.1fr) minmax(110px, 2fr) 52px; gap: 9px; align-items: center; font-size: 10px; }
.rank-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.rank-track { height: 8px; border-radius: 4px; background: #edf1f5; overflow: hidden; }
.rank-fill { height: 100%; border-radius: 4px; background: var(--red); }
.camera-rule-fill { background: var(--teal); }
.rank-value { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

.detail-panel { margin-top: 12px; min-height: 400px; }
.map-section { margin-top: 12px; height: 690px; padding-bottom: 14px; }
.morning-route-section { margin-top: 12px; height: 650px; padding-bottom: 14px; }
.camera-map-section { margin-top: 12px; height: 650px; padding-bottom: 14px; }
.camera-covered-panel { margin-top: 12px; min-height: 360px; }
.truck-status-map-section { margin-top: 12px; height: 680px; padding-bottom: 14px; }
.truck-stale-panel { margin-top: 12px; min-height: 330px; }
.morning-route-shell { height: calc(100% - 54px); overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: #e9eef3; }
.morning-route-shell iframe { display: block; width: 100%; height: 100%; border: 0; }
.map-section-head { min-height: 48px; align-items: center; }
.map-actions { display: flex; align-items: center; gap: 12px; }
.map-link { display: inline-flex; align-items: center; text-decoration: none; white-space: nowrap; }
.map-frame-shell { height: calc(100% - 54px); overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: #e9eef3; }
.map-frame-shell iframe { display: block; width: 100%; height: 100%; border: 0; }
.detail-head { align-items: center; }
.tabs { display: flex; padding: 3px; border-radius: 6px; background: #edf2f6; }
.tab { min-height: 29px; border: 0; border-radius: 4px; padding: 0 12px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; }
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgb(16 39 64 / 12%); }
.table-wrap { max-height: 460px; overflow: auto; margin: 12px -17px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 10px; }
thead { position: sticky; top: 0; z-index: 2; background: #f6f8fb; }
th { color: #52667b; font-weight: 800; text-align: left; white-space: nowrap; }
th, td { padding: 9px 10px; border-bottom: 1px solid #e8edf2; }
.detail-sort-button { display: inline-flex; align-items: center; gap: 5px; border: 0; padding: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.detail-sort-button:hover { color: var(--blue); }
.detail-sort-indicator { color: var(--blue); font-size: 11px; }
.detail-filter-menu { position: relative; display: inline-block; margin-left: 7px; vertical-align: middle; }
.detail-filter-menu summary { display: inline-block; padding: 2px 5px; border: 1px solid #ccd7e2; border-radius: 4px; background: #fff; color: var(--muted); font-size: 9px; font-weight: 700; cursor: pointer; list-style: none; }
.detail-filter-menu summary::-webkit-details-marker { display: none; }
.detail-filter-menu summary::after { content: "⌄"; margin-left: 4px; }
.detail-filter-menu[open] summary { color: var(--blue); border-color: #9ebbd2; }
.detail-filter-popover { position: fixed; z-index: 100; display: grid; gap: 7px; min-width: 145px; padding: 9px; border: 1px solid #ccd7e2; border-radius: 5px; background: #fff; box-shadow: 0 9px 22px rgb(16 39 64 / 16%); }
.detail-filter-popover label { display: grid; gap: 4px; min-width: 125px; color: var(--muted); font-size: 9px; }
.detail-filter-popover input, .detail-filter-popover select { height: 29px; min-width: 125px; padding: 0 6px; font-size: 10px; }
.detail-filter-actions { display: flex; justify-content: flex-end; padding-top: 2px; border-top: 1px solid var(--line); }
.detail-filter-actions button { min-height: 27px; border: 0; border-radius: 4px; padding: 0 10px; background: var(--blue); color: #fff; font-size: 10px; font-weight: 800; cursor: pointer; }
.detail-reset-button { margin-left: 5px; white-space: nowrap; }
td { color: #314356; white-space: nowrap; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #f8fbfd; }
.truck-stale-row { cursor: pointer; }
.truck-stale-row:hover { background: #eef5fa; }
.truck-stale-row:focus { outline: 2px solid var(--blue); outline-offset: -2px; background: #eef5fa; }
.truck-stale-row.selected { background: #e2f0f8; box-shadow: inset 3px 0 var(--blue); }
.episode-row { cursor: pointer; }
.episode-row:focus { outline: 2px solid var(--blue); outline-offset: -2px; background: #eef5fa; }
.badge { display: inline-flex; align-items: center; min-width: 68px; justify-content: center; padding: 3px 7px; border-radius: 4px; font-size: 9px; font-weight: 800; }
.badge.leve { color: #1d6b35; background: #e1f5e7; }.badge.media, .badge.moderado { color: #775b08; background: #fff2c8; }.badge.grave { color: #91430e; background: #ffe2cf; }.badge.gravisima, .badge.critico { color: #9b2828; background: #ffdada; }
.load-badge { display: inline-flex; min-width: 62px; justify-content: center; padding: 3px 7px; border: 1px solid transparent; border-radius: 4px; font-size: 9px; font-weight: 800; }
.load-badge.loaded { color: #1d6b35; border-color: #bfe2c9; background: #e1f5e7; }
.load-badge.empty { color: #52667b; border-color: #d4dde6; background: #edf2f6; }
.load-badge.unknown { color: #775b08; border-color: #ecd98d; background: #fff2c8; }
.movement-badge { display: inline-flex; min-width: 92px; justify-content: center; padding: 3px 7px; border: 1px solid transparent; border-radius: 4px; font-size: 9px; font-weight: 800; }
.movement-badge.moved { color: #1d6b35; border-color: #bfe2c9; background: #e1f5e7; }
.movement-badge.stationary { color: #245c88; border-color: #bdd3e4; background: #e7f1f8; }
.movement-badge.unknown { color: #775b08; border-color: #ecd98d; background: #fff2c8; }
.score-badge { display: inline-flex; min-width: 54px; justify-content: center; padding: 3px 7px; border: 1px solid transparent; border-radius: 4px; font-size: 9px; font-weight: 800; }
.score-badge.bajo { color: #1d6b35; border-color: #bfe2c9; background: #e1f5e7; }
.score-badge.moderado { color: #775b08; border-color: #ecd98d; background: #fff2c8; }
.score-badge.alto { color: #91430e; border-color: #efc19f; background: #ffe2cf; }
.score-badge.critico { color: #9b2828; border-color: #efb3b3; background: #ffdada; }
.table-footer { display: flex; justify-content: space-between; gap: 20px; padding-top: 10px; color: var(--muted); font-size: 10px; }
.skeleton { animation: pulse 1.2s infinite ease-in-out; color: transparent !important; background: #e9eef3; border-radius: 4px; }
@keyframes pulse { 50% { opacity: .55; } }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .filter-panel { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 860px) {
  .auth-layout { grid-template-columns: 1fr; min-height: 0; margin: 24px auto; }
  .auth-context { min-height: 260px; padding: 28px; }
  .auth-context-copy { margin: 42px 0; }
  .auth-context-copy h1 { font-size: 30px; }
  .auth-form-side { padding: 38px 28px; }
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; flex-direction: row; align-items: center; padding: 11px 14px; }
  .brand { border: 0; padding: 0; }
  .brand span, .method-card { display: none; }
  nav { display: flex; margin-left: auto; }
  .nav-item { padding: 8px; font-size: 0; }.nav-item span { width: auto; font-size: 15px; }
  main { padding: 17px 14px 28px; }
  .topbar { align-items: flex-start; }
  .freshness { display: none; }
  .filter-panel { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .panel.wide { grid-column: auto; }
  .morning-charts { grid-template-columns: 1fr; }
  .stay-entity-grid { grid-template-columns: 1fr; }
  .map-section { height: 650px; }
  .morning-route-section { height: 620px; }
  .camera-map-section { height: 620px; }
  .map-actions .panel-note { display: none; }
}
@media (max-width: 560px) {
  .auth-layout { width: 100%; margin: 0; border: 0; border-radius: 0; }
  .auth-context { min-height: 230px; padding: 24px; }
  .auth-context-copy { margin: 34px 0; }
  .auth-context-copy h1 { font-size: 26px; }
  .auth-context-copy > p:last-child { display: none; }
  .auth-form-side { padding: 34px 24px; }
  .user-menu { display: none; }
  .logout-button { padding: 0 9px; }
  .topbar { display: grid; }
  .load-form-grid { grid-template-columns: 1fr 1fr; }
  .load-name-field { grid-column: 1 / -1; }
  .header-actions { flex-wrap: wrap; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  input, select { min-width: 0; }
  .kpi { min-height: 96px; }.kpi strong { font-size: 22px; }
  .donut-layout { grid-template-columns: 1fr; height: auto; }
  #severityChart { height: 170px; }
  #cameraSeverityChart { height: 170px; }
  .morning-kpis { grid-template-columns: repeat(2, 1fr); }
  .morning-kpis div:nth-child(2) { border-right: 0; }
  .morning-kpis div:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .morning-chart { height: 205px; }
  .excess-panel-head { display: grid; }
  .chart-controls { width: 100%; flex-wrap: wrap; }
  .morning-chart-toolbar { align-items: flex-start; }
  .morning-chart-controls { flex-wrap: wrap; justify-content: flex-end; }
  .quality-strip { grid-template-columns: 1fr; gap: 8px; }
  .quality-strip div { border: 0; }
  .panel { padding: 14px; }
  .map-section { height: 620px; }
  .morning-route-section { height: 660px; }
  .camera-map-section { height: 620px; }
  .map-section-head { align-items: flex-start; }
  .map-link { padding: 0 9px; font-size: 10px; }
  .table-wrap { margin-left: -14px; margin-right: -14px; }
  .table-footer { display: grid; }
}
