:root {
    --bg-dark: #0f111a;
    --bg-panel: #1a1d2d;
    --bg-glass: rgba(26, 29, 45, 0.7);
    --primary: #00d2ff;
    --primary-glow: rgba(0, 210, 255, 0.4);
    --secondary: #3a7bd5;
    --text-main: #f8f9fa;
    --text-muted: #a0a5b5;
    --accent-green: #00e676;
    --accent-warning: #ffea00;
    --accent-purple: #b388ff;
    --border-color: rgba(255, 255, 255, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
}

/* Glassmorphism utility */
.glass {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Layout */
.dashboard-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 16px 0;
    z-index: 10;
    height: 100%;
    overflow: hidden;
}

.logo {
    padding: 0 24px 20px;
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 12px;
    overflow-y: auto;
}

/* Custom Scrollbar for Sidebar Nav Menu */
.nav-menu::-webkit-scrollbar {
    width: 4px;
}

.nav-menu::-webkit-scrollbar-track {
    background: transparent;
}

.nav-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.nav-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 210, 255, 0.3);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-weight: 500;
    border-left: 4px solid transparent; /* Evita desplazamiento visual del item activo */
}

.nav-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: var(--text-main);
    background: linear-gradient(90deg, rgba(0, 210, 255, 0.1) 0%, rgba(58, 123, 213, 0.1) 100%);
    border-left: 4px solid var(--primary);
}

.nav-item i,
.nav-item svg {
    width: 26px;
    min-width: 26px;
    text-align: center;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0; /* Evita que los iconos se deformen en pantallas pequeñas */
}

.sidebar-footer {
    padding: 20px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
}

.system-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.82rem;
    color: var(--accent-green);
    background: rgba(0, 230, 118, 0.08);
    border: 1px solid rgba(0, 230, 118, 0.25);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 0 12px rgba(0, 230, 118, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    cursor: default;
}

.system-status:hover {
    background: rgba(0, 230, 118, 0.12);
    border-color: rgba(0, 230, 118, 0.4);
    box-shadow: 0 0 15px rgba(0, 230, 118, 0.2);
    transform: translateY(-1.5px);
}

.status-indicator {
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-green);
}

.pulse {
    animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
    0% { box-shadow: 0 0 8px var(--accent-green), 0 0 0 0 rgba(0, 230, 118, 0.7); }
    70% { box-shadow: 0 0 8px var(--accent-green), 0 0 0 8px rgba(0, 230, 118, 0); }
    100% { box-shadow: 0 0 8px var(--accent-green), 0 0 0 0 rgba(0, 230, 118, 0); }
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: radial-gradient(circle at top right, rgba(58, 123, 213, 0.1) 0%, transparent 40%),
                radial-gradient(circle at bottom left, rgba(0, 210, 255, 0.05) 0%, transparent 40%);
}

.top-header {
    height: 80px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: rgba(15, 17, 26, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 5;
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 16px;
    width: 300px;
}

.search-bar i {
    color: var(--text-muted);
    margin-right: 10px;
}

.search-bar input {
    background: transparent;
    border: none;
    color: var(--text-main);
    outline: none;
    width: 100%;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.action-btn {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: 0.3s;
}

.action-btn:hover {
    background: rgba(255,255,255,0.1);
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--primary);
    color: #000;
    font-size: 0.7rem;
    font-weight: bold;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--primary);
}

/* Views */
.view-section {
    display: none;
    padding: 32px;
    animation: fadeIn 0.4s ease forwards;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Banner */
.welcome-banner {
    background: linear-gradient(135deg, rgba(0, 210, 255, 0.15) 0%, rgba(58, 123, 213, 0.05) 100%);
    border: 1px solid var(--primary-glow);
    border-radius: 20px;
    padding: 32px;
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.banner-content h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    background: linear-gradient(90deg, #fff, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.banner-content p {
    color: var(--text-muted);
}

.banner-stats {
    display: flex;
    gap: 24px;
}

.b-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.b-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.b-value {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Colors */
.text-green { color: var(--accent-green); }
.text-blue { color: var(--primary); }
.text-warning { color: var(--accent-warning); }

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.kpi-card {
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 20px;
    transition: transform 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(0, 210, 255, 0.15);
}

.kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.kpi-icon.blue { background: rgba(0, 210, 255, 0.1); color: var(--primary); }
.kpi-icon.warning { background: rgba(255, 234, 0, 0.1); color: var(--accent-warning); }
.kpi-icon.purple { background: rgba(179, 136, 255, 0.1); color: var(--accent-purple); }
.kpi-icon.green { background: rgba(0, 230, 118, 0.1); color: var(--accent-green); }

.kpi-info h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 8px;
}

.kpi-metric {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.kpi-metric span {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-muted);
}

.kpi-trend {
    font-size: 0.85rem;
}

.kpi-trend.positive { color: var(--accent-green); }

/* Charts Area */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.chart-container {
    padding: 24px;
}

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

.chart-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Machine List */
.machine-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.machine-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
}

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

.m-status {
    font-size: 0.85rem;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════
   MOBILE TOPBAR (visible only on mobile)
═══════════════════════════════════════════════════ */
.mobile-topbar {
    display: none;
}

/* ═══════════════════════════════════════════════════
   MOBILE DRAWER OVERLAY
═══════════════════════════════════════════════════ */
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1998;
    backdrop-filter: blur(2px);
}
.mobile-overlay.active {
    display: block;
}

.mobile-actions-only {
    display: none;
}

/* ═══════════════════════════════════════════════════
   MOBILE RESPONSIVENESS — DRAWER PATTERN
═══════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .mobile-actions-only {
        display: block;
        padding: 15px 20px 0 20px;
        border-top: 1px solid var(--border-color);
        margin-top: auto;
    }

    /* --- Prevent ALL horizontal scroll --- */
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100vw !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body {
        overflow-y: auto;
        height: auto !important;
    }

    /* --- Main layout --- */
    .dashboard-container {
        display: block;
        height: auto;
        width: 100vw !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        margin: 0 auto;
        padding-top: 56px; /* space for fixed topbar */
    }

    /* --- Mobile top bar (fixed) --- */
    .mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        padding: 0 20px;
        background: var(--bg-panel);
        border-bottom: 1px solid var(--border-color);
        z-index: 1999;
        box-shadow: 0 2px 20px rgba(0,0,0,0.4);
    }

    .mobile-topbar .topbar-logo {
        display: flex;
        align-items: center;
        gap: 10px;
        font-weight: 700;
        font-size: 1rem;
        color: var(--primary);
    }

    .mobile-topbar .topbar-logo i {
        font-size: 1.3rem;
    }

    #mobile-hamburger-btn {
        background: rgba(255, 255, 255, 0.03) !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        color: var(--primary) !important;
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        min-height: 48px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer;
        padding: 0 !important;
        border-radius: 10px !important;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        -webkit-tap-highlight-color: transparent;
        flex-shrink: 0 !important;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    }

    #mobile-hamburger-btn svg {
        width: 24px !important;
        height: 24px !important;
        stroke: var(--primary) !important;
        display: block !important;
        transition: transform 0.2s ease;
        pointer-events: none;
    }

    #mobile-hamburger-btn:hover,
    #mobile-hamburger-btn:active,
    #mobile-hamburger-btn:focus {
        background: rgba(0, 210, 255, 0.12) !important;
        border-color: var(--primary) !important;
        box-shadow: 0 0 12px rgba(0, 210, 255, 0.25) !important;
    }

    #mobile-hamburger-btn:active svg {
        transform: scale(0.9);
    }

    /* --- Sidebar becomes a drawer --- */
    .sidebar {
        position: fixed !important;
        top: 0;
        left: -110vw;          /* fully off-screen, including border */
        width: 100% !important;
        max-width: 100vw !important;
        height: 100vh !important;
        z-index: 2000 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
        border-right: 1px solid var(--border-color);
        padding: 0 !important;
    }

    .sidebar.drawer-open {
        left: 0 !important;
        box-shadow: 4px 0 40px rgba(0,0,0,0.6);
    }

    /* Hide the old hamburger icon inside the sidebar */
    .mobile-menu-btn {
        display: none !important;
    }

    /* Sidebar logo row inside drawer */
    .logo {
        padding: 20px 20px 16px !important;
        justify-content: space-between;
        align-items: center;
        display: flex;
        border-bottom: 1px solid var(--border-color);
        margin-bottom: 8px;
    }

    /* Close X button inside drawer */
    #drawer-close-btn {
        display: none; /* Controlled dynamically */
        align-items: center !important;
        justify-content: center !important;
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        background: rgba(255, 255, 255, 0.03) !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        color: var(--text-muted) !important;
        cursor: pointer;
        padding: 0 !important;
        border-radius: 8px !important;
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }

    #drawer-close-btn svg {
        width: 20px !important;
        height: 20px !important;
        stroke: currentColor !important;
        display: block !important;
        pointer-events: none;
    }

    #drawer-close-btn:hover,
    #drawer-close-btn:active {
        color: var(--text-main) !important;
        background: rgba(255, 255, 255, 0.08) !important;
        border-color: rgba(255, 255, 255, 0.15) !important;
    }

    /* --- Nav menu inside drawer --- */
    .nav-menu {
        display: flex !important;
        flex-direction: column !important;
        padding: 4px 12px !important;
        overflow-y: auto !important;
        flex: 1 !important;
    }

    .nav-item {
        padding: 14px 16px;
        font-size: 0.95rem;
        border-radius: 8px;
        margin-bottom: 4px;
        display: flex;
        align-items: center;
        gap: 12px;
    }

    /* --- Main content area --- */
    .main-content {
        width: 100vw !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        overflow-y: auto;
        min-height: calc(100vh - 56px);
        margin: 0;
        padding: 0;
    }

    /* --- Hide desktop header on mobile (we use mobile-topbar instead) --- */
    .top-header {
        display: none !important;
    }

    /* --- Content views --- */
    .view-section {
        padding: 14px 10px;
        width: 100vw !important;
        max-width: 100vw !important;
        box-sizing: border-box;
        overflow-x: hidden;
        margin: 0 auto;
    }

    /* --- Welcome banner --- */
    .welcome-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 18px;
    }

    .banner-stats {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
    }

    .b-stat {
        align-items: flex-start;
        min-width: 120px;
    }

    /* --- Stack Grids --- */
    .charts-grid,
    .kpi-grid {
        grid-template-columns: 1fr !important;
    }

    /* --- Tables: scrollable inside container --- */
    .table-container,
    .chart-card,
    .panel-card {
        overflow-x: auto !important;
        max-width: 100% !important;
    }

    table {
        min-width: unset;
        width: 100%;
    }

    /* --- All inline fixed-width grids stack --- */
    div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    /* --- NUCLEAR: cap every element to viewport width --- */
    * {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* --- Prevent fixed-width elements from overflowing --- */
    [style*="width:"] {
        max-width: 100% !important;
    }

    [style*="min-width:"] {
        min-width: 0 !important;
        max-width: 100% !important;
    }

    /* --- Scrollable content wrappers --- */
    .view-section > div {
        max-width: 100% !important;
        overflow-x: hidden;
    }

    /* --- Legal modal tabs --- */
    .legal-modal-tabs {
        flex-direction: column;
        gap: 4px;
        padding: 6px;
    }

    .legal-tab-btn {
        padding: 8px;
        font-size: 0.8rem;
    }

    /* --- Sidebar footer hide --- */
    .sidebar-footer {
        display: none;
    }

    /* --- Login box --- */
    .login-box {
        padding: 32px 20px !important;
    }

    /* --- Modal dialog responsive sizing fixes --- */
    .legal-modal-box {
        max-height: 92vh !important;
        width: 95% !important;
    }

    .legal-modal-header {
        padding: 12px 16px !important;
    }

    .legal-modal-body {
        padding: 16px !important;
        max-height: calc(92vh - 200px) !important;
    }

    .legal-modal-footer {
        padding: 14px 16px !important;
    }

    .ai-modal-overlay {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        overflow-y: auto !important;
        padding: env(safe-area-inset-top, 45px) 10px 20px 10px !important;
    }

    .ai-modal-box {
        max-height: none !important;
        padding: 20px 16px !important;
        width: 92% !important;
        max-width: 440px !important;
        margin: auto !important; /* Flex center + scroll trick */
    }

    .ai-modal-body {
        max-height: none !important;
        overflow-y: visible !important;
        padding-right: 4px;
    }

    /* Compact form elements inside modal on mobile */
    .ai-modal-box form {
        gap: 10px !important;
    }
    .ai-modal-box form label {
        font-size: 0.78rem !important;
        margin-bottom: 3px !important;
    }
    .ai-modal-box form input,
    .ai-modal-box form select {
        padding: 8px !important;
        font-size: 16px !important; /* Prevents iOS Safari auto-zoom */
        border-radius: 5px !important;
    }
    .ai-modal-box form button[type="submit"] {
        padding: 10px !important;
        font-size: 0.9rem !important;
        margin-top: 5px !important;
    }

    .ai-modal-close-btn {
        width: 36px !important;
        height: 36px !important;
        font-size: 0.95rem !important;
    }

    /* --- Form resets for mobile --- */
    input, select, textarea, button {
        max-width: 100% !important;
    }
}

/* ═══════════════════════════════════════════════════
   LOGIN / WELCOME SCREEN
═══════════════════════════════════════════════════ */
#login-screen {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    background-image:
        radial-gradient(circle at 20% 50%, rgba(0,210,255,0.12) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(58,123,213,0.1) 0%, transparent 40%),
        radial-gradient(circle at 55% 85%, rgba(0,230,118,0.06) 0%, transparent 40%);
    transition: opacity 0.5s ease;
}
.login-box { width: 460px; max-width: 90vw; padding: 50px 44px; text-align: center; }
.login-logo-icon { font-size: 3rem; color: var(--primary); margin-bottom: 18px; display: block; animation: loginGlow 2.5s ease-in-out infinite; }
@keyframes loginGlow {
    0%,100% { text-shadow: 0 0 20px rgba(0,210,255,0.5); }
    50%     { text-shadow: 0 0 50px rgba(0,210,255,0.9), 0 0 100px rgba(0,210,255,0.2); }
}
.login-box h1 { font-size: 2rem; font-weight: 700; background: linear-gradient(90deg,#fff 30%,var(--primary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 6px; }
.login-subtitle { color: var(--text-muted); font-size: 0.8rem; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 36px; }
.login-divider { width: 50px; height: 2px; background: linear-gradient(90deg,transparent,var(--primary),transparent); margin: 0 auto 36px; }
.login-label { display: block; text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted); margin-bottom: 8px; }
.login-input { width: 100%; background: rgba(255,255,255,0.05); border: 1px solid rgba(0,210,255,0.25); color: var(--text-main); padding: 14px 18px; border-radius: 10px; font-size: 1rem; font-family: 'Inter',sans-serif; outline: none; transition: all 0.3s; margin-bottom: 22px; }
.login-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,210,255,0.1); }
.login-btn { width: 100%; background: linear-gradient(135deg,var(--primary),var(--secondary)); color: #000; border: none; padding: 16px; border-radius: 10px; font-size: 1rem; font-weight: 700; cursor: pointer; transition: all 0.3s; box-shadow: 0 4px 20px rgba(0,210,255,0.3); }
.login-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(0,210,255,0.45); }
.login-footer-note { margin-top: 28px; font-size: 0.78rem; color: var(--text-muted); display: flex; align-items: center; justify-content: center; gap: 8px; }

/* ═══════════════════════════════════════════════════
   CUSTOM MODAL SYSTEM
═══════════════════════════════════════════════════ */
.ai-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.65); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); z-index: 1500; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
.ai-modal-overlay.active { opacity: 1; pointer-events: all; }
.ai-modal-box { width: 520px; max-width: 92vw; max-height: 82vh; overflow-y: auto; padding: 32px; animation: modalSlideIn 0.3s ease forwards; }
@keyframes modalSlideIn { from { transform: translateY(24px) scale(0.96); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
.ai-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.ai-modal-icon-wrap { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.ai-modal-icon-wrap.info    { background: rgba(0,210,255,0.15);   color: var(--primary); }
.ai-modal-icon-wrap.success { background: rgba(0,230,118,0.15);   color: var(--accent-green); }
.ai-modal-icon-wrap.warning { background: rgba(255,234,0,0.15);   color: var(--accent-warning); }
.ai-modal-icon-wrap.danger  { background: rgba(255,82,82,0.15);   color: #ff5252; }
.ai-modal-icon-wrap.purple  { background: rgba(179,136,255,0.15); color: var(--accent-purple); }
.ai-modal-close-btn { width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,0.05); border: 1px solid var(--border-color); color: var(--text-muted); cursor: pointer; font-size: 0.85rem; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.ai-modal-close-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.ai-modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 14px; }
.ai-modal-body { color: var(--text-muted); font-size: 0.88rem; line-height: 1.7; margin-bottom: 22px; }
.ai-modal-body strong { color: var(--text-main); }
.modal-list { list-style: none; padding: 0; margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.modal-list li { background: rgba(255,255,255,0.03); border: 1px solid var(--border-color); border-radius: 8px; padding: 10px 14px; display: flex; align-items: flex-start; gap: 10px; color: var(--text-main); font-size: 0.85rem; }
.ai-modal-footer { display: flex; justify-content: flex-end; gap: 10px; }
.modal-btn { padding: 10px 22px; border-radius: 8px; border: none; font-weight: 600; font-size: 0.88rem; font-family: 'Inter',sans-serif; cursor: pointer; transition: all 0.2s; }
.modal-btn.primary   { background: var(--primary); color: #000; }
.modal-btn.primary:hover { opacity: 0.85; transform: translateY(-1px); }
.modal-btn.success   { background: var(--accent-green); color: #000; }
.modal-btn.danger    { background: #ff5252; color: #fff; }
.modal-btn.secondary { background: rgba(255,255,255,0.07); color: var(--text-main); border: 1px solid var(--border-color); }
.modal-btn.secondary:hover { background: rgba(255,255,255,0.13); }
#company-badge { font-size: 0.78rem; background: rgba(0,210,255,0.1); color: var(--primary); border: 1px solid rgba(0,210,255,0.2); padding: 4px 10px; border-radius: 20px; font-weight: 600; margin-right: 10px; }

/* ═══════════════════════════════════════════════════
   QUALITY CONTROL SOURCE SELECTORS
   ═══════════════════════════════════════════════════ */
.quality-source-selectors .source-btn:hover {
    background: rgba(255,255,255,0.1) !important;
    color: #fff !important;
}
.quality-source-selectors .source-btn.active {
    background: var(--primary) !important;
    color: #000 !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 12px var(--primary-glow);
}

/* ═══════════════════════════════════════════════════
   PREDICTIVE MAINTENANCE TOGGLE SWITCH
   ═══════════════════════════════════════════════════ */
.switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 18px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s;
    border-radius: 18px;
    border: 1px solid var(--border-color);
}
.slider:before {
    position: absolute;
    content: "";
    height: 10px;
    width: 10px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted);
    transition: .3s;
    border-radius: 50%;
}
.switch input:checked + .slider {
    background-color: rgba(255, 82, 82, 0.2) !important;
    border-color: #ff5252 !important;
}
.switch input:checked + .slider:before {
    transform: translateX(16px);
    background-color: #ff5252 !important;
}

/* ═══════════════════════════════════════════════════
   SMART HR MODULE STYLES
   ═══════════════════════════════════════════════════ */
#hr-cv-dropzone:hover, #hr-cv-dropzone.dragover {
    border-color: var(--accent-purple) !important;
    background: rgba(179, 136, 255, 0.08) !important;
    box-shadow: 0 0 15px rgba(179, 136, 255, 0.2);
}
#hr-candidate-tabs .tab-btn:hover {
    color: var(--text-main) !important;
    background: rgba(255, 255, 255, 0.05) !important;
}
#hr-candidate-tabs .tab-btn.active {
    background: var(--accent-purple) !important;
    color: #000 !important;
    font-weight: 700 !important;
}
.candidate-item-card {
    transition: all 0.3s ease;
}
.candidate-item-card:hover {
    background: rgba(179, 136, 255, 0.06) !important;
    border-color: rgba(179, 136, 255, 0.3) !important;
    transform: translateX(4px);
}
.candidate-item-card.selected {
    border-color: var(--accent-purple) !important;
    background: rgba(179, 136, 255, 0.08) !important;
    box-shadow: 0 0 10px rgba(179, 136, 255, 0.15);
}

/* ═══════════════════════════════════════════════════
   USER MANUAL & HELP STYLES
   ═══════════════════════════════════════════════════ */
.manual-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
}

/* Accordion */
.accordion {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.accordion-item {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-item.active {
    border-color: rgba(0, 210, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0, 210, 255, 0.05);
}

.accordion-header {
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.accordion-header:hover {
    background: rgba(255, 255, 255, 0.02);
}

.accordion-header span {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.accordion-header span i {
    color: var(--primary);
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.accordion-arrow {
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-item.active .accordion-arrow {
    transform: rotate(180deg);
    color: var(--primary);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-body {
    padding: 0 24px 24px 24px;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    padding-top: 20px;
}

.accordion-body strong {
    color: var(--text-main);
}

.accordion-body ul {
    margin-left: 20px;
    margin-top: 10px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.accordion-body li {
    line-height: 1.5;
}

.accordion-body code {
    background: rgba(255, 255, 255, 0.07);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    color: var(--primary);
    font-size: 0.85rem;
}

/* ═════════ COMPLIANCE LEGAL MODAL STYLES ═════════════════════════════════ */
.footer-links {
    margin-top: 12px;
    width: 100%;
    text-align: center;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.72rem;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.footer-links a:hover {
    color: var(--primary);
    text-shadow: 0 0 8px var(--primary-glow);
}

.legal-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 9, 15, 0.8);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.legal-modal-box {
    width: 90%;
    max-width: 680px;
    background: rgba(26, 29, 45, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.legal-modal-overlay.active .legal-modal-box {
    transform: scale(1);
}

.legal-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.legal-header-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.legal-header-icon {
    font-size: 1.3rem;
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
}

.legal-modal-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.legal-modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.legal-modal-close-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.legal-modal-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 4px;
}

.legal-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.legal-tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
}

.legal-tab-btn.active {
    color: var(--primary);
    background: rgba(0, 210, 255, 0.08);
    box-shadow: inset 0 0 8px rgba(0, 210, 255, 0.05);
}

.legal-tab-btn.warning-tab.active {
    color: var(--accent-warning);
    background: rgba(255, 234, 0, 0.08);
}

.legal-modal-body {
    padding: 24px;
    max-height: 360px;
    overflow-y: auto;
    background: rgba(15, 17, 26, 0.2);
}

/* Custom scrollbar for compliance body */
.legal-modal-body::-webkit-scrollbar {
    width: 6px;
}

.legal-modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.legal-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.legal-modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--primary-glow);
}

.legal-tab-content {
    display: none;
    flex-direction: column;
    gap: 16px;
}

.legal-tab-content.active {
    display: flex;
}

.legal-tab-content h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
}

.legal-tab-content p {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin: 0;
}

.legal-tab-content ul {
    margin: 0 0 0 20px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legal-tab-content li {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.legal-warning-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(255, 234, 0, 0.06);
    border: 1px solid rgba(255, 234, 0, 0.25);
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--accent-warning);
    font-size: 0.85rem;
    line-height: 1.5;
}

.legal-warning-alert i {
    font-size: 1.1rem;
    margin-top: 2px;
}

.legal-modal-footer {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(26, 29, 45, 0.9);
}

.legal-checkbox-container {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}

.legal-checkbox-container input[type="checkbox"] {
    margin-top: 3px;
    accent-color: var(--accent-green);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.legal-checkbox-container label {
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--text-muted);
    user-select: none;
    cursor: pointer;
}

.legal-checkbox-container label:hover {
    color: var(--text-main);
}

.legal-action-btns {
    display: flex;
    justify-content: flex-end;
}

.legal-action-btns .modal-btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.legal-action-btns .modal-btn.primary {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 12px var(--primary-glow);
}

.legal-action-btns .modal-btn.primary:hover:not(:disabled) {
    background: #fff;
    box-shadow: 0 0 18px var(--primary-glow);
}

.legal-action-btns .modal-btn.primary:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
}

.legal-action-btns .modal-btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.legal-action-btns .modal-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   CHART EXPORT & QUICK DATA TEMPLATE STYLES (OPTIONS C & D)
   ========================================================================== */
.chart-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.export-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.export-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.export-btn i {
    font-size: 0.85rem;
}

.sample-templates-container {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.sample-template-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sample-template-btn:hover {
    background: rgba(156, 39, 176, 0.1);
    border-color: rgba(156, 39, 176, 0.3);
    color: #b388ff;
    box-shadow: 0 0 10px rgba(156, 39, 176, 0.1);
}

.sample-template-btn i {
    font-size: 0.8rem;
}

/* ═══════════════════════════════════════════════════
   PREDICTIVE MAINTENANCE RESPONSIVE GRID & CARDS
   ═══════════════════════════════════════════════════ */
.maint-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 24px;
    margin-top: 20px;
}

.maint-sensor-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.sensor-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid var(--accent-green);
    transition: border-color 0.3s ease;
}

.sensor-card-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 5px;
}

.sensor-card-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.maint-actions-row {
    display: flex;
    gap: 10px;
    width: 100%;
}

@media (max-width: 768px) {
    .maint-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
}

@media (max-width: 600px) {
    .maint-sensor-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
    }

    .sensor-card {
        padding: 8px 6px !important;
    }

    .sensor-card-label {
        font-size: 0.65rem !important;
        margin-bottom: 3px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sensor-card-value {
        font-size: 0.95rem !important;
    }

    .sensor-card-value span {
        font-size: 0.6rem !important;
    }

    .maint-actions-row {
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    .maint-actions-row button {
        width: 100% !important;
        flex: none !important;
        padding: 12px !important;
        justify-content: center !important;
    }
}

/* ═══════════════════════════════════════════════════
   INTELLIGENT INVENTORY RESPONSIVE GRID & LAYOUT
   ═══════════════════════════════════════════════════ */
.inventory-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-top: 20px;
}

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

@media (max-width: 768px) {
    .inventory-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
}

@media (max-width: 600px) {
    .card-header-flex {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }
    
    .card-header-flex button {
        width: 100% !important;
        padding: 12px !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }

    /* Ajuste de tablas en móvil para evitar desbordes */
    table th, table td {
        padding: 8px 4px !important;
        font-size: 0.8rem !important;
    }

    table td span {
        font-size: 0.7rem !important;
        padding: 2px 4px !important;
    }
}

/* ═══════════════════════════════════════════════════
   FINANCE & ADMIN RESPONSIVE GRID & LAYOUT
   ═══════════════════════════════════════════════════ */
.finance-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-top: 20px;
}

.finance-kpis-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .finance-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    .finance-kpis-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    /* Tabla Finance: columnas más pequeñas y texto compacto */
    #fin-tx-table td,
    #fin-tx-table th,
    #finance table td,
    #finance table th {
        padding: 4px 2px !important; /* Más reducido para ganar espacio */
        font-size: 0.65rem !important; /* Letra un poco más pequeña */
        white-space: normal !important; /* Permitir que el texto salte de línea para que quepa en la pantalla */
        word-break: break-word;
    }

    #finance table td strong,
    #finance table td span {
        font-size: inherit !important;
    }

    /* Evitar que la tarjeta contenedora se ensanche por comportamiento Grid */
    #finance .glass {
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        padding: 10px !important; /* Reducido de 16px para dar más espacio horizontal a la tabla */
    }

    /* Contenedor responsivo explícito */
    #finance .table-responsive-container {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important; /* Restaurar scroll por si algo desborda */
        display: block !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Tabla responsiva: ajustar para que ocupe todo el ancho sin scroll */
    #finance table.responsive-table {
        width: 100% !important;
        min-width: 100% !important; /* Asegurar que use al menos todo el ancho */
        max-width: 100% !important;
        display: table !important;
        table-layout: auto !important;
    }

    /* Ocultar la columna 'Time' (4ta) en móviles para ganar espacio */
    #finance table th:nth-child(4),
    #finance table td:nth-child(4) {
        display: none !important;
    }

    /* Alert Center: altura máxima ajustada en móvil */
    #fin-alerts {
        max-height: 280px !important;
    }

    /* Banner stats en Finance apilados verticalmente */
    #finance .welcome-banner .banner-stats {
        flex-direction: column !important;
        gap: 8px !important;
    }

    /* Botón AI Audit en Finance */
    #btn-audit {
        width: 100% !important;
        padding: 10px !important;
        justify-content: center !important;
    }

    /* card-header-flex dentro de Finance debe apilar en móvil */
    #finance .card-header-flex {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }
}

/* ═══════════════════════════════════════════════════
   HUMAN RESOURCES RESPONSIVE GRID & LAYOUT
   ═══════════════════════════════════════════════════ */
.hr-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
    margin-top: 20px;
}

.hr-kpis-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 20px;
}

/* Sub-grid 2 columnas del formulario de puesto (Departamento + Años Exp) */
.hr-form-2col {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 10px;
}

/* Tabs de candidatos con scroll horizontal */
.hr-tabs-wrap {
    display: flex;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    padding: 3px;
    border-radius: 8px;
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.hr-tabs-wrap::-webkit-scrollbar {
    display: none;
}

.hr-tabs-wrap .tab-btn {
    flex-shrink: 0;
}

/* Header del AI Interview Generator */
.hr-interview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

/* ── Tarjeta contenedora de candidatos (desktop) ── */
.hr-candidates-card {
    padding: 24px;
    min-height: 380px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
}

/* ── Lista de candidatos (desktop): scroll vertical acotado ── */
.hr-candidates-list-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    max-height: 380px;
    padding-right: 4px;
    box-sizing: border-box;
}

/* El antiguo ID también mantiene sus estilos */
#hr-candidate-tabs {
    display: flex;
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

#hr-candidate-tabs::-webkit-scrollbar {
    display: none;
}

#hr-candidate-tabs .tab-btn {
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .hr-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    .hr-kpis-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    /* Formulario de puesto: cada campo ocupa su propia línea */
    .hr-form-2col {
        grid-template-columns: 1fr !important;
    }

    /* Header de candidatos: apilar título y tabs verticalmente */
    #hr-view .glass > div[style*="justify-content: space-between"],
    #hr .glass > div[style*="justify-content: space-between"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }

    /* Tabs ocupan el ancho completo */
    .hr-tabs-wrap {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Interview Generator header apila en mobile */
    .hr-interview-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }

    /* Banner stats en HR apilados */
    #hr-view .welcome-banner .banner-stats,
    #hr .welcome-banner .banner-stats {
        flex-direction: column !important;
        gap: 8px !important;
    }

    /* ─── CORRECCIÓN PRINCIPAL: quitar min-height y altura fija ─── */
    /* La tarjeta no restringe altura en móvil */
    .hr-candidates-card {
        min-height: unset !important;
        height: auto !important;
        overflow: visible !important;
        padding: 10px !important; /* Reducido para dar más espacio horizontal */
    }

    /* La lista muestra TODO el contenido sin recortar */
    .hr-candidates-list-wrap {
        max-height: none !important;
        overflow-y: visible !important;
        overflow-x: visible !important; /* Permitir que el contenido no se corte horizontalmente */
        flex: none !important;
        padding-right: 0 !important;
    }

    /* También sobreescribir por ID por si hay cache viejo */
    #hr-candidates-list {
        max-height: none !important;
        overflow-y: visible !important;
        overflow-x: visible !important; /* Permitir que el contenido no se corte horizontalmente */
    }

    /* Botón guardar puesto: ancho completo */
    #btn-hr-save-job {
        font-size: 0.8rem !important;
        padding: 10px !important;
    }
}

/* ═══════════════════════════════════════════════════
   QUALITY & DEFECT RESPONSIVE GRID & LAYOUT
   ═══════════════════════════════════════════════════ */
.quality-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-top: 20px;
}

.quality-action-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    gap: 12px;
}

@media (max-width: 768px) {
    .quality-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
}

@media (max-width: 600px) {
    .quality-action-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    .quality-action-row button {
        width: 100% !important;
        padding: 12px !important;
        justify-content: center !important;
    }

    .quality-action-row span {
        text-align: center !important;
    }
}

/* ═══════════════════════════════════════════════════
   RPA AUTOMATION RESPONSIVE GRID & LAYOUT
   ═══════════════════════════════════════════════════ */
.rpa-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 20px;
}

.rpa-kpis-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .rpa-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .rpa-kpis-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
}

/* ═══════════════════════════════════════════════════
   CUSTOMER SERVICE RESPONSIVE GRID & LAYOUT
   ═══════════════════════════════════════════════════ */
.cs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 20px;
}

.cs-kpis-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .cs-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .cs-kpis-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
}

/* ═══════════════════════════════════════════════════
   MARKETING RESPONSIVE GRID & LAYOUT
   ═══════════════════════════════════════════════════ */
.mkt-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
    margin-top: 20px;
}

.mkt-kpis-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .mkt-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .mkt-kpis-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
}

/* ═══════════════════════════════════════════════════
   DECISIONS RESPONSIVE GRID & LAYOUT
   ═══════════════════════════════════════════════════ */
.decisions-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .decisions-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
}

/* ═══════════════════════════════════════════════════
   PDF READER RESPONSIVE GRID & LAYOUT
   ═══════════════════════════════════════════════════ */
.pdf-reader-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
    margin-top: 20px;
    min-height: 520px;
}

@media (max-width: 768px) {
    .pdf-reader-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
        min-height: auto !important;
    }
}

/* ═══════════════════════════════════════════════════
   CANDIDATE CARD AND MODAL MOBILE FIXES
   ═══════════════════════════════════════════════════ */
.modal-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    font-size: 0.8rem;
    margin-top: 10px;
    margin-bottom: 10px;
}

/* ── Tarjetas de candidatos: base ── */
.candidate-item-card {
    overflow: visible !important;
    box-sizing: border-box;
    width: 100%;
}

/* Fila de botones de acción en la tarjeta */
.candidate-item-card .cand-actions-row {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
    border-top: 1px solid rgba(255,255,255,0.03);
    padding-top: 8px;
}

/* Texto de análisis de match: máximo 3 líneas en escritorio */
.candidate-item-card .cand-match-text {
    font-size: 0.78rem;
    color: #e2e8f0;
    line-height: 1.4;
    opacity: 0.85;
    border-top: 1px solid rgba(255,255,255,0.03);
    padding-top: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 768px) {
    .modal-grid-2col {
        grid-template-columns: 1fr !important;
        gap: 6px !important;
    }

    /* Tarjeta: padding más compacto */
    .candidate-item-card {
        padding: 10px 12px !important;
    }

    /* Fila nombre + score: que no se apriete */
    .candidate-item-card > div:first-child {
        gap: 6px !important;
    }

    /* Match text: mostrar completo en móvil (sin clamp) */
    .candidate-item-card .cand-match-text {
        -webkit-line-clamp: unset !important;
        display: block !important;
        font-size: 0.75rem !important;
    }

    /* Botones de acción: 2 por fila, alineados al inicio */
    .candidate-item-card .cand-actions-row {
        justify-content: flex-start !important;
        gap: 5px !important;
    }

    .candidate-item-card .cand-action-btn {
        padding: 5px 8px !important;
        font-size: 0.68rem !important;
        flex: 0 0 auto !important;
    }

    /* Nombre del candidato: no cortar */
    .candidate-item-card .cand-name-row {
        font-size: 0.85rem !important;
        flex-wrap: wrap !important;
    }

    /* Score badge: siempre visible a la derecha */
    .candidate-item-card .cand-score-col {
        flex-shrink: 0 !important;
        min-width: 52px !important;
    }

    /* Lista completa: suficiente espacio para ver todos los candidatos */
    #hr-candidates-list {
        max-height: 500px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }
}

/* Integration System Container */
.integration-system-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}
