:root {
  --primary: #667eea;
  --text-1: #1f2937; --text-2: #4b5563; --text-3: #6b7280; --text-4: #9ca3af;
  --bg-1: #fff; --bg-2: #f9fafb; --bg-3: #f3f4f6; --border: #e5e7eb;
  --success: #10b981; --danger: #ef4444; --warning: #f59e0b;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg-2); color: var(--text-1); font-size: 14px; }

/* ========== Toast（统一：顶部居中、深色） ========== */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: rgba(31,41,55,.95); color: #fff; padding: 10px 20px; border-radius: 8px; font-size: 13px; z-index: 9999; display: none; }
.toast.success { background: #10b981; }
.toast.error { background: #ef4444; }
.toast.warning { background: #f59e0b; }
.toast.info { background: rgba(31,41,55,.95); }

/* ========== 顶栏（统一：浅色） ========== */
.settings-page { max-width: 1100px; margin: 0 auto; padding: 0 20px; height: 100vh; display: flex; flex-direction: column; }
.top-bar { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: 16px 0; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-2); z-index: 10; }
.top-left { display: flex; align-items: center; gap: 16px; }
.back-link { display: flex; align-items: center; gap: 6px; color: var(--text-3); text-decoration: none; font-size: 13px; transition: color .2s; }
.back-link:hover { color: var(--primary); }
.page-title { font-size: 20px; font-weight: 600; color: var(--text-1); }
.top-right { display: flex; align-items: center; gap: 12px; }
.admin-name { color: var(--text-2); font-size: 13px; }
.btn { border: 1px solid var(--border); background: var(--bg-1); color: var(--text-2); padding: 7px 14px; border-radius: 8px; font-size: 13px; cursor: pointer; transition: all .2s; }
.btn:hover { background: var(--bg-2); }
.btn-default { background: var(--bg-1); color: var(--text-2); border-color: var(--border); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: #5a6fd6; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-danger { color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }

/* ========== 主体布局 ========== */
.settings-body { flex: 1; display: flex; overflow: hidden; }

/* ========== 左侧站点列表 ========== */
.site-sidebar { width: 280px; background: var(--bg-1); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-header { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.sidebar-header h2 { font-size: 14px; font-weight: 600; color: var(--text-1); }
.btn-add { border: 1px solid var(--primary); background: var(--primary); color: #fff; padding: 5px 12px; border-radius: 8px; font-size: 12px; font-weight: 500; cursor: pointer; transition: all .2s; }
.btn-add:hover { background: #5a6fd6; }

.site-list { flex: 1; overflow-y: auto; padding: 8px; }
.site-list::-webkit-scrollbar { width: 4px; }
.site-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.site-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; cursor: pointer; transition: all .15s; margin-bottom: 4px; }
.site-item:hover { background: var(--bg-2); }
.site-item.active { background: #eef2ff; }
.site-item.active .site-name-text { color: var(--primary); }
.site-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--success); }
.site-dot.disabled { background: var(--text-4); }
.site-info-mini { flex: 1; min-width: 0; }
.site-name-text { font-size: 13px; font-weight: 500; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-id-text { font-size: 11px; color: var(--text-4); }
.site-badge-invite { font-size: 10px; padding: 1px 6px; border-radius: 8px; background: #eef2ff; color: var(--primary); white-space: nowrap; }
.loading-hint { padding: 20px; text-align: center; color: var(--text-4); font-size: 13px; }

/* ========== 右侧配置区 ========== */
.site-config { flex: 1; overflow-y: auto; padding: 20px 24px; }
.site-config::-webkit-scrollbar { width: 6px; }
.site-config::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.config-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--text-4); gap: 12px; }
.config-empty p { font-size: 14px; }
.config-form { max-width: 800px; }

/* ========== 配置区段 ========== */
.config-section { background: var(--bg-1); border-radius: 12px; padding: 18px 20px; margin-bottom: 14px; border: 1px solid var(--border); }
.section-title { font-size: 14px; font-weight: 600; color: var(--text-1); margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.form-group label .required { color: var(--danger); }
.form-hint { font-size: 11px; color: var(--text-4); margin-top: 2px; }

.form-input { border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; font-size: 13px; color: var(--text-1); background: var(--bg-1); outline: none; transition: all .2s; font-family: inherit; width: 100%; }
.form-input:focus { border-color: var(--primary); }
.form-input:disabled { background: var(--bg-2); color: var(--text-4); cursor: not-allowed; }
.form-textarea { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 13px; color: var(--text-1); background: var(--bg-1); outline: none; transition: all .2s; resize: vertical; min-height: 38px; font-family: inherit; line-height: 1.5; }
.form-textarea:focus { border-color: var(--primary); }
.color-preview { width: 100%; height: 28px; border-radius: 6px; margin-top: 4px; background: var(--primary); border: 1px solid var(--border); transition: background .3s; }

/* ========== 语言设置 ========== */
.lang-checkboxs { display: flex; flex-wrap: wrap; gap: 8px 16px; padding-top: 2px; }
.lang-chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.lang-chk input[type=checkbox] { width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary); }
.lang-chk input[type=checkbox]:disabled { cursor: not-allowed; }
.lang-chk input[type=checkbox]:disabled + span { color: var(--text-4); }

/* ========== 多语言标签页编辑 ========== */
.i18n-tabs { width: 100%; }
.i18n-tab-bar { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 0; }
.i18n-tab { border: 1px solid var(--border); border-bottom: none; background: var(--bg-2); color: var(--text-3); padding: 6px 14px; font-size: 12px; cursor: pointer; border-radius: 8px 8px 0 0; transition: all .15s; font-family: inherit; }
.i18n-tab:hover { background: var(--bg-1); color: var(--text-2); }
.i18n-tab.active { background: var(--bg-1); color: var(--primary); border-color: var(--border); position: relative; }
.i18n-tab.active::after { content: ""; position: absolute; left: -1px; right: -1px; bottom: -1px; height: 2px; background: var(--bg-1); }
.i18n-tab:disabled { cursor: not-allowed; opacity: .6; }
.i18n-default-mark { display: inline-block; font-size: 10px; padding: 0 5px; border-radius: 8px; background: #eef2ff; color: var(--primary); margin-left: 4px; vertical-align: middle; }
.i18n-panes { border: 1px solid var(--border); border-top: none; border-radius: 0 0 8px 8px; overflow: hidden; }
.i18n-pane { display: none; padding: 0; }
.i18n-pane.active { display: block; }
.i18n-textarea { width: 100%; border: none !important; border-radius: 0 !important; min-height: 70px; resize: vertical; font-family: inherit; line-height: 1.5; }
.i18n-textarea:focus { border-color: var(--primary) !important; box-shadow: inset 0 0 0 1px var(--primary); }

/* ========== 开关样式 ========== */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: var(--border); border-radius: 22px; transition: .3s; }
.slider::before { content: ""; position: absolute; height: 16px; width: 16px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .3s; }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ========== 邀请预览 ========== */
.invite-section .section-title { border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.invite-config-body { margin-top: 14px; }
.invite-config-body.disabled { opacity: 0.4; pointer-events: none; }
.invite-preview { margin-top: 14px; padding: 14px; background: var(--bg-2); border-radius: 10px; border: 1px dashed var(--border); }
.preview-label { font-size: 12px; color: var(--text-4); display: block; margin-bottom: 10px; }
.preview-box { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.06); width: fit-content; min-width: 300px; }
.preview-box.style-popup { border-radius: 10px; }
.preview-box.style-card { background: var(--primary); flex-direction: column; align-items: stretch; gap: 8px; }
.preview-box.style-bar { border-radius: 10px 10px 0 0; flex-direction: row; }
.preview-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; background: var(--primary); }
.preview-box.style-card .preview-avatar { background: rgba(255,255,255,0.25); }
.preview-info { flex: 1; min-width: 0; }
.preview-box.style-card .preview-info { text-align: center; }
.preview-name { font-size: 13px; font-weight: 600; color: var(--text-1); }
.preview-box.style-card .preview-name { color: #fff; }
.preview-text { font-size: 12px; color: var(--text-3); line-height: 1.4; }
.preview-box.style-card .preview-text { color: rgba(255,255,255,0.9); }
.preview-btn { padding: 6px 14px; border: none; border-radius: 8px; background: var(--primary); color: #fff; font-size: 12px; font-weight: 500; cursor: pointer; }
.preview-box.style-card .preview-btn { width: 100%; }

/* ========== 操作按钮 ========== */
.config-actions { display: flex; gap: 10px; padding: 14px 0; }
.btn-save { border: 1px solid var(--primary); background: var(--primary); color: #fff; padding: 8px 24px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .2s; }
.btn-save:hover { background: #5a6fd6; }
.btn-disable { padding: 8px 18px; border: 1px solid var(--danger); border-radius: 8px; background: transparent; color: var(--danger); font-size: 13px; font-weight: 500; cursor: pointer; transition: all .2s; }
.btn-disable:hover { background: #fef2f2; }

/* ========== 弹窗（统一） ========== */
.modal { display: none; }
.modal.show { display: block; }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1000; }
.modal-box { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--bg-1); border-radius: 12px; z-index: 1001; width: 420px; max-width: 90vw; max-height: 85vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { border: none; background: none; font-size: 18px; color: var(--text-4); cursor: pointer; width: 28px; height: 28px; border-radius: 50%; }
.modal-close:hover { background: var(--bg-2); }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-body .form-group { margin-bottom: 14px; }
.modal-footer { padding: 12px 18px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--border); }
.btn-cancel { border: 1px solid var(--border); background: var(--bg-1); color: var(--text-2); padding: 7px 16px; border-radius: 8px; font-size: 13px; cursor: pointer; transition: all .2s; }
.btn-cancel:hover { background: var(--bg-2); }
.btn-confirm { border: 1px solid var(--primary); background: var(--primary); color: #fff; padding: 7px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; transition: all .2s; }
.btn-confirm:hover { background: #5a6fd6; }
