/* ==================== متغیرهای رنگ و theme اصلی ==================== */
:root {
    /* گرادیان های اصلی */
    --primary-gradient: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --info-gradient: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --danger-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --secondary-gradient: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    
    /* Glass morphism */
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-strong: rgba(255, 255, 255, 0.15);
    
    /* سایه ها */
    --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --hover-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    --button-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    
    /* متن ها */
    --text-primary: #e5e7eb;
    --text-secondary: #cbd5e1;
    --text-muted: #aeb8c6;
    --text-cream: #e5e7eb;
    --text-dark: #e2e8f0; /* Changed from dark to light gray */
    
    /* پس زمینه */
    --bg-main: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 50%, #0d1117 100%);
    --bg-dark: #000;
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-hover: rgba(255, 255, 255, 0.08);
    
    /* وضعیت ها */
    --status-success: #10b981;
    --status-warning: #f59e0b;
    --status-danger: #ef4444;
    --status-info: #06b6d4;
    --status-secondary: #94a3b8;
}

/* ==================== ریست و base styles ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: rgb(1, 1, 1);
    min-height: 100vh;
    line-height: 1.6;
    color: var(--text-primary);
    direction: rtl;
}

.dashboard-theme {
    font-family: 'Vazirmatn', sans-serif;
    --dashboard-bg: #050505;
    --dashboard-card: #141414;
    --dashboard-card-strong: #1a1a1a;
    --dashboard-border: #2a2a2a;
    --dashboard-accent: #84cc16;
    --dashboard-accent-dark: #65a30d;
    --dashboard-text: #e5e7eb;
    --dashboard-muted: #9ca3af;
}

body.loading-active {
    overflow: hidden;
}

/* ==================== Navigation ==================== */
.navbar {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    padding: 0.75rem 0;
    position: relative;
    z-index: 1100;
}

.modal-backdrop {
    z-index: 1200 !important;
}

/* Softer modal dimming with blur so the page remains visible */
.modal-backdrop,
#modalBackdrop,
#createModalBackdrop,
#renewModalBackdrop,
.peer-detail-modal-backdrop {
    background: rgba(0, 0, 0, 0.35) !important;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* ── Traffic operation segment buttons (افزایش / کاهش) ─────────────────── */
.dashboard-theme .traffic-op-group {
    display: flex;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    overflow: hidden;
}
.dashboard-theme .traffic-op-btn {
    flex: 1;
    padding: 0.38rem 0.75rem;
    background: #111;
    border: none;
    border-radius: 0;
    color: #8899aa;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}
.dashboard-theme .traffic-op-btn + .traffic-op-btn {
    border-right: 1px solid #2a2a2a;
}
.dashboard-theme .traffic-op-btn.active {
    background: var(--dashboard-accent, #6366f1);
    color: #fff;
    font-weight: 600;
}
.dashboard-theme #trafficOpAdd.active {
    background: #22c55e;
    color: #fff;
}
.dashboard-theme #trafficOpDecrease.active {
    background: #ef4444;
    color: #fff;
}
.dashboard-theme .traffic-op-btn:hover:not(.active):not(:disabled) {
    background: #1c1c1c;
    color: #e2e8f0;
}
.dashboard-theme .traffic-op-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Balance preview ─────────────────────────────────────────────────────── */
.dashboard-theme .traffic-balance-preview {
    flex-direction: column;
    gap: 0.28rem;
    margin-top: 0.55rem;
    padding: 0.5rem 0.65rem;
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 6px;
}
.dashboard-theme .tbp-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.77rem;
}
.dashboard-theme .tbp-row span:first-child {
    color: #5a6475;
}
.dashboard-theme .tbp-val {
    font-weight: 600;
    color: #cbd5e1;
    direction: ltr;
    font-variant-numeric: tabular-nums;
}
.dashboard-theme .tbp-val.tbp-up   { color: #22c55e; }
.dashboard-theme .tbp-val.tbp-down { color: #ef4444; }
/* ───────────────────────────────────────────────────────────────────────── */

/* Force input-group rows in the agent settings modals to stay on one
   line. The default Bootstrap input-group with `input-group-sm` plus our
   compact-modal width was wrapping the "Mbps" / "GB" addon to a new
   line in RTL mode. flex-wrap:nowrap + a flex:1 on the input restores
   the inline pill layout. */
.agent-settings-modal .input-group {
    flex-wrap: nowrap !important;
}
.agent-settings-modal .input-group > .form-control {
    flex: 1 1 auto !important;
    min-width: 0 !important;
}
.agent-settings-modal .input-group > .input-group-text {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
}

/* Strong blur on the agent settings modals (traffic + speed) — matches
   the look used by the peer-detail modal stack in peers.html. Tagged via
   JS (shown.bs.modal listener) so only OUR settings modals get the
   strong blur; other Bootstrap modals on the page keep the default.

   Z-index stacking: the dashboard already forces every .modal-backdrop
   to 1200 and every .modal to 1210. That means a normal Bootstrap stack
   would put the second modal's backdrop AT 1200 — below the FIRST
   modal at 1210 — so the parent modal (editAgentModal) wouldn't be
   blurred. We lift our settings modal and its backdrop above 1210 so
   the parent IS blurred and the settings modal sits on top.

       1240 — agent-settings-modal (the popup itself, fully clear)
       1230 — agent-settings-backdrop (blurs everything below 1230)
       1210 — editAgentModal (visible through the blur)
       1200 — editAgentModal's backdrop (regular dim)            */
.modal.agent-settings-modal {
    z-index: 1240 !important;
}
.modal-backdrop.agent-settings-backdrop {
    z-index: 1230 !important;
    background: rgba(8, 8, 8, 0.55) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    opacity: 1 !important;
}

/* Slightly larger labels in create modal */
#createPeerForm label {
    font-size: 13px;
}

.modal {
    z-index: 1210 !important;
}

.persian-calendar-grid {
    display: grid !important;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.25rem;
    direction: rtl;
}

.persian-calendar-grid .calendar-header {
    padding: 0.25rem 0;
    font-size: 0.75rem;
}

.persian-calendar-grid .calendar-cell {
    padding: 0.125rem;
}

.collapse {
    /* Tailwind's collapse utility conflicts with Bootstrap's class */
    visibility: visible !important;
}

.navbar .navbar-collapse {
    transition: height 0.3s ease, opacity 0.3s ease;
}

@media (min-width: 992px) {
    .navbar .navbar-collapse {
        display: flex !important;
        flex-basis: auto;
    }
}

@media (max-width: 991.98px) {
    .navbar .navbar-collapse {
        width: 100%;
        background: rgba(0, 0, 0, 0.6);
        border-radius: 0 0 12px 12px;
        padding: 0.5rem 1rem;
    }

    .navbar .collapse:not(.show) {
        display: none !important;
    }
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary) !important;
}

.nav-link {
    font-weight: 500;
    border-radius: 8px;
    margin: 0 2px;
    transition: all 0.3s ease;
    color: var(--text-secondary) !important;
}

.nav-link:hover, 
.nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary) !important;
}

.app-tabs {
    display: flex;
    gap: 0.5rem;
    margin-inline-start: 1rem;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.navbar .app-tabs {
    margin-inline-end: auto;
    margin-inline-start: 0;
}
.app-tab {
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    border: 1px solid transparent;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    font-family: 'Vazirmatn', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.app-tab.active,
.app-tab:hover {
    border-color: rgba(255, 255, 255, 0.4);
    color: var(--text-primary);
    background: rgba(34, 197, 94, 0.15);
}

/* Header profile chip (avatar + logged-in username) */
/* keep the empty/expanded collapse from stealing header slack so the chip can sit at the far edge (desktop only) */
@media (min-width: 992px) {
    .navbar.h20-navbar .navbar-collapse {
        flex-grow: 0;
        flex-basis: auto;
    }
}
.profile-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    margin-inline-start: auto;
    padding: 5px;
    padding-inline-start: 16px;
    min-height: 48px;
    border-radius: 999px;
    background: #0a0a0a;
    border: 1px solid rgba(34, 197, 94, 0.28);
    white-space: nowrap;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.profile-chip:hover {
    border-color: rgba(34, 197, 94, 0.6);
    background: rgba(34, 197, 94, 0.07);
}
.profile-chip .profile-avatar {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    color: #0a0a0a;
    font-size: 20px;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.35);
}
.profile-chip .profile-name {
    color: #e8f5ea;
    font-family: 'Vazirmatn', sans-serif;
    font-weight: 700;
    font-size: 14px;
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}
@media (max-width: 575px) {
    .profile-chip {
        min-height: 42px;
        padding-inline-end: 12px;
    }
    .profile-chip .profile-avatar { width: 32px; height: 32px; font-size: 17px; }
    .profile-chip .profile-name { max-width: 110px; font-size: 13px; }
}

/* Desktop header style (h.html pattern) */
@media (min-width: 992px) {
    .navbar.h20-navbar {
        background: #0a0a0a !important;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border-bottom: 0;
        box-shadow: none;
        padding: 0 !important;
    }

    .navbar.h20-navbar > .container-fluid {
        padding-left: 0;
        padding-right: 0;
    }

    .navbar.h20-navbar .app-tabs.h20 {
        background: #0a0a0a;
        min-height: 60px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        padding: 0 10px;
        gap: 6px;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: thin;
        border: 0;
        box-shadow: none;
    }

    .navbar.h20-navbar .app-tabs.h20 .app-tab {
        color: #b4b4b4;
        padding: 10px 22px;
        font-size: 14px;
        font-weight: 600;
        border-radius: 8px;
        position: relative;
        overflow: hidden;
        border: 0;
        background: transparent;
        transition: color 0.3s ease, padding-right 0.3s ease, background 0.3s ease;
        white-space: nowrap;
    }

    .navbar.h20-navbar .app-tabs.h20 .app-tab i {
        display: none;
    }

    .navbar.h20-navbar .app-tabs.h20 .app-tab::before {
        content: "\2039";
        position: absolute;
        right: 6px;
        top: 50%;
        transform: translateY(-50%);
        color: #84cc16;
        font-size: 18px;
        font-weight: 800;
        opacity: 0;
        transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    }

    .navbar.h20-navbar .app-tabs.h20 .app-tab:hover,
    .navbar.h20-navbar .app-tabs.h20 .app-tab.active {
        color: #9ad929;
        padding-right: 30px;
        background: rgba(132, 204, 22, 0.12);
        border-color: transparent;
    }

    .navbar.h20-navbar .app-tabs.h20 .app-tab:hover::before,
    .navbar.h20-navbar .app-tabs.h20 .app-tab.active::before {
        opacity: 1;
        right: 12px;
    }

    .navbar.h20-navbar .app-tabs.h20 .app-tab.exit:hover,
    .navbar.h20-navbar .app-tabs.h20 .app-tab.exit.active {
        color: #ef4444;
        background: rgba(239, 68, 68, 0.12);
    }

    .navbar.h20-navbar .app-tabs.h20 .app-tab.exit::before {
        color: #ef4444;
    }
}

/* mobile tab row */
.mobile-tabs {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.4rem 0;
}

.mobile-tab {
    padding: 0.35rem 0.6rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    font-family: 'Vazirmatn', sans-serif;
    font-weight: 500;
    font-size: 0.8rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    justify-content: center;
    transition: all 0.2s ease;
}

.mobile-tab.active,
.mobile-tab:hover {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(34, 197, 94, 0.15);
    color: var(--text-primary);
}

/* ==================== Container و Layout ==================== */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

.page-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ==================== Glass Cards ==================== */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--card-shadow);
}

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

.glass-card-strong {
    background: var(--glass-strong);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}

/* ==================== Headers ==================== */
.page-header {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255,255,255,0.01) 10px,
        rgba(255,255,255,0.01) 20px
    );
    animation: float 20s linear infinite;
}

@keyframes float {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.header-content {
    position: relative;
    z-index: 1;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-cream);
}

.page-subtitle {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.breadcrumb-nav {
    background: rgba(255, 255, 255, 0.08);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    display: inline-block;
}

.breadcrumb-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
}

.breadcrumb-nav a:hover {
    color: var(--text-cream);
}

/* ==================== Cards و Sections ==================== */
.card-header {
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 1.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
    color: var(--text-primary);
}

/* ==================== Buttons ==================== */
.btn-glass {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-cream);
    transform: translateY(-2px);
    box-shadow: var(--button-shadow);
}

.btn-primary {
    background: var(--primary-gradient);
    border: none;
    color: white;
}

.btn-success {
    background: var(--success-gradient);
    border: none;
    color: white;
}

.btn-warning {
    background: var(--warning-gradient);
    border: none;
    color: white;
}

.btn-danger {
    background: var(--danger-gradient);
    border: none;
    color: white;
}

.btn-info {
    background: var(--info-gradient);
    border: none;
    color: white;
}

.btn-secondary {
    background: var(--secondary-gradient);
    border: none;
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--button-shadow);
    color: white;
}

/* دکمه های عمل */
.btn-action {
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary-action {
    background: var(--primary-gradient);
    color: white;
}

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

.btn-warning-action {
    background: var(--warning-gradient);
    color: white;
}

.btn-danger-action {
    background: var(--danger-gradient);
    color: white;
}

.btn-info-action {
    background: var(--info-gradient);
    color: white;
}

.btn-secondary-action {
    background: var(--secondary-gradient);
    color: white;
}

/* ==================== Forms ==================== */
.form-control {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    border-radius: 8px;
}

.form-control:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--status-success);
    box-shadow: 0 0 0 0.2rem rgba(74, 222, 128, 0.25);
    color: var(--text-primary);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-label {
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.form-select:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--status-success);
    color: var(--text-primary);
}

.form-check-input:checked {
    background-color: var(--status-success);
    border-color: var(--status-success);
}

.form-check-label {
    color: var(--text-secondary);
}

/* ==================== Badges و Status ==================== */
.badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-weight: 500;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--status-success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--status-warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--status-danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-info {
    background: rgba(6, 182, 212, 0.2);
    color: var(--status-info);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.badge-secondary {
    background: rgba(148, 163, 184, 0.2);
    color: var(--status-secondary);
    border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Status badges */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid;
}

.status-online {
    background: rgba(16, 185, 129, 0.2);
    color: var(--status-success);
    border-color: rgba(16, 185, 129, 0.3);
}

.status-offline {
    background: rgba(239, 68, 68, 0.2);
    color: var(--status-danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.status-unknown {
    background: rgba(148, 163, 184, 0.2);
    color: var(--status-secondary);
    border-color: rgba(148, 163, 184, 0.3);
}

.status-ready {
    background: rgba(16, 185, 129, 0.2);
    color: var(--status-success);
    border-color: rgba(16, 185, 129, 0.3);
}

.status-checking {
    background: rgba(245, 158, 11, 0.2);
    color: var(--status-warning);
    border-color: rgba(245, 158, 11, 0.3);
}

.status-error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--status-danger);
    border-color: rgba(239, 68, 68, 0.3);
}

/* ==================== Alerts ==================== */
.alert {
    border: none;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--status-success);
    border-color: rgba(16, 185, 129, 0.3);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--status-danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--status-warning);
    border-color: rgba(245, 158, 11, 0.3);
}

.alert-info {
    background: rgba(6, 182, 212, 0.15);
    color: var(--status-info);
    border-color: rgba(6, 182, 212, 0.3);
}

/* ==================== Stats و Metrics ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
}

.stat-card:nth-child(2)::before {
    background: var(--success-gradient);
}

.stat-card:nth-child(3)::before {
    background: var(--warning-gradient);
}

.stat-card:nth-child(4)::before {
    background: var(--info-gradient);
}

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

.stat-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    opacity: 0.8;
    color: var(--text-secondary);
}

.stat-number {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--text-cream);
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.stat-detail {
    font-size: 0.8rem;
    opacity: 0.7;
    color: var(--text-muted);
}

/* ==================== Tables ==================== */
.table {
    color: var(--text-primary);
}

.table-dark {
    --bs-table-bg: rgba(255, 255, 255, 0.05);
    --bs-table-border-color: rgba(255, 255, 255, 0.1);
}

.table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

/* ==================== Progress Bars ==================== */
.progress {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    height: 8px;
}

.progress-bar {
    background: var(--success-gradient);
    border-radius: 8px;
}

/* ==================== Loading و Animations ==================== */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid var(--text-cream);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==================== Modal ==================== */
.modal-content {
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    color: var(--text-primary);
}

.modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-title {
    color: var(--text-cream);
}

.btn-close {
    filter: invert(1);
}

/* ==================== Custom Components ==================== */

/* Usage bars */
.usage-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.usage-fill {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

.usage-normal {
    background: var(--success-gradient);
}

.usage-warning {
    background: var(--warning-gradient);
}

.usage-danger {
    background: var(--danger-gradient);
}

/* Resource bars */
.resource-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.resource-fill {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

.cpu-fill {
    background: var(--warning-gradient);
}

.memory-fill {
    background: var(--info-gradient);
}

/* Empty states */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
    color: var(--text-secondary);
}

.empty-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.empty-subtitle {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}

.empty-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
}

.empty-btn:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--button-shadow);
}

/* ==================== Utility Classes ==================== */
.text-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hidden {
    display: none !important;
}

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

.refresh-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: none;
    align-items: center;
    justify-content: center;
}

.refresh-indicator.show {
    display: flex;
}

/* ==================== Login specific styles ==================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.login-header {
    background: var(--glass-strong);
    color: var(--text-primary);
    text-align: center;
    position: relative;
    overflow: hidden;
    padding: 2rem;
}

.tab-button {
    transition: all 0.3s ease;
    border: none;
    background: transparent;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    color: var(--text-secondary);
}

.tab-button.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--button-shadow);
}

.form-floating > label {
    color: var(--text-muted);
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    color: var(--text-secondary); /* Changed from black to light gray */
}

/* Password strength indicator */
.password-strength {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.strength-bar {
    height: 100%;
    width: 0%;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.strength-weak {
    background: var(--danger-gradient);
}

.strength-medium {
    background: var(--warning-gradient);
}

.strength-strong {
    background: var(--success-gradient);
}

/* ==================== Responsive Design ==================== */
@media (max-width: 768px) {
    .main-container,
    .page-container {
        padding: 1rem;
    }

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

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

    .navbar-brand {
        font-size: 1rem;
    }

    .btn-action {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .page-header {
        padding: 1.5rem;
        text-align: center;
    }

    .breadcrumb-nav {
        display: block;
        text-align: center;
    }
}

@media (max-width: 576px) {
    .main-container,
    .page-container {
        padding: 0.75rem;
    }

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

    .stat-card {
        padding: 1rem;
    }

    .stat-number {
        font-size: 1.8rem;
    }

    .page-header {
        padding: 1rem;
    }

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

/* ==================== Print Styles ==================== */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    .navbar,
    .btn,
    .loading-spinner {
        display: none !important;
    }
    
    .glass-card {
        background: white !important;
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }
}


/* Selection and input states */
        .form-select,
        .form-control {
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid var(--glass-border);
            color: var(--text-primary);
        }

        .form-select:focus,
        .form-control:focus {
            background: rgba(255, 255, 255, 0.12);
            border-color: var(--primary-color);
            box-shadow: 0 0 0 0.2rem rgba(74, 222, 128, 0.25);
            color: var(--text-primary);
        }

        .form-select option {
            background: var(--dark-bg);
            color: var(--text-primary);
        }

        /* Fix select dropdown visibility - More aggressive approach */
        .form-select {
            background: #1a1a1a !important;
            color: #ffffff !important;
            border: 1px solid rgba(255, 255, 255, 0.3) !important;
        }

        .form-select option {
            background: #1a1a1a !important;
            color: #ffffff !important;
            padding: 0.75rem !important;
        }

        .form-select option:hover,
        .form-select option:focus,
        .form-select option:checked,
        .form-select option:active {
            background: #333333 !important;
            color: #ffffff !important;
        }

        /* Force dark background for all select elements */
        select.form-select,
        select.form-control,
        select {
            background-color: #1a1a1a !important;
            background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e") !important;
            background-repeat: no-repeat !important;
            background-size: 16px 12px !important;
            background-position: left 0.75rem center !important;
            color: #e5e7eb !important;
            border: 1px solid rgba(255, 255, 255, 0.3) !important;
            padding-left: 2.25rem !important;
        }

        select.form-select:focus,
        select.form-control:focus,
        select:focus {
            background-color: #2a2a2a !important;
            border-color: #4ade80 !important;
            color: #ffffff !important;
            box-shadow: 0 0 0 0.2rem rgba(74, 222, 128, 0.25) !important;
        }

        /* Additional fallback for stubborn browsers */
        select option,
        .form-select option,
        .form-control option {
            background-color: #1a1a1a !important;
            color: #ffffff !important;
        }

        select.no-select-arrow {
            appearance: none !important;
            -webkit-appearance: none !important;
            -moz-appearance: none !important;
            background-image: none !important;
            padding-left: 0.75rem !important;
            padding-right: 0.75rem !important;
        }

        /* WebKit specific fixes */
        select::-webkit-scrollbar {
            background: #1a1a1a;
        }

        select::-webkit-scrollbar-thumb {
            background: #333333;
        }

        /* Fix white text on white background issues */
        .router-selection {
            color: var(--text-primary);
        }

        .router-info {
            background: rgba(255, 255, 255, 0.05);
            padding: 1rem;
            border-radius: 8px;
            color: var(--text-secondary);
        }

        /* Fix status badges visibility */
        .status-badge {
            background: rgba(255, 255, 255, 0.1);
            color: var(--text-primary);
            padding: 0.25rem 0.75rem;
            border-radius: 12px;
            font-size: 0.8rem;
            font-weight: 500;
            border: 1px solid rgba(255, 255, 255, 0.2);
        }

        .status-ready {
            background: rgba(16, 185, 129, 0.2);
            color: var(--status-success);
            border-color: rgba(16, 185, 129, 0.3);
        }

        .status-error {
            background: rgba(239, 68, 68, 0.2);
            color: var(--status-danger);
            border-color: rgba(239, 68, 68, 0.3);
        }

        .status-checking {
            background: rgba(148, 163, 184, 0.2);
            color: var(--status-secondary);
            border-color: rgba(148, 163, 184, 0.3);
        }


/* ==================== XTunnel Clients Page Styles ==================== */

/* XTunnel Stats Sidebar */
.xtunnel-stats-sidebar {
    position: fixed;
    top: 80px;
    left: 15px;
    z-index: 1000;
    min-width: 200px;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
}

.xtunnel-stats-sidebar .stat-item {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.xtunnel-stats-sidebar .stat-item:last-child {
    border-bottom: none;
}

.xtunnel-stats-sidebar .stat-value {
    font-weight: bold;
    font-size: 1.1rem;
}

.xtunnel-stats-sidebar .stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.xtunnel-stats-sidebar .stat-icon {
    font-size: 1.2rem;
    margin-left: 8px;
}

/* XTunnel Server Management Sidebar */
.xtunnel-server-sidebar {
    position: fixed;
    top: 280px;
    left: 15px;
    z-index: 999;
    width: 200px;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
}

/* XTunnel Main Content */
.xtunnel-main-content {
    margin-left: 0;
    padding-left: 0;
}

@media (min-width: 768px) {
    .xtunnel-main-content {
        margin-left: 220px;
    }
}

/* XTunnel Peer Cards - Compact Design */
.xtunnel-peer-card {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid var(--status-info);
    color: var(--text-primary);
}

.xtunnel-peer-card:hover {
    background: var(--bg-hover);
    transform: translateX(-3px);
    box-shadow: var(--hover-shadow);
}

.xtunnel-peer-card.inactive {
    border-left-color: var(--status-danger);
    opacity: 0.7;
}

.xtunnel-peer-card.suspended {
    border-left-color: var(--status-secondary);
    background: rgba(148, 163, 184, 0.05);
}

.xtunnel-peer-card.expired {
    border-left-color: var(--status-warning);
    background: rgba(245, 158, 11, 0.05);
}

.xtunnel-peer-card .peer-name {
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 4px;
    color: var(--text-cream);
}

.xtunnel-peer-card .peer-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    opacity: 0.9;
    color: var(--text-secondary);
}

/* Mobile responsive for XTunnel */
@media (max-width: 768px) {
    .xtunnel-stats-sidebar, 
    .xtunnel-server-sidebar {
        position: relative;
        top: auto;
        left: auto;
        width: 100%;
        margin-bottom: 20px;
    }
    
    .xtunnel-main-content {
        margin-left: 0;
    }
}

/* XTunnel specific elements */
.xtunnel-peer-card .usage-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}

.xtunnel-peer-card .usage-fill {
    height: 100%;
    transition: width 0.3s ease;
}

        /* Peers specific styles */
        .stats-compact {
            position: relative;
            width: 100%;
            background: linear-gradient(135deg, rgba(22, 22, 22, 0.9), rgba(12, 12, 12, 0.9));
            border: 1px solid rgba(255, 255, 255, 0.05);
            border-radius: 14px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.45);
            padding: 10px 14px;
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
        }

        .stat-chip {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 6px 10px;
            border-radius: 10px;
            background: rgba(255,255,255,0.04);
            border: 1px solid rgba(255,255,255,0.05);
            color: #dcdcdc;
            font-size: 0.85rem;
            line-height: 1.2;
        }

        .stat-chip.heading {
            background: rgba(132, 204, 22, 0.1);
            border-color: rgba(132, 204, 22, 0.3);
            color: #c2f56c;
            font-weight: 600;
        }

        .stat-chip .stat-label {
            font-size: 0.82rem;
            color: #b0b0b0;
        }

        .stat-chip .stat-value {
            font-weight: 700;
            font-size: 0.92rem;
            color: #e5e5e5;
        }

        .stat-chip i {
            font-size: 0.95rem;
            color: #9ad94a;
        }

        .stat-chip.stat-action {
            cursor: pointer;
            background: rgba(255, 159, 28, 0.12);
            border-color: rgba(255, 159, 28, 0.35);
            color: #ffbe55;
            transition: all 0.2s ease;
        }

        .stat-chip.stat-action:hover {
            background: rgba(255, 159, 28, 0.2);
            border-color: rgba(255, 159, 28, 0.6);
        }

        /* Traffic snapshot tiles */
        .stats-info-box {
            position: relative;
            width: 100%;
            background: rgba(12, 12, 12, 0.9);
            border: 1px solid rgba(255, 255, 255, 0.05);
            border-radius: 14px;
            box-shadow: 0 10px 25px rgba(0,0,0,0.35);
            padding: 10px 14px;
            display: flex;
            align-items: center;
            gap: 12px;
            flex-wrap: wrap;
            margin-bottom: 1rem;
        }

        .info-tile {
            display: inline-flex;
            flex-direction: column;
            gap: 4px;
            padding: 8px 12px;
            border-radius: 10px;
            background: rgba(255,255,255,0.03);
            border: 1px solid rgba(255,255,255,0.05);
            min-width: 160px;
        }

        .info-label {
            font-size: 0.82rem;
            color: #b0b0b0;
        }

        .info-value {
            font-size: 0.98rem;
            font-weight: 700;
            color: #e5e5e5;
        }

        /* Sidebar summary (left nav) */
        .stats-sidebar {
            position: fixed;
            left: 18px;
            top: 85px;
            width: 210px;
            background: rgba(12, 12, 12, 0.95);
            border: 1px solid rgba(255,255,255,0.05);
            border-radius: 16px;
            box-shadow: 0 16px 40px rgba(0,0,0,0.45);
            padding: 4px 8px;
            flex-direction: column;
            gap: 4px;
            z-index: 4;
        }

        .sidebar-title {
            display: flex;
            align-items: center;
            gap: 6px;
            color: #dcdcdc;
            font-weight: 600;
            font-size: 0.85rem;
        }

        .sidebar-title i {
            color: #9ad94a;
        }

        .sidebar-list {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .sidebar-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 3px 5px;
            background: rgba(255,255,255,0.03);
            border: 1px solid rgba(255,255,255,0.04);
            border-radius: 8px;
        }

        .sidebar-row .info-label {
            font-size: 0.78rem;
            color: #b0b0b0;
        }

        .sidebar-row .info-value {
            font-size: 0.85rem;
            font-weight: 700;
            color: #e5e5e5;
        }

        .stats-quick-card {
            position: fixed;
            left: 24px;
            top: 460px;
            width: 200px;
            background: rgba(12, 12, 12, 0.95);
            border: 1px solid rgba(255,255,255,0.05);
            border-radius: 16px;
            box-shadow: 0 16px 40px rgba(0,0,0,0.45);
            padding: 5px 8px;
            flex-direction: column;
            gap: 4px;
            z-index: 4;
        }

        .traffic-card {
            top: 270px;
        }

        .stat-action-btn {
            width: 100%;
            text-align: left;
            background: #a5ff831f;
            border: 1px solid rgb(0 63 4);
            color: #ffbe55;
            border-radius: 8px;
            padding: 4px 6px;
            display: inline-flex;
            justify-content: space-between;
            align-items: center;
            gap: 6px;
            transition: all 0.2s ease;
        }

        .stat-action-btn:hover {
            background: rgba(255, 159, 28, 0.2);
            border-color: rgba(255, 159, 28, 0.6);
        }

        /* Hide old top stats bar */
        .stats-compact {
            display: none !important;
        }

        /* Shift main content so sidebars don't overlap */
        .main-content {
            margin-left: 240px;
        }

        @media (max-width: 992px) {
            .stats-sidebar,
            .stats-quick-card {
                display: none !important;
            }
            .main-content {
                margin-left: 0;
            }
        }

        /* XTunnel Server Management - moved to left sidebar under stats */
        .xtunnel-server-section {
            position: fixed;
            top: 320px;
            left: 15px;
            z-index: 999;
            width: 200px;
            background: var(--glass-bg);
            backdrop-filter: blur(10px);
            border: 1px solid var(--glass-border);
            border-radius: 10px;
            box-shadow: var(--card-shadow);
        }
        
        /* Peer Card Enhanced - made smaller and more compact */
        .peer-card {
            transition: all 0.3s ease;
            border-left: 4px solid var(--status-info);
            margin-bottom: 8px;
            font-size: 0.9rem;
            background: var(--glass-bg);
            backdrop-filter: blur(10px);
            border: 1px solid var(--glass-border);
            border-radius: 12px;
            padding: 12px;
            cursor: pointer;
        }
        
        .peer-card:hover {
            background: rgba(255, 255, 255, 0.08) !important;
            transform: translateX(-3px);
            box-shadow: var(--hover-shadow);
        }
        
        .peer-card.inactive {
            opacity: 0.7;
            border-left-color: var(--status-danger);
        }
        
        .peer-card.over-limit {
            opacity: 0.9;
            border-left-color: var(--status-danger);
            background: rgba(239, 68, 68, 0.1) !important;
        }
        
        .peer-card.suspended {
            opacity: 0.7;
            border-left-color: var(--status-secondary);
            background: #3a3a3a1a !important;
        }
        
        .peer-card.auto-suspended {
            border-left-color: var(--status-danger);
            background: linear-gradient(90deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%) !important;
            animation: autoSuspendedPulse 2s infinite;
        }

        .peer-card.missing-router {
            border-left-color: var(--status-warning);
            background: rgba(141, 101, 0, 0.466) !important;
            box-shadow: 0 0 15px rgba(255, 183, 0, 0.199);
        }

        .missing-router-alert {
            border: 1px dashed rgba(246, 195, 67, 0.4);
            background: rgba(246, 195, 67, 0.08);
            color: var(--status-warning);
            border-radius: 8px;
            padding: 6px 10px;
        }
        
        @keyframes autoSuspendedPulse {
            0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
            70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
            100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
        }

        /* Compact peer display - only name, data, days, status */
        .peer-compact-info {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 4px;
        }

        .peer-name-compact {
            font-weight: bold;
            font-size: 1rem;
            color: var(--text-cream);
        }

        /* Fix RTL display issues */
        .peer-data-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 0.85rem;
            color: var(--text-muted);
            direction: rtl;
        }

        .peer-data-row > div {
            direction: rtl;
            text-align: right;
        }

        /* Fix usage display */
        .usage-display {
            direction: ltr !important;
            text-align: left !important;
            font-family: 'Courier New', monospace;
            display: inline-block;
        }

        .peer-status-badge-compact {
            padding: 2px 6px;
            border-radius: 8px;
            font-size: 0.7rem;
            font-weight: 500;
        }
        
        .router-badge {
            background: var(--info-gradient);
            color: white;
            font-size: 0.75rem;
            padding: 2px 6px;
            border-radius: 8px;
            font-weight: 500;
        }
        
        .qr-section {
            background: var(--glass-bg);
            border: 2px solid var(--status-info);
            border-radius: 12px;
        }
        
        .router-info {
            background: rgba(6, 182, 212, 0.1);
            border: 1px solid var(--status-info);
            border-radius: 8px;
        }
        
        /* Client Server Cards */
        .client-server-card {
            background: var(--info-gradient);
            border: none;
            color: white;
            margin-bottom: 12px;
            border-radius: 12px;
        }
        
        .client-server-card .card-title {
            color: white;
        }
        
        .client-server-card .badge {
            background: rgba(255, 255, 255, 0.2) !important;
            color: white !important;
        }
        
        .setup-client-server {
            background: var(--info-gradient);
            border: none;
            color: white;
            transition: all 0.3s ease;
        }
        
        .setup-client-server:hover {
            background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
            transform: translateY(-2px);
            box-shadow: var(--hover-shadow);
        }
        
        .setup-section {
            background: var(--glass-bg);
            border: 2px dashed var(--status-info);
            border-radius: 10px;
        }
        
        .client-server-endpoint {
            font-family: 'Courier New', monospace;
            background: rgba(255, 255, 255, 0.1);
            padding: 2px 6px;
            border-radius: 4px;
            font-size: 0.9em;
        }
        
        /* Search and Filter */
        .search-filter-section {
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            border-radius: 10px;
            box-shadow: var(--card-shadow);
            margin-bottom: 20px;
        }
        
        .auto-suspend-warning {
            background: linear-gradient(90deg, rgba(239, 68, 68, 0.1) 0%, rgba(245, 158, 11, 0.1) 100%);
            border: 1px solid var(--status-danger);
            border-radius: 8px;
            animation: warningPulse 3s infinite;
        }
        
        @keyframes warningPulse {
            0%, 100% { border-color: var(--status-danger); }
            50% { border-color: var(--status-warning); }
        }
        
        /* Compact layout adjustments */
        .main-content {
            margin-left: 0;
        }
        
        @media (min-width: 768px) {
            .main-content {
                margin-left: 220px;
            }
        }
        
        .peer-actions {
            display: flex;
            gap: 4px;
            flex-wrap: wrap;
        }
        
        .peer-actions .btn {
            padding: 4px 8px;
            font-size: 0.8rem;
        }
        
        .peer-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 8px;
        }
        
        .peer-title {
            display: flex;
            align-items: center;
            gap: 8px;
            flex: 1;
        }
        
        .peer-status-badges {
            display: flex;
            gap: 4px;
            flex-wrap: wrap;
        }
        
        .peer-details {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
            font-size: 0.85rem;
            margin-bottom: 10px;
        }
        
        @media (max-width: 768px) {
            .peer-details {
                grid-template-columns: 1fr;
            }
            
            .stats-compact, .xtunnel-server-section {
                position: relative;
                top: auto;
                left: auto;
                margin-bottom: 20px;
                width: 100%;
            }
            
            .main-content {
                margin-left: 0;
            }
        }
        
        /* Error styling */
        .error-message {
            background: rgba(239, 68, 68, 0.15);
            color: var(--status-danger);
            border: 1px solid rgba(239, 68, 68, 0.3);
            border-radius: 8px;
            padding: 10px;
            margin: 10px 0;
        }
        
        .success-message {
            background: rgba(16, 185, 129, 0.15);
            color: var(--status-success);
            border: 1px solid rgba(16, 185, 129, 0.3);
            border-radius: 8px;
            padding: 10px;
            margin: 10px 0;
        }

        /* QR Code download button */
        .qr-download-btn {
            background: var(--success-gradient);
            border: none;
            color: white;
            padding: 8px 16px;
            border-radius: 8px;
            font-size: 0.9rem;
            transition: all 0.3s ease;
            margin-top: 10px;
        }

        .qr-download-btn:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
        }

        /* Routers.html */
                
# Custom header layout tweaks
 .peers-custom-header .header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.peers-custom-header .app-tabs {
    order: 2;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-inline-start: auto;
    flex-direction: row-reverse;
}

.peers-custom-header .subscription-info {
    order: 1;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: flex-start;
}
.peers-custom-header {
    width: 100%;
    background: rgba(17,17,17,0.9);
    border-radius: 0 0 1rem 1rem;
    padding: 1rem 1.25rem;
    border: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(12px);
}

.peers-custom-header .header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    direction: ltr;
}

.peers-custom-header .subscription-area {
    flex: 1 1 auto;
    gap: 1rem;
    order: 1;
}

.peers-custom-header .app-tabs {
    order: 2;
    margin-inline-start: auto;
}

.subscription-area .subscription-labels {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.subscription-area .capacity-row {
    flex: 1;
    min-width: 250px;
}

.subscription-area .capacity-row .progress {
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 999px;
    overflow: hidden;
}

.subscription-area .capacity-row small {
    color: rgba(255,255,255,0.7);
    white-space: nowrap;
}


/* ==================== Dashboard Styles (moved from dashboard.html) ==================== */
.subscription-card {
            background: var(--glass-bg);
            backdrop-filter: blur(15px);
            border: 1px solid var(--glass-border);
            border-radius: 20px;
            padding: 1.5rem;
            margin-bottom: 2rem;
            position: relative;
            overflow: hidden;
        }

        .subscription-card.none {
            border: 2px solid var(--status-warning);
            background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.05));
        }

        .subscription-card.basic {
            border: 2px solid var(--primary-color);
            background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.05));
        }

        .subscription-card.pro {
            border: 2px solid var(--status-success);
            background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
        }

        .subscription-card.enterprise {
            border: 2px solid var(--status-info);
            background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(139, 92, 246, 0.05));
        }

        .subscription-status {
            position: absolute;
            top: 1rem;
            left: 1rem;
            padding: 0.25rem 0.75rem;
            border-radius: 20px;
            font-size: 0.8rem;
            font-weight: 600;
        }

        .subscription-status.none {
            background: var(--warning-gradient);
            color: white;
        }

        .subscription-status.active {
            background: var(--success-gradient);
            color: white;
        }

        .subscription-status.expired {
            background: var(--danger-gradient);
            color: white;
        }

        .subscription-title {
            font-size: 1.25rem;
            font-weight: 700;
            color: var(--text-cream);
            margin-bottom: 0.5rem;
        }

        .subscription-limits {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
            gap: 1rem;
            margin-top: 1rem;
        }

        .limit-item {
            text-align: center;
            padding: 0.75rem;
            background: rgba(255, 255, 255, 0.05);
            border-radius: 10px;
        }

        .limit-number {
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--text-cream);
            display: block;
        }

        .limit-label {
            font-size: 0.8rem;
            color: var(--text-muted);
            margin-top: 0.25rem;
        }

        .purchase-btn {
            background: var(--warning-gradient);
            color: white;
            border: none;
            padding: 0.75rem 1.5rem;
            border-radius: 10px;
            font-weight: 600;
            text-decoration: none;
            display: inline-block;
            transition: all 0.3s ease;
            margin-top: 1rem;
        }

        .purchase-btn:hover {
            transform: translateY(-2px);
            box-shadow: var(--button-shadow);
            color: white;
        }

        .upgrade-btn {
            background: var(--success-gradient);
        }

        .wizard-btn {
            background: var(--primary-gradient);
            color: white;
            border: none;
            padding: 1rem 2rem;
            border-radius: 15px;
            font-weight: 700;
            font-size: 1.1rem;
            text-decoration: none;
            display: inline-block;
            transition: all 0.3s ease;
            margin-top: 1rem;
            position: relative;
            overflow: hidden;
        }

        .wizard-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
            color: white;
        }

        .wizard-btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
            transition: left 0.5s;
        }

        .wizard-btn:hover::before {
            left: 100%;
        }

        .feature-disabled {
            opacity: 0.5;
            pointer-events: none;
            position: relative;
        }

        .feature-disabled::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.1);
            border-radius: inherit;
        }

        .upgrade-notice {
            background: var(--warning-gradient);
            color: white;
            padding: 1rem;
            border-radius: 10px;
            text-align: center;
            margin: 1rem 0;
        }

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

        .usage-bar {
            width: 100%;
            height: 6px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 3px;
            overflow: hidden;
            margin-top: 0.5rem;
        }

        .usage-fill {
            height: 100%;
            background: var(--primary-gradient);
            border-radius: 3px;
            transition: width 0.3s ease;
        }

        .usage-fill.high {
            background: var(--warning-gradient);
        }

        .usage-fill.full {
            background: var(--danger-gradient);
        }

        .expired-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.8);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 9999;
        }

        .expired-modal {
            background: var(--glass-bg);
            backdrop-filter: blur(15px);
            border: 2px solid var(--status-danger);
            border-radius: 20px;
            padding: 2rem;
            text-align: center;
            max-width: 400px;
            margin: 2rem;
        }

        .wizard-intro {
            background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
            border: 2px solid rgba(59, 130, 246, 0.3);
            border-radius: 20px;
            padding: 2rem;
            text-align: center;
            margin-bottom: 2rem;
        }

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

        .wizard-feature {
            background: rgba(255, 255, 255, 0.05);
            padding: 1rem;
            border-radius: 10px;
            text-align: center;
        }

        .wizard-feature-icon {
            font-size: 2rem;
            color: var(--primary-color);
            margin-bottom: 0.5rem;
        }

        .wizard-completion-notice {
            background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(59, 130, 246, 0.1));
            border: 2px solid var(--status-success);
            border-radius: 20px;
            padding: 2rem;
            text-align: center;
            margin-bottom: 2rem;
        }


/* ==================== Dashboard Theme Overrides ==================== */
.dashboard-theme .main-container.dashboard-shell {
    background: rgba(8, 8, 8, 0.92);
    border: 1px solid #1f1f1f;
    border-radius: 20px;
    padding: 1.75rem;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
}

@media (max-width: 768px) {
    .dashboard-theme .main-container.dashboard-shell {
        padding: 1.25rem;
    }
}

.dashboard-theme .page-header {
    background: var(--dashboard-card);
    border: 1px solid var(--dashboard-border);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35);
}

.dashboard-theme .page-header::before {
    content: none;
}

.dashboard-theme .page-title {
    color: var(--dashboard-text);
}

.dashboard-theme .page-subtitle {
    color: var(--dashboard-muted);
}

.dashboard-theme .glass-card {
    background: var(--dashboard-card);
    border-color: var(--dashboard-border);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
    color: var(--dashboard-text);
}

.dashboard-theme .text-white {
    color: #e5e7eb !important;
}

.dashboard-theme .text-light {
    color: #cbd5e1 !important;
}

.dashboard-theme .glass-card-strong {
    background: var(--dashboard-card-strong);
    border-color: var(--dashboard-border);
}

.dashboard-theme .card-header {
    background: #111111;
    border-bottom: 1px solid var(--dashboard-border);
}

.dashboard-theme .stat-card {
    background: var(--dashboard-card);
    border-color: var(--dashboard-border);
}

.dashboard-theme .stat-card::before {
    background: linear-gradient(135deg, var(--dashboard-accent), var(--dashboard-accent-dark));
}

.dashboard-theme .stat-icon {
    color: var(--dashboard-accent);
}

.dashboard-theme .stat-number {
    color: var(--dashboard-text);
}

.dashboard-theme .stat-label,
.dashboard-theme .stat-detail {
    color: var(--dashboard-muted);
}

.dashboard-theme .usage-bar {
    background: #1f1f1f;
}

.dashboard-theme .usage-fill {
    background: linear-gradient(135deg, var(--dashboard-accent), var(--dashboard-accent-dark));
}

.dashboard-theme .btn-primary {
    background: linear-gradient(135deg, var(--dashboard-accent), var(--dashboard-accent-dark));
    border: 1px solid rgba(132, 204, 22, 0.5);
    color: #101010;
}

.dashboard-theme .btn-primary:hover {
    background: linear-gradient(135deg, #95d92d, #6aa70f);
    color: #101010;
}

.dashboard-theme .btn-secondary {
    background: #151515;
    border: 1px solid var(--dashboard-border);
    color: var(--dashboard-text);
}

.dashboard-theme .btn-secondary:hover {
    background: #1d1d1d;
    border-color: rgba(132, 204, 22, 0.35);
    color: var(--dashboard-text);
}

.dashboard-theme .compact-modal-dialog {
    max-width: 460px;
}

.dashboard-theme .compact-modal-dialog.agent-create-dialog {
    max-width: 680px;
}

/* Keep the create-agent modal a constant size across all 6 steps so it
   doesn't jump as content changes. Only the modal grows — inputs, buttons
   and fonts are unchanged. */
.dashboard-theme #createAgentModal .agent-create-sections {
    min-height: 360px;
}

.dashboard-theme #createAgentModal .modal-dialog {
    margin-top: 0.35rem;
    margin-bottom: 0.35rem;
}

.dashboard-theme #createAgentModal .modal-content {
    background: #121212;
    border: 1px solid #2c2f33;
    border-radius: 12px;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.72);
    overflow: hidden;
}

.dashboard-theme .compact-modal {
    background: #0f0f0f;
    border: 1px solid var(--dashboard-border);
    border-radius: 16px;
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.6);
    color: var(--dashboard-text);
}

.dashboard-theme .compact-modal .modal-header,
.dashboard-theme .compact-modal .modal-footer {
    background: #0a0a0a;
    border-color: #1f1f1f;
    padding: 0.75rem 1rem;
}

.dashboard-theme .compact-modal .modal-body {
    background: #080808;
    padding: 0.85rem;
}

.dashboard-theme #createAgentModal .modal-body {
    background: #121212;
    padding: 0.95rem 1rem 0.75rem;
}

.dashboard-theme .compact-modal .form-control {
    background: #141414;
    border-color: #2a2a2a;
    color: var(--dashboard-text);
    border-radius: 7px;
    width: 100%;
    /* Heights reduced ~10% for a tighter look (was 34/36). */
    min-height: 30px;
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
    font-size: 0.84rem;
}

.dashboard-theme #createAgentModal .form-control,
.dashboard-theme #addRouterModal .form-control {
    height: 32px;
    min-height: 32px;
    background: #1f1f1f;
    border: 1px solid #2d2f33;
    border-radius: 7px;
    color: #edf2f7;
    box-shadow: none;
    padding-top: 0.28rem;
    padding-bottom: 0.28rem;
    font-size: 0.84rem;
}
/* Textareas can be a hair taller for readability. */
.dashboard-theme #createAgentModal textarea.form-control,
.dashboard-theme #addRouterModal textarea.form-control {
    height: auto;
    min-height: 44px;
}

.dashboard-theme #createAgentModal .form-control::placeholder {
    color: #6c7890;
    opacity: 1;
}

.dashboard-theme #createAgentModal textarea.form-control {
    line-height: 1.45;
}

.dashboard-theme #createAgentModal .form-control:focus {
    background: #202020;
    border-color: #39dd58;
    box-shadow: 0 0 0 1px rgba(57, 221, 88, 0.46);
}

.dashboard-theme .compact-modal .form-control:focus {
    border-color: var(--dashboard-accent);
    box-shadow: 0 0 0 2px rgba(132, 204, 22, 0.2);
}

.dashboard-theme .compact-modal .form-label {
    font-size: 0.8rem;
    color: #cbd5e1;
}

.dashboard-theme #createAgentModal .form-label {
    margin-bottom: 0.22rem;
    color: #aeb9c9;
    font-size: 0.72rem;
    font-weight: 700;
}

.dashboard-theme #createAgentModal .agent-modal-field > .form-label,
.dashboard-theme #createAgentModal .agent-traffic-label-row,
.dashboard-theme #addRouterModal .agent-modal-field > .form-label {
    height: 16px;
    min-height: 16px;
    margin-bottom: 0.16rem;
    line-height: 16px;
}

.dashboard-theme #createAgentModal .form-label::after {
    color: #39dd58;
}

.dashboard-theme .compact-modal .form-text {
    font-size: 0.75rem;
    color: var(--dashboard-muted);
}

.dashboard-theme .compact-modal .form-actions {
    margin-top: 0.35rem;
}

.dashboard-theme .compact-modal .btn-close {
    display: none;
}

.dashboard-theme .agent-create-dialog .btn-close {
    display: none;
}

/* Buttons inside agent-create / router-create modals: compact, same look
   as the inputs around them so the form reads as one tight unit. */
.dashboard-theme #createAgentModal .form-actions .btn,
.dashboard-theme #addRouterModal .form-actions .btn,
.dashboard-theme #addRouterModal .agent-modal-card .btn {
    min-height: 32px;
    padding: 0.28rem 0.85rem;
    font-size: 0.85rem;
    border-radius: 7px;
}

.dashboard-theme .agent-modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    /* Tighter — fields hug each other. (was 0.62/0.75rem) */
    gap: 0.42rem 0.55rem;
    align-items: start;
}

.dashboard-theme .agent-modal-field {
    min-width: 0;
}

.dashboard-theme .agent-modal-field.full {
    grid-column: 1 / -1;
}

.dashboard-theme .agent-modal-field .form-label {
    display: block;
    margin-bottom: 0.16rem;
}

.dashboard-theme .agent-create-sections {
    display: grid;
    /* Tighter — sections stack closer. (was 0.8rem) */
    gap: 0.55rem;
}

.dashboard-theme .agent-form-section {
    position: relative;
    padding-top: 0.62rem;
    padding-right: 0;
    border-top: 1px solid #242424;
    border-right: 0;
}

.dashboard-theme .agent-form-section:first-child {
    padding-top: 0;
    border-top: 0;
}

.dashboard-theme .agent-section-title {
    display: none;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
    margin-bottom: 0.52rem;
    color: #39dd58;
    font-size: 0.72rem;
    font-weight: 700;
}

.dashboard-theme .agent-section-title i {
    font-size: 0.82rem;
}

.dashboard-theme .agent-create-dialog .modal-header {
    min-height: 54px;
    padding: 0.75rem 1rem;
    background: #141414;
    border-bottom: 1px solid #252525;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row;
    direction: rtl;
}

.dashboard-theme .agent-create-dialog .modal-title {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: #f2f4f7;
    font-size: 0.95rem;
    font-weight: 800;
    margin: 0;
}

.dashboard-theme .compact-modal .modal-title,
.dashboard-theme .agent-clean-modal .modal-title,
.modal-title {
    color: #f8fafc !important;
}

.dashboard-theme .agent-create-dialog .modal-title i {
    width: 27px;
    height: 27px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: rgba(40, 199, 80, 0.18);
    color: #39dd58;
    font-size: 0.95rem;
    margin: 0 !important;
}

.dashboard-theme .agent-create-dialog .form-control-sm,
.dashboard-theme .agent-create-dialog .form-select-sm {
    padding: 0.32rem 0.72rem;
    font-size: 0.8rem;
}

.dashboard-theme .agent-network-grid {
    align-items: end;
}

/* ── Router multi-select (checkbox-card list) ──────────────────────────── */
.router-choice-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.55rem;
    background: #0d0d0d;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    min-height: 52px;
    transition: transform 0.2s;
}
.router-choice-list.router-choice-shake {
    animation: rchShake 0.35s;
}
@keyframes rchShake {
    0%, 100% { transform: translateX(0); }
    25%     { transform: translateX(-4px); }
    75%     { transform: translateX(4px); }
}
.router-choice-empty {
    color: #6b7280;
    font-size: 0.78rem;
    padding: 0.3rem 0.4rem;
}
.router-choice-empty.text-warning { color: #f59e0b; }
.router-choice-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.34rem 0.65rem;
    background: #141417;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    color: #cbd5e1;
    font-size: 0.79rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    margin: 0;
}
.router-choice-item:hover {
    background: #1c1c20;
    border-color: #3a3a3a;
}
.router-choice-item.is-checked {
    background: rgba(99, 102, 241, 0.15);
    border-color: #6366f1;
    color: #fff;
}
.router-choice-cb {
    accent-color: #6366f1;
    cursor: pointer;
}
.router-choice-ip {
    color: #8899aa;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}

/* ── Step 4: selectable router card grid ──────────────────────────────────── */
.router-pick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.45rem;
    min-height: 52px;
}
.router-pick-count {
    font-size: 0.72rem;
    color: #8b93a7;
    background: #141417;
    border: 1px solid #2a2a2a;
    border-radius: 999px;
    padding: 0.1rem 0.6rem;
}
.router-pick-card {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    text-align: right;
    padding: 0.4rem 0.55rem;
    background: #141417;
    border: 1px solid #2a2a2a;
    border-radius: 9px;
    color: #cbd5e1;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.router-pick-card:hover { background: #1c1c20; border-color: #3a3a3a; }
.router-pick-card.is-selected {
    background: rgba(99, 102, 241, 0.14);
    border-color: #6366f1;
    color: #fff;
}
.router-pick-card.router-pick-shake { animation: rchShake 0.35s; }
.router-pick-check {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    border: 1px solid #3a3a3a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.66rem;
    color: transparent;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.router-pick-card.is-selected .router-pick-check {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
}
.router-pick-body { display: flex; flex-direction: column; gap: 0; min-width: 0; line-height: 1.25; }
.router-pick-name { font-size: 0.78rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.router-pick-ip {
    font-size: 0.68rem;
    color: #8899aa;
    font-variant-numeric: tabular-nums;
    direction: ltr;
    text-align: right;
}

/* ── Step 5: per-router allocation cards ──────────────────────────────────── */
.router-alloc-head {
    font-size: 0.82rem;
    font-weight: 500;
    color: #e2e8f0;
    margin-bottom: 0.6rem;
}
.router-alloc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.7rem;
}
.router-alloc-card {
    background: #0f0f12;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 0.8rem 0.85rem;
}
.router-alloc-card-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
    color: #e2e8f0;
}
.router-alloc-card-head i { color: #6366f1; }
.router-alloc-name { font-size: 0.84rem; font-weight: 500; }
.router-alloc-ip {
    margin-inline-start: auto;
    font-size: 0.7rem;
    color: #8899aa;
    direction: ltr;
    font-variant-numeric: tabular-nums;
}
.router-alloc-card .form-label { margin-bottom: 0.2rem; color: #aab2c5; }
.router-alloc-mini { font-size: 0.68rem; margin-top: 0.2rem; }
.agent-scope-hint { color: #8b93a7; }

/* ── Custom themed select (click-to-open) — replaces inline radio groups ──── */
.ui-select { position: relative; }
.ui-select-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    background: #141417;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.82rem;
    padding: 0.45rem 0.7rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.ui-select-trigger:hover { border-color: #3a3a3a; background: #18181c; }
.ui-select.open .ui-select-trigger { border-color: #6366f1; background: #18181c; }
.ui-select-trigger .ui-select-caret { color: #8b93a7; transition: transform 0.15s; flex: 0 0 auto; }
.ui-select.open .ui-select-trigger .ui-select-caret { transform: rotate(180deg); }
.ui-select-menu {
    display: none;
    margin-top: 4px;
    background: #0f0f12;
    border: 1px solid #34343c;
    border-radius: 8px;
    padding: 4px;
}
.ui-select.open .ui-select-menu { display: block; }
.ui-select-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
    font-size: 0.82rem;
    color: #cbd5e1;
    cursor: pointer;
    margin: 0;
}
.ui-select-option:hover { background: #1c1c20; }
.ui-select-option input { display: none; }
.ui-select-option.is-active { background: rgba(99, 102, 241, 0.16); color: #fff; }
.ui-select-option .ui-opt-check { margin-inline-start: auto; color: #8b8ff5; opacity: 0; font-size: 0.85rem; }
.ui-select-option.is-active .ui-opt-check { opacity: 1; }

/* ── Per-router assign modal (edit-agent: peer cap / traffic credit) ──────── */
.agent-assign-btn { color: #8b8ff5; }
/* Higher specificity than `.dashboard-theme .compact-modal-dialog` (460px). */
.dashboard-theme .compact-modal-dialog.agent-assign-dialog { max-width: 600px; }
.agent-router-assign-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
    gap: 12px;
}
.router-adjust-card {
    background: #0f0f12;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 14px;
}
.router-adjust-head { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.router-adjust-head i { color: #8b8ff5; font-size: 1rem; }
.router-adjust-name { font-size: 0.82rem; color: #e2e8f0; font-weight: 500; }
.router-adjust-ip { margin-inline-start: auto; font-size: 0.7rem; color: #8899aa; direction: ltr; font-variant-numeric: tabular-nums; }
.router-adjust-current { font-size: 0.74rem; color: #9aa3b5; margin-bottom: 10px; }
.router-adjust-current strong { color: #e2e8f0; font-weight: 500; }
.router-adjust-editor { display: flex; align-items: center; gap: 8px; }
.router-adjust-editor .router-adjust-amount { flex: 1; min-width: 0; text-align: center; }
.router-adjust-btn {
    flex: 0 0 auto; width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    background: #1a1a1f; border: 1px solid #2f2f37; border-radius: 8px;
    color: #e2e8f0; font-size: 0.95rem; cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.router-adjust-btn:hover { background: #24242b; }
.router-adjust-btn.plus:hover { border-color: #2f6f4f; color: #5fd39a; }
.router-adjust-btn.minus:hover { border-color: #7a3030; color: #ef8585; }
.router-adjust-btn:disabled { opacity: 0.5; cursor: default; }
.router-adjust-preview {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
    margin-top: 9px; font-size: 0.72rem; color: #8b93a7;
}
.router-adjust-preview .rap-after { display: inline-flex; gap: 12px; }
.rap-inc { color: #5fd39a; }
.rap-dec { color: #ef8585; }
/* Per-router manage cards reuse the total-mode op-switch + balance preview */
.router-adjust-card .traffic-op-group { margin: 9px 0 8px; }
.router-adjust-card .input-group { margin-bottom: 0; }
.router-adjust-card .traffic-balance-preview { display: flex; }
.router-card-new.rap-inc { color: #5fd39a; }
.router-card-new.rap-dec { color: #ef8585; }
/* Save-confirm summary (who got +/- how much) */
.confirm-change-list { display: flex; flex-direction: column; gap: 8px; }
.confirm-change-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    font-size: 0.8rem; background: #0f0f12; border: 1px solid #2a2a2a; border-radius: 8px; padding: 8px 11px;
}
.confirm-change-name { color: #e2e8f0; }
.confirm-change-after { color: #9aa3b5; font-size: 0.74rem; direction: ltr; font-variant-numeric: tabular-nums; }

/* Scope toggle inside the assign modal */
.agent-scope-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.6rem 0.7rem;
    margin-bottom: 0.85rem;
    background: #0f0f12;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
}
.agent-scope-toggle-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.agent-scope-toggle-title { font-size: 0.8rem; color: #e2e8f0; }
.agent-scope-toggle-sub { font-size: 0.68rem; color: #8b93a7; line-height: 1.5; }
.agent-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: 0 0 auto; cursor: pointer; margin: 0; }
.agent-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.agent-switch-track { position: absolute; inset: 0; background: #3a3a3a; border-radius: 999px; transition: background 0.15s; }
.agent-switch-thumb { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform 0.15s; }
.agent-switch input:checked + .agent-switch-track { background: #6366f1; }
.agent-switch input:not(:checked) + .agent-switch-track .agent-switch-thumb { transform: translateX(-20px); }
.agent-switch input:disabled + .agent-switch-track { opacity: 0.6; }

/* Stacked modals: dim the page with the backdrop, and blur the MODAL(S) that
   sit BEHIND the top one directly (filter on their .modal-content). Using
   backdrop-filter blurs the page behind the backdrop — not the in-between
   modal — which is why the modal behind never looked blurred. */
.dashboard-theme .modal-backdrop.show { opacity: 1; background-color: rgba(0, 0, 0, 0.55); }
.dashboard-theme .modal-content.modal-behind-blur {
    filter: blur(3px);
    pointer-events: none;
    transition: filter 0.15s ease;
}

/* Edit-agent modal: tabs + scope toggles */
.dashboard-theme .compact-modal-dialog.edit-agent-dialog { max-width: 600px; }
.dashboard-theme .edit-agent-header { flex-direction: column; align-items: stretch; gap: 0; }
.edit-agent-tabs { display: flex; gap: 6px; margin-top: 12px; }
.edit-agent-tab {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 10px; background: #141417; border: 1px solid #2a2a2a; border-radius: 9px;
    color: #9aa3b5; font-size: 0.79rem; cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.edit-agent-tab i { font-size: 0.88rem; }
.edit-agent-tab:hover { background: #1c1c20; color: #cbd5e1; }
.edit-agent-tab.is-active { background: rgba(99, 102, 241, 0.16); border-color: #6366f1; color: #fff; }
.edit-scope-row { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; }
.edit-scope-row + .edit-scope-row { border-top: 1px solid #232323; padding-top: 0.7rem; }
.edit-scope-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.edit-scope-title { font-size: 0.84rem; color: #e2e8f0; }
.edit-scope-sub { font-size: 0.72rem; color: #8b93a7; }
.edit-scope-btn {
    flex: 0 0 auto;
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 11px;
    background: #1a1a1f; border: 1px solid #2f2f37; border-radius: 8px;
    color: #c7cad6; font-size: 0.74rem; cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.edit-scope-btn:hover { background: #232330; border-color: #6366f1; color: #fff; }
.edit-scope-btn i { font-size: 0.8rem; }

/* Themed confirm dialog + scope-convert reference line */
.confirm-modal-dialog { max-width: 420px; }
.confirm-modal-text { font-size: 0.86rem; color: #cbd5e1; line-height: 1.9; }
.scope-convert-ref {
    font-size: 0.74rem; color: #9aa3b5; background: #0f0f12;
    border: 1px solid #2a2a2a; border-radius: 9px; padding: 0.55rem 0.7rem; margin-bottom: 0.85rem; line-height: 1.7;
}
.scope-convert-ref strong { color: #e2e8f0; font-weight: 500; }
/* ───────────────────────────────────────────────────────────────────────── */

.dashboard-theme .agent-description-compact {
    height: 36px;
    min-height: 36px;
    resize: none;
    overflow: hidden;
}

.dashboard-theme .speed-mode-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
}

.dashboard-theme .speed-mode-option {
    min-height: 36px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.36rem 0.65rem;
    background: #1f1f1f;
    border: 1px solid #2d2f33;
    border-radius: 7px;
    color: #aeb9c9;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.dashboard-theme .speed-mode-option input {
    margin: 0;
    accent-color: var(--dashboard-accent);
}

.dashboard-theme .speed-mode-option:has(input:checked) {
    border-color: #39dd58;
    background: #111f15;
    color: #39dd58;
}

.dashboard-theme .agent-package-duration-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-theme #agentPackageCards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

.dashboard-theme .agent-package-card {
    border: 1px solid #2d2f33;
    background: #1f1f1f;
    color: #d8dee9;
    border-radius: 8px;
    padding: 0.85rem;
    text-align: right;
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.dashboard-theme .agent-package-card:hover,
.dashboard-theme .agent-package-card.selected {
    border-color: #39dd58;
    background: #111f15;
    transform: translateY(-1px);
}

.dashboard-theme .agent-package-card-title {
    font-weight: 850;
    color: #f8fafc;
}

.dashboard-theme .agent-package-card-price {
    margin-top: 0.35rem;
    color: #39dd58;
    font-size: 0.85rem;
    font-weight: 800;
}

.dashboard-theme .account-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 7px;
}

.dashboard-theme .account-table th {
    color: #9ca3af;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0 0.55rem 0.2rem;
}

.dashboard-theme .account-table td {
    background: #151515;
    border-top: 1px solid #282828;
    border-bottom: 1px solid #282828;
    padding: 0.55rem;
    font-size: 0.82rem;
    color: #cbd5e1;
}

.dashboard-theme .account-empty {
    color: #9ca3af;
    border: 1px dashed #2d2f33;
    border-radius: 8px;
    padding: 0.8rem;
    text-align: center;
}

.dashboard-theme #createAgentModal .agent-traffic-row {
    display: block;
}

.dashboard-theme #createAgentModal .agent-traffic-row.is-unlimited {
    display: block;
    min-height: 0 !important;
    width: 100%;
}

.dashboard-theme #createAgentModal .agent-traffic-row.is-unlimited #agentTrafficCreditGroup {
    width: 100%;
}

.dashboard-theme #createAgentModal #agentTrafficCredit:disabled {
    opacity: 0.58;
    cursor: not-allowed;
}

.dashboard-theme #createAgentModal .agent-traffic-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.dashboard-theme #createAgentModal .agent-traffic-label-row .form-label {
    margin-bottom: 0;
    line-height: 18px;
}

.dashboard-theme #createAgentModal .agent-traffic-label-row .form-check-label {
    color: #cfd7e3;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 18px;
}

.dashboard-theme #createAgentModal .agent-traffic-label-row .form-check {
    height: 18px;
    min-height: 18px;
    align-items: center !important;
}

.dashboard-theme #createAgentModal .agent-traffic-toggle {
    min-height: 36px;
    align-items: center;
    color: #cfd7e3;
}

.dashboard-theme #createAgentModal .square-check {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background-color: #f8fafc;
    border-color: #d7dde7;
}

.dashboard-theme #createAgentModal .square-check:checked {
    background-color: #39dd58;
    border-color: #39dd58;
}

.dashboard-theme #createAgentModal .square-check:focus {
    border-color: #39dd58;
    box-shadow: 0 0 0 2px rgba(57, 221, 88, 0.22);
}

.dashboard-theme #createAgentModal .form-actions {
    margin: 0.75rem -1rem -0.75rem;
    padding: 0.75rem 1rem;
    background: #141414;
    border-top: 1px solid #252525;
}

.dashboard-theme #createAgentModal .form-actions .btn {
    min-width: 82px;
    min-height: 34px;
    border-radius: 7px;
    font-size: 0.82rem;
    font-weight: 800;
}

.dashboard-theme #createAgentModal .form-actions .btn-primary {
    background: #3bd954;
    border-color: #3bd954;
    color: #071109;
}

.dashboard-theme #createAgentModal .form-actions .btn-primary:hover {
    background: #47e862;
    border-color: #47e862;
}

.dashboard-theme #createAgentModal .form-actions .btn-secondary {
    background: #151515;
    border-color: #343841;
    color: #b9c4d4;
}

.dashboard-theme #createAgentModal .form-text {
    height: 28px;
    padding: 0.35rem 0.65rem;
    background: #161616;
    border: 1px solid #25272b;
    border-radius: 5px;
    color: #6c7890;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

@media (max-width: 575.98px) {
    .dashboard-theme .compact-modal-dialog.agent-create-dialog {
        max-width: none;
    }
}

.dashboard-theme .alert.position-fixed {
    min-width: 0 !important;
    max-width: min(360px, calc(100vw - 24px));
    padding: 0.65rem 0.85rem;
    border-radius: 12px;
    border: 1px solid #242424;
    background: #101010;
    color: #f3f4f6;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
    font-size: 0.82rem;
}


/* ==================== Dashboard Layout Refresh ==================== */
.dashboard-theme .main-container.dashboard-shell {
    width: min(1180px, calc(100% - 32px));
    max-width: none;
    background: #0b0b0b;
    border: 1px solid #1f1f1f;
    border-radius: 24px;
    padding: 2rem;
    margin: 1.5rem auto 0;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.5);
}

@media (max-width: 768px) {
    .dashboard-theme .main-container.dashboard-shell {
        padding: 1.25rem;
        margin-top: 0.5rem;
        border-radius: 18px;
    }
}

.dashboard-theme .dash-hero {
    padding: 1.75rem;
    border-radius: 22px;
    background: radial-gradient(circle at top right, rgba(132, 204, 22, 0.08), transparent 45%),
        linear-gradient(135deg, rgba(20, 20, 20, 0.95), rgba(10, 10, 10, 0.95));
    border: 1px solid #242424;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dashboard-theme .dash-hero-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.dashboard-theme .dash-hero-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dashboard-theme .dash-avatar {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, #84cc16, #65a30d);
    color: #0b0b0b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 10px 20px rgba(132, 204, 22, 0.25);
}

.dashboard-theme .dash-label {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #9ca3af;
}

.dashboard-theme .dash-title {
    font-size: 1.8rem;
    margin: 0.25rem 0 0.35rem;
    color: #f8fafc;
    font-weight: 700;
}

.dashboard-theme .dash-title-row {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.dashboard-theme .dash-title-action {
    border-radius: 10px;
    font-size: 0.78rem;
    line-height: 1.2;
    padding: 0.35rem 0.7rem;
}

.dashboard-theme .dash-subtitle {
    margin: 0;
    color: #9ca3af;
    font-size: 0.95rem;
}

.dashboard-theme .dash-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.dashboard-theme .dash-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    flex: 1 1 320px;
    min-width: 240px;
    width: 100%;
}

.dashboard-theme .dash-hero-meta {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    border-top: 1px solid #1f1f1f;
    padding-top: 1rem;
}

.dashboard-theme .dash-alert {
    margin-top: 1.5rem;
    padding: 1.25rem 1.5rem;
    border-radius: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background: #111111;
    border: 1px solid #2a2a2a;
}

.dashboard-theme .dash-alert-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #f8fafc;
}

.dashboard-theme .dash-alert-text {
    margin: 0.35rem 0 0;
    color: #9ca3af;
    font-size: 0.9rem;
}

.dashboard-theme .dash-wizard {
    margin-top: 1.75rem;
    padding: 1.5rem;
    border-radius: 20px;
}

.dashboard-theme .dash-wizard-header h3 {
    margin-bottom: 0.35rem;
    color: #f8fafc;
}

.dashboard-theme .dash-wizard-header p {
    margin: 0 0 1rem;
    color: #9ca3af;
}

.dashboard-theme .dash-wizard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.dashboard-theme .dash-wizard-card {
    background: #101010;
    border: 1px solid #242424;
    border-radius: 16px;
    padding: 1rem;
    text-align: center;
    color: #e5e7eb;
}

.dashboard-theme .dash-wizard-icon {
    width: 42px;
    height: 42px;
    margin: 0 auto 0.5rem;
    border-radius: 12px;
    background: rgba(132, 204, 22, 0.15);
    color: #84cc16;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.dashboard-theme .dash-kpi-grid {
    margin-top: 0;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(170px, 1fr);
    gap: 0.75rem;
    flex: 1 1 100%;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    width: 100%;
    max-width: 100%;
}

.dashboard-theme .dash-kpi {
    padding: 0.85rem 1rem;
    border-radius: 16px;
}

.dashboard-theme .dash-kpi h6 {
    margin-bottom: 0.5rem;
    color: #e5e7eb;
    font-weight: 600;
    font-size: 0.85rem;
}

.dashboard-theme .dash-kpi-value {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
}

.dashboard-theme .dash-kpi-limit {
    color: #9ca3af;
    font-size: 0.85rem;
}

.dashboard-theme .dash-kpi-note {
    color: #9ca3af;
    font-size: 0.8rem;
}

.dashboard-theme .agent-traffic-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: end;
}

.dashboard-theme .agent-traffic-row.is-unlimited {
    grid-template-columns: 1fr;
    justify-items: start;
}

.dashboard-theme .agent-traffic-toggle {
    display: flex;
    align-items: flex-end;
}

.dashboard-theme .square-check {
    width: calc(1.5rem + 2px);
    height: calc(1.5rem + 2px);
    border-radius: 6px;
    margin-top: 0;
}

.dashboard-theme .dash-grid {
    margin-top: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.dashboard-theme .dash-panel {
    padding: 1.25rem;
    border-radius: 20px;
    /* Bootstrap dropdown menus (e.g. the agents sort menu in the header)
       are rendered as siblings of their toggle button. Their parent
       .glass-card has overflow:hidden to clip the card's rounded corners,
       which also clips dropdowns that try to pop outside the card. The
       inner content of dash-panel doesn't need that clip — its cards live
       inside their own containers — so we let it overflow. */
    overflow: visible;
}

.dashboard-theme .dash-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.dashboard-theme .dash-panel-header h3 {
    margin: 0;
    font-size: 1.05rem;
    color: #f3f4f6;
}

.dashboard-theme .dash-panel-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.dashboard-theme .dash-panel-body {
    min-height: 80px;
}

.dashboard-theme .dash-list {
    display: grid;
    gap: 0.75rem;
}

.dashboard-theme .dash-item {
    background: #121212;
    border: 1px solid #242424;
    border-radius: 14px;
    padding: 0.75rem 0.9rem;
}

.dashboard-theme .dash-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.dashboard-theme .dash-item-title {
    font-weight: 600;
    color: #f3f4f6;
    font-size: 0.95rem;
}

.dashboard-theme .dash-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    color: #9ca3af;
    font-size: 0.82rem;
}

.dashboard-theme .dash-item-meta i {
    color: #84cc16;
    margin-left: 0.25rem;
}

.dashboard-theme .dash-password-form .form-label {
    font-size: 0.8rem;
    color: #cbd5e1;
}

.dashboard-theme .dash-password-form .form-control {
    background: #141414;
    border-color: #2a2a2a;
    color: var(--dashboard-text);
    border-radius: 10px;
}

.dashboard-theme .dash-password-form .form-control:focus {
    border-color: var(--dashboard-accent);
    box-shadow: 0 0 0 2px rgba(132, 204, 22, 0.2);
}

.dashboard-theme .dash-password-form .form-text {
    font-size: 0.75rem;
    color: var(--dashboard-muted);
}

.dashboard-theme .dash-note {
    background: #111111;
    border: 1px solid #242424;
    border-radius: 12px;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    height: 100%;
}

.dashboard-theme .table {
    color: #e5e7eb;
}

.dashboard-theme .table-dark {
    --bs-table-bg: #121212;
    --bs-table-border-color: rgba(255, 255, 255, 0.06);
}

.dashboard-theme .modal-content.bg-dark,
.dashboard-theme .modal-content.compact-modal {
    background: #0f0f0f;
    border: 1px solid #242424;
    border-radius: 16px;
    color: #f3f4f6;
}

.dashboard-theme .modal-header,
.dashboard-theme .modal-footer {
    border-color: #1f1f1f;
}

.dashboard-theme .modal-body {
    background: #0a0a0a;
}

.dashboard-theme .agent-card {
    border-radius: 12px;
    border-color: #242424;
}

/* ── Agents list toolbar ────────────────────────────────────────────────── */
/* Visual language matches the purchase-confirm/create-agent modals:
   subtle borders, compact paddings, lime accent on hover/active, dark fills. */
/* Panel header lives as: [title] [toolbar (search + sort/filter/view)] [ایجاد]
   The toolbar takes the middle slot and flex-grows so the title + create
   button stay on the edges. On narrow screens the title wraps to a new
   line, then the toolbar wraps below it, then the create button. */
.dashboard-theme .dash-panel-header.agents-panel-header {
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.dashboard-theme .agents-panel-header h3 {
    margin: 0;
    flex: 0 0 auto;
}
.dashboard-theme .agents-panel-header .dash-panel-actions {
    flex: 0 0 auto;
    margin-inline-start: auto;
}
.dashboard-theme .agents-panel-header .agents-toolbar {
    flex: 1 1 360px;
    margin: 0;
}
.dashboard-theme .agents-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 6px 0 10px;
    padding: 8px 10px;
    border: 1px solid #2a2a2a;
    border-radius: 11px;
    background: #131313;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.018);
}
.dashboard-theme .agents-toolbar-search {
    position: relative;
    flex: 1 1 260px;
    min-width: 220px;
}
.dashboard-theme .agents-toolbar-search i {
    position: absolute;
    inset-inline-start: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,.42);
    font-size: 13px;
    pointer-events: none;
}
.dashboard-theme .agents-toolbar-search input.form-control {
    height: 32px;
    min-height: 32px;
    padding-inline-start: 30px;
    background: #181818;
    border: 1px solid #2f2f2f;
    color: #f4f4f5;
    font-size: 12.5px;
    border-radius: 8px;
}
.dashboard-theme .agents-toolbar-search input.form-control:focus {
    border-color: rgba(132,204,22,.45);
    box-shadow: 0 0 0 1px rgba(132,204,22,.22);
    background: #181818;
}
.dashboard-theme .agents-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.dashboard-theme .agents-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 5px 11px;
    border: 1px solid #2f2f2f;
    border-radius: 8px;
    background: #181818;
    color: rgba(255,255,255,.78);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.dashboard-theme .agents-toolbar-btn:hover,
.dashboard-theme .agents-toolbar-btn.is-active {
    border-color: rgba(132,204,22,.45);
    color: #c7f284;
    background: rgba(132,204,22,.07);
}
.dashboard-theme .agents-sort-menu {
    background: #161616;
    border: 1px solid #2f2f2f;
    padding: 4px;
    border-radius: 9px;
    min-width: 200px;
    /* Sit above any panel/section that follows below in the page. The
       dropdown menu lives as a sibling of the toggle button inside
       .dash-panel-header — the next .glass-card panel creates its own
       stacking context that otherwise covers the menu's bottom rows. */
    z-index: 1080;
}
/* The toolbar's .dropdown wrapper itself needs a positive z-index so
   Popper's positioned menu inherits a stacking context above siblings. */
.dashboard-theme .agents-toolbar .dropdown { position: relative; z-index: 1080; }
.dashboard-theme .agents-sort-menu .dropdown-item {
    color: rgba(255,255,255,.78);
    font-size: 12px;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 6px;
}
.dashboard-theme .agents-sort-menu .dropdown-item:hover,
.dashboard-theme .agents-sort-menu .dropdown-item.is-active {
    background: rgba(132,204,22,.10);
    color: #c7f284;
}
.dashboard-theme .agents-sort-menu .dropdown-divider {
    border-color: #2a2a2a;
    margin: 4px 2px;
}
.dashboard-theme .agents-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #84cc16;
    color: #0b1404;
    font-size: 10px;
    font-weight: 900;
}
.dashboard-theme .agents-view-toggle {
    display: inline-flex;
    padding: 3px;
    border: 1px solid #2f2f2f;
    border-radius: 8px;
    background: #181818;
    gap: 2px;
}
.dashboard-theme .agents-view-btn {
    width: 30px;
    height: 26px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: rgba(255,255,255,.6);
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.dashboard-theme .agents-view-btn:hover {
    color: #c7f284;
}
.dashboard-theme .agents-view-btn.is-active {
    background: #1d1d1d;
    border-color: rgba(132,204,22,.35);
    color: #c7f284;
    box-shadow: inset 0 0 0 1px rgba(132,204,22,.16);
}
.dashboard-theme .agents-result-meta {
    margin: 0 2px 8px;
    color: rgba(255,255,255,.46);
    font-size: 11px;
    font-weight: 700;
    min-height: 14px;
}
.dashboard-theme .filter-range-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
}
.dashboard-theme .filter-range-sep {
    color: rgba(255,255,255,.46);
    font-size: 11.5px;
    font-weight: 750;
}

/* ── Row view (alternative to cards) ─────────────────────────────────────── */
.dashboard-theme .agents-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
/* Column-titles header — same visual language as the toolbar (dark fill,
   border, lime accent) but slightly slimmer. Uses the same grid template
   as .agent-row so titles line up with their cells. */
.dashboard-theme .agents-row-head {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 90px 90px 90px 110px auto;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    margin-bottom: 6px;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    background: #131313;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.018);
    color: rgba(255,255,255,.6);
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .2px;
}
.dashboard-theme .agents-row-head > span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}
.dashboard-theme .agents-row-head .head-name,
.dashboard-theme .agents-row-head .head-routers {
    text-align: start;
}
.dashboard-theme .agents-row-head .head-actions { text-align: center; }
@media (max-width: 900px) {
    .dashboard-theme .agents-row-head {
        grid-template-columns: minmax(0, 1fr) 80px 80px;
        gap: 8px;
    }
    .dashboard-theme .agents-row-head .head-routers,
    .dashboard-theme .agents-row-head .head-traffic,
    .dashboard-theme .agents-row-head .head-expiry {
        display: none;
    }
}
/* Shared grid template for the header row and every data row so columns
   line up pixel-perfect. Tweaking widths here must keep .agents-row-head
   in sync (they share the same template literal below in @media). */
.dashboard-theme .agents-row-head,
.dashboard-theme .agent-row {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 90px 90px 90px 80px 168px;
    gap: 12px;
}
.dashboard-theme .agent-row {
    display: grid;
    align-items: center;
    padding: 9px 12px;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    background: #161616;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.02);
    transition: border-color .15s ease, background .15s ease;
}
.dashboard-theme .agent-row:hover {
    border-color: rgba(132,204,22,.35);
    background: #181818;
}
.dashboard-theme .agent-row.is-inactive {
    border-color: rgba(248,113,113,.34);
    background: rgba(127,29,29,.08);
}
.dashboard-theme .agent-row-name {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.dashboard-theme .agent-row-name strong {
    color: #f4f4f5;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dashboard-theme .agent-row-name small {
    color: rgba(255,255,255,.5);
    font-size: 10.5px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dashboard-theme .agent-row-routers {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    min-width: 0;
}
.dashboard-theme .agent-row-routers .agent-router-badge {
    margin: 0;
    font-size: 10.5px;
    padding: 2px 7px;
}
/* One-line numeric cell — header label lives in .agents-row-head above. */
.dashboard-theme .agent-row-cell {
    color: rgba(255,255,255,.86);
    font-size: 12px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dashboard-theme .agent-row-cell.text-warning { color: #fbbf24; }
.dashboard-theme .agent-row-cell.text-danger  { color: #fb7185; }
.dashboard-theme .agent-row-cell-status { text-align: center; }
.dashboard-theme .agent-row-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 850;
}
.dashboard-theme .agent-row-status.is-active {
    background: rgba(132,204,22,.12);
    color: #bef264;
    border: 1px solid rgba(132,204,22,.32);
}
.dashboard-theme .agent-row-status.is-inactive {
    background: rgba(248,113,113,.12);
    color: #fecaca;
    border: 1px solid rgba(248,113,113,.32);
}
.dashboard-theme .agent-row-expiry {
    color: rgba(255,255,255,.78);
    font-size: 11px;
    font-weight: 750;
    direction: ltr;
    text-align: left;
}
.dashboard-theme .agent-row-expiry.text-warning { color: #fbbf24; }
.dashboard-theme .agent-row-expiry.text-danger  { color: #fb7185; }
.dashboard-theme .agent-row-actions {
    display: inline-flex;
    gap: 3px;
}
.dashboard-theme .agent-row-actions .btn {
    width: 28px;
    height: 28px;
    min-height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border-radius: 7px;
}
.dashboard-theme .agents-empty {
    padding: 30px 14px;
    text-align: center;
    color: rgba(255,255,255,.54);
    font-size: 13px;
    border: 1px dashed #2a2a2a;
    border-radius: 11px;
    background: rgba(255,255,255,.02);
}
@media (max-width: 900px) {
    .dashboard-theme .agent-row {
        grid-template-columns: minmax(0, 1fr) 80px 80px;
        gap: 8px;
    }
    .dashboard-theme .agent-row-routers,
    .dashboard-theme .agent-row-cell.metric-traffic,
    .dashboard-theme .agent-row-expiry {
        display: none;
    }
}

.dashboard-theme .agent-mini-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
}

.dashboard-theme .agent-mini-grid > div,
/* ── Agent-create wizard breadcrumb (step indicator) ───────────────────── */
.dashboard-theme .agent-wizard-steps {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: #8899aa;
    padding: 0.35rem 0.6rem;
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 8px;
}
.dashboard-theme .agent-wizard-step {
    padding: 0.18rem 0.55rem;
    border-radius: 12px;
    background: transparent;
    transition: background 0.15s, color 0.15s;
}
.dashboard-theme .agent-wizard-step.is-active {
    background: rgba(132, 204, 22, 0.18);
    color: #cdebab;
}
.dashboard-theme .agent-wizard-step.is-done {
    color: #84cc16;
}
.dashboard-theme .agent-wizard-step i { font-size: 0.74rem; margin-inline-end: 0.15rem; }
.dashboard-theme .agent-wizard-step-sep {
    opacity: 0.5;
}

/* ── Shared purchase-confirm modal styles (account.html + dashboard) ───── */
/* These were inlined in templates/account.html. Lifting them here so the
   dashboard's agent-purchase modal can reuse the exact same look. */
.purchase-confirm-grid { display: grid; gap: 14px; }
.purchase-confirm-card { display: grid; gap: 10px; padding: 13px; border: 1px solid #343434; border-radius: 10px; background: #1d1d1d; box-shadow: inset 0 0 0 1px rgba(255,255,255,.025); }
.purchase-confirm-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; color: rgba(255,255,255,.88); font-size: 13px; font-weight: 750; }
.purchase-confirm-label { color: #b7bec9; font-size: 12px; font-weight: 750; }
.purchase-confirm-value { color: #f4f4f5; font-size: 13px; font-weight: 850; text-align: left; }
.purchase-confirm-modal .form-label { color: #cbd0d8; font-size: 12px; font-weight: 800; margin-bottom: 6px; }
.purchase-confirm-modal .form-control { min-height: 38px; border: 1px solid #3a3a3a; border-radius: 7px; background: #202020; color: #f4f4f5; font-size: 13px; font-weight: 750; }
.purchase-confirm-modal .form-control:focus { border-color: #37e056; box-shadow: 0 0 0 1px rgba(55,224,86,.24); background: #202020; color: #fff; }
.purchase-preview-card { display: grid; gap: 8px; padding: 12px; border: 1px solid rgba(132,204,22,.24); border-radius: 10px; background: rgba(132,204,22,.055); }
.purchase-preview-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; color: rgba(255,255,255,.76); font-size: 12px; font-weight: 750; }
.purchase-preview-row strong { color: #f4f4f5; font-size: 13px; font-weight: 850; }
.purchase-preview-row strong.is-insufficient { color: #fb7185; }
.purchase-terms { display: flex; align-items: center; gap: 9px; margin-top: 14px; padding: 12px; border: 1px solid #343434; border-radius: 10px; background: #1d1d1d; color: #d6d6d6; font-size: 12px; font-weight: 700; line-height: 1.7; }
.purchase-terms .form-check-label { margin: 0; }
.purchase-terms .form-check-input { float: none; margin: 0; width: 16px; height: 16px; border-color: #4b5563; background-color: #202020; }
.purchase-terms .form-check-input:checked { background-color: #37e056; border-color: #37e056; }
.purchase-confirm-modal .modal-footer { gap: 10px; justify-content: flex-start; }
.purchase-action-btn { min-height: 38px; padding: 8px 16px; border-radius: 7px; border: 1px solid #3a3a3a; background: #151515; color: #dbe3ef; font-size: 13px; font-weight: 800; cursor: pointer; }
.purchase-action-btn:hover { background: #1e1e1e; border-color: #555; color: #fff; }
.purchase-action-btn.confirm { border-color: #27a649; background: #31d843; color: #07150a; }
.purchase-action-btn.confirm:hover { background: #3eea51; color: #061207; }
.purchase-action-btn.confirm:disabled { border-color: #2d4c32; background: #244129; color: rgba(255,255,255,.42); cursor: not-allowed; }

/* Days-remaining pill next to the expiry date in the packages table. */
.pkg-days { display: inline-block; margin-inline-start: 4px; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 999px; line-height: 1.6; }
.pkg-days-ok      { color: #22c55e; background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.35); }
.pkg-days-warn    { color: #f59e0b; background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.4); }
.pkg-days-danger  { color: #f87171; background: rgba(248,113,113,0.12); border: 1px solid rgba(248,113,113,0.4); }
.pkg-days.expired { color: #fb7185; background: rgba(251,113,133,0.12); border: 1px solid rgba(251,113,133,0.4); }

/* Wallet-modal toolbar — tabs on one side, the two buy buttons on the other. */
.dashboard-theme .agent-wallet-toolbar .agent-wallet-tabs { margin-bottom: 0; flex: 0 0 auto; }
.dashboard-theme .agent-wallet-toolbar { gap: 0.5rem; }
/* ───────────────────────────────────────────────────────────────────────── */

/* ── Wallet modal: active / history tab strip ──────────────────────────── */
.dashboard-theme .agent-wallet-tabs {
    border-bottom: 1px solid #242424;
    gap: 4px;
}
.dashboard-theme .agent-wallet-tabs .nav-link {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px 8px 0 0;
    color: #8899aa;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.4rem 0.85rem;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.dashboard-theme .agent-wallet-tabs .nav-link:hover {
    color: #e6edf5;
    background: #141414;
}
.dashboard-theme .agent-wallet-tabs .nav-link.active {
    background: #0d0d0d;
    color: #cdebab;
    border-color: #242424 #242424 #0d0d0d;
}
.dashboard-theme .agent-wallet-pager {
    border-top: 1px dashed #1f1f1f;
    padding-top: 0.55rem;
    margin-top: 0.55rem;
}
.dashboard-theme .agent-wallet-pager .btn-outline-secondary {
    border-color: #2a2a2a;
    color: #c8cfd9;
    background: #0d0d0d;
}
.dashboard-theme .agent-wallet-pager .btn-outline-secondary:hover:not(:disabled) {
    background: #1a1a1a;
    color: #fff;
    border-color: #3a3a3a;
}
.dashboard-theme .agent-wallet-pager .btn-outline-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
/* ───────────────────────────────────────────────────────────────────────── */

/* ── Cost-summary card shown on wizard step 2 ──────────────────────────── */
.dashboard-theme .agent-cost-summary {
    background: #0d0d0d;
    border: 1px solid #242424;
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
    font-size: 0.82rem;
    color: #c0c8d2;
}
.dashboard-theme .agent-cost-summary strong { color: #f0f4fa; }
/* ───────────────────────────────────────────────────────────────────────── */

/* ── Router badges on the agent card (one chip per assigned router) ─────── */
.dashboard-theme .agent-router-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}
/* Agent card: expiry line shown right under the router badges */
.dashboard-theme .agent-card-expiry {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
    font-size: 14px;
}

/* Compact package-card grid used inside the wallet modal */
.dashboard-theme .package-list-compact {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

/* The agent_subscription card sits next to peer cards — gold accent so it's
   visually distinct from "X کلاینت" peer packs. */
.dashboard-theme .agent-package-card-subscription {
    border-color: rgba(99, 102, 241, 0.42) !important;
    background: rgba(99, 102, 241, 0.08) !important;
}
.dashboard-theme .agent-package-card-subscription .agent-package-card-title {
    color: #c7d2fe;
}

.dashboard-theme .agent-router-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.5rem;
    background: rgba(132, 204, 22, 0.15);
    color: var(--accent-lime, #84cc16);
    border: 1px solid rgba(132, 204, 22, 0.4);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}
/* ───────────────────────────────────────────────────────────────────────── */

.dashboard-theme .agent-modal-card,
.dashboard-theme .agent-subscription-card {
    background: #0d0d0d;
    border: 1px solid #242424;
    border-radius: 10px;
}

.dashboard-theme .agent-mini-grid > div {
    min-height: 54px;
    padding: 0.55rem 0.65rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
}

.dashboard-theme .agent-mini-grid span,
.dashboard-theme .agent-subscription-card span {
    color: #a4adc0;
    font-size: 0.72rem;
    font-weight: 500;
}

.dashboard-theme .agent-mini-grid strong,
.dashboard-theme .agent-subscription-card strong {
    color: #f7f7f7;
    font-size: 0.86rem;
    font-weight: 600;
}

.dashboard-theme .agent-card-actions .btn {
    min-height: 34px;
    border-color: #2a2a2a;
}

.dashboard-theme .agent-clean-modal .modal-header {
    background: #0a0a0a;
    border-bottom: 1px solid #1f1f1f;
}

.dashboard-theme .agent-clean-modal .modal-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f7f7f7;
}

.dashboard-theme .agent-clean-modal .modal-body {
    background: #080808;
}

.dashboard-theme .agent-clean-modal .btn-close {
    display: none;
}

.dashboard-theme .agent-modal-card {
    padding: 0.65rem;
}

.dashboard-theme .agent-clean-modal .form-label {
    color: #a4adc0;
    font-size: 0.75rem;
    margin-bottom: 0.35rem;
}

.dashboard-theme .agent-clean-modal .form-control,
.dashboard-theme .agent-clean-modal .input-group-text {
    background: #171717;
    border-color: #303030;
    color: #f5f5f5;
    border-radius: 9px;
    font-size: 0.82rem;
}

.dashboard-theme .agent-clean-modal .form-control:focus {
    background: #1b1b1b;
    border-color: rgba(132, 204, 22, 0.7);
    box-shadow: 0 0 0 2px rgba(132, 204, 22, 0.18);
    color: #ffffff;
}

.dashboard-theme .agent-clean-modal .input-group-text {
    color: #84cc16;
    border-right: 0;
}

.dashboard-theme .agent-inline-add .input-group,
.dashboard-theme #agentAddCreditModal .input-group {
    width: 100%;
    flex-wrap: nowrap;
}

.dashboard-theme .agent-inline-add .input-group .form-control,
.dashboard-theme #agentAddCreditModal .input-group .form-control {
    min-width: 0;
}

.dashboard-theme .agent-inline-add .input-group .input-group-text,
.dashboard-theme #agentAddCreditModal .input-group .input-group-text {
    flex: 0 0 auto;
    white-space: nowrap;
}

.dashboard-theme .agent-clean-modal .form-control::placeholder {
    color: #5f6674;
    opacity: 1;
}

.dashboard-theme .agent-clean-modal .text-muted,
.dashboard-theme .agent-card .text-muted {
    color: #9aa3b5 !important;
}

.dashboard-theme .agent-clean-modal textarea.form-control {
    resize: vertical;
    min-height: 74px;
}

.dashboard-theme .agent-subscription-dialog {
    max-width: 520px;
}

.dashboard-theme .agent-subscription-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
}

.dashboard-theme .agent-subscription-card {
    min-height: 68px;
    padding: 0.65rem 0.7rem;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "label action"
        "value action";
    align-items: center;
    column-gap: 0.75rem;
}

.dashboard-theme .agent-subscription-card span {
    grid-area: label;
}

.dashboard-theme .agent-subscription-card strong {
    grid-area: value;
}

.dashboard-theme .agent-add-btn,
.dashboard-theme .agent-adjust-btn {
    grid-area: action;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    border: 1px solid rgba(132, 204, 22, 0.45);
    background: rgba(132, 204, 22, 0.1);
    color: #84cc16;
}

.dashboard-theme .agent-adjust-actions {
    grid-area: action;
    display: inline-flex;
    gap: 0.45rem;
}

.dashboard-theme .agent-decrease-btn {
    border-color: rgba(239, 68, 68, 0.45);
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
}

.dashboard-theme .agent-edit-btn {
    border-color: rgba(59, 130, 246, 0.45);
    background: rgba(59, 130, 246, 0.1);
    color: #bfdbfe;
}

.dashboard-theme .agent-add-btn:hover,
.dashboard-theme .agent-increase-btn:hover {
    background: #84cc16;
    color: #101010;
}

.dashboard-theme .agent-decrease-btn:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: #ffffff;
}

.dashboard-theme .agent-edit-btn:hover {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
}

.dashboard-theme .agent-add-back {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid #303030;
    background: #171717;
    color: #a4adc0;
}

.dashboard-theme .agent-add-back:hover {
    color: #84cc16;
    border-color: rgba(132, 204, 22, 0.45);
}

.dashboard-theme .agent-btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(16, 16, 16, 0.35);
    border-top-color: #101010;
    border-radius: 50%;
    display: inline-block;
    animation: agentSpin 0.75s linear infinite;
}

@keyframes agentSpin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 575.98px) {
    .dashboard-theme .agent-mini-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-theme .agent-clean-modal .modal-dialog {
        margin: 0.75rem;
    }
}

.xtunnel-notification-modal,
.xtunnel-notification-modal * {
    font-family: 'Vazirmatn', sans-serif;
}

.xtunnel-notification-modal .modal-dialog {
    width: min(440px, calc(100vw - 28px));
}

.xtunnel-notification-modal .xtunnel-notification-modal-content {
    background: #050505;
    border: 1px solid #3a3a3a;
    border-radius: 1.15rem;
    box-shadow: inset 0 0 0 1px #151515, 0 18px 50px rgba(0, 0, 0, 0.58);
    color: #f3f3f3;
    overflow: hidden;
}

.xtunnel-notification-modal .modal-header,
.xtunnel-notification-modal .modal-footer {
    background: #0f0f0f;
    border-color: #2f2f2f;
    padding: 0.85rem 1rem;
}

.xtunnel-notification-modal .modal-body {
    background: #050505;
    padding: 1rem;
}

.xtunnel-notification-modal .modal-title {
    color: #f3f3f3;
    font-size: 0.96rem;
    font-weight: 700;
}

.xtunnel-notification-modal .modal-title i {
    color: #8bd539;
}

.xtunnel-notification-modal .btn-close {
    filter: invert(1) grayscale(1);
    opacity: 0.65;
}

.xtunnel-notification-modal .btn-close:hover {
    opacity: 0.9;
}

.xtunnel-notification-prompt-card {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    min-height: 82px;
    padding: 14px;
    background: #0a0a0a;
    border: 1px solid #343434;
    border-radius: 1rem;
    box-shadow: inset 0 0 0 1px #151515, 0 8px 22px rgba(0, 0, 0, 0.45);
}

.xtunnel-notification-prompt-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 0.75rem;
    color: #8bd539;
    background: rgba(139, 213, 57, 0.08);
    border: 1px solid rgba(139, 213, 57, 0.32);
}

.xtunnel-notification-prompt-card p {
    color: #e2e2e2;
    font-size: 0.86rem;
    font-weight: 650;
    line-height: 1.8;
    text-align: right;
}

.xtunnel-notification-danger {
    color: #fb7185;
    font-weight: 900;
}

.xtunnel-agent-notification-modal .xtunnel-notification-prompt-icon {
    color: #fb7185;
    background: rgba(248, 113, 113, 0.08);
    border-color: rgba(248, 113, 113, 0.34);
}

.xtunnel-notification-modal .modal-footer {
    display: flex;
    gap: 0.65rem;
}

.xtunnel-notification-action {
    flex: 1 1 0;
    min-height: 38px;
    padding: 0.58rem 0.8rem;
    border-width: 1px;
    border-style: solid;
    border-radius: 0.65rem;
    background: #111111;
    color: #f3f3f3;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.xtunnel-notification-action:hover {
    background: #181818;
}

.xtunnel-notification-confirm {
    border-color: #27a649;
    color: #7df78b;
}

.xtunnel-notification-confirm:hover {
    background: #0c1f12;
    color: #a5ffb3;
}

.xtunnel-notification-cancel {
    border-color: #3a3a3a;
    color: #cfcfcf;
}

.xtunnel-notification-cancel:hover {
    background: #101010;
    border-color: #555;
    color: #f3f3f3;
}

@media (max-width: 480px) {
    .xtunnel-notification-modal .modal-footer {
        flex-direction: column-reverse;
    }

    .xtunnel-notification-action {
        width: 100%;
    }
}

/* ------------------------------------------------------------------
   Floating Contact FAB
   ------------------------------------------------------------------
   Bottom-right circular button. Click toggles `data-open="true"` on
   .contact-fab and the option chips animate upward from behind the
   main button (translate + scale + opacity). column-reverse keeps
   the chips ABOVE the toggle visually in DOM-after order.
*/
.contact-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1100;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    pointer-events: none; /* container is layout-only; children re-enable */
}

.contact-fab-toggle {
    pointer-events: auto;
    position: relative;
    z-index: 2;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #84cc16, #65a30d);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(132, 204, 22, 0.35), 0 2px 8px rgba(0, 0, 0, 0.35);
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.contact-fab-toggle:hover {
    transform: scale(1.06);
    box-shadow: 0 8px 22px rgba(132, 204, 22, 0.5), 0 3px 10px rgba(0, 0, 0, 0.4);
}
.contact-fab-toggle:focus-visible {
    outline: 2px solid #d8f59c;
    outline-offset: 3px;
}

/* Swap the toggle icon (chat ↔ X) based on open state */
.contact-fab-toggle .contact-fab-icon-open  { display: none; }
.contact-fab-toggle .contact-fab-icon-closed { display: inline-block; }
.contact-fab[data-open="true"] .contact-fab-toggle .contact-fab-icon-open  { display: inline-block; }
.contact-fab[data-open="true"] .contact-fab-toggle .contact-fab-icon-closed { display: none; }
.contact-fab[data-open="true"] .contact-fab-toggle {
    transform: rotate(0deg);
    background: linear-gradient(135deg, #5a8b10, #3f6308);
}

.contact-fab-options {
    pointer-events: none;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.contact-fab-option {
    pointer-events: auto;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-decoration: none;
    font-size: 22px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    /* Hidden state — start tucked behind the main button. */
    opacity: 0;
    transform: translateY(20px) scale(0.5);
    transition: opacity 0.25s ease,
                transform 0.3s cubic-bezier(0.5, 1.5, 0.5, 1);
}
.contact-fab[data-open="true"] .contact-fab-option {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Stagger the appearance when there are multiple options. The first
   option in DOM order is closest to the toggle and animates first;
   each subsequent option delays a bit so they cascade upward. */
.contact-fab[data-open="true"] .contact-fab-option:nth-child(1) { transition-delay: 0s;    }
.contact-fab[data-open="true"] .contact-fab-option:nth-child(2) { transition-delay: 0.04s; }
.contact-fab[data-open="true"] .contact-fab-option:nth-child(3) { transition-delay: 0.08s; }
.contact-fab[data-open="true"] .contact-fab-option:nth-child(4) { transition-delay: 0.12s; }

.contact-fab-telegram {
    background: #229ED9; /* official Telegram brand blue */
}
.contact-fab-telegram:hover {
    background: #1c8cc4;
    color: #fff;
}

/* Slightly tighter spacing on small phones so the FAB doesn't crowd
   the bottom-edge navigation bar (if any). */
@media (max-width: 480px) {
    .contact-fab { bottom: 16px; right: 16px; }
    .contact-fab-toggle { width: 50px; height: 50px; font-size: 20px; }
    .contact-fab-option { width: 44px; height: 44px; font-size: 20px; }
}
