:root {
    /* 明亮主题颜色系统 (Light Theme) */
    --bg-main: #f4f6fb;
    --bg-card: rgba(255, 255, 255, 0.88);
    --bg-card-hover: rgba(255, 255, 255, 0.98);
    --bg-sidebar: #ffffff;
    --border-color: rgba(226, 232, 240, 0.8);
    --border-hover: rgba(203, 213, 225, 1);
    
    --primary-gradient: linear-gradient(135deg, #e91e63 0%, #0284c7 100%);
    --accent-pink: #e91e63;
    --accent-blue: #0284c7;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --input-bg: #ffffff;
    --input-border: #cbd5e1;
    --table-header-bg: #f8fafc;
    --table-row-hover: #f1f5f9;
    --modal-overlay-bg: rgba(15, 23, 42, 0.45);
    
    --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-code: 'JetBrains Mono', monospace;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.06), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 20px 35px -10px rgba(0, 0, 0, 0.1);
}

/* 暗黑模式重载变量 */
body.dark-theme {
    --bg-main: #090d16;
    --bg-card: rgba(26, 34, 53, 0.75);
    --bg-card-hover: rgba(36, 47, 72, 0.85);
    --bg-sidebar: rgba(15, 23, 42, 0.9);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.18);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --input-bg: rgba(15, 23, 42, 0.6);
    --input-border: rgba(255, 255, 255, 0.12);
    --table-header-bg: rgba(255, 255, 255, 0.03);
    --table-row-hover: rgba(255, 255, 255, 0.05);
    --modal-overlay-bg: rgba(9, 13, 22, 0.85);
}

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

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(circle at 10% 15%, rgba(233, 30, 99, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 90% 85%, rgba(2, 132, 199, 0.07) 0%, transparent 40%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-main);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* 高级感玻璃摩砂面板 */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    transition: all 0.25s ease;
}

/* 按钮样式 */
.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px rgba(233, 30, 99, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.35);
}

.btn-secondary {
    background: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.btn-danger-sm {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.25);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger-sm:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-icon {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--table-row-hover);
    border-color: var(--border-hover);
}

/* 登录弹窗 Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--modal-overlay-bg);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.brand-header {
    text-align: center;
    margin-bottom: 28px;
}

.logo-badge {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: var(--primary-gradient);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(233, 30, 99, 0.3);
}

.logo-icon {
    font-size: 32px;
}

.brand-header h2 {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

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

/* 表单组件 */
.input-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.input-group input, .input-group textarea {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input:focus, .input-group textarea:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.full-width {
    width: 100%;
}

.error-msg {
    color: var(--accent-red);
    font-size: 0.85rem;
    margin-bottom: 16px;
    text-align: center;
    font-weight: 600;
}

/* 主布局 */
.main-layout {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    box-shadow: var(--shadow-sm);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 24px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.brand-logo {
    width: 42px;
    height: 42px;
    background: var(--primary-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.2);
}

.brand-text .title {
    display: block;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
}

.brand-text .subtitle {
    display: block;
    font-size: 0.75rem;
    color: var(--accent-blue);
    font-weight: 700;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: var(--table-row-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.25);
}

.sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 36px;
    height: 36px;
    background: rgba(2, 132, 199, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--accent-blue);
}

.user-details .username {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.user-details .role {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* 主内容 */
.content-area {
    flex: 1;
    padding: 32px 40px;
    overflow-y: auto;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.top-bar h1 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: var(--accent-green);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
}

.status-pill .dot {
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--accent-green);
}

/* 概览统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    padding: 24px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.users-bg { background: rgba(233, 30, 99, 0.1); }
.active-users-bg { background: rgba(2, 132, 199, 0.1); }
.nodes-bg { background: rgba(168, 85, 247, 0.1); }
.active-nodes-bg { background: rgba(16, 185, 129, 0.1); }

.stat-data .stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
}

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

/* 详细 Panel */
.panel {
    border-radius: var(--radius-md);
    padding: 28px;
}

.panel-header {
    margin-bottom: 20px;
}

.panel-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.guide-box {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.guide-item {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.step-num {
    width: 32px;
    height: 32px;
    background: var(--primary-gradient);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
}

.step-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.code-badge {
    display: inline-block;
    margin-top: 8px;
    background: var(--table-header-bg);
    color: var(--accent-blue);
    font-family: var(--font-code);
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-weight: 600;
}

/* 表格与操作 */
.table-actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 16px;
}

.search-box input {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    width: 280px;
    outline: none;
}

.table-container {
    border-radius: var(--radius-md);
    overflow-x: auto;
}

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

.data-table th, .data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.data-table th {
    background: var(--table-header-bg);
    color: var(--text-secondary);
    font-weight: 700;
}

.data-table tbody tr:hover {
    background: var(--table-row-hover);
}

.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-proto {
    background: rgba(2, 132, 199, 0.1);
    color: var(--accent-blue);
    border: 1px solid rgba(2, 132, 199, 0.25);
}

.badge-active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-expired {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* 代码/JSON 预览面板 */
.json-preview {
    background: #0f172a;
    color: #38bdf8;
    font-family: var(--font-code);
    padding: 16px;
    border-radius: var(--radius-sm);
    max-height: 260px;
    overflow-y: auto;
    font-size: 0.82rem;
    margin-top: 10px;
}

/* 二级菜单 Sub Nav Tabs */
.sub-nav-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 12px;
}

.sub-nav-item {
    background: transparent;
    border: none;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.sub-nav-item:hover {
    color: var(--text-primary);
    background: var(--table-row-hover);
}

.sub-nav-item.active {
    color: var(--accent-blue);
    background: rgba(2, 132, 199, 0.1);
    box-shadow: inset 0 -2px 0 var(--accent-blue);
}

.sub-tab-content {
    display: none;
}

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

/* 进度条与硬件监控卡片 */
.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.info-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    padding-top: 8px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px;
    background: var(--input-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.info-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.info-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-code);
}

/* 3x-ui 风格多功能筛选器 */
.filter-group {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.select-filter {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    outline: none;
    font-size: 0.88rem;
    cursor: pointer;
}

/* 3x-ui 客户端芯片 Badges */
.chip-green {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.25);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

.chip-purple {
    background: rgba(168, 85, 247, 0.12);
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.25);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

.chip-blue {
    background: rgba(14, 165, 233, 0.12);
    color: #0ea5e9;
    border: 1px solid rgba(14, 165, 233, 0.25);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

.status-online-dot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #10b981;
    font-weight: 600;
    font-size: 0.85rem;
}

.status-online-dot::before {
    content: '';
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
}

.status-offline-dot {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* 客户端表格专用进度条 */
.client-progress-bar {
    width: 130px;
    height: 6px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.client-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.client-progress-fill.blue {
    background: linear-gradient(90deg, #38bdf8, #0284c7);
}

.client-progress-fill.purple {
    background: linear-gradient(90deg, #c084fc, #9333ea);
}

.client-progress-fill.red {
    background: linear-gradient(90deg, #f87171, #dc2626);
}

/* iOS Style Switch Toggle */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
    border-radius: 20px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #0284c7;
}

input:checked + .toggle-slider:before {
    transform: translateX(18px);
}

.tab-content {
    display: none;
}

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

.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.form-row input {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 6px;
    flex: 1;
}

/* 模态框扩展 */
.modal-card {
    border-radius: var(--radius-md);
    padding: 32px;
    width: 100%;
    max-width: 480px;
}

.modal-card.wide {
    max-width: 650px;
}

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

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

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