/* ═══════════════════════════════════════════════════════
   MONITORING — CONTROL TOWER PRO v3
   Mapa full-screen · Sidebar flotante · Player inferior
   ═══════════════════════════════════════════════════════ */

/* ── LAYOUT: mapa ocupa todo, sidebar flota encima ── */
.monitoring-container {
    position: relative;
    width: 100%;
    height: calc(100vh - 72px);
    overflow: hidden;
}

#monitoring-map {
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* ── SIDEBAR FLOTANTE ── */
.monitoring-sidebar {
    position: absolute;
    top: 12px;
    left: 12px;
    bottom: 12px;
    width: 360px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(10, 15, 28, 0.82);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0,180,240,0.08);
}

html:not(.dark) .monitoring-sidebar {
    background: rgba(255,255,255,0.88);
    border-color: rgba(0,0,0,0.08);
    box-shadow: 0 24px 64px rgba(0,0,0,0.18);
}

/* ── HEADER ── */
.mon-header {
    padding: 14px 16px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
    background: linear-gradient(135deg, rgba(0,180,240,0.08) 0%, transparent 100%);
}

html:not(.dark) .mon-header {
    background: linear-gradient(135deg, rgba(0,180,240,0.05) 0%, transparent 100%);
    border-bottom-color: rgba(0,0,0,0.06);
}

.mon-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.mon-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: #f1f5f9;
    letter-spacing: .04em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
}

html:not(.dark) .mon-title { color: #0f172a; }

.mon-live-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #22c55e;
    flex-shrink: 0;
    animation: mon-pulse 2s infinite;
}

@keyframes mon-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.7); }
    70%  { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
    100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

.mon-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.mon-stat-chip {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    padding: 8px 6px;
    text-align: center;
    transition: background 0.15s;
}

html:not(.dark) .mon-stat-chip {
    background: rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.07);
}

.mon-stat-chip .val {
    font-size: 1.3rem;
    font-weight: 900;
    line-height: 1;
    color: #f1f5f9;
    font-variant-numeric: tabular-nums;
}

html:not(.dark) .mon-stat-chip .val { color: #0f172a; }

.mon-stat-chip .lbl {
    font-size: 0.58rem;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-top: 3px;
    font-weight: 600;
}

html:not(.dark) .mon-stat-chip .lbl { color: rgba(0,0,0,0.4); }

.mon-stat-chip.online  .val { color: #22c55e; }
.mon-stat-chip.offline .val { color: #6b7280; }

/* ── TABS ── */
.mon-tabs {
    display: flex;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
    padding: 0 4px;
}

html:not(.dark) .mon-tabs {
    background: rgba(0,0,0,0.04);
    border-bottom-color: rgba(0,0,0,0.07);
}

.mon-tab {
    flex: 1;
    padding: 10px 2px 8px;
    font-size: 0.6rem;
    font-weight: 700;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.35);
    cursor: pointer;
    transition: all 0.18s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    border-bottom: 2px solid transparent;
    letter-spacing: .05em;
    text-transform: uppercase;
    position: relative;
}

html:not(.dark) .mon-tab { color: rgba(0,0,0,0.4); }

.mon-tab .tab-icon { font-size: 1.1rem; line-height: 1; }

.mon-tab:hover { color: rgba(255,255,255,0.7); }
html:not(.dark) .mon-tab:hover { color: rgba(0,0,0,0.7); }

.mon-tab.active {
    color: #00b4f0;
    border-bottom-color: #00b4f0;
}

.mon-tab-content { display: none; flex-direction: column; flex: 1; min-height: 0; }
.mon-tab-content.active { display: flex; }

.mon-tab-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
}

.mon-tab-scroll::-webkit-scrollbar { width: 3px; }
.mon-tab-scroll::-webkit-scrollbar-track { background: transparent; }
.mon-tab-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }

/* ── VEHICLE CARDS ── */
.car-status-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 11px 13px;
    cursor: pointer;
    transition: all 0.18s ease;
    position: relative;
    overflow: hidden;
}

html:not(.dark) .car-status-card {
    background: rgba(0,0,0,0.02);
    border-color: rgba(0,0,0,0.08);
}

/* Accent bar izquierda */
.car-status-card::before {
    content: '';
    position: absolute;
    left: 0; top: 10%; bottom: 10%;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #6b7280;
    transition: background 0.2s, height 0.2s;
}

.car-status-card.status-moving::before   { background: #22c55e; box-shadow: 0 0 8px rgba(34,197,94,0.5); }
.car-status-card.status-speeding::before { background: #ef4444; box-shadow: 0 0 8px rgba(239,68,68,0.5); animation: blink-bar 0.8s infinite; }
.car-status-card.status-stopped::before  { background: #00b4f0; }
.car-status-card.status-offline::before  { background: #374151; }

@keyframes blink-bar {
    0%,100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

.car-status-card:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(0,180,240,0.3);
    transform: translateX(2px);
}

html:not(.dark) .car-status-card:hover {
    background: rgba(0,180,240,0.05);
    border-color: rgba(0,180,240,0.3);
}

.car-status-card.active {
    border-color: rgba(0,180,240,0.45);
    background: rgba(0,180,240,0.07);
}

.csc-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 9px;
}

.csc-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: #f1f5f9;
    line-height: 1.2;
}
html:not(.dark) .csc-name { color: #0f172a; }

.csc-plate {
    font-family: 'Courier New', monospace;
    font-size: 0.68rem;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 2px 8px;
    border-radius: 6px;
    color: rgba(255,255,255,0.6);
    letter-spacing: .06em;
    font-weight: 700;
}

html:not(.dark) .csc-plate {
    background: rgba(0,0,0,0.06);
    border-color: rgba(0,0,0,0.1);
    color: rgba(0,0,0,0.5);
}

.csc-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-top: 4px;
}

.badge-moving   { background: rgba(34,197,94,.15);   color: #22c55e; }
.badge-speeding { background: rgba(239,68,68,.15);   color: #ef4444; animation: badge-blink 0.8s infinite; }
.badge-stopped  { background: rgba(0,180,240,.12);   color: #00b4f0; }
.badge-offline  { background: rgba(107,114,128,.12); color: #6b7280; }

@keyframes badge-blink { 0%,100%{opacity:1} 50%{opacity:.5} }

.csc-grid {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 5px;
    margin-bottom: 9px;
}

.csc-metric {
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

html:not(.dark) .csc-metric { background: rgba(0,0,0,0.04); }

.csc-metric-val {
    font-size: 1rem;
    font-weight: 800;
    color: #f1f5f9;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

html:not(.dark) .csc-metric-val { color: #0f172a; }

.csc-metric-lbl {
    font-size: 0.55rem;
    color: rgba(255,255,255,0.3);
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 600;
}

html:not(.dark) .csc-metric-lbl { color: rgba(0,0,0,0.35); }

.csc-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

html:not(.dark) .csc-footer { border-top-color: rgba(0,0,0,0.06); }

.csc-update {
    font-size: 0.62rem;
    color: rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    gap: 4px;
}

html:not(.dark) .csc-update { color: rgba(0,0,0,0.35); }

/* ── SWITCH SEGUIMIENTO ── */
.csc-follow-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.55rem 0.55rem;
    cursor: pointer;
    user-select: none;
}
.csc-follow-lbl {
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: rgba(255,255,255,0.45);
    transition: color 0.2s;
}
.csc-follow-wrap.active .csc-follow-lbl { color: #60a5fa; }
html:not(.dark) .csc-follow-lbl       { color: rgba(0,0,0,0.38); }
html:not(.dark) .csc-follow-wrap.active .csc-follow-lbl { color: #2563eb; }

.csc-follow-track {
    position: relative;
    width: 34px;
    height: 18px;
    border-radius: 9px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.12);
    transition: background 0.22s, border-color 0.22s, box-shadow 0.22s;
    flex-shrink: 0;
}
.csc-follow-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.35);
    transition: transform 0.22s cubic-bezier(.4,0,.2,1), background 0.22s;
}
.csc-follow-wrap.active .csc-follow-track {
    background: #3b82f6;
    border-color: #3b82f6;
    box-shadow: 0 0 8px rgba(59,130,246,0.5);
    animation: follow-glow 2s ease-in-out infinite;
}
.csc-follow-wrap.active .csc-follow-thumb {
    transform: translateX(16px);
    background: #fff;
}
@keyframes follow-glow {
    0%, 100% { box-shadow: 0 0 6px rgba(59,130,246,0.45); }
    50%       { box-shadow: 0 0 12px rgba(59,130,246,0.75); }
}
html:not(.dark) .csc-follow-track {
    background: rgba(0,0,0,0.08);
    border-color: rgba(0,0,0,0.12);
}
html:not(.dark) .csc-follow-thumb { background: rgba(0,0,0,0.25); }
html:not(.dark) .csc-follow-wrap.active .csc-follow-track { background: #3b82f6; border-color: #3b82f6; }
html:not(.dark) .csc-follow-wrap.active .csc-follow-thumb { background: #fff; }

/* ── ROUTE FORM ── */
.route-form-panel {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 13px;
}

html:not(.dark) .route-form-panel {
    background: rgba(0,0,0,0.03);
    border-color: rgba(0,0,0,0.07);
}

.route-form-panel label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: rgba(255,255,255,0.4);
    display: block;
    margin-bottom: 5px;
}

html:not(.dark) .route-form-panel label { color: rgba(0,0,0,0.45); }

.route-form-panel .form-control {
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.09);
    background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.03));
    color: #f8fafc;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 10px 24px rgba(0,0,0,0.18);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.route-form-panel .form-control:hover {
    border-color: rgba(0,180,240,0.28);
}

.route-form-panel .form-control:focus {
    outline: none;
    border-color: rgba(0,180,240,0.7);
    box-shadow: 0 0 0 3px rgba(0,180,240,0.16), inset 0 1px 0 rgba(255,255,255,0.05);
}

.route-form-panel select.form-control {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 38px;
    background-image:
      linear-gradient(45deg, transparent 50%, rgba(255,255,255,0.8) 50%),
      linear-gradient(135deg, rgba(255,255,255,0.8) 50%, transparent 50%);
    background-position:
      calc(100% - 19px) calc(50% - 3px),
      calc(100% - 13px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.route-form-panel input[type="date"].form-control {
    color-scheme: dark;
    padding-right: 42px;
    font-variant-numeric: tabular-nums;
}

.route-form-panel input[type="date"].form-control::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.9;
    filter: invert(1) brightness(1.15);
}

html:not(.dark) .route-form-panel .form-control {
    border-color: rgba(15,23,42,0.1);
    background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(241,245,249,0.92));
    color: #0f172a;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 10px 24px rgba(15,23,42,0.08);
}

html:not(.dark) .route-form-panel select.form-control {
    background-image:
      linear-gradient(45deg, transparent 50%, rgba(15,23,42,0.62) 50%),
      linear-gradient(135deg, rgba(15,23,42,0.62) 50%, transparent 50%);
}

html:not(.dark) .route-form-panel input[type="date"].form-control {
    color-scheme: light;
}

html:not(.dark) .route-form-panel input[type="date"].form-control::-webkit-calendar-picker-indicator {
    filter: none;
}

/* ── ROUTE PLAYER (panel flotante sobre el mapa) ── */
.route-player {
    position: absolute;
    bottom: 16px;
    left: 388px;
    right: 16px;
    z-index: 200;
    background: rgba(10, 15, 28, 0.88);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 14px 18px;
    display: none;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}

html:not(.dark) .route-player {
    background: rgba(255,255,255,0.92);
    border-color: rgba(0,0,0,0.08);
}

.route-player.visible { display: flex; }

/* ── Stats chips row inside player ── */
.rp-stats-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    margin-bottom: 2px;
}
.rp-stats-row::-webkit-scrollbar { display: none; }
html:not(.dark) .rp-stats-row { border-bottom-color: rgba(0,0,0,0.07); }

.rp-stat-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    padding: 5px 10px;
    min-width: 70px;
    flex-shrink: 0;
}
html:not(.dark) .rp-stat-chip { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.07); }

.rp-sc-lbl {
    font-size: 0.6rem;
    color: rgba(255,255,255,0.38);
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}
html:not(.dark) .rp-sc-lbl { color: rgba(0,0,0,0.4); }

.rp-sc-val {
    font-size: 0.78rem;
    font-weight: 700;
    color: #e2e8f0;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
html:not(.dark) .rp-sc-val { color: #0f172a; }

.rp-top {
    display: flex;
    align-items: center;
    gap: 14px;
}

.rp-play-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00b4f0, #0090cc);
    border: none;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 18px rgba(0,180,240,0.5);
    transition: transform 0.15s, box-shadow 0.15s;
    flex-shrink: 0;
}

.rp-play-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 28px rgba(0,180,240,0.7);
}

.rp-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.rp-time {
    font-size: 1.2rem;
    font-weight: 900;
    color: #f1f5f9;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

html:not(.dark) .rp-time { color: #0f172a; }

.rp-date {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.35);
    font-weight: 500;
}

html:not(.dark) .rp-date { color: rgba(0,0,0,0.4); }

.rp-speed-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.rp-speed {
    font-size: 1.3rem;
    font-weight: 900;
    color: #22c55e;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    transition: color 0.3s;
    min-width: 80px;
    text-align: right;
}

.rp-speed-unit {
    font-size: 0.6rem;
    color: rgba(255,255,255,0.3);
    font-weight: 600;
    text-transform: uppercase;
}

html:not(.dark) .rp-speed-unit { color: rgba(0,0,0,0.35); }

.rp-speed-sel {
    font-size: 0.68rem;
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    color: #f1f5f9;
    cursor: pointer;
    font-weight: 600;
}

html:not(.dark) .rp-speed-sel {
    background: rgba(0,0,0,0.06);
    border-color: rgba(0,0,0,0.1);
    color: #0f172a;
}

/* Timeline */
.rp-timeline {
    position: relative;
    padding-top: 18px;
}

.rp-hour-ticks {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 18px;
    pointer-events: none;
}

.rp-hour-tick {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateX(-50%);
    gap: 1px;
}

.rp-hour-tick span {
    font-size: 8px;
    color: rgba(255,255,255,0.3);
    font-weight: 600;
    white-space: nowrap;
}

html:not(.dark) .rp-hour-tick span { color: rgba(0,0,0,0.3); }

.rp-hour-tick div {
    width: 1px;
    height: 4px;
    background: rgba(255,255,255,0.15);
}

html:not(.dark) .rp-hour-tick div { background: rgba(0,0,0,0.15); }

#route-anim-slider {
    width: 100%;
    height: 5px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.1);
    border-radius: 5px;
    cursor: pointer;
    outline: none;
}

html:not(.dark) #route-anim-slider { background: rgba(0,0,0,0.1); }

#route-anim-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00b4f0, #0090cc);
    box-shadow: 0 0 10px rgba(0,180,240,0.6);
    cursor: pointer;
    transition: transform 0.1s;
    border: 2px solid rgba(255,255,255,0.2);
}

#route-anim-slider::-webkit-slider-thumb:hover { transform: scale(1.25); }

/* ── EVENTS ── */
.route-events-wrap {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    overflow: hidden;
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

html:not(.dark) .route-events-wrap {
    background: rgba(0,0,0,0.03);
    border-color: rgba(0,0,0,0.07);
}

.route-events-wrap.visible { display: flex; }

.route-events-header {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,0.3);
    flex-shrink: 0;
    background: rgba(0,0,0,0.15);
}

html:not(.dark) .route-events-header {
    border-bottom-color: rgba(0,0,0,0.07);
    color: rgba(0,0,0,0.35);
    background: rgba(0,0,0,0.03);
}

#route-points-list { flex: 1; overflow-y: auto; min-height: 0; }
#route-points-list::-webkit-scrollbar { width: 2px; }
#route-points-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); }

.route-event-item {
    padding: 8px 13px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    cursor: pointer;
    transition: background 0.12s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

html:not(.dark) .route-event-item { border-bottom-color: rgba(0,0,0,0.05); }

.route-event-item:hover { background: rgba(0,180,240,0.08); }
.route-event-item:last-child { border-bottom: none; }

.route-event-label {
    font-size: 0.76rem;
    font-weight: 600;
    flex: 1;
}

.route-event-time {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.3);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

html:not(.dark) .route-event-time { color: rgba(0,0,0,0.35); }

/* ── COMMANDS & GEOFENCES ── */
.cmd-card, .geo-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    background: rgba(255,255,255,0.03);
    transition: border-color 0.15s, background 0.15s;
}

html:not(.dark) .cmd-card, html:not(.dark) .geo-card {
    border-color: rgba(0,0,0,0.07);
    background: rgba(0,0,0,0.03);
}

.cmd-card:hover, .geo-card:hover {
    border-color: rgba(0,180,240,0.35);
    background: rgba(0,180,240,0.05);
}

.cmd-card-dim { opacity: 0.35; }

.btn-cmd {
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: opacity 0.15s, transform 0.1s;
    flex-shrink: 0;
    letter-spacing: .03em;
}

.btn-cmd:hover { opacity: 0.85; transform: scale(0.96); }

/* ── MAP FLOATING BADGES (top-right) ── */
.mon-map-badges {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 100;
    display: flex;
    gap: 8px;
    pointer-events: none;
}

.mon-map-badge {
    background: rgba(10,15,28,0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #f1f5f9;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: .03em;
}

html:not(.dark) .mon-map-badge {
    background: rgba(255,255,255,0.9);
    border-color: rgba(0,0,0,0.1);
    color: #0f172a;
}

.mon-map-badge .badge-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mon-map-badge.online-badge  .badge-dot { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.mon-map-badge.offline-badge .badge-dot { background: #9ca3af; }
.mon-map-badge.online-badge  { border-color: rgba(34,197,94,0.25); }
.mon-map-badge.offline-badge { border-color: rgba(156,163,175,0.2); }

/* ── LEAFLET LIGHT MAP ── */
.leaflet-tile { filter: none !important; }

.leaflet-container { background: #dbe7f3; }

.leaflet-control-zoom {
    border-radius: 12px !important;
    overflow: hidden;
    border: none !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4) !important;
}

.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
    background: rgba(255,255,255,0.94) !important;
    backdrop-filter: blur(12px);
    color: #0f172a !important;
    border-bottom: 1px solid rgba(15,23,42,0.08) !important;
}

.leaflet-control-zoom-in:hover,
.leaflet-control-zoom-out:hover {
    background: rgba(0,180,240,0.14) !important;
    color: #0098cf !important;
}

.leaflet-popup-content-wrapper {
    background: rgba(10,15,28,0.92) !important;
    backdrop-filter: blur(16px);
    color: #f1f5f9 !important;
    border-radius: 14px !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    box-shadow: 0 16px 48px rgba(0,0,0,0.6) !important;
}

html:not(.dark) .leaflet-popup-content-wrapper {
    background: rgba(255,255,255,0.95) !important;
    color: #0f172a !important;
    border-color: rgba(0,0,0,0.1) !important;
}

.leaflet-popup-tip {
    background: rgba(10,15,28,0.92) !important;
}

html:not(.dark) .leaflet-popup-tip { background: rgba(255,255,255,0.95) !important; }

/* ── CAR MARKER ── */
.car-marker { display: flex; align-items: center; justify-content: center; }

.car-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}

.car-label {
    position: absolute;
    bottom: -19px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(7,12,24,0.88);
    backdrop-filter: blur(6px);
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid rgba(255,255,255,0.08);
    color: #e2e8f0;
    pointer-events: none;
    letter-spacing: .03em;
}

.car-label-offline { color: #6b7280; }

/* ── RESPONSIVE (tablet 992px) ── */
@media (max-width: 992px) {
    .monitoring-sidebar { width: 300px; }
    .route-player { left: 324px; }
}

/* ══════════════════════════════════════════════════════════
   MOBILE — layout sin scroll, todo cabe en pantalla
   Panel inferior fijo (45vh) + mapa en el resto (55vh)
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* Columna flex: mapa arriba (flex:1), panel abajo (auto o 45vh) */
    .monitoring-container {
        position: relative;
        width: 100%;
        height: calc(100svh - 60px);
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    /* Mapa ocupa todo el espacio por encima del panel */
    #monitoring-map {
        order: 1;
        flex: 1;
        min-height: 0;
        position: relative;
        z-index: 1;
    }

    /* Panel: siempre 45vh en todos los tabs */
    .monitoring-sidebar {
        order: 2;
        position: static !important;
        top: auto !important; left: auto !important;
        right: auto !important; bottom: auto !important;
        width: 100% !important;
        height: 45vh;
        max-height: 45vh;
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        border-radius: 14px 14px 0 0;
        border: none;
        border-top: 1px solid rgba(255,255,255,0.1);
        box-shadow: 0 -6px 24px rgba(0,0,0,0.6);
        overflow: hidden;
    }

    .monitoring-sidebar.mob-sheet {
        box-shadow: 0 -10px 36px rgba(0,0,0,0.7);
    }

    .mon-header::before {
        content: '';
        display: block;
        width: 32px; height: 3px;
        background: rgba(255,255,255,0.2);
        border-radius: 2px;
        margin: 0 auto 4px;
    }

    .mon-header {
        padding: 4px 8px;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 5px;
        flex-shrink: 0;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    .mon-header-top  { display: contents; }
    .mon-title       { font-size: 0.5rem; gap: 4px; flex-shrink: 0; order: 0; }
    .mon-live-dot    { width: 5px; height: 5px; }
    #monitoring-alert { display: none !important; }

    .mon-stats-row {
        display: flex; flex-direction: row;
        gap: 3px; flex: 1; order: 1;
    }
    .mon-stat-chip {
        display: flex; flex-direction: row;
        align-items: center; gap: 2px;
        padding: 1px 5px; border-radius: 20px;
        flex: 1; justify-content: center;
    }
    .mon-stat-chip .val { font-size: 0.58rem; line-height: 1; }
    .mon-stat-chip .lbl { font-size: 0.36rem; margin-top: 0; white-space: nowrap; }

    .mon-header > div:last-child {
        order: 2; font-size: 0.36rem; white-space: nowrap; flex-shrink: 0;
    }
    .mon-header > div:last-child span { font-size: 0.36rem; }
    #mon-refresh-dot { width: 4px; height: 4px; }

    .mon-tabs { padding: 0; flex-shrink: 0; }
    .mon-tab  { font-size: 0; padding: 4px 2px 3px; gap: 0; }
    .mon-tab .tab-icon { font-size: 0.7rem; }

    /* Solo el tab activo es visible (display lo controla la regla global) */
    .mon-tab-content          { overflow: hidden; min-height: 0; }
    .mon-tab-content.active   { flex: 1; overflow: hidden; min-height: 0; }

    /* Area de scroll: tambien flex:1, sin overflow */
    .mon-tab-scroll {
        flex: 1;
        overflow: hidden;
        min-height: 0;
        padding: 5px 8px;
        gap: 5px;
        display: flex;
        flex-direction: column;
    }

    /* EN VIVO: tarjetas completas en columna con scroll */
    #tab-live .mon-tab-scroll {
        flex-direction: column;
        flex-wrap: nowrap;
        align-content: flex-start;
        overflow-y: auto;
        padding: 6px 8px;
        gap: 6px;
    }
    #cars-status-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        padding: 0 4px;
    }

    /* Tarjeta completa — igual que escritorio pero compacta */
    .car-status-card {
        flex-shrink: 0;
        height: auto;
        overflow: visible;
        padding: 8px 10px;
        border-radius: 10px;
        transform: none !important;
        cursor: pointer;
    }
    .car-status-card:hover { transform: none !important; }
    .car-status-card::before { top: 10%; bottom: 10%; }

    /* Header de tarjeta — formato nuevo (csc-*) */
    .csc-top {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
        height: auto;
        white-space: normal;
        margin-bottom: 6px;
    }
    .csc-top > div:first-child { display: flex; flex-direction: column; gap: 2px; }
    .csc-name         { font-size: 0.78rem; line-height: 1.2; white-space: nowrap; }
    .csc-plate        { font-size: 0.62rem; padding: 2px 6px; letter-spacing: .04em; flex-shrink: 0; }
    .csc-status-badge { display: inline-flex; font-size: 0.55rem; padding: 1px 7px; margin-top: 0; }

    /* Grid de métricas */
    .csc-grid         { gap: 4px; margin-bottom: 5px; }
    .csc-metric       { padding: 4px 6px; }
    .csc-metric-val   { font-size: 0.88rem; }
    .csc-metric-lbl   { font-size: 0.5rem; }
    .csc-footer       { padding-top: 5px; }
    .csc-update       { font-size: 0.56rem; }

    /* Header de tarjeta — formato viejo (car-status-*) */
    .car-status-header {
        display: flex !important;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 5px;
        height: auto;
        white-space: normal;
        margin-bottom: 5px;
    }
    .car-status-title { font-size: 0.78rem; color: #f1f5f9; font-weight: 700; white-space: nowrap; }
    .car-status-plate { font-size: 0.62rem; color: rgba(255,255,255,0.5); }
    .car-status-info  { display: flex !important; flex-direction: column; gap: 2px; font-size: 0.65rem; margin-bottom: 4px; }

    /* RUTAS */
    .route-form-panel {
        padding: 5px 8px;
        border-radius: 8px;
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
        align-items: flex-end;
        flex-shrink: 0;
    }
    .route-form-panel .form-group    { flex: 1; min-width: 90px; margin: 0 !important; }
    .route-form-panel label          { font-size: 0.46rem; margin-bottom: 2px; }
    .route-form-panel .form-control  { min-height: 28px; font-size: 0.7rem; padding: 0 7px; }
    .route-form-panel .w-full        { flex: 0 0 100%; min-height: 28px; font-size: 0.7rem; }
    .route-form-panel .mb-2,
    .route-form-panel .mb-3          { margin-bottom: 0 !important; }

    .route-events-wrap {
        flex: 1;
        position: relative;
        left: auto; right: auto; bottom: auto;
        width: auto; min-height: 0;
        margin: 0; border-radius: 8px;
        overflow: hidden;
    }
    .route-events-header { font-size: 0.5rem; padding: 4px 10px; }
    .route-event-item    { padding: 4px 10px; }
    .route-event-label   { font-size: 0.65rem; }
    .route-event-time    { font-size: 0.58rem; }

    /* Route player por encima del panel */
    .route-player {
        left: 8px; right: 8px;
        bottom: calc(45vh + 8px); top: auto;
        padding: 8px 12px; border-radius: 12px; gap: 6px;
    }
    .rp-stats-row { gap: 5px; }
    .rp-stat-chip { min-width: 55px; padding: 4px 6px; }
    .rp-play-btn  { width: 32px; height: 32px; font-size: 12px; }
    .rp-speed     { font-size: 1rem; min-width: 60px; }
    .rp-time      { font-size: 0.9rem; }
    .rp-date      { font-size: 0.58rem; }

    .car-label { font-size: 0.52rem; padding: 1px 4px; }

    /* Badges debajo del boton X */
    .mon-map-badges {
        display: flex;
        top: 52px; right: 8px;
        flex-direction: column;
        gap: 4px;
    }
    .mon-map-badge { font-size: 0.55rem; padding: 3px 7px; }

    /* Geocercas */
    .geo-card {
        padding: 4px 8px;
        border-radius: 7px;
        flex-shrink: 0;
    }
    .geo-card > div > div > div:first-child { font-size: 0.65rem !important; }
    .geo-card > div > div > div:last-child  { font-size: 0.55rem !important; }
    .geo-card > div > span { width: 8px !important; height: 8px !important; }
    #geo-list { gap: 4px; }
    .btn-cmd  { font-size: 0.55rem !important; padding: 3px 7px !important; }
}

/* ── MODERN VEHICLE CARDS (Image Style) ── */
.cvm-card { background: linear-gradient(145deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.9)); backdrop-filter: blur(12px); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 16px; padding: 16px; margin-bottom: 12px; display: flex; gap: 16px; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); cursor: pointer; position: relative; overflow: hidden; }
.cvm-card:hover { transform: translateY(-2px); border-color: rgba(0, 180, 240, 0.4); box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3); }
.cvm-card.active { border-color: #00b4f0; box-shadow: 0 0 20px rgba(0, 180, 240, 0.2); background: linear-gradient(145deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 1)); }
.cvm-icon-box { width: 48px; height: 48px; background: rgba(255, 255, 255, 0.05); border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cvm-icon { font-size: 1.5rem; }
.cvm-content { flex: 1; min-width: 0; }
.cvm-title { font-size: 1rem; font-weight: 700; color: #f1f5f9; margin-bottom: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cvm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
.cvm-item { display: flex; flex-direction: column; gap: 2px; }
.cvm-label { font-size: 0.65rem; font-weight: 600; color: rgba(255, 255, 255, 0.4); text-transform: uppercase; letter-spacing: 0.05em; }
.cvm-value { font-size: 0.85rem; font-weight: 700; color: #cbd5e1; }
.cvm-status-wrap { position: absolute; bottom: 12px; right: 12px; }
.cvm-badge { padding: 4px 12px; border-radius: 99px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; border: 1px solid transparent; display: flex; align-items: center; gap: 6px; }
.cvm-badge.moving { color: #4ade80; border-color: rgba(74, 222, 128, 0.3); background: rgba(74, 222, 128, 0.1); box-shadow: 0 0 12px rgba(74, 222, 128, 0.15); }
.cvm-badge.stopped { color: #f87171; border-color: rgba(248, 113, 113, 0.3); background: rgba(248, 113, 113, 0.1); box-shadow: 0 0 12px rgba(248, 113, 113, 0.15); }
.cvm-badge.idling { color: #fbbf24; border-color: rgba(251, 191, 36, 0.3); background: rgba(251, 191, 36, 0.1); box-shadow: 0 0 12px rgba(251, 191, 36, 0.15); }
.cvm-badge.offline { color: #94a3b8; border-color: rgba(148, 163, 184, 0.3); background: rgba(148, 163, 184, 0.1); }

/* ══════════════════════════════════════════════════════════════
   COMPACT VEHICLE CARDS STYLING
   ══════════════════════════════════════════════════════════════ */

.csc-card-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 4px;
}

/* ── Header (icono + nombre + dot) ───────────────────────── */
.csc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.csc-icon-box {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(148,163,184,0.10);
  border: 1px solid rgba(148,163,184,0.18);
  color: #94a3b8;
  transition: all 0.25s ease;
}
.csc-icon-box.moving {
  background: rgba(34,197,94,0.14);
  border-color: rgba(34,197,94,0.32);
  color: #4ade80;
  box-shadow: 0 0 12px -2px rgba(34,197,94,0.45);
}
.csc-icon-box.stopped {
  background: rgba(59,130,246,0.14);
  border-color: rgba(59,130,246,0.32);
  color: #60a5fa;
  box-shadow: 0 0 12px -2px rgba(59,130,246,0.35);
}
.csc-icon-box.speeding {
  background: rgba(239,68,68,0.14);
  border-color: rgba(239,68,68,0.4);
  color: #f87171;
  box-shadow: 0 0 12px -2px rgba(239,68,68,0.5);
}
.csc-icon-box.offline {
  background: rgba(148,163,184,0.08);
  border-color: rgba(148,163,184,0.18);
  color: #94a3b8;
}
html:not(.dark) .csc-icon-box.moving   { background: rgba(34,197,94,0.10); color: #16a34a; }
html:not(.dark) .csc-icon-box.stopped  { background: rgba(59,130,246,0.10); color: #2563eb; }
html:not(.dark) .csc-icon-box.speeding { background: rgba(239,68,68,0.10); color: #dc2626; }
html:not(.dark) .csc-icon-box.offline  { background: rgba(0,0,0,0.04); color: #64748b; border-color: rgba(0,0,0,0.08); }

/* Pulse ring para vehículos en movimiento */
.csc-pulse-ring {
  position: absolute;
  inset: -3px;
  border-radius: 12px;
  border: 1.5px solid currentColor;
  opacity: 0;
  pointer-events: none;
  animation: csc-pulse 1.6s ease-out infinite;
}
@keyframes csc-pulse {
  0%   { transform: scale(0.85); opacity: 0.7; }
  100% { transform: scale(1.15); opacity: 0; }
}

.csc-info {
  flex: 1;
  min-width: 0;
}
.csc-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  line-height: 1.15;
}
html:not(.dark) .csc-title { color: #0f172a; }

.csc-subtitle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
}
.csc-plate-chip {
  display: inline-block;
  padding: 2px 7px;
  background: rgba(255,255,255,0.06);
  border: 0.5px solid rgba(255,255,255,0.10);
  border-radius: 4px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.75);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
html:not(.dark) .csc-plate-chip {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.10);
  color: #334155;
}
.csc-meta {
  font-size: 0.62rem;
  color: rgba(255,255,255,0.45);
  font-weight: 500;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
}
html:not(.dark) .csc-meta { color: #64748b; }

/* Dot de estado en la esquina superior derecha */
.csc-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #94a3b8;
}
.csc-live-dot.moving  { background: #22c55e; box-shadow: 0 0 6px #22c55e; animation: csc-blink 1.4s ease-in-out infinite; }
.csc-live-dot.stopped { background: #3b82f6; box-shadow: 0 0 6px rgba(59,130,246,0.6); }
.csc-live-dot.speeding{ background: #ef4444; box-shadow: 0 0 6px #ef4444; animation: csc-blink 0.7s ease-in-out infinite; }
.csc-live-dot.offline { background: #64748b; opacity: 0.7; }
@keyframes csc-blink {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.4; }
}

/* ── Hero: velocímetro + estado ──────────────────────────── */
.csc-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(148,163,184,0.06), rgba(148,163,184,0.02));
  border: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
}
.csc-hero::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: #6b7280;
  transition: background 0.25s;
}
.csc-hero.moving::before   { background: linear-gradient(180deg, #22c55e, #16a34a); box-shadow: 0 0 8px rgba(34,197,94,0.6); }
.csc-hero.stopped::before  { background: linear-gradient(180deg, #60a5fa, #3b82f6); }
.csc-hero.speeding::before { background: linear-gradient(180deg, #ef4444, #dc2626); box-shadow: 0 0 8px rgba(239,68,68,0.6); }
.csc-hero.offline::before  { background: #475569; }

.csc-hero.moving   { background: linear-gradient(135deg, rgba(34,197,94,0.08), rgba(34,197,94,0.02)); border-color: rgba(34,197,94,0.18); }
.csc-hero.stopped  { background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(59,130,246,0.02)); border-color: rgba(59,130,246,0.18); }
.csc-hero.speeding { background: linear-gradient(135deg, rgba(239,68,68,0.08), rgba(239,68,68,0.02)); border-color: rgba(239,68,68,0.22); }

html:not(.dark) .csc-hero          { background: rgba(0,0,0,0.025); border-color: rgba(0,0,0,0.06); }
html:not(.dark) .csc-hero.moving   { background: rgba(34,197,94,0.06); border-color: rgba(34,197,94,0.18); }
html:not(.dark) .csc-hero.stopped  { background: rgba(59,130,246,0.05); border-color: rgba(59,130,246,0.18); }
html:not(.dark) .csc-hero.speeding { background: rgba(239,68,68,0.05); border-color: rgba(239,68,68,0.22); }

.csc-speed {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding-left: 6px;
}
.csc-speed-num {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #cbd5e1;
  font-variant-numeric: tabular-nums;
}
.csc-hero.moving   .csc-speed-num { color: #4ade80; text-shadow: 0 0 12px rgba(34,197,94,0.4); }
.csc-hero.stopped  .csc-speed-num { color: #60a5fa; }
.csc-hero.speeding .csc-speed-num { color: #f87171; text-shadow: 0 0 12px rgba(239,68,68,0.4); }
.csc-hero.offline  .csc-speed-num { color: #64748b; }
html:not(.dark) .csc-hero.moving   .csc-speed-num { color: #15803d; text-shadow: none; }
html:not(.dark) .csc-hero.stopped  .csc-speed-num { color: #1d4ed8; }
html:not(.dark) .csc-hero.speeding .csc-speed-num { color: #b91c1c; text-shadow: none; }
html:not(.dark) .csc-hero.offline  .csc-speed-num { color: #475569; }

.csc-speed-unit {
  font-size: 0.62rem;
  font-weight: 600;
  color: rgba(255,255,255,0.45);
  text-transform: lowercase;
  letter-spacing: 0.04em;
}
html:not(.dark) .csc-speed-unit { color: #64748b; }

.csc-hero-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.csc-status-chip {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.55rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #cbd5e1;
  background: rgba(148,163,184,0.15);
  border: 0.5px solid rgba(148,163,184,0.25);
  white-space: nowrap;
}
.csc-status-chip.moving   { color: #4ade80; background: rgba(34,197,94,0.15); border-color: rgba(34,197,94,0.35); }
.csc-status-chip.stopped  { color: #60a5fa; background: rgba(59,130,246,0.15); border-color: rgba(59,130,246,0.35); }
.csc-status-chip.speeding { color: #f87171; background: rgba(239,68,68,0.18); border-color: rgba(239,68,68,0.4); }
.csc-status-chip.offline  { color: #94a3b8; background: rgba(148,163,184,0.12); border-color: rgba(148,163,184,0.22); }
html:not(.dark) .csc-status-chip.moving   { color: #15803d; background: rgba(34,197,94,0.12); }
html:not(.dark) .csc-status-chip.stopped  { color: #1d4ed8; background: rgba(59,130,246,0.10); }
html:not(.dark) .csc-status-chip.speeding { color: #b91c1c; background: rgba(239,68,68,0.10); }
html:not(.dark) .csc-status-chip.offline  { color: #475569; background: rgba(148,163,184,0.10); }

.csc-time-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.62rem;
  color: rgba(255,255,255,0.45);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
html:not(.dark) .csc-time-row { color: #64748b; }

/* ── Footer: conexión / duración ─────────────────────────── */
.csc-foot {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 7px 4px 0;
  border-top: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 8px;
}
html:not(.dark) .csc-foot { border-top-color: rgba(0,0,0,0.06); }

.csc-foot-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.65rem;
  font-weight: 500;
  color: rgba(255,255,255,0.55);
  line-height: 1.2;
  min-height: 14px;
}
html:not(.dark) .csc-foot-line { color: #475569; }
.csc-foot-line:empty { display: none; }
.csc-foot-line > span:first-child { flex-shrink: 0; }

.csc-foot-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.csc-foot-mute { color: rgba(255,255,255,0.4); font-weight: 500; }
html:not(.dark) .csc-foot-mute { color: #94a3b8; }

/* ── Power / batería del GPS ──────────────────────────────── */
.csc-power {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 8px;
  margin-bottom: 9px;
  font-size: 0.64rem;
  font-weight: 600;
  line-height: 1.2;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.05);
}
html:not(.dark) .csc-power { background: rgba(0,0,0,0.025); border-color: rgba(0,0,0,0.06); }

.csc-power-ico {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.csc-power-lbl {
  font-weight: 700;
  letter-spacing: 0.01em;
}
.csc-power-meta {
  color: rgba(255,255,255,0.45);
  font-weight: 500;
  margin-left: 2px;
}
html:not(.dark) .csc-power-meta { color: rgba(0,0,0,0.45); }

.csc-power.on {
  background: rgba(34,197,94,0.08);
  border-color: rgba(34,197,94,0.22);
  color: #4ade80;
}
html:not(.dark) .csc-power.on { color: #15803d; background: rgba(34,197,94,0.07); border-color: rgba(34,197,94,0.22); }

.csc-power.off {
  background: rgba(239,68,68,0.10);
  border-color: rgba(239,68,68,0.32);
  color: #f87171;
  animation: csc-pwr-pulse 1.6s ease-in-out infinite;
}
html:not(.dark) .csc-power.off { color: #b91c1c; background: rgba(239,68,68,0.07); border-color: rgba(239,68,68,0.30); }
@keyframes csc-pwr-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.3); }
  50%     { box-shadow: 0 0 0 4px rgba(239,68,68,0); }
}

.csc-power.warn {
  background: rgba(245,158,11,0.10);
  border-color: rgba(245,158,11,0.32);
  color: #fbbf24;
}
html:not(.dark) .csc-power.warn { color: #b45309; background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.28); }

.csc-power.neutral {
  color: rgba(255,255,255,0.65);
}
html:not(.dark) .csc-power.neutral { color: #475569; }

/* ── Aceite ───────────────────────────────────────────────── */
.csc-oil {
  padding: 7px 9px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 9px;
}
html:not(.dark) .csc-oil { background: rgba(0,0,0,0.025); border-color: rgba(0,0,0,0.06); }

.csc-oil.good { border-color: rgba(34,197,94,0.20); }
.csc-oil.warn { border-color: rgba(245,158,11,0.28); }
.csc-oil.crit { border-color: rgba(239,68,68,0.32); background: linear-gradient(135deg, rgba(239,68,68,0.06), rgba(239,68,68,0.01)); }

.csc-oil-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}
.csc-oil-lbl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.55);
}
html:not(.dark) .csc-oil-lbl { color: #64748b; }
.csc-oil.good .csc-oil-lbl svg { color: #22c55e; }
.csc-oil.warn .csc-oil-lbl svg { color: #f59e0b; }
.csc-oil.crit .csc-oil-lbl svg { color: #ef4444; }

.csc-oil-pct {
  font-size: 0.78rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.csc-oil.good .csc-oil-pct { color: #4ade80; }
.csc-oil.warn .csc-oil-pct { color: #fbbf24; }
.csc-oil.crit .csc-oil-pct { color: #f87171; }
html:not(.dark) .csc-oil.good .csc-oil-pct { color: #15803d; }
html:not(.dark) .csc-oil.warn .csc-oil-pct { color: #b45309; }
html:not(.dark) .csc-oil.crit .csc-oil-pct { color: #b91c1c; }

.csc-oil-bar {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
html:not(.dark) .csc-oil-bar { background: rgba(0,0,0,0.07); }

.csc-oil-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}
.csc-oil.good .csc-oil-fill { background: linear-gradient(90deg, #22c55e, #4ade80); box-shadow: 0 0 6px rgba(34,197,94,0.4); }
.csc-oil.warn .csc-oil-fill { background: linear-gradient(90deg, #f59e0b, #fbbf24); box-shadow: 0 0 6px rgba(245,158,11,0.4); }
.csc-oil.crit .csc-oil-fill { background: linear-gradient(90deg, #ef4444, #f87171); box-shadow: 0 0 6px rgba(239,68,68,0.45); animation: csc-oil-blink 1.4s ease-in-out infinite; }
@keyframes csc-oil-blink {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.55; }
}

.csc-oil-meta {
  margin-top: 4px;
  font-size: 0.56rem;
  color: rgba(255,255,255,0.4);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
html:not(.dark) .csc-oil-meta { color: #94a3b8; }

/* ── Follow toggle (rediseñado) ──────────────────────────── */
.csc-follow-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
  transition: all 0.2s ease;
}
.csc-follow-wrap:hover { background: rgba(0,180,240,0.06); border-color: rgba(0,180,240,0.18); }
.csc-follow-wrap.active {
  background: rgba(0,180,240,0.08);
  border-color: rgba(0,180,240,0.3);
}
html:not(.dark) .csc-follow-wrap { background: rgba(0,0,0,0.025); border-color: rgba(0,0,0,0.06); }
html:not(.dark) .csc-follow-wrap.active { background: rgba(0,180,240,0.08); border-color: rgba(0,180,240,0.35); }

.csc-follow-lbl {
  font-size: 0.66rem;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.01em;
}
.csc-follow-wrap.active .csc-follow-lbl { color: #60a5fa; }
html:not(.dark) .csc-follow-lbl { color: #64748b; }
html:not(.dark) .csc-follow-wrap.active .csc-follow-lbl { color: #2563eb; }

.csc-follow-track {
  width: 34px;
  height: 18px;
  background: rgba(0,0,0,0.35);
  border-radius: 10px;
  padding: 2px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 0.5px solid rgba(255,255,255,0.05);
}
.csc-follow-wrap.active .csc-follow-track {
  background: #00b4f0;
  border-color: #00b4f0;
  box-shadow: 0 0 8px rgba(0,180,240,0.4);
}
html:not(.dark) .csc-follow-track { background: rgba(0,0,0,0.12); border-color: rgba(0,0,0,0.10); }
html:not(.dark) .csc-follow-wrap.active .csc-follow-track { background: #00b4f0; border-color: #00b4f0; }

.csc-follow-thumb {
  width: 14px;
  height: 14px;
  background: rgba(255,255,255,0.55);
  border-radius: 50%;
  transition: all 0.25s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.csc-follow-wrap.active .csc-follow-thumb {
  background: #fff;
  transform: translateX(15px);
  box-shadow: 0 0 6px rgba(255,255,255,0.6);
}
html:not(.dark) .csc-follow-thumb { background: #fff; }

/* Responsive: en móvil, una columna */
@media (max-width: 600px) {
  .csc-card-container {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════════════
   Selector de vehículos custom (rutas / comandos / geocercas)
   ═══════════════════════════════════════════════════════════ */
.ac-vsel {
  position: relative;
  width: 100%;
}
.ac-vsel-native {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.ac-vsel-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  color: #f1f5f9;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}
.ac-vsel-trigger:hover {
  background: rgba(0,180,240,0.07);
  border-color: rgba(0,180,240,0.30);
}
.ac-vsel-trigger.open,
.ac-vsel-trigger:focus-visible {
  background: rgba(0,180,240,0.10);
  border-color: rgba(0,180,240,0.45);
  box-shadow: 0 0 0 3px rgba(0,180,240,0.10);
}
html:not(.dark) .ac-vsel-trigger {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.10);
  color: #0f172a;
}
html:not(.dark) .ac-vsel-trigger:hover,
html:not(.dark) .ac-vsel-trigger.open { background: rgba(0,180,240,0.08); border-color: rgba(0,180,240,0.40); }

.ac-vsel-trigger-display {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.ac-vsel-placeholder {
  color: rgba(255,255,255,0.45);
  font-weight: 500;
}
html:not(.dark) .ac-vsel-placeholder { color: #94a3b8; }

.ac-vsel-trigger-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(0,180,240,0.15);
  color: #60a5fa;
  flex-shrink: 0;
}
html:not(.dark) .ac-vsel-trigger-ico { background: rgba(0,180,240,0.12); color: #2563eb; }

.ac-vsel-trigger-name {
  font-weight: 700;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex-shrink: 1;
}
.ac-vsel-trigger-plate {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.08);
  border: 0.5px solid rgba(255,255,255,0.12);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  color: rgba(255,255,255,0.85);
  flex-shrink: 0;
}
html:not(.dark) .ac-vsel-trigger-plate {
  background: rgba(0,0,0,0.06);
  border-color: rgba(0,0,0,0.10);
  color: #334155;
}

.ac-vsel-chevron {
  flex-shrink: 0;
  color: rgba(255,255,255,0.55);
  transition: transform 0.25s ease;
}
.ac-vsel-trigger.open .ac-vsel-chevron { transform: rotate(180deg); color: #60a5fa; }
html:not(.dark) .ac-vsel-chevron { color: #64748b; }

/* Panel desplegable */
.ac-vsel-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(15,23,42,0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0,180,240,0.30);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
  overflow: hidden;
  animation: ac-vsel-fade 0.15s ease-out;
}
@keyframes ac-vsel-fade {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
html:not(.dark) .ac-vsel-panel {
  background: rgba(255,255,255,0.98);
  border-color: rgba(0,180,240,0.35);
  box-shadow: 0 12px 32px rgba(15,23,42,0.18);
}

.ac-vsel-search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.55);
}
html:not(.dark) .ac-vsel-search {
  border-bottom-color: rgba(0,0,0,0.06);
  color: #64748b;
}
.ac-vsel-search-input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: #f1f5f9;
  font-size: 0.74rem;
  font-family: inherit;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.ac-vsel-search-input::placeholder { color: rgba(255,255,255,0.30); }
html:not(.dark) .ac-vsel-search-input { color: #0f172a; }
html:not(.dark) .ac-vsel-search-input::placeholder { color: #94a3b8; }

.ac-vsel-options {
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,180,240,0.3) transparent;
}
.ac-vsel-options::-webkit-scrollbar { width: 6px; }
.ac-vsel-options::-webkit-scrollbar-thumb { background: rgba(0,180,240,0.3); border-radius: 3px; }

.ac-vsel-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 7px;
  background: transparent;
  border: 0;
  color: #f1f5f9;
  font-family: inherit;
  font-size: 0.72rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}
.ac-vsel-option + .ac-vsel-option { margin-top: 2px; }
.ac-vsel-option:hover { background: rgba(0,180,240,0.10); }
.ac-vsel-option.selected { background: rgba(0,180,240,0.16); }
html:not(.dark) .ac-vsel-option { color: #0f172a; }
html:not(.dark) .ac-vsel-option:hover { background: rgba(0,180,240,0.08); }
html:not(.dark) .ac-vsel-option.selected { background: rgba(0,180,240,0.12); }

.ac-vsel-option-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(0,180,240,0.12);
  color: #60a5fa;
  flex-shrink: 0;
}
.ac-vsel-option.selected .ac-vsel-option-icon { background: rgba(0,180,240,0.22); color: #93c5fd; }
html:not(.dark) .ac-vsel-option-icon { background: rgba(0,180,240,0.10); color: #2563eb; }

.ac-vsel-option-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ac-vsel-option-name {
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ac-vsel-option-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.62rem;
  color: rgba(255,255,255,0.55);
  font-weight: 500;
  letter-spacing: 0.02em;
}
html:not(.dark) .ac-vsel-option-meta { color: #64748b; }

.ac-vsel-option-plate {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255,255,255,0.08);
  border: 0.5px solid rgba(255,255,255,0.12);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  color: rgba(255,255,255,0.82);
}
html:not(.dark) .ac-vsel-option-plate {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.10);
  color: #334155;
}

.ac-vsel-dot { opacity: 0.5; }

.ac-vsel-option-check {
  flex-shrink: 0;
  color: #22c55e;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.ac-vsel-option.selected .ac-vsel-option-check { opacity: 1; }

.ac-vsel-empty {
  text-align: center;
  padding: 14px 10px;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.4);
  font-weight: 500;
}
html:not(.dark) .ac-vsel-empty { color: #94a3b8; }
