/* SYSTEM DESIGN SYSTEM & THEME CONFIGURATION */
:root {
    color-scheme: dark;
    --font-primary: 'Inter', sans-serif;
    --font-display: 'Outfit', sans-serif;
    
    /* Dark Theme Palette (Deep Slate & Cobalt) */
    --bg-primary: #0b0f19;
    --bg-secondary: #0f172a;
    --bg-tertiary: #1e293b;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-hover-border: rgba(14, 165, 233, 0.4);
    
    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary: #f97316;
    --primary-glow: rgba(249, 115, 22, 0.25);
    --primary-hover: #ea580c;
    
    --input-bg: rgba(15, 23, 42, 0.6);
    --input-bg-focus: rgba(15, 23, 42, 0.8);
    --input-border: rgba(255, 255, 255, 0.08);
    
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.2);
    
    --warning: #f59e0b;
    --warning-glow: rgba(245, 158, 11, 0.2);
    
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.2);
    
    --purple: #a855f7;
    --purple-glow: rgba(168, 85, 247, 0.2);
    
    /* Floating Menu Speeds & Variables */
    --nav-height: 72px;
    --nav-bg: rgba(30, 41, 59, 0.75);
    --nav-bg-scrolled: rgba(15, 23, 42, 0.45);
    --nav-blur: 16px;
    --nav-blur-scrolled: 6px;
    --transition-smooth: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

body.light-theme {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-border: rgba(0, 0, 0, 0.1);
    --card-hover-border: var(--primary);
    
    --text-primary: #1e293b;
    --text-secondary: #334155;
    --text-muted: #64748b;
    
    --nav-bg: rgba(248, 250, 252, 0.9);
    --nav-bg-scrolled: rgba(255, 255, 255, 0.95);
    
    --input-bg: rgba(255, 255, 255, 0.9);
    --input-bg-focus: #ffffff;
    --input-border: rgba(0, 0, 0, 0.15);
}

/* GENERAL STYLES & RESET */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* BACKGROUND GLOW EFFECTS (Premium Aesthetic) */
.bg-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
    filter: blur(150px);
    opacity: 0.15;
    transition: var(--transition-smooth);
}
.glow-1 {
    top: -10%;
    left: -10%;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
}
.glow-2 {
    bottom: -10%;
    right: -10%;
    background: radial-gradient(circle, var(--warning) 0%, transparent 70%);
}

/* LAYOUT STRUCTURE */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-bottom: calc(var(--nav-height) + 40px); /* Space for floating navigation bar */
}

/* MAIN HEADER */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 5%;
    background: linear-gradient(to bottom, rgba(11, 15, 25, 0.8), transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    position: sticky;
    top: 0;
    z-index: 50;
}

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

.logo-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--purple) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(14, 165, 233, 0.3);
}

.logo-icon i {
    width: 22px;
    height: 22px;
    color: white;
}

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

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    100% { transform: scale(1.08); opacity: 1; }
}

.logo-text h1 {
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.1;
    background: linear-gradient(to right, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text h1 span {
    background: linear-gradient(to right, var(--primary), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.system-version {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* HEADER STATUS GROUP */
.header-status-group {
    display: flex;
    gap: 16px;
    align-items: center;
}

.empresa-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 6px 8px;
    border-radius: 12px;
}

.empresa-switcher select {
    min-width: 160px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 0.78rem;
    font-weight: 600;
}

.status-indicator-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: var(--transition-smooth);
}

.status-indicator-badge:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
}

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

.status-dot.online {
    background-color: var(--success);
    box-shadow: 0 0 10px var(--success);
}
.status-dot.online::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 50%;
    border: 1px solid var(--success);
    animation: ripple 1.5s infinite ease-out;
}

.status-dot.offline {
    background-color: var(--danger);
    box-shadow: 0 0 10px var(--danger);
}

@keyframes ripple {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(2.8); opacity: 0; }
}

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

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    object-fit: cover;
}

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

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.user-role {
    font-size: 0.7rem;
    color: var(--primary);
    font-weight: 500;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--danger-glow);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--danger);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    font-family: var(--font-primary);
    white-space: nowrap;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.22);
    color: #b91c1c;
    transform: translateY(-1px);
}

.btn-logout svg {
    width: 16px;
    height: 16px;
}

/* LOGIN PAGE */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 24px;
}

.login-card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    padding: 32px 28px;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.login-form {
    margin-bottom: 20px;
}

.login-error {
    color: #fca5a5;
    font-size: 0.82rem;
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.login-hints {
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.login-hints-title {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.login-hints ul {
    margin: 0;
    padding-left: 18px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.6;
}

.login-hints strong {
    color: var(--text-primary);
}

.form-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 16px 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-section-title:first-of-type {
    margin-top: 0;
}

@media (max-width: 768px) {
    .btn-logout-text {
        display: none;
    }

    .user-info {
        display: none;
    }
}

/* CONTENT AREA & VIEWS */
.content-area {
    padding: 16px 5%;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.app-view {
    display: none;
    animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

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

.view-header {
    margin-bottom: 28px;
}

.view-header h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.view-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

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

.kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    backdrop-filter: blur(12px);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.kpi-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 3px;
    background: transparent;
    transition: var(--transition-smooth);
}
.kpi-card:hover::before {
    background: linear-gradient(to right, var(--primary), var(--purple));
}

.kpi-icon-wrapper {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-icon-wrapper i {
    width: 24px;
    height: 24px;
}

.kpi-icon-wrapper.blue {
    background-color: rgba(14, 165, 233, 0.1);
    color: var(--primary);
}
.kpi-icon-wrapper.green {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
}
.kpi-icon-wrapper.red {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}
.kpi-icon-wrapper.purple {
    background-color: rgba(168, 85, 247, 0.1);
    color: var(--purple);
}

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

.kpi-data h3 {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kpi-value {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.2;
    margin: 2px 0;
    font-family: var(--font-display);
}

.kpi-value.alert-text {
    color: var(--danger);
    text-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
}

.kpi-trend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}
.kpi-trend.positive {
    color: var(--success);
}
.kpi-trend.positive i {
    width: 14px;
    height: 14px;
}
.kpi-trend.negative {
    color: var(--danger);
}
.kpi-trend.negative i {
    width: 14px;
    height: 14px;
}

.kpi-subtext {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* DETAILS & CHARTS GRID */
.dashboard-details-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

@media (max-width: 1024px) {
    .dashboard-details-grid {
        grid-template-columns: 1fr;
    }
}

.detail-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 24px;
    backdrop-filter: blur(12px);
    transition: var(--transition-smooth);
}

.detail-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

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

.card-title-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.card-icon {
    width: 24px;
    height: 24px;
}

.cyan-text { color: var(--primary); }
.orange-text { color: var(--warning); }
.red-text { color: var(--danger); }
.purple-text { color: var(--purple); }
.green-text { color: var(--success); }

.card-title-group h4 {
    font-size: 1.05rem;
    font-weight: 700;
}

.card-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.chart-stats {
    display: flex;
    gap: 8px;
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 600;
}
.stat-pill.download {
    background-color: rgba(14, 165, 233, 0.1);
    color: var(--primary);
    border: 1px solid rgba(14, 165, 233, 0.15);
}
.stat-pill.upload {
    background-color: rgba(168, 85, 247, 0.1);
    color: var(--purple);
    border: 1px solid rgba(168, 85, 247, 0.15);
}
.stat-pill i {
    width: 14px;
    height: 14px;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
}

/* LOG CARD */
.log-card {
    display: flex;
    flex-direction: column;
}

.live-badge {
    font-size: 0.65rem;
    font-weight: 800;
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.05em;
    animation: pulseGlow 1.5s infinite alternate;
}

@keyframes pulseGlow {
    0% { opacity: 0.6; box-shadow: 0 0 5px rgba(239, 68, 68, 0); }
    100% { opacity: 1; box-shadow: 0 0 10px rgba(239, 68, 68, 0.4); }
}

.log-container {
    flex-grow: 1;
    overflow-y: auto;
    max-height: 300px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 6px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.75rem;
}

.log-item {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.02);
    border-left: 3px solid var(--text-muted);
    padding: 8px 12px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: slideInLog 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

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

.log-item.info { border-left-color: var(--primary); }
.log-item.success { border-left-color: var(--success); }
.log-item.warning { border-left-color: var(--warning); }
.log-item.danger { border-left-color: var(--danger); }

.log-time-badge {
    color: var(--text-muted);
    font-weight: 700;
}

.log-message {
    color: var(--text-primary);
}

.log-source {
    align-self: flex-end;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* CUSTOM TOOLBAR (SEARCH + FILTERS) */
.toolbar-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 24px;
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    backdrop-filter: blur(12px);
}

.search-box {
    flex-grow: 1;
    position: relative;
    min-width: 250px;
}

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

.search-box input {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px 14px 12px 42px;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    transition: var(--transition-smooth);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
    background: rgba(15, 23, 42, 0.8);
}

.filter-actions {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.config-subtabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 18px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 6px;
    border-radius: 12px;
}

.config-subtab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 9px 14px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
}

.config-subtab-btn.active {
    background: var(--primary);
    color: white;
}

.config-tab-content {
    display: none;
    margin-bottom: 24px;
}

.config-tab-content.active {
    display: block;
}

.filter-btn {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    white-space: nowrap;
}

.filter-btn:hover {
    background: rgba(30, 41, 59, 0.8);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 12px var(--primary-glow);
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    font-family: var(--font-primary);
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition-smooth);
    white-space: nowrap;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-primary);
}
.btn-outline:hover {
    background: var(--primary-glow);
    border-color: var(--primary);
    color: var(--primary);
}
.btn-outline.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #b91c1c 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.btn-block {
    width: 100%;
}

.btn-xs {
    padding: 6px 12px;
    font-size: 0.75rem;
    border-radius: 8px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
}
.btn-xs:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* DATA TABLE STYLE */
.table-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    overflow-x: auto;
    backdrop-filter: blur(12px);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
}

.data-table th {
    padding: 16px 24px;
    background: rgba(15, 23, 42, 0.4);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table td {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

/* CUSTOMER SPECIFIC TABLE ELEMENTS */
.client-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.client-avatar-placeholder {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-family: var(--font-display);
    font-size: 0.95rem;
}

.client-name-group {
    display: flex;
    flex-direction: column;
}

.client-name-group .c-name {
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-smooth);
}
.client-name-group .c-name:hover {
    color: var(--primary);
}

.client-name-group .c-mac {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: monospace;
}

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

.contact-info .c-phone {
    font-weight: 500;
    color: var(--text-secondary);
}

.contact-info .c-address {
    font-size: 0.7rem;
    color: var(--text-muted);
}

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

.plan-info .c-ip {
    font-family: monospace;
    color: var(--text-secondary);
}

.plan-info .c-plan {
    font-size: 0.7rem;
    color: var(--primary);
    font-weight: 600;
}

/* NET STATUS BADGES */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.status-pill.status-green {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.status-pill.status-red {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.status-pill.status-yellow {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.15);
}

.status-pill.status-muted {
    background-color: rgba(100, 116, 139, 0.1);
    color: var(--text-muted);
    border: 1px solid rgba(100, 116, 139, 0.15);
}

/* OLT SIGNAL BADGES (GLOWING ACCORDING TO SIGNAL QUALITY) */
.signal-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.signal-value {
    font-size: 0.8rem;
    font-weight: 700;
    font-family: monospace;
}

.signal-value.excellent {
    color: var(--success);
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}
.signal-value.good {
    color: #a3e635; /* Lime-400 */
}
.signal-value.warning {
    color: var(--warning);
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}
.signal-value.danger {
    color: var(--danger);
    text-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
    animation: blinkGlow 1s infinite alternate;
}

@keyframes blinkGlow {
    0% { opacity: 0.7; }
    100% { opacity: 1; }
}

.signal-pon-port {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.btn-actions-cell {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    min-width: 220px;
}

/* TECHNICAL ORDERS (OT) GRID & CARD STYLE */
.ot-board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.stat-tabs {
    display: flex;
    gap: 8px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 4px;
    border-radius: 12px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

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

.tab-btn.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.ot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.ot-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    backdrop-filter: blur(12px);
    transition: var(--transition-smooth);
}

.ot-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

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

.ot-id-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
}

.ot-card-body h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.ot-customer {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 4px;
}

.ot-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.ot-meta {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.ot-tech {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--text-secondary);
}
.ot-tech i {
    width: 12px;
    height: 12px;
}

.ot-actions {
    display: flex;
    gap: 6px;
}

/* FINANCE VIEWS */
.finance-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 24px;
}

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

.finance-form-card {
    height: fit-content;
}

/* FORMS */
.app-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.form-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.app-form input, 
.app-form select, 
.app-form textarea {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.85rem;
    transition: var(--transition-smooth);
    width: 100%;
}

select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.app-form input:focus, 
.app-form select:focus, 
.app-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
    background: var(--input-bg-focus);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.total-expense-badge {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.expense-table-wrapper {
    overflow-x: auto;
    max-height: 380px;
}

.text-right { text-align: right; }
.td-danger-val { color: var(--danger); font-weight: 700; font-family: monospace; }

/* MODALS & OVERLAYS */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-smooth);
}

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

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    width: 90%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    transform: scale(0.9) translateY(20px);
    transition: var(--transition-smooth);
}

.modal-overlay.active .modal-card {
    transform: scale(1) translateY(0);
}

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

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
    width: 24px;
    height: 24px;
}
.btn-close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

/* CLIENT DIAGNOSTIC / DETAIL INFO inside Modal */
.diagnostic-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.diag-summary {
    display: flex;
    gap: 16px;
    align-items: center;
}

.diag-network-status {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
}

.diag-grid-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 14px;
}

.diag-stat-item {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 10px;
    border-radius: 10px;
    text-align: center;
}
.diag-stat-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-secondary);
}
.diag-stat-val {
    font-size: 0.95rem;
    font-weight: 700;
    font-family: monospace;
    color: var(--text-primary);
}

.payment-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.payment-history-item {
    display: flex;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.4);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
}

/* CONFIGURATION VIEW SPECIFIC */
.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

/* REPORT SCREEN SPECIFIC */
.reports-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
@media (max-width: 768px) {
    .reports-grid {
        grid-template-columns: 1fr;
    }
}

/* FLOATING NAVIGATION BAR STYLING (CRITICAL COMPONENT) */
.floating-nav-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 780px;
    height: var(--nav-height);
    background-color: var(--nav-bg);
    backdrop-filter: blur(var(--nav-blur));
    -webkit-backdrop-filter: blur(var(--nav-blur));
    border: 1px solid var(--card-border);
    border-radius: 24px;
    box-shadow: 0 12px 40px -8px rgba(0, 0, 0, 0.7), 
                0 0 0 1px rgba(255, 255, 255, 0.05);
    z-index: 999;
    display: flex;
    align-items: center;
    padding: 0 14px;
    transition: var(--transition-smooth);
}

/* Scroll Transparency state */
.floating-nav-bar.scrolled {
    background-color: var(--nav-bg-scrolled);
    backdrop-filter: blur(var(--nav-blur-scrolled));
    -webkit-backdrop-filter: blur(var(--nav-blur-scrolled));
    border-color: rgba(255, 255, 255, 0.03);
    opacity: 0.65;
    box-shadow: 0 6px 20px -8px rgba(0, 0, 0, 0.5);
    bottom: 16px;
}

/* Interactive Hover override when scrolled */
.floating-nav-bar.scrolled:hover {
    background-color: var(--nav-bg);
    backdrop-filter: blur(var(--nav-blur));
    -webkit-backdrop-filter: blur(var(--nav-blur));
    border-color: var(--card-border);
    opacity: 1;
    box-shadow: 0 12px 40px -8px rgba(0, 0, 0, 0.7);
    bottom: 24px;
}

.nav-links {
    display: flex;
    width: 100%;
    height: 100%;
    justify-content: space-between;
    align-items: center;
    list-style: none;
    position: relative;
}

.nav-item {
    position: relative;
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-item a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-secondary);
    gap: 4px;
    width: 100%;
    height: 100%;
    transition: var(--transition-smooth);
    z-index: 2;
    padding: 8px 0;
}

.nav-item a i {
    width: 22px;
    height: 22px;
    transition: var(--transition-smooth);
}

.nav-label {
    font-size: 0.7rem;
    font-weight: 700;
    transition: var(--transition-smooth);
    font-family: var(--font-display);
}

.rotate-icon {
    transition: transform 0.6s ease;
}

.nav-item:hover a {
    color: var(--text-primary);
}

.nav-item:hover a i.rotate-icon {
    transform: rotate(60deg);
}

/* Active State styling */
.nav-item.active a {
    color: var(--primary);
}

.nav-item.active a i {
    transform: translateY(-2px);
    color: var(--primary);
    filter: drop-shadow(0 0 6px var(--primary-glow));
}

/* Sliding navigation indicator */
.active-nav-indicator {
    position: absolute;
    height: 44px;
    border-radius: 14px;
    background: rgba(14, 165, 233, 0.08);
    border: 1px solid rgba(14, 165, 233, 0.15);
    z-index: 1;
    pointer-events: none;
    transition: left 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), 
                width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* RESPONSIVE LAYOUT CONSTRAINTS FOR THE BOTTOM BAR */
@media (max-width: 768px) {
    /* Hide desktop items in Mobile Bottom Navigation */
    .nav-item.desktop-only {
        display: none !important;
    }
}

@media (min-width: 769px) {
    /* Desktop layout details */
    .nav-item.desktop-only {
        display: flex !important;
    }
}

/* Location Manager Submenus & Items */
.loc-tab-btn.active {
    background: rgba(255, 255, 255, 0.08) !important;
    color: var(--primary) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.location-item-list li {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-smooth);
}

.location-item-list li:hover {
    background: rgba(30, 41, 59, 0.5);
    border-color: rgba(255, 255, 255, 0.08);
}

.btn-delete-location {
    background: transparent;
    border: none;
    color: var(--danger);
    opacity: 0.6;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-delete-location:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Dynamic Service Rows in Client Form */
.service-row {
    display: flex;
    gap: 10px;
    align-items: center;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 10px 12px;
    border-radius: 12px;
    animation: slideInLog 0.3s ease forwards;
}

.service-row select {
    flex: 1;
    background: rgba(15, 23, 42, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.btn-delete-service-row {
    background: transparent;
    border: none;
    color: var(--danger);
    opacity: 0.7;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.btn-delete-service-row:hover {
    opacity: 1;
    transform: scale(1.1);
}

.add-service-btn-container {
    margin-top: 8px;
}

/* Client Detail Modal Tabs */
.detail-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 20px;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
}
.detail-tabs::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
}
.detail-tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    padding: 10px 16px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}
.detail-tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
}
.detail-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: rgba(14, 165, 233, 0.05);
}
.detail-tab-content {
    display: none;
}
.detail-tab-content.active {
    display: block;
}

/* Timeline classes */
.timeline {
    position: relative;
    padding-left: 20px;
    margin-top: 15px;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(255, 255, 255, 0.08);
}
.timeline-item {
    position: relative;
    margin-bottom: 20px;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: -19px;
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    border: 2px solid var(--bg-secondary);
}
.timeline-item.success::before {
    background: var(--success);
    box-shadow: 0 0 8px var(--success-glow);
}
.timeline-item.info::before {
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
}
.timeline-item.warning::before {
    background: var(--warning);
    box-shadow: 0 0 8px var(--warning-glow);
}
.timeline-item.danger::before {
    background: var(--danger);
    box-shadow: 0 0 8px var(--danger-glow);
}
.timeline-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 2px;
    font-family: monospace;
}
.timeline-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}
.timeline-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Live Optical Signal graph styling */
.optical-graph-container {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 16px;
    margin-top: 15px;
}
.signal-history-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 80px;
    gap: 4px;
    margin-top: 10px;
}
.signal-history-bar {
    flex: 1;
    background: var(--primary);
    opacity: 0.7;
    border-radius: 2px 2px 0 0;
    transition: var(--transition-smooth);
    position: relative;
}
.signal-history-bar:hover {
    opacity: 1;
}
.signal-history-bar.danger {
    background: var(--danger);
}
.signal-history-bar.warning {
    background: var(--warning);
}
.signal-history-bar.success {
    background: var(--success);
}
.signal-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: #fff;
    font-size: 0.65rem;
    padding: 2px 4px;
    border-radius: 4px;
    display: none;
    pointer-events: none;
    white-space: nowrap;
    z-index: 10;
}
.signal-history-bar:hover .signal-tooltip {
    display: block;
}

/* Annulled payment & voucher styles */
.timeline-item.annulled {
    opacity: 0.65;
    border-left-color: var(--text-muted) !important;
}
.timeline-item.annulled .timeline-title {
    text-decoration: line-through;
    color: var(--text-muted);
}
.payment-annulled {
    text-decoration: line-through;
    opacity: 0.5;
}

/* MOBILE RESPONSIVE FIXES (iPhone SE / Small Phones < 500px) */
@media (max-width: 500px) {
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 16px 5%;
        gap: 12px;
    }
    
    .header-status-group {
        width: 100%;
        flex-wrap: wrap;
        justify-content: space-between;
    }
    
    .empresa-switcher select {
        min-width: 120px;
    }
    
    .user-profile {
        position: absolute;
        top: 16px;
        right: 5%;
    }

    .toolbar-card {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
    }

    .search-box {
        width: 100%;
        min-width: 100%;
    }

    .filter-actions {
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 5px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .diag-grid-stats {
        grid-template-columns: 1fr 1fr;
    }

    .ot-grid, .config-grid {
        grid-template-columns: 1fr;
    }

    .finance-grid, .reports-grid, .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .modal-card {
        width: 95%;
        padding: 0;
        margin: 10px;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 16px;
    }
    
    .modal-body {
        padding: 16px;
    }

    .floating-nav-bar {
        width: calc(100% - 16px);
        bottom: 12px;
        padding: 0 8px;
    }
    
    .nav-label {
        font-size: 0.6rem;
    }
}



/* RESPONSIVE TABLE FOR CLIENTES */
@media (max-width: 768px) {
    #clientes-table thead {
        display: none;
    }
    #clientes-table, #clientes-table tbody, #clientes-table tr, #clientes-table td {
        display: block;
        width: 100%;
    }
    #clientes-table tr {
        margin-bottom: 15px;
        border: 1px solid var(--card-border);
        border-radius: 12px;
        background: rgba(255,255,255,0.02);
        padding: 10px;
    }
    #clientes-table td {
        text-align: right;
        padding: 8px 10px;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        position: relative;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    #clientes-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        font-size: 0.7rem;
        margin-right: 15px;
    }
    #clientes-table td:last-child {
        border-bottom: none;
        flex-direction: column;
        align-items: flex-end;
    }
    #clientes-table td:last-child::before {
        display: none;
    }
    .btn-actions-cell {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
        justify-content: flex-end;
    }
    
    /* Also apply to Caja Ingresos/Egresos if needed, but they don't have data-label yet */
}
