/* ==========================================================================
   LANJET PRO GPS - MODERN COMMAND CENTER STYLES
   Design System: Dark Command Center / Modern Telematics Dashboard
   ========================================================================== */

:root {
    /* Color Palette */
    --bg-base: #090d16;
    --bg-surface: #0f172a;
    --bg-card: rgba(18, 27, 47, 0.75);
    --bg-card-hover: rgba(28, 41, 70, 0.85);
    --bg-input: #0b1120;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(0, 240, 255, 0.4);
    
    /* Accents & Status */
    --accent-cyan: #00f0ff;
    --accent-cyan-dim: rgba(0, 240, 255, 0.15);
    --accent-blue: #3b82f6;
    
    --color-online: #10b981;
    --color-online-glow: rgba(16, 185, 129, 0.35);
    --color-offline: #f43f5e;
    --color-offline-glow: rgba(244, 63, 94, 0.35);
    --color-unknown: #f59e0b;
    --color-unknown-glow: rgba(245, 158, 11, 0.35);
    
    /* Typography */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-heading: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Shadows & Effects */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.6);
    --shadow-cyan: 0 0 20px rgba(0, 240, 255, 0.3);
    --blur-glass: blur(14px);
    
    /* Spacings & Sizing */
    --header-height: 64px;
    --sidebar-width: 370px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbars */
.custom-scroll::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.custom-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.custom-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
}
.custom-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* App Layout Structure */
.app-layout {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* ==========================================================================
   HEADER / TOP COMMAND BAR
   ========================================================================== */
.header-bar {
    height: var(--header-height);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: var(--blur-glass);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.brand-logo-wrap {
    position: relative;
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #0ea5e9, #00f0ff);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
}

.brand-icon {
    font-size: 18px;
    color: #030712;
}

.brand-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: var(--radius-md);
    border: 2px solid var(--accent-cyan);
    animation: pulseGlow 2.5s infinite;
    pointer-events: none;
}

@keyframes pulseGlow {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 0; }
    100% { transform: scale(1); opacity: 0; }
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    line-height: 1.1;
}

.brand-badge {
    font-size: 10px;
    padding: 2px 6px;
    background: var(--accent-cyan);
    color: #030712;
    border-radius: var(--radius-full);
    font-weight: 800;
    vertical-align: middle;
}

.brand-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Quick Fleet Stats in Header */
.fleet-quick-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(11, 17, 32, 0.6);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.03);
    cursor: default;
}

.stat-pill .stat-label {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-pill .stat-value {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-primary);
}

.stat-online .stat-value { color: var(--color-online); }
.stat-offline .stat-value { color: var(--color-offline); }

/* WebSocket Badge */
.ws-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    border: 1px solid transparent;
    transition: var(--transition-normal);
}

.ws-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.ws-connected {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--color-online);
}
.ws-connected .ws-dot {
    background: var(--color-online);
    box-shadow: 0 0 8px var(--color-online);
}

.ws-connecting {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: var(--color-unknown);
}
.ws-connecting .ws-dot {
    background: var(--color-unknown);
    animation: blink 1s infinite alternate;
}

.ws-disconnected {
    background: rgba(244, 63, 94, 0.1);
    border-color: rgba(244, 63, 94, 0.3);
    color: var(--color-offline);
}
.ws-disconnected .ws-dot {
    background: var(--color-offline);
}

@keyframes blink {
    from { opacity: 0.3; }
    to { opacity: 1; }
}

/* Header Right Buttons */
.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn, .action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: var(--transition-fast);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
}

.icon-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
}

.action-btn {
    height: 36px;
    padding: 0 14px;
}

.icon-btn:hover, .action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.action-btn.active {
    background: var(--accent-cyan-dim);
    border-color: rgba(0, 240, 255, 0.4);
    color: var(--accent-cyan);
}

.btn-danger-soft:hover {
    background: rgba(244, 63, 94, 0.15);
    color: var(--color-offline);
    border-color: rgba(244, 63, 94, 0.4);
}

.relative { position: relative; }
.badge-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--color-offline);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 17px;
    height: 17px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ==========================================================================
   WORKSPACE: SIDEBAR + MAP
   ========================================================================== */
.main-workspace {
    display: flex;
    flex: 1;
    height: calc(100vh - var(--header-height));
    position: relative;
    overflow: hidden;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: var(--blur-glass);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 500;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
    margin-left: calc(-1 * var(--sidebar-width));
    transform: translateX(-100%);
    pointer-events: none;
}

/* Sidebar Tabs */
.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: rgba(11, 17, 32, 0.5);
    flex-shrink: 0;
}

.tab-btn {
    flex: 1;
    padding: 12px 10px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-secondary);
}

.tab-btn.active {
    color: var(--accent-cyan);
    border-bottom-color: var(--accent-cyan);
    background: rgba(0, 240, 255, 0.04);
}

/* Tab Panes */
.tab-pane {
    display: none;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
}

.tab-pane.active {
    display: flex;
}

/* Search Box */
.search-box-wrapper {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(11, 17, 32, 0.3);
    flex-shrink: 0;
}

.search-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 13px;
}

.search-input-group input {
    width: 100%;
    height: 38px;
    padding: 0 34px 0 36px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    transition: var(--transition-fast);
}

.search-input-group input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.15);
}

.btn-clear {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
}

.filter-pills {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.filter-pill {
    flex: 1;
    padding: 5px 8px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.filter-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.filter-pill.active {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: var(--text-primary);
}

.filter-pill.pill-online.active {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--color-online);
    color: var(--color-online);
}

.filter-pill.pill-offline.active {
    background: rgba(244, 63, 94, 0.2);
    border-color: var(--color-offline);
    color: var(--color-offline);
}

/* Device List */
.device-list, .geofence-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.device-card {
    flex-shrink: 0;
    width: 100%;
    min-height: 66px;
    box-sizing: border-box;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    overflow: hidden;
}

.device-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--text-muted);
    transition: var(--transition-fast);
}

.device-card.status-online::before { background: var(--color-online); }
.device-card.status-offline::before { background: var(--color-offline); }
.device-card.status-unknown::before { background: var(--color-unknown); }

.device-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.device-card.selected {
    background: rgba(0, 240, 255, 0.08);
    border-color: rgba(0, 240, 255, 0.4);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.15);
}

.device-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

.device-identity {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.device-name {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.device-id-badge {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.dot-online {
    background: var(--color-online);
    box-shadow: 0 0 8px var(--color-online-glow);
}

.dot-offline {
    background: var(--color-offline);
    box-shadow: 0 0 6px var(--color-offline-glow);
}

.dot-unknown {
    background: var(--color-unknown);
}

.device-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
}

.device-speed {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.device-speed.moving {
    color: var(--accent-cyan);
}

.device-time {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.device-badges {
    display: flex;
    gap: 6px;
}

.badge-tag {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-tag.tag-online {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-online);
}

.badge-tag.tag-offline {
    background: rgba(244, 63, 94, 0.15);
    color: var(--color-offline);
}

/* ==========================================================================
   GEOFENCES (GEOZONAS) UI & DRAWING ENGINE
   ========================================================================== */
.geofence-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.geofence-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Geofence Card */
.geofence-card {
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.geofence-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(0, 240, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.geofence-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

.geofence-title {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.geofence-name-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.geofence-color-bullet {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 6px currentColor;
}

.geofence-type-tag {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.geofence-card-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.geofence-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.geofence-id-tag {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
}

.geofence-action-btns {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-gf-action {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 11px;
    transition: var(--transition-fast);
}

.btn-gf-action:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

.btn-gf-action.btn-gf-focus:hover {
    color: var(--accent-cyan);
    border-color: rgba(0, 240, 255, 0.3);
    background: rgba(0, 240, 255, 0.1);
}

.btn-gf-action.btn-gf-edit:hover {
    color: #3b82f6;
    border-color: rgba(59, 130, 246, 0.4);
    background: rgba(59, 130, 246, 0.12);
}

.btn-gf-action.btn-gf-delete:hover {
    color: var(--color-offline);
    border-color: rgba(244, 63, 94, 0.4);
    background: rgba(244, 63, 94, 0.12);
}

.btn-create-first {
    margin-top: 12px;
    background: rgba(0, 240, 255, 0.15);
    border: 1px solid var(--accent-cyan);
    color: var(--accent-cyan);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-fast);
}

.btn-create-first:hover {
    background: var(--accent-cyan);
    color: #0b1120;
    box-shadow: var(--shadow-cyan);
}

.geofence-actions-bar {
    flex-shrink: 0;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(11, 17, 32, 0.4);
}

/* ==========================================================================
   BARRA FLOTANTE DE DIBUJO DE GEOZONA (MAP OVERLAY)
   ========================================================================== */
.geofence-draw-toolbar {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: var(--blur-glass);
    border: 1px solid rgba(0, 240, 255, 0.4);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 240, 255, 0.2);
    border-radius: var(--radius-full);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    animation: drawToolbarSlideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 90vw;
}

@keyframes drawToolbarSlideDown {
    from {
        transform: translate(-50%, -20px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

.draw-toolbar-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.draw-status-pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-cyan);
    box-shadow: 0 0 10px var(--accent-cyan);
    animation: drawPulse 1.4s infinite alternate;
}

@keyframes drawPulse {
    from { opacity: 0.4; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1.15); }
}

.draw-toolbar-texts {
    display: flex;
    flex-direction: column;
}

.draw-title {
    font-weight: 700;
    font-size: 13px;
    color: var(--accent-cyan);
    font-family: var(--font-heading);
    line-height: 1.2;
}

.draw-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.2;
}

.draw-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.btn-draw-tool {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-fast);
}

.btn-draw-tool:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

.btn-draw-tool.btn-draw-confirm {
    background: var(--color-online);
    border-color: var(--color-online);
    color: #ffffff;
    box-shadow: 0 0 12px var(--color-online-glow);
}

.btn-draw-tool.btn-draw-confirm:hover {
    background: #059669;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.6);
}

.btn-draw-tool.btn-draw-close {
    padding: 6px 9px;
    background: rgba(244, 63, 94, 0.15);
    border-color: rgba(244, 63, 94, 0.3);
    color: var(--color-offline);
}

.btn-draw-tool.btn-draw-close:hover {
    background: var(--color-offline);
    color: #ffffff;
}

/* Cursor de dibujo sobre el mapa Leaflet */
.map-view.map-drawing-mode,
.map-drawing-mode .leaflet-pane {
    cursor: crosshair !important;
}

/* Vértices y Tiradores Interactivos en el Mapa */
.geofence-handle-vertex-wrap,
.geofence-handle-center-wrap,
.geofence-handle-edge-wrap {
    background: transparent !important;
    border: none !important;
}

.geofence-handle-vertex {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0f172a;
    border: 2px solid #00f0ff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.8), 0 0 6px currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    transition: transform 0.15s ease;
}

.geofence-handle-vertex:active {
    cursor: grabbing;
    transform: scale(1.3);
}

.geofence-handle-vertex span {
    font-size: 10px;
    font-weight: 800;
    color: #ffffff;
    font-family: var(--font-mono);
}

.geofence-handle-vertex.is-first {
    border-width: 3px;
    box-shadow: 0 0 12px #00f0ff;
}

.geofence-handle-center {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #0f172a;
    border: 2px solid #00f0ff;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 11px;
    cursor: grab;
    transition: transform 0.15s ease;
}

.geofence-handle-center:active {
    cursor: grabbing;
    transform: scale(1.2);
}

.geofence-handle-edge {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.8), 0 0 8px currentColor;
    cursor: ew-resize;
    transition: transform 0.15s ease;
}

.geofence-handle-edge:active {
    transform: scale(1.3);
}

/* Selector de Color y Presets en Modal */
.geofence-color-selector {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-presets {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.color-preset-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition-fast);
}

.color-preset-btn:hover {
    transform: scale(1.15);
}

.color-preset-btn.active {
    border-color: #ffffff;
    box-shadow: 0 0 10px currentColor;
    transform: scale(1.2);
}

.custom-color-input {
    width: 36px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    border-radius: var(--radius-sm);
}

/* Radio para Círculo */
.radius-input-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.custom-range {
    flex: 1;
    accent-color: var(--accent-cyan);
    cursor: pointer;
}

.radius-number-wrap {
    display: flex;
    align-items: center;
    position: relative;
    width: 120px;
}

.radius-num-input {
    width: 100%;
    padding-right: 30px !important;
    font-family: var(--font-mono);
}

.unit-badge {
    position: absolute;
    right: 10px;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 700;
}

/* Bloque Interactivo de Geometría en Modal */
.geofence-geom-card {
    background: rgba(11, 17, 32, 0.6);
    border: 1px dashed rgba(0, 240, 255, 0.3);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: var(--transition-fast);
}

.geofence-geom-card:hover {
    border-color: var(--accent-cyan);
    background: rgba(11, 17, 32, 0.85);
}

.geom-card-content {
    flex: 1;
}

.geom-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
}

.geom-status-badge.status-ready {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-online);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.geom-status-badge.status-empty {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-unknown);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.geom-desc {
    font-size: 11px;
    color: var(--text-muted);
}

.btn-action-draw {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(59, 130, 246, 0.25));
    border: 1px solid var(--accent-cyan);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.btn-action-draw:hover {
    background: var(--accent-cyan);
    color: #090d16;
    box-shadow: var(--shadow-cyan);
    transform: translateY(-1px);
}

/* WKT Toggle Row */
.wkt-toggle-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 0;
    user-select: none;
}

.wkt-toggle-header:hover {
    color: var(--text-secondary);
}

.wkt-toggle-icon {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.wkt-toggle-icon.rotate-180 {
    transform: rotate(180deg);
}

.wkt-textarea {
    font-family: var(--font-mono);
    font-size: 11px;
    margin-top: 4px;
    resize: vertical;
}

/* Sidebar Footer */
.sidebar-footer {
    flex-shrink: 0;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: rgba(11, 17, 32, 0.7);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.time-display {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-footer-action {
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid rgba(0, 240, 255, 0.3);
    color: var(--accent-cyan);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-footer-action:hover {
    background: var(--accent-cyan);
    color: #030712;
}

/* ==========================================================================
   MAP WORKSPACE & FLOATING CONTROLS
   ========================================================================== */
.map-section {
    flex: 1;
    position: relative;
    height: 100%;
    background: #0b1120;
}

.map-view {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Map Floating Controls */
.map-floating-controls {
    position: absolute;
    z-index: 400;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.map-floating-controls.top-right {
    top: 16px;
    right: 16px;
}

.map-control-btn {
    width: 40px;
    height: 40px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: var(--shadow-md);
    transition: var(--transition-fast);
}

.map-control-btn:hover {
    background: rgba(28, 41, 70, 0.95);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--accent-cyan);
}

.layer-dropdown {
    position: absolute;
    top: 0;
    right: 48px;
    width: 220px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dropdown-header {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
}

.layer-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.layer-option:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.layer-option input {
    display: none;
}

.layer-radio-custom {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--text-muted);
    display: inline-block;
    transition: var(--transition-fast);
}

.layer-option input:checked + .layer-radio-custom {
    border-color: var(--accent-cyan);
    background: var(--accent-cyan);
}

/* Selected Device HUD (Bottom Floating Bar) */
.selected-hud {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 450;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: var(--blur-glass);
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), 0 0 25px rgba(0, 240, 255, 0.15);
    padding: 12px 20px;
    min-width: 480px;
    max-width: 90vw;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translate(-50%, 40px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

.hud-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

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

.hud-titles {
    display: flex;
    flex-direction: column;
}

.hud-name {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.hud-time {
    font-size: 11px;
    color: var(--text-muted);
}

.hud-metrics {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hud-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hud-metric .metric-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.hud-metric .metric-val {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--accent-cyan);
}

.metric-pill {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.pill-on {
    background: rgba(16, 185, 129, 0.2);
    color: var(--color-online);
}

.pill-off {
    background: rgba(244, 63, 94, 0.2);
    color: var(--color-offline);
}

.hud-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hud-btn {
    background: var(--accent-cyan-dim);
    border: 1px solid rgba(0, 240, 255, 0.4);
    color: var(--accent-cyan);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}

.hud-btn:hover {
    background: var(--accent-cyan);
    color: #030712;
}

.hud-btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
}

.hud-btn-close:hover {
    color: var(--text-primary);
}

/* Route Playback Panel */
.playback-panel {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 650px;
    max-width: 95vw;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: var(--blur-glass);
    border: 1px solid var(--accent-cyan);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), var(--shadow-cyan);
    padding: 14px 20px;
    z-index: 460;
    animation: slideUp 0.3s ease;
}

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

.playback-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.playback-icon {
    color: var(--accent-cyan);
    font-size: 18px;
}

.playback-badge {
    font-family: var(--font-mono);
    font-size: 12px;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    color: var(--accent-cyan);
}

.playback-speed-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.speed-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-right: 4px;
}

.btn-speed {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-family: var(--font-mono);
    cursor: pointer;
}

.btn-speed.active {
    background: var(--accent-cyan);
    color: #030712;
    border-color: var(--accent-cyan);
    font-weight: 700;
}

.playback-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
}

.playback-close:hover {
    color: var(--color-offline);
}

.playback-slider-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.btn-playback-toggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-cyan);
    color: #030712;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.btn-playback-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 0 15px var(--accent-cyan);
}

.playback-range {
    flex: 1;
    accent-color: var(--accent-cyan);
    cursor: pointer;
}

.playback-metrics-quick {
    display: flex;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ==========================================================================
   MODALS AND DIALOGS
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(3, 7, 18, 0.75);
    backdrop-filter: var(--blur-glass);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-window {
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    animation: modalScale 0.25s ease;
    overflow: hidden;
}

@keyframes modalScale {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-xs { width: 380px; max-width: 95vw; }
.modal-sm { width: 440px; max-width: 95vw; }
.modal-md { width: 620px; max-width: 95vw; }
.modal-lg { width: 920px; max-width: 95vw; }
.modal-xl { width: 1100px; max-width: 96vw; }
.modal-login { width: 400px; }

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(11, 17, 32, 0.4);
}

.modal-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-title-icon {
    font-size: 22px;
    color: var(--accent-cyan);
}

.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
}

.modal-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.btn-modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(11, 17, 32, 0.5);
}

/* Forms */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control {
    height: 38px;
    padding: 0 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    transition: var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.15);
}

.form-help {
    font-size: 11px;
    color: var(--text-muted);
}

.form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.flex-none { flex: none; }
.align-end { align-self: flex-end; }
.mt-2 { margin-top: 10px; }
.mb-3 { margin-bottom: 14px; }
.w-100 { width: 100%; }

/* Buttons */
.btn-primary-action {
    background: linear-gradient(135deg, #0284c7, #00f0ff);
    color: #030712;
    border: none;
    padding: 0 18px;
    height: 38px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
}

.btn-secondary-action {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0 16px;
    height: 38px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-secondary-action:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-secondary-action:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Switch Control */
.switch-control {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.switch-control input {
    display: none;
}

.switch-slider {
    width: 38px;
    height: 20px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    position: relative;
    transition: var(--transition-fast);
}

.switch-slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    top: 3px;
    left: 3px;
    transition: var(--transition-fast);
}

.switch-control input:checked + .switch-slider {
    background: var(--accent-cyan);
}

.switch-control input:checked + .switch-slider::before {
    transform: translateX(18px);
    background: #030712;
}

.switch-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Quick Dates Buttons */
.quick-dates-buttons {
    display: flex;
    gap: 6px;
}

.btn-quick-date {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.btn-quick-date.active {
    background: var(--accent-cyan-dim);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

/* Reports KPI Cards */
.summary-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.kpi-card {
    background: rgba(11, 17, 32, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.icon-dist { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.icon-speed { background: rgba(244, 63, 94, 0.15); color: #f43f5e; }
.icon-avg { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.icon-engine { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }

.kpi-info {
    display: flex;
    flex-direction: column;
}

.kpi-title {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

.kpi-value {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Modern Report Table */
.report-table-scroll {
    max-height: 380px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    text-align: left;
}

.modern-table th {
    background: rgba(11, 17, 32, 0.9);
    padding: 10px 14px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 2;
}

.modern-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
}

.modern-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
}

/* Empty State / Loading State */
.empty-report-state, .loading-state, .empty-drawer-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    gap: 10px;
    color: var(--text-muted);
}

.empty-report-state i {
    font-size: 40px;
    color: rgba(255, 255, 255, 0.1);
}

.loader-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(0, 240, 255, 0.2);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loader-spinner-lg {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(0, 240, 255, 0.2);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Login Modal */
.login-header {
    padding: 24px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, rgba(0, 240, 255, 0.05), transparent);
}

.login-brand i {
    font-size: 32px;
    color: var(--accent-cyan);
    margin-bottom: 8px;
}

.login-brand h2 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 800;
}

.login-brand span {
    font-size: 12px;
    color: var(--text-muted);
}

.alert-box-error {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid var(--color-offline);
    color: var(--color-offline);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Toast Notifications */
.toast-stack {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast-item {
    pointer-events: auto;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-cyan);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 280px;
    max-width: 360px;
    animation: toastIn 0.3s ease;
    transition: opacity 0.3s ease;
}

@keyframes toastIn {
    from { transform: translateX(50px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast-item.toast-success { border-left-color: var(--color-online); }
.toast-item.toast-error { border-left-color: var(--color-offline); }
.toast-item.toast-warning { border-left-color: var(--color-unknown); }

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-primary);
}

.toast-message {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Notifications Drawer */
.drawer-panel {
    position: fixed;
    top: var(--header-height);
    right: 0;
    bottom: 0;
    width: 340px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: var(--blur-glass);
    border-left: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    animation: drawerSlide 0.3s ease;
}

@keyframes drawerSlide {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.drawer-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.drawer-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-cyan);
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notif-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.notif-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notif-dev-name {
    font-weight: 700;
    font-size: 12px;
    color: var(--text-primary);
}

.notif-time {
    font-size: 10px;
    color: var(--text-muted);
}

.notif-text {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ==========================================================================
   LEAFLET CUSTOM STYLING (DARK MODE)
   ========================================================================== */
.leaflet-popup-content-wrapper {
    background: rgba(15, 23, 42, 0.95) !important;
    backdrop-filter: var(--blur-glass) !important;
    border: 1px solid rgba(0, 240, 255, 0.3) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-lg), 0 0 20px rgba(0, 240, 255, 0.15) !important;
    color: var(--text-primary) !important;
    padding: 0 !important;
}

.leaflet-popup-content {
    margin: 14px 16px !important;
    line-height: 1.4 !important;
}

.leaflet-popup-tip {
    background: #0f172a !important;
    border: 1px solid rgba(0, 240, 255, 0.3) !important;
}

.leaflet-container a.leaflet-popup-close-button {
    color: var(--text-muted) !important;
    padding: 8px !important;
}

.leaflet-container a.leaflet-popup-close-button:hover {
    color: var(--text-primary) !important;
}

/* ==========================================================================
   OPENLAYERS CUSTOM STYLING (DARK MODE & LOCAL OFFLINE)
   ========================================================================== */
.ol-custom-popup {
    position: absolute;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: var(--blur-glass);
    border: 1px solid rgba(0, 240, 255, 0.35);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), 0 0 25px rgba(0, 240, 255, 0.2);
    color: var(--text-primary);
    padding: 14px 16px;
    line-height: 1.4;
    min-width: 250px;
    z-index: 1000;
}

.ol-custom-popup::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 8px 0;
    border-style: solid;
    border-color: #0f172a transparent transparent transparent;
    display: block;
    width: 0;
}

.ol-popup-closer {
    position: absolute;
    top: 10px;
    right: 12px;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    transition: color 0.2s ease;
    text-decoration: none;
}

.ol-popup-closer:hover {
    color: #ff3366;
}

/* OpenLayers Zoom Controls Styling */
.ol-zoom {
    top: auto !important;
    left: auto !important;
    bottom: 24px !important;
    right: 24px !important;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ol-zoom button {
    background: rgba(15, 23, 42, 0.85) !important;
    color: #00f0ff !important;
    border: 1px solid rgba(0, 240, 255, 0.3) !important;
    border-radius: 8px !important;
    backdrop-filter: blur(10px) !important;
    width: 38px !important;
    height: 38px !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.ol-zoom button:hover {
    background: rgba(0, 240, 255, 0.25) !important;
    color: #ffffff !important;
    border-color: #00f0ff !important;
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.4) !important;
}

/* Custom Marker Icons */
.custom-vehicle-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.marker-inner {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    border: 2px solid #fff;
    position: relative;
}

.marker-inner.marker-online {
    background: #10b981;
    border-color: #34d399;
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.8);
}

.marker-inner.marker-offline {
    background: #f43f5e;
    border-color: #fb7185;
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.6);
}

.marker-inner.marker-unknown {
    background: #f59e0b;
    border-color: #fcd34d;
}

.marker-heading-arrow {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 7px solid #fff;
}

/* Tooltip Geofence */
.geofence-label-tooltip {
    background: rgba(15, 23, 42, 0.85) !important;
    backdrop-filter: blur(8px) !important;
    border: 1px solid var(--accent-cyan) !important;
    color: var(--text-primary) !important;
    border-radius: 6px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    box-shadow: var(--shadow-sm) !important;
    padding: 3px 8px !important;
}

.geofence-label-tooltip::before {
    display: none !important;
}

/* Utility Classes */
.hidden { display: none !important; }

/* Responsive Media Queries */
@media (max-width: 768px) {
    .fleet-quick-stats { display: none; }
    .sidebar {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-width: 320px;
    }
    .selected-hud {
        width: 95vw;
        min-width: unset;
        bottom: 10px;
    }
}

/* ==========================================================================
   USER PROFILE BADGE & SECURITY SCREEN
   ========================================================================== */
.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    cursor: default;
}

.user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0ea5e9, #00f0ff);
    color: #030712;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.user-info-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.user-name {
    font-weight: 700;
    font-size: 12px;
    color: var(--text-primary);
}

.user-role {
    font-size: 10px;
    color: var(--accent-cyan);
    font-weight: 600;
    text-transform: uppercase;
}

/* App Lock State: Panel completamente oculto si no está autenticado */
body.auth-locked #appContainer {
    display: none !important;
}

/* ==========================================================================
   PANTALLA COMPLETA DE INICIO DE SESIÓN (LOGIN)
   ========================================================================== */
.auth-fullscreen-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    background: #060913;
    background-image: 
        radial-gradient(circle at 50% 12%, rgba(0, 240, 255, 0.16) 0%, transparent 50%),
        radial-gradient(circle at 85% 85%, rgba(59, 130, 246, 0.12) 0%, transparent 45%),
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 36px 36px, 36px 36px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: clamp(40px, 8vh, 85px);
    padding-bottom: 50px;
    padding-left: 20px;
    padding-right: 20px;
    overflow-y: auto;
    box-sizing: border-box;
}

.auth-glow-orb {
    position: absolute;
    top: 8%;
    left: 50%;
    transform: translateX(-50%);
    width: 520px;
    height: 520px;
    background: radial-gradient(circle, rgba(0, 240, 255, 0.14) 0%, rgba(0, 240, 255, 0) 70%);
    pointer-events: none;
    filter: blur(65px);
}

.auth-card {
    position: relative;
    width: 440px;
    max-width: 95vw;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(0, 240, 255, 0.28);
    border-radius: var(--radius-lg);
    box-shadow: 
        0 25px 65px rgba(0, 0, 0, 0.9),
        0 0 40px rgba(0, 240, 255, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    padding: 36px 32px;
    margin: 0 auto;
    animation: authCardIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

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

.auth-card-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px auto;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 240, 255, 0.4);
    border-radius: var(--radius-md);
    max-width: 280px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 25px rgba(0, 240, 255, 0.2);
}

.auth-brand-logo {
    max-width: 100%;
    width: auto;
    height: auto;
    max-height: 54px;
    object-fit: contain;
    display: block;
}

.auth-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.auth-security-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 14px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: var(--radius-full);
    color: var(--color-online);
    font-size: 11px;
    font-weight: 600;
}

.auth-form {
    display: flex;
    flex-direction: column;
}

.auth-form .form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.auth-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.auth-input-wrapper input {
    width: 100%;
    height: 44px;
    padding: 0 42px 0 14px;
    background: rgba(8, 14, 28, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition-fast);
}

.auth-input-wrapper input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.2);
    background: rgba(8, 14, 28, 1);
}

.btn-toggle-eye {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 15px;
    padding: 8px;
    transition: var(--transition-fast);
}

.btn-toggle-eye:hover {
    color: var(--accent-cyan);
}

.auth-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.auth-options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
}

.remember-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.remember-label input {
    display: none;
}

.custom-chk {
    width: 18px;
    height: 18px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: var(--bg-input);
    border-radius: 5px;
    position: relative;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.remember-label input:checked + .custom-chk {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
}

.remember-label input:checked + .custom-chk::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 800;
    color: #030712;
}

.auth-submit-btn {
    width: 100%;
    height: 46px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.3px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #00f0ff 0%, #0284c7 100%);
    color: #030712;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    transition: var(--transition-fast);
    box-shadow: 0 4px 18px rgba(0, 240, 255, 0.32);
}

.auth-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 26px rgba(0, 240, 255, 0.5);
    background: linear-gradient(135deg, #38bdf8 0%, #00f0ff 100%);
}

.auth-submit-btn:active {
    transform: translateY(0);
}

.auth-footer-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 18px;
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

/* ==========================================================================
   PANTALLA COMPLETA PURA SIN MENÚS (Full Screen Pure Map Mode)
   ========================================================================== */
body.fullscreen-pure-mode #mainHeader {
    display: none !important;
}

body.fullscreen-pure-mode #mainSidebar {
    display: none !important;
}

body.fullscreen-pure-mode .main-workspace {
    height: 100vh !important;
    max-height: 100vh !important;
}

body.fullscreen-pure-mode .map-section {
    width: 100vw !important;
    height: 100vh !important;
}

body.fullscreen-pure-mode #leafletMap {
    width: 100vw !important;
    height: 100vh !important;
}

/* Botón Flotante para Salir de Pantalla Completa */
.btn-exit-fullscreen {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(0, 240, 255, 0.4);
    color: var(--accent-cyan);
    border-radius: var(--radius-full);
    backdrop-filter: var(--blur-glass);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6), 0 0 18px rgba(0, 240, 255, 0.3);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-normal);
}

.btn-exit-fullscreen:hover {
    background: rgba(0, 240, 255, 0.18);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.7), 0 0 25px rgba(0, 240, 255, 0.5);
    color: #fff;
}

/* ==========================================================================
   MENÚ DISCRETO DE MÓVIL Y ACCIONES CONTEXTUALES
   ========================================================================== */
.device-actions-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.btn-device-menu {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition-fast);
}

.btn-device-menu:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Menú Contextual Flotante Discreto */
.device-context-menu {
    position: fixed;
    z-index: 10000;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: var(--blur-glass);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65), 0 0 15px rgba(0, 240, 255, 0.15);
    padding: 6px;
    min-width: 175px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: ctxFadeIn 0.15s ease-out;
}

@keyframes ctxFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ctx-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    transition: var(--transition-fast);
}

.ctx-item i {
    width: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    transition: var(--transition-fast);
}

.ctx-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.ctx-item:hover i {
    color: var(--accent-cyan);
}

.ctx-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 4px 0;
}

.ctx-item.ctx-danger {
    color: #fb7185;
}

.ctx-item.ctx-danger i {
    color: #fb7185;
}

.ctx-item.ctx-danger:hover {
    background: rgba(244, 63, 94, 0.15);
    color: #fff;
}

.ctx-item.ctx-danger:hover i {
    color: #fff;
}

/* ==========================================================================
   GRUPOS DE MÓVILES
   ========================================================================== */
.section-top-actions {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
}

.btn-sm-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(0, 240, 255, 0.12);
    border: 1px solid rgba(0, 240, 255, 0.3);
    color: var(--accent-cyan);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-sm-action:hover {
    background: var(--accent-cyan);
    color: #030712;
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

.section-filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 6px 10px;
    background: rgba(11, 17, 32, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
}

.select-section-filter {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
}

.select-section-filter option {
    background: #0f172a;
    color: var(--text-primary);
}

.filter-pill.pill-action {
    background: rgba(0, 240, 255, 0.12);
    border-color: rgba(0, 240, 255, 0.35);
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.filter-pill.pill-action:hover {
    background: var(--accent-cyan);
    color: #030712;
}

/* Lista de Grupos */
.section-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.section-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
}

.section-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

.section-card.active {
    background: rgba(0, 240, 255, 0.08);
    border-color: rgba(0, 240, 255, 0.4);
}

.section-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.section-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(0, 240, 255, 0.12);
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.section-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.section-count-badge {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.section-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
}

.btn-section-action {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition-fast);
}

.btn-section-action:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-section-action.text-danger:hover {
    background: rgba(244, 63, 94, 0.15);
    color: #fb7185;
}

/* Modales Adicionales */
.modal-md {
    max-width: 620px;
    width: 95%;
}

.modal-xs {
    max-width: 440px;
    width: 90%;
}

.btn-danger-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    background: #e11d48;
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: 0 4px 14px rgba(225, 29, 72, 0.35);
}

.btn-danger-action:hover {
    background: #f43f5e;
    box-shadow: 0 6px 20px rgba(225, 29, 72, 0.5);
    transform: translateY(-1px);
}

.modal-warning-text {
    font-size: 12px;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    padding: 8px 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.text-highlight {
    color: var(--accent-cyan);
}

.text-danger {
    color: #f43f5e !important;
}

/* ==========================================================================
   MARCADORES DE VEHÍCULO: ÍCONOS ALINEADOS, FLECHA DE RUMBO Y EFECTO MOVIMIENTO
   ========================================================================== */
.vehicle-marker-wrapper {
    background: transparent !important;
    border: none !important;
}

.custom-vehicle-marker {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
}

/* 1. Capa de rotación exclusiva para la flecha de rumbo */
.marker-heading-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    transform-origin: 50% 50%;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 3;
}

/* 2. Flecha indicadora de orientación / rumbo */
.marker-heading-arrow {
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 15px;
    height: 15px;
    color: var(--accent-cyan);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.85)) drop-shadow(0 0 6px rgba(0, 240, 255, 0.7));
    transition: color 0.3s ease, filter 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-heading-arrow svg.arrow-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Efecto dinámico cuando el vehículo se está desplazando */
.marker-heading-arrow.is-moving {
    color: #00f0ff;
    animation: arrowGlowPulse 1.4s infinite ease-in-out;
}

@keyframes arrowGlowPulse {
    0%, 100% {
        transform: translateX(-50%) scale(1);
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.9)) drop-shadow(0 0 6px rgba(0, 240, 255, 0.8));
    }
    50% {
        transform: translateX(-50%) scale(1.22);
        filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.95)) drop-shadow(0 0 12px rgba(0, 240, 255, 1));
    }
}

/* 3. Núcleo central del móvil: SIEMPRE VERTICAL Y ALINEADO (SIN ROTACIÓN) */
.marker-core {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2.5px solid var(--accent-cyan);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
    z-index: 2;
    transition: transform 0.2s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.custom-vehicle-marker:hover .marker-core {
    transform: scale(1.12);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.85), 0 0 16px rgba(0, 240, 255, 0.6);
}

/* Colores de estado del núcleo central */
.marker-core.marker-online {
    border-color: #10b981;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7), 0 0 10px rgba(16, 185, 129, 0.55);
}

.marker-core.marker-online ~ .marker-heading-layer .marker-heading-arrow {
    color: #10b981;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.85)) drop-shadow(0 0 6px rgba(16, 185, 129, 0.7));
}

.marker-core.marker-offline {
    border-color: #f43f5e;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7), 0 0 8px rgba(244, 63, 94, 0.45);
}

.marker-core.marker-offline ~ .marker-heading-layer .marker-heading-arrow {
    color: #f43f5e;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.85)) drop-shadow(0 0 6px rgba(244, 63, 94, 0.6));
}

.marker-core.marker-unknown {
    border-color: #f59e0b;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7), 0 0 8px rgba(245, 158, 11, 0.45);
}

.marker-core.marker-unknown ~ .marker-heading-layer .marker-heading-arrow {
    color: #f59e0b;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.85)) drop-shadow(0 0 6px rgba(245, 158, 11, 0.6));
}

/* Ícono del Móvil: SIEMPRE DERECHO, CENTRADO Y NUNCA VOLCADO */
.marker-icon {
    font-size: 14px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: none !important; /* Garantiza alineación vertical perfecta en todo momento */
    pointer-events: none;
    line-height: 1;
}

/* Anillo de pulso sutil cuando el móvil está en movimiento */
.marker-pulse-ring {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(16, 185, 129, 0.7);
    animation: markerPulse 1.8s infinite cubic-bezier(0.2, 0.8, 0.2, 1);
    pointer-events: none;
}

@keyframes markerPulse {
    0% {
        transform: scale(0.9);
        opacity: 0.9;
    }
    100% {
        transform: scale(1.65);
        opacity: 0;
    }
}

/* ==========================================================================
   MODO PANTALLA COMPLETA PURA / AGRANDAR MAPA
   ========================================================================== */
body.fullscreen-pure-mode .header-bar,
body.fullscreen-pure-mode .sidebar {
    display: none !important;
}

body.fullscreen-pure-mode .main-workspace,
body.fullscreen-pure-mode .map-section,
body.fullscreen-pure-mode .map-view {
    width: 100vw !important;
    height: 100vh !important;
    flex: 1 1 100% !important;
}

/* ==========================================================================
   GESTIÓN DE USUARIOS Y PERMISOS DE SECCIONES (MODERN COMMAND CENTER)
   ========================================================================== */

/* Resumen Estadístico Superior de Usuarios */
.users-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.user-stat-card {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    overflow: hidden;
    transition: var(--transition-fast);
}

.user-stat-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.user-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.stat-icon-total {
    background: rgba(0, 240, 255, 0.12);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 240, 255, 0.3);
}

.stat-icon-admin {
    background: rgba(168, 85, 247, 0.12);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.stat-icon-operator {
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.stat-icon-active {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.user-stat-info {
    display: flex;
    flex-direction: column;
}

.user-stat-value {
    font-size: 22px;
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--text-primary);
    line-height: 1.1;
}

.user-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 3px;
}

/* Barra de Herramientas de Usuarios */
.users-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.users-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 280px;
}

.users-search-box {
    position: relative;
    flex: 1;
    max-width: 360px;
}

.users-search-box input {
    width: 100%;
    height: 38px;
    padding: 0 32px 0 36px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
}

.users-search-box input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 2px rgba(0, 240, 255, 0.15);
    outline: none;
}

.users-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
}

.users-search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.users-filter-pills {
    display: flex;
    gap: 6px;
}

.user-filter-pill {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: var(--transition-fast);
}

.user-filter-pill:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.user-filter-pill.active {
    background: rgba(0, 240, 255, 0.12);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    font-weight: 600;
}

.users-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Tabla de Usuarios */
.users-table-wrap {
    overflow-x: auto;
    background: rgba(11, 17, 32, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    max-height: 480px;
    overflow-y: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.users-table thead th {
    background: rgba(15, 23, 42, 0.95);
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.users-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background var(--transition-fast);
}

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

.users-table tbody td {
    padding: 14px 16px;
    vertical-align: middle;
}

/* Celda de Usuario con Avatar */
.user-cell-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    text-transform: uppercase;
}

.user-avatar-admin {
    background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
    border-color: rgba(168, 85, 247, 0.4);
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.3);
}

.user-name-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.user-email-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.user-self-pill {
    font-size: 10px;
    background: rgba(0, 240, 255, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 240, 255, 0.3);
    padding: 1px 6px;
    border-radius: var(--radius-full);
    font-weight: 600;
}

/* Badges de Rol */
.user-role-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11.5px;
    font-weight: 600;
}

.user-role-badge.role-admin {
    background: rgba(168, 85, 247, 0.15);
    color: #d8b4fe;
    border: 1px solid rgba(168, 85, 247, 0.35);
}

.user-role-badge.role-operator {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.35);
}

.user-role-badge.role-readonly {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

/* Badges de Estado */
.user-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
}

.user-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.user-status-pill.active {
    color: #34d399;
}

.user-status-pill.active .user-status-dot {
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.user-status-pill.disabled {
    color: #f87171;
}

.user-status-pill.disabled .user-status-dot {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

/* Mini Tags de Secciones Permitidas */
.section-perm-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 320px;
}

.section-chip {
    font-size: 10.5px;
    padding: 2px 7px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.section-chip.granted {
    background: rgba(0, 240, 255, 0.08);
    border-color: rgba(0, 240, 255, 0.25);
    color: #7dd3fc;
}

.section-chip.all {
    background: rgba(168, 85, 247, 0.12);
    border-color: rgba(168, 85, 247, 0.3);
    color: #d8b4fe;
    font-weight: 600;
}

.section-chip.denied {
    opacity: 0.45;
    text-decoration: line-through;
}

/* Botones de Acción en Fila de Usuario */
.user-row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-table-action {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-table-action:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

.btn-table-action.action-perm:hover {
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    background: rgba(0, 240, 255, 0.1);
}

.btn-table-action.action-edit:hover {
    color: #60a5fa;
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.btn-table-action.action-delete:hover {
    color: #f87171;
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.btn-table-action:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* ==========================================================================
   MODAL DE INSPECCIÓN Y EDICIÓN DE PERMISOS POR SECCIÓN
   ========================================================================== */
.user-perm-hero {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.8) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.user-perm-user-details {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-perm-stats-bar {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.perm-progress-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.perm-progress-bar-wrap {
    width: 180px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.perm-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-cyan), #3b82f6);
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

/* Presets Rápidos de Permisos */
.perm-presets-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    background: rgba(11, 17, 32, 0.4);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.perm-presets-label {
    font-size: 11.5px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 4px;
}

.btn-perm-preset {
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: var(--transition-fast);
}

.btn-perm-preset:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
}

/* Grid de Secciones de Permisos */
.sections-permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.section-permission-card {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition-fast);
    display: flex;
    flex-direction: column;
}

.section-permission-card:hover {
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}

.section-perm-card-header {
    padding: 12px 16px;
    background: rgba(11, 17, 32, 0.6);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-perm-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
}

.section-perm-card-title i {
    font-size: 15px;
    color: var(--accent-cyan);
}

.section-status-tag {
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.section-status-tag.full {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.section-status-tag.partial {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.section-status-tag.none {
    background: rgba(244, 63, 94, 0.12);
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, 0.25);
}

.section-perm-items-list {
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.perm-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.perm-toggle-row:last-child {
    border-bottom: none;
}

.perm-toggle-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.perm-toggle-title {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-primary);
}

.perm-toggle-desc {
    font-size: 11px;
    color: var(--text-muted);
}

/* Custom iOS-style Switch Toggle */
.custom-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}

.custom-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.12);
    border: 1px solid var(--border-color);
    transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 24px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: #94a3b8;
    transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.custom-switch input:checked + .switch-slider {
    background-color: #0284c7;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

.custom-switch input:checked + .switch-slider:before {
    transform: translateX(18px);
    background-color: #ffffff;
}

.custom-switch input:disabled + .switch-slider {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Estados Vacíos y de Carga para Usuarios */
.users-empty-state, .users-loading-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.users-empty-state i {
    font-size: 38px;
    color: var(--text-muted);
    opacity: 0.5;
}

.users-loading-state .loader-spinner {
    width: 32px;
    height: 32px;
    border-width: 3px;
}







