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

:root {
    --bg: #f0f4f8;
    --bg-card: #ffffff;
    --bg-sidebar: linear-gradient(180deg, #1a1f36 0%, #0d1025 100%);
    --bg-sidebar-solid: #1a1f36;
    --text: #1a1f36;
    --text-secondary: #5a6178;
    --text-muted: #8f95a8;
    --border: #e1e5ee;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #eef2ff;
    --primary-fg: #ffffff;
    --success: #10b981;
    --success-hover: #059669;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --danger-hover: #dc2626;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --accent: #8b5cf6;
    --accent-light: #ede9fe;
    --cyan: #06b6d4;
    --cyan-light: #cffafe;
    --orange: #f97316;
    --orange-light: #ffedd5;
    --pink: #ec4899;
    --pink-light: #fce7f3;
    --sidebar-text: #a5adc6;
    --sidebar-active: rgba(99,102,241,.2);
    --sidebar-hover: rgba(255,255,255,.06);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.03);
    --shadow: 0 2px 8px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.04);
    --shadow-md: 0 8px 24px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.04);
    --shadow-lg: 0 16px 48px rgba(0,0,0,.1), 0 4px 12px rgba(0,0,0,.05);
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #06d6a0 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
    --gradient-cyan: linear-gradient(135deg, #06b6d4 0%, #6366f1 100%);
    --gradient-warm: linear-gradient(135deg, #f97316 0%, #ec4899 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    --sidebar-width: 264px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: radial-gradient(ellipse at 30% 0%, rgba(99,102,241,.15) 0%, transparent 70%);
    pointer-events: none;
}

.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
}

.sidebar-brand-icon {
    width: 42px;
    height: 42px;
    background: var(--gradient-primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(99,102,241,.3);
}

.sidebar-brand h2 {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    letter-spacing: -.01em;
}

.sidebar-brand small {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.sidebar-nav { padding: 16px 12px; flex: 1; position: relative; }

.sidebar-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.25);
    padding: 12px 12px 8px;
    font-weight: 700;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all .2s cubic-bezier(.4,0,.2,1);
    margin-bottom: 3px;
    position: relative;
}

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
    text-decoration: none;
    transform: translateX(2px);
}

.sidebar-link.active {
    background: var(--sidebar-active);
    color: #fff;
    font-weight: 600;
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.sidebar-link svg, .sidebar-link .icon {
    width: 18px;
    height: 18px;
    opacity: .6;
    flex-shrink: 0;
}

.sidebar-link.active svg, .sidebar-link.active .icon { opacity: 1; }

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,.06);
}

.sidebar-close {
    display: none;
    position: absolute;
    top: 20px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255,255,255,.1);
    border-radius: 8px;
    cursor: pointer;
    color: #fff;
    align-items: center;
    justify-content: center;
    z-index: 60;
    transition: background .2s;
}
.sidebar-close:hover { background: rgba(239,68,68,.3); }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 45;
}

.main { margin-left: var(--sidebar-width); flex: 1; min-height: 100vh; transition: margin-left .25s cubic-bezier(.4,0,.2,1); }

.main-header {
    padding: 18px 32px;
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.sidebar-toggle {
    display: none;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text-secondary);
    align-items: center;
    justify-content: center;
    transition: all .2s;
    flex-shrink: 0;
}
.sidebar-toggle:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.main-content { padding: 28px 32px; }

.page-title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -.02em;
    background: linear-gradient(135deg, var(--text) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 2px;
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    transition: all .25s cubic-bezier(.4,0,.2,1);
    position: relative;
    overflow: hidden;
}

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

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
    border-color: rgba(99,102,241,.2);
}

.stat-card:hover::after { opacity: 1; }

.stat-card:nth-child(2)::after { background: var(--gradient-success); }
.stat-card:nth-child(3)::after { background: var(--gradient-danger); }
.stat-card:nth-child(4)::after { background: var(--gradient-success); }
.stat-card:nth-child(5)::after { background: var(--gradient-cyan); }

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.stat-label svg { opacity: .5; }

.stat-value {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -.03em;
}

.stat-value.success { color: var(--success); }
.stat-value.danger { color: var(--danger); }
.stat-value.primary { color: var(--primary); }
.stat-value.accent { color: var(--accent); }
.stat-value.cyan { color: var(--cyan); }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: box-shadow .2s;
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.card-body { padding: 24px; }
.card-body.no-pad { padding: 0; }

.summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-radius: var(--radius);
    margin-bottom: 10px;
    transition: transform .15s;
}

.summary-row:hover { transform: translateX(4px); }

.summary-row.success-bg { background: linear-gradient(135deg, rgba(16,185,129,.08) 0%, rgba(6,214,160,.08) 100%); border-left: 3px solid var(--success); }
.summary-row.danger-bg { background: linear-gradient(135deg, rgba(239,68,68,.08) 0%, rgba(249,115,22,.08) 100%); border-left: 3px solid var(--danger); }
.summary-row.primary-bg { background: linear-gradient(135deg, rgba(99,102,241,.08) 0%, rgba(139,92,246,.08) 100%); border-left: 3px solid var(--primary); }

.summary-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.summary-value { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.summary-value.success { color: var(--success); }
.summary-value.danger { color: var(--danger); }
.summary-value.primary { color: var(--primary); }

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    align-items: start;
}

table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 13px 18px;
    text-align: left;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}
th {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: linear-gradient(180deg, #f8f9fc 0%, #f0f2f7 100%);
}

tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(99,102,241,.03); }
tr:last-child td { border-bottom: none; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: .01em;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-secondary { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-accent { background: var(--accent-light); color: var(--accent); }
.badge-cyan { background: var(--cyan-light); color: #0e7490; }

.badge-dot::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all .2s cubic-bezier(.4,0,.2,1);
    text-decoration: none;
    line-height: 1.4;
    letter-spacing: -.01em;
    font-family: inherit;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.btn-primary {
    background: var(--gradient-primary);
    color: var(--primary-fg);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(99,102,241,.25);
}
.btn-primary:hover { box-shadow: 0 4px 16px rgba(99,102,241,.35); }

.btn-success {
    background: var(--gradient-success);
    color: #fff;
    box-shadow: 0 2px 8px rgba(16,185,129,.25);
}
.btn-success:hover { box-shadow: 0 4px 16px rgba(16,185,129,.35); }

.btn-danger {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239,68,68,.2);
}
.btn-danger:hover { background: var(--danger-hover); box-shadow: 0 4px 16px rgba(239,68,68,.3); }

.btn-warning {
    background: var(--gradient-warning);
    color: #fff;
    box-shadow: 0 2px 8px rgba(245,158,11,.25);
}
.btn-warning:hover { box-shadow: 0 4px 16px rgba(245,158,11,.4); }

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }

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

.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }

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

.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 7px;
    color: var(--text);
    letter-spacing: -.01em;
}
.form-input {
    width: 100%;
    padding: 11px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text);
    transition: all .2s cubic-bezier(.4,0,.2,1);
    outline: none;
}
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99,102,241,.1);
}
.form-input::placeholder { color: var(--text-muted); }

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

.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}
.alert-success {
    background: linear-gradient(135deg, rgba(16,185,129,.08) 0%, rgba(6,214,160,.08) 100%);
    color: #065f46;
    border: 1px solid rgba(16,185,129,.2);
}
.alert-danger {
    background: linear-gradient(135deg, rgba(239,68,68,.08) 0%, rgba(249,115,22,.08) 100%);
    color: #991b1b;
    border: 1px solid rgba(239,68,68,.2);
}

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

.router-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow);
    transition: all .25s cubic-bezier(.4,0,.2,1);
    position: relative;
    overflow: hidden;
}

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

.router-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    border-color: rgba(6,182,212,.2);
}

.router-card-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}

.router-icon {
    width: 44px;
    height: 44px;
    background: var(--gradient-cyan);
    color: white;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(6,182,212,.25);
}

.router-name { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.router-host {
    font-size: 13px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 3px;
}

.router-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-muted);
}

.empty-icon {
    width: 72px;
    height: 72px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    font-size: 28px;
    color: white;
    box-shadow: 0 8px 24px rgba(99,102,241,.2);
}

.empty-state h3 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 14px; max-width: 360px; margin: 0 auto; color: var(--text-secondary); }

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

.login-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99,102,241,.08) 0%, transparent 70%);
    pointer-events: none;
}

.login-container::after {
    content: '';
    position: absolute;
    bottom: -30%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(16,185,129,.06) 0%, transparent 70%);
    pointer-events: none;
}

.login-box { width: 100%; max-width: 420px; position: relative; z-index: 1; }

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    font-size: 28px;
    font-weight: 700;
}

.login-icon.admin {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 8px 24px rgba(99,102,241,.25);
}
.login-icon.client {
    background: var(--gradient-success);
    color: white;
    box-shadow: 0 8px 24px rgba(16,185,129,.25);
}

.login-header h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -.02em;
}

.login-header p { color: var(--text-secondary); font-size: 15px; margin-top: 6px; }

.login-footer {
    text-align: center;
    padding-top: 20px;
    margin-top: 20px;
    border-top: 1px solid var(--border);
}

.client-header {
    background: rgba(255,255,255,.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.client-user {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.client-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--gradient-success);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(16,185,129,.2);
    flex-shrink: 0;
}

.client-name {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.client-sub { font-size: 12px; color: var(--text-muted); font-weight: 500; }

.client-content { max-width: 720px; margin: 32px auto; padding: 0 24px; }

.status-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    transition: all .25s;
}

.status-card:hover { box-shadow: var(--shadow-md); }
.status-card.active { border-color: rgba(16,185,129,.3); background: linear-gradient(135deg, rgba(16,185,129,.02) 0%, rgba(6,214,160,.02) 100%); }
.status-card.disconnected { border-color: rgba(239,68,68,.3); background: linear-gradient(135deg, rgba(239,68,68,.02) 0%, rgba(249,115,22,.02) 100%); }

.status-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
}

.status-icon.active {
    background: var(--gradient-success);
    color: white;
    box-shadow: 0 6px 20px rgba(16,185,129,.25);
}
.status-icon.disconnected {
    background: var(--gradient-danger);
    color: white;
    box-shadow: 0 6px 20px rgba(239,68,68,.25);
}

.status-info { flex: 1; min-width: 0; }
.status-info-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.status-info-value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.status-info-value.active { color: var(--success); }
.status-info-value.disconnected { color: var(--danger); }

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    transition: all .25s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

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

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

.info-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.info-card-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.info-card-value { font-size: 22px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,16,37,.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    animation: modalIn .25s cubic-bezier(.4,0,.2,1);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-body { padding: 24px; }

.btn-close {
    background: var(--bg);
    border: 1px solid var(--border);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
    line-height: 1;
}

.btn-close:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-light); }

.chart-legend {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.chart-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    flex-shrink: 0;
}

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: flex; }
    .sidebar-overlay.show { display: block; }
    .main { margin-left: 0; }
    .sidebar-toggle { display: flex; }
}

@media (max-width: 768px) {
    .main-content { padding: 20px 16px; }
    .main-header { padding: 14px 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 16px; }
    .stat-value { font-size: 22px; }
    .grid-2 { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .router-grid { grid-template-columns: 1fr; }
    .client-content { padding: 0 12px; margin: 20px auto; }
    .client-header { padding: 12px 16px; }
    .status-card { padding: 20px; flex-wrap: wrap; }
    .status-info-value { font-size: 20px; }
    .status-icon { width: 48px; height: 48px; }
    .card-header { padding: 14px 18px; }
    .card-body { padding: 18px; }
    .summary-value { font-size: 18px; }
    .page-title { font-size: 20px; }
    .login-header h1 { font-size: 24px; }
    .login-box { max-width: 100%; }
    th, td { padding: 10px 12px; font-size: 13px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .status-card > div:first-child { gap: 12px; }
    .info-card-value { font-size: 18px; }
}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.text-mono { font-family: 'JetBrains Mono', monospace; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 12px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
