/* ================== CSS VARIABLES ================== */
:root {
    /* Color Palette */
    --bg-base: #0f1115;
    --bg-sidebar: #15181e;
    --bg-surface: #1e222b;
    --bg-surface-hover: #262b36;
    --border-color: rgba(255, 255, 255, 0.08);
    
    /* Accents (GalaTelecom Branded Colors adapted for Dark Theme) */
    --accent-primary: #a2d100;
    --accent-primary-hover: #b8e61d;
    --accent-secondary: #2c5eb3;
    --accent-secondary-light: #4477ce;
    
    /* Gantt Task Colors */
    --task-design: #8b5cf6;
    --task-dev: #3b82f6;
    --task-marketing: #ec4899;
    --task-done: #10b981;

    /* Typography */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --font-family: 'Inter', sans-serif;
    
    /* Layout */
    --sidebar-width: 260px;
    --topbar-height: 70px;
    --transition-speed: 0.3s;
}

/* ================== RESET & BASE ================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button, input { font-family: inherit; border: none; outline: none; background: none; }
ul { list-style: none; }

/* Contenedor de Selección de Proyectos / Entorno */
#projects-container {
    min-height: 100vh;
    width: 100%;
    background: var(--bg-surface);
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 80px;
}

/* ================== LAYOUT APLICACIÓN PRINCIPAL ================== */
#app-container {
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    width: 100vw;
}

.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* ================== SIDEBAR ================== */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    z-index: 1000; /* Prioritize sidebar over everything else */
}

.sidebar-header {
    padding: 0 24px 24px;
    margin-bottom: 10px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.logo .brand-icon {
    color: var(--accent-primary);
    width: 28px;
    height: 28px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin: 24px 0 8px 12px;
}

.nav-item { margin-bottom: 4px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-speed);
}

.nav-link svg { width: 18px; height: 18px; color: var(--text-muted); transition: color var(--transition-speed); }

.nav-link:hover {
    background-color: var(--bg-surface);
    color: var(--text-primary);
}
.nav-link:hover svg { color: var(--accent-primary); }

.nav-item.active .nav-link {
    background-color: rgba(162, 209, 0, 0.1);
    color: var(--accent-primary);
}
.nav-item.active .nav-link svg { color: var(--accent-primary); }

.badge {
    margin-left: auto;
    background-color: var(--accent-secondary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.upgrade-card {
    margin: 24px 16px 0;
    padding: 20px;
    background: linear-gradient(145deg, var(--bg-surface), #1a1e25);
    border-radius: 12px;
    border: 1px solid rgba(162, 209, 0, 0.15);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.upgrade-card::before {
    content: '';
    position: absolute;
    top: -50px; left: -50px; width: 100px; height: 100px;
    background: var(--accent-primary);
    filter: blur(50px);
    opacity: 0.1;
}

.upgrade-icon { font-size: 24px; margin-bottom: 8px; }
.upgrade-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.upgrade-card p { font-size: 12px; color: var(--text-secondary); margin-bottom: 12px; }

.btn-glass {
    width: 100%;
    padding: 8px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-glass:hover { background: rgba(255,255,255,0.1); transform: translateY(-1px); }

/* ================== MAIN CONTENT ================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Important for flex-child overflow */
}

/* ================== TOPBAR ================== */
.topbar {
    height: var(--topbar-height);
    background-color: var(--bg-base);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    flex-shrink: 0;
}

.search-container {
    position: relative;
    width: 320px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    background-color: var(--bg-surface);
    color: var(--text-primary);
    padding: 10px 16px 10px 40px;
    border-radius: 20px;
    border: 1px solid transparent;
    font-size: 14px;
    transition: all 0.3s;
}

.search-input:focus {
    background-color: var(--bg-surface-hover);
    border-color: rgba(162, 209, 0, 0.4);
    box-shadow: 0 0 0 3px rgba(162, 209, 0, 0.1);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 24px;
}

.action-btn {
    position: relative;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}
.action-btn:hover { color: var(--text-primary); }
.action-btn svg { width: 22px; height: 22px; }

/* Botones Salir del Sistema */
.btn-sidebar-logout {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #ef4444;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-sidebar-logout:hover {
    background: #ef4444;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
}
.btn-sidebar-logout:hover svg {
    color: #ffffff;
}

.btn-logout-action:hover {
    background: #ef4444 !important;
    color: #ffffff !important;
    border-color: #ef4444 !important;
}
.btn-logout-action:hover svg {
    color: #ffffff !important;
}

.notification-dot {
    position: absolute;
    top: 0; right: 2px;
    width: 8px; height: 8px;
    background-color: #ef4444;
    border-radius: 50%;
    border: 2px solid var(--bg-base);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 30px;
    transition: background 0.2s;
}
.user-profile:hover { background: var(--bg-surface); }

.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-surface); }
.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: 11px; color: var(--text-muted); }
.dropdown-icon { width: 16px; height: 16px; color: var(--text-muted); }

/* ================== PAGE HEADER ================== */
.content-wrapper {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

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

.page-title { display: flex; align-items: center; gap: 16px; }
.page-title h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; }

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.status-active { background: rgba(162,209,0,0.15); color: var(--accent-primary); border: 1px solid rgba(162,209,0,0.3); }

.page-actions { display: flex; align-items: center; gap: 16px; }

.view-toggles {
    display: flex;
    background: var(--bg-surface);
    border-radius: 8px;
    padding: 4px;
}
.view-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}
.view-btn svg { width: 16px; height: 16px; }
.view-btn:hover { color: var(--text-primary); }
.timeline-day.is-weekend {
    background: var(--bg-surface-hover);
    color: var(--accent-primary);
}

.timeline-day.is-today {
    background: rgba(162, 209, 0, 0.1);
    color: var(--accent-primary);
    border-bottom: 2px solid var(--accent-primary);
}
.view-btn.active {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn svg { width: 18px; height: 18px; }

.btn-primary {
    background-color: var(--accent-primary);
    color: #1a1a1a;
    box-shadow: 0 4px 14px rgba(162,209,0,0.3);
}
.btn-primary:hover {
    background-color: var(--accent-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(162,209,0,0.4);
}

.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover { background-color: var(--bg-surface-hover); }

/* ================== GANTT CHART COMPONENT ================== */
.gantt-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.gantt-header-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0,0,0,0.1);
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-base);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}
.zoom-controls span { font-size: 13px; font-weight: 600; padding: 0 8px; }
.control-btn {
    padding: 4px;
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
}
.control-btn:hover { background: var(--bg-surface); color: var(--text-primary); }
.control-btn svg { width: 18px; height: 18px; display: block; }

.gantt-chart-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left: Task List */
.gantt-task-list {
    width: 280px;
    min-width: 280px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: var(--bg-sidebar);
}

.gantt-list-header {
    height: 60px; /* Two rows of timeline header */
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.col-name { flex: 1; }
.col-assignee { width: 40px; text-align: right; }

.gantt-list-body {
    flex: 1;
    overflow-y: auto;
    /* Custom scrollbar hidden for sync with visual area */
}
.gantt-list-body::-webkit-scrollbar { display: none; }

.task-row {
    height: 50px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
    cursor: pointer;
}
.task-row:hover { background: rgba(255,255,255,0.02); }

.task-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-name-indented { padding-left: 20px; color: var(--text-secondary); font-size: 13px; display: flex; align-items: center; gap: 8px;}
.task-name-indented::before { content: ''; width: 4px; height: 4px; background: var(--border-color); border-radius: 50%; }

.task-assignee img { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--bg-surface); }

/* Right: Timeline */
.gantt-timeline-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: auto;
    overflow-y: hidden;
    background: var(--bg-base);
}

/* Scrollbar styling */
.gantt-timeline-view::-webkit-scrollbar { height: 8px; width: 8px; }
.gantt-timeline-view::-webkit-scrollbar-track { background: var(--bg-base); }
.gantt-timeline-view::-webkit-scrollbar-thumb { background: var(--bg-surface-hover); border-radius: 4px; }

.gantt-timeline-header {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface);
    position: sticky;
    top: 0;
    z-index: 5;
}

.timeline-months {
    display: flex;
    height: 30px;
    border-bottom: 1px solid var(--border-color);
}
.timeline-month {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--border-color);
}

.timeline-days {
    display: flex;
    height: 30px;
}
.timeline-day {
    flex-shrink: 0;
    width: 40px; /* Base day width */
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--border-color);
}
.timeline-day.is-weekend { background: rgba(255,255,255,0.02); color: var(--text-secondary); }
.timeline-day.is-today { background: rgba(162,209,0,0.1); color: var(--accent-primary); font-weight: 700; border-bottom: 2px solid var(--accent-primary); }

.gantt-timeline-grid {
    position: relative;
    flex: 1;
    overflow-y: auto;
    background-image: linear-gradient(to right, var(--border-color) 1px, transparent 1px);
    background-size: 40px 100%; /* Match timeline-day width */
}
.gantt-timeline-grid::-webkit-scrollbar { display: none; }

/* Horizontal grid rows */
.grid-row {
    height: 50px; /* Match task-row height */
    border-bottom: 1px solid rgba(255,255,255,0.03);
    position: relative;
}
.grid-row:hover { background: rgba(255,255,255,0.01); }

/* Task Bars */
.gantt-bar-container {
    position: absolute;
    top: 10px;
    height: 30px;
    padding: 0 5px;
    z-index: 2;
    cursor: grab;
}
.gantt-bar-container:active { cursor: grabbing; }

.gantt-bar {
    height: 100%;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
}
.gantt-bar:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.4);
}

.gantt-bar-progress {
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
    position: absolute;
    top: 0; left: 0;
    transition: width 0.3s ease;
}

.gantt-bar-label {
    position: relative;
    z-index: 10;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    padding: 0 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Colors by category */
.bar-design { background: linear-gradient(90deg, #8b5cf6, #7c3aed); }
.bar-dev { background: linear-gradient(90deg, #3b82f6, #2563eb); }
.bar-marketing { background: linear-gradient(90deg, #ec4899, #db2777); }
.bar-qa { background: linear-gradient(90deg, #f59e0b, #d97706); }
.bar-pm { background: linear-gradient(90deg, #6366f1, #4f46e5); }
.bar-ops { background: linear-gradient(90deg, #64748b, #475569); }
.bar-overdue { background: linear-gradient(90deg, #ef4444, #dc2626); border: 2px solid #fff; }
.bar-done { background: linear-gradient(90deg, #10b981, #059669); }
.bar-epic { background: linear-gradient(90deg, var(--bg-surface-hover), var(--bg-surface)); border: 1px solid var(--border-color); }
.bar-epic .gantt-bar-label { color: var(--text-primary); }

/* Dependency Lines (simplified visual logic for mock) */
.dependency-line {
    position: absolute;
    border: 1.5px solid var(--accent-primary);
    border-radius: 2px;
    z-index: 1;
    pointer-events: none;
    opacity: 0.6;
}

/* ================== THEMES (4 TEMAS DE ESCRITORIO) ================== */

/* 1. TEMA BLANCO / CLARO (PREDETERMINADO) */
body, body.theme-light, body.light-theme {
    --bg-base: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f1f5f9;
    --border-color: rgba(0, 0, 0, 0.09);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --accent-primary: #a2d100;
    --accent-primary-hover: #b8e61d;
    --accent-secondary: #2563eb;
    --accent-secondary-light: #3b82f6;
    background-color: var(--bg-base);
    color: var(--text-primary);
}

body.theme-light .gantt-card, 
body.theme-light .topbar, 
body.theme-light .gantt-list-header,
body.light-theme .gantt-card, 
body.light-theme .topbar, 
body.light-theme .gantt-list-header {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

/* BOTONES PRIMARIOS: VERDE CORPORATIVO (#a2d100) EN TODOS LOS TEMAS */
.btn-primary,
body.theme-light .btn-primary,
body.light-theme .btn-primary,
body.theme-dark .btn-primary,
body.theme-navy .btn-primary,
body.theme-aquamarine .btn-primary { 
    background-color: #a2d100 !important;
    color: #0f1115 !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 14px rgba(162, 209, 0, 0.35) !important;
}

.btn-primary:hover,
body.theme-light .btn-primary:hover,
body.light-theme .btn-primary:hover,
body.theme-dark .btn-primary:hover,
body.theme-navy .btn-primary:hover,
body.theme-aquamarine .btn-primary:hover {
    background-color: #b8e61d !important;
    box-shadow: 0 6px 20px rgba(162, 209, 0, 0.5) !important;
}

/* 2. TEMA OSCURO GALA / DARK PRO */
body.theme-dark {
    --bg-base: #0f1115;
    --bg-sidebar: #15181e;
    --bg-surface: #1e222b;
    --bg-surface-hover: #262b36;
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-primary: #a2d100;
    --accent-primary-hover: #b8e61d;
    --accent-secondary: #2c5eb3;
    --accent-secondary-light: #4477ce;
    background-color: var(--bg-base);
    color: var(--text-primary);
}

/* 3. TEMA AZUL MARINO / NAVY DEEP */
body.theme-navy {
    --bg-base: #070d1e;
    --bg-sidebar: #0b152d;
    --bg-surface: #122143;
    --bg-surface-hover: #1a2f5f;
    --border-color: rgba(96, 165, 250, 0.18);
    --text-primary: #f8fafc;
    --text-secondary: #93c5fd;
    --text-muted: #60a5fa;
    --accent-primary: #a2d100;
    --accent-primary-hover: #b8e61d;
    --accent-secondary: #2563eb;
    --accent-secondary-light: #60a5fa;
    background-color: var(--bg-base);
    color: var(--text-primary);
}

body.theme-navy .gantt-card, 
body.theme-navy .topbar, 
body.theme-navy .gantt-list-header {
    box-shadow: 0 4px 15px rgba(3, 7, 18, 0.4);
}

/* 4. TEMA AZUL AGUAMARINA / TEAL OCEAN */
body.theme-aquamarine {
    --bg-base: #031c20;
    --bg-sidebar: #062b31;
    --bg-surface: #0a3d46;
    --bg-surface-hover: #0f4f5a;
    --border-color: rgba(45, 212, 191, 0.22);
    --text-primary: #f0fdfa;
    --text-secondary: #99f6e4;
    --text-muted: #5eead4;
    --accent-primary: #a2d100;
    --accent-primary-hover: #b8e61d;
    --accent-secondary: #0d9488;
    --accent-secondary-light: #2dd4bf;
    background-color: var(--bg-base);
    color: var(--text-primary);
}

body.theme-aquamarine .gantt-card, 
body.theme-aquamarine .topbar, 
body.theme-aquamarine .gantt-list-header {
    box-shadow: 0 4px 15px rgba(2, 28, 32, 0.4);
}

/* ================== MODAL STYLES ================== */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 2000; /* Modals on top of sidebar */
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 400px;
    max-width: 90%;
    transform: translateY(20px);
    transition: transform 0.3s;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.modal-overlay.active .modal-content { transform: translateY(0); }

.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}
.modal-header h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.close-btn { color: var(--text-muted); cursor: pointer; transition: color 0.2s; }
.close-btn:hover { color: var(--text-primary); }
.close-btn svg { width: 20px; height: 20px; }

.modal-body { padding: 20px; }

.form-group { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.form-group-row { display: flex; gap: 16px; margin-bottom: 16px; }
.form-group-row .form-group { flex: 1; margin-bottom: 0; }

.form-group label { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.form-input {
    background: var(--bg-base);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--accent-primary); box-shadow: 0 0 0 2px rgba(162, 209, 0, 0.1); }

.form-range { -webkit-appearance: none; appearance: none; background: transparent; height: 4px; border-radius: 2px; }
.form-range::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    height: 16px; width: 16px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    box-shadow: 0 0 0 4px rgba(162, 209, 0, 0.2);
}
.form-range::-webkit-slider-runnable-track { background: var(--border-color); height: 4px; border-radius: 2px; }

/* ================== LOGIN STYLES ================== */
.login-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-base);
    position: relative;
    overflow-y: auto;
}

/* Cabecera superior para Login y Pantallas */
.site-top-header {
    width: 100%;
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.brand-logo-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 10px;
    background: #0b132b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: transform 0.2s ease;
}

.brand-logo-badge:hover {
    transform: scale(1.02);
}

.brand-logo-img {
    height: 32px;
    width: auto;
    object-fit: contain;
    display: block;
}

.brand-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hdr-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.hdr-btn:hover {
    background: var(--bg-base);
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

.hdr-btn.pwa-highlight {
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.hdr-btn.pwa-highlight:hover {
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.45);
}

.login-center-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.login-card {
    background: var(--bg-surface);
    padding: 36px 32px;
    border-radius: 16px;
    width: 440px;
    max-width: 100%;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
}

.login-logo {
    display: flex; gap: 12px; align-items: center; justify-content: center;
    margin-bottom: 8px; font-size: 24px; font-weight: 700;
}
.login-logo .brand-icon { width: 32px; height: 32px; color: var(--accent-primary); }

.login-subtitle {
    text-align: center; color: var(--text-secondary); margin-bottom: 24px; font-size: 14px;
}

/* ================== CORPORATE FOOTER ================== */
.login-corporate-footer {
    width: 100%;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 40px 32px 24px;
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1.2fr 1.5fr 1fr;
    gap: 32px;
    max-width: 1280px;
    margin: 0 auto;
}

.footer-col h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 14px;
    position: relative;
    padding-bottom: 6px;
}

.footer-col h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 24px;
    height: 2px;
    background: var(--accent-primary);
    border-radius: 2px;
}

.footer-col p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 14px;
}

.footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-col ul li {
    margin-bottom: 8px;
    font-size: 13px;
}

.footer-col ul li a {
    color: var(--text-secondary);
    transition: color 0.2s ease, transform 0.2s ease;
    display: inline-block;
}

.footer-col ul li a:hover {
    color: var(--accent-primary);
    transform: translateX(3px);
}

.status-live-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
    font-size: 12px;
    font-weight: 600;
}

.status-live-pill .live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}

.qr-box {
    text-align: center;
}

.qr-box img {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    background: #ffffff;
    padding: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
    display: inline-block;
    margin-top: 6px;
}

.footer-bottom {
    max-width: 1280px;
    margin: 32px auto 0;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

.footer-bottom a {
    color: var(--text-secondary);
}

.footer-bottom a:hover {
    color: var(--accent-primary);
}

.app-tag {
    font-weight: 600;
    color: var(--accent-primary);
}

@media (max-width: 992px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
}

@media (max-width: 600px) {
    .site-top-header {
        padding: 12px 16px;
    }
    .brand-logo-img {
        height: 24px;
    }
    .hdr-btn span {
        display: none;
    }
    .hdr-btn {
        padding: 8px 10px;
    }
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}


/* ================== GLOBAL THEME BUTTON ================== */
.global-theme-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: 30px;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    font-size: 14px;
    font-weight: 600;
}

.global-theme-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
    background: var(--bg-surface-hover);
    border-color: var(--accent-primary);
}

.global-theme-btn i {
    color: var(--accent-primary);
}

body.light-theme .global-theme-btn {
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

/* Today indicator line */
.today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ef4444;
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}
.today-line::before {
    content: 'HOY';
    position: absolute;
    top: -20px;
    left: -15px;
    background: #ef4444;
    color: white;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 4px;
}

/* ================== IP INDICATOR BADGES ================== */
.topbar-ip-badge {
    transition: all 0.2s ease;
    user-select: none;
    cursor: default;
}

.topbar-ip-badge:hover {
    background: rgba(59, 130, 246, 0.2) !important;
    border-color: rgba(59, 130, 246, 0.4) !important;
}

@media (max-width: 768px) {
    .topbar-ip-badge {
        font-size: 11px;
        padding: 4px 6px !important;
    }
    .topbar-ip-badge span {
        display: none;
    }
    .topbar-ip-badge::after {
        content: attr(title);
    }
}

