:root {
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --glass-border: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --primary-color: #60a5fa;
    --online-color: #34d399;
    --degraded-color: #fbbf24;
    --offline-color: #f87171;
    --sidebar-bg: linear-gradient(180deg, #ffffff 0%, #f0f4ff 100%);
    --sidebar-border: #dde4f0;
    --sidebar-link-hover: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.08));
    --sidebar-link-active: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
    --sidebar-width: 260px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --primary-color: #60a5fa;
    --sidebar-bg: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    --sidebar-border: rgba(255, 255, 255, 0.05);
    --sidebar-link-hover: rgba(255, 255, 255, 0.05);
    --sidebar-link-active: rgba(99, 102, 241, 0.15);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
    display: flex;
    min-height: 100vh;
}

.glass-bg {
    position: fixed;
    top: -10%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0) 70%);
    z-index: -1;
    filter: blur(80px);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    position: fixed;
    height: 100vh;
    box-shadow: 2px 0 20px rgba(99, 102, 241, 0.06);
    overflow-y: auto; /* PERMITE EL SCROLL */
    overflow-x: hidden;
}

/* Barra de scroll personalizada con colores del logo */
.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.2); /* Sutil por defecto */
    border-radius: 10px;
    transition: var(--transition);
}
.sidebar:hover::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #6366f1 0%, #a855f7 100%); /* Colores del logo al hacer hover */
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #4f46e5 0%, #9333ea 100%); /* Más intenso al agarrarla */
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 3rem;
    cursor: pointer;
    transition: var(--transition);
}

.logo:hover .logo-icon {
    transform: rotate(15deg) scale(1.1);
    filter: brightness(1.1) drop-shadow(0 0 10px rgba(99, 102, 241, 0.4));
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo span {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #4f46e5, #9333ea);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: var(--transition);
}

.logo:hover span {
    filter: saturate(1.2);
    letter-spacing: 0px;
}

.nav-links {
    list-style: none;
    flex-grow: 1;
}

.nav-links li {
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    animation: slideInMenu 0.4s ease forwards;
    opacity: 0;
}

@keyframes slideInMenu {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Staggered animation for menu items */
.nav-links a:nth-child(1) li { animation-delay: 0.05s; }
.nav-links a:nth-child(2) li { animation-delay: 0.1s; }
.nav-links a:nth-child(3) li { animation-delay: 0.15s; }
.nav-links a:nth-child(4) li { animation-delay: 0.2s; }
.nav-links a:nth-child(5) li { animation-delay: 0.25s; }
.nav-links a:nth-child(6) li { animation-delay: 0.3s; }
.nav-links a:nth-child(n+7) li { animation-delay: 0.35s; }

.nav-links li svg {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: #94a3b8;
}

.nav-links li:hover {
    background: var(--sidebar-link-hover);
    color: #6366f1;
    transform: translateX(4px);
}

.nav-links li:hover svg {
    transform: scale(1.2);
    color: #6366f1;
}

.nav-links li.active {
    background: var(--sidebar-link-active);
    color: var(--primary-color);
    border-left: 4px solid var(--primary-color);
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.08);
}

.nav-links li.active svg {
    color: var(--primary-color);
    filter: drop-shadow(0 0 5px rgba(99, 102, 241, 0.4));
    transform: scale(1.1);
}

/* Admin links styling */
.admin-only-nav li {
    border: 1px dashed rgba(168, 85, 247, 0.2);
}

.admin-only-nav li::after {
    content: 'ADMIN';
    font-size: 0.6rem;
    background: linear-gradient(135deg, #a855f7, #ec4899);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 2rem;
    border-top: 1px solid var(--glass-border);
}

.avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    box-shadow: 0 3px 10px rgba(99, 102, 241, 0.3);
}

.info .name {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.info .role {
    font-size: 0.75rem;
    color: #8b5cf6;
}

/* Content */
.content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    padding: 2.5rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.header-title h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.header-title p {
    color: var(--text-secondary);
}

.btn {
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

/* Layout Top */
.top-dashboard {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.stat-icon svg {
    opacity: 0.9;
}

.stat-icon.online { background: #ecfdf5; border: 1px solid #a7f3d0; color: #059669; }
.stat-icon.degraded { background: #fffbeb; border: 1px solid #fde68a; color: #d97706; }
.stat-icon.offline { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }
.stat-icon.total { background: #eff6ff; border: 1px solid #bfdbfe; color: #2563eb; }

.stat-info .label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

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

/* Glass containers */
.glass {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 1.5rem;
}

.table-section {
    width: 100%;
}

.container-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.container-header h3 {
    font-weight: 600;
}

#searchOnu {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 8px 16px;
    border-radius: 10px;
    color: white;
    width: 240px;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 12px;
    border-bottom: 1px solid var(--glass-border);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.95rem;
    transition: var(--transition);
}

tbody tr {
    transition: var(--transition);
}

tbody tr:hover {
    background: var(--sidebar-link-hover);
    transform: scale(1.005);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

tbody tr:hover td {
    border-bottom-color: transparent;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.badge-online { 
    background: #ecfdf5; 
    color: #059669; 
    border: 1px solid #a7f3d0;
}
.badge-degraded { 
    background: #fffbeb; 
    color: #d97706; 
    border: 1px solid #fde68a;
}
.badge-offline { 
    background: #fef2f2; 
    color: #dc2626; 
    border: 1px solid #fecaca;
}

/* Inline ID chip used in olts.php table */
.badge {
    display: inline-block;
    background: var(--bg-color);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: .8rem;
    font-weight: 700;
    font-family: monospace;
}

/* status-badge variants for olts.php (online / offline) */
.status-badge.online  { background: #ecfdf5; color: #059669; border-color: #a7f3d0; }
.status-badge.offline { background: #fef2f2; color: #dc2626; border-color: #fecaca; }

/* Badges Grandes y Vistosos para Puertos */
.badge-status-lg {
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: var(--transition);
}

.badge-status-lg.up {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    color: #059669;
    border: 1px solid #10b981;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

.badge-status-lg.down {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #dc2626;
    border: 1px solid #ef4444;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}

.badge-status-lg.unknown {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    color: #d97706;
    border: 1px solid #f59e0b;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.2);
}

.badge-status-lg svg {
    width: 18px;
    height: 18px;
}

/* Pulsing effect for online status */
.badge-online::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #10b981;
    box-shadow: 0 0 4px #10b981;
    animation: pulse 2s infinite;
}
.badge-online { padding-left: 22px; }

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.power-value {
    font-weight: 600;
    font-family: monospace;
    background: var(--bg-color);
    padding: 4px 8px;
    border-radius: 6px;
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

/* Pagination */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1rem 0.5rem 1rem;
    border-top: 1px solid var(--glass-border);
    margin-top: 1rem;
}

#pageInfo {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.btn-page {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 6px 16px;
    font-size: 0.85rem;
}

.btn-page:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

.btn-page:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.stat-card, .glass {
    animation: fadeIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: #cbd5e1;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-color);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    width: 100%;
    max-width: 450px;
    background: var(--card-bg);
    padding: 2rem;
    animation: slideUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.close-modal {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

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

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: var(--bg-color);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-danger {
    background: #fef2f2;
    color: var(--offline-color);
    border: 1px solid #fecaca;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.btn-danger:hover {
    background: #fee2e2;
    transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .top-dashboard {
        grid-template-columns: 1fr;
    }
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    color: var(--primary-color);
    width: 45px;
    height: 45px;
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    cursor: pointer;
    backdrop-filter: blur(10px);
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }

    body {
        flex-direction: column;
    }
    
    .sidebar {
        width: 280px;
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1000;
        padding: 2rem 1.5rem;
        border-right: 1px solid var(--glass-border);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        transform: translateX(-100%); /* Escondido por defecto */
        box-shadow: 10px 0 30px rgba(0,0,0,0.1);
    }

    .sidebar.active {
        transform: translateX(0); /* Mostrar */
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        backdrop-filter: blur(4px);
        z-index: 999;
        animation: fadeIn 0.3s ease;
    }

    .sidebar-overlay.active {
        display: block;
    }
    
    .logo {
        margin-bottom: 2rem;
        justify-content: flex-start;
    }
    
    .nav-links {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .nav-links li {
        margin-bottom: 0;
        padding: 14px 16px;
        font-size: 1rem;
    }
    
    .user-profile {
        display: flex;
        padding-top: 1.5rem;
        margin-top: auto;
    }
    
    .content {
        margin-left: 0;
        padding: 1.5rem;
        padding-top: 5rem; /* Espacio para el botón flotante */
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
        border-radius: 14px;
    }

    .stat-info .value {
        font-size: 1.2rem;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }
    
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }

    .header-title h1 {
        font-size: 1.4rem;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 600px;
    }

    .glass {
        border-radius: 16px;
        padding: 1rem;
    }

    .container-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }

    #searchOnu {
        width: 100%;
    }

    /* Reports grid mobile */
    .reports-grid {
        grid-template-columns: 1fr !important;
    }

    /* Modal mobile */
    .modal-content {
        max-width: 95%;
        margin: 1rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .stat-card {
        flex-direction: row;
        padding: 0.8rem 1rem;
    }

    .header-title h1 {
        font-size: 1.2rem;
    }

    .content {
        padding: 0.75rem;
    }

    .btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
}

/* ─── PWA: Mobile hamburger toggle ────────────────────────────────────────── */
.mobile-nav-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 950;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.mobile-nav-toggle:active {
    transform: scale(0.92);
}

@media (max-width: 768px) {
    .mobile-nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .content {
        padding-top: 60px !important;
    }
}

/* ─── PWA: Install banner ─────────────────────────────────────────────────── */
#pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border-top: 1px solid rgba(96, 165, 250, 0.3);
    padding: 12px 16px;
    animation: slideUpBanner 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3);
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
    color: #e2e8f0;
    font-size: 0.9rem;
}

.pwa-banner-content span {
    flex: 1;
}

#pwa-install-btn {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

#pwa-install-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
}

#pwa-dismiss-btn {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

#pwa-dismiss-btn:hover {
    color: #f8fafc;
}

@keyframes slideUpBanner {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

/* ─── PWA: Offline indicator ──────────────────────────────────────────────── */
.online-indicator {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9998;
    text-align: center;
    padding: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.online-indicator.offline {
    display: block;
    background: linear-gradient(90deg, #f97316, #dc2626);
    color: white;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to   { transform: translateY(0); }
}

/* ─── PWA: iOS safe areas ─────────────────────────────────────────────────── */
@supports (padding-top: env(safe-area-inset-top)) {
    .sidebar {
        padding-top: calc(1rem + env(safe-area-inset-top));
    }
    .mobile-nav-toggle {
        top: calc(12px + env(safe-area-inset-top));
    }
    #pwa-install-banner {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
}

/* ─── PWA: Touch-friendly enhancements ────────────────────────────────────── */
@media (pointer: coarse) {
    .btn, .btn-page, .btn-primary, .btn-danger,
    .btn-generate, .btn-trigger, .btn-view, .btn-del, .btn-dl {
        min-height: 44px;
        min-width: 44px;
    }

    .nav-links li {
        min-height: 48px;
    }

    td, th {
        padding: 12px 8px;
    }
}

/* ─── PWA: Standalone mode tweaks ─────────────────────────────────────────── */
@media (display-mode: standalone) {
    .content {
        padding-top: env(safe-area-inset-top, 0px);
    }
}

/* ─── DESIGN PHASE 1: Skeletons & Interactions ────────────────────────────── */

.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite linear;
    border-radius: 8px;
    display: inline-block;
    min-height: 1em;
    width: 100%;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text { height: 14px; margin-bottom: 8px; border-radius: 4px; }
.skeleton-title { height: 24px; margin-bottom: 12px; width: 60%; }
.skeleton-circle { width: 40px; height: 40px; border-radius: 50%; }

/* Micro-interactions */
.btn, .nav-links li, .stat-card, .glass {
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.96);
}

.nav-links li:active {
    transform: scale(0.98);
}

/* Scroll smoothness */
html {
    scroll-behavior: smooth;
}

/* Chart loading state */
.chart-loading {
    position: relative;
    overflow: hidden;
}

.chart-loading::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent 25%, rgba(255,255,255,0.4) 50%, transparent 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite linear;
}

/* OLT Proactive Panel */
.olt-panel {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05);
}

.olt-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.03));
}

.olt-selector-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.olt-selector-wrap label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.olt-select {
    background: var(--bg-color);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 8px 16px;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    min-width: 200px;
}

.olt-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

.olt-metrics-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
}

.olt-metric-box {
    flex: 1;
    min-width: 150px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    border-right: 1px solid var(--glass-border);
    transition: var(--transition);
}

.olt-metric-box:last-child {
    border-right: none;
}

.olt-metric-box:hover {
    background: rgba(99, 102, 241, 0.02);
}

.olt-metric-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
}

.olt-metric-info .label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.olt-metric-info .value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.olt-status-pill {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.olt-status-pill.online {
    background: rgba(52, 211, 153, 0.1);
    color: #059669;
}

.olt-status-pill.offline {
    background: rgba(248, 113, 113, 0.1);
    color: #dc2626;
}

.port-bars-container {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.port-bar {
    width: 12px;
    height: 24px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}

.port-bar:hover {
    transform: scaleY(1.2);
    filter: brightness(1.1);
}
