:root {
    --hn-bg: #0f172a;
    --hn-bg-2: #111827;
    --hn-card: #ffffff;
    --hn-soft: #f1f5f9;
    --hn-text: #0f172a;
    --hn-muted: #64748b;
    --hn-blue: #2563eb;
    --hn-cyan: #06b6d4;
    --hn-green: #10b981;
    --hn-border: #e2e8f0;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--hn-text); }
a { text-decoration: none; }

.login-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, .34), transparent 32rem),
        radial-gradient(circle at bottom right, rgba(6, 182, 212, .22), transparent 26rem),
        linear-gradient(135deg, #020617, #0f172a 55%, #111827);
}
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; }
.login-card { width: min(100%, 440px); background: #fff; border-radius: 28px; padding: 2rem; }
.brand-mark, .brand-icon {
    display: inline-grid; place-items: center; width: 54px; height: 54px;
    border-radius: 18px; color: #fff; font-weight: 900;
    background: linear-gradient(135deg, var(--hn-blue), var(--hn-cyan));
    box-shadow: 0 15px 35px rgba(37, 99, 235, .30);
}
.login-card h1 { margin-top: 1rem; font-size: 2.1rem; font-weight: 900; letter-spacing: -.04em; }
.btn-horus { background: linear-gradient(135deg, var(--hn-blue), var(--hn-cyan)); color: #fff; border: 0; font-weight: 800; }
.btn-horus:hover { color: #fff; filter: brightness(.95); }

.app-body { background: #eef2f7; }
.app-layout { min-height: 100vh; display: flex; }
.sidebar {
    width: 285px; min-height: 100vh; padding: 1.25rem;
    background: linear-gradient(180deg, #020617, #0f172a 68%, #111827);
    color: #fff; position: sticky; top: 0;
}
.sidebar-brand { display: flex; gap: .85rem; align-items: center; color: #fff; margin-bottom: 2rem; }
.sidebar-brand strong { display: block; font-size: 1.15rem; }
.sidebar-brand small { display: block; color: #94a3b8; }
.sidebar-nav { display: grid; gap: .45rem; }
.sidebar-nav a {
    color: #cbd5e1; padding: .85rem 1rem; border-radius: 16px;
    transition: .18s ease; font-weight: 700;
}
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,.10); color: #fff; }
.sidebar-next {
    margin-top: 2rem; padding: 1rem; border-radius: 18px;
    background: rgba(255,255,255,.07); color: #cbd5e1;
}
.sidebar-next strong { display: block; color: #fff; margin-bottom: .35rem; }
.sidebar-next span { font-size: .88rem; }

.app-main { flex: 1; min-width: 0; }
.topbar {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: #fff; padding: 1.6rem 2rem; display: flex; justify-content: space-between; gap: 1rem; align-items: center;
}
.topbar h1 { margin: .1rem 0 0; font-size: 1.9rem; font-weight: 900; letter-spacing: -.035em; }
.eyebrow { color: #93c5fd; font-weight: 800; font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; }
.topbar-user { display: flex; align-items: center; gap: .75rem; }
.content-wrap { padding: 2rem; }

.metric-card, .panel-card {
    background: #fff; border: 1px solid var(--hn-border); border-radius: 24px;
    box-shadow: 0 16px 34px rgba(15, 23, 42, .06);
}
.metric-card { padding: 1.25rem; min-height: 145px; }
.metric-card span { color: var(--hn-muted); font-weight: 800; text-transform: uppercase; font-size: .78rem; letter-spacing: .08em; }
.metric-card strong { display: block; font-size: 2.4rem; line-height: 1; margin: .75rem 0 .45rem; letter-spacing: -.06em; }
.metric-card small { color: var(--hn-muted); }
.panel-card { padding: 1.35rem; }
.panel-card h2 { font-size: 1.25rem; margin: 0 0 .4rem; font-weight: 900; letter-spacing: -.03em; }
.panel-card p { color: var(--hn-muted); }
.panel-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.timeline-mini { display: grid; gap: .8rem; }
.timeline-mini div { border-left: 4px solid var(--hn-blue); padding: .35rem .2rem .35rem .9rem; background: #f8fafc; border-radius: 0 14px 14px 0; }
.timeline-mini strong { display: block; }
.timeline-mini span { color: var(--hn-muted); }
.nice-list { margin: 0 0 1rem; padding-left: 1.1rem; color: var(--hn-muted); }
.table { --bs-table-bg: transparent; }
code { color: #1d4ed8; background: #eff6ff; padding: .16rem .35rem; border-radius: .45rem; }

@media (max-width: 900px) {
    .app-layout { display: block; }
    .sidebar { width: 100%; min-height: auto; position: relative; }
    .topbar { display: block; }
    .topbar-user { margin-top: 1rem; }
    .content-wrap { padding: 1rem; }
}
/* HorusNav — PACK 02 MAPA */
.metric-card-compact { min-height: 118px; }
.map-panel { padding: 1.25rem; }
.map-toolbar { align-items: center; }
.map-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; }
.horus-map {
    width: 100%;
    min-height: 640px;
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid var(--hn-border);
    background: #dbeafe;
    box-shadow: inset 0 0 0 1px rgba(15,23,42,.03);
}
.map-info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
}
.map-info-grid > div {
    background: #f8fafc;
    border: 1px solid var(--hn-border);
    border-radius: 16px;
    padding: .85rem 1rem;
}
.map-info-grid strong { display: block; font-size: .9rem; }
.map-info-grid span { display: block; color: var(--hn-muted); font-size: .88rem; margin-top: .18rem; }
.map-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--hn-muted);
    font-size: .9rem;
}
.leaflet-popup-content strong { display: block; margin-bottom: .2rem; }
.leaflet-popup-content small { color: #64748b; }
.horus-marker-label {
    font-weight: 800;
    letter-spacing: -.02em;
}
@media (max-width: 900px) {
    .map-toolbar { display: block; }
    .map-actions { justify-content: stretch; margin-top: 1rem; }
    .map-actions .btn { flex: 1 1 100%; }
    .horus-map { min-height: 520px; }
    .map-info-grid { grid-template-columns: 1fr; }
    .map-footer { display: block; }
    .map-footer span { display: block; margin-top: .3rem; }
}

/* HorusNav — PACK 02A: correção visual do Leaflet
   Motivo: alguns navegadores/servidores podem falhar ao carregar o CSS externo do Leaflet.
   Este bloco local garante posicionamento correto dos tiles, controles e camadas. */
.leaflet-container {
    position: relative !important;
    overflow: hidden !important;
    background: #dbeafe !important;
    outline-offset: 1px;
    font-family: inherit;
    touch-action: none;
}
.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
    position: absolute !important;
    left: 0;
    top: 0;
}
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
    user-select: none;
    -webkit-user-drag: none;
}
.leaflet-tile::selection { background: transparent; }
.leaflet-safari .leaflet-tile { image-rendering: -webkit-optimize-contrast; }
.leaflet-zoom-animated { transform-origin: 0 0; }
.leaflet-overlay-pane svg { -moz-user-select: none; }
.leaflet-tile-pane { z-index: 200; }
.leaflet-overlay-pane { z-index: 400; }
.leaflet-shadow-pane { z-index: 500; }
.leaflet-marker-pane { z-index: 600; }
.leaflet-tooltip-pane { z-index: 650; }
.leaflet-popup-pane { z-index: 700; }
.leaflet-map-pane canvas { z-index: 100; }
.leaflet-map-pane svg { z-index: 200; }
.leaflet-control {
    position: relative;
    z-index: 800;
    pointer-events: auto;
    float: left;
    clear: both;
}
.leaflet-top,
.leaflet-bottom {
    position: absolute;
    z-index: 1000;
    pointer-events: none;
}
.leaflet-top { top: 12px; }
.leaflet-right { right: 12px; }
.leaflet-bottom { bottom: 12px; }
.leaflet-left { left: 12px; }
.leaflet-top .leaflet-control { margin-top: 0; }
.leaflet-bottom .leaflet-control { margin-bottom: 0; }
.leaflet-left .leaflet-control { margin-left: 0; }
.leaflet-right .leaflet-control { margin-right: 0; float: right; }
.leaflet-control-zoom {
    border: 0 !important;
    border-radius: 14px !important;
    overflow: hidden;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .18) !important;
}
.leaflet-control-zoom a {
    width: 36px !important;
    height: 36px !important;
    line-height: 34px !important;
    display: block;
    background: #fff;
    color: #0f172a !important;
    text-align: center;
    text-decoration: none !important;
    font-weight: 900;
    border-bottom: 1px solid #e2e8f0;
}
.leaflet-control-zoom a:last-child { border-bottom: 0; }
.leaflet-control-layers {
    background: #fff;
    border: 1px solid rgba(226, 232, 240, .95);
    border-radius: 16px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .12);
    padding: .65rem .75rem;
    color: #0f172a;
    font-size: .9rem;
}
.leaflet-control-layers label { display: block; margin: .15rem 0; }
.leaflet-control-attribution {
    background: rgba(255,255,255,.88);
    padding: .25rem .45rem;
    border-radius: 10px;
    font-size: .75rem;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .10);
}
.leaflet-popup {
    position: absolute;
    text-align: center;
    margin-bottom: 20px;
}
.leaflet-popup-content-wrapper {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 18px 38px rgba(15, 23, 42, .18);
    padding: .2rem;
    text-align: left;
}
.leaflet-popup-content {
    margin: .85rem 1rem;
    line-height: 1.35;
    min-width: 130px;
}
.leaflet-popup-tip-container {
    width: 40px;
    height: 20px;
    position: absolute;
    left: 50%;
    margin-left: -20px;
    overflow: hidden;
    pointer-events: none;
}
.leaflet-popup-tip {
    width: 16px;
    height: 16px;
    padding: 1px;
    margin: -8px auto 0;
    background: #fff;
    transform: rotate(45deg);
    box-shadow: 0 18px 38px rgba(15, 23, 42, .18);
}
.leaflet-popup-close-button {
    position: absolute;
    top: 6px;
    right: 8px;
    border: 0;
    text-align: center;
    width: 24px;
    height: 24px;
    font-size: 20px;
    line-height: 22px;
    color: #64748b !important;
    text-decoration: none !important;
}
.leaflet-interactive { cursor: pointer; }
.leaflet-grab { cursor: grab; }
.leaflet-dragging .leaflet-grab { cursor: move; }
.horus-map .leaflet-control-container { font-family: inherit; }

/* PACK 03 — Importação semanal de radares */
.mini-stat {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: .9rem;
    min-height: 86px;
}
.mini-stat span {
    display: block;
    color: #64748b;
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.mini-stat strong {
    display: block;
    color: #0f172a;
    font-size: 1.6rem;
    line-height: 1.2;
    margin-top: .25rem;
}
.table small { line-height: 1.25; }

/* PACK 04 — Modo Radar / alerta por voz */
.radar-speed-card strong::after {
    content: " km/h";
    font-size: 1rem;
    color: #64748b;
    letter-spacing: 0;
    margin-left: .25rem;
}
.radar-watch-panel { padding: 1.25rem; }
.radar-watch-title { align-items: center; }
.radar-live-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 1rem;
    align-items: stretch;
}
.radar-live-map { min-height: 660px; }
.radar-live-side {
    display: grid;
    gap: .85rem;
    align-content: start;
}
.radar-alert-box,
.radar-side-card {
    border: 1px solid #e2e8f0;
    border-radius: 22px;
    background: #f8fafc;
    padding: 1rem;
}
.radar-alert-box {
    background: linear-gradient(135deg, #eff6ff, #f8fafc);
    border-color: #bfdbfe;
    min-height: 150px;
}
.radar-alert-box.warn {
    background: linear-gradient(135deg, #fffbeb, #fff7ed);
    border-color: #f59e0b;
}
.radar-alert-box.danger {
    background: linear-gradient(135deg, #fef2f2, #fff7ed);
    border-color: #ef4444;
    box-shadow: 0 16px 34px rgba(239, 68, 68, .14);
}
.radar-alert-kicker,
.radar-side-card span {
    display: block;
    color: #64748b;
    font-size: .76rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: .35rem;
}
.radar-alert-box strong {
    display: block;
    color: #0f172a;
    font-size: 1.35rem;
    line-height: 1.15;
    margin-bottom: .45rem;
    letter-spacing: -.035em;
}
.radar-alert-box p,
.radar-side-card p {
    color: #475569;
    margin-bottom: 0;
}
.radar-side-card strong {
    display: block;
    font-size: 1.1rem;
    color: #0f172a;
    margin-bottom: .35rem;
}
.radar-mini-list {
    margin: 0;
    padding-left: 1.1rem;
    color: #475569;
}
.radar-muted-card {
    background: #fff;
}
@media (max-width: 1100px) {
    .radar-live-grid { grid-template-columns: 1fr; }
    .radar-live-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
    .radar-live-map { min-height: 520px; }
    .radar-live-side { grid-template-columns: 1fr; }
}


/* PACK 04B — Modo radar visual/mobile, sem depender da voz */
.radar-watch-title .map-actions .btn { white-space: nowrap; }
.speed-test-card {
    border: 1px solid #dbeafe;
    background: linear-gradient(135deg, #eff6ff, #f8fafc);
    border-radius: 18px;
    padding: .9rem 1rem;
}
.speed-test-row {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    align-items: center;
}
.speed-test-row input {
    max-width: 150px;
    font-weight: 900;
}
.speed-preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-top: .55rem;
}
.speed-preset-row .btn { border-radius: 999px; font-weight: 800; }
.radar-limit-status.safe {
    border-color: #bbf7d0;
    background: #f0fdf4;
}
.radar-limit-status.warn {
    border-color: #fbbf24;
    background: #fffbeb;
}
.radar-limit-status.danger {
    border-color: #ef4444;
    background: #fef2f2;
    box-shadow: 0 16px 34px rgba(239, 68, 68, .14);
}
.radar-alert-box.safe {
    background: linear-gradient(135deg, #ecfdf5, #f8fafc);
    border-color: #10b981;
}
.radar-big-distance {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: .65rem;
    margin-top: .75rem;
}
.radar-big-distance div {
    border-radius: 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    padding: .75rem;
}
.radar-big-distance span {
    display: block;
    color: #64748b;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 900;
    margin-bottom: .2rem;
}
.radar-big-distance strong {
    display: block;
    font-size: 1.45rem;
    line-height: 1;
    color: #0f172a;
}
.hn-focus-mode .sidebar,
.hn-focus-mode .topbar,
.hn-focus-mode .row.g-4.mb-4 {
    display: none !important;
}
.hn-focus-mode .content-wrap {
    padding: 0 !important;
}
.hn-focus-mode .radar-watch-panel {
    min-height: 100vh;
    border-radius: 0;
    border: 0;
    box-shadow: none;
}
.hn-focus-mode .radar-live-map {
    min-height: calc(100vh - 170px);
}
.hn-focus-mode .radar-live-grid {
    grid-template-columns: minmax(0, 1fr) 330px;
}
.hn-focus-mode .radar-watch-title {
    position: sticky;
    top: 0;
    z-index: 1200;
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid #e2e8f0;
    margin: -1.25rem -1.25rem 1rem;
    padding: 1rem 1.25rem;
}
@media (max-width: 900px) {
    .radar-watch-title { display: block; }
    .radar-watch-title .map-actions { justify-content: stretch; margin-top: .75rem; }
    .radar-watch-title .map-actions .btn { flex: 1 1 calc(50% - .5rem); }
    .radar-live-map { min-height: 68vh; }
    .speed-test-row input { max-width: none; flex: 1; }
    .radar-big-distance { grid-template-columns: 1fr; }
    .hn-focus-mode .radar-live-grid { grid-template-columns: 1fr; }
    .hn-focus-mode .radar-live-side { grid-template-columns: 1fr; }
    .hn-focus-mode .radar-watch-title { position: relative; }
    .hn-focus-mode .radar-live-map { min-height: 70vh; }
}

/* PACK 04C — Modo direção visual */
.radar-top-metrics .metric-card,
.radar-top-metrics .panel-card { min-height: 122px; }
.drive-cockpit {
    margin: .25rem 0 1rem;
    border-radius: 24px;
    border: 1px solid #dbeafe;
    background: radial-gradient(circle at top left, rgba(37,99,235,.14), transparent 32%), linear-gradient(135deg, #0f172a, #172554);
    color: #fff;
    padding: 1.15rem;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(320px, .95fr);
    gap: 1rem;
    box-shadow: 0 22px 44px rgba(15, 23, 42, .20);
    transition: background .18s ease, box-shadow .18s ease, transform .18s ease;
}
.drive-cockpit.info {
    background: radial-gradient(circle at top left, rgba(59,130,246,.30), transparent 32%), linear-gradient(135deg, #1e3a8a, #0f172a);
}
.drive-cockpit.safe {
    background: radial-gradient(circle at top left, rgba(16,185,129,.28), transparent 32%), linear-gradient(135deg, #064e3b, #0f172a);
}
.drive-cockpit.warn {
    background: radial-gradient(circle at top left, rgba(245,158,11,.34), transparent 34%), linear-gradient(135deg, #78350f, #111827);
    box-shadow: 0 22px 54px rgba(245,158,11,.22);
}
.drive-cockpit.danger {
    background: radial-gradient(circle at top left, rgba(239,68,68,.42), transparent 36%), linear-gradient(135deg, #7f1d1d, #111827);
    box-shadow: 0 22px 58px rgba(239,68,68,.30);
    animation: hnDangerPulse 1.6s ease-in-out infinite;
}
@keyframes hnDangerPulse {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-1px); }
}
.drive-main-message span,
.approach-wrap span,
.drive-metrics span {
    display: block;
    text-transform: uppercase;
    letter-spacing: .10em;
    font-size: .74rem;
    font-weight: 900;
    color: rgba(255,255,255,.72);
}
.drive-main-message strong {
    display: block;
    font-size: clamp(1.8rem, 3.2vw, 3.35rem);
    line-height: 1.02;
    margin: .35rem 0 .45rem;
    color: #fff;
}
.drive-main-message p,
.approach-wrap small {
    color: rgba(255,255,255,.80);
    margin: 0;
}
.drive-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .7rem;
}
.drive-metrics div {
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 18px;
    padding: .9rem;
    backdrop-filter: blur(8px);
}
.drive-metrics strong {
    display: block;
    font-size: clamp(1.8rem, 3.3vw, 3.4rem);
    line-height: 1;
    color: #fff;
    margin: .3rem 0 .25rem;
}
.drive-metrics small {
    color: rgba(255,255,255,.72);
    font-weight: 800;
}
.approach-wrap {
    grid-column: 1 / -1;
    margin-top: .1rem;
}
.approach-bar {
    height: 14px;
    border-radius: 999px;
    background: rgba(255,255,255,.18);
    overflow: hidden;
    margin: .45rem 0 .35rem;
}
.approach-bar i {
    display: block;
    width: 0%;
    height: 100%;
    border-radius: 999px;
    background: rgba(255,255,255,.88);
    transition: width .25s ease;
}
.speed-test-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.follow-toggle {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .7rem;
    border-radius: 999px;
    border: 1px solid #bfdbfe;
    background: #fff;
    color: #0f172a;
    font-weight: 800;
    cursor: pointer;
    user-select: none;
}
.follow-toggle input { accent-color: #2563eb; }
.radar-live-grid-drive {
    grid-template-columns: minmax(0, 1fr) 360px;
}
.radar-alert-box.info {
    border-color: #60a5fa;
    background: linear-gradient(135deg, #eff6ff, #fff);
}
.recent-alert-list {
    display: grid;
    gap: .55rem;
    margin-top: .55rem;
}
.recent-alert-list em {
    color: #64748b;
    font-size: .92rem;
}
.recent-alert-item {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: .58rem .65rem;
    background: #fff;
}
.recent-alert-item strong {
    display: block;
    font-size: .92rem;
    line-height: 1.15;
    color: #0f172a;
}
.recent-alert-item small {
    display: block;
    margin-top: .15rem;
    color: #64748b;
    font-weight: 700;
}
.recent-alert-item.info { border-color: #bfdbfe; background: #eff6ff; }
.recent-alert-item.warn { border-color: #fbbf24; background: #fffbeb; }
.recent-alert-item.danger { border-color: #ef4444; background: #fef2f2; }
.hn-focus-mode .drive-cockpit {
    position: sticky;
    top: 0;
    z-index: 1250;
    border-radius: 0;
    margin: -1.25rem -1.25rem 1rem;
}
.hn-focus-mode .radar-live-grid-drive {
    grid-template-columns: minmax(0, 1fr) 330px;
}
.hn-focus-mode .radar-live-map {
    min-height: calc(100vh - 270px);
}
@media (max-width: 1100px) {
    .drive-cockpit { grid-template-columns: 1fr; }
    .radar-live-grid-drive { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .drive-cockpit {
        border-radius: 20px;
        padding: .9rem;
    }
    .drive-metrics { grid-template-columns: 1fr; }
    .drive-metrics div { padding: .7rem; }
    .drive-main-message strong { font-size: 2rem; }
    .drive-metrics strong { font-size: 2rem; }
    .speed-test-head { display: block; }
    .follow-toggle { margin-top: .65rem; }
    .hn-focus-mode .drive-cockpit { position: relative; margin: 0 0 .8rem; border-radius: 18px; }
    .hn-focus-mode .radar-live-map { min-height: 66vh; }
}

/* ==========================
   PACK 05 - ROTAS OSRM
   ========================== */
.route-osrm-status-card small {
  color: var(--muted);
  word-break: break-all;
}

.route-panel .route-title {
  gap: 1rem;
}

.route-help-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.route-help-grid > div,
.route-form-card {
  background: #f8fafc;
  border: 1px solid #dbe4f0;
  border-radius: 1rem;
  padding: 1rem;
}

.route-help-grid strong,
.route-form-card label,
.route-side-card > span,
.route-summary-card > span {
  display: block;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #526987;
  font-weight: 800;
  margin-bottom: .35rem;
}

.route-help-grid span,
.route-form-card small {
  color: var(--muted);
}

.route-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.route-pick-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  margin-top: .85rem;
}

.route-pick-row span {
  color: var(--muted);
  font-weight: 700;
}

.route-pick-row .btn.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb !important;
}

.route-live-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 1rem;
  align-items: start;
}

.route-map-wrap {
  min-width: 0;
}

.route-map {
  height: 620px;
  min-height: 520px;
  border-radius: 1.25rem;
  overflow: hidden;
  border: 1px solid #dbe4f0;
  background: #eef4fb;
}

.route-side {
  display: grid;
  gap: 1rem;
}

.route-summary-card,
.route-side-card {
  background: #fff;
  border: 1px solid #dbe4f0;
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .05);
}

.route-summary-card strong {
  display: block;
  font-size: 1.25rem;
  line-height: 1.2;
  margin-bottom: .35rem;
}

.route-summary-card p,
.route-side-card p {
  color: var(--muted);
  margin: 0;
}

.route-summary-card.safe {
  background: #ecfdf5;
  border-color: #86efac;
}

.route-summary-card.info {
  background: #eff6ff;
  border-color: #93c5fd;
}

.route-summary-card.warn {
  background: #fffbeb;
  border-color: #fbbf24;
}

.route-summary-card.danger {
  background: #fef2f2;
  border-color: #ef4444;
}

.route-numbers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

.route-numbers > div {
  background: #f8fafc;
  border: 1px solid #dbe4f0;
  border-radius: .9rem;
  padding: .85rem;
}

.route-numbers span {
  display: block;
  color: #526987;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 800;
}

.route-numbers strong {
  font-size: 1.45rem;
  line-height: 1;
}

.route-radar-list {
  display: grid;
  gap: .6rem;
  max-height: 310px;
  overflow: auto;
  padding-right: .25rem;
}

.route-radar-item {
  border: 1px solid #dbe4f0;
  background: #f8fafc;
  border-radius: .75rem;
  padding: .7rem .8rem;
}

.route-radar-item strong,
.route-radar-item span {
  display: block;
}

.route-radar-item span {
  color: var(--muted);
  font-size: .92rem;
}

.route-point-icon {
  background: transparent !important;
  border: 0 !important;
}

.route-point-icon span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: #fff;
  font-weight: 900;
  border: 3px solid #fff;
  box-shadow: 0 10px 20px rgba(15, 23, 42, .25);
}

.route-map .leaflet-control-layers,
.route-map .leaflet-control-zoom {
  border: 0 !important;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .18) !important;
  border-radius: .8rem !important;
  overflow: hidden;
}

@media (max-width: 1180px) {
  .route-live-grid {
    grid-template-columns: 1fr;
  }
  .route-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .route-help-grid,
  .route-form-row,
  .route-side {
    grid-template-columns: 1fr;
  }
  .route-map {
    height: 70vh;
    min-height: 420px;
  }
  .route-title .map-actions {
    width: 100%;
  }
}

/* ==========================
   PACK 05A - ALERTAS NO TRAJETO
   ========================== */
.route-intel-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.route-intel-card {
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border: 1px solid #dbe4f0;
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .045);
}

.route-intel-card span {
  display: block;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #526987;
  font-weight: 900;
  margin-bottom: .35rem;
}

.route-intel-card strong {
  display: block;
  font-size: 1.2rem;
  line-height: 1.15;
  color: #0f172a;
}

.route-intel-card small {
  display: block;
  color: #64748b;
  margin-top: .35rem;
}

.route-intel-next {
  background: linear-gradient(135deg, #eff6ff, #ffffff);
  border-color: #93c5fd;
}

.route-radar-ordered {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  gap: .65rem;
  align-items: start;
}

.route-radar-ordered > b {
  display: grid;
  place-items: center;
  min-width: 2.15rem;
  height: 2.15rem;
  border-radius: 999px;
  background: #e0ecff;
  color: #1d4ed8;
  font-size: .82rem;
  font-weight: 900;
}

.route-radar-list-card .route-radar-list {
  max-height: 430px;
}

.route-summary-card.info {
  background: #eff6ff;
  border-color: #93c5fd;
}

@media (max-width: 1180px) {
  .route-intel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .route-intel-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================
   PACK 05B - RADAR DA ROTA NO MODO DIREÇÃO
   ========================== */
.drive-route-panel {
  background: linear-gradient(135deg, #0f172a, #1e293b 60%, #334155);
  color: #fff;
  border-radius: 1.2rem;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 16px 36px rgba(15, 23, 42, .18);
}

.drive-route-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: .85rem;
}

.drive-route-head span,
.drive-route-stats span {
  display: block;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  font-weight: 900;
  color: #bfdbfe;
  margin-bottom: .25rem;
}

.drive-route-head strong {
  display: block;
  font-size: 1.12rem;
  line-height: 1.2;
}

.drive-route-head small,
.drive-route-stats small {
  display: block;
  color: #cbd5e1;
  margin-top: .25rem;
}

.drive-route-stats {
  display: grid;
  grid-template-columns: 1.4fr .75fr .8fr;
  gap: .75rem;
}

.drive-route-stats > div {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 1rem;
  padding: .85rem;
}

.drive-route-stats strong {
  display: block;
  font-size: 1.18rem;
  line-height: 1.15;
}

.drive-route-upcoming {
  display: grid;
  gap: .55rem;
  margin-top: .85rem;
}

.drive-route-upcoming-item {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr);
  gap: .65rem;
  align-items: center;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: .85rem;
  padding: .55rem .65rem;
}

.drive-route-upcoming-item.next {
  background: rgba(249, 115, 22, .16);
  border-color: rgba(251, 146, 60, .45);
}

.drive-route-upcoming-item b {
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 999px;
  background: #f97316;
  color: #fff;
  font-size: .82rem;
}

.drive-route-upcoming-item strong,
.drive-route-upcoming-item small {
  display: block;
}

.drive-route-upcoming-item small {
  color: #cbd5e1;
}

.hn-focus-mode .drive-route-panel {
  border-radius: 0;
  margin-bottom: 0 !important;
}

@media (max-width: 960px) {
  .drive-route-head,
  .drive-route-stats {
    grid-template-columns: 1fr;
  }
  .drive-route-head {
    display: grid;
  }
}

/* ==========================
   PACK 05C - MODO VIAGEM REFINADO
   ========================== */
.drive-route-panel-compact {
  padding: .85rem;
  background: linear-gradient(135deg, #0b1220, #172033 58%, #243247);
}

.drive-route-head-compact {
  align-items: center;
  margin-bottom: .7rem;
}

.drive-route-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .45rem;
}

.drive-route-actions .btn,
.drive-route-step-actions .btn-xs {
  font-weight: 800;
  border-radius: .65rem;
}

.drive-route-panel-compact.trip-started {
  background: linear-gradient(135deg, #0f2b1d, #153425 58%, #254033);
  border-color: rgba(34, 197, 94, .28);
}

.drive-route-stats-compact {
  grid-template-columns: 1.15fr .55fr .65fr;
}

.drive-route-stats-compact > div {
  padding: .72rem;
}

.drive-route-stats-compact strong {
  font-size: 1.05rem;
}

.drive-route-progressbar {
  height: .65rem;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,.16);
  margin-top: .75rem;
}

.drive-route-progressbar i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f97316, #facc15);
  border-radius: inherit;
  transition: width .25s ease;
}

.drive-route-step-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  justify-content: flex-end;
  margin-top: .6rem;
}

.drive-route-upcoming-wrap {
  margin-top: .75rem;
}

.drive-route-panel.collapsed .drive-route-upcoming-wrap {
  display: none;
}

.drive-route-upcoming-title {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #bfdbfe;
  font-weight: 900;
  margin-bottom: .45rem;
}

.drive-route-upcoming {
  max-height: 360px;
  overflow: auto;
  padding-right: .15rem;
}

.drive-route-upcoming-item {
  min-height: 3.25rem;
}

.drive-route-upcoming-item.next {
  box-shadow: inset 0 0 0 1px rgba(251, 146, 60, .25);
}

.hn-focus-mode .drive-route-panel-compact {
  position: relative;
  z-index: 20;
}

.hn-focus-mode .drive-route-actions {
  justify-content: flex-start;
}

@media (max-width: 960px) {
  .drive-route-stats-compact {
    grid-template-columns: 1fr;
  }
  .drive-route-actions {
    justify-content: flex-start;
  }
  .drive-route-step-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 680px) {
  .drive-route-panel-compact {
    margin-left: -.25rem;
    margin-right: -.25rem;
    border-radius: .9rem;
  }
  .drive-route-actions .btn,
  .drive-route-step-actions .btn-xs {
    width: 100%;
  }
}

/* ==========================
   PACK 05D - ACABAMENTO MODO VIAGEM / MOBILE
   ========================== */
.hn-route-active .map-info-grid {
  display: none !important;
}

.hn-route-active .speed-test-card {
  padding: .65rem .75rem;
  margin-bottom: .75rem !important;
}

.hn-route-active .speed-test-head p {
  display: none;
}

.hn-route-active .speed-test-head {
  align-items: center;
}

.hn-route-active .speed-test-row {
  gap: .4rem;
  flex-wrap: wrap;
}

.hn-route-active .speed-test-row input {
  max-width: 130px;
}

.hn-route-active .speed-preset-row {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: .15rem;
  scrollbar-width: thin;
}

.drive-route-panel-compact {
  padding: .65rem .75rem;
  margin-bottom: .75rem !important;
  overflow: hidden;
}

.drive-route-head-compact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .75rem;
  align-items: start;
}

.drive-route-head-compact > div:first-child {
  min-width: 0;
}

.drive-route-head-compact #hnRouteTitle {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1rem;
}

.drive-route-head-compact #hnRouteSubtitle {
  font-size: .78rem;
}

.drive-route-actions {
  max-width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .35rem;
}

.drive-route-actions .btn,
.drive-route-step-actions .btn-xs {
  white-space: nowrap;
  line-height: 1.05;
  padding: .38rem .55rem;
  font-size: .8rem;
}

.drive-route-stats-compact {
  grid-template-columns: minmax(0, 1.3fr) .45fr .55fr;
  gap: .55rem;
}

.drive-route-stats-compact > div {
  padding: .6rem .65rem;
  min-width: 0;
}

.drive-route-stats-compact span {
  font-size: .66rem;
}

.drive-route-stats-compact strong {
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.drive-route-stats-compact small {
  font-size: .78rem;
}

.drive-route-progressbar {
  height: .5rem;
  margin-top: .55rem;
}

.drive-route-step-actions {
  margin-top: .45rem;
}

.drive-route-step-actions #btnRouteNextRadarManual {
  background: rgba(255, 255, 255, .95);
  color: #0f172a;
  border-color: rgba(255, 255, 255, .8);
}

.drive-route-upcoming-wrap {
  margin-top: .55rem;
}

.drive-route-upcoming-title {
  margin-bottom: .35rem;
}

.drive-route-upcoming {
  max-height: 285px;
}

.drive-route-upcoming-item {
  min-height: 2.75rem;
  padding: .45rem .55rem;
  grid-template-columns: 2.25rem minmax(0, 1fr);
}

.drive-route-upcoming-item b {
  width: 1.85rem;
  height: 1.85rem;
  font-size: .72rem;
}

.drive-route-upcoming-item strong {
  font-size: .9rem;
}

.drive-route-upcoming-item small {
  font-size: .76rem;
}

.hn-focus-mode.hn-route-active .drive-route-panel-compact {
  border-radius: 0;
}

@media (max-width: 1280px) {
  .drive-route-head-compact {
    grid-template-columns: 1fr;
  }
  .drive-route-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 960px) {
  .drive-route-stats-compact {
    grid-template-columns: 1fr 1fr;
  }
  .drive-route-stats-compact > div:first-child {
    grid-column: 1 / -1;
  }
  .drive-route-actions .btn,
  .drive-route-step-actions .btn-xs {
    flex: 1 1 auto;
  }
}

@media (max-width: 680px) {
  .hn-route-active .speed-test-head {
    display: grid;
    gap: .45rem;
  }
  .hn-route-active .speed-test-row input,
  .hn-route-active .speed-test-row .btn {
    max-width: none;
    flex: 1 1 100%;
  }
  .drive-route-panel-compact {
    padding: .6rem;
    border-radius: .85rem;
  }
  .drive-route-stats-compact {
    grid-template-columns: 1fr;
  }
  .drive-route-actions,
  .drive-route-step-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .drive-route-actions .btn,
  .drive-route-step-actions .btn-xs {
    width: 100%;
  }
  .drive-route-head-compact #hnRouteTitle {
    white-space: normal;
  }
  .drive-route-upcoming {
    max-height: 240px;
  }
}

/* ==========================
   PACK 06A - INDICADOR OSRM LOCAL / FALLBACK
   ========================== */
.route-osrm-status-card {
  position: relative;
  overflow: hidden;
}
.route-engine-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .28rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
  border: 1px solid rgba(15, 23, 42, .12);
}
.route-engine-pill.is-local {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}
.route-engine-pill.is-public {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #93c5fd;
}
.route-engine-pill.is-warn {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}
.route-osrm-live-box.osrm-local-ok {
  border-color: #86efac !important;
  background: linear-gradient(135deg, rgba(220, 252, 231, .95), rgba(240, 253, 244, .85)) !important;
}
.route-osrm-live-box.osrm-local-warn {
  border-color: #fcd34d !important;
  background: linear-gradient(135deg, rgba(254, 243, 199, .95), rgba(255, 251, 235, .88)) !important;
}
.route-used-engine {
  margin-top: .65rem;
  padding: .45rem .6rem;
  border-radius: .75rem;
  background: rgba(255, 255, 255, .7);
  border: 1px solid rgba(148, 163, 184, .25);
  font-size: .78rem;
  color: #475569;
  overflow-wrap: anywhere;
}
.osrm-engine-banner {
  display: grid;
  grid-template-columns: 1.3fr .7fr .7fr;
  gap: .75rem;
  padding: .85rem;
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, .35);
  background: #f8fafc;
}
.osrm-engine-banner.is-online {
  background: linear-gradient(135deg, #dcfce7, #f0fdf4);
  border-color: #86efac;
}
.osrm-engine-banner.is-warning {
  background: linear-gradient(135deg, #fef3c7, #fff7ed);
  border-color: #fcd34d;
}
.osrm-engine-banner > div {
  padding: .75rem;
  border-radius: .85rem;
  background: rgba(255, 255, 255, .58);
  min-width: 0;
}
.osrm-engine-banner span {
  display: block;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #64748b;
}
.osrm-engine-banner strong {
  display: block;
  font-size: 1.45rem;
  line-height: 1.05;
  color: #0f172a;
  margin-top: .25rem;
}
.osrm-engine-banner small {
  display: block;
  margin-top: .25rem;
  color: #475569;
  overflow-wrap: anywhere;
}
@media (max-width: 900px) {
  .osrm-engine-banner {
    grid-template-columns: 1fr;
  }
}

/* PACK 07 — Alertas colaborativos */
.alert-top-metrics .metric-card strong { letter-spacing: -0.04em; }
.alertas-panel { overflow: hidden; }
.alert-help-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.alert-help-grid > div {
  border: 1px solid rgba(148, 163, 184, .28);
  background: #f8fafc;
  border-radius: 18px;
  padding: 16px;
}
.alert-help-grid strong {
  display: block;
  color: #0f172a;
  font-weight: 900;
  margin-bottom: 6px;
}
.alert-help-grid span {
  display: block;
  color: #475569;
  line-height: 1.45;
}
.alertas-live-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: stretch;
}
.alert-map-wrap {
  min-width: 0;
}
.alertas-map {
  height: 620px;
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, .35);
  overflow: hidden;
  background: #e2e8f0;
}
.alert-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.alert-report-card,
.alert-side-card {
  border: 1px solid rgba(148, 163, 184, .32);
  background: #fff;
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 16px 38px rgba(15, 23, 42, .06);
}
.alert-report-card > span,
.alert-side-card > span {
  display: block;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #64748b;
  font-weight: 900;
  font-size: .75rem;
  margin-bottom: 8px;
}
.alert-report-card strong,
.alert-side-card strong {
  display: block;
  color: #020617;
  font-size: 1.15rem;
  line-height: 1.2;
}
.alert-report-card p,
.alert-side-card p {
  margin: 7px 0 0;
  color: #475569;
  line-height: 1.45;
}
.alert-vote-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}
.alertas-table small {
  color: #64748b;
}
.alert-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .06em;
  border: 1px solid transparent;
}
.status-ativo {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}
.status-pendente {
  background: #fef3c7;
  color: #92400e;
  border-color: #facc15;
}
.status-expirado {
  background: #e2e8f0;
  color: #475569;
  border-color: #cbd5e1;
}
.status-removido {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}
.leaflet-popup-content strong + span {
  display: block;
  margin-top: 2px;
}
@media (max-width: 1200px) {
  .alertas-live-grid { grid-template-columns: 1fr; }
  .alert-side { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .alert-help-grid { grid-template-columns: 1fr; }
  .alert-side { display: flex; }
  .alertas-map { height: 520px; }
  .alertas-table .btn-group { flex-wrap: wrap; }
}

/* PACK 07A — Alertas colaborativos no trajeto e modo direção */
.route-alert-list-card {
  border: 1px solid rgba(14, 165, 233, .18);
}
.route-alert-list {
  display: grid;
  gap: .55rem;
  margin-top: .75rem;
  max-height: 320px;
  overflow: auto;
}
.route-alert-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: .65rem;
  align-items: center;
  padding: .75rem;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 14px;
  background: rgba(248, 250, 252, .96);
}
.route-alert-item b {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #0f766e;
  color: #fff;
  font-size: .78rem;
}
.route-alert-item strong {
  display: block;
  font-size: .93rem;
}
.route-alert-item span {
  display: block;
  color: #64748b;
  font-size: .82rem;
}
.route-alert-acidente b { background: #dc2626; }
.route-alert-blitz b { background: #7c2d12; }
.route-alert-buraco b { background: #f97316; }
.route-alert-obra b { background: #f59e0b; }
.route-alert-enchente b { background: #0284c7; }
.route-alert-transito_parado b { background: #9333ea; }
.route-alert-area_perigosa b { background: #111827; }
.route-alert-radar_movel b { background: #ea580c; }
.drive-route-panel .drive-route-upcoming-item.next {
  box-shadow: 0 0 0 1px rgba(249, 115, 22, .35) inset;
}
@media (max-width: 768px) {
  .route-alert-list { max-height: 220px; }
  .route-alert-item { grid-template-columns: 34px 1fr; padding: .65rem; }
  .route-alert-item b { width: 28px; height: 28px; }
}
