/* ========================================
   CSS DESIGN SYSTEM — NetMonitor
   Modern SaaS UI (Indigo + Dark Sidebar)
   ======================================== */

/* ========================================
   CSS CUSTOM PROPERTIES
   ======================================== */

:root {
    /* Primary — Indigo */
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-300: #a5b4fc;
    --primary-400: #818cf8;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;

    /* Semantic */
    --success: #10b981;
    --success-light: #d1fae5;
    --success-dark: #065f46;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --danger-dark: #991b1b;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --warning-dark: #92400e;
    --info: #3b82f6;
    --info-light: #dbeafe;
    --info-dark: #1e40af;

    /* Sidebar */
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-text-hover: #e2e8f0;
    --sidebar-active-bg: rgba(99, 102, 241, 0.15);
    --sidebar-active-text: #818cf8;
    --sidebar-border: #1e293b;

    /* Surfaces */
    --surface: #ffffff;
    --surface-hover: #f8fafc;
    --page-bg: #f1f5f9;
    --border: #e2e8f0;
    --border-light: #f1f5f9;

    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);

    /* Radii */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Spacing */
    --sidebar-width: 260px;
}

/* ========================================
   RESET & BASE
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background-color: var(--page-bg);
    color: var(--text-primary);
    font-size: 0.9375rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   LOGIN PAGE
   ======================================== */

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--sidebar-bg);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 40%);
    pointer-events: none;
}

.login-card {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.login-brand {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.login-brand-logo {
    width: 280px;
    max-width: 80%;
    height: auto;
    object-fit: contain;
    background: #ffffff;
    border-radius: 16px;
    padding: 1rem 1.5rem;
}

.login-brand-text {
    text-align: center;
}

.login-brand-text p {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 0;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 500;
}

.login-form {
    background: var(--surface);
    padding: 2rem 2.5rem 2.5rem;
}

.login-form h2 {
    text-align: center;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.15rem;
    letter-spacing: -0.3px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 1.75rem;
}

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

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-family: var(--font-sans);
    background: var(--surface);
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

button {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: var(--primary-500);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}

button:hover {
    background: var(--primary-600);
    box-shadow: var(--shadow-md);
}

button:active {
    transform: translateY(1px);
}

.error-message {
    background: var(--danger-light);
    color: var(--danger-dark);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    border: 1px solid #fecaca;
    font-size: 0.875rem;
    line-height: 1.6;
}

.error-message strong {
    display: block;
    margin-bottom: 0.5rem;
}

.success-message {
    background: var(--success-light);
    color: var(--success-dark);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    border: 1px solid #a7f3d0;
    font-size: 0.875rem;
}

/* ========================================
   DASHBOARD LAYOUT
   ======================================== */

.dashboard-container {
    display: flex;
    min-height: 100vh;
    background: var(--page-bg);
}

/* ========================================
   SIDEBAR — Dark Theme
   ======================================== */

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    border-right: 1px solid var(--sidebar-border);
}

.sidebar-header {
    padding: 1.25rem 1.25rem;
    border-bottom: 1px solid var(--sidebar-border);
}

.logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.logo-img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    object-fit: contain;
}

.logo-text {
    font-size: 1.125rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.logo svg {
    color: var(--primary-400);
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.15s ease;
    font-weight: 500;
    font-size: 0.875rem;
    border-left: 3px solid transparent;
    margin: 2px 0;
}

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

.nav-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    border-left-color: var(--primary-500);
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.75;
}

.sidebar-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--sidebar-border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary-500), var(--primary-400));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    font-size: 0.8125rem;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--sidebar-text);
}

.logout-link {
    display: block;
    text-align: center;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 0.15s;
}

.logout-link:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

/* Sidebar mobile toggle button */
.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 1002;
    background: var(--sidebar-bg);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.5rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    box-shadow: var(--shadow-lg);
}

.sidebar-toggle svg {
    display: block;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(2px);
}

/* Prevent body scroll when sidebar is open on mobile */
body.sidebar-open {
    overflow: hidden;
}

/* ========================================
   MAIN CONTENT
   ======================================== */

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    background: var(--page-bg);
}

.top-bar {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1.25rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.25px;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.search-box {
    position: relative;
}

.search-box input {
    padding: 0.5rem 1rem 0.5rem 2.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    width: 260px;
    font-size: 0.875rem;
    font-family: var(--font-sans);
    background: var(--surface);
    transition: all 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    width: 320px;
}

.search-box::before {
    content: '';
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
    pointer-events: none;
}

/* ========================================
   STATS CONTAINER
   ======================================== */

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    padding: 1.5rem 2rem;
}

.stat-box {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--border);
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.stat-box:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.75;
}

.stat-icon-primary {
    background: var(--primary-50);
    color: var(--primary-500);
}

.stat-icon-success {
    background: var(--success-light);
    color: var(--success);
}

.stat-icon-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 0.125rem;
    font-weight: 500;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

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

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

/* ========================================
   CONTENT SECTION
   ======================================== */

.content-section {
    padding: 1.5rem 2rem 2rem;
}

.section-header {
    margin-bottom: 1.25rem;
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* ========================================
   CLIENT CARDS
   ======================================== */

.clients-grid-modern {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
}

.client-card-modern {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.client-card-modern:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.card-online {
    border-left: 4px solid var(--success);
}

.card-offline {
    border-left: 4px solid var(--danger);
}

.card-header-modern {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

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

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.025em;
}

.badge-online {
    background: var(--success-light);
    color: var(--success-dark);
}

.badge-offline {
    background: var(--danger-light);
    color: var(--danger-dark);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.card-body-modern {
    padding: 1.25rem 1.5rem;
}

.wan-status-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.wan-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--page-bg);
    border-radius: var(--radius-md);
}

.wan-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.wan-icon {
    display: flex;
    align-items: center;
    color: var(--text-muted);
}

.wan-icon svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.wan-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.indicator-up {
    background: var(--success-light);
    color: var(--success-dark);
}

.indicator-down {
    background: var(--danger-light);
    color: var(--danger-dark);
}

.indicator-warning {
    background: var(--warning-light);
    color: var(--warning-dark);
}

.indicator-na {
    background: var(--page-bg);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-style: italic;
}

.indicator-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Card Actions */
.card-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 0.625rem;
    justify-content: center;
}

.btn-action {
    flex: 1;
    padding: 0.5rem 1rem;
    text-align: center;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}

.btn-action svg {
    width: 14px;
    height: 14px;
    stroke-width: 2;
}

.btn-edit {
    background: var(--primary-500);
    color: white;
}

.btn-edit:hover {
    background: var(--primary-600);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-network {
    background: var(--success);
    color: white;
}

.btn-network:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* ========================================
   FORMS — Register / Edit Pages
   ======================================== */

.dashboard {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.form-container {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.form-header {
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 2px solid var(--border-light);
}

.form-header h2 {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
    letter-spacing: -0.25px;
}

.form-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0;
}

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-light);
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h3 {
    color: var(--primary-500);
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-100);
    font-size: 1rem;
    font-weight: 600;
}

.client-form .form-group {
    margin-bottom: 1.25rem;
}

.client-form label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.client-form input,
.client-form select,
.client-form textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-family: var(--font-sans);
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--surface);
    color: var(--text-primary);
}

.client-form input:focus,
.client-form select:focus,
.client-form textarea:focus {
    border-color: var(--primary-500);
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.client-form textarea {
    min-height: 80px;
    resize: vertical;
}

.btn-primary {
    background: var(--primary-500);
    color: white;
    padding: 0.875rem 2rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.15s;
    font-family: var(--font-sans);
}

.btn-primary:hover {
    background: var(--primary-600);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--page-bg);
    color: var(--text-secondary);
    padding: 0.625rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font-sans);
    transition: all 0.15s;
    width: auto;
}

.btn-secondary:hover {
    background: var(--border);
    color: var(--text-primary);
}

.logout-btn {
    background: var(--danger);
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: white;
    border-radius: var(--radius-md);
    width: auto;
}

.logout-btn:hover {
    background: #dc2626;
}

/* ========================================
   FORM UTILITIES — Absorbed inline styles
   ======================================== */

.form-description {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.form-hint {
    display: block;
    color: var(--text-muted);
    font-size: 0.8125rem;
    margin-top: 0.375rem;
}

.form-hint a {
    color: var(--primary-500);
    text-decoration: none;
}

.form-hint a:hover {
    text-decoration: underline;
}

/* Toggle label (checkbox + label inline) */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
}

.toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-500);
    cursor: pointer;
}

/* Form row (side-by-side fields) */
.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

/* VPN Pool Info Box */
.vpn-pool-info {
    background: var(--page-bg);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    border-left: 4px solid var(--info);
}

.vpn-pool-info strong {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.vpn-pool-info .pool-details {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.375rem;
}

/* Script Actions */
.script-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* Text color utilities */
.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

/* Config Summary Box */
.config-summary {
    background: var(--page-bg);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.75;
}

.config-summary p {
    margin: 0.25rem 0;
}

.config-summary strong {
    color: var(--text-primary);
}

/* Table empty state */
.table-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* Script container */
.script-container {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--page-bg);
    border-radius: var(--radius-md);
}

.script-container h3 {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.script-container p {
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.script-code {
    width: 100%;
    height: 300px;
    padding: 1.25rem;
    background: var(--sidebar-bg);
    color: #e2e8f0;
    border: 1px solid var(--sidebar-border);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    resize: vertical;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

/* ========================================
   VPN MANAGEMENT PAGE
   ======================================== */

.vpn-header {
    background: linear-gradient(135deg, var(--primary-500) 0%, #7c3aed 100%);
    color: white;
    padding: 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
}

.vpn-header h2 {
    margin: 0 0 0.375rem 0;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: -0.25px;
}

.vpn-header h2 svg {
    width: 24px;
    height: 24px;
}

.vpn-header p {
    margin: 0;
    opacity: 0.85;
    font-size: 0.875rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--surface);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-500);
    box-shadow: var(--shadow-sm);
    border-top: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.stat-card.warning {
    border-left-color: var(--warning);
}

.stat-card.danger {
    border-left-color: var(--danger);
}

/* Clients Table */
.clients-table {
    background: var(--surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.clients-table table {
    width: 100%;
    border-collapse: collapse;
}

.clients-table th {
    background: var(--page-bg);
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
}

.clients-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
}

.clients-table tr:hover {
    background: var(--surface-hover);
}

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

.ip-badge {
    background: var(--primary-500);
    color: white;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 500;
}

.status-badge {
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 500;
}

.status-badge.online {
    background: var(--success-light);
    color: var(--success-dark);
}

.status-badge.offline {
    background: var(--danger-light);
    color: var(--danger-dark);
}

/* IP Grid */
.ip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.5rem;
    background: var(--surface);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.ip-cell {
    padding: 0.625rem;
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 0.8125rem;
    transition: all 0.15s;
    cursor: default;
    border: 2px solid transparent;
}

.ip-cell.free {
    background: var(--success-light);
    border-color: #a7f3d0;
    color: var(--success-dark);
}

.ip-cell.used {
    background: var(--primary-500);
    color: white;
    font-weight: 500;
}

.ip-cell.server {
    background: var(--sidebar-bg);
    color: white;
    font-weight: 600;
}

.ip-cell:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.ip-cell-ip {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
}

.ip-cell-label {
    font-size: 0.625rem;
    margin-top: 0.25rem;
    opacity: 0.8;
}

/* Config Box (dark) */
.config-box {
    background: var(--sidebar-bg);
    color: white;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    margin-bottom: 1.5rem;
}

.config-box h3 {
    margin-top: 0;
    color: #f1f5f9;
    font-family: var(--font-sans);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.config-box h3 svg {
    width: 18px;
    height: 18px;
}

.config-line {
    padding: 0.25rem 0;
    color: #cbd5e1;
}

.config-line strong {
    color: #93c5fd;
}

/* Legend */
.legend {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.legend-box {
    width: 18px;
    height: 18px;
    border-radius: 4px;
}

.legend-box.legend-free {
    background: var(--success-light);
    border: 2px solid #a7f3d0;
}

.legend-box.legend-used {
    background: var(--primary-500);
}

.legend-box.legend-server {
    background: var(--sidebar-bg);
}

/* ========================================
   MONITORING LOGS PAGE
   ======================================== */

.logs-container {
    background: #0f172a;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-top: 1rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid var(--sidebar-border);
}

.log-line {
    padding: 0.25rem 0;
    border-bottom: 1px solid #1e293b;
}

.log-error {
    color: #fca5a5;
}

.log-warning {
    color: #fcd34d;
}

.log-info {
    color: #6ee7b7;
}

.log-default {
    color: #94a3b8;
}

.filter-bar {
    background: var(--surface);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.filter-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.filter-group label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.filter-group select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.875rem;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.stats-mini {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-mini {
    background: var(--surface);
    padding: 1rem;
    border-radius: var(--radius-md);
    flex: 1;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.stat-mini-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

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

.stat-mini-value.error {
    color: var(--danger);
}

.stat-mini-value.warning {
    color: var(--warning);
}

.stat-mini-value.info {
    color: var(--success);
}

.no-logs {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.no-logs p {
    margin: 0.25rem 0;
}

.refresh-btn {
    margin-left: auto;
    width: auto;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.auto-refresh-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auto-refresh-checkbox input[type="checkbox"] {
    accent-color: var(--primary-500);
}

/* ========================================
   SERVER CONFIG PAGE
   ======================================== */

.config-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.config-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-light);
}

.config-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--primary-50);
    color: var(--primary-500);
    border-radius: var(--radius-md);
}

.config-icon svg {
    width: 18px;
    height: 18px;
}

.config-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
    letter-spacing: -0.25px;
}

.info-box {
    background: var(--info-light);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--info);
}

.info-box p {
    margin: 0.375rem 0;
    color: var(--info-dark);
    font-size: 0.875rem;
}

.info-box p:first-child {
    margin-top: 0;
}

.warning-box {
    background: var(--warning-light);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--warning);
}

.warning-box p {
    margin: 0.375rem 0;
    color: var(--warning-dark);
    font-size: 0.875rem;
}

.command-box {
    background: var(--sidebar-bg);
    color: #f1f5f9;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    margin: 0.75rem 0;
    position: relative;
}

.command-box code {
    color: #93c5fd;
}

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--sidebar-text);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.75rem;
    font-family: var(--font-sans);
    transition: all 0.15s;
    width: auto;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.375rem;
}

.status-indicator.configured {
    background: var(--success);
}

.status-indicator.not-configured {
    background: var(--danger);
}

.config-status-text {
    font-size: 0.8125rem;
    font-weight: 500;
}

.config-status-text.configured {
    color: var(--success);
}

.config-status-text.not-configured {
    color: var(--danger);
}

.config-section h3 {
    color: var(--text-primary);
    margin: 1.25rem 0 0.5rem;
    font-size: 0.9375rem;
}

.config-section .form-hint {
    margin-bottom: 1rem;
}

/* ========================================
   VPN MANAGEMENT — Subsection titles
   ======================================== */

.section-subtitle {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

/* ========================================
   SETUP MODE SELECTOR
   ======================================== */

.setup-mode-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.setup-mode-option {
    position: relative;
    padding: 1.25rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--surface);
    text-align: center;
}

.setup-mode-option:hover {
    border-color: var(--primary-300);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.setup-mode-option.active {
    border-color: var(--primary-500);
    background: var(--primary-50);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.setup-mode-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.setup-mode-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin: 0 auto 0.75rem;
    border-radius: var(--radius-lg);
    background: var(--page-bg);
    color: var(--text-muted);
    transition: all 0.2s;
}

.setup-mode-option.active .setup-mode-icon {
    background: var(--primary-100);
    color: var(--primary-600);
}

.setup-mode-icon svg {
    width: 24px;
    height: 24px;
    stroke-width: 1.75;
}

.setup-mode-title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.setup-mode-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.form-section.hidden {
    display: none !important;
}

/* Connection type badge on cards */
.connection-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    font-weight: 500;
    margin-top: 0.375rem;
}

.connection-badge svg {
    width: 12px;
    height: 12px;
    stroke-width: 2;
}

.connection-badge-vpn {
    background: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
}

.connection-badge-direct {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

/* Checkbox inline style for "existing API" */
.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.checkbox-inline input[type="checkbox"] {
    width: auto;
    accent-color: var(--primary-500);
}


/* ========================================
   CLIENT DETAIL PAGE
   ======================================== */

.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.detail-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.detail-header-left h2 {
    margin: 0;
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.25px;
}

.detail-header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.btn-refresh {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.625rem 1.25rem;
    background: var(--primary-500);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    font-family: var(--font-sans);
    transition: all 0.15s;
}

.btn-refresh:hover {
    background: var(--primary-600);
    box-shadow: var(--shadow-md);
}

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

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.625rem 1.25rem;
    background: var(--page-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    font-family: var(--font-sans);
    transition: all 0.15s;
}

.btn-back:hover {
    background: var(--border);
    color: var(--text-primary);
}

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

/* Detail Stats Grid */
.detail-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.detail-stat-card {
    background: var(--surface);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.detail-stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.detail-stat-icon svg {
    width: 20px;
    height: 20px;
}

.detail-stat-icon.icon-cpu {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-500);
}

.detail-stat-icon.icon-ram {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.detail-stat-icon.icon-uptime {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.detail-stat-icon.icon-version {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.detail-stat-icon.icon-board {
    background: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
}

.detail-stat-content {
    flex: 1;
    min-width: 0;
}

.detail-stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.detail-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.detail-stat-value.mono {
    font-family: var(--font-mono);
    font-size: 1.125rem;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--page-bg);
    border-radius: var(--radius-full);
    margin-top: 0.5rem;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

.progress-bar-fill.fill-cpu {
    background: var(--primary-500);
}

.progress-bar-fill.fill-ram {
    background: var(--success);
}

.progress-bar-fill.fill-high {
    background: var(--warning);
}

.progress-bar-fill.fill-critical {
    background: var(--danger);
}

/* Interfaces Table */
.interfaces-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
}

.interfaces-section-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 2px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.interfaces-section-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.interfaces-section-header svg {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.interfaces-table {
    width: 100%;
    border-collapse: collapse;
}

.interfaces-table th {
    background: var(--page-bg);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
}

.interfaces-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
    color: var(--text-primary);
}

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

.interfaces-table tr:hover {
    background: var(--surface-hover);
}

.interfaces-table .mono {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
}

.interface-up {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--success-light);
    color: var(--success-dark);
}

.interface-down {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--danger-light);
    color: var(--danger-dark);
}

.interface-up .indicator-dot,
.interface-down .indicator-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Offline Banner */
.offline-banner {
    background: var(--warning-light);
    border: 1px solid var(--warning);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--warning-dark);
    font-size: 0.875rem;
    font-weight: 500;
}

.offline-banner svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Detail Button on Dashboard Cards */
.btn-detail {
    background: var(--info);
    color: white;
}

.btn-detail:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* ========================================
   TRAFFIC CHART — Real-time monitoring
   ======================================== */

.traffic-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-top: 1.5rem;
}

.traffic-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    flex-wrap: wrap;
}

.traffic-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    color: var(--text-primary);
    min-width: 200px;
    cursor: pointer;
}

.traffic-select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn-traffic {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.15s;
}

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

.btn-traffic-start {
    background: var(--success);
    color: white;
}

.btn-traffic-start:hover:not(:disabled) {
    background: #059669;
}

.btn-traffic-stop {
    background: var(--danger);
    color: white;
}

.btn-traffic-stop:hover {
    background: #dc2626;
}

.traffic-live-stats {
    display: flex;
    gap: 1.5rem;
    padding: 0 1.5rem 1rem;
}

.traffic-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
}

.traffic-stat-tx {
    background: rgba(59, 130, 246, 0.08);
}

.traffic-stat-rx {
    background: rgba(16, 185, 129, 0.08);
}

.traffic-stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.traffic-stat-tx .traffic-stat-label {
    color: #3b82f6;
}

.traffic-stat-rx .traffic-stat-label {
    color: #10b981;
}

.traffic-stat-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.traffic-chart-container {
    padding: 0.5rem 1.5rem 1.5rem;
    height: 300px;
}

.traffic-error {
    padding: 0.75rem 1.5rem;
    margin: 0 1.5rem 1rem;
    background: var(--danger-light);
    color: var(--danger-dark);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    border-left: 4px solid var(--danger);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* --- iOS safe area for sidebar footer --- */
.sidebar-footer {
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
}

/* --- Table scroll wrapper --- */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* --- 3.1 Tablet landscape / laptop pequeno (max-width: 1024px) --- */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 220px;
    }

    .clients-grid-modern {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }

    .interfaces-table th,
    .interfaces-table td {
        font-size: 0.8125rem;
        padding: 0.625rem 0.75rem;
    }

    .detail-stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
}

/* --- 3.2 Tablet portrait / iPad (max-width: 768px) --- */
@media (max-width: 768px) {
    /* Sidebar: oculta por defecto */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1001;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: flex;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Main content: ancho completo */
    .main-content {
        margin-left: 0;
    }

    /* Top bar — dejar espacio para hamburguesa */
    .top-bar {
        padding: 0.875rem 1rem;
        padding-left: 4rem;
        min-height: 56px;
    }

    /* Grid de cards */
    .clients-grid-modern {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    /* Stats */
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
        padding: 1rem;
    }

    .stats-mini {
        flex-wrap: wrap;
    }

    .stat-mini {
        min-width: calc(50% - 0.5rem);
    }

    /* Content section */
    .content-section {
        padding: 1rem;
    }

    /* Search */
    .search-box input {
        width: 180px;
    }

    .search-box input:focus {
        width: 220px;
    }

    /* Formularios: campos full-width */
    .form-group {
        width: 100%;
    }

    .setup-mode-selector {
        grid-template-columns: 1fr;
    }

    /* Tables: scroll horizontal */
    .interfaces-section {
        overflow: visible;
    }

    .interfaces-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Detail page */
    .detail-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .detail-header-actions {
        width: 100%;
    }

    .detail-header-actions .btn-refresh,
    .detail-header-actions .btn-back {
        flex: 1;
    }

    /* Traffic chart */
    .traffic-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .traffic-select {
        min-width: 100%;
    }

    .traffic-live-stats {
        flex-wrap: wrap;
    }

    /* Config section */
    .config-section {
        padding: 1.25rem;
    }

    /* Filter bar */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        width: 100%;
    }

    .filter-group select {
        flex: 1;
    }

    .refresh-btn {
        margin-left: 0;
        width: 100%;
    }
}

/* --- 3.3 iPhone landscape / movil grande (max-width: 576px) --- */
@media (max-width: 576px) {
    .page-title {
        font-size: 1.2rem;
    }

    .top-bar {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
        padding: 0.875rem 1rem;
        padding-left: 4rem;
        min-height: 56px;
    }

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

    .search-box input:focus {
        width: 100%;
    }

    /* Stats cards: 2 columnas */
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .stats-mini {
        flex-direction: column;
    }

    /* Client cards */
    .clients-grid-modern {
        grid-template-columns: 1fr;
    }

    .client-card-modern {
        border-radius: var(--radius-md);
    }

    .card-body-modern {
        padding: 1rem;
    }

    /* Config */
    .config-section {
        padding: 1rem;
    }

    .config-header h2 {
        font-size: 1.0625rem;
    }

    /* Buttons full-width en formularios */
    .btn-primary,
    .form-section .btn-primary {
        width: 100%;
    }

    /* Command box */
    .command-box code {
        font-size: 0.75rem;
        word-break: break-all;
    }

    /* Login page responsive */
    .login-container {
        padding: 1rem;
    }

    .login-card {
        max-width: 100%;
    }

    .login-brand {
        padding: 2rem 1.5rem;
    }

    .login-brand-logo {
        width: 220px;
    }

    .login-form {
        padding: 1.5rem;
    }

    /* IP grid */
    .ip-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    }

    /* Traffic chart */
    .traffic-chart-container {
        height: 220px;
        padding: 0.5rem 1rem 1rem;
    }

    .traffic-live-stats {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0 1rem 0.75rem;
    }

    /* Detail page — client_detail.php */
    .detail-header {
        padding: 1rem;
        gap: 0.75rem;
    }

    .detail-header-left h2 {
        font-size: 1.125rem;
    }

    .detail-header-left {
        gap: 0.5rem;
    }

    .detail-header-actions {
        flex-direction: column;
        width: 100%;
    }

    .detail-header-actions .btn-back,
    .detail-header-actions .btn-refresh {
        width: 100%;
        justify-content: center;
        padding: 0.75rem 1rem;
    }

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

    .detail-stat-card {
        padding: 0.875rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .detail-stat-icon {
        width: 32px;
        height: 32px;
    }

    .detail-stat-icon svg {
        width: 16px;
        height: 16px;
    }

    .detail-stat-value {
        font-size: 1rem;
    }

    .detail-stat-value.mono {
        font-size: 0.875rem;
        word-break: break-all;
    }

    .detail-stat-label {
        font-size: 0.6875rem;
    }

    /* Interfaces table responsive */
    .interfaces-section-header {
        padding: 1rem;
        flex-wrap: wrap;
    }

    .interfaces-section-header h3 {
        font-size: 0.9375rem;
    }

    .interfaces-table th,
    .interfaces-table td {
        padding: 0.5rem 0.625rem;
        font-size: 0.75rem;
        white-space: nowrap;
    }

    /* Offline banner */
    .offline-banner {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
        font-size: 0.8125rem;
    }

    /* Traffic section */
    .traffic-controls {
        padding: 0.75rem 1rem;
    }

    .btn-traffic {
        width: 100%;
        justify-content: center;
    }

    /* Modal — bottom sheet en movil */
    .modal-overlay {
        align-items: flex-end;
    }

    .modal-content {
        border-radius: 1rem 1rem 0 0;
        max-height: 85vh;
        width: 100%;
        max-width: 100%;
        overflow-y: auto;
        padding-bottom: calc(2rem + env(safe-area-inset-bottom));
        animation: slideUp 0.3s ease;
    }

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

/* --- 3.4 iPhone portrait (max-width: 390px) --- */
@media (max-width: 390px) {
    .stats-container {
        grid-template-columns: 1fr;
    }

    .page-title {
        font-size: 1rem;
    }

    .content-section {
        padding: 0.75rem;
    }

    .card-body-modern {
        padding: 0.75rem;
    }

    .wan-item {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }

    .card-actions {
        flex-direction: column;
    }

    .card-actions .btn-sm {
        width: 100%;
        justify-content: center;
    }

    .form-hint {
        font-size: 0.75rem;
    }

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

    .detail-header-actions {
        flex-direction: column;
    }

    .detail-header-actions .btn-refresh,
    .detail-header-actions .btn-back {
        width: 100%;
        justify-content: center;
    }

    .top-bar {
        padding-left: 3.5rem;
    }

    .config-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    /* Setup mode cards smaller */
    .setup-mode-option {
        padding: 1rem;
    }

    .setup-mode-icon {
        width: 40px;
        height: 40px;
    }

    .setup-mode-title {
        font-size: 0.8125rem;
    }

    .setup-mode-desc {
        font-size: 0.75rem;
    }
}

/* ========================================
   MODAL
   ======================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-primary);
}

.modal-content h3 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 1.125rem;
}

.modal-content .form-group {
    margin-bottom: 1rem;
}

.modal-content .form-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.modal-content .form-group input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-sizing: border-box;
}

.modal-content .form-group input:focus {
    outline: none;
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ======================================
   SEMÁFORO (Client Dashboard)
   ====================================== */

.semaphore-container {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.semaphore {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem 0.75rem;
    background: #1e293b;
    border-radius: 2rem;
}

.semaphore-light {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.semaphore-red {
    background: #4a1c1c;
}
.semaphore-yellow {
    background: #4a3f1c;
}
.semaphore-green {
    background: #1c4a2a;
}

.semaphore-red.active {
    background: #ef4444;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.6), 0 0 40px rgba(239, 68, 68, 0.3);
    animation: glow-red 2s ease-in-out infinite alternate;
}

.semaphore-yellow.active {
    background: #f59e0b;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.6), 0 0 40px rgba(245, 158, 11, 0.3);
    animation: glow-yellow 2s ease-in-out infinite alternate;
}

.semaphore-green.active {
    background: #10b981;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.6), 0 0 40px rgba(16, 185, 129, 0.3);
    animation: glow-green 2s ease-in-out infinite alternate;
}

@keyframes glow-red {
    from { box-shadow: 0 0 15px rgba(239, 68, 68, 0.4); }
    to   { box-shadow: 0 0 25px rgba(239, 68, 68, 0.7), 0 0 50px rgba(239, 68, 68, 0.3); }
}
@keyframes glow-yellow {
    from { box-shadow: 0 0 15px rgba(245, 158, 11, 0.4); }
    to   { box-shadow: 0 0 25px rgba(245, 158, 11, 0.7), 0 0 50px rgba(245, 158, 11, 0.3); }
}
@keyframes glow-green {
    from { box-shadow: 0 0 15px rgba(16, 185, 129, 0.4); }
    to   { box-shadow: 0 0 25px rgba(16, 185, 129, 0.7), 0 0 50px rgba(16, 185, 129, 0.3); }
}

.semaphore-label {
    flex: 1;
}

.semaphore-text-green {
    font-size: 1.5rem;
    font-weight: 700;
    color: #10b981;
}
.semaphore-text-yellow {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f59e0b;
}
.semaphore-text-red {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ef4444;
}

.semaphore-desc {
    margin: 0.25rem 0 0;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

/* ======================================
   CLIENT SIMPLIFIED CARDS
   ====================================== */

.client-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.client-simple-card {
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 1.25rem;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
}

.client-card-green {
    border-left-color: #10b981;
}
.client-card-yellow {
    border-left-color: #f59e0b;
}
.client-card-red {
    border-left-color: #ef4444;
}

.client-simple-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.client-simple-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.client-simple-status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
}

.client-status-online {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}
.client-status-backup {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}
.client-status-offline {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.status-dot-online,
.status-dot-backup,
.status-dot-offline {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot-online { background: #10b981; animation: pulse-green 2s infinite; }
.status-dot-backup { background: #f59e0b; animation: pulse-yellow 2s infinite; }
.status-dot-offline { background: #ef4444; animation: pulse-red 2s infinite; }

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}
@keyframes pulse-yellow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
}
@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

/* Provider status rows */
.provider-status-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding: 0.5rem 0;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid var(--border);
}

.provider-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
}

.provider-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.provider-dot.provider-up { background: #10b981; }
.provider-dot.provider-down { background: #ef4444; }

.provider-name {
    font-weight: 600;
    color: var(--text-primary);
}

.provider-tag {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.provider-state {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
}

.provider-state-up {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.provider-state-down {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.client-status-no-redundancy {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.status-dot-no-redundancy {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    background: #f59e0b;
    animation: pulse-yellow 2s infinite;
}

.client-simple-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.client-simple-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metric-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.metric-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.client-simple-uptime-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.uptime-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.uptime-excellent { background: #10b981; }
.uptime-good { background: #f59e0b; }
.uptime-poor { background: #ef4444; }

.client-simple-lastcheck {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
}

/* Router Stats inside client cards */
.router-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.375rem 1rem;
    padding: 0.625rem 0;
    border-top: 1px solid var(--border);
    margin-top: 0.375rem;
}

.router-stat {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.router-stat svg {
    flex-shrink: 0;
    opacity: 0.5;
}

.router-stat-label {
    white-space: nowrap;
}

.router-stat-value {
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
}

.router-stat-value.stat-ok { color: #10b981; }
.router-stat-value.stat-warning { color: #f59e0b; }
.router-stat-value.stat-danger { color: #ef4444; }

.last-update-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* ======================================
   CLIENT EVENTS LIST
   ====================================== */

.client-events-section {
    margin-top: 1rem;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
}

.client-events-list {
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.client-event-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.client-event-item:last-child {
    border-bottom: none;
}

.client-event-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.client-event-dot.badge-severity-critical { background: #ef4444; }
.client-event-dot.badge-severity-warning { background: #f59e0b; }
.client-event-dot.badge-severity-info { background: #3b82f6; }

.client-event-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.client-event-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.client-event-branch {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.client-event-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ======================================
   EVENT HISTORY TABLE (Admin)
   ====================================== */

.event-table-container {
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.event-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.event-table thead {
    background: #f8fafc;
}

.event-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.event-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.event-table tbody tr:hover {
    background: #f8fafc;
}

.event-date {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.event-client {
    display: block;
    font-weight: 500;
}

.event-branch {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Event type badges */
.badge-event-type {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.badge-event-router_offline,
.badge-event-wan_primary_down {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.badge-event-router_online,
.badge-event-wan_primary_up,
.badge-event-wan_backup_up,
.badge-event-failover_to_primary {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.badge-event-wan_backup_down,
.badge-event-failover_to_backup,
.badge-event-backup_down_no_redundancy {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

/* Severity badges */
.badge-severity-critical {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.badge-severity-warning {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.badge-severity-info {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

/* Status badges */
.badge-open {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.badge-resolved {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.text-warning {
    color: #f59e0b;
    font-weight: 500;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
}

.pagination-link {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--primary-500);
    background: rgba(99, 102, 241, 0.05);
    text-decoration: none;
    transition: background 0.15s;
}

.pagination-link:hover {
    background: rgba(99, 102, 241, 0.1);
}

.pagination-info {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* ======================================
   SLA REPORT KPI CARDS
   ====================================== */

.sla-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.sla-kpi-card {
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 1.25rem;
    text-align: center;
}

.sla-kpi-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

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

.sla-kpi-value.kpi-excellent { color: #10b981; }
.sla-kpi-value.kpi-good { color: #f59e0b; }
.sla-kpi-value.kpi-poor { color: #ef4444; }

.sla-uptime-progress {
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.sla-uptime-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.6s ease;
}

.sla-uptime-bar.uptime-excellent { background: linear-gradient(90deg, #10b981, #34d399); }
.sla-uptime-bar.uptime-good { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.sla-uptime-bar.uptime-poor { background: linear-gradient(90deg, #ef4444, #f87171); }

/* SLA filter bar */
.sla-filters {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.sla-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

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

.sla-filter-group select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--surface);
    color: var(--text-primary);
    min-width: 180px;
}

.sla-no-data {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 0.9375rem;
}

/* ======================================
   PROVIDER SLA CARDS
   ====================================== */

.provider-sla-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1.25rem;
}

.provider-sla-card {
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.provider-sla-header {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.provider-sla-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #10b981;
    flex-shrink: 0;
}

.provider-sla-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.provider-sla-tag {
    margin-left: auto;
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--surface);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.provider-sla-body {
    padding: 1.25rem;
}

.provider-sla-uptime {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.provider-sla-percent {
    font-size: 2.25rem;
    font-weight: 800;
    font-family: var(--font-mono);
    line-height: 1;
}

.provider-sla-uptime-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.provider-sla-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.provider-sla-stat {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.provider-sla-stat-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.provider-sla-stat-value {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.provider-sla-events {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.provider-sla-events h4 {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.provider-event-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.375rem 0;
    font-size: 0.8125rem;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.provider-event-row:last-child {
    border-bottom: none;
}

.provider-event-date {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 70px;
}

.provider-event-label {
    flex: 1;
    color: var(--text-primary);
}

.provider-event-duration {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

@media (max-width: 768px) {
    .provider-sla-grid {
        grid-template-columns: 1fr;
    }
}

/* ======================================
   RESPONSIVE ADJUSTMENTS (new components)
   ====================================== */

@media (max-width: 768px) {
    .semaphore-container {
        flex-direction: column;
        text-align: center;
    }

    .semaphore {
        flex-direction: row;
    }

    .client-cards-grid {
        grid-template-columns: 1fr;
    }

    .sla-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .sla-filters {
        flex-direction: column;
    }

    .sla-filter-group select {
        min-width: 100%;
    }

    .event-table {
        font-size: 0.75rem;
    }

    .event-table th,
    .event-table td {
        padding: 0.5rem;
    }
}

@media (max-width: 576px) {
    .sla-kpi-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   PDF DOWNLOAD BUTTON
   ======================================== */

.btn-pdf {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: var(--danger);
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    white-space: nowrap;
}

.btn-pdf:hover {
    background: var(--danger-dark);
    transform: translateY(-1px);
    color: #fff;
}

.btn-pdf svg {
    flex-shrink: 0;
}

/* ========================================
   NETWORK MAP
   ======================================== */

.custom-marker {
    background: transparent !important;
    border: none !important;
}

.leaflet-popup-content-wrapper {
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
    font-family: var(--font-sans) !important;
}

.leaflet-popup-content {
    margin: 10px 14px !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
}
