* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
}
/* 左侧菜单 */
.sidebar {
    width: 155px;
    min-width: 155px;
    background: #0f1629;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.06);
}
.sidebar-header {
    padding: 14px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-header h2 {
    font-size: 14px;
    color: #fff;
    margin-bottom: 2px;
}
.sidebar-header .ver {
    font-size: 11px;
    background: #28a745;
    padding: 1px 6px;
    border-radius: 3px;
    color: #fff;
}
.sidebar-menu {
    flex: 1;
    padding: 12px 0;
}
.menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    color: rgba(255,255,255,0.55);
    font-size: 13px;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}
.menu-item:hover {
    color: #fff;
    background: rgba(255,255,255,0.04);
}
.menu-item.active {
    color: #4a9eff;
    background: rgba(74,158,255,0.08);
    border-left-color: #4a9eff;
}
.menu-icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 12px;
    color: rgba(255,255,255,0.4);
}
.sidebar-footer .user {
    color: #495057;
    margin-bottom: 8px;
}
.sidebar-footer .btn-logout {
    background: rgba(255,107,107,0.15);
    color: #ff6b6b;
    border: 1px solid rgba(255,107,107,0.25);
    padding: 5px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 11px;
    width: 100%;
}
.sidebar-footer .btn-logout:hover { background: rgba(255,107,107,0.25); }

/* 右侧内容 */
.main {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}
.page {
    display: none;
}
.page.active {
    display: block;
}
.page-title {
    font-size: 20px;
    color: #fff;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* 卡片 */
.card {
    background: #16213e;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(255,255,255,0.06);
}
.card h3 {
    font-size: 14px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 12px;
    font-weight: 500;
}

/* 数据总览卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.stat-card {
    background: #16213e;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid rgba(255,255,255,0.06);
}
.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #4a9eff;
}
.stat-card .stat-label {
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    margin-top: 4px;
}
.stat-card.green .stat-value { color: #28a745; }
.stat-card.orange .stat-value { color: #ffc107; }

/* 表格 */
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
th {
    color: rgba(255,255,255,0.4);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}
td { font-size: 13px; }
tr:hover td { background: rgba(255,255,255,0.02); }
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}
.badge-active { background: rgba(40,167,69,0.15); color: #28a745; }
.badge-disabled { background: rgba(255,107,107,0.15); color: #ff6b6b; }

/* 表单 */
.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.form-group label {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
}
.form-group input, .form-group select, .form-group textarea {
    padding: 8px 12px;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: rgba(74,158,255,0.5);
}
.form-group input::placeholder, .form-group textarea::placeholder {
    color: rgba(255,255,255,0.2);
}

/* ===== 根治所有select/option白底白字问题 ===== */
select {
    background-color: #1a1f2e;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 13px;
    outline: none;
}
select option {
    background-color: #1a1f2e;
    color: #fff;
}
/* Chrome/Edge Windows下原生下拉面板强制暗色 */
@supports (color-scheme: dark) {
    select {
        color-scheme: dark;
    }
}
select:focus {
    border-color: rgba(74,158,255,0.5);
}

.form-group input { border-color: #4a9eff; }

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    transition: transform 0.1s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, #4a9eff, #2d6cdf); color: #fff; }
.btn-success { background: linear-gradient(135deg, #28a745, #1e7e34); color: #fff; }
.btn-warning { background: linear-gradient(135deg, #ffc107, #e0a800); color: #1a1a2e; }
.btn-danger { background: linear-gradient(135deg, #dc3545, #b02a37); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-ghost { background: rgba(255,255,255,0.08); color: #ccc; }

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    z-index: 1000;
    animation: slideIn 0.3s ease;
    display: none;
}
.toast.success { background: #28a745; }
.toast.error { background: #dc3545; }
@keyframes slideIn {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}


/* 协议设置 */
.agreement-card {
    background: #16213e;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid rgba(255,255,255,0.06);
}
.agreement-card .agr-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.agreement-card .agr-title {
    font-size: 16px;
    color: #fff;
    font-weight: 600;
}
.agreement-card .agr-meta {
    font-size: 12px;
    color: rgba(255,255,255,0.4);
}
.agreement-card .agr-content {
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    padding: 16px;
    max-height: 300px;
    overflow-y: auto;
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    line-height: 1.8;
}
.agreement-card .agr-content h2 { font-size: 18px; color: #fff; margin-bottom: 8px; }
.agreement-card .agr-content h3 { font-size: 14px; color: #4a9eff; margin: 12px 0 6px; }
.agreement-card .agr-content ul { padding-left: 20px; }
.agreement-card .agr-content li { margin-bottom: 4px; }
/* 富文本编辑器 */
.agr-editor-toolbar {
    display: flex;
    gap: 4px;
    padding: 8px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px 8px 0 0;
    border: 1px solid rgba(255,255,255,0.08);
    border-bottom: none;
}
.agr-editor-toolbar button {
    width: 32px; height: 32px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    color: #ccc;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.agr-editor-toolbar button:hover {
    background: rgba(74,158,255,0.2);
    color: #4a9eff;
}
.agr-editor {
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
    padding: 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 0 0 8px 8px;
    color: #e0e0e0;
    font-size: 13px;
    line-height: 1.8;
    outline: none;
}
.agr-editor:focus {
    border-color: rgba(74,158,255,0.4);
}
.agr-editor h2 { font-size: 18px; color: #fff; margin-bottom: 8px; }
.agr-editor h3 { font-size: 14px; color: #4a9eff; margin: 12px 0 6px; }
.agr-editor ul, .agr-editor ol { padding-left: 20px; }
.agr-editor li { margin-bottom: 4px; }
.agr-editor a { color: #4a9eff; }
.agr-btn-row {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.loading { text-align: center; color: rgba(255,255,255,0.3); padding: 24px; }
.empty { text-align: center; color: rgba(255,255,255,0.2); padding: 24px; font-size: 13px; }

/* 服务器监控 */
.mon-bar-wrap {
    background: rgba(255,255,255,0.08);
    border-radius: 6px;
    height: 22px;
    overflow: hidden;
    position: relative;
}
.mon-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.6s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    min-width: 40px;
}
.mon-bar-fill.green { background: linear-gradient(90deg, #28a745, #34d058); }
.mon-bar-fill.orange { background: linear-gradient(90deg, #ffc107, #e0a800); color: #1a1a2e; }
.mon-bar-fill.red { background: linear-gradient(90deg, #dc3545, #ff6b6b); }
.mon-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.mon-stat-label { font-size: 13px; color: rgba(255,255,255,0.6); }
.mon-stat-value { font-size: 13px; color: #fff; font-weight: 500; }
.proc-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}
.proc-badge.running { background: rgba(40,167,69,0.15); color: #28a745; }
.proc-badge.stopped { background: rgba(255,107,107,0.15); color: #ff6b6b; }
.proc-badge.unknown { background: rgba(255,193,7,0.15); color: #ffc107; }

/* v214.2.68: 监控页面健康状态可视化 */
/* 异常告警条 */
.mon-alert-bar {
    background: linear-gradient(90deg, rgba(220,53,69,0.18), rgba(220,53,69,0.08));
    border: 1px solid rgba(220,53,69,0.5);
    border-left: 4px solid #dc3545;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    animation: monAlertPulse 2s ease-in-out infinite;
}
@keyframes monAlertPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220,53,69,0.3); }
    50% { box-shadow: 0 0 12px 2px rgba(220,53,69,0.25); }
}
.mon-alert-title {
    font-size: 14px;
    font-weight: 600;
    color: #ff6b6b;
    margin-bottom: 8px;
}
.mon-alert-item {
    font-size: 13px;
    color: rgba(255,255,255,0.85);
    padding: 3px 0;
    line-height: 1.5;
}
.mon-alert-item.critical { color: #ff6b6b; }
.mon-alert-item.warning { color: #ffc107; }
.mon-alert-item strong { color: #fff; }

/* 健康状态总览 */
.mon-health-overview {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}
.mon-health-dashboard {
    width: 110px;
    height: 110px;
    min-width: 110px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 4px solid;
    box-shadow: 0 0 24px rgba(0,0,0,0.3);
    transition: all 0.4s ease;
}
.mon-health-dashboard.normal {
    border-color: #28a745;
    background: radial-gradient(circle, rgba(40,167,69,0.25), rgba(40,167,69,0.05));
    box-shadow: 0 0 20px rgba(40,167,69,0.3);
}
.mon-health-dashboard.warning {
    border-color: #ffc107;
    background: radial-gradient(circle, rgba(255,193,7,0.25), rgba(255,193,7,0.05));
    box-shadow: 0 0 20px rgba(255,193,7,0.3);
}
.mon-health-dashboard.critical {
    border-color: #dc3545;
    background: radial-gradient(circle, rgba(220,53,69,0.3), rgba(220,53,69,0.05));
    box-shadow: 0 0 24px rgba(220,53,69,0.4);
    animation: monCriticalPulse 1.5s ease-in-out infinite;
}
@keyframes monCriticalPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}
.mon-health-icon {
    font-size: 42px;
    font-weight: 700;
    line-height: 1;
}
.mon-health-dashboard.normal .mon-health-icon { color: #28a745; }
.mon-health-dashboard.warning .mon-health-icon { color: #ffc107; }
.mon-health-dashboard.critical .mon-health-icon { color: #ff6b6b; }
.mon-health-text {
    font-size: 16px;
    font-weight: 600;
    margin-top: 4px;
    color: #fff;
}
.mon-health-summary {
    flex: 1;
    min-width: 200px;
}
.mon-health-title {
    font-size: 16px;
    color: #fff;
    font-weight: 600;
    margin-bottom: 10px;
}
.mon-health-counts {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.mon-health-count {
    font-size: 14px;
    padding: 4px 12px;
    border-radius: 6px;
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.6);
    border: 1px solid rgba(255,255,255,0.06);
}
.mon-health-count.normal { color: #28a745; background: rgba(40,167,69,0.1); border-color: rgba(40,167,69,0.3); }
.mon-health-count.warning { color: #ffc107; background: rgba(255,193,7,0.1); border-color: rgba(255,193,7,0.3); }
.mon-health-count.critical { color: #ff6b6b; background: rgba(220,53,69,0.12); border-color: rgba(220,53,69,0.4); }
.mon-health-tip {
    font-size: 12px;
    color: rgba(255,255,255,0.4);
}

/* 关键指标卡片 */
.mon-key-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.mon-metric-card {
    background: #16213e;
    border-radius: 8px;
    padding: 14px 16px;
    border: 1px solid rgba(255,255,255,0.06);
    border-left: 3px solid #28a745;
    transition: all 0.3s ease;
}
.mon-metric-card.normal {
    border-left-color: #28a745;
}
.mon-metric-card.warning {
    border-left-color: #ffc107;
    background: linear-gradient(90deg, rgba(255,193,7,0.08), #16213e 40%);
    box-shadow: 0 0 0 1px rgba(255,193,7,0.2);
}
.mon-metric-card.critical {
    border-left-color: #dc3545;
    background: linear-gradient(90deg, rgba(220,53,69,0.12), #16213e 40%);
    box-shadow: 0 0 0 1px rgba(220,53,69,0.3);
    animation: monMetricCritical 1.8s ease-in-out infinite;
}
@keyframes monMetricCritical {
    0%, 100% { box-shadow: 0 0 0 1px rgba(220,53,69,0.3); }
    50% { box-shadow: 0 0 12px 1px rgba(220,53,69,0.4); }
}
.mon-metric-label {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 6px;
}
.mon-metric-value {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}
.mon-metric-card.warning .mon-metric-value { color: #ffc107; }
.mon-metric-card.critical .mon-metric-value { color: #ff6b6b; }
.mon-metric-detail {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    margin-top: 4px;
    line-height: 1.4;
}

/* 弹窗 */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 999;
    align-items: center;
    justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
    background: #16213e;
    border-radius: 12px;
    padding: 24px;
    width: 480px;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.1);
}
.modal h3 { font-size: 16px; color: #fff; margin-bottom: 16px; }
.modal .btn-close {
    float: right; background: none; border: none;
    color: rgba(255,255,255,0.4); font-size: 20px; cursor: pointer;
}

/* 版本策略 */
.policy-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.policy-item {
    background: rgba(255,255,255,0.03);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.06);
}
.policy-item .pval {
    font-size: 22px;
    font-weight: 600;
    color: #4a9eff;
    margin-top: 4px;
}
.toggle-switch {
    position: relative;
    width: 48px; height: 26px;
    display: inline-block;
}
.toggle-switch input { display: none; }
.toggle-slider {
    position: absolute; inset: 0;
    background: rgba(255,255,255,0.2);
    border-radius: 13px; cursor: pointer;
    transition: 0.3s;
}
.toggle-slider:before {
    content: ''; position: absolute;
    width: 20px; height: 20px; border-radius: 50%;
    background: #fff; top: 3px; left: 3px;
    transition: 0.3s;
}
input:checked + .toggle-slider { background: #28a745; }
input:checked + .toggle-slider:before { transform: translateX(22px); }

/* Tab切换 — 暗色pill风格 */
.tabs {
    display: flex;
    gap: 4px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    padding: 3px;
    margin-bottom: 12px;
}
.tab-btn {
    padding: 7px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: rgba(255,255,255,0.45);
    transition: all 0.2s;
    font-family: inherit;
}
.tab-btn:hover {
    color: rgba(255,255,255,0.7);
    background: rgba(255,255,255,0.04);
}
.tab-btn.active {
    color: #fff;
    background: rgba(74,158,255,0.18);
    font-weight: 500;
}
