/* ═══════════════════════════════════════════════════════════
   GeoNex GPS Portal — Midnight Premium v5
   ═══════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* ─── BASE TOKENS + THEME — Neon Tech ─────────────────────── */
:root {
    --sidebar-w: 260px;
    --sidebar-w-collapsed: 72px;
    --content-offset-left: 260px;
    --topbar-h: 60px;
    --footer-h: 48px;
    color-scheme: dark;
    --bg-dark: #151718;
    --bg-sidebar: rgba(18, 22, 24, 0.92);
    --bg-main: #0f1214;
    --bg-card: rgba(22, 28, 32, 0.92);
    --bg-card-hover: rgba(32, 42, 48, 0.94);
    --bg-hover: rgba(74, 222, 128, 0.08);
    --accent: #4ade80;
    --accent-hover: #86efac;
    --accent-glow: rgba(74, 222, 128, 0.2);
    --accent-gradient: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    --danger: #ff4757;
    --warning: #ffa502;
    --info: #38bdf8;
    --online: #4ade80;
    --offline: #747d8c;
    --text: #f4f5f9;
    --text-muted: #b0bcc8;
    --border: rgba(200, 220, 230, 0.1);
    --border-subtle: rgba(200, 220, 230, 0.04);
    --shadow: 0 10px 40px -10px rgba(0,0,0,0.35), 0 0 80px -20px rgba(255,255,255,0.03);
    --shadow-sm: 0 4px 16px rgba(0,0,0,0.22), 0 0 30px -10px rgba(255,255,255,0.02);
    --shadow-lg: 0 24px 60px -12px rgba(0,0,0,0.4), 0 0 100px -20px rgba(74,222,128,0.08);
    --input-bg: rgba(10, 18, 10, 0.85);
    --input-text: #fafafa;
    --table-stripe: rgba(255,255,255,0.015);
    --scrollbar-thumb: rgba(200,220,230,0.12);
    --scrollbar-hover: rgba(200,220,230,0.22);
    --overlay-bg: rgba(0,0,0,0.55);
    --brand-text: #fff;
    --nav-hover-bg: rgba(255,255,255,0.06);
    --nav-active-bg: rgba(74,222,128,0.14);
    --nav-active-border: #4ade80;
    --marker-shadow: rgba(0,0,0,0.3);
    --leaflet-ctrl-bg: rgba(20,24,28,0.5);
    --leaflet-ctrl-text: #fafafa;
    --glass: rgba(20, 26, 30, 0.88);
    --glass-border: rgba(200,220,230,0.12);
    --glass-blur: blur(28px) saturate(200%);
    --sidebar-gradient: linear-gradient(180deg, rgba(16,20,24,0.95) 0%, rgba(12,16,18,0.96) 100%);
    --topbar-gradient: rgba(16,20,24,0.92);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --header-card-bg: radial-gradient(circle at left top, rgba(74,222,128,0.1), transparent 30%), rgba(28,34,38,0.34);
    --header-card-border: rgba(200,220,230,0.12);
    --header-card-shadow: 0 18px 44px rgba(0,0,0,0.22), 0 0 60px -15px rgba(255,255,255,0.03);
    --header-kicker: #4ade80;
    --services-card-bg: radial-gradient(circle at top right, rgba(74,222,128,0.1), transparent 36%), rgba(28,34,38,0.34);
    --services-card-border: rgba(200,220,230,0.12);
    --services-card-shadow: 0 18px 40px rgba(0,0,0,0.22), 0 0 50px -15px rgba(255,255,255,0.03);
    --services-meta-bg: rgba(255,255,255,0.04);
    --services-meta-border: rgba(200,220,230,0.1);
    --services-meta-text: #a4b0be;
    --services-empty-bg: rgba(28,34,38,0.34);
    --services-card-hover-border: rgba(74,222,128,0.35);
    --panel-bg: rgba(24,30,34,0.32);
    --panel-bg-gradient: linear-gradient(180deg, rgba(28,34,38,0.36), rgba(16,20,24,0.42));
    --panel-border: rgba(200,220,230,0.1);
    --panel-shadow: 0 18px 40px rgba(0,0,0,0.22), 0 0 40px -10px rgba(255,255,255,0.03);
    --sub-bg: rgba(255,255,255,0.03);
    --sub-bg-hover: rgba(255,255,255,0.06);
    --sub-border: rgba(200,220,230,0.1);
    --sub-text: #a4b0be;
    --sub-text-dim: rgba(255,255,255,0.5);
    --sub-text-medium: rgba(255,255,255,0.78);
    --input-field-bg: rgba(16,20,24,0.35);
    --input-field-border: rgba(200,220,230,0.1);
    --modal-header-bg: rgba(20,24,28,0.5);
    --modal-footer-bg: rgba(16,20,24,0.5);
    --modal-form-bg: rgba(16,20,24,0.42);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Indicadores de frescura */
.time-fresh { color: var(--online); font-weight: 600; }
.time-recent { color: #fbbf24; }
.time-delayed { color: #f97316; }
.time-stale { color: var(--danger); font-weight: 600; }

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
    color: var(--text);
    display: flex;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
}

/* ─── PREMIUM MESH GRADIENT & GPS GRID BACKGROUNDS ─── */
body {
    background:
        radial-gradient(ellipse 1400px 900px at 15% 10%, rgba(74, 222, 128, 0.1), transparent 55%),
        radial-gradient(ellipse 1000px 600px at 85% 90%, rgba(120, 180, 255, 0.06), transparent 55%),
        radial-gradient(ellipse 800px 500px at 50% 50%, rgba(255, 255, 255, 0.04), transparent 60%),
        linear-gradient(rgba(200,220,230,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(200,220,230,0.03) 1px, transparent 1px),
        var(--bg-main);
    background-size: 100% 100%, 100% 100%, 100% 100%, 40px 40px, 40px 40px, auto;
    background-attachment: fixed;
}

.text-muted {
    color: var(--text-muted) !important;
}

*, *::before, *::after {
    box-sizing: border-box;
}

/* ─── GLASSMORPHISM — universal frosted glass for all surfaces ─── */
.bento-card,
.card-dark,
.services-card,
.enterprise-card,
.trip-card,
.stop-card,
.detail-card,
.vehicle-panel,
.history-kpi,
.history-tab-bar,
.alerts-kpi-mini,
.alerts-kpi-card,
.clavijero-summary,
.clavijero-calendar-card,
.clavijero-detail-card,
.clavijero-route-card,
.vt-wrap,
.wt-wrap,
.vehicles-toolbar,
.vehicles-header,
.clavijero-actions-bar,
.services-empty,
.page-content.has-max .table-responsive,
.vehicle-modal-section,
.geo-kpi-chip {
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

/* Glass shimmer highlight on all major cards */
.bento-card::before,
.services-card::before,
.enterprise-card::before,
.card-dark::before,
.trip-card::before,
.detail-card::before,
.clavijero-summary::before,
.clavijero-calendar-card::before,
.clavijero-detail-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), rgba(74,222,128,0.08), rgba(255,255,255,0.1), transparent);
    z-index: 1;
    pointer-events: none;
    display: block !important;
}

/* Glass borders with subtle green tint */
.bento-card,
.services-card,
.enterprise-card,
.card-dark,
.trip-card,
.detail-card,
.vt-wrap,
.wt-wrap,
.clavijero-summary,
.clavijero-calendar-card,
.clavijero-detail-card,
.clavijero-route-card {
    border-color: var(--glass-border) !important;
}

/* glass inner glow on hover */
.bento-card:hover,
.services-card:hover,
.enterprise-card:hover,
.card-dark:hover,
.trip-card:hover {
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.08), 0 0 40px -10px rgba(74,222,128,0.06);
}

[data-page] {
    max-width: 100%;
    overflow-x: hidden;
}

/* ─── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    height: 100vh;
    background: var(--sidebar-gradient);
    backdrop-filter: blur(28px) saturate(160%);
    -webkit-backdrop-filter: blur(28px) saturate(160%);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    transition: all var(--transition-normal);
    z-index: 1000;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(180deg, rgba(74,222,128,0.2), transparent 30%, transparent 70%, rgba(74,222,128,0.1));
    z-index: 2;
    pointer-events: none;
}
.sidebar.collapsed {
    width: var(--sidebar-w-collapsed);
    min-width: var(--sidebar-w-collapsed);
}
.sidebar.collapsed .brand-text-wrap,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .user-name,
.sidebar.collapsed .user-role,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .brand-sub { display: none; }
.sidebar.collapsed .nav-link { justify-content: center; padding: 12px 0; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 16px; }
.sidebar.collapsed .sidebar-footer { justify-content: center; gap: 0; }
.sidebar.collapsed .user-info { display: none; }
.sidebar.collapsed .user-avatar { margin: 0 auto; }

/* ─── SIDEBAR BRAND ── */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    position: relative;
    z-index: 1;
}
.brand-logo-wrap {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(74,222,128,0.2), rgba(34,197,94,0.2));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2), inset 0 0 0 1px rgba(255,255,255,0.05);
}
.brand-logo-icon {
    font-size: 20px;
    color: #fff;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}
.brand-logo-icon {
    font-size: 18px;
    color: #fff;
}
.brand-text-wrap {
    display: flex;
    flex-direction: column;
}
.brand-text {
    font-size: 20px;
    font-weight: 800;
    color: var(--brand-text);
    letter-spacing: -0.04em;
    line-height: 1.1;
}
.text-accent { color: var(--accent); }
.text-purple { color: #22c55e; }
.text-teal   { color: #14b8a6; }
.text-pink   { color: #ec4899; }
.btn-outline-accent { color: var(--accent); border-color: var(--accent); background: transparent; }
.btn-outline-accent:hover { background: rgba(0,255,136,0.1); color: var(--accent); border-color: var(--accent); }

/* ─── PROPUESTAS — TEMA COMPLETO ──────────────────────────── */
/* ─── CRM SHARED — Proposals, Contracts, WhatsApp ──────────── */
.crm-page {
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.crm-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 28px;
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
    position: relative;
}
.crm-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
}
.crm-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 16px;
    flex-shrink: 0;
}
.crm-header h3 {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0;
}
.crm-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 28px;
    border-bottom: 1px solid var(--glass-border);
    background: transparent;
    flex-shrink: 0;
}
.crm-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}
.crm-tab:hover {
    color: var(--text);
    background: var(--sub-bg);
}
.crm-tab.active {
    color: var(--accent);
    background: var(--sub-bg);
    border-color: var(--glass-border);
}
.crm-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}
.crm-steps {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-width: 720px;
    margin: 0 auto;
}
.crm-step {
    position: relative;
    padding-left: 48px;
    padding-bottom: 20px;
}
.crm-step:last-child { padding-bottom: 0; }
.crm-step::before {
    content: attr(data-step);
    position: absolute;
    left: 0;
    top: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-glow);
    color: var(--accent);
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(74,222,128,0.25);
    z-index: 1;
}
.crm-step:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 15px;
    top: 32px;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, rgba(74,222,128,0.2), transparent);
}
.crm-step .prop-card { margin-bottom: 0; }
.crm-step-action {
    max-width: 720px;
    margin: 20px auto 0;
    padding-left: 48px;
}

/* ── Prop Cards (glass) ── */
.prop-card {
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
    transition: border-color 0.15s ease;
}
.prop-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    pointer-events: none;
}
.prop-card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
}
.prop-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}
.prop-input {
    width: 100%;
    background: var(--input-field-bg);
    color: var(--input-text);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 9px 14px;
    font-size: 13px;
    outline: none;
    transition: all var(--transition-fast);
    font-family: inherit;
    resize: vertical;
}
.prop-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.prop-input::placeholder { color: var(--text-muted); opacity: 0.6; }
.prop-input-sm { padding: 5px 10px; font-size: 12px; }
.prop-radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.prop-radio-item label {
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    margin: 0;
}
.prop-radio { accent-color: var(--accent); cursor: pointer; }
.prop-check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    transition: background 0.1s ease;
}
.prop-check-item:hover {
    background: var(--sub-bg);
}
.prop-check-item label {
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    margin: 0;
    line-height: 1.4;
}
.prop-check-item.small label { font-size: 12px; }
.prop-check { accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.prop-subreports {
    border-left: 2px solid var(--glass-border);
    padding-left: 14px;
}
.prop-subreports-title {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}
.prop-price-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.prop-price-table thead th {
    background: var(--sub-bg);
    color: var(--text-muted);
    border-bottom: 1px solid var(--glass-border);
    padding: 8px 10px;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.prop-price-table tbody td {
    color: var(--text);
    border-bottom: 1px solid var(--border-subtle);
    padding: 6px 4px;
    vertical-align: middle;
}
.prop-price-table tbody tr:hover td {
    background: var(--sub-bg);
}
.prop-total-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.prop-btn-secondary {
    background: var(--sub-bg);
    color: var(--text);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.prop-btn-secondary:hover {
    background: var(--sub-bg-hover);
    border-color: var(--accent);
    color: var(--accent);
}

/* ── WhatsApp card title override ── */
#page-whatsapp .prop-card-title { color: #25D366; }
#page-whatsapp .prop-input:focus { border-color: #25D366; box-shadow: 0 0 0 3px rgba(37,211,102,0.15); }

/* ── CRM header extras ── */
.crm-header-sub {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}
.crm-header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* ── CRM filter bar ── */
.crm-filter-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 10px 24px;
    border-bottom: 1px solid var(--glass-border);
    background: transparent;
    flex-shrink: 0;
}
.crm-search-wrap {
    flex: 1;
    min-width: 180px;
    position: relative;
}
.crm-search-wrap i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 12px;
    pointer-events: none;
}
.crm-search-wrap input {
    width: 100%;
    background: var(--input-field-bg);
    color: var(--input-text);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 8px 12px 8px 32px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
}
.crm-search-wrap input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.crm-search-wrap input::placeholder { color: var(--text-muted); opacity: 0.6; }
.crm-select {
    background: var(--input-field-bg);
    color: var(--input-text);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
    min-width: 150px;
    cursor: pointer;
    transition: border-color 0.15s;
}
.crm-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ── CRM table skin ── */
.crm-body .geonex-table thead th {
    background: var(--sub-bg);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 2;
}
.crm-body .geonex-table tbody tr {
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.12s;
}
.crm-body .geonex-table tbody tr:hover {
    background: var(--sub-bg);
}

/* ── CRM responsive ── */
@media (max-width: 992px) {
    .crm-body { padding: 14px; }
    .crm-header { padding: 14px 16px; }
    .crm-tabs { padding: 10px 16px; }
    .crm-step { padding-left: 40px; }
    .crm-step-action { padding-left: 40px; }
    .crm-filter-bar { padding: 10px 16px; flex-wrap: wrap; }
    .crm-header-actions { justify-content: flex-end; width: 100%; }
}
.brand-sub {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
    margin-top: 2px;
}

/* ─── SIDEBAR SECTION LABEL ── */
.sidebar-section-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 24px 16px 8px;
    position: relative;
    z-index: 1;
}

.sidebar-nav {
    padding: 0 10px;
    overflow-y: auto;
    position: relative;
    z-index: 1;
}
.sidebar-nav:not(.sidebar-nav-system) {
    flex: 1;
}
.sidebar-nav-system {
    padding-bottom: 8px;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    margin: 4px 16px;
    position: relative;
    width: auto;
}
.nav-icon-wrap {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    flex-shrink: 0;
}
.nav-link:hover {
    color: var(--text);
    background: rgba(74,222,128,0.06);
    transform: translateX(2px);
}
.nav-link:hover .nav-icon-wrap {
    color: var(--accent);
}
.nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(74,222,128,0.25), rgba(34,197,94,0.15));
    box-shadow: 0 4px 16px rgba(0,0,0,0.2), inset 0 0 0 1px rgba(255,255,255,0.08);
    font-weight: 600;
}
.nav-link.active .nav-icon-wrap {
    color: #fff;
}
.nav-link.active::before {
    display: none;
}
.nav-link i { transition: color var(--transition-fast); }

/* ─── SIDEBAR ROUTES LIST ── */
.sidebar-routes-wrap {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 0;
    overflow: hidden;
}
.sidebar-routes-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--sub-bg, rgba(0,0,0,0.03));
    border: 1px solid var(--border);
}
.sidebar-routes-search i {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.sidebar-routes-search input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.78rem;
    color: var(--text);
    font-family: inherit;
}
.sidebar-routes-search input::placeholder {
    color: var(--text-muted);
}
.sidebar-routes-filters {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0 14px 8px;
}
.sidebar-routes-tag-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--sub-bg, rgba(0,0,0,0.03));
    border: 1px solid var(--border);
}
.sidebar-routes-tag-filter i {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.sidebar-routes-tag-filter select {
    flex: 1;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: none;
    font-size: 0.78rem;
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
    outline: none;
}
.sidebar-routes-tag-filter select option {
    background: var(--card-bg);
    color: var(--text);
}
.sidebar-routes-list {
    overflow-y: auto;
    flex: 1 1 0;
    padding: 0 8px 12px;
}
.sr-group {
    margin-bottom: 6px;
}
.sr-group-head {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: sticky;
    top: 0;
    background: var(--sidebar-bg, var(--bg));
    z-index: 2;
}
.sr-group-head i {
    font-size: 0.68rem;
}
.sr-group-head.sr-group-noruta {
    color: var(--text-muted);
}
.sr-group-count {
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 8px;
    line-height: 1.4;
}
.sr-group-noruta .sr-group-count {
    background: var(--text-muted);
}
.sr-vehicle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.sr-vehicle:hover {
    background: var(--sub-bg-hover, rgba(0,0,0,0.04));
}
.sr-vehicle.sr-selected {
    background: rgba(74,222,128,0.10);
}
.sr-vehicle-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.sr-vehicle-dot.online {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34,197,94,0.5);
}
.sr-vehicle-dot.offline {
    background: #94a3b8;
}
.sr-vehicle-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.sr-vehicle-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sr-vehicle-plate {
    font-size: 0.66rem;
    color: var(--text-muted);
}
.sr-vehicle-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    flex-shrink: 0;
}
.sr-speed {
    font-size: 0.66rem;
    font-weight: 600;
    color: var(--text);
}
.sr-ago {
    font-size: 0.6rem;
    color: var(--text-muted);
}
.sr-ago.time-recent { color: #22c55e; }
.sr-ago.time-moderate { color: #f59e0b; }
.sr-ago.time-old { color: #ef4444; }
.sr-empty {
    text-align: center;
    padding: 24px 12px;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.sidebar.collapsed .sidebar-routes-wrap {
    display: none;
}

.sidebar-footer {
    display: none; /* Usuario movido al header */
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-top: 1px solid var(--border);
    position: relative;
    z-index: 1;
    background: rgba(0,0,0,0.1);
}
.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4ade80, #86efac);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(74,222,128,0.3);
    border: 2px solid rgba(255,255,255,0.1);
}
.user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.user-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}
.user-role {
    font-size: 11px;
    color: var(--text-muted);
}
.logout-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    font-size: 14px;
}
.logout-btn:hover { color: var(--danger); background: rgba(255,107,107,0.1); }

/* ─── MAIN CONTENT ────────────────────────────────────────── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    background: transparent !important;
}

/* ─── TOPBAR / HEADER ─────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    min-height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px 0 20px;
    background: var(--glass);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
}
.topbar::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(74,222,128,0.2), transparent);
    z-index: 2;
}
.topbar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}
.topbar-toggle:hover { background: var(--nav-hover-bg); }
.topbar-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.topbar-title {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: -0.02em;
    line-height: 1;
}
.topbar-breadcrumb {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
}
.topbar-breadcrumb:empty {
    display: none;
}
.topbar-breadcrumb i {
    color: var(--accent);
    font-size: 9px;
    margin-right: 3px;
}
.topbar-stats {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    min-width: 0;
    flex-shrink: 0;
}
.stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: var(--shadow-sm);
}
.stat-badge:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.15); border-color: var(--glass-border); }
.stat-badge.online { color: var(--online); }
.stat-badge.offline { color: var(--offline); }
.stat-badge.total { color: var(--text-muted); }
/* Usuario en header (patrón estándar: user en topbar) */
.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    margin: 0 4px;
    flex-shrink: 0;
}
.topbar-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4ade80, #86efac);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(74,222,128,0.3);
    border: 2px solid rgba(255,255,255,0.1);
}
.topbar-user-info {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}
.topbar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-user-role {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: capitalize;
}
.topbar-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* Topbar right group */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Usuario compacto en topbar (solo avatar) */
.topbar-user-compact {
    position: relative;
    cursor: default;
    flex-shrink: 0;
}
.topbar-user-name-hidden,
.topbar-user-role-hidden { display: none; }

/* Usuario en header (patrón estándar) */
.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px 0 8px;
    border-left: 1px solid var(--border);
    margin-left: 4px;
}
.topbar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--accent-gradient);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.topbar-user-info {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}
.topbar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-user-role {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: capitalize;
}

/* Live indicator */
.topbar-live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 700;
    color: var(--online);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 4px 10px;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.15);
    border-radius: 20px;
}
.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--online);
    animation: livePulse 1.5s ease-in-out infinite;
}
@keyframes livePulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(0,212,170,0.4); }
    50% { opacity: 0.6; box-shadow: 0 0 0 5px rgba(0,212,170,0); }
}
.theme-toggle {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    transition: all var(--transition-fast);
}
.theme-toggle:hover { color: var(--text); background: var(--bg-card-hover); }

.connection-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--offline);
    display: inline-block;
    transition: all 0.3s;
    flex-shrink: 0;
}
.connection-dot.connected {
    background: var(--online);
    box-shadow: 0 0 0 3px rgba(52,211,153,0.15);
}
.topbar-actions-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
    flex-shrink: 0;
}
.topbar-logout-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: var(--shadow-sm);
}
.topbar-logout-btn:hover {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.15);
}

/* ─── FOOTER ──────────────────────────────────────────────── */
.app-footer {
    height: var(--footer-h);
    min-height: var(--footer-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: var(--glass);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-top: 1px solid var(--glass-border);
    font-size: 13px;
    font-weight: 500;
    flex-shrink: 0;
    position: relative;
    z-index: 5;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
}
.app-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(74,222,128,0.15), transparent);
    z-index: 2;
}
.footer-left, .footer-center, .footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    z-index: 1;
    font-size: 12px;
}
.footer-left {
    font-weight: 500;
    letter-spacing: 0;
}
.footer-icon {
    color: var(--accent);
    font-size: 12px;
}
.footer-version {
    padding: 2px 10px;
    background: var(--accent-glow);
    color: var(--accent);
    border: 1px solid rgba(74,222,128,0.15);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.footer-right {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-muted);
}

/* ─── PAGES ───────────────────────────────────────────────── */
.page { display: none; flex: 1; overflow: hidden; min-width: 0; }
.page.active { display: flex; flex-direction: column; }
.page-content {
    flex: 1;
    padding: 24px 28px;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
    max-width: 100%;
}
/* Contenedor con ancho máximo para páginas de listados/tablas */
.page-content.has-max { max-width: 1320px; margin: 0 auto; width: 100%; }
/* Tablas en páginas con max-width: card */
.page-content.has-max .table-responsive {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.page-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding: 24px 32px;
    background: var(--glass);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
    gap: 12px;
    position: relative;
    overflow: hidden;
}
.page-header-bar h3 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: 10px;
}
.page-header-bar h3 i {
    color: var(--accent);
    font-size: 18px;
}

#page-service-detail,
#page-service-detail .page-content,
#page-service-detail .page-content.has-max {
    background:
        radial-gradient(ellipse 900px 520px at 12% 18%, rgba(74,222,128,0.08), transparent 55%),
        radial-gradient(ellipse 760px 420px at 86% 76%, rgba(14,165,233,0.06), transparent 58%),
        linear-gradient(180deg, #0b0d13 0%, #0a0c12 100%);
}
#page-service-detail .page-header-bar {
    background: linear-gradient(180deg, rgba(18,22,32,0.9), rgba(14,18,28,0.86));
    border-color: rgba(255,255,255,0.08);
    box-shadow: 0 14px 34px rgba(0,0,0,0.18);
}
.service-detail-hero {
    align-items: flex-start;
    gap: 18px;
}
.service-detail-hero-copy {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    max-width: 860px;
}
.service-detail-kicker {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #86efac;
}
.service-detail-subtitle {
    margin: 0;
    max-width: 66ch;
    color: var(--text-muted);
    line-height: 1.6;
}
.service-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.service-detail-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    color: #dbe6f3;
    font-size: 0.8rem;
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
.service-detail-meta-chip i {
    color: var(--accent);
}
.service-detail-meta-chip.is-inactive {
    color: #cbd5e1;
    background: rgba(148,163,184,0.14);
    border-color: rgba(148,163,184,0.2);
}
.service-detail-meta-chip.is-inactive i {
    color: #cbd5e1;
}
.service-detail-hero-actions {
    margin-left: auto;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}
#serviceDetailTabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px !important;
    padding: 8px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    background: rgba(10,15,24,0.72);
    box-shadow: 0 14px 28px rgba(0,0,0,0.16);
}
#serviceDetailTabs .nav-link {
    color: #94a3b8;
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 14px;
    background: transparent;
    min-height: 44px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}
#serviceDetailTabs .nav-link:hover {
    color: #f8fafc;
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.06);
}
#serviceDetailTabs .nav-link.active {
    color: #f8fafc;
    background: linear-gradient(180deg, rgba(20,24,34,0.96), rgba(16,18,27,0.92));
    border-color: rgba(74,222,128,0.22);
    box-shadow: 0 10px 22px rgba(0,0,0,0.16), inset 0 0 0 1px rgba(74,222,128,0.08);
}
#page-service-detail .btn-outline-light {
    color: #cbd5e1;
    border-color: rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.03);
}
#page-service-detail .btn-outline-light:hover {
    color: #f8fafc;
    border-color: rgba(96,165,250,0.24);
    background: rgba(74,222,128,0.08);
}

.vehicles-toolbar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 22px;
    padding: 18px 20px;
    background: var(--header-card-bg);
    border: 1px solid var(--header-card-border);
    border-radius: var(--radius-md);
    box-shadow: var(--header-card-shadow);
}
.vehicles-header {
    position: relative;
    overflow: hidden;
    align-items: stretch;
    padding: 22px 24px;
    background: var(--header-card-bg);
    border: 1px solid var(--header-card-border);
    border-radius: var(--radius-md);
    box-shadow: var(--header-card-shadow);
}
.vehicles-header-copy {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 760px;
}
.vehicles-header-kicker {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--header-kicker);
    font-weight: 800;
}
.vehicles-header-subtitle {
    margin: 0;
    color: var(--text-muted);
    max-width: 62ch;
    line-height: 1.55;
}
.vehicles-header-actions {
    display: flex;
    align-items: flex-start;
}
.vehicles-add-btn {
    min-height: 44px;
    padding-inline: 18px;
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(22,163,74,0.24);
}
.vehicles-toolbar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.vehicles-toolbar-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
}
.vehicles-toolbar-subtitle {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-muted);
}
.vehicles-toolbar-main {
    display: grid;
    grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(170px, 1fr)) auto;
    gap: 12px;
    align-items: center;
}
.vehicles-search {
    position: relative;
}
.vehicles-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}
.vehicles-search .form-control,
.vehicles-toolbar .form-select {
    background: var(--input-field-bg);
    border: 1px solid var(--sub-border);
    color: var(--text);
    min-height: 48px;
    border-radius: 14px;
    font-weight: 600;
}
.vehicles-search .form-control {
    padding-left: 40px;
}
.vehicles-search .form-control:focus,
.vehicles-toolbar .form-select:focus {
    background: var(--sub-bg-hover);
    color: var(--text);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.vehicles-toolbar-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.vehicle-summary-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 16px;
    border: 1px solid var(--sub-border);
    background: var(--sub-bg);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    box-shadow: inset 0 1px 0 var(--sub-border);
}
.vehicle-summary-chip strong {
    color: var(--text);
    font-size: 15px;
}

.services-header {
    margin-bottom: 24px;
}
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}
.services-card {
    border: 1px solid var(--services-card-border);
    border-radius: 18px;
    padding: 18px 18px 16px;
    text-align: left;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
    background: var(--services-card-bg);
    box-shadow: var(--services-card-shadow);
    color: var(--text);
}
.services-card:hover {
    transform: translateY(-2px);
    border-color: var(--services-card-hover-border);
    box-shadow: var(--shadow-lg);
}
.services-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.services-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-glow);
    color: var(--accent);
}
.services-card-status {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 11px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    border: 1px solid transparent;
}
.services-card-status.is-active {
    background: rgba(16,185,129,0.14);
    color: var(--online);
    border-color: rgba(16,185,129,0.2);
}
.services-card-status.is-inactive {
    background: rgba(148,163,184,0.12);
    color: var(--offline);
    border-color: rgba(148,163,184,0.16);
}
.services-card-title {
    font-size: 1.03rem;
    font-weight: 800;
    line-height: 1.25;
    color: var(--text);
}
.services-card-client {
    margin-top: 6px;
    font-size: 0.88rem;
    color: var(--text-muted);
}
.services-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}
.services-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--services-meta-bg);
    border: 1px solid var(--services-meta-border);
    color: var(--services-meta-text);
    font-size: 0.76rem;
    font-weight: 700;
}
.services-meta-chip i {
    color: var(--accent);
}
.services-empty {
    background: var(--services-empty-bg);
    border: 1px solid var(--services-card-border);
    border-radius: 18px;
    box-shadow: var(--services-card-shadow);
}

.service-routes-shell {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.service-routes-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
    border: 1px solid var(--sub-border);
    border-radius: 22px;
    background:
        radial-gradient(circle at top right, rgba(14,165,233,0.14), transparent 32%),
        radial-gradient(circle at left center, rgba(74,222,128,0.08), transparent 36%),
        var(--panel-bg-gradient);
    box-shadow: 0 20px 40px rgba(2,6,23,0.2);
}
.service-routes-toolbar-copy {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}
.service-routes-toolbar-kicker {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #7dd3fc;
    font-weight: 800;
}
.service-routes-toolbar-title {
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 800;
}
.service-routes-toolbar-text {
    color: var(--text-muted);
    font-size: 0.88rem;
    max-width: 72ch;
    line-height: 1.55;
}
.service-routes-toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}
.service-routes-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
}
.service-routes-overview-card {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 84px;
    padding: 16px 18px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(19,24,35,0.92), rgba(13,18,28,0.86));
    box-shadow: 0 16px 30px rgba(2,6,23,0.16);
}
.service-routes-overview-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(74,222,128,0.12);
    color: var(--accent);
    font-size: 1rem;
    flex: 0 0 auto;
}
.service-routes-overview-card strong {
    display: block;
    color: var(--text);
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.1;
}
.service-routes-overview-card span:last-child {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.35;
}
.service-routes-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 280px;
    padding: 28px;
    text-align: center;
    border: 1px dashed rgba(125,211,252,0.2);
    border-radius: 24px;
    background:
        radial-gradient(circle at top, rgba(125,211,252,0.08), transparent 28%),
        rgba(9,14,22,0.78);
}
.service-routes-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.04);
    color: #7dd3fc;
    font-size: 1.45rem;
}
.service-routes-empty-title {
    color: var(--text);
    font-size: 1.08rem;
    font-weight: 800;
}
.service-routes-empty-text {
    max-width: 58ch;
    color: var(--text-muted);
    line-height: 1.55;
}
.service-route-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.service-route-card {
    position: relative;
    padding: 20px 20px 18px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(18,23,34,0.94), rgba(12,17,27,0.9));
    box-shadow: 0 20px 40px rgba(2,6,23,0.18);
    overflow: hidden;
}
.service-route-card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--route-color), rgba(255,255,255,0));
    opacity: 0.9;
}
.service-route-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}
.service-route-card-title-wrap {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-width: 0;
    flex: 1 1 auto;
}
.service-route-color {
    display: inline-flex;
    width: 10px;
    min-width: 10px;
    min-height: 72px;
    border-radius: 999px;
    background: var(--route-color);
    box-shadow: 0 0 0 4px rgba(255,255,255,0.04);
}
.service-route-card-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.service-route-card-title {
    margin: 0;
    color: var(--text);
    font-size: 1.08rem;
    font-weight: 800;
    line-height: 1.25;
}
.service-route-number,
.service-route-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    color: #dbe6f3;
    font-size: 0.72rem;
    font-weight: 800;
}
.service-route-tag {
    color: #7dd3fc;
}
.service-route-card-subtitle {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.84rem;
    line-height: 1.5;
}
.service-route-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.service-route-edit-btn {
    min-height: 38px;
    padding-inline: 14px;
    border-radius: 12px;
    font-weight: 700;
}
.service-route-card-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0 16px;
}
.service-route-stat {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.07);
    background: rgba(255,255,255,0.03);
}
.service-route-stat-label {
    color: var(--text-muted);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
}
.service-route-stat strong {
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1;
}
.service-route-card-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 14px;
}
.service-route-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(7,11,18,0.34);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.service-route-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--text);
    font-size: 0.86rem;
    font-weight: 800;
}
.service-route-panel-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(74,222,128,0.12);
    color: #86efac;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
}
.service-route-panel-pill.is-muted {
    background: rgba(148,163,184,0.14);
    color: #94a3b8;
}
.service-stop-timeline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 6px;
}
.service-stop-node {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    color: var(--text);
    font-size: 0.76rem;
    font-weight: 700;
    max-width: 100%;
}
.service-stop-node.is-origin {
    border-color: rgba(74,222,128,0.3);
    background: rgba(74,222,128,0.09);
}
.service-stop-node.is-destination {
    border-color: rgba(125,211,252,0.28);
    background: rgba(125,211,252,0.08);
}
.service-stop-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 240px;
}
.service-stop-time {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(59,130,246,0.14);
    color: #93c5fd;
    font-size: 0.65rem;
    font-weight: 800;
}
.service-stop-connector {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    color: rgba(148,163,184,0.72);
    font-size: 0.72rem;
}
.service-route-empty-block {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 94px;
    padding: 14px;
    border-radius: 16px;
    border: 1px dashed rgba(148,163,184,0.2);
    background: rgba(148,163,184,0.05);
    color: var(--text-muted);
    text-align: center;
}

.clavijero-actions-bar {
    margin-bottom: 18px;
    padding: 16px 18px;
    border: 1px solid var(--sub-border);
    border-radius: 18px;
    background:
        radial-gradient(circle at top right, rgba(74,222,128,0.12), transparent 34%),
        var(--panel-bg-gradient);
    box-shadow: 0 18px 40px rgba(0,0,0,0.18);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}
.clavijero-actions-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.clavijero-actions-kicker {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #86efac;
    font-weight: 800;
}
.clavijero-actions-title {
    color: var(--text);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.2;
}
.clavijero-actions-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    max-width: 640px;
}
.clavijero-actions-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}
.clavijero-action-btn {
    min-height: 42px;
    padding-inline: 16px;
    border-radius: 14px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: inset 0 1px 0 var(--sub-border);
}
.clavijero-action-upload {
    background: rgba(0,255,136,0.06);
}
.clavijero-action-template {
    background: rgba(74,222,128,0.08);
}

.workers-toolbar-compact {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.workers-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 0;
    min-width: 0;
}
.workers-toolbar-count {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
}
.workers-toolbar-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}
.workers-toolbar-btn {
    min-height: 36px;
    padding-inline: 14px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.workers-toolbar-search {
    position: relative;
    min-width: 200px;
    flex: 1 1 240px;
    max-width: 360px;
}
.workers-toolbar-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.78rem;
    pointer-events: none;
    z-index: 1;
}
.workers-toolbar-search-icon i {
    display: block;
    line-height: 1;
}
.workers-toolbar-search .form-control {
    min-height: 36px;
    height: 36px;
    padding-left: 32px;
    padding-right: 12px;
    border-radius: 10px;
    background: var(--sub-bg);
    border: 1px solid var(--sub-border);
    color: var(--text);
    font-size: 0.82rem;
}
.workers-toolbar-search .form-control::placeholder {
    color: var(--text-muted);
}
.workers-toolbar-search .form-control:focus {
    background: var(--sub-bg-hover);
    border-color: rgba(74,222,128,0.28);
    box-shadow: 0 0 0 2px rgba(74,222,128,0.1);
    color: var(--text);
}
.wt-shell {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.wt-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.wt-filter-select {
    height: 32px;
    padding: 0 28px 0 10px;
    border-radius: 8px;
    border: 1px solid var(--sub-border);
    background: var(--sub-bg);
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    appearance: auto;
}
.wt-filter-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(74,222,128,0.1);
}
.wt-filter-count {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}
.wt-wrap {
    border: 1px solid var(--sub-border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-card);
}
.wt-table {
    width: 100%;
    border-collapse: collapse;
}
.wt-table thead th {
    padding: 10px 12px;
    border-bottom: 1px solid var(--sub-border);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--sub-bg);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}
.wt-table thead th:hover { color: var(--accent); }
.wt-sort-icon { margin-left: 4px; font-size: 0.65rem; opacity: 0.35; }
.wt-sort-icon.active { opacity: 1; color: var(--accent); }
.wt-col-doc { width: 12%; }
.wt-col-name { width: 28%; }
.wt-col-type { width: 12%; }
.wt-col-routes { width: 36%; }
.wt-col-actions { width: 12%; text-align: right; }
.wt-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--sub-border);
    vertical-align: middle;
    font-size: 0.82rem;
    color: var(--text);
}
.wt-table tbody tr:last-child td { border-bottom: 0; }
.wt-table tbody tr:hover td { background: var(--sub-bg); }
.wt-no-results {
    text-align: center;
    padding: 32px 16px !important;
    color: var(--text-muted);
    font-size: 0.82rem;
}
.wt-doc {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 8px;
    background: rgba(74,222,128,0.08);
    border: 1px solid rgba(74,222,128,0.12);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.wt-name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.wt-avatar {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(74,222,128,0.1);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
    flex-shrink: 0;
}
.wt-name-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.wt-name-text strong {
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wt-name-text small {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.wt-type {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid rgba(34,211,238,0.14);
    background: rgba(34,211,238,0.08);
    color: #0891b2;
    font-size: 0.74rem;
    font-weight: 700;
}
.wt-type {
    color: #a5f3fc;
}
.wt-routes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.wt-route {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid var(--sub-border);
    background: var(--sub-bg);
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.5;
}
.wt-route-empty {
    color: var(--text-muted);
    border-style: dashed;
}
.wt-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}
.wt-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--sub-border);
    background: var(--sub-bg);
    color: var(--text-muted);
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.15s ease;
}
.wt-btn:hover { transform: translateY(-1px); }
.wt-btn-edit:hover {
    border-color: rgba(74,222,128,0.24);
    background: rgba(74,222,128,0.08);
    color: var(--accent);
}
.wt-btn-del {
    color: #ef4444;
}
.wt-btn-del:hover {
    border-color: rgba(239,68,68,0.3);
    background: rgba(239,68,68,0.08);
    color: #dc2626;
}
.wt-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 0 2px;
}
.wt-page-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid var(--sub-border);
    background: var(--sub-bg);
    color: var(--text);
    font-size: 0.72rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.wt-page-btn:hover:not(:disabled) {
    background: var(--sub-bg-hover);
    border-color: var(--accent);
    color: var(--accent);
}
.wt-page-btn:disabled {
    opacity: 0.35;
    cursor: default;
}
.wt-page-info {
    font-size: 0.78rem;
    color: var(--text);
    padding: 0 6px;
}
.wt-page-info strong { font-weight: 700; }
.wt-page-range {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-left: 8px;
}
.workers-empty {
    min-height: 220px;
    border-radius: 18px;
    border: 1px dashed var(--sub-border);
    background: var(--sub-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 28px;
}
.workers-empty-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(74,222,128,0.12);
    color: #93c5fd;
    font-size: 1.2rem;
}
.workers-empty-copy {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.workers-empty-copy strong {
    color: var(--text);
    font-size: 1rem;
}
.workers-empty-copy span {
    color: var(--text-muted);
    font-size: 0.88rem;
    max-width: 420px;
}
.svc-vehicles-count {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 14px;
}
.svc-vehicles-count-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--sub-border);
    background: var(--panel-bg-gradient);
    color: var(--sub-text);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: var(--shadow), inset 0 1px 0 var(--sub-border);
}
.svc-vehicles-count-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1;
}
.svc-vehicles-count-copy {
    color: rgba(226,232,240,0.92);
    white-space: nowrap;
}
.service-departure-summary {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;
    min-height: 120px;
    padding: 18px 20px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(180deg, rgba(15,23,42,0.58), rgba(2,8,23,0.78));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
.service-departure-summary strong {
    color: var(--text);
    font-size: clamp(2rem, 3vw, 2.5rem);
    line-height: 1;
    font-weight: 900;
}
.service-departure-summary span {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.service-routes-toolbar-actions > .btn,
.service-routes-toolbar-actions > label,
.workers-toolbar-actions > .btn,
.workers-toolbar-actions > label,
.clavijero-actions-group > .btn,
.clavijero-actions-group > label {
    min-width: 0;
}
.service-route-card-title-wrap > div,
.clavijero-calendar-head > div,
.clavijero-detail-head > div {
    min-width: 0;
}
.service-route-card-title,
.service-stop-name,
.clavijero-route-name,
.clavijero-bus-main strong {
    overflow-wrap: anywhere;
}
.service-route-badge,
.service-departure-summary {
    max-width: 100%;
}

.clavijero-board {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.clavijero-summary,
.clavijero-calendar-card,
.clavijero-detail-card {
    border: 1px solid var(--sub-border);
    border-radius: 22px;
    background:
        radial-gradient(circle at top right, rgba(74,222,128,0.14), transparent 36%),
        var(--panel-bg-gradient);
    box-shadow: 0 20px 44px rgba(2,6,23,0.22);
}
.clavijero-summary {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    padding: 22px 24px;
}
.clavijero-summary-copy {
    max-width: 560px;
}
.clavijero-summary-kicker,
.clavijero-detail-kicker {
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-weight: 800;
    color: #7fb1ff;
    margin-bottom: 8px;
}
.clavijero-summary h4,
.clavijero-detail-head h5 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text);
}
.clavijero-summary p,
.clavijero-detail-head p {
    margin: 8px 0 0;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}
.clavijero-summary-metrics {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
}
.clavijero-metric {
    min-width: 132px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid var(--sub-border);
    background: var(--sub-bg);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.clavijero-metric strong {
    font-size: 1.25rem;
    line-height: 1;
    color: var(--text);
}
.clavijero-metric span {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.clavijero-layout {
    display: grid;
    grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
    gap: 18px;
    align-items: stretch;
}
.clavijero-calendar-card,
.clavijero-detail-card {
    padding: 20px;
}
.clavijero-calendar-card {
    position: sticky;
    top: 18px;
    align-self: start;
    min-height: 720px;
    max-height: 720px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.clavijero-detail-card {
    min-height: 720px;
    max-height: 720px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.clavijero-calendar-head,
.clavijero-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}
.clavijero-calendar-label {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text);
    text-transform: capitalize;
}
.clavijero-calendar-sub {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.84rem;
}
.clavijero-detail-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.clavijero-search {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 14px;
    border: 1px solid var(--sub-border);
    background: var(--sub-bg);
}
.clavijero-search i {
    color: #7dd3fc;
    font-size: 0.9rem;
}
.clavijero-search input {
    flex: 1;
    background: transparent;
    border: 0;
    outline: none;
    color: var(--text);
    font-size: 0.92rem;
}
.clavijero-search input::placeholder {
    color: var(--text-muted);
}
.clavijero-nav-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--sub-border);
    background: var(--sub-bg);
    color: var(--sub-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
}
.clavijero-nav-btn:hover {
    color: #fff;
    border-color: rgba(74,222,128,0.28);
    background: rgba(74,222,128,0.12);
}
.clavijero-calendar-weekdays,
.clavijero-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
}
.clavijero-calendar-weekdays {
    margin-bottom: 10px;
}
.clavijero-calendar-weekdays span {
    text-align: center;
    font-size: 0.73rem;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.clavijero-day {
    min-height: 92px;
    border-radius: 18px;
    border: 1px solid var(--sub-border);
    background: var(--sub-bg);
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    text-align: left;
    overflow: hidden;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.clavijero-day:hover {
    transform: translateY(-1px);
    border-color: rgba(74,222,128,0.24);
    background: rgba(74,222,128,0.08);
}
.clavijero-day.is-empty {
    min-height: 92px;
    border-radius: 18px;
    background: var(--sub-bg);
    border: 1px dashed var(--sub-border);
}
.clavijero-day.has-load {
    background: linear-gradient(180deg, rgba(15,118,110,0.16), var(--panel-bg));
    border-color: rgba(45,212,191,0.22);
}
.clavijero-day.is-selected {
    border-color: rgba(96,165,250,0.42);
    background: linear-gradient(180deg, rgba(74,222,128,0.2), var(--panel-bg));
    box-shadow: var(--shadow);
}
.clavijero-day-num {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text);
}
.clavijero-day-stack {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 1px;
    width: 100%;
}
.clavijero-day-stat,
.clavijero-day-empty-label {
    width: 100%;
    min-height: auto;
    padding: 0;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
    font-size: 0.5rem;
    line-height: 1;
    overflow: hidden;
    background: transparent;
    border: 0;
}
.clavijero-day-stat strong {
    color: var(--text);
    font-size: 0.58rem;
    font-weight: 800;
}
.clavijero-day-stat small {
    color: #93c5fd;
    font-size: 0.46rem;
    text-transform: lowercase;
    letter-spacing: 0.01em;
    font-weight: 700;
}
.clavijero-day-empty-label {
    margin-top: auto;
    color: var(--sub-text);
    font-weight: 700;
}
.clavijero-route-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding-right: 6px;
    align-content: start;
}
.clavijero-route-list::-webkit-scrollbar {
    width: 8px;
}
.clavijero-route-list::-webkit-scrollbar-thumb {
    background: rgba(148,163,184,0.28);
    border-radius: 999px;
}
.clavijero-route-list::-webkit-scrollbar-track {
    background: transparent;
}
.clavijero-route-card {
    padding: 16px;
    border-radius: 18px;
    border: 1px solid var(--sub-border);
    background: var(--sub-bg);
}
.clavijero-route-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}
.clavijero-route-name {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
}
.clavijero-route-meta {
    margin-top: 4px;
    font-size: 0.76rem;
    color: var(--text-muted);
}
.clavijero-route-badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(74,222,128,0.12);
    border: 1px solid rgba(74,222,128,0.2);
    color: #bfdbfe;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}
.clavijero-assignment-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.clavijero-assignment-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--sub-bg);
    border: 1px solid var(--sub-border);
    width: 100%;
    text-align: left;
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}
.clavijero-assignment-item:hover {
    transform: translateY(-1px);
    border-color: rgba(74,222,128,0.18);
    background: rgba(30,41,59,0.72);
}
.clavijero-time-pill {
    min-width: 66px;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(45,212,191,0.12);
    border: 1px solid rgba(45,212,191,0.2);
    color: #99f6e4;
    font-size: 0.76rem;
    font-weight: 800;
    text-align: center;
}
.clavijero-bus-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.clavijero-bus-main strong {
    color: var(--text);
    font-size: 0.92rem;
}
.clavijero-bus-main span {
    color: var(--text-muted);
    font-size: 0.78rem;
}
.clavijero-edit-indicator {
    margin-left: auto;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(74,222,128,0.16);
    background: rgba(74,222,128,0.08);
    color: #93c5fd;
    flex: 0 0 30px;
}
.clavijero-modal-shell {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.clavijero-modal-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.clavijero-modal-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.clavijero-modal-chip {
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--sub-border);
    background: var(--sub-bg);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.clavijero-modal-chip span {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
}
.clavijero-modal-chip strong {
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 800;
}
.clavijero-time-picker {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.clavijero-time-composer {
    display: grid;
    grid-template-columns: minmax(220px, 270px) minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
}
.clavijero-time-preview {
    padding: 18px 20px;
    border-radius: 20px;
    border: 1px solid rgba(56,189,248,0.18);
    background:
        radial-gradient(circle at top left, rgba(34,211,238,0.12), transparent 55%),
        var(--bg-card);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}
.clavijero-time-preview-label {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7dd3fc;
    font-weight: 800;
}
.clavijero-time-preview strong {
    color: var(--text);
    font-size: clamp(1.55rem, 2vw, 2rem);
    font-weight: 800;
    line-height: 1;
}
.clavijero-time-preview small {
    color: var(--text-muted);
    font-size: 0.82rem;
}
.clavijero-time-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.clavijero-time-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.clavijero-time-field-label {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 800;
}
.clavijero-time-select {
    min-height: 48px;
    border-radius: 16px;
    border-color: var(--sub-border);
    background: var(--sub-bg);
    color: var(--text);
    font-weight: 700;
    box-shadow: none;
}
.clavijero-time-select:focus {
    border-color: rgba(74,222,128,0.45);
    box-shadow: 0 0 0 0.2rem rgba(74,222,128,0.15);
    background: var(--sub-bg-hover);
    color: var(--text);
}
.clavijero-time-period {
    min-width: 0;
}
.clavijero-period-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.clavijero-period-btn {
    min-height: 48px;
    border-radius: 16px;
    border: 1px solid var(--sub-border);
    background: var(--sub-bg);
    color: var(--sub-text);
    font-weight: 800;
    transition: all 0.18s ease;
}
.clavijero-period-btn:hover {
    border-color: rgba(74,222,128,0.28);
    color: var(--text);
}
.clavijero-period-btn.is-selected {
    border-color: rgba(74,222,128,0.4);
    background: linear-gradient(180deg, rgba(22,163,74,0.22), rgba(21,128,61,0.18));
    color: #eff6ff;
    box-shadow: inset 0 1px 0 var(--sub-border);
}
.clavijero-time-presets {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.clavijero-time-presets-label {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 800;
}
.clavijero-time-presets-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.clavijero-time-preset {
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--sub-border);
    background: var(--sub-bg);
    color: var(--sub-text);
    font-size: 0.88rem;
    font-weight: 700;
    transition: all 0.18s ease;
}
.clavijero-time-preset:hover {
    border-color: rgba(34,211,238,0.22);
    color: var(--text);
}
.clavijero-time-preset.is-active {
    border-color: rgba(34,211,238,0.28);
    background: rgba(34,211,238,0.12);
    color: #ecfeff;
}
.clavijero-time-input-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 68px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--sub-border);
    background: var(--sub-bg);
}
.clavijero-time-input-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.clavijero-time-input-copy span {
    color: var(--sub-text);
    font-size: 0.88rem;
    font-weight: 700;
}
.clavijero-time-input-copy small {
    color: var(--text-muted);
    font-size: 0.76rem;
}
.clavijero-time-input-wrap .form-control {
    max-width: 190px;
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid var(--sub-border);
    background: var(--input-field-bg);
    color: var(--text);
    font-weight: 700;
}
.clavijero-time-input-wrap .form-control:focus {
    border-color: rgba(74,222,128,0.45);
    box-shadow: 0 0 0 0.2rem rgba(74,222,128,0.15);
    background: var(--sub-bg-hover);
}
.clavijero-time-help {
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.4;
}
.clavijero-empty {
    min-height: 260px;
    border-radius: 18px;
    border: 1px dashed var(--sub-border);
    background: var(--sub-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 28px;
}
.clavijero-empty-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(74,222,128,0.12);
    color: #93c5fd;
    font-size: 1.2rem;
}
.clavijero-empty-copy {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.clavijero-empty-copy strong {
    color: var(--text);
    font-size: 1rem;
}
.clavijero-empty-copy span {
    color: var(--text-muted);
    font-size: 0.88rem;
    max-width: 420px;
}

/* Workers empty state preserved for new wt-table */
.vehicle-summary-chip i {
    color: #6aa5ff;
}
.vehicle-name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.vehicle-name-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(38,99,235,0.24), rgba(21,128,61,0.12));
    border: 1px solid rgba(96,165,250,0.24);
    box-shadow: inset 0 1px 0 var(--sub-border);
    font-size: 19px;
    flex-shrink: 0;
}
.vehicle-name-meta {
    min-width: 0;
}
.vehicle-name-title {
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.vehicle-name-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.vehicle-status-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}
.vehicle-inline-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
}
.vehicle-table-cell-compact {
    line-height: 1.25;
}
.vehicle-table-primary {
    font-weight: 700;
    color: var(--text);
}
.vehicle-table-secondary {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}
/* ─── VEHICLES TABLE ──────────────────────────────────────────────── */
.vt-wrap {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--sub-border);
    background: var(--panel-bg);
}
.vt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.vt-thead th {
    padding: 9px 14px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid var(--sub-border);
    background: var(--sub-bg);
    transition: color 0.15s;
}
.vt-thead th:hover { color: var(--text); }
.vt-sort-icon { margin-left: 4px; opacity: 0.35; font-size: 10px; }
.vt-sort-active { opacity: 1 !important; color: var(--accent); }
.vt-row {
    border-bottom: 1px solid var(--sub-border);
    transition: background 0.12s;
    cursor: pointer;
}
.vt-row:last-child { border-bottom: none; }
.vt-row:hover { background: var(--sub-bg); }
.vt-row-expanded { background: var(--sub-bg); }
.vt-td {
    padding: 9px 14px;
    vertical-align: middle;
    white-space: nowrap;
    color: var(--text);
}
/* status column */
.vt-td-status { width: 130px; }
.vt-dot {
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    margin-right: 6px;
    flex-shrink: 0;
}
.vt-dot-online  { background: #2ecc71; box-shadow: 0 0 4px #2ecc7188; }
.vt-dot-offline { background: #636e72; }
.vt-status-label { font-size: 12px; font-weight: 500; }
.vt-status-online  { color: #2ecc71; }
.vt-status-offline { color: var(--text-muted); }
/* name column */
.vt-icon { margin-right: 5px; }
.vt-name { font-weight: 600; }
/* plate */
.vt-mono { font-family: 'Courier New', monospace; font-size: 12.5px; letter-spacing: 0.04em; }
/* tag */
.vt-tag-pill {
    background: var(--sub-bg);
    border: 1px solid var(--sub-border);
    border-radius: 999px;
    padding: 2px 9px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
/* speed */
.vt-speed { font-size: 13px; font-weight: 600; }
.vt-speed small { font-size: 10px; font-weight: 400; color: var(--text-muted); }
.vt-speed-moving { color: #f39c12; }
.vt-speed-na { color: var(--text-muted); }
/* time */
.vt-td-time { color: var(--text-muted); font-size: 12.5px; }
/* actions */
.vt-td-actions { width: 80px; }
.btn-xs {
    width: 28px; height: 28px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}
.vt-btn-action {
    color: var(--text-muted);
    border-color: var(--sub-border);
    background: transparent;
}
.vt-btn-action:hover { color: var(--text); border-color: var(--text-muted); }
.vt-btn-map:hover { color: #3498db; border-color: #3498db; }
/* expanded detail */
.vt-expand-row { border-bottom: 1px solid var(--sub-border); }
.vt-expand-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    align-items: flex-start;
    padding: 12px 20px 14px;
    border-top: 1px solid var(--sub-border);
    animation: vtExpandIn 0.15s ease;
}
@keyframes vtExpandIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.vt-expand-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 32px;
    flex: 1;
    align-items: center;
}
.vt-expand-item { display: flex; flex-direction: column; gap: 1px; }
.vt-expand-key { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.vt-expand-val { font-size: 13px; font-weight: 500; color: var(--text); }
.vt-expand-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; margin-left: 20px; }

/* ─── legacy (kept for compatibility) ─────────────────────────────── */
.vehicles-list-shell {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.vehicle-card-row {
    display: grid;
    grid-template-columns: 118px minmax(0, 1fr) auto;
    gap: 20px;
    align-items: stretch;
    padding: 20px 22px;
    border-radius: 22px;
    border: 1px solid var(--sub-border);
    background:
        radial-gradient(circle at top right, rgba(98, 117, 156, 0.08), transparent 28%),
        var(--panel-bg-gradient);
    box-shadow: 0 14px 34px rgba(4, 8, 16, 0.18);
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    overflow: hidden;
    min-height: 126px;
}
.vehicle-card-row:hover {
    transform: translateY(-1px);
    border-color: var(--sub-border);
    box-shadow: var(--shadow);
    background:
        radial-gradient(circle at top right, rgba(119, 137, 177, 0.11), transparent 30%),
        var(--bg-card-hover);
}
.vehicle-card-status {
    display: flex;
    align-items: center;
    padding-right: 18px;
    border-right: 1px solid var(--sub-border);
    gap: 12px;
}
.vehicle-status-rail {
    width: 3px;
    align-self: stretch;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255,255,255,0.36), var(--sub-bg));
}
.vehicle-card-row.is-online .vehicle-status-rail {
    background: linear-gradient(180deg, rgba(255,255,255,0.7), rgba(255,255,255,0.12));
}
.vehicle-status-stack-card {
    gap: 12px;
    padding-top: 0;
}
.vehicle-card-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    justify-content: center;
}
.vehicle-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
}
.vehicle-card-quickmeta {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
    padding-top: 2px;
}
.vehicle-card-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--sub-border);
    background: var(--sub-bg);
    color: var(--sub-text-medium);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}
.vehicle-card-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    align-items: center;
    padding-top: 2px;
}
.vehicle-meta-chip {
    display: grid;
    gap: 6px;
    min-width: 0;
    padding-right: 18px;
    border-right: 1px solid var(--sub-border);
}
.vehicle-meta-chip::after {
    display: none;
}
.vehicle-meta-chip:last-child {
    border-right: 0;
    padding-right: 0;
}
.vehicle-meta-chip-serial {
    flex: 1 1 auto;
}
.vehicle-meta-key {
    color: var(--sub-text-dim);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
    flex-shrink: 0;
}
.vehicle-meta-value {
    display: inline-block;
    color: var(--text);
    font-size: 1.03rem;
    line-height: 1.2;
    word-break: break-word;
    font-weight: 700;
    min-width: 0;
}
.vehicle-card-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding-left: 10px;
}
.vehicle-card-actions .btn-outline-light,
.vehicle-card-actions .btn-outline-info {
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.vehicle-name-cell,
.vehicle-name-meta {
    min-width: 0;
}
.vehicle-name-title,
.vehicle-table-primary {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.vehicle-name-subtitle,
.vehicle-table-secondary {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.vehicle-table-mono {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    word-break: normal;
}
.vehicle-inline-meta {
    max-width: 100%;
    white-space: normal;
    line-height: 1.35;
}
.vehicle-unit-block {
    align-items: flex-start;
    gap: 14px;
}
.vehicle-unit-meta {
    width: 100%;
}
.vehicle-name-title {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}
.vehicle-name-subtitle {
    margin-top: 6px;
    color: var(--sub-text-medium);
    font-size: 0.98rem;
    line-height: 1.25;
}
.vehicle-name-subtitle-label {
    color: var(--sub-text-dim);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
    flex-shrink: 0;
}
.vehicle-name-subtitle-value {
    min-width: 0;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.vehicle-name-icon {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    background: var(--sub-bg);
    border-color: var(--sub-border);
    box-shadow: inset 0 1px 0 var(--sub-border), 0 10px 20px rgba(0,0,0,0.14);
}
.vehicle-card-actions .btn-outline-light {
    border-color: var(--sub-border);
    background: var(--sub-bg);
}
.vehicle-card-actions .btn-outline-info {
    border-color: var(--sub-border);
    background: var(--sub-bg);
    color: var(--text);
}
.vehicle-modal {
    display: flex;
    flex-direction: column;
    gap: 22px;
    min-height: 100%;
}
.vehicle-modal-head {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) auto;
    align-items: start;
    gap: 24px;
    padding: 4px 2px 0;
}
.vehicle-modal-head-main {
    min-width: 0;
    flex: 1 1 auto;
}
.vehicle-modal-head-side {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-self: start;
}
.vehicle-modal-eyebrow {
    margin-bottom: 8px;
    color: var(--sub-text-dim);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.vehicle-modal-title {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.03em;
}
.vehicle-modal-subtitle {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 1rem;
}
.vehicle-modal-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}
.vehicle-modal-summary-item {
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--sub-border);
    background: var(--sub-bg);
    min-width: 0;
    min-height: 88px;
}
.vehicle-modal-summary-label {
    display: block;
    margin-bottom: 6px;
    color: var(--sub-text-dim);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.vehicle-modal-summary-value {
    display: block;
    color: var(--text);
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.3;
    word-break: break-word;
}
.vehicle-modal-sections {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    padding-bottom: 4px;
    align-items: start;
}
.vehicle-modal-section {
    padding: 16px 18px 18px;
    border-radius: 20px;
    border: 1px solid var(--sub-border);
    background:
        var(--sub-bg);
    box-shadow: inset 0 1px 0 var(--sub-border);
}
.vehicle-modal-section-title {
    margin-bottom: 14px;
    color: var(--text);
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.vehicle-modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.vehicle-modal-section-primary .vehicle-modal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.vehicle-modal-section-secondary .vehicle-modal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.vehicle-modal-section-secondary .vehicle-modal-item:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}
.vehicle-modal-item {
    min-width: 0;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--sub-border);
    background: var(--sub-bg);
}
.vehicle-modal-label {
    display: block;
    margin-bottom: 8px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sub-text-dim);
}
.vehicle-modal-value {
    display: block;
    color: var(--text);
    line-height: 1.35;
    font-size: 1.02rem;
    font-weight: 600;
    word-break: break-word;
}
.badge-online,
.badge-offline {
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 800;
}
.badge-online {
    background: var(--sub-bg);
    color: var(--sub-text);
    border-color: var(--sub-border);
}
.badge-offline {
    background: var(--sub-bg);
    color: var(--sub-text-medium);
    border-color: var(--sub-border);
}
.vehicles-empty-state {
    margin-top: 18px;
    padding: 36px 24px;
    border: 1px dashed var(--border);
    border-radius: 18px;
    text-align: center;
    background: var(--sub-bg);
    color: var(--text-muted);
}
.vehicles-empty-state i {
    font-size: 32px;
    color: var(--accent);
    margin-bottom: 12px;
}
.vehicles-empty-state h4 {
    margin: 0 0 8px;
    color: var(--text);
    font-size: 18px;
}
.vehicles-empty-state p {
    margin: 0 auto;
    max-width: 520px;
}

/* ─── DASHBOARD KPI STRIP → CARDS ─────────────────────────── */
.dash-strip {
    display: flex;
    background: transparent;
    padding: 8px 12px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    position: relative;
}
.dash-strip-bottom {
    border-bottom: none;
    border-top: 1px solid var(--border);
    padding: 6px 12px;
}
.dash-row {
    display: flex;
    gap: 6px;
    flex: 1;
    align-items: center;
}
.dash-separator {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 4px;
    flex-shrink: 0;
}
.dash-filter-search {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    width: 160px;
    flex-shrink: 0;
}
.dash-filter-search i {
    color: var(--text-muted);
    font-size: 11px;
}
.dash-filter-search input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 11px;
    color: var(--text);
    font-family: inherit;
    min-width: 0;
}
.dash-filter-search input::placeholder {
    color: var(--text-muted);
}
.dash-filter-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    font-size: 10px;
    opacity: 0.5;
    transition: opacity 0.2s;
    line-height: 1;
}
.dash-filter-clear:hover {
    opacity: 1;
    color: var(--accent);
}
.dash-filter-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    width: 140px;
    flex-shrink: 0;
}
.dash-filter-tag i {
    color: var(--text-muted);
    font-size: 11px;
}
.dash-filter-tag select {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 11px;
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
    min-width: 0;
}
.dash-filter-tag select option {
    background: var(--card-bg);
    color: var(--text);
}
.dash-strip::-webkit-scrollbar { display: none; }

.dash-kpi {
    flex: 1 1 0;
    min-width: 0;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    transition: all var(--transition-fast);
    cursor: default;
    position: relative;
}
.dash-kpi:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    border-color: rgba(79,143,255,0.2);
}
.dk-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
}
.dk-data {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}
.dk-val {
    font-size: 14px;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text);
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dk-lbl {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* KPI colored icons - using both static kpi-* and dynamic dk-* classes */
.kpi-online .dk-icon, .dk-online .dk-icon { background: rgba(0,212,170,0.12); color: #00d4aa; }
.kpi-moving .dk-icon, .dk-moving .dk-icon { background: rgba(0,180,216,0.12); color: #00b4d8; }
.kpi-stopped .dk-icon, .dk-stopped .dk-icon { background: rgba(255,209,102,0.12); color: #ffd166; }
.kpi-engine .dk-icon, .dk-on .dk-icon { background: rgba(116,185,255,0.12); color: #74b9ff; }
.kpi-speed .dk-icon { background: rgba(162,155,254,0.12); color: #a29bfe; }
.kpi-maxspeed .dk-icon, .dk-danger .dk-icon { background: rgba(255,107,107,0.12); color: #ff6b6b; }
.kpi-violations .dk-icon { background: rgba(255,107,107,0.12); color: #ff6b6b; }
.kpi-odometer .dk-icon { background: rgba(85,239,196,0.12); color: #55efc4; }

/* Also style icon based on element ID for reliable coloring */
#dkOnline .dk-icon { background: rgba(0,212,170,0.12); color: #00d4aa; }
#dkMoving .dk-icon { background: rgba(0,180,216,0.12); color: #00b4d8; }
#dkStopped .dk-icon { background: rgba(255,209,102,0.12); color: #ffd166; }
#dkEngines .dk-icon { background: rgba(116,185,255,0.12); color: #74b9ff; }
#dkSpeed .dk-icon { background: rgba(162,155,254,0.12); color: #a29bfe; }
#dkMaxSpeed .dk-icon { background: rgba(253,203,110,0.12); color: #fdcb6e; }
#dkViolations .dk-icon { background: rgba(255,107,107,0.12); color: #ff6b6b; }
#dkOdometer .dk-icon { background: rgba(85,239,196,0.12); color: #55efc4; }

/* KPI color states (dynamic via JS) */
.dk-online .dk-val { color: #00d4aa; }
.dk-moving .dk-val { color: #00b4d8; }
.dk-stopped .dk-val { color: #ffd166; }
.dk-on .dk-val { color: #74b9ff; }
.dk-danger .dk-val { color: #ff6b6b; }

.dash-charts-btn {
    display: none;
}
.dash-charts-btn:hover { display: none; }
.dash-charts-btn.active { display: none; }

/* Map charts button (inside map-wrapper) */
.map-charts-btn {
    position: absolute;
    top: 150px;
    left: 12px;
    z-index: 5;
    width: 38px;
    height: 38px;
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}
.map-charts-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 4px 12px -2px rgba(79,143,255,0.4); }
.map-charts-btn.active { background: var(--accent-gradient); color: #fff; border-color: transparent; box-shadow: 0 4px 12px -2px rgba(79,143,255,0.5); }

/* ─── DASHBOARD CHARTS — FLOATING GLASS OVERLAY ──────────── */
.dash-charts {
    display: none;
    position: absolute;
    top: 8px;
    left: 12px;
    right: 12px;
    z-index: 600;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 16px;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.dash-charts.open {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    animation: chartsSlideIn 0.35s ease forwards;
}
@keyframes chartsSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.dash-charts-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}
.dash-charts-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.dash-charts-title i {
    color: var(--accent);
    font-size: 14px;
}
.dash-charts-close {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all var(--transition-fast);
}
.dash-charts-close:hover {
    color: var(--danger);
    border-color: rgba(255,107,107,0.3);
    background: rgba(255,107,107,0.08);
}
.dash-chart-card {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px;
    display: flex;
    flex-direction: column;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}
.dash-chart-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-fast);
}
.dash-chart-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--accent);
}
.dash-chart-card:hover::before { opacity: 1; }
.dc-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.dc-title i {
    font-size: 11px;
    color: var(--accent);
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-glow);
    border-radius: 6px;
}
.dash-chart-card canvas {
    flex: 1;
    min-height: 0;
    max-height: 140px;
}

@media (max-width: 1200px) {
    .dash-charts.open { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .dash-kpi { padding: 4px 6px; gap: 4px; }
    .dk-val { font-size: 12px; }
    .dk-lbl { font-size: 7px; }
    .dk-icon { width: 22px; height: 22px; font-size: 10px; border-radius: 5px; }
    .dash-strip { padding: 4px 6px; }
    .dash-row { gap: 4px; }
    .dash-charts { left: 6px; right: 6px; padding: 10px; }
    .dash-charts.open { grid-template-columns: 1fr; }
}

/* ─── MAP ─────────────────────────────────────────────────── */
.map-wrapper { flex: 1; position: relative; display: flex; overflow: hidden; }
#map { flex: 1; z-index: 1; }

/* ─── FULLSCREEN MONITORING MODE ──────────────────────────── */
.map-fullscreen-btn {
    position: absolute;
    top: 104px;
    left: 12px;
    z-index: 5;
    width: 38px;
    height: 38px;
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}
.map-fullscreen-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 4px 12px -2px rgba(79,143,255,0.4);
}
.map-fullscreen-btn.active {
    background: var(--accent-gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px -2px rgba(79,143,255,0.5);
}

/* Fullscreen mode: hide sidebar, topbar, kpi strip, footer */
body.monitor-mode .sidebar { display: none; }
body.monitor-mode .main-content { margin-left: 0; }
body.monitor-mode .topbar { display: none; }
body.monitor-mode .dash-strip { display: none; }
body.monitor-mode .app-footer { display: none; }
body.monitor-mode .page.active { height: 100vh; }
body.monitor-mode .map-wrapper { border-radius: 0; }

/* Monitor mode overlay info */
.monitor-badge {
    position: absolute;
    top: 12px;
    left: 58px;
    z-index: 10;
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    box-shadow: var(--shadow);
    letter-spacing: 0.5px;
}
.monitor-badge .live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: livePulse 1.5s ease-in-out infinite;
}
body.monitor-mode .monitor-badge { display: flex; }

.map-fit-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 5;
    width: 38px;
    height: 38px;
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}
.map-fit-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 4px 12px -2px rgba(79,143,255,0.4); }

.map-measure-btn {
    position: absolute;
    top: 58px;
    left: 12px;
    z-index: 5;
    width: 38px;
    height: 38px;
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}
.map-measure-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.map-measure-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.map-measure-hint {
    position: absolute;
    top: 102px;
    left: 12px;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: min(380px, calc(100% - 24px));
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(0, 184, 148, 0.35);
    background: var(--panel-bg);
    color: var(--text);
    font-size: 12px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}
.map-measure-hint > i { color: var(--accent); }

.map-measure-clear {
    margin-left: auto;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    border-radius: 6px;
    font-size: 11px;
    line-height: 1;
    padding: 6px 8px;
    cursor: pointer;
}
.map-measure-clear:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}



.measure-point-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #2f80ed;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

.measure-distance-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(47, 128, 237, 0.35);
    background: var(--panel-bg);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.2px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    white-space: nowrap;
}

/* ── Replay Bar ──────────────────────────────────────── */
.replay-bar {
    position: absolute;
    bottom: 14px;
    left: 14px;
    right: 14px;
    z-index: 1000;
    background: var(--glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
}
.replay-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    flex-shrink: 0;
}
.replay-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.replay-progress-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.replay-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
    cursor: pointer;
}
.replay-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #e17055;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(225,112,85,0.5);
}
.replay-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #e17055;
    cursor: pointer;
    border: none;
}
.replay-time {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    padding: 0 2px;
}
.replay-speed-sel {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
}
.replay-follow-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    user-select: none;
}
.replay-follow-label input { width: 14px; height: 14px; cursor: pointer; }

/* ── Replay navigation marker ── */
.replay-nav-marker {
    background: none !important;
    border: none !important;
}
.replay-nav-arrow {
    width: 22px;
    height: 22px;
    position: absolute;
    top: 1px;
    left: 1px;
    will-change: transform;
    transition: transform 0.15s linear;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
    display: flex;
    align-items: center;
    justify-content: center;
}
.replay-nav-arrow svg {
    width: 18px;
    height: 22px;
}
.replay-nav-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(39,174,96,0.25);
    animation: replayPulse 1.4s ease-in-out infinite;
    z-index: -1;
}
@keyframes replayPulse {
    0% { transform: translate(-50%,-50%) scale(0.7); opacity: 1; }
    100% { transform: translate(-50%,-50%) scale(1.8); opacity: 0; }
}

/* Replay trip button in trip card */
.replay-trip-btn {
    color: var(--text-muted);
    border: none;
    background: none;
    padding: 2px 6px;
    font-size: 16px;
    cursor: pointer;
    transition: color 0.2s;
}
.replay-trip-btn:hover { color: #e17055; }

/* Responsive adjustments for replay bar */
@media (max-width: 768px) {
    .replay-bar {
        flex-wrap: wrap;
        gap: 6px;
        padding: 6px 10px;
    }
    .replay-progress-wrap {
        order: 3;
        width: 100%;
        flex-basis: 100%;
    }
}

.vehicle-panel {
    width: 340px;
    min-width: 340px;
    max-width: 340px;
    position: absolute;
    right: 12px;
    top: 12px;
    bottom: 12px;
    z-index: 10;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.vehicle-panel.hidden {
    width: 0;
    min-width: 0;
    max-width: 0;
    opacity: 0;
    border: none;
    padding: 0;
    pointer-events: none;
    transform: translateX(20px);
}
.vp-header {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--sub-border);
    align-items: center;
    background: transparent;
}
.vp-search {
    flex: 1;
    padding: 8px 14px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: all var(--transition-fast);
}
.vp-search:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}
.vp-toggle-btn, .vp-expand-btn {
    background: var(--sub-bg-hover);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.vp-toggle-btn:hover, .vp-expand-btn:hover { color: var(--text); background: rgba(255,255,255,0.1); }
.vp-expand-btn {
    position: absolute;
    right: 12px;
    top: 12px;
    z-index: 10;
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-sm);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.vp-expand-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 4px 12px -2px rgba(79,143,255,0.4);
}
.vp-tag-filter {
    padding: 6px 12px;
    border-bottom: 1px solid var(--sub-border);
}
.vp-tag-filter select {
    width: 100%;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    background: var(--sub-bg);
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
}
.vp-tag-filter select:focus {
    outline: none;
    border-color: var(--accent);
}
.vp-stats {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--sub-border);
    font-size: 11px;
    flex-wrap: wrap;
    background: transparent;
}
.vp-list { flex: 1; overflow-y: auto; padding: 6px; }

/* Vehicle Cards */
.v-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 4px;
    border: 1px solid transparent;
    background: transparent;
}
.v-card:hover {
    background: var(--bg-hover);
    border-color: var(--border);
    transform: translateX(3px);
}
.v-card.selected {
    background: rgba(0,212,170,0.06);
    border-color: rgba(0,212,170,0.2);
    box-shadow: 0 0 0 1px rgba(0,212,170,0.1), var(--shadow-sm);
}
.v-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.v-icon.online { background: rgba(0,184,148,0.15); }
.v-icon.offline { background: rgba(99,110,114,0.15); }
.v-icon-bus {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}
.v-icon-bus.online { background: linear-gradient(135deg, rgba(16,185,129,0.15), rgba(6,182,212,0.15)); color: #10b981; }
.v-icon-bus.offline { background: rgba(100,116,139,0.1); color: #64748b; }
.v-info { flex: 1; min-width: 0; }
.v-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.v-detail {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
    margin-top: 2px;
}
.v-status {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}
.v-status.online { background: var(--online); box-shadow: 0 0 6px var(--online); }
.v-status.offline { background: var(--offline); }

/* Detail Overlay */
.detail-overlay {
    position: absolute;
    left: 12px;
    right: 364px;
    bottom: 24px;
    z-index: 15;
    display: none;
    pointer-events: none;
}
.detail-overlay.show { display: flex; justify-content: center; }
.vehicle-panel.hidden ~ .detail-overlay { right: 12px; }
.detail-card {
    pointer-events: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 22px;
    min-width: 380px;
    max-width: 520px;
    box-shadow: var(--shadow-lg);
}
.detail-route {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin: 8px 0 4px;
    border-radius: 10px;
    background: rgba(74,222,128,0.08);
    border: 1px solid rgba(74,222,128,0.14);
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
}
.detail-route i {
    font-size: 0.78rem;
    opacity: 0.7;
}
.detail-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 12px;
}
.detail-item { text-align: center; }
.detail-item .label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.detail-item .value { font-size: 18px; font-weight: 700; margin-top: 2px; }
.detail-item .value.on { color: var(--online); }
.detail-item .value.off { color: var(--danger); }
.detail-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 15px;
    font-weight: 600;
}
.close-detail {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
}
.close-detail:hover { color: #fff; }
.detail-location {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
}
.detail-location .label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.detail-location .address {
    margin-top: 4px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}
.detail-location .coords {
    margin-top: 3px;
    font-size: 12px;
    color: var(--text-muted);
    font-family: monospace;
}

/* ─── HISTORY ─────────────────────────────────────────────── */
.history-wrapper { flex: 1; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.history-topbar {
    padding: 12px 16px;
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 10;
}
.history-controls-row {
    display: flex;
    gap: 10px;
    align-items: end;
    flex-wrap: wrap;
}
.history-control-group {
    min-width: 190px;
    flex: 0 0 auto;
}
.history-control-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.history-control-actions {
    display: flex;
    gap: 8px;
}
.history-action-btn {
    min-width: 72px;
}
.history-kpis {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
}
.history-kpi {
    padding: 10px 12px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: all var(--transition-fast);
}
.history-kpi:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.history-kpi-label {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}
.history-kpi-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
}
.history-kpi-value small {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}
.history-kpi-danger {
    border-color: rgba(231, 76, 60, 0.35);
    background: rgba(231, 76, 60, 0.10);
}
.history-content-split {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    gap: 0;
    position: relative;
}
.history-map { min-height: 0; height: 100%; grid-row: 1; grid-column: 1; }
.history-table-panel {
    min-height: 0;
    overflow-y: auto;
    background: var(--bg-card);
    border-left: 2px solid var(--accent);
    transition: none;
    grid-row: 1;
    grid-column: 2;
}
.history-wrapper:not(.history-has-results) .history-table-panel {
    display: none;
}
.history-wrapper:not(.history-has-results) .history-map {
    width: 100%;
}
.history-wrapper.history-has-results .history-content-split {
    grid-template-columns: minmax(380px, 58%) minmax(320px, 42%);
    grid-template-rows: 1fr auto;
}
.history-table-panel:empty { border-left: none; }
.history-table-panel table { margin-bottom: 0; }
.history-table-panel thead { position: sticky; top: 0; z-index: 1; background: var(--bg-dark); }

/* ── Trip number badge on map ── */
.trip-number-badge {
    width: 24px; height: 24px;
    border-radius: 50%;
    color: #fff;
    font-size: 12px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    border: 2px solid rgba(255,255,255,0.7);
}
/* ── Stop badge on map ── */
.stop-badge {
    width: 28px; height: 28px;
    border-radius: 6px;
    background: rgba(99,110,114,0.85);
    color: #fff;
    font-size: 14px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    border: 2px solid rgba(255,255,255,0.5);
}

/* ── History bottom tabs ── */
.history-bottom-tabs { display: flex; flex-direction: column; height: 100%; }
.history-tab-bar {
    display: flex;
    gap: 0;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.history-tab {
    padding: 6px 14px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px; font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}
.history-tab:hover { color: var(--text); }
.history-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.history-tab-content { flex: 1; overflow-y: auto; }
.history-tab-pane { display: none; }
.history-tab-pane.active { display: block; }

/* ── Trip cards (corporate) ── */
.trips-grid { display: flex; flex-direction: column; gap: 8px; padding: 8px; }
.history-trip-actions {
    padding: 8px 8px 0 8px;
    display: flex;
    justify-content: flex-end;
}
.trip-card {
    padding: 0;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid var(--border);
    overflow: hidden;
}
.trip-card:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.trip-card.active {
    background: rgba(0,184,148,0.07);
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}
.tc-header {
    display: flex;
    align-items: stretch;
    gap: 0;
}
.tc-number {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    background: var(--trip-color, var(--accent));
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    flex-shrink: 0;
}
.tc-route {
    flex: 1;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
    position: relative;
}
.tc-origin, .tc-dest {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}
.tc-dot-start {
    font-size: 7px;
    color: #00b894;
    flex-shrink: 0;
}
.tc-dot-end {
    font-size: 11px;
    color: #e74c3c;
    flex-shrink: 0;
    width: 7px;
    text-align: center;
}
.tc-address {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tc-dest .tc-address {
    color: var(--text-muted);
    font-weight: 500;
}
.tc-route-line {
    width: 1px;
    height: 10px;
    background: rgba(255,255,255,0.15);
    margin-left: 3px;
    border-left: 1.5px dashed rgba(255,255,255,0.2);
}
.tc-play {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    background: none;
    border: none;
    border-left: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
}
.tc-play:hover {
    color: var(--accent);
    background: rgba(0,184,148,0.08);
}
.tc-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 10px;
    padding: 6px 10px 8px;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.12);
}
.tc-stat {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.tc-stat i {
    font-size: 10px;
    opacity: 0.6;
}
.tc-stat-warn {
    color: #e74c3c;
}
.tc-stat-warn i {
    opacity: 1;
}

/* ── Stop cards ── */
.stops-grid { display: flex; flex-direction: column; gap: 6px; padding: 8px; }
.stop-card {
    padding: 8px 12px;
    background: var(--bg-card);
    border-radius: 8px;
    border-left: 3px solid #636e72;
    cursor: pointer;
    display: flex; flex-direction: column; gap: 2px;
    transition: background 0.2s;
}
.stop-card:hover { background: var(--bg-hover); }
.stop-card-title {
    font-weight: 700; font-size: 12px;
    color: var(--text);
}

/* Neon glow route effect */
.leaflet-overlay-pane svg path.neon-trail {
    filter: drop-shadow(0 0 6px var(--accent)) drop-shadow(0 0 12px var(--accent));
}

/* ── Flow Vision: Speed Heatmap History ───────────────────── */

/* Animated flowing direction dashes */
.flow-dash {
    stroke-dasharray: 12 18;
    animation: flowDash 1.2s linear infinite;
}
@keyframes flowDash {
    to { stroke-dashoffset: -30; }
}

/* Direction arrows on route */
.flow-arrow {
    width: 18px; height: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 900;
    color: var(--sub-text-medium);
    text-shadow: 0 0 4px rgba(0,0,0,0.7);
    pointer-events: none;
    line-height: 1;
}

/* Start / End endpoint markers */
.flow-endpoint {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    pointer-events: none;
}
.flow-ep-icon {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 900; font-size: 14px;
    color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
    border: 2.5px solid rgba(255,255,255,0.9);
}
.flow-start .flow-ep-icon { background: #00b894; }
.flow-end   .flow-ep-icon { background: #e74c3c; }

.flow-ep-label {
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: var(--panel-bg);
    padding: 1px 6px;
    border-radius: 4px;
    white-space: nowrap;
    backdrop-filter: blur(4px);
}

/* Speed legend overlay */
.flow-speed-legend {
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    color: var(--text);
    font-family: 'Inter', sans-serif;
}
.fsl-title {
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-align: center;
}
.fsl-bar {
    display: flex; align-items: center; gap: 6px;
}
.fsl-gradient {
    width: 100px; height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #2ecc71, #27ae60, #f1c40f, #e67e22, #e74c3c);
}
.fsl-label {
    font-size: 10px; font-weight: 600;
    color: var(--text-muted);
}

/* Interactive Day Timeline */
.flow-timeline {
    position: relative;
    width: 100%;
    height: 52px;
    background: var(--panel-bg);
    border-top: 1px solid var(--sub-border);
    cursor: crosshair;
    flex-shrink: 0;
    grid-column: 1 / -1;
    grid-row: 2;
}
.flow-tl-canvas {
    display: block;
    width: 100%;
    height: 52px;
}
.flow-tl-cursor {
    position: absolute;
    top: 0; bottom: 0;
    width: 1.5px;
    background: rgba(0,184,148,0.9);
    pointer-events: none;
    display: none;
    z-index: 5;
    box-shadow: 0 0 6px rgba(0,184,148,0.5);
}
.flow-tl-tooltip {
    position: absolute;
    bottom: 100%;
    transform: translateX(-50%);
    background: var(--panel-bg);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 5px;
    white-space: nowrap;
    pointer-events: none;
    display: none;
    z-index: 6;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
    margin-bottom: 4px;
    font-family: 'Inter', sans-serif;
}

/* ─── CARDS ───────────────────────────────────────────────── */
.card-dark {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

/* ─── ALERT EVENT DETAIL ──────────────────────────────────── */
.alerts-detail-dialog {
    max-width: min(1520px, 96vw);
}
.alerts-detail-modal .modal-content {
    height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
    display: flex;
}
.alerts-detail-modal .modal-body {
    padding: 12px 14px;
    overflow: auto;
    flex: 1;
}
.alerts-detail-shell {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 8px;
    height: 100%;
    min-height: 0;
}
.alerts-detail-hero {
    background: linear-gradient(135deg, rgba(0,184,148,0.12), rgba(9,132,227,0.08));
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}
.alerts-detail-hero-compact {
    padding: 8px 10px;
}
.alerts-type-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 8px;
    border: 1px solid transparent;
}
.alerts-type-pill.is-danger { color: #ff7b84; background: rgba(231, 76, 60, 0.12); border-color: rgba(231, 76, 60, 0.32); }
.alerts-type-pill.is-success { color: #66e6b4; background: rgba(0, 184, 148, 0.12); border-color: rgba(0, 184, 148, 0.3); }
.alerts-type-pill.is-warning { color: #ffd166; background: rgba(243, 156, 18, 0.12); border-color: rgba(243, 156, 18, 0.32); }
.alerts-type-pill.is-info { color: #74b9ff; background: rgba(9, 132, 227, 0.12); border-color: rgba(9, 132, 227, 0.32); }
.alerts-type-pill.is-secondary { color: #c2c9d2; background: rgba(127, 140, 155, 0.14); border-color: rgba(127, 140, 155, 0.34); }
.alerts-type-pill.is-neutral { color: var(--text-muted); background: rgba(127, 140, 155, 0.12); border-color: rgba(127, 140, 155, 0.3); }
.alerts-detail-hero-main { min-width: 0; }
.alerts-detail-hero-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}
.alerts-detail-hero-sub {
    margin: 6px 0 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.alerts-detail-hero-side {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 8px;
}
.alerts-kpi-mini {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
}
.kpi-mini-label {
    font-size: 11px;
    color: var(--text-muted);
}
.kpi-mini-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}
.alerts-kpis-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.alerts-kpis-grid-compact {
    gap: 6px;
}
.alerts-kpi-card {
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 10px 14px;
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    min-height: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.alerts-kpi-card .kpi-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
}
.alerts-kpi-card .kpi-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-top: 2px;
}
.alerts-reference-layout {
    display: grid;
    grid-template-columns: minmax(760px, 1.7fr) minmax(460px, 1fr);
    gap: 8px;
    min-height: 0;
    align-items: stretch;
    height: clamp(460px, 64vh, 780px);
}
.alerts-right-stack {
    display: grid;
    grid-template-rows: minmax(130px, auto) minmax(0, 1fr);
    gap: 8px;
    min-height: 0;
    height: 100%;
    min-width: 0;
}
.alerts-detail-meta {
    max-height: none;
    min-height: 0;
    overflow: auto;
    padding: 9px 11px;
    scrollbar-width: thin;
}
.alerts-detail-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.alerts-detail-kv {
    font-size: 0.88rem;
    margin-bottom: 8px;
    color: var(--text);
    line-height: 1.35;
}
.alerts-detail-kv b {
    color: var(--text-muted);
    font-weight: 600;
}
.alerts-context-compact {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
}
.alerts-context-compact .ctx-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px;
    align-items: start;
    border-bottom: 1px dashed var(--border);
    padding: 2px 0;
}
.alerts-context-compact .ctx-row:last-child {
    border-bottom: 0;
}
.alerts-context-compact .ctx-key {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    font-weight: 700;
}
.alerts-context-compact .ctx-val {
    font-size: 0.95rem;
    color: var(--text);
    font-weight: 600;
    line-height: 1.3;
}
.alerts-detail-map-wrap {
    min-width: 0;
    padding: 8px;
    display: flex;
    height: 100%;
    position: relative;
}
.alerts-detail-map {
    height: 100%;
    width: 100%;
    min-height: 420px;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.alerts-replay-bar {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 18px;
    z-index: 920;
    padding: 7px 10px;
    border-radius: 10px;
    background: var(--panel-bg);
    backdrop-filter: blur(6px);
}
.alerts-replay-bar .replay-btn {
    width: 32px;
    height: 32px;
}
.alerts-replay-bar .replay-slider {
    height: 5px;
}
.alerts-replay-bar .replay-info {
    font-size: 12px;
}
.alerts-detail-table {
    padding: 10px;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.alerts-event-table thead th {
    position: static;
    background: var(--bg-card);
}
.alerts-detail-table .table-responsive {
    max-height: 100%;
    min-height: 0;
    flex: 1;
    max-width: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.alerts-detail-table .table {
    font-size: 0.8rem;
    table-layout: fixed;
    width: 100%;
}
.alerts-event-table th,
.alerts-event-table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    vertical-align: middle;
}
.alerts-event-table th:nth-child(1),
.alerts-event-table td:nth-child(1) {
    width: 6%;
    text-align: center;
}
.alerts-event-table th:nth-child(3),
.alerts-event-table td:nth-child(3),
.alerts-event-table th:nth-child(4),
.alerts-event-table td:nth-child(4),
.alerts-event-table th:nth-child(5),
.alerts-event-table td:nth-child(5) {
    white-space: nowrap;
}
.alerts-event-table th:nth-child(5),
.alerts-event-table td:nth-child(5) {
    text-align: center;
}
.alerts-event-table th:nth-child(6),
.alerts-event-table td:nth-child(6) {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-size: 0.79rem;
}
.alerts-event-table {
    border-collapse: separate;
    border-spacing: 0 2px;
    width: 100%;
    max-width: 100%;
}
.alerts-event-table tbody tr td {
    background: var(--sub-bg);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    border-left: 0;
    border-right: 0;
}
.alerts-event-table tbody tr td:first-child {
    border-left: 1px solid var(--border);
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}
.alerts-event-table tbody tr td:last-child {
    border-right: 1px solid var(--border);
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}
.alerts-event-table tbody tr:hover td {
    background: rgba(0, 184, 148, 0.08);
}

@media (min-width: 1201px) {
    .alerts-detail-modal .modal-body {
        overflow: auto;
    }
    .alerts-detail-hero {
        padding: 7px 10px;
        gap: 12px;
    }
    .alerts-type-pill {
        margin-bottom: 6px;
    }
    .alerts-detail-hero-title {
        font-size: 1rem;
    }
    .alerts-detail-hero-sub {
        font-size: 0.8rem;
    }
    .alerts-kpis-grid {
        gap: 6px;
    }
    .alerts-reference-layout {
        height: clamp(460px, 64vh, 780px);
    }
    .alerts-detail-map {
        min-height: 440px;
    }
    .alerts-detail-meta {
        max-height: none;
    }
    .alerts-detail-table .table-responsive {
        max-height: 100%;
    }
    .alerts-event-table thead th {
        font-size: 0.82rem;
        letter-spacing: 0.2px;
    }
    .alerts-event-table td {
        padding-top: 5px;
        padding-bottom: 5px;
    }
}

@media (max-width: 992px) {
    .alerts-detail-dialog {
        max-width: 98vw;
    }
    .alerts-detail-modal .modal-body {
        padding: 12px;
    }
    .alerts-detail-hero {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .alerts-detail-hero-side {
        grid-template-columns: 1fr 1fr;
    }
    .alerts-kpis-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .alerts-reference-layout {
        grid-template-columns: 1fr;
        overflow: visible;
        gap: 8px;
        height: auto;
    }
    .alerts-right-stack {
        grid-template-rows: auto auto;
        height: auto;
        gap: 8px;
    }
    .alerts-detail-meta {
        max-height: none;
    }
    .alerts-context-compact .ctx-row {
        grid-template-columns: 96px 1fr;
    }
    .alerts-detail-map {
        height: 360px;
    }
    .alerts-replay-bar {
        left: 14px;
        right: 14px;
        bottom: 14px;
    }
    .alerts-detail-table .table-responsive {
        max-height: 320px;
        overflow: auto;
    }
}

@media (max-width: 1200px) and (min-width: 993px) {
    .alerts-detail-dialog {
        max-width: 98vw;
    }
    .alerts-reference-layout {
        grid-template-columns: minmax(620px, 1.5fr) minmax(390px, 1fr);
        gap: 10px;
        height: clamp(430px, 60vh, 700px);
    }
    .alerts-right-stack {
        grid-template-rows: minmax(120px, auto) minmax(0, 1fr);
        height: 100%;
    }
    .alerts-detail-map {
        min-height: 390px;
    }
    .alerts-detail-table .table {
        font-size: 0.8rem;
    }
    .alerts-detail-table .table-responsive {
        overflow: auto;
    }
    .alerts-event-table th:nth-child(2),
    .alerts-event-table td:nth-child(2) { width: 34%; }
    .alerts-event-table th:nth-child(6),
    .alerts-event-table td:nth-child(6) { width: 22%; }
}

@media (max-width: 768px) {
    .alerts-detail-dialog {
        max-width: 100vw;
        margin: 0;
    }
    .alerts-detail-modal .modal-content {
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    .alerts-detail-modal .modal-body {
        padding: 10px;
    }
    .alerts-detail-hero-main {
        width: 100%;
    }
    .alerts-detail-hero-side {
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }
    .alerts-kpis-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    .alerts-kpi-card {
        min-height: 48px;
        padding: 8px 10px;
    }
    .alerts-detail-map {
        height: 300px;
    }
    .alerts-replay-bar {
        left: 10px;
        right: 10px;
        bottom: 10px;
        padding: 6px 8px;
        gap: 8px;
    }
    .alerts-replay-bar .replay-speed-sel {
        min-width: 62px;
        max-width: 62px;
        font-size: 12px;
    }
    .alerts-context-compact .ctx-row {
        grid-template-columns: 86px 1fr;
        gap: 8px;
    }
    .alerts-detail-table {
        padding: 10px;
    }
    .alerts-detail-table .table {
        font-size: 0.85rem;
    }
}

@media (max-width: 576px) {
    .alerts-detail-hero-title {
        font-size: 0.98rem;
    }
    .alerts-detail-hero-sub {
        font-size: 0.78rem;
    }
    .alerts-kpis-grid {
        grid-template-columns: 1fr;
    }
    .alerts-detail-hero-side {
        grid-template-columns: 1fr;
    }
    .alerts-detail-map {
        height: 250px;
    }
    .alerts-context-compact .ctx-row {
        grid-template-columns: 1fr;
        gap: 2px;
        padding: 6px 0;
    }
    .alerts-context-compact .ctx-key {
        font-size: 11px;
    }
    .alerts-context-compact .ctx-val {
        font-size: 0.9rem;
    }
}

/* ─── GEOFENCES ───────────────────────────────────────────── */
.geo-table-shell {
    background: rgba(255,255,255,0.7);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 20px;
    box-shadow: 0 24px 50px rgba(148, 163, 184, 0.18);
    overflow: hidden;
    backdrop-filter: blur(18px);
}
.geo-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    background:
        linear-gradient(135deg, rgba(255,255,255,0.92), rgba(239,246,255,0.8)),
        radial-gradient(circle at top right, rgba(74,222,128,0.12), transparent 45%);
}
.geo-table-kpis {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.geo-kpi-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.78);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 8px 20px rgba(148, 163, 184, 0.08);
}
.geo-kpi-value {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text);
}
.geo-kpi-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 700;
}
.geo-table-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
    font-size: 0.76rem;
    color: var(--text-muted);
}
.geo-table-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.geo-table-legend .fa-sign-in-alt { color: #10b981; }
.geo-table-legend .fa-sign-out-alt { color: #f59e0b; }
.geo-table-legend .fa-home { color: #4ade80; }
.geo-filter-bar {
    display: grid;
    grid-template-columns: minmax(240px, 1.5fr) repeat(2, minmax(180px, 0.85fr)) auto;
    gap: 12px;
    padding: 14px 18px 8px;
    background: rgba(255,255,255,0.5);
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}
.geo-search-box {
    position: relative;
}
.geo-search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}
.geo-search-box input,
.geo-filter-select {
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(255,255,255,0.86);
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.65);
}
.geo-search-box input {
    width: 100%;
    padding: 0 14px 0 38px;
    outline: none;
}
.geo-search-box input:focus,
.geo-filter-select:focus {
    border-color: rgba(74,222,128,0.35);
    box-shadow: 0 0 0 3px rgba(74,222,128,0.12);
}
.geo-filter-reset {
    height: 40px;
    border-radius: 12px;
    white-space: nowrap;
}
.geo-filter-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 18px 14px;
    font-size: 0.76rem;
    color: var(--text-muted);
}
.geo-filter-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(74,222,128,0.1);
    color: #16a34a;
    border: 1px solid rgba(74,222,128,0.16);
    font-weight: 700;
}
.geo-table {
    font-size: 0.83rem;
    margin: 0;
    table-layout: fixed;
}
.geo-table th {
    background: rgba(248, 250, 252, 0.9);
    font-weight: 800;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    white-space: nowrap;
    padding: 12px 14px;
}
.geo-table td {
    padding: 12px 14px;
    vertical-align: middle;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(255,255,255,0.72);
}
.geo-table tbody tr {
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.geo-table tbody tr:hover td { background: rgba(248, 250, 252, 0.98); }
.geo-table tbody tr:last-child td { border-bottom: none; }
.geo-table th:nth-child(1) { width: 29%; }
.geo-table th:nth-child(2) { width: 28%; }
.geo-table th:nth-child(3) { width: 8%; }
.geo-table th:nth-child(4) { width: 9%; }
.geo-table th:nth-child(5) { width: 10%; }
.geo-table th:nth-child(6) { width: 9%; }
.geo-table th:nth-child(7) { width: 7%; }
.geo-inactive { opacity: 0.62; }
.geo-name-cell {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}
.geo-index-pill {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(74,222,128,0.14), rgba(14,165,233,0.18));
    color: #16a34a;
    font-weight: 800;
    box-shadow: inset 0 0 0 1px rgba(74,222,128,0.12);
}
.geo-name-main {
    min-width: 0;
}
.geo-name-line {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.geo-name-line strong {
    display: block;
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.18;
    word-break: break-word;
}
.geo-subtext {
    margin-top: 3px;
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.3;
}
.geo-name-meta {
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.geo-color-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.14);
}
.geo-color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.95);
    box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.2), 0 6px 14px rgba(15, 23, 42, 0.1);
    vertical-align: middle;
}
.geo-service-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.geo-service-chip {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(241, 245, 249, 0.95), rgba(226, 232, 240, 0.92));
    color: #334155;
    font-size: 0.71rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    border: 1px solid rgba(148, 163, 184, 0.24);
    box-shadow: 0 8px 18px rgba(148, 163, 184, 0.14);
    max-width: 100%;
}
.geo-service-chip.is-empty {
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-muted);
    box-shadow: none;
    border: 1px dashed rgba(148, 163, 184, 0.3);
}
.geo-type-pill,
.geo-radius-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 0 11px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
}
.geo-type-pill {
    background: rgba(100, 116, 139, 0.12);
    color: #475569;
    border: 1px solid rgba(100, 116, 139, 0.18);
}
.geo-radius-pill {
    background: rgba(16, 185, 129, 0.08);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.16);
}
.geo-radius-pill i {
    font-size: 0.68rem;
}
.geo-flags {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 34px;
}
.geo-flag {
    width: 32px;
    height: 32px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    border: 1px solid transparent;
}
.geo-flag.is-on {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    border-color: rgba(16, 185, 129, 0.18);
}
.geo-flag.is-base {
    background: rgba(74, 222, 128, 0.12);
    color: #16a34a;
    border-color: rgba(74, 222, 128, 0.18);
}
.geo-flag.is-off {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-muted);
    border-color: rgba(148, 163, 184, 0.14);
}
.geo-actions {
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 34px;
}
.geo-actions .btn {
    width: 34px;
    height: 34px;
    padding: 0;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    vertical-align: middle;
    flex-shrink: 0;
}
.geo-table td:nth-child(6),
.geo-table td:nth-child(7),
.geo-table th:nth-child(6),
.geo-table th:nth-child(7) {
    text-align: center;
}
.geo-empty-state {
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    color: var(--text-muted);
}
.geo-empty-state i {
    font-size: 1.6rem;
    opacity: 0.55;
}
.geo-empty-state strong {
    color: var(--text);
    font-size: 0.92rem;
}
.geo-empty-state span {
    max-width: 360px;
    line-height: 1.45;
}

@media (max-width: 1200px) {
    .geo-filter-bar {
        grid-template-columns: 1fr 1fr;
    }
    .geo-table {
        table-layout: auto;
    }
    .geo-table th,
    .geo-table td {
        white-space: nowrap;
    }
    .geo-name-line strong,
    .geo-service-chip {
        white-space: normal;
    }
}

@media (max-width: 768px) {
    .geo-table-toolbar,
    .geo-filter-meta {
        flex-direction: column;
        align-items: flex-start;
    }
    .geo-filter-bar {
        grid-template-columns: 1fr;
    }
    .geo-filter-reset {
        width: 100%;
    }
    #page-geofences .vehicles-header {
        padding: 18px 16px;
        gap: 16px;
    }
    #page-geofences .vehicles-header-copy {
        gap: 6px;
    }
    #page-geofences .vehicles-header h3 {
        font-size: 1.9rem;
        line-height: 1.05;
    }
    #page-geofences .vehicles-header-subtitle {
        font-size: 0.98rem;
        line-height: 1.45;
        max-width: none;
    }
    #page-geofences .vehicles-header-actions {
        width: 100%;
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    #page-geofences .vehicles-header-actions .btn {
        width: 100%;
        min-height: 44px;
        justify-content: center;
        border-radius: 12px;
    }
    .geo-table-shell {
        border-radius: 18px;
    }
    .geo-table-toolbar {
        padding: 14px 16px 12px;
    }
    .geo-table-kpis {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    .geo-kpi-chip {
        justify-content: center;
    }
    .geo-table-legend {
        width: 100%;
        justify-content: flex-start;
        gap: 10px 14px;
        font-size: 0.74rem;
    }
    .geo-filter-bar {
        padding: 12px 16px 8px;
    }
    .geo-filter-meta {
        padding: 0 16px 12px;
        width: 100%;
        gap: 6px;
    }
    .geo-filter-meta > span:last-child {
        align-self: flex-start;
    }
    .geo-table {
        border: 0;
    }
    .geo-table thead {
        display: none;
    }
    .geo-table,
    .geo-table tbody,
    .geo-table tr,
    .geo-table td {
        display: block;
        width: 100%;
    }
    .geo-table tbody {
        padding: 10px;
    }
    .geo-table tbody tr {
        margin-bottom: 12px;
        border-radius: 16px;
        overflow: hidden;
        border: 1px solid rgba(148, 163, 184, 0.14);
        box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    }
    .geo-table tbody tr:last-child {
        margin-bottom: 0;
    }
    .geo-table td {
        padding: 10px 12px;
        white-space: normal;
        border-bottom: 1px solid rgba(148, 163, 184, 0.1);
        background: transparent;
    }
    .geo-table td:last-child {
        border-bottom: none;
    }
    .geo-table td:not(:first-child) {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
    }
    .geo-table td:not(:first-child)::before {
        content: attr(data-label);
        flex: 0 0 88px;
        font-size: 0.72rem;
        font-weight: 800;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--text-muted);
        line-height: 1.5;
        padding-top: 3px;
    }
    .geo-name-cell {
        gap: 10px;
    }
    .geo-index-pill {
        width: 30px;
        height: 30px;
    }
    .geo-name-line {
        align-items: flex-start;
        gap: 8px;
    }
    .geo-name-line strong {
        font-size: 0.95rem;
    }
    .geo-service-wrap,
    .geo-flags,
    .geo-actions {
        justify-content: flex-end;
    }
    .geo-service-wrap {
        max-width: calc(100% - 88px);
    }
    .geo-service-chip {
        font-size: 0.74rem;
        padding: 7px 10px;
    }
    .geo-type-pill,
    .geo-radius-pill {
        margin-left: auto;
    }
    .geo-actions {
        gap: 10px;
    }
    .geo-actions .btn {
        width: 36px;
        height: 36px;
    }
    .geo-empty-state {
        min-height: 140px;
        padding: 16px 8px;
    }
}

@media (max-width: 520px) {
    #page-geofences .vehicles-header-actions {
        grid-template-columns: 1fr;
    }
    .geo-table-kpis {
        grid-template-columns: 1fr;
    }
    .geo-table td:not(:first-child) {
        flex-direction: column;
        gap: 8px;
    }
    .geo-table td:not(:first-child)::before {
        flex: none;
        padding-top: 0;
    }
    .geo-service-wrap,
    .geo-flags,
    .geo-actions {
        justify-content: flex-start;
        max-width: 100%;
    }
    .geo-type-pill,
    .geo-radius-pill {
        margin-left: 0;
    }
}

.geo-table-shell {
    background: linear-gradient(180deg, rgba(18,20,28,0.96), rgba(13,15,21,0.94));
    border-color: rgba(255,255,255,0.08);
    box-shadow: 0 24px 60px rgba(0,0,0,0.45);
}
.geo-table-toolbar {
    background:
        radial-gradient(circle at top right, rgba(74,222,128,0.18), transparent 40%),
        linear-gradient(135deg, rgba(20,24,34,0.98), rgba(16,18,27,0.96));
    border-bottom-color: rgba(255,255,255,0.08);
}
.geo-kpi-chip {
    background: rgba(255,255,255,0.03);
    border-color: rgba(255,255,255,0.08);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.geo-kpi-value,
.geo-name-line strong,
.geo-empty-state strong {
    color: #f8fafc;
}
.geo-filter-bar {
    background: rgba(255,255,255,0.025);
    border-bottom-color: rgba(255,255,255,0.06);
}
.geo-search-box input,
.geo-filter-select {
    background: rgba(8,10,16,0.72);
    color: #f8fafc;
    border-color: rgba(255,255,255,0.1);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.geo-search-box input::placeholder {
    color: rgba(226,232,240,0.45);
}
.geo-search-box i {
    color: rgba(226,232,240,0.55);
}
.geo-filter-meta,
.geo-subtext,
.geo-empty-state {
    color: rgba(226,232,240,0.58);
}
.geo-color-chip {
    background: rgba(255,255,255,0.04);
    color: rgba(226,232,240,0.56);
    border-color: rgba(255,255,255,0.08);
}
.geo-table th {
    background: rgba(255,255,255,0.03);
    color: rgba(226,232,240,0.7);
    border-bottom-color: rgba(255,255,255,0.08);
}
.geo-table td {
    background: rgba(255,255,255,0.015);
    border-bottom-color: rgba(255,255,255,0.06);
}
.geo-table tbody tr:hover td {
    background: rgba(74,222,128,0.06);
}
.geo-index-pill {
    background: linear-gradient(135deg, rgba(74,222,128,0.22), rgba(14,165,233,0.18));
    color: #bfdbfe;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 0 0 1px rgba(74,222,128,0.12);
}
.geo-color-dot {
    border-color: rgba(255,255,255,0.92);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 6px 16px rgba(0,0,0,0.35);
}
.geo-service-chip {
    background: linear-gradient(135deg, rgba(51, 65, 85, 0.78), rgba(71, 85, 105, 0.68));
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.14);
    box-shadow: 0 8px 20px rgba(2, 6, 23, 0.14);
}
.geo-service-chip.is-empty {
    background: rgba(255,255,255,0.03);
    color: rgba(226,232,240,0.55);
    border-color: rgba(255,255,255,0.12);
}
.geo-type-pill {
    background: rgba(148,163,184,0.12);
    color: #cbd5e1;
    border-color: rgba(148,163,184,0.16);
}
.geo-radius-pill {
    background: rgba(16,185,129,0.14);
    color: #6ee7b7;
    border-color: rgba(16,185,129,0.18);
}
.geo-flag.is-on {
    background: rgba(16,185,129,0.18);
    color: #6ee7b7;
    border-color: rgba(16,185,129,0.22);
}
.geo-flag.is-base {
    background: rgba(74,222,128,0.18);
    color: #93c5fd;
    border-color: rgba(74,222,128,0.22);
}
.geo-flag.is-off {
    background: rgba(255,255,255,0.04);
    color: rgba(226,232,240,0.38);
    border-color: rgba(255,255,255,0.08);
}
.geo-filter-badge {
    background: rgba(74,222,128,0.16);
    color: #93c5fd;
    border-color: rgba(74,222,128,0.2);
}

/* ─── BENTO GRID DASHBOARD — Futuristic Premium ─── */

/* Keyframes */
@keyframes bentoPulseRing {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 212, 170, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 20px rgba(0, 212, 170, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 212, 170, 0); }
}
@keyframes bentoSlideUp {
    from { opacity: 0; transform: translateY(28px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes bentoShine {
    0% { transform: translateX(-100%) rotate(25deg); }
    100% { transform: translateX(250%) rotate(25deg); }
}
@keyframes bentoFloat {
    0%,100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(2deg); }
}
@keyframes bentoBorderGlow {
    0%,100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ─── Dashboard Cards ─── */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(150px, auto);
    gap: 18px;
    width: 100%;
}
.bento-span-4 { grid-column: span 4; }
.bento-span-2 { grid-column: span 2; }
.bento-row-2 { grid-row: span 2; }

@media (max-width: 1200px) {
    .bento-grid { grid-template-columns: repeat(2, 1fr); }
    .bento-span-4 { grid-column: span 2; }
}
@media (max-width: 768px) {
    .bento-grid { grid-template-columns: 1fr; }
    .bento-span-4, .bento-span-2 { grid-column: span 1; }
    .bento-row-2 { grid-row: span 1; min-height: 200px; }
}

/* ─── Card Base ─── */
.bento-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-xl);
    padding: 28px 26px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: bentoSlideUp 0.5s cubic-bezier(0.16,1,0.3,1) both;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.bento-card:nth-child(1) { animation-delay: 0.04s; }
.bento-card:nth-child(2) { animation-delay: 0.08s; }
.bento-card:nth-child(3) { animation-delay: 0.12s; }
.bento-card:nth-child(4) { animation-delay: 0.16s; }
.bento-card:nth-child(5) { animation-delay: 0.20s; }

.bento-card::after { display: none; }

.bento-card:hover {
    transform: translateY(-4px);
    background: var(--bg-card-hover);
    border-color: var(--accent);
    box-shadow: var(--shadow-lg);
}
.bento-card:active {
    transform: translateY(-2px);
    transition-duration: 0.1s;
}

/* ─── Watermark Icon ─── */
.bento-watermark {
    position: absolute;
    top: -15px;
    right: -15px;
    font-size: 120px;
    opacity: 0.04;
    color: var(--accent);
    transition: all 0.5s ease;
    z-index: 0;
    pointer-events: none;
}
.bento-card:hover .bento-watermark {
    transform: scale(1.05) rotate(-3deg);
    opacity: 0.08;
}

/* ─── Content ─── */
.bento-content {
    position: relative;
    z-index: 1;
}
.bento-value {
    font-size: 3rem;
    font-weight: 800;
    margin: 0;
    line-height: 1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}
.bento-label {
    font-size: 0.82rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin-top: 8px;
    display: block;
    color: var(--text-muted);
}

/* ─── Action Arrow ─── */
.bento-action {
    position: absolute;
    top: 22px;
    right: 22px;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.3s ease;
    z-index: 2;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.bento-card:hover .bento-action {
    transform: translateX(3px);
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
}

/* ─── Pulse Ring (online card) ─── */
.bento-pulse-ring {
    position: absolute;
    bottom: 32px;
    right: 32px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    z-index: 1;
    background: var(--online);
    box-shadow: 0 0 12px var(--accent-glow);
    animation: bentoPulseRing 2s infinite;
}

/* ═══ PER-CARD ACCENTS ═══ */
.bento-live .bento-value {
    color: var(--accent);
    font-weight: 900;
}
.bento-live { border-left: 3px solid var(--accent); }
.bento-secondary { border-left: 3px solid var(--info); }
.bento-glass { border-left: 3px solid var(--text-muted); }
.bento-accent { border-left: 3px solid var(--online); }

/* ─── Hero (transparent header) ─── */
.bento-hero {
    grid-row: span 1;
    padding: 24px 32px;
    background: transparent;
    border: none;
    box-shadow: none;
    justify-content: center;
    cursor: default;
}
.bento-hero:hover { transform: none; box-shadow: none; border: none; }
.bento-hero::before, .bento-hero::after { display: none; }
.bento-hero-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.12), rgba(34, 197, 94, 0.08));
    backdrop-filter: blur(28px) saturate(160%);
    -webkit-backdrop-filter: blur(28px) saturate(160%);
    border: 1px solid var(--glass-border);
    border-radius: 22px;
    z-index: 0;
}
.bento-hero-content {
    position: relative;
    z-index: 1;
}
.bento-hero-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin: 0 0 6px 0;
    background: linear-gradient(90deg, #fff, #94a3b8);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.03em;
}
.bento-hero-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 400;
    margin: 0;
}
/* ─── ENTERPRISES (GeoNex provider panel) ────────────────── */
.enterprises-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}
.enterprise-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 0;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
}
.enterprise-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(74,222,128,0.2), rgba(255,255,255,0.08), transparent);
    z-index: 1;
}
.enterprise-card:hover {
    border-color: rgba(74,222,128,0.3);
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(74,222,128,0.1);
    transform: translateY(-4px);
}
.enterprise-card:hover::before { transform: scaleX(1); }
.enterprise-card-inner {
    padding: 24px 24px 20px;
}
.enterprise-card-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}
.ec-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, #16a34a 0%, #22c55e 50%, #4ade80 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    box-shadow: 0 6px 20px -4px rgba(0,113,227,0.35);
}
.ec-info {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}
.enterprise-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
    line-height: 1.3;
}
.enterprise-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
    font-weight: 500;
    letter-spacing: 0.02em;
}
.enterprise-card-body {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.enterprise-stat {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: 6px 12px;
    background: var(--bg-hover);
    border-radius: 20px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}
.enterprise-card:hover .enterprise-stat {
    border-color: rgba(74,222,128,0.15);
}
.enterprise-stat i {
    color: var(--accent);
    font-size: 0.78rem;
}
.enterprise-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-top: 1px solid var(--glass-border);
    background: rgba(74,222,128,0.02);
}
.enterprise-card-footer .ec-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent);
}
.enterprise-card-footer .ec-status i {
    font-size: 6px;
}
.ec-edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}
.ec-edit-btn:hover {
    color: #16a34a;
    border-color: rgba(0,113,227,0.3);
    background: rgba(0,113,227,0.06);
}
/* Enterprise Detail back bar */
.ed-back-bar {
    margin-bottom: 16px;
}

/* ─── Enterprise Detail ─── */
.ed-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    margin-bottom: 20px;
}
.ed-header-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: linear-gradient(135deg, #16a34a 0%, #22c55e 50%, #4ade80 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
    box-shadow: 0 8px 24px -6px rgba(0,113,227,0.35);
}
.ed-header-info { flex: 1; min-width: 0; }
.ed-header-name {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    margin: 0 0 6px;
}
.ed-header-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.ed-meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 4px 12px;
    background: var(--bg-hover);
    border-radius: 20px;
    border: 1px solid var(--border);
}
.ed-status-active { color: #00b894; }
.ed-status-inactive { color: var(--text-muted); }

.ed-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.ed-kpi {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all 0.2s;
}
.ed-kpi:hover {
    border-color: rgba(0,113,227,0.2);
    box-shadow: 0 4px 16px -4px rgba(0,113,227,0.08);
}
.ed-kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--accent-glow);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.ed-kpi-data { flex: 1; min-width: 0; }
.ed-kpi-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.2;
}
.ed-kpi-value small {
    font-size: 0.75em;
    font-weight: 600;
    color: var(--text-muted);
}
.ed-kpi-value.ed-kpi-text {
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0;
}
.ed-kpi-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 2px;
}

.ed-address {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}
.ed-address i { color: var(--accent); }

.ed-action-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.ed-action-left h5 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 6px;
}
.ed-action-left p {
    font-size: 0.84rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

.my-org-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.my-org-summary {
    margin-bottom: 22px;
}

.my-org-shell {
    display: grid;
    gap: 18px;
}

.my-org-card {
    background: var(--panel-bg-gradient);
    border: 1px solid rgba(94, 114, 228, 0.18);
    border-radius: 20px;
    padding: 22px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.18);
}

.my-org-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 18px;
}

.my-org-title {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.my-org-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(43, 112, 250, 0.24), rgba(56, 189, 248, 0.18));
    color: var(--accent);
    font-size: 1.25rem;
}

.my-org-name {
    margin: 0 0 8px;
    font-size: 1.45rem;
    font-weight: 800;
}

.my-org-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.my-org-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--sub-bg);
    border: 1px solid var(--sub-border);
    color: var(--text-secondary);
    font-size: 0.86rem;
}

.my-org-status.is-active {
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.25);
    background: rgba(20, 83, 45, 0.15);
}

.my-org-status.is-inactive {
    color: #fca5a5;
    border-color: rgba(248, 113, 113, 0.22);
    background: rgba(127, 29, 29, 0.24);
}

.my-org-contact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.my-org-contact-item {
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.my-org-contact-label {
    display: block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.my-org-contact-value {
    color: var(--text-primary);
    word-break: break-word;
}

@media (max-width: 768px) {
    .ed-header { flex-wrap: wrap; }
    .ed-kpis { grid-template-columns: 1fr 1fr; }
    .ed-action-card { flex-direction: column; text-align: center; }
    .my-org-top { flex-direction: column; }
    .my-org-header-actions { width: 100%; }
    .my-org-header-actions .btn { flex: 1 1 auto; }
}

/* Geofence map pins */
.geo-map-preview {
    height: 280px;
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    border: 1px solid var(--border);
    overflow: hidden;
}

/* Geofence form layout */
.geo-form-wrapper {
    display: flex;
    flex: 1;
    width: 100%;
    min-height: 0;
    overflow: hidden;
}
.geo-form-panel {
    width: 380px;
    min-width: 340px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    overflow-y: auto;
}
.geo-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.geo-form-header h4 {
    font-size: 16px;
    margin: 0;
    color: var(--text);
}
.geo-form-body {
    flex: 1;
    padding: 12px 16px;
    overflow-y: auto;
}
.geo-form-body .form-control,
.geo-form-body .form-select {
    background: var(--bg-dark);
    color: var(--text);
    border-color: var(--border);
    font-size: 13px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}
.geo-form-body .form-control:focus,
.geo-form-body .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.geo-form-body .form-check-input {
    background-color: var(--bg-dark);
    border-color: var(--border);
}
.geo-form-body .form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}
.geo-form-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.geo-form-map-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    min-width: 0;
}
.geo-form-map {
    flex: 1;
    min-height: 0;
    min-width: 0;
}
/* Search bar over map */
.geo-search-bar {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.18);
    max-width: 440px;
}
.geo-search-icon {
    color: var(--text-muted);
    font-size: 13px;
    margin-right: 8px;
    flex-shrink: 0;
}
.geo-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    padding: 9px 0;
    min-width: 0;
}
.geo-search-input::placeholder { color: var(--text-muted); }
.geo-search-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 12px;
    flex-shrink: 0;
}
.geo-search-clear:hover { color: var(--text); }
.geo-search-results {
    position: absolute;
    top: 46px;
    left: 10px;
    z-index: 1001;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.22);
    max-width: 440px;
    max-height: 260px;
    overflow-y: auto;
    width: calc(100% - 20px);
}
.geo-search-results .geo-sr-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background .15s;
}
.geo-search-results .geo-sr-item:last-child { border-bottom: none; }
.geo-search-results .geo-sr-item:hover { background: var(--bg-dark); }
.geo-sr-item .geo-sr-icon {
    color: var(--accent);
    font-size: 14px;
    margin-top: 2px;
    flex-shrink: 0;
}
.geo-sr-item .geo-sr-text {
    flex: 1;
    min-width: 0;
}
.geo-sr-item .geo-sr-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.3;
}
.geo-sr-item .geo-sr-addr {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.geo-search-results .geo-sr-empty {
    padding: 14px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}
.geo-search-results .geo-sr-loading {
    padding: 14px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}
.geo-form-map-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
}
/* Geofence map pins */
.geo-center-pin {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, #10b981, #059669);
    border: 2.5px solid #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    cursor: grab;
    transition: box-shadow 0.2s;
}
.geo-center-pin:active { cursor: grabbing; }
.geo-center-pin:hover { box-shadow: 0 4px 16px rgba(16,185,129,0.4); }
.geo-resize-handle {
    width: 24px; height: 24px;
    background: rgba(255,255,255,0.9);
    border: 2px solid var(--accent);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--accent); font-size: 11px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    cursor: ew-resize;
}

/* Geofence circles on main map */
.leaflet-interactive.geo-circle { cursor: pointer; }

@media (max-width: 768px) {
    .geo-form-wrapper { flex-direction: column; }
    .geo-form-panel { width: 100%; min-width: 0; max-height: 50vh; }
    .geo-form-map-container { min-height: 300px; }
}

/* ─── REPORTS ─────────────────────────────────────────────── */

/* Page header */
.rpt-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}
.rpt-page-header-left { display: flex; align-items: center; gap: 14px; }
.rpt-page-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), #0099ff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,184,148,.30);
    flex-shrink: 0;
}
.rpt-page-title { font-size: 22px; font-weight: 800; margin: 0; letter-spacing: -0.02em; }
.rpt-page-subtitle { font-size: 12px; color: var(--text-muted); margin: 2px 0 0; }
.rpt-badge {
    background: rgba(0,184,148,.15);
    color: var(--accent);
    border: 1px solid rgba(0,184,148,.3);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
}

/* Config panel */
.rpt-config-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 22px 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 16px rgba(0,0,0,.15);
}
.rpt-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.rpt-divider {
    height: 1px;
    background: var(--border);
    margin: 20px 0;
}

/* Type cards grid */
.rpt-type-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.rpt-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1.5px solid var(--border);
    background: var(--bg-dark);
    cursor: pointer;
    transition: all 0.18s ease;
    min-width: 78px;
    flex: 0 0 auto;
    user-select: none;
}
.rpt-type-card:hover {
    border-color: var(--accent);
    background: rgba(0,184,148,.06);
    transform: translateY(-2px);
}
.rpt-type-card.rpt-type-active {
    border-color: var(--accent);
    background: rgba(0,184,148,.12);
    box-shadow: 0 0 0 3px rgba(0,184,148,.12);
}
.rpt-type-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
}
.rpt-icon-summary  { background: linear-gradient(135deg,#6c5ce7,#a29bfe); }
.rpt-icon-trips    { background: linear-gradient(135deg,#00b894,#00cec9); }
.rpt-icon-stops    { background: linear-gradient(135deg,#e17055,#d63031); }
.rpt-icon-speed    { background: linear-gradient(135deg,#fdcb6e,#e67e22); }
.rpt-icon-distance { background: linear-gradient(135deg,#0984e3,#74b9ff); }
.rpt-icon-ignition { background: linear-gradient(135deg,#00b894,#55efc4); }
.rpt-icon-activity { background: linear-gradient(135deg,#a29bfe,#6c5ce7); }
.rpt-icon-ptp      { background: linear-gradient(135deg,#fd79a8,#e84393); }
.rpt-icon-fleet    { background: linear-gradient(135deg,#636e72,#2d3436); }
.rpt-icon-dispatch { background: linear-gradient(135deg,#00b894,#0984e3); }
.rpt-type-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
    text-align: center;
    line-height: 1.2;
}
.rpt-type-active .rpt-type-name { color: var(--accent); }

/* Params row */
.rpt-params-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}
.rpt-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 160px;
    min-width: 130px;
}
.rpt-field-vehicle { flex: 2 1 200px; min-width: 180px; }
.rpt-field-time    { flex: 1 1 130px; min-width: 120px; }
.rpt-field-speed   { flex: 1 1 130px; min-width: 110px; }
.rpt-field-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.2px;
}
.rpt-input, .rpt-select {
    background: var(--bg-dark);
    border: 1.5px solid var(--border);
    border-radius: 9px;
    color: var(--text);
    font-size: 13px;
    padding: 8px 12px;
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
    font-variant-numeric: tabular-nums;
    appearance: auto;
}
.rpt-input:focus, .rpt-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,184,148,.12);
}
.rpt-select { cursor: pointer; }

/* ── Searchable device combo ───────────────────────────────── */
.rpt-device-combo {
    position: relative;
    width: 100%;
}
.rpt-device-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.rpt-device-search-icon {
    position: absolute;
    left: 11px;
    font-size: 11px;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}
.rpt-device-input {
    background: var(--bg-dark);
    border: 1.5px solid var(--border);
    border-radius: 9px;
    color: var(--text);
    font-size: 13px;
    padding: 8px 32px 8px 30px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
    cursor: text;
}
.rpt-device-input::placeholder { color: var(--text-muted); font-size: 12px; }
.rpt-device-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,184,148,.12);
}
.rpt-device-clear {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    padding: 4px 5px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
    border-radius: 50%;
    transition: color .14s, background .14s;
}
.rpt-device-clear:hover { color: var(--text); background: rgba(255,255,255,.07); }

/* Dropdown list */
.rpt-device-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    left: 0; right: 0;
    background: var(--bg-card);
    border: 1.5px solid var(--accent);
    border-radius: 11px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 12px 40px rgba(0,0,0,.55), 0 0 0 1px rgba(0,184,148,.1);
    padding: 4px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,184,148,.3) transparent;
}
.rpt-device-dropdown::-webkit-scrollbar { width: 4px; }
.rpt-device-dropdown::-webkit-scrollbar-thumb { background: rgba(0,184,148,.3); border-radius: 99px; }
.rpt-device-dropdown.rdc-open { display: block; }

/* Dropdown item */
.rdc-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 13px;
    cursor: pointer;
    transition: background .1s;
    outline: none;
    gap: 8px;
}
.rdc-item:hover, .rdc-item:focus {
    background: rgba(0,184,148,.1);
}
.rdc-item-all {
    border-bottom: 1px solid var(--border);
    margin-bottom: 3px;
    color: var(--text-muted);
    font-style: italic;
}
.rdc-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
.rdc-item-all .rdc-name { color: var(--text-muted); font-weight: 400; font-size: 12px; }
.rdc-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.rdc-plate {
    font-size: 10.5px;
    font-weight: 700;
    background: rgba(0,184,148,.14);
    border: 1px solid rgba(0,184,148,.25);
    color: #55efc4;
    border-radius: 5px;
    padding: 2px 6px;
    letter-spacing: .5px;
    font-variant-numeric: tabular-nums;
}
.rdc-group {
    font-size: 10px;
    color: var(--text-muted);
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 4px;
    padding: 1px 5px;
}
.rdc-empty {
    padding: 14px 13px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

/* Light theme */

.rpt-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 20px;
}
.rpt-btn-generate {
    background: linear-gradient(135deg, var(--accent), #0099ff);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 11px 26px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s;
    box-shadow: 0 4px 14px rgba(0,184,148,.30);
    letter-spacing: 0.2px;
    white-space: nowrap;
}
.rpt-btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,184,148,.40);
}
.rpt-btn-generate:active { transform: translateY(0); }
.rpt-shortcut-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.rpt-pill {
    background: var(--bg-dark);
    border: 1.5px solid var(--border);
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    padding: 5px 14px;
    cursor: pointer;
    transition: all 0.15s;
}
.rpt-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(0,184,148,.06);
}

/* Results container */
.rpt-results { animation: fadeInUp 0.3s ease; }

/* Stat cards */
.report-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.report-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px 16px;
    text-align: center;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}
.report-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    border-radius: 3px 3px 0 0;
}
.report-stat-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 20px rgba(0,184,148,.12);
    transform: translateY(-2px);
}
.report-stat-card .stat-icon {
    font-size: 20px;
    margin-bottom: 8px;
    opacity: 0.7;
}
.report-stat-card .stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.03em;
    line-height: 1;
}
.report-stat-card .stat-unit {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: 2px;
}
.report-stat-card .stat-label {
    font-size: 10.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 600;
    margin-top: 8px;
}

/* ─── REPORTE RESUMEN — DISEÑO PROFESIONAL ──────────────────── */
.rsm-wrap {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 4px 0;
}

/* --- Header vehiculo --- */
.rsm-header {
    display: flex;
    align-items: center;
    gap: 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px 24px;
    border-left: 4px solid var(--accent);
}
.rsm-header-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: rgba(0,184,148,.12);
    border: 1px solid rgba(0,184,148,.25);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 22px;
    color: var(--accent);
}
.rsm-header-info {
    flex: 1;
    min-width: 0;
}
.rsm-header-name {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -.02em;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rsm-header-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.rsm-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.rsm-badge-plate  { background: rgba(52,152,219,.14); color: #74b9e6; border: 1px solid rgba(52,152,219,.25); }
.rsm-badge-driver { background: rgba(155,89,182,.14); color: #c39bd3; border: 1px solid rgba(155,89,182,.25); }
.rsm-badge-group  { background: rgba(0,184,148,.13);  color: var(--accent); border: 1px solid rgba(0,184,148,.25); }
.rsm-header-period {
    text-align: right;
    flex-shrink: 0;
}
.rsm-period-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 5px;
}
.rsm-period-range {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
    font-size: 11px;
    color: var(--text-muted);
    font-family: ui-monospace, monospace;
}

/* --- KPI Grid --- */
.rsm-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}
@media (max-width: 900px) {
    .rsm-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
    .rsm-kpi-grid { grid-template-columns: 1fr; }
}

.rsm-kpi {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: transform .15s, box-shadow .15s;
    position: relative;
    overflow: hidden;
}
.rsm-kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(0,0,0,.25);
}
.rsm-kpi::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    border-radius: 0 0 14px 14px;
    opacity: .7;
}
.rsm-kpi-blue::after   { background: #3498db; }
.rsm-kpi-orange::after { background: #e67e22; }
.rsm-kpi-teal::after   { background: #00b894; }
.rsm-kpi-purple::after { background: #9b59b6; }
.rsm-kpi-green::after  { background: #27ae60; }
.rsm-kpi-cyan::after   { background: #00cec9; }

.rsm-kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}
.rsm-kpi-blue   .rsm-kpi-icon { background: rgba(52,152,219,.14);  color: #74b9e6; }
.rsm-kpi-orange .rsm-kpi-icon { background: rgba(230,126,34,.14);  color: #e67e22; }
.rsm-kpi-teal   .rsm-kpi-icon { background: rgba(0,184,148,.14);   color: #00b894; }
.rsm-kpi-purple .rsm-kpi-icon { background: rgba(155,89,182,.14);  color: #c39bd3; }
.rsm-kpi-green  .rsm-kpi-icon { background: rgba(39,174,96,.14);   color: #55efc4; }
.rsm-kpi-cyan   .rsm-kpi-icon { background: rgba(0,206,201,.14);   color: #00cec9; }

.rsm-kpi-body { flex: 1; min-width: 0; }
.rsm-kpi-val {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1;
    color: var(--text);
    margin-bottom: 3px;
}
.rsm-kpi-unit {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 2px;
    letter-spacing: 0;
}
.rsm-kpi-lbl {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 3px;
}
.rsm-kpi-sub {
    font-size: 11px;
    color: var(--text-muted);
    opacity: .7;
}

/* --- Activity bar --- */
.rsm-activity {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 22px;
}
.rsm-activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.rsm-activity-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-muted);
}
.rsm-activity-pct {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
}
.rsm-activity-bar {
    display: flex;
    height: 32px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--border);
}
.rsm-activity-fill {
    background: linear-gradient(90deg, #00b894, #00cec9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    transition: width .5s ease;
    min-width: 0;
    overflow: hidden;
}
.rsm-activity-rest {
    background: rgba(255,255,255,.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    transition: width .5s ease;
    min-width: 0;
    overflow: hidden;
}
.rsm-activity-legend {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 11px;
    color: var(--text-muted);
}
.rsm-act-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.rsm-act-on  { background: #00b894; }
.rsm-act-off { background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.2); }

/* ─── REPORTE PARADAS — TIMELINE ───────────────────────────── */
.stops-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}
.stops-list-header {
    padding: 14px 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0;
}
.stops-list-count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    background: rgba(0,184,148,.12);
    color: var(--accent);
    border: 1px solid rgba(0,184,148,.2);
    border-radius: 20px;
    padding: 2px 10px;
}
.stops-list {
    max-height: 560px;
    overflow-y: auto;
    padding: 8px 0;
}
.stops-row {
    display: flex;
    align-items: flex-start;
    gap: 0;
    padding: 10px 20px;
    transition: background .12s;
}
.stops-row:hover { background: rgba(255,255,255,.03); }
.stops-num {
    width: 28px;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    padding-top: 2px;
    text-align: right;
    padding-right: 10px;
}
.stops-timeline {
    width: 20px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}
.stops-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid;
    flex-shrink: 0;
    z-index: 1;
    margin-top: 3px;
}
.stops-tier-yellow { border-color: #f9ca24; background: rgba(249,202,36,.15); }
.stops-tier-orange { border-color: #e67e22; background: rgba(230,126,34,.15); }
.stops-tier-red    { border-color: #e74c3c; background: rgba(231,76,60,.15); }
.stops-line {
    width: 2px;
    flex: 1;
    min-height: 28px;
    background: var(--border);
    margin-top: 2px;
}
.stops-line-last { background: transparent; }
.stops-body {
    flex: 1;
    min-width: 0;
    padding-left: 12px;
    padding-bottom: 8px;
}
.stops-header-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}
.stops-time-range {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 5px;
}
.stops-arrow { color: var(--text-muted); font-size: 11px; }
.stops-date {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 4px;
}
.stops-dur-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 20px;
    border: 1px solid;
    margin-left: auto;
    white-space: nowrap;
}
.stops-dur-badge.stops-tier-yellow { background: rgba(249,202,36,.12); color: #f9ca24; border-color: rgba(249,202,36,.3); }
.stops-dur-badge.stops-tier-orange { background: rgba(230,126,34,.12); color: #e67e22; border-color: rgba(230,126,34,.3); }
.stops-dur-badge.stops-tier-red    { background: rgba(231,76,60,.12);  color: #e74c3c; border-color: rgba(231,76,60,.3); }
.stops-coords {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}
.stops-addr-cell { font-family: ui-monospace, monospace; font-size: 11px; }
.stops-addr-cell.resolved { font-family: inherit; color: var(--text); }

/* ── Stops layout: map + list ──────────────────────────────── */
.stops-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 14px;
    align-items: start;
}
@media (max-width: 860px) {
    .stops-layout { grid-template-columns: 1fr; }
}
.stops-map-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    position: sticky;
    top: 70px;
}
.stops-map {
    height: 520px;
    width: 100%;
}

/* ── Stops map markers ─────────────────────────────────────── */
.stops-map-marker {
    width: 28px;
    height: 28px;
    border-radius: 50% 50% 50% 4px;
    transform: rotate(-45deg);
    background: var(--c, #f9ca24);
    border: 2px solid rgba(255,255,255,.35);
    box-shadow: 0 2px 8px rgba(0,0,0,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
}
.stops-map-marker span {
    transform: rotate(45deg);
    display: block;
}

/* ── Stops popup ───────────────────────────────────────────── */
.stops-leaflet-popup .leaflet-popup-content-wrapper {
    background: #0f1923;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0,0,0,.55);
    color: #e8eaed;
    padding: 0;
}
.stops-leaflet-popup .leaflet-popup-tip {
    background: #0f1923;
}
.stops-leaflet-popup .leaflet-popup-content {
    margin: 0;
}
.stops-popup {
    padding: 13px 16px;
    min-width: 170px;
}
.stops-popup-num {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 4px;
    opacity: .85;
}
.stops-popup-time {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2px;
}
.stops-popup-dur {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
}
.stops-popup-addr {
    font-size: 11px;
    color: rgba(255,255,255,.55);
    line-height: 1.4;
    word-break: break-word;
}

/* Active row highlight */
.stops-row-active {
    background: rgba(0,184,148,.07) !important;
    border-left: 3px solid var(--accent);
}

/* Light theme overrides */
/* Legacy compat */
.report-controls { display: none; }
.form-label-sm { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; display: block; }

/* ─── PTP: KPI BAR ──────────────────────────────────────── */
.ptp-kpi-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.ptp-kpi-item {
    flex: 1 1 140px;
    min-width: 120px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 14px 14px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    position: relative;
    overflow: hidden;
    transition: transform .15s, box-shadow .15s;
}
.ptp-kpi-item:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.ptp-kpi-item::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
}
.ptp-kpi-blue::before   { background: linear-gradient(90deg,#0984e3,#74b9ff); }
.ptp-kpi-green::before  { background: linear-gradient(90deg,#00b894,#55efc4); }
.ptp-kpi-orange::before { background: linear-gradient(90deg,#e17055,#fdcb6e); }
.ptp-kpi-purple::before { background: linear-gradient(90deg,#6c5ce7,#a29bfe); }
.ptp-kpi-teal::before   { background: linear-gradient(90deg,#00cec9,#81ecec); }
.ptp-kpi-ico {
    font-size: 13px;
    margin-bottom: 6px;
    opacity: .55;
}
.ptp-kpi-blue .ptp-kpi-ico   { color: #74b9ff; }
.ptp-kpi-green .ptp-kpi-ico  { color: #55efc4; }
.ptp-kpi-orange .ptp-kpi-ico { color: #fdcb6e; }
.ptp-kpi-purple .ptp-kpi-ico { color: #a29bfe; }
.ptp-kpi-teal .ptp-kpi-ico   { color: #81ecec; }
.ptp-kpi-val {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    line-height: 1;
}
.ptp-kpi-unit {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: 2px;
}
.ptp-kpi-lbl {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 700;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ─── PTP: IDENTITY CARD ────────────────────────────────── */
.ptp-identity-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg,rgba(0,184,148,.06),rgba(0,153,255,.04));
    border: 1px solid rgba(0,184,148,.22);
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 14px;
}
.ptp-identity-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg,var(--accent),#0099ff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(0,184,148,.25);
}
.ptp-identity-body { flex: 1; min-width: 0; }
.ptp-identity-name {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ptp-identity-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    flex-wrap: wrap;
}
.ptp-plate {
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .5px;
    color: var(--text);
}
.ptp-imei-badge {
    font-size: 11px;
    color: var(--text-muted);
    font-family: ui-monospace, monospace;
}
.ptp-identity-driver {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}
.ptp-identity-badge {
    text-align: center;
    flex-shrink: 0;
    background: rgba(0,184,148,.1);
    border: 1px solid rgba(0,184,148,.25);
    border-radius: 12px;
    padding: 10px 18px;
}
.ptp-identity-badge-num {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.03em;
    line-height: 1;
}
.ptp-identity-badge-lbl {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-muted);
    font-weight: 700;
    margin-top: 3px;
}

/* ─── PTP: FILTER BAR ───────────────────────────────────── */
.ptp-filterbar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.ptp-search-wrap {
    position: relative;
    flex: 1 1 220px;
    min-width: 160px;
}
.ptp-search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 12px;
    pointer-events: none;
}
.ptp-search-input {
    width: 100%;
    background: var(--bg-dark);
    border: 1.5px solid var(--border);
    border-radius: 9px;
    color: var(--text);
    font-size: 13px;
    padding: 7px 12px 7px 32px;
    outline: none;
    transition: border-color .15s;
}
.ptp-search-input::placeholder { color: var(--text-muted); }
.ptp-search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,184,148,.1); }
.ptp-filter-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}
.ptp-fpill {
    background: var(--bg-dark);
    border: 1.5px solid var(--border);
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 600;
    padding: 5px 12px;
    cursor: pointer;
    transition: all .15s;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
.ptp-fpill:hover { border-color: var(--accent); color: var(--accent); }
.ptp-fpill-active { border-color: var(--accent) !important; color: var(--accent) !important; background: rgba(0,184,148,.1) !important; }
.ptp-fpill-danger:hover, .ptp-fpill-danger.ptp-fpill-active { border-color: #e74c3c !important; color: #e74c3c !important; background: rgba(231,76,60,.1) !important; }

/* ─── PTP: LAYOUT ───────────────────────────────────────── */
.ptp-layout {
    --ptp-panel-h: clamp(460px, 74vh, 820px);
    display: grid;
    grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr);
    gap: 14px;
    align-items: stretch;
}
.ptp-layout-map,
.ptp-layout-table { min-width: 0; }
.ptp-map {
    height: var(--ptp-panel-h);
    min-height: 0;
    border-radius: 14px;
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,.15);
}
.ptp-table-shell {
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow-y: auto;
    overflow-x: hidden;
    height: var(--ptp-panel-h);
    background: var(--bg-card);
    box-shadow: 0 2px 12px rgba(0,0,0,.12);
    /* Custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(0,184,148,.3) transparent;
}
.ptp-table-shell::-webkit-scrollbar { width: 5px; }
.ptp-table-shell::-webkit-scrollbar-track { background: transparent; }
.ptp-table-shell::-webkit-scrollbar-thumb { background: rgba(0,184,148,.3); border-radius: 99px; }

/* ─── PTP: TABLE ─────────────────────────────────────────── */
.ptp-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
    font-size: 12.5px;
}
.ptp-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--bg-card);
    border-bottom: 2px solid var(--border);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-muted);
    padding: 10px 8px;
    white-space: nowrap;
}
.ptp-table tbody tr {
    transition: background .14s ease;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}
.ptp-table tbody tr:hover {
    background: rgba(0,184,148,.05) !important;
}
.ptp-table td {
    vertical-align: middle;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(255,255,255,.04);
    line-height: 1.3;
    overflow: hidden;
}

/* Row state colors */
.ptp-row-on    { border-left: 3px solid rgba(39,174,96,.4); }
.ptp-row-off   { border-left: 3px solid rgba(231,76,60,.3); }
.ptp-row-speeding { border-left: 3px solid rgba(231,76,60,.7); background: rgba(231,76,60,.03); }
.ptp-row-active {
    background: rgba(0,184,148,.09) !important;
    box-shadow: inset 3px 0 0 var(--accent);
}

/* Column widths — simplified (Detalle col removed) */
.ptp-col-idx    { width: 42px; text-align: center; padding-left: 6px; padding-right: 6px; }
.ptp-col-dt     { width: 100px; }
.ptp-col-loc    { }  /* auto — takes remaining space */
.ptp-col-speed  { width: 90px; text-align: center; }
.ptp-col-state  { width: 115px; text-align: center; }
.ptp-col-tags   { width: 160px; }
.ptp-col-ib     { width: 90px; }
.ptp-col-driver { width: 130px; }
.ptp-col-detail { display: none; }  /* column removed */

/* Index badge */
.ptp-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg,#0984e3,#74b9ff);
    box-shadow: 0 2px 6px rgba(9,132,227,.3);
}

/* Date/time cell */
.ptp-time {
    font-weight: 700;
    font-size: 13px;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    white-space: nowrap;
}
.ptp-date {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.1;
    margin-top: 2px;
    white-space: nowrap;
}

/* Location cell — single truncated line */
.ptp-address-main {
    display: block;
    font-size: 12px;
    line-height: 1.3;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.ptp-address-coords { display: none; }
.ptp-mini-course    { display: none; }
.ptp-cell-muted { color: var(--text-muted); }
.ptp-ibutton {
    font-size: 10px;
    background: rgba(255,255,255,.06);
    border-radius: 4px;
    padding: 2px 5px;
    color: var(--text-muted);
    font-family: ui-monospace, monospace;
}

/* State + Speed chips */
.ptp-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 8px;
    border: 1px solid transparent;
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}
.ptp-chip-speed-stop {
    background: rgba(148,163,184,.1);
    border-color: rgba(148,163,184,.2);
    color: var(--text-muted);
}
.ptp-chip-speed-moving {
    background: rgba(0,184,148,.12);
    border-color: rgba(0,184,148,.25);
    color: #55efc4;
}
.ptp-chip-speed-high {
    background: rgba(231,76,60,.15);
    border-color: rgba(231,76,60,.30);
    color: #ff8b8b;
    animation: ptp-pulse-danger 1.4s ease-in-out infinite;
}
@keyframes ptp-pulse-danger {
    0%,100% { box-shadow: 0 0 0 0 rgba(231,76,60,.0); }
    50% { box-shadow: 0 0 0 4px rgba(231,76,60,.15); }
}
.ptp-chip-on {
    background: rgba(39,174,96,.12);
    border-color: rgba(39,174,96,.28);
    color: #55efc4;
}
.ptp-chip-off {
    background: rgba(231,76,60,.12);
    border-color: rgba(231,76,60,.28);
    color: #ff8b8b;
}
.ptp-chip-unknown {
    background: rgba(241,196,15,.12);
    border-color: rgba(241,196,15,.28);
    color: #f4d35e;
}

/* Detail col — hidden */
.ptp-detail { display: none; }

/* Driver */
.ptp-driver-name { font-size: 12px; color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ptp-driver-meta { display: none; }

/* Tags — compact horizontal */
.ptp-tags-wrap { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.ptp-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text);
    border: 1px solid rgba(148,163,184,.2);
    background: rgba(148,163,184,.1);
    white-space: nowrap;
}
.ptp-tag--ignition { background: rgba(39,174,96,.14); border-color: rgba(39,174,96,.28); color: #55efc4; }
.ptp-tag--stopped  { background: rgba(148,163,184,.14); border-color: rgba(148,163,184,.26); }
.ptp-tag--moving   { background: rgba(0,206,201,.12); border-color: rgba(0,206,201,.25); color: #81ecec; }
.ptp-tag--source   { background: rgba(116,185,255,.12); border-color: rgba(116,185,255,.25); color: #74b9ff; }
.ptp-tag--event    { background: rgba(162,155,254,.13); border-color: rgba(162,155,254,.26); color: #a29bfe; }
.ptp-tag--speed    { background: rgba(231,76,60,.14); border-color: rgba(231,76,60,.28); color: #ff8b8b; }
.ptp-tag-more {
    background: rgba(255,255,255,.05);
    border-color: rgba(255,255,255,.14);
    color: var(--text-muted);
    font-weight: 700;
    cursor: pointer;
    transition: all .14s;
    padding: 2px 6px;
}
.ptp-tag-more:hover { background: rgba(0,184,148,.1); color: var(--accent); }
.ptp-tags-more { display: none; padding-top: 4px; }
.ptp-tags-more.show { display: flex; flex-wrap: wrap; gap: 3px; }

/* Empty state */
.ptp-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
}

/* Light theme */
/* Legacy compat (unused but keep to avoid breaking anything) */
.ptp-meta { display: none; }
.ptp-toolbar { display: none; }

/* ─── PTP MAP LAYER SWITCHER ─────────────────────────────── */
.ptp-layer-switcher {
    position: relative;
    margin: 10px;
}
.ptp-ls-toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(14, 22, 32, 0.90);
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 9px;
    color: #e8eaed;
    font-size: 12px;
    font-weight: 600;
    padding: 7px 13px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 14px rgba(0,0,0,.45);
    transition: background .15s, border-color .15s;
    white-space: nowrap;
    letter-spacing: .2px;
}
.ptp-ls-toggle:hover,
.ptp-ls-toggle.ptp-ls-open {
    background: rgba(0,184,148,.18);
    border-color: rgba(0,184,148,.4);
    color: #fff;
}
.ptp-ls-toggle i {
    font-size: 13px;
    color: var(--accent);
}
.ptp-ls-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    flex-direction: column;
    gap: 3px;
    background: rgba(14, 22, 32, 0.95);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 10px;
    padding: 5px;
    backdrop-filter: blur(10px);
    box-shadow: 0 6px 22px rgba(0,0,0,.55);
    min-width: 110px;
    z-index: 9999;
}
.ptp-ls-btn {
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 7px;
    color: rgba(255,255,255,.65);
    font-size: 11px;
    font-weight: 600;
    padding: 6px 14px;
    cursor: pointer;
    transition: all .15s;
    text-align: left;
    white-space: nowrap;
    letter-spacing: .2px;
    width: 100%;
}
.ptp-ls-btn:hover {
    background: rgba(0,184,148,.15);
    color: #fff;
    border-color: rgba(0,184,148,.3);
}
.ptp-ls-btn.ptp-ls-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,184,148,.4);
}

/* ─── PTP MAP ────────────────────────────────────────────── */

/* Leaflet wrapper overrides */
.ptp-pin-wrapper,
.ptp-arrow-wrapper {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* Start / End pins — rotated diamond */
.ptp-map-pin {
    width: 30px;
    height: 30px;
    border-radius: 50% 50% 50% 4px;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,.6), 0 0 0 2px rgba(255,255,255,.15);
    border: 2px solid rgba(255,255,255,.22);
}
.ptp-map-pin i { transform: rotate(45deg); font-size: 10px; }
.ptp-map-pin-start { background: linear-gradient(135deg, #00b894, #55efc4); }
.ptp-map-pin-end   { background: linear-gradient(135deg, #e74c3c, #fd79a8); }

/* Direction arrows along route */
.ptp-route-arrow {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: rgba(0, 210, 255, 0.72);
    transform-origin: center center;
    pointer-events: none;
    text-shadow: 0 0 6px rgba(0,0,0,.9);
    line-height: 1;
}

/* Focus ring pulse animation */
.ptp-focus-ring {
    animation: ptp-ring-pulse 1.8s ease-in-out infinite;
}
@keyframes ptp-ring-pulse {
    0%, 100% { opacity: 0.9; stroke-width: 2.5; }
    50%       { opacity: 0.25; stroke-width: 4; }
}

/* Dark popup card */
.ptp-leaflet-popup .leaflet-popup-content-wrapper {
    background: rgba(14, 22, 32, 0.97);
    border: 1px solid rgba(0, 210, 255, 0.2);
    border-radius: 12px;
    box-shadow: 0 10px 36px rgba(0,0,0,.65), 0 0 0 1px rgba(0,210,255,.08);
    color: #e8eaed;
    padding: 0;
    overflow: hidden;
}
.ptp-leaflet-popup .leaflet-popup-tip-container { display: none; }
.ptp-leaflet-popup .leaflet-popup-content { margin: 0; padding: 0; }
.ptp-leaflet-popup .leaflet-popup-close-button {
    color: rgba(255,255,255,.45) !important;
    font-size: 16px !important;
    top: 8px !important; right: 8px !important;
}
.ptp-leaflet-popup .leaflet-popup-close-button:hover { color: #fff !important; }

/* Popup inner layout */
.ptp-popup {
    padding: 12px 14px 10px;
    min-width: 170px;
}
.ptp-popup-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: #00d2ff;
    margin-bottom: 5px;
    opacity: .85;
}
.ptp-popup-time {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.5px;
}
.ptp-popup-date {
    font-size: 11px;
    color: rgba(255,255,255,.45);
    margin-top: 2px;
    margin-bottom: 8px;
}
.ptp-popup-location {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    background: rgba(0,210,255,.07);
    border: 1px solid rgba(0,210,255,.15);
    border-radius: 8px;
    padding: 7px 9px;
    margin-bottom: 5px;
    font-size: 12px;
    line-height: 1.35;
}
.ptp-popup-location i {
    color: #00d2ff;
    font-size: 10px;
    margin-top: 2px;
    flex-shrink: 0;
}
.ptp-popup-addr {
    color: rgba(255,255,255,.88);
    font-weight: 500;
    word-break: break-word;
    white-space: normal;
    line-height: 1.4;
    font-size: 12px;
}
.ptp-addr-progress {
    padding: 7px 14px;
    font-size: 12px;
    color: #00b894;
    background: rgba(0,184,148,.08);
    border-bottom: 1px solid rgba(0,184,148,.15);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: opacity .3s;
}
.ptp-popup-resolving {
    color: #8b95a0;
    font-style: italic;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.ptp-popup-coords {
    font-size: 10px;
    color: rgba(255,255,255,.3);
    font-family: ui-monospace, monospace;
    letter-spacing: .3px;
    margin-bottom: 8px;
    padding-left: 2px;
}
.ptp-popup-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.ptp-popup-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
}
.ptp-popup-speed-moving {
    background: rgba(0,184,148,.15);
    border-color: rgba(0,184,148,.3);
    color: #55efc4;
}
.ptp-popup-speed-danger {
    background: rgba(231,76,60,.16);
    border-color: rgba(231,76,60,.35);
    color: #ff8b8b;
}
.ptp-popup-speed-stop {
    background: rgba(148,163,184,.1);
    border-color: rgba(148,163,184,.2);
    color: rgba(255,255,255,.4);
}
.ptp-popup-ign-on {
    background: rgba(39,174,96,.13);
    border-color: rgba(39,174,96,.28);
    color: #55efc4;
}
.ptp-popup-ign-off {
    background: rgba(231,76,60,.11);
    border-color: rgba(231,76,60,.24);
    color: #fab1a0;
}

/* ─── TABLES ──────────────────────────────────────────────── */
.table-dark {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--border);
    --bs-table-hover-bg: var(--bg-hover);
    font-size: 13px;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}
.table-dark thead th {
    background: var(--bg-card);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    border-top: none;
    white-space: nowrap;
    padding: 12px 16px;
}
.table-dark tbody tr {
    transition: background var(--transition-fast);
}
.table-dark tbody tr:hover {
    background: var(--bg-hover);
}
.table-dark tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-subtle);
}
.table-responsive, .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}
/* Tablas en páginas con has-max: card */
.page-content.has-max .table-responsive {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.page-content.has-max .table-responsive .table {
    margin-bottom: 0;
}
.page-content.has-max .table-responsive .table thead th {
    border-radius: 0;
}
.page-content.has-max .table-responsive .table thead th:first-child {
    border-radius: var(--radius-md) 0 0 0;
}
.page-content.has-max .table-responsive .table thead th:last-child {
    border-radius: 0 var(--radius-md) 0 0;
}
.page-content.has-max .table-responsive .table tbody tr:last-child td {
    border-bottom: none;
}
.page-content.has-max .table-responsive .table tbody tr:last-child td:first-child {
    border-radius: 0 0 0 var(--radius-md);
}
.page-content.has-max .table-responsive .table tbody tr:last-child td:last-child {
    border-radius: 0 0 var(--radius-md) 0;
}

/* ─── PAGE ADMIN: tabla contenida, distribución ───────────── */
#page-admin .page-content,
#page-my-org .page-content {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.users-table-shell {
    position: relative;
    background:
        radial-gradient(circle at top right, rgba(74, 222, 128, 0.12), transparent 34%),
        linear-gradient(180deg, rgba(18, 18, 18, 0.94), rgba(8, 8, 8, 0.96));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    box-shadow: 0 22px 55px rgba(0, 0, 0, 0.34);
    overflow: hidden;
}

.users-table-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), transparent 38%);
}

.users-table-toolbar {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    padding: 24px 24px 18px;
}

.users-table-copy {
    max-width: 760px;
}

.users-table-kicker {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    margin-bottom: 10px;
    border-radius: 999px;
    background: rgba(74, 222, 128, 0.12);
    border: 1px solid rgba(74, 222, 128, 0.16);
    color: #86efac;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.users-table-copy h4 {
    margin: 0;
    font-size: 1.32rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #f8fafc;
}

.users-table-copy p {
    margin: 8px 0 0;
    color: rgba(228, 232, 240, 0.76);
    line-height: 1.6;
    font-size: 0.95rem;
}

.users-table-metric {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 118px;
    padding: 12px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    font-size: 0.92rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.users-table-wrap {
    position: relative;
    z-index: 1;
    margin: 0 18px 18px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.02);
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.users-modern-table {
    table-layout: fixed;
    margin: 0;
    width: 100%;
    max-width: 100%;
}

.users-modern-table thead th {
    background: rgba(255, 255, 255, 0.035);
    font-size: 10px;
    letter-spacing: 0.16em;
    color: rgba(228, 232, 240, 0.54);
    padding: 14px 14px;
    white-space: normal;
}

.users-modern-table th:nth-child(1),
.users-modern-table td:nth-child(1) { width: 20%; }
.users-modern-table th:nth-child(2),
.users-modern-table td:nth-child(2) { width: 12%; }
.users-modern-table th:nth-child(3),
.users-modern-table td:nth-child(3) { width: 25%; }
.users-modern-table th:nth-child(4),
.users-modern-table td:nth-child(4) { width: 22%; }
.users-modern-table th:nth-child(5),
.users-modern-table td:nth-child(5) { width: 8%; }
.users-modern-table th:nth-child(6),
.users-modern-table td:nth-child(6) { width: 13%; }

.users-modern-table td {
    padding: 15px 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    background: rgba(255, 255, 255, 0.01);
    min-width: 0;
    vertical-align: top;
}

.users-modern-table td > * {
    min-width: 0;
    max-width: 100%;
}

.users-modern-table tbody tr {
    transition: transform var(--transition-fast), background var(--transition-fast);
}

.users-modern-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.04);
}

.users-person-cell {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}

.users-person-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.22), rgba(56, 189, 248, 0.18));
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.users-person-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
    width: 100%;
}

.users-person-name {
    color: #f8fafc;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.users-person-meta {
    color: var(--text-muted);
    font-size: 0.76rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.users-role-cell,
.users-status-cell,
.users-actions-cell {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
}

.users-contact-cell,
.users-access-cell {
    display: grid;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.users-contact-line {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: #e2e8f0;
    font-size: 0.8rem;
    min-width: 0;
}

.users-contact-line i {
    width: 14px;
    color: rgba(74, 222, 128, 0.86);
    flex-shrink: 0;
}

.users-contact-line span {
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: normal;
    line-height: 1.35;
}

.users-contact-line.is-empty {
    color: var(--text-muted);
}

.users-contact-line.is-empty i {
    color: rgba(164, 176, 190, 0.72);
}

.users-access-main {
    color: #f8fafc;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
}

.users-access-sub {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: normal;
    overflow-wrap: anywhere;
}

.users-access-cell.is-empty .users-access-main {
    color: rgba(226, 232, 240, 0.72);
}

.users-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    color: #f8fafc;
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    width: auto;
    min-width: 46px;
    justify-content: center;
}

.users-action-btn:hover {
    background: rgba(74, 222, 128, 0.12);
    border-color: rgba(74, 222, 128, 0.22);
    color: #f8fafc;
}

.users-action-btn span {
    font-size: 0.78rem;
}

@media (max-width: 1500px) {
    .users-action-btn span {
        display: none;
    }

    .users-action-btn {
        width: 46px;
        padding-inline: 0;
    }
}

@media (max-width: 1280px) {
    .users-action-btn {
        padding-inline: 10px;
        justify-content: center;
    }

    .users-action-btn span {
        display: none;
    }
}

.users-table-shell .text-center.text-muted {
    color: rgba(228, 232, 240, 0.68) !important;
    padding: 34px 20px !important;
}

.users-filter-summary {
    padding: 10px 24px 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.35;
}

@media (max-width: 980px) {
    .users-table-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .users-table-metric {
        min-width: 0;
    }

    .users-filter-summary {
        padding: 10px 16px 0;
    }

    .users-modern-table,
    .users-modern-table tbody,
    .users-modern-table tr,
    .users-modern-table td {
        display: block;
        width: 100%;
    }

    .users-modern-table thead {
        display: none;
    }

    .users-table-wrap {
        padding: 12px;
    }

    .users-modern-table tbody {
        display: grid;
        gap: 12px;
    }

    .users-modern-table tr {
        border: 1px solid rgba(255, 255, 255, 0.07);
        border-radius: 18px;
        overflow: hidden;
        background: rgba(255, 255, 255, 0.025);
    }

    .users-modern-table td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 14px;
        padding: 14px 16px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        text-align: right;
    }

    .users-modern-table td::before {
        content: attr(data-label);
        flex: 0 0 112px;
        color: rgba(228, 232, 240, 0.5);
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        text-align: left;
    }

    .users-modern-table td:first-child::before {
        display: none;
    }

    .users-modern-table td:first-child {
        padding-bottom: 16px;
    }

    .users-modern-table td:first-child,
    .users-modern-table td:first-child .users-person-cell {
        display: block;
        text-align: left;
    }

    .users-modern-table td:first-child .users-person-cell {
        display: flex;
    }

    .users-modern-table td:last-child {
        border-bottom: none;
    }

    .users-role-cell,
    .users-status-cell,
    .users-actions-cell,
    .users-contact-cell,
    .users-access-cell {
        margin-left: auto;
        align-items: flex-end;
        text-align: right;
    }

    .users-contact-line {
        justify-content: flex-end;
    }
}

@media (max-width: 640px) {
    .users-table-shell {
        border-radius: 20px;
    }

    .users-table-toolbar {
        padding: 20px 18px 14px;
    }

    .users-table-copy h4 {
        font-size: 1.14rem;
    }

    .users-table-copy p {
        font-size: 0.88rem;
    }

    .users-filter-summary {
        padding: 10px 12px 0;
        font-size: 0.78rem;
    }

    .users-table-wrap {
        margin: 0 12px 12px;
        padding: 10px;
        border-radius: 16px;
    }

    .users-modern-table td {
        gap: 12px;
        padding: 13px 14px;
    }

    .users-modern-table td::before {
        flex-basis: 92px;
    }

    .users-action-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ─── BUTTONS ─────────────────────────────────────────────── */
.btn-accent {
    background: var(--accent-gradient);
    border: none;
    color: #fff;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    box-shadow: 0 1px 3px rgba(74,222,128,0.3);
    text-transform: none;
    letter-spacing: 0;
}
.btn-accent:hover {
    color: #fff;
    box-shadow: 0 4px 12px -2px rgba(74,222,128,0.4);
    filter: brightness(1.1);
}

/* Outline buttons */
.btn-outline-secondary {
    background: transparent !important;
    border: 1px solid var(--border) !important;
    color: var(--text-muted) !important;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}
.btn-outline-secondary:hover {
    background: var(--bg-hover) !important;
    border-color: var(--text-muted) !important;
    color: var(--text) !important;
}

.btn-excel {
    background: linear-gradient(135deg, #1f7a43 0%, #107c41 100%);
    border: 1px solid #0f6a38;
    color: #fff;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    box-shadow: 0 8px 20px -12px rgba(16, 124, 65, 0.85);
}

.btn-excel:hover {
    background: linear-gradient(135deg, #24914f 0%, #138848 100%);
    border-color: #107c41;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 12px 24px -14px rgba(16, 124, 65, 0.95);
}

.btn-excel:focus,
.btn-excel:active {
    background: linear-gradient(135deg, #1b6d3b 0%, #0f6f3a 100%) !important;
    border-color: #0f6a38 !important;
    color: #fff !important;
    box-shadow: 0 0 0 0.2rem rgba(16, 124, 65, 0.22) !important;
}

/* ─── BADGES ──────────────────────────────────────────────── */
.badge-online { background: rgba(16,185,129,0.1); color: var(--online); border: 1px solid rgba(16,185,129,0.2); }
.badge-offline { background: rgba(100,116,139,0.1); color: var(--offline); border: 1px solid rgba(100,116,139,0.2); }
.badge-role {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.35;
    text-align: center;
    white-space: normal;
}

.badge-online,
.badge-offline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}
.badge-superadmin { background: rgba(22,163,74,0.12); color: #16a34a; border: 1px solid rgba(22,163,74,0.25); }
.badge-admin { background: rgba(74,222,128,0.1); color: #86efac; border: 1px solid rgba(74,222,128,0.2); }
.badge-operator { background: rgba(245,158,11,0.1); color: #fbbf24; border: 1px solid rgba(245,158,11,0.2); }
.badge-viewer { background: rgba(148,163,184,0.1); color: var(--text-muted); border: 1px solid rgba(148,163,184,0.2); }
.badge-owner { background: rgba(251,191,36,0.12); color: #facc15; border: 1px solid rgba(251,191,36,0.22); }
.badge-dispatch_sogamoso { background: rgba(14,165,233,0.12); color: #38bdf8; border: 1px solid rgba(14,165,233,0.24); }
.badge-supervisor_apdr { background: rgba(16,185,129,0.12); color: #34d399; border: 1px solid rgba(16,185,129,0.25); }

/* ─── VEHICLE ICONS (Map markers) ─────────────────────────── */
.marker-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    color: #fff;
    font-weight: 700;
}

/* ─── BUS MARKER ──────────────────────────────────────────── */
/* Lateral view (sidebar / detail) */
.custom-bus-marker {
    background: none !important;
    border: none !important;
}
.bus-marker {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.5s ease;
}
.bus-marker-body {
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35));
    transition: filter 0.3s;
}
.bus-marker:hover .bus-marker-body {
    filter: drop-shadow(0 3px 10px rgba(0,184,148,0.5));
}
.bus-marker-label {
    margin-top: -2px;
    padding: 1px 6px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 9px;
    font-weight: 600;
    border-radius: 4px;
    white-space: nowrap;
    letter-spacing: 0.3px;
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    line-height: 1.3;
}
.marker-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 32px;
    margin-left: -25px;
    margin-top: -18px;
    border-radius: 8px;
    background: rgba(46,204,113,0.2);
    animation: busPulse 2s ease-out infinite;
    pointer-events: none;
    z-index: -1;
}

/* Tooltip bubble label above markers (Leaflet bindTooltip) */
.marker-bubble-tooltip {
    background: rgba(30, 39, 50, 0.92) !important;
    color: #fff !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    padding: 2px 7px !important;
    border: 1px solid rgba(46,204,113,0.35) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25) !important;
    white-space: nowrap !important;
    letter-spacing: 0.3px;
    line-height: 1.4;
    pointer-events: none;
}
.marker-bubble-tooltip::before {
    border-top-color: rgba(30, 39, 50, 0.92) !important;
}
.custom-marker {
    background: none !important;
    border: none !important;
    overflow: visible !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* ─── MODERN VEHICLE MARKERS (v3 — Premium) ───────────────── */
.v-marker-container {
    background: none !important;
    border: none !important;
    overflow: visible !important;
}
.v-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.5s cubic-bezier(.4,0,.2,1);
}
.v-arrow svg { display: block; }

/* Subtle pulse ring behind moving vehicles */
.v-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 22px;
    margin-left: -11px;
    margin-top: -11px;
    border-radius: 50%;
    background: rgba(0,230,118,0.18);
    animation: vPulse 2.2s ease-out infinite;
    pointer-events: none;
    z-index: -1;
}
@keyframes vPulse {
    0%   { transform: scale(0.8); opacity: 0.6; }
    100% { transform: scale(2.8); opacity: 0; }
}

/* Label — pill style */
.v-label {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 2px;
    padding: 1px 4px;
    font-size: 9px;
    font-weight: 700;
    border-radius: 3px;
    white-space: nowrap;
    text-align: center;
    line-height: 1.25;
    pointer-events: none;
    letter-spacing: 0.3px;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}
.v-label-moving {
    background: rgba(0,200,83,0.92);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    box-shadow: 0 1px 6px rgba(0,230,118,0.45), 0 0 3px rgba(0,230,118,0.25);
}
.v-label-off {
    background: rgba(55,65,75,0.82);
    color: #b0bec5;
    border: 1px solid rgba(255,255,255,0.08);
    font-weight: 600;
    opacity: 0.75;
}

/* Smooth Leaflet marker transition for divIcons */
.leaflet-marker-icon.v-marker-container {
    transition: none !important;
    will-change: transform;
    overflow: visible !important;
}

/* Top-down / aerial view (legacy compat) */
.custom-bus-marker-top {
    background: none !important;
    border: none !important;
    overflow: visible !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.bus-marker-top {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.6s ease;
}
.bus-marker-top-body {
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
    transition: filter 0.3s, transform 0.3s;
}
.bus-marker-top:hover .bus-marker-top-body {
    filter: drop-shadow(0 4px 14px rgba(0,184,148,0.45));
    transform: scale(1.08);
}
.bus-marker-label-top {
    margin-top: -4px;
    padding: 1px 5px;
    background: rgba(0,0,0,0.75);
    color: #fff;
    font-size: 8.5px;
    font-weight: 700;
    border-radius: 3px;
    white-space: nowrap;
    text-align: center;
    letter-spacing: 0.4px;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    pointer-events: none;
}
.marker-pulse-top {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 34px;
    height: 58px;
    margin-left: -17px;
    margin-top: -29px;
    border-radius: 10px;
    background: rgba(46,204,113,0.18);
    animation: busPulse 2s ease-out infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes busPulse {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* Movement trail behind markers */
.marker-trail {
    filter: drop-shadow(0 0 4px rgba(46,204,113,0.3));
}
/* Smooth Leaflet marker transition for divIcons */
.leaflet-marker-icon.custom-bus-marker-top,
.leaflet-marker-icon.v-marker-container {
    transition: none !important; /* we handle animation via rAF */
    will-change: transform;
}

/* Hide Leaflet attribution box */
.leaflet-control-attribution {
    display: none !important;
}

/* ─── SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); }

/* ─── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 1280px) {
    .sidebar {
        position: fixed;
        left: calc(-1 * var(--sidebar-w) - 20px);
        z-index: 9999;
        box-shadow: 5px 0 30px rgba(0,0,0,0.12);
    }
    .sidebar.mobile-open { left: 0; }
    .topbar-toggle { display: block; }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        z-index: 9999;
        box-shadow: 5px 0 30px rgba(0,0,0,0.12);
    }
    .sidebar.mobile-open { left: 0; }
    .topbar-toggle { display: block; }

    /* ── Map: Vehicle Panel → Bottom Sheet ──────────────────── */
    .vehicle-panel {
        position: absolute !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        height: 56vh;
        max-height: 70vh;
        border-radius: 18px 18px 0 0 !important;
        transform: translateY(0);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow: 0 -8px 30px rgba(0,0,0,0.25) !important;
        z-index: 20 !important;
    }
    .vehicle-panel::before {
        content: '';
        display: block;
        width: 44px;
        height: 4px;
        border-radius: 2px;
        background: var(--border);
        margin: 10px auto 0;
        flex-shrink: 0;
    }
    .vehicle-panel.hidden {
        transform: translateY(100%) !important;
        opacity: 0 !important;
        pointer-events: none !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
    }
    /* Expand btn: debajo de los botones del mapa (stack izquierdo) */
    .vp-expand-btn {
        right: auto !important;
        left: 10px !important;
        transform: none !important;
        top: 136px !important;
        bottom: auto !important;
        z-index: 21 !important;
        width: 34px !important;
        height: 34px !important;
        border-radius: 8px !important;
        padding: 0 !important;
    }
    .vp-expand-btn i { font-size: 12px; }
    /* Toggle btn → flecha abajo para cerrar el bottom sheet */
    .vp-toggle-btn {
        display: flex;
        background: var(--sub-bg-hover);
        border: 1px solid var(--border);
        color: var(--text-muted);
        border-radius: var(--radius-sm);
        width: 36px;
        height: 36px;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        font-size: 14px;
    }

    /* ── Map: Detail Card → Bottom anchor ───────────────────── */
    .detail-overlay {
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        z-index: 22;
        pointer-events: none;
    }
    .detail-overlay.show { justify-content: stretch; }
    .detail-card {
        width: 100%;
        min-width: 0 !important;
        max-width: 100% !important;
        max-height: 54vh;
        overflow-y: auto;
        border-radius: 18px 18px 0 0 !important;
        padding: 16px 16px 24px;
        pointer-events: auto;
    }
    /* When vehicle panel open, push detail card above it */
    #vehiclePanel:not(.hidden) ~ .detail-overlay {
        bottom: 56vh !important;
    }

    .detail-grid { grid-template-columns: repeat(2, 1fr); }
    .page-content { padding: 12px; }
    .report-controls .row { flex-direction: column; }
    .report-time-wrap { min-width: 0; }
    .report-time-input { min-width: 0; width: 100%; }
    .rpt-type-grid { gap: 8px; }
    .rpt-type-card { min-width: 68px; padding: 10px 10px; }
    .rpt-type-name { font-size: 10px; }
    .rpt-params-grid { gap: 8px; }
    .rpt-field { flex: 1 1 100%; }
    .rpt-actions { flex-direction: column; align-items: flex-start; gap: 10px; }
    .rpt-btn-generate { width: 100%; text-align: center; }
    .ptp-layout { grid-template-columns: 1fr; }
    .ptp-map { min-height: 300px; height: 300px; }
    .ptp-toolbar { grid-template-columns: 1fr; }
    .ptp-table-shell {
        max-height: none;
        overflow: visible;
        border: none;
        background: transparent;
    }
    .ptp-table thead { display: none; }
    .ptp-table { min-width: 0; }
    .ptp-table,
    .ptp-table tbody,
    .ptp-table tr,
    .ptp-table td {
        display: block;
        width: 100%;
    }
    .ptp-table tr {
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 8px 10px;
        margin-bottom: 10px;
        background: var(--sub-bg);
    }
    .ptp-table td {
        border: none !important;
        padding: 7px 0;
    }
    .ptp-table td::before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        letter-spacing: .4px;
        text-transform: uppercase;
        color: var(--text-muted);
        margin-bottom: 4px;
    }
    .ptp-table td[data-label="#"] {
        display: inline-block;
        width: auto;
        margin-bottom: 2px;
    }
    .ptp-table td[data-label="#"]::before { display: none; }
    .ptp-table td[data-label="Etiquetas"] .ptp-tag { margin-bottom: 5px; }
    /* ── Topbar compacto en móvil ────────────────────────────── */
    .topbar-stats { display: none; }
    .topbar-breadcrumb { display: none; }
    .topbar-live-indicator { display: none; }
    .topbar-user-name-hidden { display: none; }
    .topbar-user-role-hidden { display: none; }
    .topbar-title { font-size: 14px; }

    /* ── Dashboard KPI strip inferior: oculto en móvil ───────── */
    .dash-strip-bottom { display: none !important; }

    /* ── KPI strip superior: más compacto ────────────────────── */
    .dash-strip { padding: 5px 8px; border-bottom: 1px solid var(--border); }
    .dash-row { gap: 4px; }
    .dash-kpi { padding: 5px 8px; gap: 6px; }
    .dk-val { font-size: 13px; font-weight: 700; }
    .dk-lbl { font-size: 8px; }
    .dk-icon { width: 24px; height: 24px; font-size: 10px; border-radius: 6px; }

    /* ── Botones del mapa: group pill vertical izquierda ───────── */
    .map-fit-btn, .map-measure-btn, .map-fullscreen-btn {
        position: absolute;
        left: 10px;
        right: auto;
        width: 34px;
        height: 34px;
        font-size: 13px;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    }
    .map-fit-btn       { top: 10px; }
    .map-measure-btn   { top: 52px; }
    .map-fullscreen-btn{ top: 94px; }
    .map-charts-btn    { display: none; }
    .monitor-badge     { left: 54px; top: 10px; font-size: 10px; padding: 5px 10px; }

    /* ── Overlay de gráficas analíticas ──────────────────────── */
    .dash-charts { left: 0; right: 0; border-radius: 0; top: 0; }
    .dash-charts.open { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 10px; }

    /* ── App footer ───────────────────────────────────────────── */
    .app-footer .footer-center { display: none; }
    .app-footer { font-size: 10px; }

    /* ── History module ───────────────────────────────────────── */
    .history-control-group { min-width: 0; flex: 1 1 100%; }
    .history-control-actions { width: 100%; }
    .history-action-btn { flex: 1; }
    .history-kpis { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
    .history-content-split,
    .history-wrapper.history-has-results .history-content-split { grid-template-columns: 1fr; grid-template-rows: minmax(280px, 1fr) auto auto; }
    .history-map { min-height: 280px; grid-column: 1; grid-row: 1; }
    .history-table-panel {
        max-height: 260px;
        border-left: none;
        border-top: 2px solid var(--accent);
        grid-column: 1;
        grid-row: 3;
    }
}

/* ─── RESPONSIVE MAP — small phones (≤ 576px) ─────────────── */
@media (max-width: 576px) {
    /* KPIs en cuadrícula 2×2 para pantallas muy estrechas */
    .dash-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 4px;
    }
    .dash-kpi { flex: unset; }

    /* Vehicle panel un poco más alto */
    .vehicle-panel { height: 62vh; max-height: 75vh; }
    #vehiclePanel:not(.hidden) ~ .detail-overlay { bottom: 62vh !important; }

    /* Detail card padding más ajustado */
    .detail-card { padding: 12px 12px 20px; }
    .detail-grid { grid-template-columns: 1fr 1fr; gap: 6px; }

    /* Botones del mapa: heredan posición left del bloque 768px, sin cambios */
    .map-fit-btn, .map-measure-btn, .map-fullscreen-btn { right: auto; }

    /* Expand btn: hereda posición centro-inferior del bloque 768px */

    /* Topbar: solo iconos */
    .topbar-logout-btn { padding: 6px; }
    .topbar { gap: 6px; padding: 0 10px; }
}

@media (max-width: 1200px) and (min-width: 769px) {
    .ptp-layout {
        --ptp-panel-h: clamp(420px, 68vh, 760px);
        grid-template-columns: minmax(300px, 1fr) minmax(360px, 1fr);
    }
    .ptp-col-detail { width: 20%; }
    .ptp-col-tags { width: 17%; }
}

/* ─── MOBILE OVERLAY ──────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
}
.sidebar-overlay.show { display: block; }

/* ─── FORMS ───────────────────────────────────────────────── */
.form-control.bg-dark, .form-select.bg-dark {
    border-color: var(--border);
    background: var(--input-bg) !important;
    color: var(--input-text) !important;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}
.form-control.bg-dark:focus, .form-select.bg-dark:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
/* ─── LIGHT THEME OVERRIDES ───────────────────────────────── */
/* Vehicle detail modal — light theme */
/* Light theme polish for Alerts Event Detail modal */
.event-point-card-popup .leaflet-popup-content-wrapper {
    animation: eventPointCardIn 180ms ease-out;
}

@keyframes eventPointCardIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ─── THEME TOGGLE BUTTON ─────────────────────────────────── */
.theme-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    width: 38px; height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: var(--shadow-sm);
}
.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-glow);
    transform: translateY(-2px) rotate(15deg);
    box-shadow: 0 6px 16px rgba(74,222,128,0.2);
}
/* ─── SPINNER ─────────────────────────────────────────────── */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
}
.loading-spinner i { font-size: 24px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* ─── MODAL ────────────────────────────────────────────────── */
.geonex-modal {
    background: var(--glass);
    color: var(--text);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    box-shadow: 0 24px 64px -12px rgba(0,0,0,0.5), 0 0 80px -20px rgba(74,222,128,0.06), 0 0 0 1px var(--glass-border);
    overflow: hidden;
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
}
#appModal .modal-dialog {
    max-width: 520px;
}
#appModal.clavijero-edit-modal .modal-dialog.clavijero-edit-dialog {
    max-width: 760px;
}
#appModal.clavijero-edit-modal .geonex-modal {
    background:
        radial-gradient(circle at top right, rgba(74,222,128,0.12), transparent 34%),
        var(--panel-bg-gradient);
}
#appModal.stop-direction-modal .modal-dialog.stop-direction-dialog {
    width: min(1100px, calc(100vw - 36px));
    max-width: 1100px;
}
#appModal.stop-direction-modal .geonex-modal {
    background:
        radial-gradient(circle at top right, rgba(34,197,94,0.12), transparent 34%),
        radial-gradient(circle at bottom left, rgba(56,189,248,0.09), transparent 32%),
        var(--panel-bg-gradient);
}
#appModal.vehicle-detail-modal {
    padding-left: calc(var(--content-offset-left) + 8px);
    padding-right: 12px;
}
#appModal.vehicle-detail-modal .modal-dialog.vehicle-detail-dialog {
    width: calc(100vw - var(--content-offset-left) - 20px) !important;
    max-width: min(calc(100vw - var(--content-offset-left) - 20px), 1640px) !important;
    margin: calc(var(--topbar-h) + 12px) 0 calc(var(--footer-h) + 12px) auto;
    height: calc(100dvh - var(--topbar-h) - var(--footer-h) - 24px);
    max-height: calc(100dvh - var(--topbar-h) - var(--footer-h) - 24px);
}
#appModal.vehicle-detail-modal .modal-dialog.vehicle-detail-dialog.modal-dialog-centered {
    min-height: auto;
    display: flex;
    align-items: stretch;
}
#appModal.vehicle-detail-modal .geonex-modal {
    height: 100%;
    border-radius: 24px;
}
#appModal.vehicle-detail-modal .modal-header {
    padding: 20px 28px 16px;
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--modal-header-bg);
    backdrop-filter: blur(16px);
}
#appModal.vehicle-detail-modal .modal-title {
    font-size: clamp(1.28rem, 1.6vw, 1.7rem);
    font-weight: 800;
}
#appModal.vehicle-detail-modal .modal-body {
    padding: 22px 28px 24px;
    overflow-y: auto;
}
#appModal.vehicle-detail-modal .modal-footer {
    padding: 14px 28px 18px;
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: var(--modal-footer-bg);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
#appModal.vehicle-detail-modal .modal-footer .btn {
    min-height: 46px;
    padding: 0 18px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    box-shadow: none;
}
#appModal.vehicle-detail-modal .modal-footer .btn-outline-light {
    background: var(--sub-bg);
    border-color: var(--sub-border);
    color: var(--sub-text-medium);
}
#appModal.vehicle-detail-modal .modal-footer .btn-outline-light:hover {
    background: var(--sub-bg-hover);
    border-color: var(--sub-border);
    color: var(--text);
    transform: translateY(-1px);
}
#appModal.vehicle-detail-modal .modal-footer .btn-accent {
    padding: 0 20px;
    box-shadow: 0 10px 20px rgba(22, 163, 74, 0.22);
}
#appModal.vehicle-detail-modal .modal-footer .btn-accent:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(22, 163, 74, 0.26);
}
#appModal.vehicle-detail-modal .modal-footer .btn i {
    font-size: 0.92rem;
}
#appModal.vehicle-detail-modal #modalCloseBtn {
    opacity: 1;
    filter: invert(1) grayscale(1);
}
.geonex-modal .modal-header {
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--sub-bg);
}
.geonex-modal .modal-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}
.geonex-modal .modal-footer {
    padding: 12px 22px;
    border-top: 1px solid var(--border);
    background: var(--sub-bg);
}
#appModal .modal-footer .btn[data-bs-dismiss="modal"] {
    background: rgba(255,255,255,0.04) !important;
    color: rgba(244,247,250,0.92) !important;
    border: 1px solid rgba(255,255,255,0.16) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
#appModal .modal-footer .btn[data-bs-dismiss="modal"]:hover {
    background: rgba(255,255,255,0.08) !important;
    color: #ffffff !important;
    border-color: rgba(255,255,255,0.24) !important;
}
#appModal .modal-footer .btn[data-bs-dismiss="modal"]:focus-visible {
    outline: 2px solid rgba(255,255,255,0.18);
    outline-offset: 2px;
}
.geonex-modal .modal-body {
    padding: 18px 22px;
}

/* ─── VEHICLE FORM MODAL ─────────────────────────────────── */
#appModal.vehicle-form-modal .modal-dialog.vehicle-form-dialog {
    width: min(calc(100vw - var(--content-offset-left) - 20px), 1480px) !important;
    max-width: min(calc(100vw - var(--content-offset-left) - 20px), 1480px) !important;
    margin: calc(var(--topbar-h) + 12px) 0 calc(var(--footer-h) + 12px) auto;
    height: calc(100dvh - var(--topbar-h) - var(--footer-h) - 24px);
    max-height: calc(100dvh - var(--topbar-h) - var(--footer-h) - 24px);
}
#appModal.vehicle-form-modal {
    padding-left: calc(var(--content-offset-left) + 8px);
    padding-right: 12px;
}
#appModal.vehicle-form-modal .modal-dialog.vehicle-form-dialog.modal-dialog-centered {
    min-height: auto;
    display: flex;
    align-items: stretch;
}
#appModal.vehicle-form-modal .geonex-modal {
    height: 100%;
    border-radius: 24px;
}
#appModal.vehicle-form-modal .modal-header {
    padding: 22px 28px 16px;
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--modal-header-bg);
    backdrop-filter: blur(16px);
}
#appModal.vehicle-form-modal .modal-title {
    font-size: clamp(1.35rem, 1.8vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.03em;
}
#appModal.vehicle-form-modal .modal-body {
    padding: 24px 28px 28px;
    overflow-y: auto;
}
#appModal.vehicle-form-modal .modal-footer {
    padding: 16px 28px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: var(--modal-footer-bg);
    backdrop-filter: blur(12px);
}
#appModal.vehicle-form-modal #modalCloseBtn {
    opacity: 1;
    filter: invert(1) grayscale(1);
}
#appModal.vehicle-form-modal .modal-footer .btn {
    min-height: 48px;
    padding: 0 20px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.98rem;
    font-weight: 700;
}
#appModal.vehicle-form-modal .modal-footer .btn-accent {
    box-shadow: 0 10px 22px rgba(22, 163, 74, 0.24);
}

#appModal.worker-form-modal .modal-dialog.worker-form-dialog {
    max-width: min(1080px, 94vw);
    margin: 1.25rem auto;
}
#appModal.worker-form-modal .geonex-modal {
    border-radius: 24px;
    overflow: hidden;
    background:
        radial-gradient(circle at top right, rgba(74,222,128,0.1), transparent 32%),
        var(--panel-bg-gradient);
}
#appModal.worker-form-modal .modal-header {
    padding: 22px 28px 16px;
    background: var(--modal-header-bg);
    backdrop-filter: blur(16px);
}
#appModal.worker-form-modal .modal-title {
    font-size: clamp(1.2rem, 1.4vw, 1.7rem);
    font-weight: 800;
    letter-spacing: -0.03em;
}
#appModal.worker-form-modal .modal-body {
    padding: 24px 28px 10px;
}
#appModal.worker-form-modal .modal-footer {
    padding: 16px 28px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: var(--modal-footer-bg);
    backdrop-filter: blur(12px);
}
#appModal.worker-form-modal .modal-footer .btn {
    min-height: 48px;
    padding: 0 20px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.98rem;
    font-weight: 700;
}
#appModal.worker-form-modal .modal-footer .btn-accent {
    box-shadow: 0 12px 26px rgba(22, 163, 74, 0.22);
}
.worker-form-shell {
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.worker-form-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border-radius: 20px;
    border: 1px solid var(--sub-border);
    background:
        radial-gradient(circle at top right, rgba(74,222,128,0.18), transparent 42%),
        var(--panel-bg-gradient);
}
.worker-form-hero-icon {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: linear-gradient(180deg, rgba(74,222,128,0.26), rgba(74,222,128,0.1));
    color: var(--accent);
    font-size: 1.25rem;
    box-shadow: inset 0 1px 0 var(--sub-border);
}
.worker-form-hero-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.worker-form-kicker {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    margin-bottom: 6px;
}
.worker-form-hero-copy strong {
    font-size: 1.28rem;
    line-height: 1.15;
    color: var(--text);
    letter-spacing: -0.03em;
}
.worker-form-hero-copy small {
    margin-top: 5px;
    font-size: 0.92rem;
    color: var(--sub-text-dim);
}
.worker-routes-panel {
    border-radius: 18px;
    border: 1px solid var(--sub-border);
    background: var(--sub-bg);
    overflow: hidden;
}
.worker-routes-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 14px;
    border-bottom: 1px solid var(--sub-border);
}
.worker-routes-panel-head strong {
    display: block;
    color: var(--text);
    font-size: 0.98rem;
}
.worker-routes-panel-head span {
    display: block;
    margin-top: 4px;
    color: var(--sub-text-dim);
    font-size: 0.84rem;
    line-height: 1.45;
}
.worker-routes-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(74,222,128,0.2);
    background: rgba(74,222,128,0.1);
    color: #8bc3ff;
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
}
.worker-routes-list {
    max-height: 300px;
    overflow: auto;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.worker-route-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--sub-border);
    background: var(--input-field-bg);
    cursor: pointer;
    transition: all 0.18s ease;
}
.worker-route-option:hover {
    border-color: rgba(95,157,255,0.28);
    transform: translateY(-1px);
}
.worker-route-option.is-selected {
    border-color: rgba(74,222,128,0.42);
    background: linear-gradient(180deg, rgba(74,222,128,0.16), rgba(74,222,128,0.08));
    box-shadow: inset 0 1px 0 var(--sub-border);
}
.worker-route-option-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.worker-route-option-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 4px;
}
.worker-route-option-copy strong {
    color: var(--text);
    font-size: 0.92rem;
    line-height: 1.25;
}
.worker-route-option-copy small {
    color: var(--sub-text-dim);
    font-size: 0.78rem;
}
.worker-route-option-check {
    margin-left: auto;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--sub-border);
    background: var(--sub-bg);
    color: transparent;
    flex-shrink: 0;
    transition: all 0.18s ease;
}
.worker-route-option.is-selected .worker-route-option-check {
    border-color: rgba(74,222,128,0.28);
    background: rgba(74,222,128,0.2);
    color: #9ed0ff;
}
.worker-form-empty {
    padding: 28px 18px;
    text-align: center;
    color: var(--text-muted);
}
.worker-routes-search {
    position: relative;
    display: flex;
    align-items: center;
    margin: 18px 0 16px;
    padding: 0 12px;
}
.worker-routes-search-input {
    width: 100%;
    padding-left: 16px;
    padding-right: 16px;
    min-height: 48px;
    font-size: 0.94rem;
    border-radius: 16px;
}
.worker-route-option[hidden] {
    display: none !important;
}
.worker-form-toggle {
    width: 100%;
    justify-content: flex-start;
    padding: 2px 0;
}
.worker-form-toggle-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.worker-form-toggle-copy strong {
    color: var(--text);
    font-size: 0.94rem;
}
.worker-form-toggle-copy small {
    color: var(--sub-text-dim);
    font-size: 0.82rem;
    line-height: 1.45;
}
#appModal.worker-form-modal .modal-title {
    color: #f8fbff;
}
#appModal.worker-form-modal .modal-form-section span {
    color: rgba(230,238,250,0.74);
}
#appModal.worker-form-modal .modal-form-label {
    color: rgba(180,194,214,0.68);
}
#appModal.worker-form-modal .modal-form-help,
#appModal.worker-form-modal .modal-form-actions-note {
    color: rgba(176,188,205,0.66);
}
#appModal.worker-form-modal .modal-form-input {
    background: linear-gradient(180deg, rgba(8,12,18,0.92), rgba(10,14,20,0.98));
    border-color: rgba(255,255,255,0.09);
}
#appModal.worker-form-modal .modal-form-input::placeholder {
    color: rgba(166,177,194,0.42);
}
#appModal.worker-form-modal .worker-routes-panel {
    border-color: rgba(255,255,255,0.08);
    background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.02));
}
#appModal.worker-form-modal .worker-routes-count {
    border-color: rgba(96,165,250,0.24);
    background: rgba(22,163,74,0.18);
    color: #b8d9ff;
}
#appModal.worker-form-modal .worker-route-option-copy small,
#appModal.worker-form-modal .worker-form-toggle-copy small,
#appModal.worker-form-modal .worker-routes-panel-head span,
#appModal.worker-form-modal .worker-form-hero-copy small {
    color: rgba(184,196,214,0.66);
}
#appModal.worker-form-modal #modalCloseBtn {
    opacity: 1;
    filter: invert(1) grayscale(1);
}
/* ─── HOMOLOGACIONES FORM MODAL ───────────────────────────── */
#appModal.homolog-form-modal .modal-dialog {
    max-width: min(980px, 96vw);
    margin: 1rem auto;
}
#appModal.homolog-form-modal .geonex-modal {
    border-radius: 20px;
    max-height: calc(100dvh - 2rem);
}
#appModal.homolog-form-modal .modal-header {
    padding: 18px 28px 14px;
}
#appModal.homolog-form-modal .modal-title {
    font-size: clamp(1.25rem, 1.6vw, 1.75rem);
    font-weight: 800;
    letter-spacing: -0.015em;
    line-height: 1.15;
}
#appModal.homolog-form-modal .modal-body {
    padding: 16px 28px 20px;
    overflow-y: auto;
    overflow-x: hidden;
}
#appModal.homolog-form-modal .modal-footer {
    padding: 14px 28px;
    gap: 10px;
}

.homolog-form-modern .form-label {
    font-size: 0.92rem;
    font-weight: 700;
    color: #d7e4ff;
    margin-bottom: 7px;
    letter-spacing: -0.01em;
}
.homolog-form-head {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}
.homolog-form-eyebrow {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #78b8ff;
}
.homolog-form-subtitle {
    margin: 0;
    color: rgba(214, 226, 245, 0.72);
    font-size: 0.92rem;
}
.homolog-form-section {
    border: 1px solid var(--sub-border);
    border-radius: 14px;
    padding: 12px;
    background: var(--sub-bg);
}
.homolog-form-section-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}
.homolog-form-section-title i {
    color: var(--accent);
    font-size: 0.86rem;
}
.homolog-form-modern .form-control,
.homolog-form-modern .form-select {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    height: 46px;
    border-radius: 12px;
    border: 1px solid var(--sub-border);
    background: var(--input-field-bg) !important;
    color: var(--text) !important;
    font-size: 1.02rem;
    font-weight: 600;
    line-height: 1.2;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    box-shadow: inset 0 1px 0 var(--sub-border);
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.homolog-form-modern .form-select {
    padding-right: 2.2rem;
    text-overflow: ellipsis;
}
.homolog-form-modern input[type="time"] {
    min-width: 130px;
}
.homolog-form-modern .form-control::placeholder {
    color: var(--sub-text-dim);
    font-weight: 500;
}
.homolog-form-modern .form-control:hover,
.homolog-form-modern .form-select:hover {
    border-color: rgba(96, 162, 255, 0.45);
}
.homolog-form-modern .form-control:focus,
.homolog-form-modern .form-select:focus {
    border-color: rgba(66, 148, 255, 0.75);
    box-shadow: 0 0 0 3px rgba(66, 148, 255, 0.14);
    background: var(--input-field-bg) !important;
}
.homolog-form-modern textarea.form-control {
    min-height: 92px;
    height: auto;
    resize: vertical;
    padding-top: 10px;
}
.homolog-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 2px;
}
.homolog-quick-btn {
    border: 1px solid rgba(120, 160, 230, 0.35);
    color: #cfe4ff;
    background: rgba(17, 28, 52, 0.62);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    transition: all .18s ease;
}
.homolog-quick-btn:hover {
    border-color: rgba(96, 162, 255, 0.7);
    background: rgba(27, 46, 84, 0.75);
    transform: translateY(-1px);
}
.homolog-form-modern .row {
    margin-left: -8px;
    margin-right: -8px;
}
.homolog-form-modern .row > [class*="col-"] {
    padding-left: 8px;
    padding-right: 8px;
}
@media (min-width: 1200px) {
    .homolog-form-modern .row > .col-12.col-xxl-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (max-width: 768px) {
    #appModal.homolog-form-modal .modal-dialog {
        max-width: 96vw;
        margin: .75rem auto;
    }
    #appModal.homolog-form-modal .geonex-modal {
        border-radius: 16px;
        min-height: auto;
        max-height: calc(100dvh - 1.5rem);
    }
    #appModal.homolog-form-modal .modal-title {
        font-size: 1.25rem;
    }
    #appModal.homolog-form-modal .modal-header {
        padding: 16px 16px 12px;
    }
    #appModal.homolog-form-modal .modal-body {
        padding: 14px 16px 16px;
    }
    #appModal.homolog-form-modal .modal-footer {
        padding: 12px 16px;
        justify-content: flex-end;
    }
    .homolog-form-modern .form-control,
    .homolog-form-modern .form-select {
        height: 44px;
        font-size: 0.96rem;
        border-radius: 10px;
    }
    .homolog-form-modern .form-label {
        font-size: 0.86rem;
        margin-bottom: 6px;
    }
    .homolog-form-subtitle {
        font-size: 0.84rem;
    }
    .homolog-form-section {
        padding: 10px;
    }
    .homolog-quick-actions {
        gap: 6px;
    }
    .homolog-quick-btn {
        padding: 5px 10px;
        font-size: 0.74rem;
    }
}
.geonex-modal .btn-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: all 0.2s;
    filter: invert(1) grayscale(100%) brightness(200%);
    padding: 0;
}
.geonex-modal .btn-close:hover {
    opacity: 1;
    background: rgba(255,255,255,0.1);
}
/* ─── MODAL FORM GRID ──────────────────────────────────────── */
.modal-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 16px;
}
.modal-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}
.modal-form-group.full {
    grid-column: 1 / -1;
}
.modal-form-section {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 10px;
    margin-top: 6px;
    border-top: 1px solid var(--sub-border);
}
.modal-form-section:first-child {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}
.modal-form-section i {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(74,222,128,0.16), rgba(74,222,128,0.07));
    color: #72b7ff;
    box-shadow: inset 0 1px 0 var(--sub-border);
}
.modal-form-section span {
    font-size: 0.86rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--sub-text-medium);
}
.modal-form-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--sub-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}
.modal-form-help {
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--sub-text-dim);
}
.modal-form-help strong {
    color: var(--text);
}
.modal-form-actions-note {
    margin-right: auto;
    max-width: 720px;
    font-size: 0.84rem;
    line-height: 1.5;
    color: var(--sub-text-dim);
}
.modal-form-input {
    width: 100%;
    min-height: 50px;
    padding: 12px 14px;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 600;
    color: var(--text);
    background: var(--modal-form-bg);
    border: 1px solid var(--sub-border);
    border-radius: 14px;
    outline: none;
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 0 var(--sub-border);
}
.modal-form-input::placeholder {
    color: var(--text-muted);
    opacity: 0.45;
    font-weight: 400;
}
.modal-form-input:hover {
    border-color: rgba(91, 157, 255, 0.24);
    background: var(--sub-bg-hover);
}
.modal-form-input:focus {
    border-color: rgba(94, 157, 255, 0.68);
    box-shadow: 0 0 0 4px rgba(74,222,128,0.12);
    background: var(--input-field-bg);
}
/* Toggle switch */
.modal-form-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    user-select: none;
    padding: 4px 0;
}
.modal-toggle-input {
    display: none;
}
.modal-toggle-slider {
    width: 40px;
    height: 22px;
    background: rgba(255,255,255,0.12);
    border: 1px solid var(--border);
    border-radius: 11px;
    position: relative;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}
.modal-toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.modal-toggle-input:checked + .modal-toggle-slider {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    border-color: transparent;
}
.modal-toggle-input:checked + .modal-toggle-slider::after {
    transform: translateX(18px);
}
@media (max-width: 576px) {
    .modal-form-grid { grid-template-columns: 1fr; }
    .geonex-modal .modal-header { padding: 14px 16px 12px; }
    .geonex-modal .modal-body { padding: 14px 16px; }
    .geonex-modal .modal-footer { padding: 12px 16px; }
}
/* ─── LEAFLET OVERRIDES ───────────────────────────────────── */
.leaflet-control-layers {
    background: var(--leaflet-ctrl-bg) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid var(--glass-border) !important;
    color: var(--leaflet-ctrl-text) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow) !important;
}
.leaflet-control-layers label { color: var(--leaflet-ctrl-text) !important; }
.leaflet-bar a {
    background: var(--leaflet-ctrl-bg) !important;
    color: var(--leaflet-ctrl-text) !important;
    border-color: var(--glass-border) !important;
    transition: all var(--transition-fast);
}
.leaflet-bar a:hover { background: var(--bg-card-hover) !important; }
.leaflet-bar {
    border: none !important;
    border-radius: var(--radius-sm) !important;
    overflow: hidden;
    box-shadow: var(--shadow-sm) !important;
}

/* ─── MODERN MODAL SKIN (EVENT DETAIL) ─────────────────────── */
#appModal.alerts-detail-modal .modal-dialog {
    max-width: min(1600px, 97vw);
}
#appModal.alerts-detail-modal .modal-content.geonex-modal {
    border-radius: 20px;
    overflow: hidden;
}
#appModal.alerts-detail-modal .modal-header {
    padding: 16px 22px;
}
#appModal.alerts-detail-modal .modal-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}
#appModal.alerts-detail-modal .modal-footer {
    padding: 12px 20px;
}

#appModal.alerts-detail-modal .modal-content.geonex-modal {
    background:
        radial-gradient(900px 400px at -5% -30%, rgba(79,143,255,0.12), transparent 60%),
        radial-gradient(800px 380px at 110% -25%, rgba(74,222,128,0.08), transparent 55%),
        linear-gradient(160deg, #0e1424, #121830 48%, #0e1120);
    border: 1px solid rgba(79,143,255,0.12);
    box-shadow: 0 28px 70px -24px rgba(0,0,0,0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
#appModal.alerts-detail-modal .modal-header {
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid rgba(79,143,255,0.1);
}
#appModal.alerts-detail-modal .modal-footer {
    background: rgba(8,12,24,0.5);
    border-top: 1px solid rgba(79,143,255,0.08);
}
.alerts-detail-hero {
    background: linear-gradient(130deg, rgba(74,222,128,0.12), rgba(22,163,74,0.08));
    border-color: rgba(79,143,255,0.2);
    box-shadow: 0 10px 26px rgba(0,0,0,0.28);
}
.alerts-kpi-card,
.alerts-detail-meta,
.alerts-detail-table,
.alerts-detail-map-wrap,
.alerts-kpi-mini {
    background: var(--glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-color: rgba(79,143,255,0.12);
    box-shadow: 0 6px 20px rgba(0,0,0,0.22);
}

/* ─── HOMOLOGACIONES ───────────────────────────────────────── */
.homolog-page {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 !important;
    height: 100%;
}

/* ── Toolbar (unified header + legend) ── */
.homolog-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
    flex-wrap: wrap;
    position: relative;
}
.homolog-toolbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(74,222,128,0.15), transparent);
}
.homolog-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.homolog-toolbar-center {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.homolog-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.homolog-nav-group {
    display: flex;
    gap: 2px;
    background: var(--sub-bg);
    border-radius: 10px;
    padding: 2px;
    border: 1px solid var(--glass-border);
}
.homolog-nav-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 12px;
}
.homolog-nav-btn:hover {
    background: var(--sub-bg-hover);
    color: var(--text);
}
.homolog-today-btn {
    height: 32px;
    padding: 0 14px;
    border: 1px solid var(--glass-border);
    background: var(--sub-bg);
    color: var(--text);
    border-radius: 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.15s ease;
}
.homolog-today-btn:hover {
    background: var(--sub-bg-hover);
    border-color: var(--accent);
    color: var(--accent);
}
.homolog-title {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    min-width: 0;
}
.homolog-filter-select {
    min-width: 180px;
    background: var(--input-field-bg) !important;
    border: 1px solid var(--glass-border) !important;
    color: var(--text) !important;
    border-radius: 10px !important;
    font-size: 12px;
    height: 34px;
}
.homolog-new-btn {
    border-radius: 10px !important;
    height: 34px;
    padding: 0 16px !important;
    font-weight: 700;
}

/* ── Status legend (inline) ── */
.homolog-status-legend { display: none; }
.hsl-item {
    font-size: 11px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
.hsl-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 6px currentColor;
}
.hsl-dot.is-agendado { background: #5ea8ff; color: rgba(94,168,255,0.4); }
.hsl-dot.is-homologado { background: #4ade80; color: rgba(74,222,128,0.4); }
.hsl-dot.is-sin-homologar { background: #fbbf24; color: rgba(251,191,36,0.4); }
.hsl-dot.is-fallida { background: #f87171; color: rgba(248,113,113,0.4); }

/* ── Vehicles Strip (horizontal above calendar) ── */
.homolog-vehicles-strip {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
    position: relative;
}
.homolog-vehicles-strip::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(74,222,128,0.1), transparent);
}
.homolog-vehicles-strip-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 20px;
    border-bottom: 1px solid var(--border-subtle);
}
.homolog-vehicles-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}
.homolog-vehicles-title i {
    color: var(--accent);
    font-size: 13px;
}
.homolog-vehicle-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--accent-glow);
    color: var(--accent);
    font-size: 10px;
    font-weight: 700;
}
.homolog-vehicle-search-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    height: 30px;
    width: 180px;
    background: var(--input-field-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    transition: border-color 0.15s ease;
}
.homolog-vehicle-search-wrap:focus-within {
    border-color: var(--accent);
}
.homolog-vehicle-search-wrap i {
    color: var(--text-muted);
    font-size: 10px;
    flex-shrink: 0;
}
.homolog-vehicle-search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 11px;
    min-width: 0;
}
.homolog-vehicle-search-input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}
.homolog-vehicles-hint {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
    padding: 4px 10px;
    border: 1px dashed var(--glass-border);
    border-radius: 6px;
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.7;
    white-space: nowrap;
}
.homolog-vehicles-hint i {
    color: var(--accent);
    font-size: 10px;
}
.homolog-vehicle-pool {
    display: flex;
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 20px 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--glass-border) transparent;
}
.homolog-vehicle-pool::-webkit-scrollbar {
    height: 4px;
}
.homolog-vehicle-pool::-webkit-scrollbar-track {
    background: transparent;
}
.homolog-vehicle-pool::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}
.homolog-vehicle-item {
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 6px 12px;
    cursor: grab;
    background: var(--sub-bg);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    min-width: 0;
    white-space: nowrap;
}
.homolog-vehicle-item:hover {
    border-color: var(--glass-border);
    background: var(--sub-bg-hover);
    transform: translateY(-1px);
}
.homolog-vehicle-item.is-online {
    border-left: 2px solid var(--accent);
}
.homolog-vehicle-item.is-dragging { opacity: .4; cursor: grabbing; }
.hvi-top {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.hvi-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hvi-plate {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    flex-shrink: 0;
}
.hvi-meta {
    display: none;
}

/* ── Main Layout (calendar + day panel) ── */
.homolog-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 0;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── Calendar (main area) ── */
.homolog-calendar-wrap {
    display: flex;
    flex-direction: column;
    padding: 16px;
    overflow: hidden;
    min-height: 0;
}
.homolog-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0 0 10px;
}
.homolog-weekdays span { text-align: center; }
.homolog-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-template-rows: repeat(6, minmax(0, 1fr));
    gap: 4px;
    flex: 1;
    min-height: 0;
}
.homolog-day-cell {
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    background: var(--sub-bg);
    color: var(--text);
    text-align: left;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all 0.15s ease;
    cursor: pointer;
    overflow: hidden;
    min-height: 0;
}
.homolog-day-cell:hover {
    border-color: rgba(74, 222, 128, 0.25);
    background: var(--sub-bg-hover);
}
.homolog-day-cell.is-out { opacity: 0.35; }
.homolog-day-cell.is-today {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.15) inset, 0 0 12px -4px rgba(74,222,128,0.15);
}
.homolog-day-cell.is-selected {
    border-color: var(--accent);
    background: linear-gradient(180deg, rgba(74, 222, 128, 0.08), rgba(74, 222, 128, 0.02));
    box-shadow: 0 0 16px -4px rgba(74,222,128,0.1);
}
.homolog-day-cell.is-drop-target {
    border-color: #5ea8ff;
    box-shadow: 0 0 0 2px rgba(94, 168, 255, 0.2) inset;
    background: rgba(94,168,255,0.06);
}
.homolog-day-num {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
}
.homolog-day-items {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    flex: 1;
}
.homolog-item-mini {
    border: 0; border-radius: 6px; padding: 2px 6px; width: 100%; text-align: left;
    display: grid; grid-template-columns: 20px 1fr; gap: 6px; font-size: 11px; color: #fff;
    background: rgba(127, 140, 155, 0.35);
}
.homolog-mini-time { font-weight: 700; opacity: .95; }
.homolog-mini-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.homolog-mini-more { font-size: 11px; color: var(--text-muted); padding-left: 2px; }

.homolog-item-tag {
    border: 0;
    border-radius: 8px;
    padding: 4px 5px;
    width: 100%;
    min-width: 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    font-size: 10px;
    line-height: 1.3;
    background: rgba(74,222,128,0.2);
    color: var(--text);
    cursor: pointer;
    min-height: 0;
    border-left: 2px solid rgba(74,222,128,0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.15s ease;
}
.homolog-item-tag:hover { filter: brightness(1.15); transform: scale(1.02); }
.homolog-tag-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    line-height: 1.2;
    font-weight: 800;
    width: 100%;
    letter-spacing: 0.01em;
    font-variant-numeric: tabular-nums;
}
.homolog-tag-meta {
    font-size: 9px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 3px;
    color: currentColor;
    opacity: 0.8;
    min-width: 0;
}
.homolog-tag-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    display: inline-block;
    flex: 0 0 6px;
}
.homolog-tag-status-dot.is-agendado { background: #5ea8ff; }
.homolog-tag-status-dot.is-homologado { background: #4ade80; }
.homolog-tag-status-dot.is-sin-homologar { background: #fbbf24; }
.homolog-tag-status-dot.is-fallida { background: #f87171; }

.homolog-item-mini.is-agendado, .homolog-pill.is-agendado { background: rgba(94, 168, 255, 0.2); color: #a9d6ff; }
.homolog-item-mini.is-homologado, .homolog-pill.is-homologado { background: rgba(74, 222, 128, 0.2); color: #86efac; }
.homolog-item-mini.is-sin-homologar, .homolog-pill.is-sin-homologar { background: rgba(251, 191, 36, 0.2); color: #fde68a; }
.homolog-item-mini.is-fallida, .homolog-pill.is-fallida { background: rgba(248, 113, 113, 0.2); color: #fca5a5; }
.homolog-item-mini.is-holiday { background: rgba(74, 222, 128, 0.35); color: #bbf7d0; cursor: default; }

.homolog-item-tag.is-agendado {
    background: rgba(94, 168, 255, 0.18);
    border-left-color: #5ea8ff;
    color: #c5dcff;
}
.homolog-item-tag.is-homologado {
    background: rgba(74, 222, 128, 0.18);
    border-left-color: #4ade80;
    color: #bbf7d0;
}
.homolog-item-tag.is-sin-homologar {
    background: rgba(251, 191, 36, 0.18);
    border-left-color: #fbbf24;
    color: #fde68a;
}
.homolog-item-tag.is-fallida {
    background: rgba(248, 113, 113, 0.18);
    border-left-color: #f87171;
    color: #fca5a5;
}

.homolog-day-modal-list {
    max-height: min(68vh, 560px);
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 2px;
}

/* ── Day Panel (right) ── */
.homolog-day-panel {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-left: 1px solid var(--glass-border);
    overflow: hidden;
}
.homolog-day-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
}
.homolog-day-head-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--accent-glow);
    color: var(--accent);
    font-size: 13px;
    flex-shrink: 0;
}
.homolog-day-head h4 {
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}
.homolog-day-add-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--glass-border);
    background: var(--sub-bg);
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s ease;
    flex-shrink: 0;
}
.homolog-day-add-btn:hover {
    background: var(--accent-glow);
    color: var(--accent);
    border-color: var(--accent);
}
.homolog-day-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    flex: 1;
    padding: 12px;
}
.homolog-card {
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 10px 12px;
    background: var(--sub-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.homolog-card.is-agendado { border-left: 3px solid #5ea8ff; }
.homolog-card.is-homologado { border-left: 3px solid #4ade80; }
.homolog-card.is-sin-homologar { border-left: 3px solid #fbbf24; }
.homolog-card.is-fallida { border-left: 3px solid #f87171; }
.homolog-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.homolog-pill { border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 700; border: 1px solid transparent; }
.homolog-time { color: var(--text-muted); font-size: 12px; font-weight: 600; }
.homolog-vehicle { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.homolog-meta { color: var(--text-muted); font-size: 12px; margin-bottom: 2px; }
.homolog-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.homolog-empty {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border: 1px dashed var(--glass-border);
    border-radius: 10px;
    color: var(--text-muted);
    text-align: center;
    padding: 12px;
    font-size: 12px;
}

@media (max-width: 1100px) {
    .vehicles-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .vehicles-header-actions {
        width: 100%;
        justify-content: flex-start;
    }
    .vehicle-card-row {
        grid-template-columns: 1fr;
    }
    .vehicle-card-status {
        align-self: auto;
        padding-right: 0;
        padding-bottom: 12px;
        border-right: none;
        border-bottom: 1px solid rgba(92, 111, 145, 0.16);
    }
    .vehicle-card-main { width: 100%; }
    .vehicles-toolbar-main {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1200px) {
    .vehicle-modal-head {
        grid-template-columns: 1fr;
    }
    .vehicle-modal-head-side {
        justify-content: flex-start;
    }
    .vehicle-modal-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .homolog-layout {
        grid-template-columns: 1fr;
    }
    .homolog-day-panel {
        border-left: none;
        border-top: 1px solid var(--glass-border);
    }
    .homolog-day-list { max-height: none; }
}

@media (max-width: 768px) {
    .homolog-vehicles-strip-head {
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px 12px;
    }
    .homolog-vehicle-search-wrap { width: 140px; }
    .homolog-vehicles-hint { display: none; }
    .homolog-vehicle-pool { padding: 6px 12px 8px; }
    .homolog-toolbar { padding: 10px 12px; gap: 10px; }
    .homolog-toolbar-center { display: none; }
}

@media (max-width: 768px) {
    #appModal.vehicle-form-modal {
        padding-left: 0;
        padding-right: 0;
    }
    #appModal.vehicle-form-modal .modal-dialog.vehicle-form-dialog {
        width: calc(100vw - 12px) !important;
        max-width: calc(100vw - 12px) !important;
        margin: calc(var(--topbar-h) + 6px) auto calc(var(--footer-h) + 6px);
        height: calc(100dvh - var(--topbar-h) - var(--footer-h) - 12px);
        max-height: calc(100dvh - var(--topbar-h) - var(--footer-h) - 12px);
    }
    #appModal.vehicle-form-modal .geonex-modal {
        border-radius: 18px;
    }
    #appModal.vehicle-form-modal .modal-header,
    #appModal.vehicle-form-modal .modal-body,
    #appModal.vehicle-form-modal .modal-footer {
        padding-left: 16px;
        padding-right: 16px;
    }
    #appModal.vehicle-form-modal .modal-footer {
        justify-content: stretch;
    }
    #appModal.vehicle-form-modal .modal-footer .btn,
    #appModal.vehicle-form-modal .modal-footer .modal-form-actions-note {
        width: 100%;
        max-width: none;
    }
    #appModal.vehicle-detail-modal .modal-dialog.vehicle-detail-dialog {
        width: calc(100vw - 12px) !important;
        max-width: calc(100vw - 12px) !important;
        margin: calc(var(--topbar-h) + 6px) auto calc(var(--footer-h) + 6px);
        height: calc(100dvh - var(--topbar-h) - var(--footer-h) - 12px);
        max-height: calc(100dvh - var(--topbar-h) - var(--footer-h) - 12px);
    }
    #appModal.vehicle-detail-modal {
        padding-left: 0;
        padding-right: 0;
    }
    #appModal.vehicle-detail-modal .geonex-modal {
        border-radius: 18px;
    }
    #appModal.vehicle-detail-modal .modal-header,
    #appModal.vehicle-detail-modal .modal-body,
    #appModal.vehicle-detail-modal .modal-footer {
        padding-left: 16px;
        padding-right: 16px;
    }
    #appModal.vehicle-detail-modal .modal-footer {
        justify-content: stretch;
        gap: 8px;
    }
    #appModal.vehicle-detail-modal .modal-footer .btn {
        flex: 1 1 calc(33.333% - 6px);
        min-width: 0;
        padding-left: 12px;
        padding-right: 12px;
    }
    .vehicles-header {
        padding: 18px 18px;
    }
    .vehicles-header-subtitle {
        font-size: 13px;
    }
    .vehicles-toolbar-main {
        grid-template-columns: 1fr;
    }
    .vehicles-toolbar-summary {
        flex-direction: column;
        align-items: stretch;
    }
    .vehicles-toolbar,
    .vehicles-list-shell {
        border-radius: 16px;
    }
    .vehicle-card-row {
        grid-template-columns: 1fr;
        gap: 18px;
        padding: 18px;
    }
    .vehicle-card-status {
        align-items: center;
        padding-right: 0;
        padding-bottom: 14px;
        border-right: 0;
        border-bottom: 1px solid var(--sub-border);
    }
    .vehicle-status-rail {
        width: 100%;
        height: 3px;
        align-self: auto;
        background: var(--sub-bg);
    }
    .vehicle-card-head {
        flex-direction: column;
        align-items: flex-start;
    }
    .vehicle-card-quickmeta {
        justify-content: flex-start;
    }
    .vehicle-card-metadata {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }
    .vehicle-meta-chip {
        width: 100%;
        padding-right: 0;
        border-right: 0;
        padding-bottom: 12px;
        border-bottom: 1px solid var(--sub-border);
    }
    .vehicle-meta-chip:last-child {
        padding-bottom: 0;
        border-bottom: 0;
    }
    .vehicle-card-actions {
        flex-direction: row;
        justify-content: flex-start;
        padding-left: 0;
    }
    .vehicle-modal-summary {
        grid-template-columns: 1fr;
    }
    .vehicle-modal-summary-item,
    .vehicle-modal-summary-item-wide {
        width: 100%;
        min-width: 0;
    }
    .vehicle-modal-grid {
        grid-template-columns: 1fr;
    }
    .vehicle-modal-section-secondary .vehicle-modal-item:last-child:nth-child(odd) {
        grid-column: auto;
    }
    .vehicle-modal-section {
        padding: 14px;
    }
    .modal-form-grid {
        grid-template-columns: 1fr;
    }
    .homolog-toolbar { flex-direction: column; align-items: stretch; }
    .homolog-toolbar-left, .homolog-toolbar-right { width: 100%; }
    .homolog-title { min-width: auto; }
    .homolog-calendar-grid { grid-template-rows: repeat(6, minmax(92px, 1fr)); }
    .homolog-status-legend { gap: 10px; }
    .homolog-day-cell { min-height: 92px; padding: 6px; gap: 5px; }
    .homolog-day-items { gap: 4px; }
    .homolog-item-tag { min-height: 40px; padding: 4px 4px; border-radius: 8px; }
    .homolog-tag-title { font-size: 12px; }
    .homolog-tag-meta { font-size: 9.2px; }
    .homolog-tag-status-dot { width: 6px; height: 6px; flex: 0 0 6px; }
    .homolog-mini-more { font-size: 10px; }
}

@media (max-width: 1100px) {
    .clavijero-layout {
        grid-template-columns: 1fr;
    }
    .clavijero-calendar-card {
        position: static;
        min-height: 0;
        max-height: none;
    }
    .clavijero-detail-card {
        min-height: 0;
        max-height: none;
    }
    .clavijero-route-list {
        overflow: visible;
        padding-right: 0;
    }
}

@media (max-width: 768px) {
    .clavijero-summary {
        flex-direction: column;
        padding: 18px;
    }
    .clavijero-summary-metrics {
        width: 100%;
        justify-content: flex-start;
    }
    .clavijero-metric {
        flex: 1 1 120px;
        min-width: 0;
    }
    .clavijero-calendar-card,
    .clavijero-detail-card {
        padding: 16px;
    }
    .clavijero-calendar-weekdays,
    .clavijero-calendar-grid {
        gap: 8px;
    }
    .clavijero-day,
    .clavijero-day.is-empty {
        min-height: 78px;
        padding: 10px 8px;
        border-radius: 14px;
    }
    .clavijero-day-stat,
    .clavijero-day-empty-label {
        min-height: 20px;
        padding: 0 6px;
        font-size: 0.58rem;
    }
    .clavijero-day-stat strong {
        font-size: 0.68rem;
    }
    .clavijero-day-stat small {
        font-size: 0.54rem;
    }
    .clavijero-detail-head,
    .clavijero-route-card-head {
        flex-direction: column;
        align-items: flex-start;
    }
    .clavijero-detail-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .clavijero-modal-summary {
        grid-template-columns: 1fr;
    }
    .clavijero-time-composer {
        grid-template-columns: 1fr;
    }
    .clavijero-time-controls {
        grid-template-columns: 1fr;
    }
    .clavijero-time-input-wrap {
        flex-direction: column;
        align-items: stretch;
    }
    .clavijero-time-input-wrap .form-control {
        max-width: none;
        width: 100%;
    }
    .clavijero-route-list {
        grid-template-columns: 1fr;
    }
    .clavijero-empty {
        min-height: 180px;
        flex-direction: column;
        align-items: flex-start;
    }
    .clavijero-actions-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .clavijero-actions-group {
        justify-content: stretch;
    }
    .clavijero-action-btn {
        width: 100%;
    }
    .workers-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .workers-toolbar-actions {
        justify-content: stretch;
    }
    .workers-toolbar-btn {
        width: 100%;
    }
    .workers-toolbar-search {
        min-width: 0;
        flex-basis: 100%;
    }
    .workers-panel-head {
        flex-direction: column;
        align-items: flex-start;
    }
    .workers-panel-stats {
        width: 100%;
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    .workers-table-wrap {
        overflow-x: auto;
    }
    .workers-table {
        min-width: 760px;
    }
    .workers-empty {
        min-height: 180px;
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ════════════════════════════════════════════════════════════
   MONITOR DE DESPACHOS
════════════════════════════════════════════════════════════ */
.dispatch-table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    margin-top: 4px;
}
.dispatch-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    min-width: 600px;
}
.dispatch-table thead tr {
    background: var(--bg-dark);
}
.dispatch-table th {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 10px 12px;
    text-align: center;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: var(--bg-dark);
    z-index: 2;
}
.dispatch-table th.stop-header-origin { color: var(--accent); }
.dispatch-table th.th-departure,
.dispatch-table th.th-unit {
    text-align: left;
    padding-left: 16px;
    min-width: 80px;
}
.dispatch-stop-est {
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--text-muted);
    opacity: .7;
    margin-top: 2px;
}
.dispatch-stop-tag {
    display: inline-block;
    font-size: 0.56rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 3px;
    vertical-align: middle;
}
.dispatch-stop-tag.origin { background: rgba(0,184,148,.15); color: var(--accent); }
.dispatch-stop-tag.dest   { background: rgba(231,76,60,.15); color: #e74c3c; }
.dispatch-table td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--border);
    text-align: center;
    vertical-align: middle;
}
.dispatch-table td.td-departure,
.dispatch-table td.td-plate {
    text-align: left;
    padding-left: 16px;
}
.dispatch-table tr:last-child td { border-bottom: none; }
.dispatch-table tr.dispatch-row:hover > td { background: rgba(255,255,255,.03); }
.dispatch-table .td-departure {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
    white-space: nowrap;
    min-width: 70px;
}
.dispatch-vehicle-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.dispatch-vehicle-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
}
.dispatch-vehicle-plate {
    font-size: 0.67rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.dispatch-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 72px;
    padding: 2px 0;
}
.dispatch-cell-time {
    font-size: 0.77rem;
    font-weight: 700;
    line-height: 1;
}
.dispatch-cell-delay {
    font-size: 0.65rem;
    font-weight: 800;
    border-radius: 4px;
    padding: 1px 5px;
    letter-spacing: .01em;
}
.dispatch-cell-nodato {
    font-size: 1rem;
    color: var(--text-muted);
    opacity: .4;
}
/* Status colors */
.dispatch-cell.verde .dispatch-cell-time  { color: #00b894; }
.dispatch-cell.verde .dispatch-cell-delay { background: rgba(0,184,148,.15); color: #00b894; }
.dispatch-cell.amarillo .dispatch-cell-time  { color: #f39c12; }
.dispatch-cell.amarillo .dispatch-cell-delay { background: rgba(243,156,18,.15); color: #f39c12; }
.dispatch-cell.rojo .dispatch-cell-time  { color: #e74c3c; }
.dispatch-cell.rojo .dispatch-cell-delay { background: rgba(231,76,60,.15); color: #e74c3c; }
/* Row background tints */
.dispatch-row.row-rojo    > .td-departure { border-left: 3px solid #e74c3c; }
.dispatch-row.row-amarillo > .td-departure { border-left: 3px solid #f39c12; }
td.td-departure { border-left: 3px solid transparent; }
/* Date separator */
.dispatch-date-row > td {
    background: var(--bg-dark);
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    padding: 7px 16px;
    text-align: left;
    border-top: 1px solid var(--border);
}
/* Summary stats */
.dispatch-summary {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    align-items: stretch;
}
.dispatch-stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 18px;
    min-width: 84px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.dispatch-stat-num {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1;
}
.dispatch-stat-label {
    font-size: 0.67rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    line-height: 1.3;
}
.dispatch-stat.verde   .dispatch-stat-num { color: #00b894; }
.dispatch-stat.amarillo .dispatch-stat-num { color: #f39c12; }
.dispatch-stat.rojo    .dispatch-stat-num { color: #e74c3c; }
.dispatch-stat.sin_dato .dispatch-stat-num { color: var(--text-muted); }
/* Legend */
.dispatch-legend {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 14px;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.dispatch-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.dispatch-legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dispatch-legend-dot.verde   { background: #00b894; }
.dispatch-legend-dot.amarillo { background: #f39c12; }
.dispatch-legend-dot.rojo    { background: #e74c3c; }
.dispatch-legend-dot.sin_dato { background: var(--text-muted); opacity: .5; }
/* Selector fields */
.rpt-field-service select.rpt-input,
.rpt-field-route   select.rpt-input {
    width: 100%;
}
@media (max-width: 768px) {
    .dispatch-stat {
        min-width: 65px;
        padding: 9px 12px;
    }
    .dispatch-stat-num { font-size: 1.2rem; }
    .dispatch-table { font-size: 0.72rem; }
    .dispatch-cell { min-width: 58px; }
}

/* ═══════════════════════════════════════════════════════════════
   CLAVIJERO URBANO MANUAL — Tablero de Despacho GeoNex
════════════════════════════════════════════════════════════════ */

/* ── Layout raíz ── */
#page-clavijero-urbano .page-content.has-max {
    --cu-toolbar-h: 0px;
    --cu-stats-h: 0px;
    max-width: 100%;
    width: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - var(--topbar-h) - var(--footer-h));
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* ── Header principal ── */
.cu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px 12px;
    gap: 12px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    flex-shrink: 0;
}
.cu-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.cu-back-btn {
    width: 34px; height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    background: transparent;
    color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.15s; flex-shrink: 0;
    font-size: 0.85rem;
}
.cu-back-btn:hover { background: rgba(255,255,255,0.12); color: var(--text); }
.cu-header-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cu-header-kicker {
    font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1.5px;
    color: var(--accent); font-weight: 600;
}
.cu-header-title {
    font-size: 1.1rem; font-weight: 700; color: var(--text);
    margin: 0; line-height: 1.3;
}
.cu-header-right {
    display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; min-width: 0;
}
.cu-date-nav {
    display: flex; align-items: center; gap: 4px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 3px;
    min-width: min(100%, 360px);
}
.cu-date-btn {
    width: 28px; height: 28px;
    border-radius: 7px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.15s;
    font-size: 0.75rem;
}
.cu-date-btn:hover { background: rgba(255,255,255,0.1); color: var(--text); }
.cu-date-input {
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
    width: 120px;
    min-width: 0;
    text-align: center;
    outline: none;
    cursor: pointer;
    padding: 2px 4px;
}
.cu-date-input:focus { outline: none; box-shadow: none; }
.cu-today-btn {
    padding: 4px 10px; border-radius: 7px;
    border: 1px solid rgba(0,184,148,0.3);
    background: rgba(0,184,148,0.08);
    color: var(--accent); cursor: pointer;
    font-size: 0.75rem; font-weight: 600;
    transition: all 0.15s;
}
.cu-today-btn:hover { background: rgba(0,184,148,0.2); }
.cu-icon-btn {
    width: 32px; height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.15s; font-size: 0.8rem;
}
.cu-icon-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.cu-refresh-btn {
    padding: 5px 12px; border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    display: flex; align-items: center; gap: 6px;
    cursor: pointer; transition: all 0.15s; font-size: 0.78rem;
    min-width: 0;
}
.cu-refresh-btn:hover { background: rgba(255,255,255,0.1); color: var(--text); }
.cu-refresh-btn.spinning i { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.cu-last-refresh {
    font-size: 0.65rem; color: var(--text-muted); line-height: 1;
}
.cu-generate-btn {
    padding: 5px 14px; border-radius: 8px;
    border: 1px solid rgba(52,152,219,0.3);
    background: rgba(52,152,219,0.08);
    color: #3498db; cursor: pointer;
    font-size: 0.78rem; font-weight: 600;
    display: flex; align-items: center; gap: 6px;
    transition: all 0.15s;
}
.cu-generate-btn:hover { background: rgba(52,152,219,0.18); border-color: rgba(52,152,219,0.5); }

.cu-search-toolbar {
    position: sticky;
    top: 0;
    z-index: 9;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(17,22,25,0.96), rgba(14,18,21,0.92));
    backdrop-filter: blur(14px) saturate(145%);
    -webkit-backdrop-filter: blur(14px) saturate(145%);
}
.cu-search-box {
    flex: 1 1 320px;
    min-width: 220px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.cu-search-box i {
    color: var(--text-muted);
    font-size: 0.82rem;
}
.cu-search-input {
    flex: 1;
    min-width: 0;
    height: 40px;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font-size: 0.9rem;
}
.cu-search-input::placeholder {
    color: rgba(176,188,200,0.7);
}
.cu-search-clear {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: all 0.15s;
}
.cu-search-clear.is-visible {
    opacity: 1;
    pointer-events: auto;
}
.cu-search-clear:hover {
    background: rgba(231,76,60,0.12);
    color: #e74c3c;
}
.cu-search-clear:disabled {
    cursor: default;
}
.cu-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.cu-filter-chip {
    min-height: 38px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}
.cu-filter-chip:hover {
    border-color: rgba(74,222,128,0.28);
    color: var(--text);
}
.cu-filter-chip.is-active {
    background: rgba(74,222,128,0.16);
    border-color: rgba(74,222,128,0.36);
    color: var(--accent);
    box-shadow: 0 0 0 1px rgba(74,222,128,0.08) inset;
}
.cu-search-meta {
    flex: 1 1 100%;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.74rem;
    line-height: 1.4;
}
.cu-route-switcher {
    flex: 1 1 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cu-route-switcher-mobile {
    display: none;
}
.cu-route-switcher-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
}
.cu-route-switcher-label {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    flex: 0 0 auto;
}
.cu-route-chip {
    min-height: 36px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    cursor: pointer;
    transition: all 0.15s;
    max-width: min(320px, 78vw);
}
.cu-route-chip:hover {
    border-color: rgba(74,222,128,0.28);
    color: var(--text);
}
.cu-route-chip.is-active {
    background: rgba(74,222,128,0.14);
    border-color: rgba(74,222,128,0.32);
    color: var(--text);
    box-shadow: 0 0 0 1px rgba(74,222,128,0.08) inset;
}
.cu-route-chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    flex: 0 0 auto;
}
.cu-route-chip-name {
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cu-route-chip-count {
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    color: inherit;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.1;
}
.cu-route-switcher-mobile-label {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.cu-route-select-wrap {
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
}
.cu-route-select-wrap i {
    color: var(--text-muted);
    font-size: 0.78rem;
    flex: 0 0 auto;
}
.cu-route-select {
    width: 100%;
    min-width: 0;
    height: 38px;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 700;
    appearance: none;
}
.cu-route-select option {
    background: #12171a;
    color: var(--text);
}

/* ── Barra de estadísticas ── */
.cu-stats-bar {
    display: flex; flex-direction: column;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.12);
    flex-shrink: 0;
    padding: 10px 14px 8px;
    gap: 8px;
}

/* Fila superior: buscador + filtros */
.cu-sb-top {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.cu-sb-search {
    display: flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border); border-radius: 8px;
    padding: 5px 10px; flex: 1 1 220px; min-width: 0;
}
.cu-sb-search i { color: var(--text-muted); font-size: 0.72rem; flex-shrink: 0; }
.cu-sb-search input {
    background: transparent; border: none; outline: none;
    color: var(--text); font-size: 0.8rem; width: 100%;
    font-family: inherit;
}
.cu-sb-search input::placeholder { color: var(--text-muted); opacity: 0.6; }
.cu-sb-filters {
    display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
}
.cu-sb-filter {
    background: rgba(255,255,255,0.05); border: 1px solid var(--border);
    border-radius: 20px; padding: 4px 12px;
    color: var(--text-muted); font-size: 0.7rem; font-weight: 600;
    cursor: pointer; transition: all 0.15s; white-space: nowrap;
    font-family: inherit; letter-spacing: 0.2px;
}
.cu-sb-filter:hover { background: rgba(255,255,255,0.1); color: var(--text); }
.cu-sb-filter.active {
    background: rgba(0,184,148,0.18); border-color: var(--accent);
    color: var(--accent);
}

/* Texto resumen */
.cu-sb-summary {
    font-size: 0.72rem; color: var(--text-muted); margin: 0;
    line-height: 1;
}

/* Fila de contadores */
.cu-sb-counts {
    display: flex; align-items: stretch; gap: 0;
    border: 1px solid var(--border); border-radius: 8px;
    overflow: hidden; width: fit-content;
}
.cu-sb-count {
    display: flex; flex-direction: column; align-items: center;
    padding: 5px 16px; gap: 1px;
    border-right: 1px solid var(--border);
}
.cu-sb-count:last-child { border-right: none; }
.cu-sb-count span {
    font-size: 1.15rem; font-weight: 800; line-height: 1;
    font-variant-numeric: tabular-nums; color: var(--text);
}
.cu-sb-count label {
    font-size: 0.52rem; text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--text-muted); font-weight: 600; cursor: default; white-space: nowrap;
}
.cu-sb-count--enruta span    { color: #4ade80; }
.cu-sb-count--finalizado span{ color: #a78bfa; }
.cu-sb-count--diferido span  { color: #e67e22; }
.cu-sb-count--asignado span  { color: #3498db; }

/* ── Responsive stats bar ── */
@media (max-width: 768px) {
    .cu-stats-bar  { padding: 8px 12px; gap: 6px; }
    .cu-sb-top     { flex-direction: column; align-items: stretch; gap: 6px; }
    .cu-sb-search  { flex: none; }
    .cu-sb-filters { gap: 4px; }
    .cu-sb-filter  { font-size: 0.68rem; padding: 3px 9px; }
    .cu-sb-summary { font-size: 0.7rem; }
    .cu-sb-count span  { font-size: 0.95rem; }
    .cu-sb-count label { font-size: 0.48rem; }
}
@media (max-width: 480px) {
    .cu-stats-bar  { padding: 6px 10px; }
    .cu-sb-counts  { width: 100%; }
    .cu-sb-count   { flex: 1; padding: 4px 8px; }
    .cu-sb-count span  { font-size: 0.85rem; }
    .cu-sb-count label { font-size: 0.44rem; }
}

/* ── Cuerpo del tablero ── */
.cu-board {
    flex: 0 0 auto;
    overflow: visible;
    padding: 16px 24px 24px;
    min-width: 0;
}
.cu-loading {
    padding: 60px 20px;
    text-align: center; color: var(--text-muted);
    font-size: 0.9rem; display: flex; align-items: center; justify-content: center; gap: 10px;
}
.cu-empty {
    padding: 60px 20px;
    text-align: center; color: var(--text-muted);
    font-size: 0.9rem;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.cu-empty i { font-size: 2rem; opacity: 0.4; }

/* ── Bloque de ruta ── */
.cu-route-block {
    margin-bottom: 20px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    overflow: hidden;
    min-width: 0;
}
.cu-route-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px;
    background: rgba(14,18,21,0.88);
    backdrop-filter: blur(14px) saturate(145%);
    -webkit-backdrop-filter: blur(14px) saturate(145%);
    border-bottom: 1px solid var(--border);
    border-left: 4px solid var(--rc, #00b894);
    gap: 12px;
    flex-wrap: wrap;
}
.cu-route-header-left {
    display: flex; align-items: center; gap: 10px; flex: 1 1 320px; flex-wrap: wrap; min-width: min(320px, 100%);
}
.cu-route-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.cu-route-name {
    flex: 1 1 220px;
    min-width: min(220px, 100%);
    font-size: 0.88rem; font-weight: 700; color: var(--text);
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    line-height: 1.25;
}
.cu-route-badge {
    font-size: 0.65rem; padding: 2px 7px; border-radius: 20px;
    font-weight: 600; background: rgba(255,255,255,0.05);
    border: 1px solid var(--border); color: var(--text-muted); white-space: normal; max-width: 100%;
}
.cu-route-header-right {
    display: flex; align-items: center; gap: 6px;
}
.cu-route-action-btn {
    padding: 4px 10px; border-radius: 7px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer; transition: all 0.15s;
    font-size: 0.72rem; font-weight: 600;
    display: flex; align-items: center; gap: 5px;
}
.cu-route-action-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.cu-route-action-btn--gen { color: #3498db; border-color: rgba(52,152,219,0.25); background: rgba(52,152,219,0.05); }
.cu-route-action-btn--gen:hover { background: rgba(52,152,219,0.15); }
.cu-no-departures {
    padding: 28px 20px;
    text-align: center; color: var(--text-muted);
    font-size: 0.82rem;
}

/* ── Área de slots con scroll horizontal ── */
.cu-departures-scroll {
    overflow-x: auto;
    padding: 12px 14px 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
    max-width: 100%;
}
.cu-departures-scroll::-webkit-scrollbar { height: 5px; }
.cu-departures-scroll::-webkit-scrollbar-track { background: transparent; }
.cu-departures-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
.cu-departures-row {
    display: flex; gap: 8px;
    min-width: max-content;
    align-items: flex-start;
}

/* ── Tarjeta de slot ── */
.cu-slot {
    width: 144px;
    min-height: 188px;
    border-radius: 11px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.025);
    display: flex; flex-direction: column;
    position: relative;
    transition: all 0.15s;
    overflow: hidden;
    flex-shrink: 0;
}
.cu-slot:hover { border-color: rgba(255,255,255,0.18); background: rgba(255,255,255,0.04); }

/* Estados del slot */
.cu-slot--asignado { border-color: rgba(52,152,219,0.4); background: rgba(52,152,219,0.04); }
.cu-slot--en_ruta  { border-color: rgba(0,184,148,0.5); background: rgba(0,184,148,0.05); box-shadow: 0 0 10px rgba(0,184,148,0.1); }
.cu-slot--finalizado { border-color: rgba(39,174,96,0.35); background: rgba(39,174,96,0.04); }
.cu-slot--diferido { border-color: rgba(230,126,34,0.4); background: rgba(230,126,34,0.04); }
.cu-slot--cancelado { border-color: rgba(231,76,60,0.3); background: rgba(231,76,60,0.03); }

/* Franja de color superior según estado */
.cu-slot-stripe {
    height: 3px; width: 100%; flex-shrink: 0;
}
.cu-slot--asignado  .cu-slot-stripe { background: #3498db; }
.cu-slot--en_ruta   .cu-slot-stripe { background: var(--accent); animation: cu-pulse-bar 1.5s ease-in-out infinite; }
.cu-slot--finalizado .cu-slot-stripe { background: #27ae60; }
.cu-slot--diferido  .cu-slot-stripe { background: #e67e22; }
.cu-slot--cancelado .cu-slot-stripe { background: #e74c3c; }
.cu-slot-stripe.empty { background: transparent; }
@keyframes cu-pulse-bar { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* Hora dentro del slot */
.cu-slot-time {
    font-size: 1.05rem; font-weight: 800;
    color: var(--text);
    padding: 7px 10px 4px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
    line-height: 1;
}

/* Bus vacío (click para asignar) */
.cu-bus-empty {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 5px; cursor: pointer; color: var(--text-muted);
    padding: 8px 6px 10px;
    transition: all 0.15s;
    border-top: 1px dashed rgba(255,255,255,0.08);
    margin: 0 6px; border-radius: 0 0 6px 6px;
}
.cu-bus-empty:hover { color: var(--accent); }
.cu-bus-empty i { font-size: 1rem; opacity: 0.6; }
.cu-bus-empty span { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* Bus asignado */
.cu-bus-body {
    padding: 4px 10px 6px;
    flex: 1; display: flex; flex-direction: column; gap: 2px;
    min-width: 0;
}
.cu-bus-name {
    font-size: 0.8rem; font-weight: 700;
    color: var(--text); line-height: 1.2;
    white-space: normal; overflow: hidden; text-overflow: ellipsis; overflow-wrap: anywhere;
}
.cu-bus-plate {
    font-size: 0.68rem; color: var(--text-muted);
    font-weight: 600; letter-spacing: 0.5px;
}
.cu-bus-speed {
    font-size: 0.68rem; font-weight: 700;
    display: flex; align-items: center; gap: 3px;
}
.cu-bus-speed--moving { color: var(--accent); }
.cu-bus-speed--stopped { color: var(--text-muted); }

/* Badge de estado dentro del slot */
.cu-status-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 7px; border-radius: 20px;
    font-size: 0.6rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
    margin: 2px 0 4px;
    width: fit-content;
}
.cu-status-badge--asignado  { background: rgba(52,152,219,0.15); color: #3498db; }
.cu-status-badge--en_ruta   { background: rgba(0,184,148,0.15); color: var(--accent); }
.cu-status-badge--finalizado{ background: rgba(39,174,96,0.15); color: #27ae60; }
.cu-status-badge--diferido  { background: rgba(230,126,34,0.15); color: #e67e22; }
.cu-status-badge--cancelado { background: rgba(231,76,60,0.15); color: #e74c3c; }
.cu-status-badge i { font-size: 0.55rem; }

/* Hora real de despacho */
.cu-slot-actual {
    font-size: 0.6rem; color: var(--text-muted); padding: 0 10px 2px;
    display: flex; align-items: center; gap: 3px;
}
.cu-slot-actual i { color: var(--accent); }

/* Botones de acción del slot */
.cu-slot-actions {
    display: flex; gap: 3px;
    padding: 4px 6px 6px;
    border-top: 1px solid rgba(255,255,255,0.05);
    flex-wrap: wrap;
}
.cu-action-btn {
    flex: 1 1 calc(50% - 3px); padding: 4px 2px;
    border-radius: 6px; border: 1px solid transparent;
    background: transparent; cursor: pointer;
    font-size: 0.6rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.3px;
    transition: all 0.15s; line-height: 1.2;
    display: flex; align-items: center; justify-content: center; gap: 2px;
    color: var(--text-muted);
}
.cu-action-btn--dispatch,
.cu-action-btn--finish,
.cu-action-btn--reassign {
    flex-basis: 100%;
}
.cu-action-btn--dispatch { color: #3498db; border-color: rgba(52,152,219,0.2); }
.cu-action-btn--dispatch:hover { background: rgba(52,152,219,0.15); border-color: rgba(52,152,219,0.4); }
.cu-action-btn--finish  { color: #27ae60; border-color: rgba(39,174,96,0.2); }
.cu-action-btn--finish:hover  { background: rgba(39,174,96,0.15); border-color: rgba(39,174,96,0.4); }
.cu-action-btn--defer   { color: #e67e22; border-color: rgba(230,126,34,0.2); }
.cu-action-btn--defer:hover   { background: rgba(230,126,34,0.15); border-color: rgba(230,126,34,0.4); }
.cu-action-btn--remove  { color: var(--text-muted); border-color: transparent; }
.cu-action-btn--remove:hover  { background: rgba(231,76,60,0.12); color: #e74c3c; border-color: rgba(231,76,60,0.3); }
.cu-action-btn--reassign { color: #e67e22; border-color: rgba(230,126,34,0.2); }
.cu-action-btn--reassign:hover { background: rgba(230,126,34,0.15); border-color: rgba(230,126,34,0.4); }

/* Botón de eliminar horario (X esquina) */
.cu-slot-del-dep {
    position: absolute; top: 4px; right: 4px;
    width: 18px; height: 18px;
    border-radius: 5px; border: none;
    background: transparent; color: rgba(255,255,255,0.1);
    cursor: pointer; font-size: 0.55rem;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; line-height: 1; padding: 0;
}
.cu-slot:hover .cu-slot-del-dep { color: rgba(231,76,60,0.5); }
.cu-slot-del-dep:hover { background: rgba(231,76,60,0.15) !important; color: #e74c3c !important; }

/* Preview de paradas con tiempos estimados */
.cu-stops-preview {
    margin: 2px 8px 6px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.05);
    background: rgba(0,0,0,0.15);
}
.cu-stop-row {
    display: flex; align-items: center; gap: 5px;
    padding: 3px 7px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.6rem;
}
.cu-stop-row:last-child { border-bottom: none; }
.cu-stop-dot {
    width: 5px; height: 5px; border-radius: 50%;
    background: rgba(255,255,255,0.2); flex-shrink: 0;
}
.cu-stop-origin .cu-stop-dot { background: var(--accent); }
.cu-stop-dest   .cu-stop-dot { background: #e74c3c; }
.cu-stop-name { flex: 1; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cu-stop-time { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }

/* Indicador online */
.cu-online-dot {
    display: inline-block;
    width: 6px; height: 6px; border-radius: 50%;
    background: #636e72; margin-right: 3px; flex-shrink: 0;
    vertical-align: middle;
}
.cu-online-dot--on { background: #2ecc71; box-shadow: 0 0 5px rgba(46,204,113,0.5); }
.cu-online-dot--engine { background: var(--accent); box-shadow: 0 0 5px rgba(0,184,148,0.6); animation: cu-pulse-dot 1.5s ease-in-out infinite; }
@keyframes cu-pulse-dot { 0%,100%{opacity:1} 50%{opacity:0.5} }

/* ── Barra de herramientas de ruta (generar frecuencia) ── */
.cu-route-tools {
    display: flex; gap: 6px; align-items: center; flex-wrap: wrap; min-width: min(260px, 100%);
    flex: 0 1 auto;
    justify-content: flex-end;
}

/* ── Modal de generar frecuencia ── */
.cu-gen-row {
    display: flex; gap: 8px; align-items: flex-end;
}
.cu-gen-row .form-group { flex: 1; }

/* ── Separador de add-slot ── */
.cu-add-slot {
    width: 56px; height: 188px;
    border-radius: 11px;
    border: 1px dashed rgba(255,255,255,0.1);
    background: transparent;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 4px; cursor: pointer; color: rgba(255,255,255,0.2);
    transition: all 0.15s; flex-shrink: 0;
    font-size: 0.7rem;
}
.cu-add-slot:hover { border-color: rgba(0,184,148,0.4); color: var(--accent); background: rgba(0,184,148,0.04); }
.cu-add-slot i { font-size: 1rem; }

/* ── Light theme overrides ── */
/* ── Responsive ── */
@media (max-width: 1280px) {
    .cu-header {
        padding-inline: 16px;
    }
    .cu-search-toolbar {
        padding-inline: 16px;
    }
    .cu-board {
        padding: 14px 16px 20px;
    }
    .cu-filter-row {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 2px;
    }
    .cu-filter-chip {
        flex: 0 0 auto;
        white-space: nowrap;
    }
    .cu-route-header {
        align-items: flex-start;
        gap: 10px;
    }
    .cu-route-tools {
        width: 100%;
        justify-content: flex-start;
    }
    .cu-departures-scroll {
        overflow: visible;
        padding: 14px 16px 16px;
    }
    .cu-departures-row {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
        min-width: 0;
        gap: 12px;
    }
    .cu-slot,
    .cu-add-slot {
        width: 100%;
        min-width: 0;
    }
    .cu-slot {
        min-height: 208px;
    }
    .cu-add-slot {
        height: auto;
        min-height: 124px;
    }
}

@media (max-width: 768px) {
    .cu-header { padding: 10px 14px 10px; flex-direction: column; align-items: flex-start; gap: 8px; }
    .cu-header-left  { width: 100%; }
    .cu-header-right { width: 100%; flex-wrap: wrap; gap: 6px; }
    .cu-header-title { font-size: 0.95rem; }
    .cu-date-nav     { flex: 1 1 auto; width: 100%; justify-content: space-between; }
    .cu-date-input   { flex: 1 1 auto; min-width: 100px; font-size: 0.78rem; }
    .cu-today-btn    { flex-shrink: 0; }
    .cu-refresh-btn  { flex: 1 1 auto; justify-content: center; }
    .cu-search-toolbar { padding: 10px 14px; }
    .cu-search-box { flex-basis: 100%; }
    .cu-filter-row { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
    .cu-filter-chip { flex: 0 0 auto; white-space: nowrap; }
    .cu-search-meta { flex-direction: column; }
    .cu-route-switcher { width: 100%; }
    /* Stats bar: grid 3 col para que los 6 stats quepan en 2 filas */
    .cu-stats-bar    { display: grid !important; grid-template-columns: repeat(3, 1fr); gap: 0; }
    .cu-stat         { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 7px 6px; min-width: 0; }
    .cu-stat:nth-child(3),
    .cu-stat:nth-child(6) { border-right: none; }
    .cu-stat:nth-child(4),
    .cu-stat:nth-child(5),
    .cu-stat:nth-child(6) { border-bottom: none; }
    .cu-stat-val     { font-size: 1.1rem; }
    .cu-stat-lbl     { font-size: 0.58rem; letter-spacing: 0.5px; }
    /* Route header: envolver nombre y acciones */
    .cu-route-header { flex-wrap: wrap; gap: 6px; padding: 8px 12px; }
    .cu-route-header-left  { flex: 1 1 auto; min-width: 0; max-width: 100%; }
    .cu-route-tools { width: 100%; justify-content: flex-start; }
    .cu-route-name   { font-size: 0.82rem; white-space: normal; word-break: break-word; }
    .cu-route-action-btn { flex: 1 1 calc(50% - 4px); justify-content: center; min-height: 38px; }
    .cu-slot { width: 128px; min-height: 198px; }
    .cu-slot-time { font-size: 0.95rem; }
    .cu-board { padding: 10px 12px 20px; }
}

@media (max-width: 992px) {
    .cu-header {
        padding-inline: 16px;
    }
    .cu-search-toolbar {
        padding-inline: 16px;
    }
    .cu-board {
        padding-inline: 16px;
    }
    .cu-route-header {
        align-items: flex-start;
    }
    .cu-route-tools {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    #page-clavijero-urbano .page-content.has-max {
        min-height: calc(100dvh - var(--topbar-h) - var(--footer-h));
    }
    .cu-header {
        padding: 10px 12px;
        gap: 10px;
    }
    .cu-header-title {
        font-size: 1rem;
    }
    .cu-header-kicker {
        font-size: 0.66rem;
        letter-spacing: 0.12em;
    }
    .cu-date-nav {
        display: grid;
        grid-template-columns: 36px minmax(0, 1fr) 36px auto;
        width: 100%;
        gap: 6px;
        padding: 4px;
    }
    .cu-date-btn {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }
    .cu-date-input {
        width: 100%;
        min-width: 0;
        font-size: 0.88rem;
        font-weight: 700;
    }
    .cu-today-btn {
        min-height: 36px;
        padding-inline: 12px;
        white-space: nowrap;
    }
    .cu-refresh-btn {
        width: 100%;
        min-height: 38px;
        justify-content: center;
        flex-wrap: wrap;
        gap: 4px 10px;
    }
    .cu-search-toolbar {
        padding: 10px 12px;
        gap: 8px;
    }
    .cu-search-box {
        min-width: 0;
        padding-inline: 10px;
    }
    .cu-search-input {
        height: 38px;
        font-size: 0.86rem;
    }
    .cu-filter-chip {
        min-height: 34px;
        font-size: 0.72rem;
        padding: 6px 10px;
    }
    .cu-search-meta {
        font-size: 0.7rem;
    }
    .cu-route-switcher-mobile {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }
    .cu-route-switcher-chips {
        display: none;
    }
    .cu-last-refresh {
        font-size: 0.72rem;
    }
    .cu-stats-bar {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .cu-stat {
        min-width: 0;
        padding: 10px 8px;
        border-right: 1px solid var(--border);
        border-bottom: 1px solid var(--border);
    }
    .cu-stat:nth-child(2n) {
        border-right: none;
    }
    .cu-stat:nth-last-child(-n+2) {
        border-bottom: none;
    }
    .cu-stat-val {
        font-size: 1.2rem;
    }
    .cu-stat-lbl {
        font-size: 0.62rem;
        letter-spacing: 0.05em;
    }
    .cu-board {
        padding: 12px 10px 18px;
    }
    .cu-route-block {
        border-radius: 18px;
        margin-bottom: 16px;
    }
    .cu-route-header {
        padding: 12px;
        gap: 10px;
    }
    .cu-route-header-left {
        gap: 8px;
    }
    .cu-route-name {
        width: 100%;
        font-size: 0.94rem;
        line-height: 1.35;
    }
    .cu-route-badge {
        min-height: 30px;
        display: inline-flex;
        align-items: center;
        white-space: normal;
        line-height: 1.2;
    }
    .cu-route-tools {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
    .cu-route-action-btn {
        width: 100%;
        min-height: 40px;
        padding: 8px 10px;
        justify-content: center;
        font-size: 0.78rem;
    }
    .cu-departures-scroll {
        overflow: visible;
        padding: 12px;
    }
    .cu-departures-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        min-width: 0;
        gap: 12px;
    }
    .cu-slot,
    .cu-add-slot {
        width: 100%;
        min-width: 0;
    }
    .cu-slot {
        min-height: 224px;
    }
    .cu-add-slot {
        height: auto;
        min-height: 124px;
    }
    .cu-slot-time {
        padding: 10px 34px 6px 12px;
        font-size: 1rem;
    }
    .cu-bus-body {
        gap: 4px;
        padding: 4px 12px 8px;
    }
    .cu-bus-name {
        font-size: 0.92rem;
    }
    .cu-bus-plate,
    .cu-bus-speed,
    .cu-slot-actual {
        font-size: 0.72rem;
    }
    .cu-stops-preview {
        margin: 2px 12px 8px;
    }
    .cu-stop-row {
        padding: 4px 8px;
        font-size: 0.64rem;
    }
    .cu-stop-name {
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .cu-slot-actions {
        gap: 6px;
        padding: 6px 10px 10px;
    }
    .cu-action-btn {
        min-height: 34px;
        font-size: 0.64rem;
    }
    .cu-slot-del-dep {
        top: 8px;
        right: 8px;
        width: 22px;
        height: 22px;
        font-size: 0.62rem;
    }
    .cu-progress-btn {
        width: 30px;
        height: 30px;
        bottom: 10px;
        right: 10px;
    }
    .cu-progress-header {
        padding: 14px 14px 10px;
    }
    .cu-progress-title {
        white-space: normal;
    }
    .cu-progress-body {
        padding: 12px 12px 16px;
    }
}

@media (max-width: 480px) {
    .cu-date-nav {
        grid-template-columns: 36px minmax(0, 1fr) 36px;
    }
    .cu-today-btn {
        grid-column: 1 / -1;
        width: 100%;
    }
    .cu-route-tools {
        grid-template-columns: 1fr;
    }
    .cu-departures-row {
        grid-template-columns: 1fr;
    }
    .cu-slot {
        min-height: 0;
    }
    .cu-progress-panel {
        width: 100%;
        max-width: 100vw;
        right: -100%;
    }
    .cu-prog-stop {
        gap: 2px;
    }
    .cu-prog-stop-line {
        width: 24px;
    }
    .cu-prog-stop-card {
        margin-left: 0;
        padding: 10px;
    }
    .cu-prog-stop-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .cu-prog-stop-times {
        align-items: stretch;
    }
    .cu-prog-time-arrow {
        display: none;
    }
    .cu-prog-time-block {
        align-items: flex-start;
    }
}

@media (max-width: 360px) {
    .cu-header {
        padding-inline: 10px;
    }
    .cu-search-toolbar {
        padding-inline: 10px;
    }
    .cu-board {
        padding-inline: 8px;
    }
    .cu-route-header {
        padding: 10px;
    }
    .cu-route-name {
        font-size: 0.86rem;
    }
    .cu-route-action-btn {
        font-size: 0.72rem;
        min-height: 38px;
        padding-inline: 8px;
    }
    .cu-stat {
        padding: 8px 6px;
    }
    .cu-stat-val {
        font-size: 1.08rem;
    }
    .cu-stat-lbl {
        font-size: 0.56rem;
    }
    .cu-slot-time {
        font-size: 0.92rem;
    }
    .cu-bus-name {
        font-size: 0.86rem;
    }
    .cu-action-btn {
        font-size: 0.6rem;
    }
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   CLAVIJERO URBANO — Panel de Avance de Ruta
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* Botón icono dentro del slot */
.cu-progress-btn {
    position: absolute; bottom: 6px; right: 6px;
    background: rgba(52,152,219,0.12); border: 1px solid rgba(52,152,219,0.25);
    color: #3498db; border-radius: 7px; width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; cursor: pointer; transition: all 0.15s; z-index: 2;
}
.cu-progress-btn:hover { background: rgba(52,152,219,0.25); transform: scale(1.1); }
.cu-slot { position: relative; }

/* Panel lateral deslizante */
.cu-progress-panel {
    position: fixed; right: -440px; top: var(--topbar-h, 52px);
    width: 400px; bottom: var(--footer-h);
    background: linear-gradient(180deg, rgba(9,12,14,0.97), rgba(12,16,19,0.95));
    border-left: 1px solid var(--border);
    box-shadow: -6px 0 32px rgba(0,0,0,0.35);
    z-index: 300; display: flex; flex-direction: column;
    transition: right 0.3s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
    backdrop-filter: blur(18px) saturate(145%);
    -webkit-backdrop-filter: blur(18px) saturate(145%);
    isolation: isolate;
}
.cu-progress-panel.open { right: 0; }

.cu-progress-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
}
.cu-progress-inner::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(8,11,13,0.98) 0%, rgba(11,14,17,0.96) 100%),
        linear-gradient(rgba(190,210,220,0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(190,210,220,0.035) 1px, transparent 1px);
    background-size: auto, 28px 28px, 28px 28px;
    z-index: 0;
    pointer-events: none;
}
.cu-progress-inner > * {
    position: relative;
    z-index: 1;
}
.cu-progress-loading { display: flex; align-items: center; justify-content: center;
    flex: 1; color: var(--text-muted); font-size: 0.88rem; gap: 8px; }

/* Header del panel */
.cu-progress-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--border);
    background: rgba(12,16,19,0.92);
    flex-shrink: 0;
}
.cu-progress-header-info { flex: 1; min-width: 0; }
.cu-progress-title {
    font-size: 0.88rem; font-weight: 700; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-bottom: 4px;
}
.cu-progress-meta {
    display: flex; flex-direction: column; gap: 2px;
    font-size: 0.72rem; color: var(--text-muted);
}
.cu-progress-meta span { display: flex; align-items: center; gap: 5px; }
.cu-progress-close {
    background: transparent; border: 1px solid var(--border);
    color: var(--text-muted); border-radius: 7px; width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 0.8rem; transition: all 0.15s; flex-shrink: 0; margin-left: 8px;
}
.cu-progress-close:hover { background: rgba(231,76,60,0.15); color: #e74c3c; border-color: rgba(231,76,60,0.3); }

/* Cuerpo con scroll */
.cu-progress-body { flex: 1; overflow-y: auto; padding: 16px 14px; }
.cu-prog-stops { display: flex; flex-direction: column; gap: 0; }

/* Cada parada */
.cu-prog-stop {
    display: flex; gap: 0; align-items: stretch;
}
.cu-prog-stop-line {
    width: 32px; flex-shrink: 0;
    display: flex; flex-direction: column; align-items: center; gap: 0;
}
.cu-prog-stop-dot {
    width: 22px; height: 22px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; margin-top: 10px;
    z-index: 1;
}
.cu-prog-stop-line::after {
    content: ''; flex: 1; width: 2px;
    background: var(--border);
    min-height: 12px;
}
.cu-prog-stop-line.last::after { display: none; }

/* Tarjeta de parada */
.cu-prog-stop-card {
    flex: 1; margin: 6px 0 6px 4px;
    border: 1px solid var(--sc-border, var(--border));
    background: var(--sc-bg, transparent);
    border-radius: 10px; padding: 9px 12px;
    transition: all 0.15s;
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
.cu-prog-stop-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(8,11,13,0.7);
    z-index: 0;
    pointer-events: none;
}
.cu-prog-stop-card > * {
    position: relative;
    z-index: 1;
}
.cu-prog-stop-name {
    font-size: 0.8rem; font-weight: 700; color: var(--text);
    margin-bottom: 5px;
}
.cu-prog-stop-times {
    display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 5px;
}
.cu-prog-time {
    font-size: 0.72rem; display: flex; align-items: center; gap: 4px;
    color: var(--text-muted);
}
.cu-prog-time--expected { color: var(--text-muted); }
.cu-prog-time--actual { color: var(--text); font-weight: 600; }
.cu-prog-stop-status {
    font-size: 0.72rem; font-weight: 700;
    display: flex; align-items: center; gap: 6px;
    color: var(--sc-text, var(--text-muted));
}
.cu-prog-bar-wrap {
    flex: 1; height: 4px; background: rgba(255,255,255,0.07);
    border-radius: 2px; overflow: hidden; max-width: 80px;
}
.cu-prog-bar { height: 100%; border-radius: 2px; transition: width 0.5s; }

/* Footer */
.cu-progress-footer {
    padding: 10px 14px; border-top: 1px solid var(--border);
    background: rgba(12,16,19,0.92); flex-shrink: 0;
    display: flex; justify-content: flex-end;
}

/* Light theme */
/* Responsive */
@media (max-width: 768px) {
    .cu-progress-panel {
        width: 100%;
        right: -100%;
        border-left-color: rgba(200,220,230,0.14);
    }
}

/* === ClavijeroUrbano Progress Panel — Extras v503 === */
.cu-prog-stop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}
.cu-prog-cum-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--accent);
    white-space: nowrap;
    background: rgba(0,184,148,.12);
    padding: 1px 6px;
    border-radius: 8px;
}
.cu-prog-seg-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-align: center;
    margin: 2px 0;
    letter-spacing: 0.02em;
}
/* Rediseño bloque tiempo */
.cu-prog-stop-times {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0 6px;
    flex-wrap: wrap;
}
.cu-prog-time-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    flex: 1;
    min-width: 70px;
}
.cu-prog-time-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.cu-prog-time-arrow {
    color: var(--text-muted);
    font-size: 0.7rem;
    flex-shrink: 0;
}
.cu-prog-time {
    font-size: 0.86rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}
.cu-prog-time--expected { color: var(--text-muted); }
.cu-prog-time--actual   { color: var(--accent); }
.cu-prog-time--pending  { color: var(--text-muted); opacity: 0.45; font-style: italic; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE GLOBAL — FIXES COMPLETOS POR MÓDULO
   Breakpoints usados:
     1200px → tablets grandes / laptops pequeños
      992px → tablets landscape
      768px → tablets portrait / móvil landscape
      640px → móvil grande
      480px → móvil estándar
      360px → móvil pequeño
   ═══════════════════════════════════════════════════════════════ */

/* ─── LAYOUT GLOBAL ─────────────────────────────────────────── */
/* Sidebar: breakpoint intermedio para tablets (769-1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    :root { --sidebar-w: 220px; }
}

/* Footer responsivo */
@media (max-width: 640px) {
    .app-footer { font-size: 10px; padding: 0 10px; }
    .footer-center { display: none !important; }
    .footer-right { font-size: 10px; }
}
@media (max-width: 360px) {
    .app-footer { font-size: 9px; }
    .footer-left .footer-brand { display: none; }
}

/* Topbar: ocultar stats y comprimir en móvil */
@media (max-width: 640px) {
    .topbar-stats { display: none !important; }
    .topbar-title { font-size: 14px; }
    .topbar-breadcrumb { display: none; }
    .topbar-user-compact { display: none; }
}

/* Modales: altura en dispositivos pequeños */
@media (max-width: 576px) {
    .geonex-modal .modal-dialog { max-height: calc(100dvh - 16px); margin: 8px auto; }
    .geonex-modal .modal-body { max-height: calc(100dvh - 180px); overflow-y: auto; }
    .modal-form-grid { grid-template-columns: 1fr !important; }
}

/* page-content padding */
@media (max-width: 480px) {
    .page-content { padding: 10px 10px; }
}

/* page-header-bar */
@media (max-width: 640px) {
    .page-header-bar { flex-direction: column; align-items: flex-start; gap: 10px; }
    .page-header-bar h3 { font-size: 16px; }
    .vehicles-header-actions,
    .page-header-bar > div:last-child { width: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
    .vehicles-header-actions .btn,
    .page-header-bar .btn { flex: 1 1 auto; min-height: 40px; font-size: 12px; }
}

/* ─── DASHBOARD (page-dashboard) ───────────────────────────── */
@media (max-width: 992px) {
    .admin-dashboard-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 14px; }
}
@media (max-width: 480px) {
    .admin-dashboard-grid { grid-template-columns: 1fr !important; }
    .adc-value { font-size: 1.8rem !important; }
    .adc-header { font-size: 12px; }
}

/* ─── MAPA (page-map) ───────────────────────────────────────── */
/* dash-kpi en móvil muy pequeño */
@media (max-width: 360px) {
    .dash-kpi { padding: 3px 4px; }
    .dk-val  { font-size: 11px; }
    .dk-lbl  { font-size: 6px; }
    .dk-icon { width: 18px; height: 18px; font-size: 9px; }
}

/* dash-strip bottom en móvil */
@media (max-width: 640px) {
    .dash-strip-bottom { display: none; }
}

/* ─── VEHÍCULOS (page-vehicles) ─────────────────────────────── */
/* Toolbar intermedia tablets */
@media (max-width: 992px) and (min-width: 769px) {
    .vehicles-toolbar-main {
        grid-template-columns: 1fr 1fr !important;
        row-gap: 8px;
    }
}
/* vehicle-card-row → stack vertical en móvil */
@media (max-width: 640px) {
    .vehicle-card-row {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto auto auto;
    }
    .vehicle-card-actions { flex-direction: row !important; flex-wrap: wrap; gap: 6px; }
    .vehicle-card-actions .btn { flex: 1 1 auto; min-height: 36px; font-size: 12px; }
}

/* ─── REPORTES (page-reports) ───────────────────────────────── */
/* rpt-params-grid más compacto en móvil */
@media (max-width: 640px) {
    .rpt-params-grid { flex-direction: column; }
    .rpt-field { flex: 1 1 100% !important; width: 100%; }
    .rpt-device-dropdown {
        max-height: 260px;
        width: 100% !important;
        left: 0 !important;
        right: 0 !important;
    }
    .rpt-actions { flex-direction: column; width: 100%; }
    .rpt-btn-generate { width: 100%; justify-content: center; }
}
/* report-summary-grid: evitar overflow en móvil muy pequeño */
@media (max-width: 480px) {
    .report-summary-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .rsm-kpi { padding: 12px 10px; }
}
@media (max-width: 360px) {
    .report-summary-grid { grid-template-columns: 1fr !important; }
}

/* ─── HISTORIAL (page-history) ──────────────────────────────── */
/* history-content-split: mapa arriba / tabla abajo en móvil */
@media (max-width: 768px) {
    .history-wrapper.history-has-results .history-content-split {
        grid-template-columns: 1fr !important;
        grid-template-rows: min(50vh, 320px) auto !important;
    }
    .history-map { min-height: 260px !important; }
}
/* history-controls-row: inputs al 100% en móvil */
@media (max-width: 640px) {
    .history-controls-row { flex-direction: column; align-items: stretch; }
    .history-control-group { min-width: 0 !important; width: 100%; }
    .history-control-actions { width: 100%; flex-wrap: wrap; }
    .history-action-btn { flex: 1 1 auto; }
}
/* trip-card: adaptar layout en móvil */
@media (max-width: 480px) {
    .tc-route { font-size: 11px; }
    .tc-kpis { flex-wrap: wrap; gap: 6px; }
    .tc-kpi { min-width: 60px; }
}
/* stops-map altura adaptable */
@media (max-width: 860px) {
    .stops-map { min-height: min(520px, 50vh) !important; height: min(520px, 50vh) !important; }
}

/* ─── HOMOLOGACIONES (page-homologaciones) ──────────────────── */
@media (max-width: 992px) {
    .homolog-layout {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto;
    }
    .homolog-day-panel {
        border-left: none;
        border-top: 1px solid var(--glass-border);
    }
    .homolog-calendar-wrap { position: static !important; max-height: none; }
    .homolog-toolbar { flex-direction: column; align-items: stretch; padding: 12px 16px; gap: 10px; }
    .homolog-toolbar-center { order: 3; justify-content: center; }
}
@media (max-width: 640px) {
    .clavijero-calendar-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
    }
    .cal-cell { min-height: 52px !important; padding: 2px !important; }
    .cal-cell-date { font-size: 9px !important; }
    .cal-cell-content { font-size: 8px !important; }
    .homolog-filter-bar { flex-direction: column; gap: 8px; }
    .homolog-filter-bar > * { width: 100%; }
}

/* ─── ALERTAS (page-alerts) ─────────────────────────────────── */
@media (max-width: 640px) {
    .alerts-detail-hero {
        flex-direction: column;
        gap: 12px;
    }
    .alerts-detail-hero-side {
        grid-template-columns: 1fr !important;
    }
    .alerts-event-table thead { display: none; }
    .alerts-event-table tr {
        display: block;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        margin-bottom: 8px;
        padding: 8px;
    }
    .alerts-event-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        white-space: normal !important;
        border: none !important;
        padding: 4px 0;
        font-size: 11px;
    }
    .alerts-event-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        margin-right: 8px;
        flex-shrink: 0;
    }
    .alerts-kpis-grid { grid-template-columns: 1fr !important; }
}

/* ─── GEOCERCAS (page-geofences) ────────────────────────────── */
@media (max-width: 768px) {
    .geo-filter-bar {
        grid-template-columns: repeat(2, 1fr) !important;
        row-gap: 8px;
    }
    .geo-filter-bar > *:first-child { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
    .geo-filter-bar { grid-template-columns: 1fr !important; }
    .geo-form-panel { max-height: none !important; overflow-y: visible; }
}

/* ─── EMPRESAS / MI EMPRESA (page-enterprises, page-my-org) ─── */
@media (max-width: 640px) {
    .enterprises-grid { grid-template-columns: 1fr !important; }
    .enterprise-name { word-break: break-word; overflow-wrap: anywhere; }
}
@media (max-width: 480px) {
    .ed-kpis { grid-template-columns: 1fr !important; }
    .my-org-contact { grid-template-columns: 1fr !important; }
}

/* ─── ADMIN (page-admin) ────────────────────────────────────── */
@media (max-width: 640px) {
    /* Tabla de usuarios → tarjetas */
    .admin-table thead { display: none; }
    .admin-table tr {
        display: block;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        margin-bottom: 10px;
        padding: 10px;
    }
    .admin-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 5px 0;
        border: none !important;
        font-size: 12px;
        white-space: normal !important;
    }
    .admin-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        margin-right: 8px;
        flex-shrink: 0;
    }
}

/* ─── SERVICIOS / RECÓGEME (page-services, page-service-detail) */
/* Tabs: scroll horizontal en móvil */
@media (max-width: 768px) {
    .service-detail-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap !important;
        scrollbar-width: none;
    }
    .service-detail-tabs::-webkit-scrollbar { display: none; }
    .service-detail-tabs .nav-link { white-space: nowrap; padding: 7px 12px; font-size: 12px; }
    .service-detail-hero {
        padding: 18px 18px;
    }
    .service-detail-hero-actions {
        width: 100%;
        margin-left: 0;
        justify-content: stretch;
    }
    .service-detail-hero-actions .btn {
        flex: 1 1 220px;
    }
    .service-routes-toolbar,
    .service-route-card-head,
    .service-route-card-grid {
        grid-template-columns: 1fr !important;
        flex-direction: column;
    }
    .service-routes-toolbar-actions,
    .service-route-card-actions {
        width: 100%;
        justify-content: flex-start;
    }
    .service-routes-overview {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .service-route-card-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
/* Workers toolbar */
@media (max-width: 640px) {
    .workers-toolbar-compact { flex-direction: column; align-items: stretch; gap: 8px; }
    .workers-toolbar-compact .workers-toolbar-left,
    .workers-toolbar-compact .workers-toolbar-actions { width: 100%; }
    .workers-toolbar-actions { flex-wrap: wrap; }
    .workers-toolbar-actions .btn { flex: 1 1 auto; min-height: 38px; font-size: 12px; }
    .service-detail-subtitle {
        font-size: 0.88rem;
    }
    .service-detail-meta {
        gap: 8px;
    }
    .service-detail-meta-chip {
        width: 100%;
        justify-content: flex-start;
    }
    .service-routes-toolbar,
    .service-route-card {
        padding: 16px;
        border-radius: 20px;
    }
    .service-routes-toolbar-actions .btn,
    .service-routes-toolbar-actions label,
    .service-route-card-actions .btn {
        width: 100%;
        justify-content: center;
    }
    .service-routes-overview {
        grid-template-columns: 1fr;
    }
    .service-route-card-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .service-route-color {
        min-height: 54px;
    }
    .service-stop-name {
        max-width: 180px;
    }
}
/* clavijero layout intermedio (tablet) */
@media (max-width: 1024px) and (min-width: 769px) {
    .clavijero-layout { grid-template-columns: minmax(280px, 360px) minmax(0, 1fr) !important; }
}
/* Servicio: tarjetas en móvil */
@media (max-width: 640px) {
    .services-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 900px) {
    .service-detail-hero {
        flex-direction: column;
    }
    .service-detail-hero-copy,
    .service-detail-hero-actions {
        width: 100%;
        max-width: none;
    }
    .service-detail-hero-actions {
        margin-left: 0;
        justify-content: flex-start;
    }
}

@media (max-width: 760px) {
    .service-routes-toolbar-actions,
    .service-route-card-actions,
    .clavijero-actions-group,
    .workers-toolbar-actions {
        width: 100%;
        justify-content: stretch;
    }
    .service-routes-toolbar-actions > .btn,
    .service-routes-toolbar-actions > label,
    .service-route-card-actions > .btn,
    .clavijero-actions-group > .btn,
    .clavijero-actions-group > label,
    .workers-toolbar-actions > .btn,
    .workers-toolbar-actions > label {
        flex: 1 1 100%;
        width: 100%;
        justify-content: center;
    }
    .service-route-card-title-wrap {
        width: 100%;
    }
    .service-route-card-title-row {
        gap: 6px;
    }
    .service-route-card-title {
        font-size: 1rem;
    }
    .service-route-card-grid {
        grid-template-columns: 1fr !important;
    }
    .service-route-card-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .service-route-panel {
        padding: 14px;
    }
    .service-stop-timeline {
        gap: 8px;
    }
    .service-stop-node {
        max-width: 100%;
        border-radius: 14px;
    }
    .service-stop-name {
        max-width: none;
        white-space: normal;
    }
    .service-stop-connector {
        display: none;
    }
    .service-departure-summary {
        min-height: 96px;
        padding: 16px;
    }

    #svcTabVehicles .table-responsive {
        background: transparent;
        border: 0;
        box-shadow: none;
        overflow: visible;
    }
    .svc-vehicles-count,
    .svc-vehicles-count-chip {
        width: 100%;
    }
    .svc-vehicles-count-chip {
        justify-content: space-between;
        flex-wrap: wrap;
    }
    .svc-vehicles-count-copy {
        white-space: normal;
    }
    .svc-vehicles-table thead {
        display: none;
    }
    .svc-vehicles-table,
    .svc-vehicles-table tbody,
    .svc-vehicles-table tr,
    .svc-vehicles-table td {
        display: block;
        width: 100%;
    }
    .svc-vehicles-table tbody {
        display: grid;
        gap: 12px;
    }
    .svc-vehicles-table tbody tr {
        padding: 14px;
        border-radius: 18px;
        border: 1px solid var(--sub-border);
        background: var(--panel-bg-gradient);
        box-shadow: 0 14px 28px rgba(2, 6, 23, 0.14);
    }
    .svc-vehicles-table tbody td {
        padding: 0;
        border: 0;
    }
    .svc-vehicles-table tbody td + td {
        margin-top: 10px;
    }
    .svc-vehicles-table tbody td::before,
    .wt-table tbody td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 4px;
        color: var(--text-muted);
        font-size: 0.68rem;
        font-weight: 800;
        letter-spacing: 0.06em;
        text-transform: uppercase;
    }
    .svc-vehicles-table tbody td:last-child .btn {
        width: 100%;
        min-height: 38px;
    }

    .wt-filters {
        align-items: stretch;
    }
    .wt-filter-select {
        width: 100%;
        min-height: 36px;
    }
    .wt-filter-count {
        width: 100%;
        margin-left: 0;
    }
    .wt-wrap {
        border: 0;
        overflow: visible;
        background: transparent;
    }
    .wt-table thead {
        display: none;
    }
    .wt-table,
    .wt-table tbody,
    .wt-table tr,
    .wt-table td {
        display: block;
        width: 100%;
    }
    .wt-table tbody {
        display: grid;
        gap: 12px;
    }
    .wt-table tr {
        padding: 14px;
        border-radius: 18px;
        border: 1px solid var(--sub-border);
        background: var(--panel-bg-gradient);
        box-shadow: 0 14px 28px rgba(2, 6, 23, 0.14);
    }
    .wt-table tbody td {
        padding: 0;
        border-bottom: 0;
    }
    .wt-table tbody td + td {
        margin-top: 10px;
    }
    .wt-name-cell {
        align-items: flex-start;
    }
    .wt-actions {
        justify-content: flex-start;
    }
    .wt-btn {
        width: 36px;
        height: 36px;
    }
    .wt-pagination {
        flex-wrap: wrap;
        justify-content: flex-start;
        padding-top: 14px;
    }
    .wt-page-range {
        width: 100%;
        margin-left: 0;
    }
}

@media (max-width: 640px) {
    #page-service-detail .page-header-bar {
        padding: 18px;
        border-radius: 18px;
    }
    .service-detail-kicker {
        font-size: 0.66rem;
        letter-spacing: 0.14em;
    }
    #serviceDetailTitle {
        font-size: 1.18rem;
        line-height: 1.25;
    }
    .service-detail-hero-actions .btn {
        flex: 1 1 100%;
        width: 100%;
    }
    #serviceDetailTabs.service-detail-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: visible;
        gap: 8px;
        padding: 10px;
    }
    #serviceDetailTabs .nav-item {
        width: 100%;
    }
    #serviceDetailTabs .nav-link {
        width: 100%;
        min-height: 46px;
        justify-content: center;
        text-align: center;
        white-space: normal;
        line-height: 1.2;
    }
    .service-detail-meta-chip {
        width: 100%;
        min-height: 42px;
        justify-content: flex-start;
        border-radius: 14px;
        padding: 10px 12px;
    }
    .service-routes-overview {
        grid-template-columns: 1fr;
    }
    .service-routes-overview-card {
        min-height: 72px;
        padding: 14px 16px;
    }
    .workers-toolbar-count {
        white-space: normal;
    }

    .clavijero-summary,
    .clavijero-calendar-card,
    .clavijero-detail-card {
        border-radius: 18px;
    }
    .clavijero-route-badge {
        white-space: normal;
        text-align: center;
    }
    .clavijero-assignment-item {
        flex-wrap: wrap;
        align-items: flex-start;
    }
    .clavijero-bus-main {
        flex: 1 1 calc(100% - 76px);
    }
    .clavijero-edit-indicator {
        margin-left: 0;
    }
    .clavijero-empty,
    .workers-empty {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .service-detail-hero,
    .service-routes-toolbar,
    .service-route-card,
    .clavijero-actions-bar,
    .workers-toolbar,
    .workers-toolbar-compact {
        padding: 14px;
        border-radius: 16px;
    }
    #serviceDetailTabs.service-detail-tabs {
        grid-template-columns: 1fr 1fr;
    }
    #serviceDetailTabs .nav-link {
        font-size: 0.78rem;
        padding: 10px 8px;
        gap: 6px;
    }
    .service-route-card-stats {
        grid-template-columns: 1fr;
    }
    .clavijero-calendar-weekdays,
    .clavijero-calendar-grid {
        gap: 4px;
    }
    .clavijero-calendar-weekdays span {
        font-size: 0.62rem;
    }
    .clavijero-day,
    .clavijero-day.is-empty {
        min-height: 62px;
        padding: 8px 6px;
        border-radius: 12px;
    }
    .clavijero-day-num {
        font-size: 0.86rem;
    }
    .clavijero-day-stat,
    .clavijero-day-empty-label {
        gap: 2px;
        font-size: 0.42rem;
        line-height: 1.05;
    }
    .clavijero-day-stat strong {
        font-size: 0.5rem;
    }
    .clavijero-day-stat small {
        font-size: 0.4rem;
    }
    .clavijero-time-pill {
        min-width: auto;
        white-space: nowrap;
    }
}

/* ─── CLAVIJERO URBANO (page-clavijero-urbano) ──────────────── */
@media (max-width: 480px) {
    /* 2 columnas en pantallas muy pequeñas */
    .cu-stats-bar { grid-template-columns: repeat(2, 1fr) !important; }
    /* Bordes: resetear y re-aplicar para grid 2×3 */
    .cu-stat { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
    .cu-stat:nth-child(2n) { border-right: none; }
    .cu-stat:nth-last-child(-n+2) { border-bottom: none; }
    /* Botones de acción de ruta: solo ícono en pantallas muy pequeñas */
    .cu-route-action-btn span { display: none; }
    .cu-route-action-btn { padding: 5px 8px; }
}

/* ─── FORMULARIO DE RUTA (page-route-form) ──────────────────── */
/* Mover estilos del inline <style> y hacerlos responsivos */
@media (max-width: 768px) {
    #page-route-form .page-content {
        flex-direction: column !important;
        padding: 0;
    }
    .rf-panel {
        width: 100% !important;
        max-height: 45vh;
        overflow-y: auto;
        border-right: none !important;
        border-bottom: 1px solid var(--border);
    }
    .rf-map { min-height: 300px !important; flex: 1; }
}

/* ─── PROPUESTAS / CONTRATOS (page-proposal, page-contract) ─── */
@media (max-width: 640px) {
    /* price table → tarjetas */
    .prop-price-table thead { display: none; }
    .prop-price-table tr {
        display: flex;
        flex-direction: column;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        margin-bottom: 8px;
        padding: 10px;
        gap: 6px;
    }
    .prop-price-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: none !important;
        padding: 2px 0;
        font-size: 12px;
        width: 100%;
    }
    .prop-price-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
    }
    /* Acciones en columna */
    .prop-actions-bar,
    .contract-actions-bar { flex-direction: column; gap: 8px; }
    .prop-actions-bar .btn,
    .contract-actions-bar .btn { width: 100%; justify-content: center; }
}

/* ─── WHATSAPP MODULE (page-whatsapp) ───────────────────────── */
@media (max-width: 640px) {
    .whatsapp-layout { flex-direction: column !important; }
    .whatsapp-qr-section { width: 100% !important; border-right: none !important; border-bottom: 1px solid var(--border); }
    .whatsapp-actions { flex-direction: column; gap: 8px; }
    .whatsapp-actions .btn { width: 100%; }
}

/* ─── HISTORY REPLAY BAR — Fix orden en móvil ──────────────── */
@media (max-width: 768px) {
    .replay-bar-inner { flex-wrap: wrap; gap: 6px; row-gap: 6px; }
    .replay-progress-wrap { order: -1; width: 100%; }
    .replay-controls { flex-wrap: wrap; gap: 4px; }
    .replay-speed-select { min-width: 64px; }
}

/* ─── SIDEBAR ROUTES (sidebarRoutesList) ────────────────────── */
@media (max-width: 768px) {
    .sidebar-routes-wrap { display: none !important; }
}

/* ─── TABLES GLOBALES (Bootstrap .table dentro page-content) ── */
@media (max-width: 640px) {
    .page-content .table-responsive { border-radius: var(--radius-sm); }
    /* Indica scroll con sombra interna */
    .page-content .table-responsive::after {
        content: '';
        position: sticky;
        right: 0;
        top: 0;
        width: 24px;
        background: linear-gradient(to left, var(--bg-card) 0%, transparent 100%);
        pointer-events: none;
    }
}

/* ─── DETAIL CARD (overlay sobre mapa) ─────────────────────── */
@media (max-width: 640px) {
    .detail-card {
        font-size: 12px;
    }
    .detail-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .detail-title { font-size: 13px; }
}

/* ─── GEOFENCE FORM MAP (geo-form-map-container) ────────────── */
@media (max-width: 768px) {
    .geo-form-map-container { height: min(420px, 50vh) !important; }
    .geo-form-wrapper { flex-direction: column !important; }
    .geo-form-panel { width: 100% !important; min-width: 0 !important; max-height: 50vh; overflow-y: auto; }
}

/* ─── CLAMP font-size global para ≤360px ────────────────────── */
@media (max-width: 360px) {
    body { font-size: 13px; }
    .btn { font-size: 12px; padding: 5px 10px; }
    h3, .topbar-title { font-size: 15px; }
    .page-content { padding: 8px; }
}

/* ─── ROUTE FORM — estilos migrados del inline <style> ─────── */
.rf-panel { width: 400px; flex-shrink: 0; overflow-y: auto; border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.rf-panel-header { padding: 16px 20px; border-bottom: 1px solid var(--border); background: rgba(0,0,0,0.15); }
.rf-panel-body { padding: 16px 20px; flex: 1; overflow-y: auto; }
.rf-section { margin-bottom: 18px; }
.rf-section-title { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.rf-stop-card { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 4px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.06); background: rgba(255,255,255,0.03); transition: all 0.15s; }
.rf-stop-card:hover { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.12); }
.rf-stop-num { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.75rem; flex-shrink: 0; color: #fff; }
.rf-stop-num.origin { background: #00b894; }
.rf-stop-num.dest   { background: #e17055; }
.rf-stop-num.mid    { background: #0984e3; }
.rf-stop-name  { flex: 1; font-size: 0.8rem; font-weight: 500; line-height: 1.2; }
.rf-stop-label { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; opacity: 0.7; }
.rf-stop-time  { font-size: 0.65rem; color: #00b894; margin-top: 1px; }
.rf-stop-time--mins { border-radius: 4px; padding: 1px 4px; margin-left: -4px; transition: background 0.15s; }
.rf-stop-time--mins:hover { background: rgba(0,184,148,0.12); }
.rf-stop-time--mins input::-webkit-outer-spin-button,
.rf-stop-time--mins input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rf-stop-segment-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 7px;
}
.rf-stop-segment-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    color: var(--text-muted);
    font-size: 0.64rem;
    font-weight: 700;
    line-height: 1.25;
}
.rf-stop-segment-input-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    flex-shrink: 0;
}
.rf-stop-segment-input-wrap.is-disabled {
    opacity: 0.6;
}
.rf-stop-segment-input-wrap span {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
}
.rf-stop-segment-input {
    width: 58px;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 800;
    text-align: right;
    -moz-appearance: textfield;
}
.rf-stop-segment-input::-webkit-outer-spin-button,
.rf-stop-segment-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.rf-stop-actions { display: flex; flex-direction: column; gap: 2px; }
.rf-stop-actions button { border: none; background: none; color: var(--text-muted); padding: 0 3px; font-size: 0.65rem; cursor: pointer; line-height: 1; opacity: 0.5; }
.rf-stop-actions button:hover { opacity: 1; color: #fff; }
.rf-stop-rm { border: none; background: none; color: #e17055; font-size: 0.7rem; cursor: pointer; padding: 0 4px; opacity: 0.5; flex-shrink: 0; }
.rf-stop-rm:hover { opacity: 1; }
.rf-empty { text-align: center; padding: 24px 10px; color: var(--text-muted); font-size: 0.8rem; }
.rf-empty i { font-size: 1.5rem; margin-bottom: 8px; display: block; opacity: 0.3; }
.rf-save-bar { padding: 12px 20px; border-top: 1px solid var(--border); background: rgba(0,0,0,0.15); }
.rf-map-legend { position: absolute; bottom: 12px; left: 12px; z-index: 500; background: rgba(255,255,255,0.95); border-radius: 8px; padding: 8px 12px; font-size: 0.7rem; display: flex; gap: 12px; align-items: center; border: 1px solid rgba(0,0,0,0.15); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.rf-map-legend span { display: flex; align-items: center; gap: 5px; color: #333; }
.rf-map-legend .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.rf-dir-editor { display: flex; flex-direction: column; gap: 18px; }
.rf-dir-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
}
.rf-dir-kicker { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 1px; color: #7dd3fc; margin-bottom: 4px; font-weight: 800; }
.rf-dir-hero strong { display: block; font-size: 1.12rem; line-height: 1.15; }
.rf-dir-hero span { display: block; margin-top: 6px; color: var(--text-muted); font-size: 0.86rem; }
.rf-dir-radius-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(15,23,42,0.5);
    border: 1px solid rgba(56,189,248,0.18);
    color: #d9fef1;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}
.rf-dir-mode-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.rf-dir-mode-btn {
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    color: var(--text);
    border-radius: 14px;
    padding: 11px 12px;
    font-size: 0.84rem;
    font-weight: 700;
    transition: 0.18s ease;
}
.rf-dir-mode-btn:hover { border-color: rgba(74,222,128,0.28); color: #fff; transform: translateY(-1px); }
.rf-dir-mode-btn.is-active {
    background: linear-gradient(135deg, rgba(34,197,94,0.2), rgba(56,189,248,0.12));
    border-color: rgba(74,222,128,0.34);
    color: #fff;
    box-shadow: 0 12px 28px -18px rgba(34,197,94,0.75);
}
.rf-dir-layout { display: grid; grid-template-columns: minmax(380px, 1.25fr) minmax(320px, 0.95fr); gap: 18px; }
.rf-dir-visual-card,
.rf-dir-controls-card {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    background: rgba(8,12,18,0.34);
    padding: 16px;
}
.rf-dir-visual-top,
.rf-dir-control-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.rf-dir-visual-top strong,
.rf-dir-control-head strong { display: block; font-size: 0.95rem; }
.rf-dir-visual-top span,
.rf-dir-control-head span { display: block; font-size: 0.77rem; color: var(--text-muted); margin-top: 3px; }
.rf-dir-range-pills { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.rf-dir-range-pill,
.rf-dir-preset {
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    color: var(--text);
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 0.76rem;
    font-weight: 700;
    transition: 0.15s ease;
}
.rf-dir-range-pill:hover,
.rf-dir-preset:hover { color: #fff; border-color: rgba(255,255,255,0.18); }
.rf-dir-range-pill.is-active {
    background: rgba(34,197,94,0.18);
    color: #dcfce7;
    border-color: rgba(34,197,94,0.32);
}
.rf-dir-wheel-wrap {
    margin-top: 16px;
    padding: 18px;
    border-radius: 20px;
    background:
        radial-gradient(circle at center, rgba(34,197,94,0.08), transparent 45%),
        linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
    border: 1px solid rgba(255,255,255,0.06);
}
.rf-dir-wheel-wrap.is-readonly { opacity: 0.78; }
.rf-dir-wheel { width: 100%; max-width: 360px; display: block; margin: 0 auto; touch-action: none; user-select: none; }
.rf-dir-ring-bg { fill: rgba(15,23,42,0.9); }
.rf-dir-ring-outline { fill: none; stroke: rgba(255,255,255,0.12); stroke-width: 2; }
.rf-dir-core { fill: rgba(5,10,15,0.88); stroke: rgba(255,255,255,0.08); stroke-width: 1.5; }
.rf-dir-axis { stroke: rgba(255,255,255,0.12); stroke-width: 1; stroke-dasharray: 4 6; }
.rf-dir-cardinal { fill: rgba(255,255,255,0.85); font-size: 13px; font-weight: 800; text-anchor: middle; dominant-baseline: middle; }
.rf-dir-bus-core { fill: rgba(5,150,105,0.22); stroke: rgba(110,231,183,0.36); stroke-width: 1.5; }
.rf-dir-bus-arrow { fill: #f8fafc; opacity: 0.92; }
.rf-dir-readonly { fill: rgba(255,255,255,0.55); font-size: 12px; text-anchor: middle; dominant-baseline: middle; font-weight: 700; }
.rf-dir-handle { cursor: grab; filter: drop-shadow(0 0 10px rgba(0,0,0,0.28)); }
.rf-dir-handle.is-active { stroke: #fff; stroke-width: 2.5; }
.rf-dir-handle:active { cursor: grabbing; }
.rf-dir-presets { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.rf-dir-control-block + .rf-dir-control-block { margin-top: 14px; }
.rf-dir-control-block {
    padding: 14px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.03);
}
.rf-dir-control-block.secondary { background: rgba(56,189,248,0.04); }
.rf-dir-toggle { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.rf-dir-toggle input { display: none; }
.rf-dir-toggle span {
    width: 48px;
    height: 28px;
    border-radius: 999px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.12);
    position: relative;
    transition: 0.16s ease;
}
.rf-dir-toggle span::after {
    content: '';
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    position: absolute;
    top: 3px;
    left: 4px;
    transition: 0.16s ease;
}
.rf-dir-toggle input:checked + span {
    background: linear-gradient(135deg, rgba(34,197,94,0.38), rgba(56,189,248,0.24));
    border-color: rgba(34,197,94,0.24);
}
.rf-dir-toggle input:checked + span::after { transform: translateX(19px); }
.rf-dir-input-grid {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    transition: opacity 0.16s ease;
}
.rf-dir-input-grid label { display: flex; flex-direction: column; gap: 6px; }
.rf-dir-input-grid span { font-size: 0.75rem; color: var(--text-muted); font-weight: 700; }
.rf-dir-input-grid input {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    border-radius: 12px;
    padding: 10px 12px;
}
.rf-dir-input-grid.is-disabled { opacity: 0.45; }
.rf-dir-help-card {
    margin-top: 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(34,197,94,0.08), rgba(56,189,248,0.05));
    border: 1px solid rgba(74,222,128,0.12);
}
.rf-dir-help-card i { color: #4ade80; margin-top: 2px; }
.rf-dir-help-card strong { display: block; font-size: 0.84rem; margin-bottom: 2px; }
.rf-dir-help-card span { display: block; font-size: 0.78rem; color: var(--text-muted); line-height: 1.4; }

@media (max-width: 900px) {
    .rf-dir-layout { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    #appModal.stop-direction-modal .modal-dialog.stop-direction-dialog {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
        margin: 8px auto;
    }
    .rf-dir-mode-grid { grid-template-columns: 1fr; }
    .rf-dir-hero,
    .rf-dir-visual-top,
    .rf-dir-control-head { flex-direction: column; align-items: flex-start; }
    .rf-dir-input-grid { grid-template-columns: 1fr; }
    .rf-dir-wheel-wrap { padding: 10px; }
    .rf-stop-segment-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ═══════════════════════════════════════════════════════════════
   USER FORM MODAL — Nuevo Usuario / Agregar Usuario v518
   ═══════════════════════════════════════════════════════════════ */

/* ── Tamaño y fondo del modal ── */
#appModal.user-form-modal .modal-dialog.user-form-dialog {
    width: min(760px, calc(100vw - 40px));
    max-width: 760px;
    margin: clamp(14px, 3vh, 28px) auto;
}
#appModal.user-form-modal .modal-dialog.user-form-dialog.modal-dialog-centered {
    min-height: auto;
    align-items: flex-start;
}
#appModal.user-form-modal .modal-body {
    padding: 18px 22px 20px;
    overflow-y: auto;
    max-height: min(72dvh, 820px);
    scrollbar-gutter: stable;
}
#appModal.user-form-modal .geonex-modal {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: calc(100dvh - 32px);
    background:
        radial-gradient(circle at top right, rgba(74,222,128,0.10), transparent 42%),
        radial-gradient(circle at bottom left, rgba(56,189,248,0.08), transparent 36%),
        var(--bg-card);
}
/* ── Header ── */
#appModal.user-form-modal .modal-header {
    background: var(--modal-header-bg);
    border-bottom: 1px solid var(--border);
    padding: 16px 22px;
}
#appModal.user-form-modal .modal-title {
    font-size: 1.06rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 9px;
}
#appModal.user-form-modal .modal-title::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-gradient);
    flex-shrink: 0;
}

/* ── Footer ── */
#appModal.user-form-modal .modal-footer {
    padding: 12px 22px;
    border-top: 1px solid var(--border);
    background: var(--modal-footer-bg);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

/* ── Banner decorativo arriba del formulario ── */
.uf-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    padding: 13px 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(74,222,128,0.12) 0%, rgba(22,163,74,0.06) 100%);
    border: 1px solid rgba(74,222,128,0.16);
}
.uf-banner-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(74,222,128,0.35);
}
.uf-banner-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.55;
}
.uf-shell {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}
.uf-banner-copy {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.uf-banner-copy strong {
    font-size: 0.94rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}
.uf-banner-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.uf-banner-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text);
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.09);
}
/* ── Sección de campos ── */
.uf-section {
    display: flex;
    flex-direction: column;
    gap: 11px;
    margin-bottom: 18px;
}
.uf-section:last-child { margin-bottom: 0; }

/* ── Wrapper: label + group ── */
.uf-field-wrap { display: flex; flex-direction: column; gap: 5px; }
.uf-label {
    font-size: 0.73rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    padding-left: 3px;
}
.uf-req { color: var(--accent); margin-left: 2px; font-weight: 800; }
.uf-opt { color: var(--text-muted); font-size: 0.8em; text-transform: none; font-weight: 500; }
.uf-help {
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--text-muted);
    padding-left: 3px;
}
.uf-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

/* ── Grupo con icono inline ── */
.uf-input-group {
    position: relative;
    display: flex;
    align-items: center;
}
.uf-field-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.78rem;
    pointer-events: none;
    z-index: 1;
    transition: color 0.18s;
}

/* ── Inputs / Selects ── */
.uf-control {
    width: 100%;
    padding: 10px 13px 10px 38px;
    background: var(--input-field-bg, rgba(10,12,18,0.65));
    border: 1.5px solid var(--input-field-border, rgba(255,255,255,0.08));
    border-radius: 12px;
    color: var(--text);
    font-size: 0.88rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}
.uf-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(74,222,128,0.15);
}
.uf-control:focus ~ .uf-field-icon,
.uf-input-group:focus-within .uf-field-icon { color: var(--accent); }
.uf-control::placeholder { color: rgba(255,255,255,0.22); }

/* ── Password con toggle ── */
.uf-pass-input { padding-right: 40px; }
.uf-eye-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    font-size: 0.8rem;
    border-radius: 7px;
    transition: color 0.15s, background 0.15s;
    z-index: 2;
    line-height: 1;
}
.uf-eye-btn:hover { color: var(--accent); background: rgba(74,222,128,0.1); }
/* ── Divisor de sección ── */
.uf-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.uf-section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Rol pills ── */
.uf-roles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 18px;
}
.uf-role-pill { cursor: pointer; user-select: none; }
.uf-role-pill input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.uf-role-pill span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    min-height: 42px;
    padding: 8px 14px;
    border-radius: 14px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--sub-bg, rgba(255,255,255,0.04));
    border: 1.5px solid var(--sub-border, rgba(255,255,255,0.08));
    color: var(--text-muted);
    transition: all 0.16s ease;
    white-space: normal;
    line-height: 1.2;
    text-align: center;
}
.uf-role-pill span i { font-size: 0.7rem; }
.uf-role-pill:hover span {
    border-color: rgba(74,222,128,0.35);
    color: var(--text);
    background: rgba(74,222,128,0.08);
}
.uf-role-pill input:checked + span {
    background: var(--accent-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px rgba(74,222,128,0.32);
}
.uf-role-hint {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 13px;
    border-radius: 12px;
    background: rgba(15,23,42,0.32);
    border: 1px solid rgba(255,255,255,0.06);
    color: var(--text-muted);
    font-size: 0.79rem;
    line-height: 1.5;
}
.uf-role-hint i {
    color: #7dd3fc;
    margin-top: 1px;
    flex-shrink: 0;
}
/* ── Selector de vehículos para propietario ── */
.uf-owner-panel {
    display: none;
    padding: 14px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(10,14,22,0.72), rgba(8,10,16,0.92));
    border: 1px solid rgba(255,255,255,0.08);
    gap: 12px;
}
.uf-owner-panel.is-visible {
    display: flex;
    flex-direction: column;
}
.uf-owner-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.uf-owner-panel-head strong {
    display: block;
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text);
}
.uf-owner-panel-head p {
    margin: 4px 0 0;
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--text-muted);
}
.uf-owner-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #bfdbfe;
    background: rgba(74,222,128,0.14);
    border: 1px solid rgba(74,222,128,0.2);
    white-space: nowrap;
}
.uf-owner-filters {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(200px, 0.85fr);
    gap: 10px;
}
.uf-select-control {
    padding-right: 14px;
}
.uf-owner-list {
    display: grid;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 4px;
}
.uf-device-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.uf-device-option:hover {
    border-color: rgba(74,222,128,0.24);
    background: rgba(74,222,128,0.06);
    transform: translateY(-1px);
}
.uf-device-checkbox {
    margin-top: 2px;
    accent-color: #4ade80;
    flex-shrink: 0;
}
.uf-device-option-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.uf-device-option-title {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.35;
}
.uf-device-option-meta {
    font-size: 0.75rem;
    line-height: 1.45;
    color: var(--text-muted);
    word-break: break-word;
}
.uf-owner-empty {
    display: none;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px dashed rgba(148,163,184,0.25);
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.5;
    text-align: center;
}
.uf-owner-empty.is-visible {
    display: block;
}
/* ── Estado activo ── */
.uf-toggle-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 50px;
    padding: 13px 14px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(12,16,24,0.78), rgba(9,11,18,0.9));
    border: 1px solid rgba(255,255,255,0.08);
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.uf-toggle-card:hover {
    border-color: rgba(74,222,128,0.26);
    box-shadow: 0 14px 28px rgba(2,8,23,0.18);
    transform: translateY(-1px);
}
.uf-toggle-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.uf-toggle-copy strong {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text);
}
.uf-toggle-copy small {
    font-size: 0.76rem;
    line-height: 1.45;
    color: var(--text-muted);
}
.uf-toggle-side {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
/* ── Botón cancelar en footer ── */
.uf-cancel-btn {
    background: transparent !important;
    border: 1.5px solid var(--border) !important;
    color: var(--text-muted) !important;
    font-size: 0.84rem;
    font-weight: 600;
    border-radius: 10px;
    padding: 8px 16px;
    transition: all 0.15s;
}
.uf-cancel-btn:hover {
    color: var(--text) !important;
    background: var(--sub-bg) !important;
    border-color: var(--sub-border) !important;
}
.uf-footer-note {
    margin-right: auto;
    max-width: 320px;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--text-muted);
}

@media (min-width: 900px) {
    .uf-roles {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    #appModal.user-form-modal .modal-dialog.user-form-dialog {
        width: min(680px, calc(100vw - 24px));
        max-width: 680px;
        margin: 12px auto;
    }
    #appModal.user-form-modal .modal-body {
        max-height: calc(100dvh - 180px);
        padding: 16px 18px 18px;
    }
    #appModal.user-form-modal .modal-header,
    #appModal.user-form-modal .modal-footer {
        padding-left: 18px;
        padding-right: 18px;
    }
    .uf-banner {
        padding: 12px 14px;
    }
    .uf-owner-filters {
        grid-template-columns: 1fr;
    }
}

/* ── Responsive ── */
@media (max-width: 480px) {
    #appModal.user-form-modal .modal-dialog.user-form-dialog {
        width: calc(100vw - 10px);
        max-width: none;
        margin: 5px auto;
    }
    #appModal.user-form-modal .geonex-modal {
        max-height: calc(100dvh - 10px);
        border-radius: 18px;
    }
    #appModal.user-form-modal .modal-header {
        padding: 14px 16px 12px;
    }
    #appModal.user-form-modal .modal-body {
        padding: 14px 16px 18px;
        max-height: calc(100dvh - 160px);
    }
    #appModal.user-form-modal .modal-footer {
        flex-wrap: wrap;
        justify-content: stretch;
        padding: 12px 16px 16px;
    }
    #appModal.user-form-modal .modal-footer .btn {
        width: 100%;
    }
    .uf-footer-note {
        max-width: none;
        width: 100%;
    }
    .uf-field-grid { grid-template-columns: 1fr; }
    .uf-owner-filters { grid-template-columns: 1fr; }
    .uf-owner-panel-head {
        flex-direction: column;
    }
    .uf-roles {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    .uf-role-pill span {
        min-height: 40px;
        padding: 8px 11px;
        font-size: 0.75rem;
        justify-content: flex-start;
        text-align: left;
    }
    .uf-banner { padding: 10px 12px; gap: 10px; }
    .uf-banner-icon { width: 36px; height: 36px; font-size: 0.9rem; }
    .uf-toggle-card { padding: 12px 13px; }
    .uf-owner-panel {
        padding: 12px;
    }
    .uf-owner-list {
        max-height: 220px;
    }
    .uf-device-option {
        padding: 10px 11px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   MÓDULO PROPIETARIOS
   ═══════════════════════════════════════════════════════════════ */

#ownerModal .modal-dialog.owner-form-dialog {
    width: min(980px, calc(100vw - 34px));
    max-width: 980px;
    margin: clamp(12px, 3vh, 28px) auto;
}

#ownerModal .geonex-modal {
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 30px);
    border-radius: 24px;
    overflow: hidden;
    background:
        radial-gradient(circle at top right, rgba(74,222,128,0.14), transparent 30%),
        radial-gradient(circle at bottom left, rgba(56,189,248,0.08), transparent 32%),
        linear-gradient(180deg, rgba(17,22,31,0.98), rgba(11,15,22,0.98));
}

#ownerModal .modal-header {
    padding: 20px 26px 16px;
    background: var(--modal-header-bg);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

#ownerModal .modal-title {
    font-size: clamp(1.12rem, 1.5vw, 1.5rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: 10px;
}

#ownerModal .modal-body {
    padding: 24px 26px 20px;
    overflow-y: auto;
}

#ownerModal .modal-footer {
    padding: 16px 26px 20px;
    background: var(--modal-footer-bg);
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

#ownerModal .modal-footer .btn {
    min-height: 48px;
    padding: 0 20px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.96rem;
    font-weight: 700;
}

#ownerModal .modal-footer .btn-accent {
    box-shadow: 0 12px 26px rgba(22,163,74,0.24);
}

.owner-form-shell {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.owner-form-hero {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 18px 20px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(74,222,128,0.16), rgba(8,145,178,0.08));
    border: 1px solid rgba(96,165,250,0.2);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.owner-form-hero-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #16a34a, #0ea5e9);
    color: #fff;
    font-size: 1.15rem;
    box-shadow: 0 16px 28px rgba(22,163,74,0.28);
    flex-shrink: 0;
}

.owner-form-hero-copy {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.owner-form-eyebrow {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 800;
    color: #93c5fd;
}

.owner-form-hero-copy strong {
    font-size: 1.1rem;
    line-height: 1.2;
    letter-spacing: -0.03em;
    color: var(--text);
}

.owner-form-hero-copy p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    max-width: 680px;
}

.owner-form-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px 20px 20px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.02));
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.owner-form-section-head {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.owner-form-section-kicker {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 800;
    color: #7dd3fc;
}

.owner-form-section-head p,
.owner-form-devices-head p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.84rem;
    line-height: 1.6;
}

.owner-form-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 14px;
}

.owner-form-field {
    grid-column: span 6;
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.owner-form-field-wide {
    grid-column: span 12;
}

.owner-form-field-status {
    grid-column: span 6;
}

.owner-form-field-notes {
    grid-column: span 6;
}

.owner-form-label {
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
    padding-left: 2px;
}

.owner-form-label span {
    color: #86efac;
}

.owner-form-input-wrap {
    position: relative;
}

.owner-form-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.84rem;
    color: rgba(148,163,184,0.85);
    pointer-events: none;
    transition: color 0.18s ease;
}

.owner-form-control {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px 12px 42px;
    border-radius: 14px;
    border: 1.5px solid rgba(255,255,255,0.08);
    background: rgba(7,10,16,0.54);
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.owner-form-control::placeholder {
    color: rgba(148,163,184,0.78);
}

.owner-form-control:focus {
    border-color: rgba(96,165,250,0.72);
    box-shadow: 0 0 0 4px rgba(22,163,74,0.14);
    background: rgba(9,14,21,0.82);
}

.owner-form-input-wrap:focus-within .owner-form-input-icon {
    color: #86efac;
}

.owner-form-control:is(select) {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 42px;
    cursor: pointer;
}

.owner-form-select-caret {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.78rem;
    color: rgba(148,163,184,0.9);
    pointer-events: none;
}

.owner-form-textarea {
    min-height: 48px;
    resize: vertical;
    padding-top: 12px;
    line-height: 1.45;
}

.owner-form-textarea-icon {
    top: 14px;
    transform: none;
}

.owner-form-devices-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.owner-device-counter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(22,163,74,0.14);
    border: 1px solid rgba(96,165,250,0.18);
    color: #bfdbfe;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.owner-form-footer-note {
    margin-right: auto;
    max-width: 420px;
    color: var(--text-muted);
    font-size: 0.79rem;
    line-height: 1.55;
}

/* Device picker inside owner modal */
.owners-device-picker {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
    overflow: hidden;
    background: rgba(6,10,16,0.56);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.owners-device-search {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    background: rgba(255,255,255,0.03);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.owners-device-search input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.owners-device-list {
    max-height: 280px;
    overflow-y: auto;
    padding: 10px;
    display: grid;
    gap: 10px;
}

.owners-device-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 14px;
    font-size: 0.88rem;
    color: var(--text-primary);
    background: rgba(255,255,255,0.025);
}

.owners-device-item:hover {
    background: rgba(74,222,128,0.08);
    border-color: rgba(96,165,250,0.18);
    transform: translateY(-1px);
}

.owners-device-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(22,163,74,0.14);
    color: #86efac;
    font-size: 0.92rem;
    flex-shrink: 0;
}

.owners-device-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.owners-device-name {
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.owners-device-meta {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.45;
}

.owners-device-check {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(148,163,184,0.28);
    color: transparent;
    background: rgba(255,255,255,0.03);
    flex-shrink: 0;
}

.owners-device-item.selected {
    background: linear-gradient(135deg, rgba(22,163,74,0.18), rgba(14,165,233,0.08));
    border-color: rgba(96,165,250,0.32);
    color: var(--text);
    box-shadow: 0 12px 24px rgba(2,8,23,0.16);
}

.owners-device-item.selected .owners-device-mark {
    background: linear-gradient(135deg, rgba(22,163,74,0.32), rgba(14,165,233,0.24));
    color: #dbeafe;
}

.owners-device-item.selected .owners-device-check {
    background: linear-gradient(135deg, #16a34a, #0ea5e9);
    border-color: transparent;
    color: #fff;
}

.owners-device-empty {
    padding: 26px 18px;
    color: var(--text-muted);
    font-size: 0.88rem;
    text-align: center;
}

@media (max-width: 860px) {
    #ownerModal .modal-dialog.owner-form-dialog {
        width: calc(100vw - 18px);
        max-width: none;
        margin: 9px auto;
    }

    #ownerModal .geonex-modal {
        max-height: calc(100dvh - 18px);
        border-radius: 20px;
    }

    #ownerModal .modal-header,
    #ownerModal .modal-body,
    #ownerModal .modal-footer {
        padding-left: 18px;
        padding-right: 18px;
    }

    .owner-form-field,
    .owner-form-field-doc,
    .owner-form-field-wide,
    .owner-form-field-status,
    .owner-form-field-notes {
        grid-column: span 12;
    }

    .owner-form-devices-head {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 560px) {
    #ownerModal .modal-body {
        padding-top: 16px;
    }

    #ownerModal .modal-footer {
        justify-content: stretch;
    }

    #ownerModal .modal-footer .btn,
    .owner-form-footer-note {
        width: 100%;
        max-width: none;
    }

    .owner-form-hero {
        padding: 16px;
        gap: 12px;
    }

    .owner-form-hero-icon {
        width: 44px;
        height: 44px;
        border-radius: 14px;
    }

    .owner-form-section {
        padding: 16px;
    }

    .owners-device-list {
        max-height: 220px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   TABLA PROPIETARIOS — diseño premium
   ═══════════════════════════════════════════════════════════════ */

.owners-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px 28px;
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
}

.owners-hero,
.owners-toolbar,
.owners-table-shell {
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: linear-gradient(180deg, rgba(15, 23, 32, 0.96), rgba(11, 17, 25, 0.98));
    box-shadow: 0 22px 42px rgba(3, 8, 20, 0.18);
}

.owners-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    padding: 22px 24px;
    border-radius: 24px;
    position: relative;
    overflow: hidden;
}

.owners-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top right, rgba(34, 197, 94, 0.14), transparent 26%),
        radial-gradient(circle at bottom left, rgba(14, 165, 233, 0.08), transparent 28%);
    pointer-events: none;
}

.owners-hero-main,
.owners-hero-actions,
.owners-toolbar,
.owners-table-head {
    position: relative;
    z-index: 1;
}

.owners-hero-main {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    min-width: 0;
}

.owners-hero-icon {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #166534, #0f766e);
    color: #f8fafc;
    font-size: 1.2rem;
    box-shadow: 0 18px 32px rgba(22, 101, 52, 0.28);
    flex-shrink: 0;
}

.owners-hero-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.owners-hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 800;
    color: #93c5fd;
}

.owners-hero-copy h3 {
    margin: 0;
    font-size: clamp(1.45rem, 2vw, 1.9rem);
    letter-spacing: -0.04em;
    color: var(--text);
}

.owners-hero-copy p {
    margin: 0;
    max-width: 760px;
    color: var(--text-muted);
    line-height: 1.65;
    font-size: 0.92rem;
}

.owners-hero-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.owners-stat-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(148, 163, 184, 0.12);
    color: var(--text-muted);
    font-size: 0.8rem;
    backdrop-filter: blur(10px);
}

.owners-stat-chip strong {
    color: #f8fafc;
    font-size: 0.95rem;
}

.owners-hero-actions {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.owners-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-radius: 20px;
}

.owners-toolbar-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.owners-search-wrap {
    min-width: min(520px, 100%);
    flex: 1;
}

.owners-select {
    min-width: 190px;
}

.owners-filter-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.owners-filter-range {
    color: var(--text);
    font-weight: 700;
}

.owners-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    border-radius: 999px;
    background: rgba(22, 163, 74, 0.12);
    border: 1px solid rgba(74, 222, 128, 0.2);
    color: #dcfce7;
}

.owners-filter-note {
    color: var(--text-muted);
}

.owners-alert-slot {
    padding: 0 2px;
}

.owners-table-shell {
    border-radius: 24px;
    overflow: hidden;
}

.owners-table-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.owners-table-head strong {
    display: block;
    color: var(--text);
    font-size: 1rem;
    letter-spacing: -0.02em;
}

.owners-table-head p {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 0.83rem;
}

.owners-table-body {
    padding: 0 0 10px;
    overflow: visible;
}

.owners-table-wrap {
    padding: 0 10px 10px;
}

.owners-table {
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    width: 100%;
}

.owners-table thead th {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    color: rgba(226, 232, 240, 0.82);
    font-size: 0.73rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.02);
}

.owners-table tbody td {
    padding: 14px 16px;
    border-top: 1px solid rgba(148, 163, 184, 0.06);
    vertical-align: middle;
}

.owners-th-actions { width: 108px; }

.owner-row {
    transition: background 0.18s ease, transform 0.18s ease;
}

.owner-row:hover {
    background: rgba(255, 255, 255, 0.028) !important;
}

.owner-identity-cell {
    min-width: 200px;
    padding: 12px 16px;
}

.owner-identity {
    display: flex;
    align-items: center;
    gap: 12px;
}

.owner-avatar-circle {
    width: 46px;
    height: 46px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.86rem;
    font-weight: 800;
    flex-shrink: 0;
    letter-spacing: 0.08em;
    user-select: none;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.owner-avatar-circle.is-active {
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.3), rgba(14, 165, 233, 0.22));
    color: #ecfdf5;
}

.owner-avatar-circle.is-inactive {
    background: linear-gradient(135deg, rgba(100, 116, 139, 0.28), rgba(71, 85, 105, 0.18));
    color: #e2e8f0;
}

.owner-identity-info {
    min-width: 0;
}

.owner-fullname {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text);
    line-height: 1.3;
    white-space: normal;
    word-break: break-word;
}

.owner-docrow {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.owner-docnum {
    font-size: 0.73rem;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
    letter-spacing: 0.4px;
}

.owner-contact-cell {
    min-width: 220px;
    padding: 12px 14px;
    vertical-align: middle;
}

.owner-contact-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.owner-contact-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.45;
    white-space: normal;
    overflow: hidden;
    word-break: break-word;
}

.owner-contact-row i {
    color: rgba(148, 163, 184, 0.78);
    font-size: 0.72rem;
    width: 12px;
    text-align: center;
    flex-shrink: 0;
}

.owner-contact-email {
    color: #bfdbfe;
}

.owner-address-cell {
    font-size: 0.8rem;
    color: var(--text-secondary, var(--text-muted));
    min-width: 140px;
    max-width: 220px;
    padding: 12px 14px;
    line-height: 1.5;
    white-space: normal;
    word-break: break-word;
    vertical-align: middle;
}

.owner-address-copy {
    max-width: 240px;
    line-height: 1.6;
}

.owner-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.owner-status-active {
    background: rgba(0,200,83,0.12);
    color: #00c853;
    border: 1px solid rgba(0,200,83,0.28);
}

.owner-status-inactive {
    background: rgba(231,76,60,0.12);
    color: #e74c3c;
    border: 1px solid rgba(231,76,60,0.28);
}

.owner-vehicles-cell {
    min-width: 170px;
    max-width: 230px;
    padding: 12px 14px;
    vertical-align: middle;
}

.owner-vehicles-summary {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 8px;
}

.owner-vehicles-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.owner-vehicle-badge {
    display: inline-flex;
    align-items: center;
    background: rgba(74,222,128,0.1);
    color: var(--accent);
    border: 1px solid rgba(74,222,128,0.22);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 0.71rem;
    font-weight: 600;
    margin: 2px 2px 2px 0;
    white-space: nowrap;
    line-height: 1.6;
}

.owner-vehicle-more {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: #e2e8f0;
    font-size: 0.71rem;
    font-weight: 700;
}

.owner-no-data {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.owner-actions-cell {
    width: 108px;
    padding: 10px 12px;
    vertical-align: middle;
}

.owner-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
}

.owner-btn-edit,
.owner-btn-delete {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.76rem;
    transition: background 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}

.owner-btn-edit {
    background: rgba(74,222,128,0.1);
    color: #4ade80;
}

.owner-btn-edit:hover {
    background: rgba(74,222,128,0.22);
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(74, 222, 128, 0.12);
}

.owner-btn-delete {
    background: rgba(239,68,68,0.1);
    color: #ef4444;
}

.owner-btn-delete:hover {
    background: rgba(239,68,68,0.22);
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(239, 68, 68, 0.14);
}

.owners-empty-state {
    margin: 8px 10px 0;
    padding: 42px 22px;
    border-radius: 18px;
    border: 1px dashed rgba(148, 163, 184, 0.16);
    background: rgba(255, 255, 255, 0.02);
    text-align: center;
    color: var(--text-muted);
}

.owners-empty-state h4 {
    margin: 8px 0 6px;
    color: var(--text);
    font-size: 1rem;
}

.owners-empty-state p {
    margin: 0;
}

.owners-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.owners-pg-btn {
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-weight: 700;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.owners-pg-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(96, 165, 250, 0.24);
    transform: translateY(-1px);
}

.owners-pg-btn.active {
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.26), rgba(14, 165, 233, 0.22));
    border-color: rgba(96, 165, 250, 0.28);
    color: #f8fafc;
}

.owners-pg-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.owners-device-checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.owners-pagination-shell {
    padding: 18px 4px 4px;
}

.owners-pagination-shell .wt-pagination {
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.owners-pagination-shell .wt-page-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.owners-pagination-shell .wt-page-range {
    margin-left: 0;
}

@media (max-width: 1080px) {
    .owners-hero,
    .owners-toolbar {
        grid-template-columns: 1fr;
    }

    .owners-hero-actions {
        justify-content: flex-start;
    }

    .owners-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .owners-filter-meta {
        justify-content: flex-start;
    }
}

@media (max-width: 860px) {
    .owners-page {
        padding: 16px;
    }

    .owners-hero,
    .owners-toolbar,
    .owners-table-head {
        padding-left: 16px;
        padding-right: 16px;
    }

    .owners-toolbar-filters {
        flex-wrap: wrap;
    }

    .owners-search-wrap,
    .owners-select,
    .owners-toolbar-filters .btn {
        width: 100%;
        min-width: 0;
    }

    .owners-table-wrap {
        padding-left: 0;
        padding-right: 0;
    }
}

@media (max-width: 640px) {
    .owners-page {
        padding: 12px;
        gap: 12px;
    }

    .owners-hero {
        padding: 18px;
        border-radius: 20px;
    }

    .owners-hero-main {
        gap: 12px;
    }

    .owners-hero-icon {
        width: 50px;
        height: 50px;
        border-radius: 16px;
    }

    .owners-hero-actions {
        width: 100%;
    }

    .owners-hero-actions .btn,
    .owners-hero-actions label.btn {
        width: 100%;
        justify-content: center;
    }

    .owner-address-cell { display: none; }
    .owner-contact-cell { min-width: 110px; }
    .owner-identity-cell { min-width: 150px; }

    .owner-contact-cell,
    .owner-vehicles-cell,
    .owner-actions-cell,
    .owner-identity-cell {
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* ══════════════════════════════════════════════════════
   MODAL PREVISUALIZACIÓN IMPORTACIÓN PROPIETARIOS
══════════════════════════════════════════════════════ */

#ownersImportPreviewModal {
    box-sizing: border-box;
    padding: 18px 22px 18px calc(var(--content-offset-left) + 22px) !important;
}

#ownersImportPreviewModal .modal-dialog {
    width: min(1180px, calc(100vw - var(--content-offset-left) - 44px));
    max-width: min(1180px, calc(100vw - var(--content-offset-left) - 44px));
    margin: auto;
    max-height: calc(100dvh - 36px);
}

#ownersImportPreviewModal .modal-dialog.modal-dialog-centered {
    min-height: calc(100dvh - 36px);
    display: flex;
    align-items: center;
}

#ownersImportPreviewModal .geonex-modal {
    background:
        radial-gradient(circle at top right, rgba(74,222,128,0.08), transparent 28%),
        linear-gradient(180deg, rgba(10,14,25,0.985), rgba(12,18,31,0.995));
    border-radius: 22px;
    border-color: rgba(122, 142, 177, 0.16);
    width: 100%;
    max-height: calc(100dvh - 36px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#ownersImportPreviewModal .modal-header {
    position: sticky;
    top: 0;
    z-index: 3;
    background: rgba(11, 17, 30, 0.94);
    backdrop-filter: blur(14px);
}

#ownersImportPreviewModal .modal-body {
    padding: 18px 20px 16px;
    flex: 0 1 auto;
    overflow: auto;
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 220px);
}

#ownersImportPreviewModal .modal-footer {
    background: rgba(11, 17, 30, 0.94);
    backdrop-filter: blur(14px);
    flex-shrink: 0;
}

/* Resumen de estadísticas */
.import-preview-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.import-preview-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0 0 14px;
    padding: 12px 14px;
    border: 1px solid rgba(122, 142, 177, 0.14);
    border-radius: 14px;
    background: rgba(122, 142, 177, 0.05);
}

.import-option-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(122, 142, 177, 0.16);
    background: rgba(10, 14, 25, 0.46);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
}

.import-option-chip input {
    accent-color: var(--accent);
}

.import-option-chip:has(input:disabled) {
    opacity: 0.48;
    cursor: not-allowed;
}

.import-option-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: auto;
    max-width: 420px;
    line-height: 1.35;
}

.import-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    flex: 1 1 120px;
    min-width: 100px;
}

.import-stat i {
    font-size: 1.1rem;
}

.import-stat-num {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1;
}

.import-stat-label {
    font-size: 0.76rem;
    font-weight: 500;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.import-stat-new {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
}

.import-stat-update {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}

.import-stat-skip {
    background: rgba(107, 114, 128, 0.1);
    border: 1px solid rgba(107, 114, 128, 0.2);
    color: var(--text-muted);
}

/* Tabs */
.import-preview-tabs {
    border-bottom-color: var(--border-color);
    margin-bottom: 0;
}

.import-preview-tabs .nav-link {
    color: var(--text-muted);
    border-color: transparent;
    padding: 0.5rem 1rem;
    font-size: 0.88rem;
}

.import-preview-tabs .nav-link.active {
    color: var(--accent);
    background: transparent;
    border-color: var(--border-color) var(--border-color) var(--surface);
}

.import-preview-tab-content {
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    background: rgba(9, 13, 24, 0.7);
}

.import-preview-table-wrap {
    max-height: min(52vh, 560px);
    overflow: auto;
}

.import-preview-table {
    margin: 0;
    font-size: 0.84rem;
    min-width: 1180px;
}

.import-preview-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(14, 20, 35, 0.98);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 14px;
    font-size: 0.79rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--text-secondary);
}

.import-preview-table tbody td {
    padding: 14px 14px;
    vertical-align: top;
    border-bottom: 1px solid rgba(122, 142, 177, 0.12);
}

.import-preview-table tbody tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.015);
}

.import-preview-doc-cell,
.import-preview-status-cell,
.import-preview-meta-cell {
    white-space: nowrap;
}

.import-preview-name-cell {
    min-width: 220px;
}

.import-preview-address-cell {
    min-width: 240px;
    max-width: 320px;
    color: var(--text-secondary);
}

.import-preview-vehicles-cell {
    min-width: 290px;
    max-width: 420px;
}

.import-preview-changes-cell {
    min-width: 420px;
}

.import-vehicles-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.import-vehicles-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.import-vehicles-empty {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.import-vehicle-mode {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.import-vehicle-mode-replace {
    background: rgba(245, 158, 11, 0.16);
    border: 1px solid rgba(245, 158, 11, 0.38);
    color: #fbbf24;
}

.import-vehicle-mode-keep {
    background: rgba(107, 114, 128, 0.16);
    border: 1px solid rgba(107, 114, 128, 0.28);
    color: #cbd5e1;
}

/* Badge de documento */
.import-doc-badge {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: #818cf8;
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 0.8rem;
    font-family: monospace;
    font-weight: 600;
    white-space: nowrap;
}

/* Badge de estado en el preview */
.import-status-badge {
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 0.76rem;
    font-weight: 600;
    text-transform: uppercase;
}

.import-status-active {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.import-status-inactive {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Área de cambios detectados */
.import-changes-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.import-change-row {
    display: grid;
    grid-template-columns: 86px minmax(170px, 1fr) 18px minmax(170px, 1fr);
    align-items: center;
    gap: 0.55rem;
    font-size: 0.8rem;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(122, 142, 177, 0.06);
    border: 1px solid rgba(122, 142, 177, 0.12);
}

.import-change-field {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.import-change-old {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
    border-radius: 8px;
    padding: 6px 8px;
    text-decoration: line-through;
    font-size: 0.8rem;
    overflow-wrap: anywhere;
    white-space: normal;
    line-height: 1.35;
}

.import-change-arrow {
    color: var(--text-muted);
    font-size: 0.82rem;
    flex-shrink: 0;
    text-align: center;
}

.import-change-new {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #10b981;
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 0.8rem;
    overflow-wrap: anywhere;
    white-space: normal;
    line-height: 1.35;
}

.import-no-changes {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-style: italic;
}

/* Estado vacío en tabs */
.import-preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
    font-size: 0.88rem;
}

#appModal.owner-user-import-modal {
    padding-left: calc(var(--content-offset-left) + 12px);
    padding-right: 16px;
}

#appModal.owner-user-import-modal .modal-dialog.owner-user-import-dialog {
    width: min(calc(100vw - var(--content-offset-left) - 28px), 1380px) !important;
    max-width: min(calc(100vw - var(--content-offset-left) - 28px), 1380px) !important;
    margin: calc(var(--topbar-h) + 12px) 0 calc(var(--footer-h) + 12px) auto;
    height: calc(100dvh - var(--topbar-h) - var(--footer-h) - 24px);
    max-height: calc(100dvh - var(--topbar-h) - var(--footer-h) - 24px);
}

#appModal.owner-user-import-modal .modal-dialog.owner-user-import-dialog.modal-dialog-centered {
    min-height: auto;
    display: flex;
    align-items: stretch;
}

#appModal.owner-user-import-modal .geonex-modal {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    border-radius: 24px;
    background:
        radial-gradient(circle at top right, rgba(74, 222, 128, 0.1), transparent 40%),
        radial-gradient(circle at bottom left, rgba(56, 189, 248, 0.06), transparent 34%),
        var(--bg-card);
}

#appModal.owner-user-import-modal .modal-header {
    padding: 18px 24px 14px;
    flex-shrink: 0;
}

#appModal.owner-user-import-modal .modal-body {
    padding: 18px 24px 20px;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#appModal.owner-user-import-modal .modal-footer {
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 24px 18px;
    flex-shrink: 0;
    background: rgba(11, 17, 30, 0.94);
    backdrop-filter: blur(14px);
}

#appModal.owner-user-import-modal .modal-footer .uf-footer-note {
    max-width: 58%;
}

#appModal.owner-user-import-modal .import-preview-tab-content {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#appModal.owner-user-import-modal .tab-pane {
    min-height: 0;
}

#appModal.owner-user-import-modal .tab-pane.active,
#appModal.owner-user-import-modal .tab-pane.show.active {
    display: flex;
    flex-direction: column;
}

#appModal.owner-user-import-modal .import-preview-table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow: auto;
}

#appModal.owner-user-import-modal .import-preview-table {
    min-width: 1120px;
}

/* Light theme */
@media (max-width: 1100px) {
    #ownersImportPreviewModal {
        padding: 12px !important;
    }

    #ownersImportPreviewModal .modal-dialog {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        max-height: calc(100dvh - 24px);
    }

    #ownersImportPreviewModal .modal-dialog.modal-dialog-centered {
        min-height: calc(100dvh - 24px);
    }

    #ownersImportPreviewModal .geonex-modal {
        max-height: calc(100dvh - 24px);
    }

    #ownersImportPreviewModal .modal-body {
        max-height: calc(100dvh - 200px);
    }

    .import-preview-table-wrap {
        max-height: min(48vh, 500px);
    }

    #appModal.owner-user-import-modal {
        padding-left: 10px;
        padding-right: 10px;
    }

    #appModal.owner-user-import-modal .modal-dialog.owner-user-import-dialog {
        width: calc(100vw - 20px) !important;
        max-width: calc(100vw - 20px) !important;
        margin: 10px auto;
        height: calc(100dvh - 20px);
        max-height: calc(100dvh - 20px);
    }

    #appModal.owner-user-import-modal .geonex-modal {
        border-radius: 20px;
    }

    #appModal.owner-user-import-modal .modal-body {
        padding: 16px 18px 18px;
    }

    #appModal.owner-user-import-modal .modal-footer {
        padding: 12px 18px 16px;
    }

    #appModal.owner-user-import-modal .modal-footer .uf-footer-note {
        max-width: none;
    }
}

@media (max-width: 720px) {
    .import-preview-stats {
        gap: 0.65rem;
    }

    .import-stat {
        min-width: 0;
        flex: 1 1 calc(50% - 0.65rem);
    }

    .import-preview-table {
        min-width: 980px;
    }

    .import-preview-controls {
        align-items: stretch;
    }

    .import-option-note {
        margin-left: 0;
        max-width: none;
    }

    #ownersImportPreviewModal {
        padding: 8px !important;
    }

    #ownersImportPreviewModal .modal-dialog {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
        max-height: calc(100dvh - 16px);
    }

    #ownersImportPreviewModal .modal-dialog.modal-dialog-centered {
        min-height: calc(100dvh - 16px);
    }

    #ownersImportPreviewModal .geonex-modal {
        max-height: calc(100dvh - 16px);
        border-radius: 16px;
    }

    #ownersImportPreviewModal .modal-body {
        max-height: calc(100dvh - 180px);
        padding: 14px 14px 12px;
    }

    #appModal.owner-user-import-modal {
        padding-left: 8px;
        padding-right: 8px;
    }

    #appModal.owner-user-import-modal .modal-dialog.owner-user-import-dialog {
        width: calc(100vw - 16px) !important;
        max-width: calc(100vw - 16px) !important;
        margin: 8px auto;
        height: calc(100dvh - 16px);
        max-height: calc(100dvh - 16px);
    }

    #appModal.owner-user-import-modal .modal-header {
        padding: 15px 16px 12px;
    }

    #appModal.owner-user-import-modal .modal-body {
        padding: 14px 16px 16px;
    }

    #appModal.owner-user-import-modal .modal-footer {
        padding: 12px 16px 14px;
        flex-direction: column;
        align-items: stretch;
    }

    #appModal.owner-user-import-modal .modal-footer .btn {
        width: 100%;
    }
}

/* ═══════════════════════════════════════════════════════════
   DASHBOARD HERO BAR & REFRESH BUTTON
   ═══════════════════════════════════════════════════════════ */
.dash-hero-bar {
    position: relative;
    overflow: hidden;
}
.dash-hero-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: transparent;
    pointer-events: none;
    z-index: 0;
}
.dash-hero-bar > * { position: relative; z-index: 1; }
.dash-hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    background: var(--accent-glow);
    border: 1px solid var(--accent-glow);
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 6px;
}

/* ═══════════════════════════════════════════════════════════
   MÓDULO PESV — Control de Excesos de Velocidad
   ═══════════════════════════════════════════════════════════ */

/* ── Filtro ─────────────────────────────────────────────── */
.pesv-filter-card {
    padding: 14px 16px;
}

/* ── Loading / Empty ─────────────────────────────────────── */
.pesv-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 56px 20px;
    gap: 8px;
}
.pesv-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}
.pesv-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}
.pesv-empty-icon {
    font-size: 2.4rem;
    color: var(--accent);
    margin-bottom: 10px;
    opacity: 0.75;
}
.pesv-empty-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 4px;
}

/* ── KPI Cards ───────────────────────────────────────────── */
.pesv-kpi-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-left-width: 4px;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.pesv-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.pesv-kpi-danger  { border-left-color: #e74c3c; }
.pesv-kpi-warning { border-left-color: #f39c12; }
.pesv-kpi-info    { border-left-color: #3498db; }
.pesv-kpi-critical{ border-left-color: #9b59b6; }

.pesv-kpi-icon {
    font-size: 1.5rem;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    flex-shrink: 0;
}
.pesv-kpi-danger  .pesv-kpi-icon { color: #e74c3c; background: rgba(231,76,60,0.12); }
.pesv-kpi-warning .pesv-kpi-icon { color: #f39c12; background: rgba(243,156,18,0.12); }
.pesv-kpi-info    .pesv-kpi-icon { color: #3498db; background: rgba(52,152,219,0.12); }
.pesv-kpi-critical .pesv-kpi-icon { color: #9b59b6; background: rgba(155,89,182,0.12); }

.pesv-kpi-body { min-width: 0; }
.pesv-kpi-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}
.pesv-kpi-unit {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: 3px;
}
.pesv-kpi-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ── Tabla wrapper ───────────────────────────────────────── */
.pesv-table-wrap {
    padding: 0;
    overflow: hidden;
}
.pesv-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
}
.pesv-table-count {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
}
.pesv-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}
/* Sobreescribir variables Bootstrap para tema oscuro */
.pesv-table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--border);
    --bs-table-striped-bg: rgba(255,255,255,0.03);
    --bs-table-striped-color: var(--text);
    --bs-table-hover-bg: rgba(255,255,255,0.05);
    --bs-table-hover-color: var(--text);
    font-size: 0.83rem;
    margin: 0;
    color: var(--text);
}
.pesv-table thead th {
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 0.73rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    padding: 8px 10px;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}
.pesv-table tbody td {
    background: var(--bg-card);
    color: var(--text);
    border-color: var(--border);
}
.pesv-table tbody tr:hover td {
    background: rgba(255,255,255,0.05) !important;
    color: var(--text);
}
.pesv-th-num { width: 42px; text-align: center; }
.pesv-th-unit {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: lowercase;
}
.pesv-th-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: color var(--transition-fast);
}
.pesv-th-sortable:hover { color: var(--text); }
.pesv-sort-icon {
    font-size: 0.65rem;
    margin-left: 3px;
    vertical-align: middle;
    display: inline-block;
}
.pesv-sort-inactive { opacity: 0.3; }
.pesv-sort-active { color: var(--accent); opacity: 1; }

/* ── Filas ───────────────────────────────────────────────── */
.pesv-row {
    cursor: pointer;
}
.pesv-row td {
    vertical-align: middle;
    padding: 7px 10px;
    border-color: var(--border);
}
.pesv-td-num {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 600;
    width: 42px;
}
.pesv-vehicle-cell {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 90px;
}
.pesv-vehicle-name {
    font-weight: 700;
    color: var(--text);
    font-size: 0.85rem;
}
.pesv-vehicle-plate {
    font-size: 0.73rem;
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 0.03em;
}
.pesv-tag-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(0,184,148,0.10);
    color: var(--accent);
    border: 1px solid rgba(0,184,148,0.22);
    white-space: nowrap;
}
.pesv-td-driver { min-width: 100px; }
.pesv-driver-txt {
    font-size: 0.83rem;
    color: var(--text);
    display: block;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pesv-td-period { min-width: 110px; }
.pesv-period-start {
    font-size: 0.8rem;
    color: var(--text);
    font-weight: 600;
}
.pesv-period-end {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.pesv-speed-max {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text);
}
.pesv-excess-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.pesv-excess-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}
.pesv-limit-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ── Severidad: pills y badges ───────────────────────────── */
.pesv-sev-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
}
.pesv-sev-critical,
.pesv-excess-badge.pesv-sev-critical {
    color: #ff7b84;
    background: rgba(231,76,60,0.15);
    border-color: rgba(231,76,60,0.35);
}
.pesv-sev-high,
.pesv-excess-badge.pesv-sev-high {
    color: #ffa07a;
    background: rgba(243,156,18,0.13);
    border-color: rgba(243,156,18,0.35);
}
.pesv-sev-medium,
.pesv-excess-badge.pesv-sev-medium {
    color: #ffd166;
    background: rgba(243,200,18,0.12);
    border-color: rgba(243,200,18,0.32);
}
.pesv-sev-low,
.pesv-excess-badge.pesv-sev-low {
    color: #74b9ff;
    background: rgba(9,132,227,0.12);
    border-color: rgba(9,132,227,0.3);
}

.pesv-td-meta {
    min-width: 80px;
}
.pesv-meta-pts {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
}
.pesv-meta-dur {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 1px;
}
.pesv-td-actions {
    white-space: nowrap;
    width: 70px;
}
.pesv-detail-btn,
.pesv-map-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    font-size: 0.8rem;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    transition: background var(--transition-fast), color var(--transition-fast);
}
.pesv-detail-btn:hover {
    background: rgba(0,184,148,0.15);
    color: var(--accent);
    border-color: rgba(0,184,148,0.3);
}
.pesv-map-btn:hover {
    background: rgba(52,152,219,0.15);
    color: #74b9ff;
    border-color: rgba(52,152,219,0.3);
}

/* ── Paginación ──────────────────────────────────────────── */
.pesv-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
}
.pesv-pagination-info {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.pesv-pagination-btns {
    display: flex;
    align-items: center;
    gap: 4px;
}
.pesv-page-btn {
    min-width: 30px;
    height: 30px;
    padding: 0 6px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.pesv-page-btn:hover:not(:disabled) {
    background: rgba(0,184,148,0.12);
    color: var(--accent);
    border-color: rgba(0,184,148,0.28);
}
.pesv-page-btn.active {
    background: var(--accent);
    color: #0b1622;
    border-color: var(--accent);
    font-weight: 800;
}
.pesv-page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════
   EVD — Event Detail Modal (nuevo diseño)
   ═══════════════════════════════════════════════════════════ */

/* ── Shell ───────────────────────────────────────────────── */
.evd-shell {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 8px;
    height: 100%;
    min-height: 0;
}

/* ── Hero ────────────────────────────────────────────────── */
.evd-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(0,184,148,0.07), rgba(9,132,227,0.05));
    flex-wrap: wrap;
}
.evd-hero--speed {
    background: linear-gradient(135deg, rgba(231,76,60,0.09), rgba(243,156,18,0.06));
}
.evd-hero--default {
    background: linear-gradient(135deg, rgba(0,184,148,0.08), rgba(52,152,219,0.05));
}
.evd-hero-left { min-width: 0; flex: 1; }
.evd-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 6px;
    border: 1px solid transparent;
}
.evd-type-badge.is-danger   { color: #ff7b84; background: rgba(231,76,60,0.12); border-color: rgba(231,76,60,0.32); }
.evd-type-badge.is-success  { color: #66e6b4; background: rgba(0,184,148,0.12); border-color: rgba(0,184,148,0.3); }
.evd-type-badge.is-warning  { color: #ffd166; background: rgba(243,156,18,0.12); border-color: rgba(243,156,18,0.32); }
.evd-type-badge.is-info     { color: #74b9ff; background: rgba(9,132,227,0.12); border-color: rgba(9,132,227,0.32); }
.evd-type-badge.is-secondary{ color: #c2c9d2; background: rgba(127,140,155,0.14); border-color: rgba(127,140,155,0.34); }
.evd-type-badge.is-neutral  { color: var(--text-muted); background: rgba(127,140,155,0.12); border-color: rgba(127,140,155,0.3); }

.evd-vehicle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.evd-vehicle-name {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
}
.evd-plate-chip {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    background: rgba(0,184,148,0.10);
    border: 1px solid rgba(0,184,148,0.22);
    border-radius: 5px;
    padding: 2px 7px;
    letter-spacing: 0.03em;
}
.evd-hero-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 5px;
}
.evd-meta-sep { margin: 0 6px; opacity: 0.5; }

.evd-hero-kpis {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: wrap;
}
.evd-hk-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 16px;
}
.evd-hk-sep {
    width: 1px;
    height: 36px;
    background: var(--border);
    flex-shrink: 0;
}
.evd-hk-lbl {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.evd-hk-val {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.1;
}
.evd-hk-val small {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: 2px;
}
.evd-hk-val--max { color: #ffa07a; }
.evd-hk-over .evd-hk-val--over { color: #ff7b84; }

/* ── Strip de métricas ───────────────────────────────────── */
.evd-strip {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    flex-wrap: wrap;
    overflow: hidden;
}
.evd-strip-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 4px 14px;
    flex: 1;
    min-width: 100px;
}
.evd-strip-sep {
    width: 1px;
    height: 30px;
    background: var(--border);
    flex-shrink: 0;
}
.evd-strip-ico {
    font-size: 0.95rem;
    color: var(--accent);
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}
.evd-strip-lbl {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.evd-strip-val {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

/* ── Main layout: mapa + side ────────────────────────────── */
.evd-main {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
    gap: 8px;
    min-height: 0;
    height: clamp(440px, 62vh, 760px);
}
.evd-map-panel {
    position: relative;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.evd-map {
    flex: 1;
    min-height: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.evd-side {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
    min-height: 0;
}

/* ── Context card ────────────────────────────────────────── */
.evd-ctx-card,
.evd-pts-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.evd-sec-hd {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,0.02);
    flex-shrink: 0;
}
.evd-ctx-body {
    padding: 4px 0;
    overflow-y: auto;
    scrollbar-width: thin;
    flex: 1;
}
.evd-ctx-row {
    display: grid;
    grid-template-columns: 20px 90px minmax(0, 1fr);
    gap: 6px;
    align-items: start;
    padding: 5px 12px;
    border-bottom: 1px dashed var(--border);
}
.evd-ctx-row:last-child { border-bottom: none; }
.evd-ctx-row--wide {
    grid-template-columns: 20px 90px 1fr;
}
.evd-ctx-ico {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
    text-align: center;
}
.evd-ctx-key {
    font-size: 0.73rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.evd-ctx-val {
    font-size: 0.83rem;
    color: var(--text);
    font-weight: 600;
    word-break: break-word;
}
.evd-ctx-plate {
    font-size: 0.78rem;
    color: var(--accent);
    font-weight: 700;
}
.evd-ctx-mono {
    font-family: ui-monospace, 'Cascadia Code', monospace;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

/* ── Points table ────────────────────────────────────────── */
.evd-pts-badge {
    margin-left: auto;
    background: rgba(0,184,148,0.14);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 800;
    padding: 1px 8px;
    border-radius: 20px;
    border: 1px solid rgba(0,184,148,0.22);
}
.evd-pts-scroll {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}
.evd-pts-tbl {
    width: 100%;
    font-size: 0.78rem;
    border-collapse: separate;
    border-spacing: 0;
}
.evd-pts-tbl thead th {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 5px 8px;
    border-bottom: 1px solid var(--border);
    z-index: 2;
    white-space: nowrap;
}
.evd-pts-tbl tbody tr {
    cursor: pointer;
    transition: background var(--transition-fast);
}
.evd-pts-tbl tbody tr:hover td { background: rgba(255,255,255,0.045); }
.evd-pts-tbl tbody tr.table-active td { background: rgba(0,184,148,0.10) !important; }
.evd-pts-tbl tbody td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.evd-pts-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 24px;
    font-style: italic;
}

/* column sizing */
.evd-td-num  { width: 34px; text-align: center; color: var(--text-muted); font-size: 0.72rem; }
.evd-td-time { white-space: nowrap; font-size: 0.75rem; }
.evd-td-spd  { min-width: 80px; }
.evd-td-ign  { text-align: center; width: 36px; }
.evd-td-sat  { text-align: center; width: 36px; font-size: 0.75rem; color: var(--text-muted); }
.evd-td-coord { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; line-height: 1.35; }

/* speed cell */
.evd-spd-row { display: flex; align-items: baseline; gap: 2px; }
.evd-spd-val { font-weight: 700; color: var(--text); font-size: 0.84rem; }
.evd-spd-val small, .evd-spd-val--over small { font-size: 0.65rem; color: var(--text-muted); margin-left: 1px; }
.evd-spd-val--over { font-weight: 800; color: #ff7b84; font-size: 0.84rem; }
.evd-spd-bar {
    height: 3px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    margin-top: 3px;
    overflow: hidden;
}
.evd-spd-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.2s; }
.evd-spd-fill--over { background: #e74c3c; }

/* ignition icons */
.evd-ign-on  { color: var(--accent); }
.evd-ign-off { color: var(--text-muted); }
.evd-ign-na  { color: var(--text-muted); opacity: 0.5; }

/* ═══════════════════════════════════════════════════════════
   Responsive PESV / EVD
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .evd-main {
        grid-template-columns: 1fr;
        height: auto;
    }
    .evd-map { min-height: 260px; }
    .evd-side {
        grid-template-rows: auto auto;
        height: auto;
    }
    .evd-strip { flex-direction: column; gap: 0; }
    .evd-strip-sep { display: none; }
    .evd-strip-item { padding: 6px 14px; }
    .evd-hero-kpis { gap: 4px; flex-wrap: wrap; }
    .evd-hk-item { padding: 4px 10px; }
    .pesv-table .pesv-td-driver,
    .pesv-table .pesv-td-period { display: none; }
    .pesv-pagination { flex-direction: column; align-items: flex-start; }
}

/* ── History detail table pagination ──────────────────────── */
.htab-table-wrap { display: flex; flex-direction: column; height: 100%; }
.htab-pagination {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    flex-shrink: 0;
}
.htab-pg-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-sm, 4px);
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: var(--transition-fast);
    font-size: 0.75rem;
}
.htab-pg-btn:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: #fff; }
.htab-pg-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.htab-pg-info { font-size: 0.75rem; color: var(--text-muted); }
