:root {
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    --accent: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --sidebar: #0f172a;
    --sidebar-hover: #1e293b;
    --radius: 14px;
    --shadow: 0 4px 24px rgba(15, 23, 42, .06);
    --shadow-lg: 0 12px 40px rgba(15, 23, 42, .1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ========== 登录页 ========== */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 40%, #312e81 100%);
    position: relative;
    overflow: hidden;
}
.login-screen::before {
    content: "";
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(79,70,229,.25) 0%, transparent 70%);
    top: -200px; right: -100px;
}
.login-card {
    background: var(--card);
    padding: 48px 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    width: 420px;
    position: relative;
    z-index: 1;
}
.login-brand {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin-bottom: 32px;
}
.login-card input:first-of-type {
    margin-top: 0;
}
.login-card input {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: .95rem;
    transition: border-color .2s, box-shadow .2s;
}
.login-card input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.login-error { color: var(--danger); font-size: .85rem; margin-top: 10px; min-height: 1.2em; }

/* ========== 布局 ========== */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    background: var(--sidebar);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar-brand {
    padding: 28px 24px 20px;
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.06);
    letter-spacing: -.02em;
}
.sidebar-brand small { display: block; font-size: .72rem; font-weight: 400; color: #64748b; margin-top: 4px; }
.sidebar nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    margin-bottom: 4px;
    border-radius: 10px;
    color: #94a3b8;
    cursor: pointer;
    transition: all .2s;
    font-size: .92rem;
    font-weight: 500;
    text-decoration: none;
}
.sidebar nav a:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.sidebar nav a.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 14px rgba(79,70,229,.35);
}
.nav-icon { width: 20px; text-align: center; font-size: 1rem; opacity: .9; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    background: var(--card);
    padding: 18px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar h2 { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-meta { font-size: .85rem; color: var(--text-muted); }
.topbar-server-time {
    font-size: .82rem; color: var(--text-muted); font-variant-numeric: tabular-nums;
    padding: 4px 10px; border-radius: 8px; background: #f8fafc; border: 1px solid var(--border);
    white-space: nowrap;
}
#content { padding: 28px 32px; flex: 1; }
.page { display: none; animation: fadeIn .3s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ========== 按钮 ========== */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: .9rem;
    transition: transform .15s, box-shadow .15s;
    box-shadow: 0 2px 8px rgba(79,70,229,.25);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(79,70,229,.35); }
.btn-block { width: 100%; }
.btn-sm {
    background: transparent;
    color: var(--text-muted);
    border: 1.5px solid var(--border);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: .85rem;
    transition: all .15s;
}
.btn-sm:hover { border-color: var(--danger); color: var(--danger); background: #fef2f2; }
.btn-outline {
    background: var(--card);
    border: 1.5px solid var(--border);
    padding: 7px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: .85rem;
    color: var(--text);
    transition: all .15s;
    margin-right: 6px;
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* ========== 统计卡片 ========== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; margin-bottom: 28px; }
.stat-card {
    background: var(--card);
    padding: 22px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card::after {
    content: "";
    position: absolute;
    top: 0; right: 0;
    width: 80px; height: 80px;
    border-radius: 0 0 0 80px;
    opacity: .08;
}
.stat-card.purple::after { background: var(--primary); }
.stat-card.cyan::after { background: var(--accent); }
.stat-card.green::after { background: var(--success); }
.stat-card.orange::after { background: var(--warning); }
.stat-card.red::after { background: var(--danger); }
.stat-label { font-size: .82rem; color: var(--text-muted); font-weight: 500; margin-bottom: 8px; }
.stat-card h3 { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.stat-card.purple h3 { color: var(--primary); }
.stat-card.cyan h3 { color: var(--accent); }
.stat-card.green h3 { color: var(--success); }
.stat-card.orange h3 { color: var(--warning); }
.stat-card.red h3 { color: var(--danger); }
.stat-trend { font-size: .78rem; color: var(--success); margin-top: 8px; }

/* ========== 图表 & 面板 ========== */
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; margin-bottom: 24px; }
.panel {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 24px;
}
.panel-title { font-size: 1rem; font-weight: 700; margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; }
.panel-title span { font-size: .8rem; color: var(--text-muted); font-weight: 400; }
.chart-wrap { position: relative; height: 280px; }

.rank-list { list-style: none; }
.rank-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.rank-item:last-child { border-bottom: none; }
.rank-num {
    width: 28px; height: 28px;
    border-radius: 8px;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 700;
    color: var(--text-muted);
}
.rank-item:nth-child(1) .rank-num { background: #fef3c7; color: #b45309; }
.rank-item:nth-child(2) .rank-num { background: #f1f5f9; color: #475569; }
.rank-item:nth-child(3) .rank-num { background: #ffedd5; color: #c2410c; }
.rank-info { flex: 1; min-width: 0; }
.rank-name { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-meta { font-size: .78rem; color: var(--text-muted); }
.rank-value { font-weight: 700; color: var(--primary); font-size: .95rem; }

/* ========== 表格 ========== */
.toolbar { margin-bottom: 20px; display: flex; gap: 12px; align-items: center; }
.tenant-toolbar { flex-wrap: wrap; }
.tenant-toolbar .message-search-input { flex: 1; min-width: 240px; max-width: 420px; }
.clone-section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px 12px;
    margin-top: 8px;
}
.clone-section-item { display: flex; align-items: center; gap: 6px; font-size: .9rem; }

/* 复刻方式：卡片单选 */
.clone-mode-form-row > label:first-child { margin-bottom: 10px; }
.clone-mode-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
}
@media (max-width: 640px) {
    .clone-mode-grid { grid-template-columns: 1fr; }
}
.clone-mode-option {
    display: block;
    margin: 0;
    cursor: pointer;
}
.clone-mode-option input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.clone-mode-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    height: 100%;
    min-height: 72px;
    padding: 14px 16px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: #fafbfc;
    transition: border-color .2s, background .2s, box-shadow .2s;
}
.clone-mode-option:hover .clone-mode-card {
    border-color: #cbd5e1;
    background: #fff;
}
.clone-mode-option input:checked + .clone-mode-card {
    border-color: #4f46e5;
    background: linear-gradient(135deg, #f5f3ff, #eef2ff);
    box-shadow: 0 2px 10px rgba(79, 70, 229, .12);
}
.clone-mode-radio {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    background: #fff;
    flex-shrink: 0;
    position: relative;
    transition: border-color .2s, background .2s;
}
.clone-mode-option input:checked + .clone-mode-card .clone-mode-radio {
    border-color: #4f46e5;
    background: #4f46e5;
}
.clone-mode-option input:checked + .clone-mode-card .clone-mode-radio::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    border-radius: 50%;
    background: #fff;
}
.clone-mode-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}
.clone-mode-text strong {
    font-size: .92rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.35;
}
.clone-mode-text small {
    font-size: .8rem;
    color: var(--text-muted);
    line-height: 1.45;
    font-weight: 400;
}
.data-table {
    width: 100%;
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    border-collapse: separate;
    border-spacing: 0;
}
.data-table th {
    padding: 14px 18px;
    text-align: left;
    background: #f8fafc;
    font-weight: 600;
    font-size: .8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
}
.data-table td { padding: 14px 18px; border-bottom: 1px solid var(--border); font-size: .9rem; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f8fafc; }

/* ========== 表单 ========== */
.form-card {
    background: var(--card);
    padding: 28px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}
.redis-status-box { margin-top: 4px; }
.redis-status-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    margin-bottom: 14px;
    font-size: .88rem;
    color: var(--muted);
}
.redis-status-meta strong { color: var(--text); }
.redis-status-table code { font-size: .78rem; background: #f1f5f9; padding: 2px 6px; border-radius: 4px; }
.redis-status-table .redis-desc { font-size: .82rem; color: var(--muted); max-width: 320px; }
.redis-module-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: .78rem;
    font-weight: 600;
    background: #eef2ff;
    color: #4338ca;
}
.redis-status-err { color: #b91c1c; font-size: .88rem; margin: 0; }
.form-row { margin-bottom: 18px; }
.form-row label { display: block; margin-bottom: 6px; font-weight: 600; font-size: .88rem; color: var(--text); }
.form-row input, .form-row textarea, .form-row select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: .92rem;
    transition: border-color .2s;
}
.form-row input:focus, .form-row textarea:focus, .form-row select:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.form-check-row { margin-bottom: 16px; }
.form-check-label,
label.form-check-label,
.form-row > .form-check-label,
.form-card > .form-check-label,
.modal-body-inner .form-check-label,
label:has(> input[type=checkbox]):not(.menu-switch-item) {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: .88rem;
    font-weight: 500;
    color: var(--text);
    margin: 0;
    line-height: 1.4;
}
.form-check-label input[type=checkbox],
label:has(> input[type=checkbox]):not(.menu-switch-item) input[type=checkbox] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--primary);
}
.form-check-label span { user-select: none; }
/* form-row 内勾选框不再使用 block 标签样式 */
.form-row > label:has(input[type=checkbox]) {
    display: inline-flex;
    margin-bottom: 0;
    font-weight: 500;
}

/* ========== 菜单开关 ========== */
.menu-form-card { padding: 24px 28px 12px; }
.menu-group { margin-bottom: 28px; }
.menu-group:last-child { margin-bottom: 8px; }
.menu-group-head { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.menu-group-head h4 { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.menu-group-head p { font-size: .82rem; color: var(--text-muted); margin: 0; }
.menu-switch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.menu-switch-item { cursor: pointer; display: block; }
.menu-switch-item input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.menu-switch-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: #fafbfc;
    transition: border-color .2s, background .2s, box-shadow .2s;
}
.menu-switch-item:hover .menu-switch-card { border-color: #cbd5e1; background: #fff; }
.menu-switch-item input:checked + .menu-switch-card {
    border-color: #0891b2;
    background: linear-gradient(135deg, #f0fdfa, #ecfeff);
    box-shadow: 0 2px 8px rgba(8,145,178,.12);
}
.menu-switch-icon {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    background: #fff;
    border-radius: 10px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.menu-switch-item input:checked + .menu-switch-card .menu-switch-icon {
    border-color: #99f6e4;
    background: #fff;
}
.menu-switch-label { flex: 1; font-size: .9rem; font-weight: 600; color: var(--text); }
.menu-switch-toggle {
    width: 40px; height: 22px;
    border-radius: 11px;
    background: #cbd5e1;
    position: relative;
    flex-shrink: 0;
    transition: background .2s;
}
.menu-switch-toggle::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
    transition: transform .2s;
}
.menu-switch-item input:checked + .menu-switch-card .menu-switch-toggle { background: #0891b2; }
.menu-switch-item input:checked + .menu-switch-card .menu-switch-toggle::after { transform: translateX(18px); }
.form-actions { margin-top: 4px; }

.trend-fallback { margin-top: 8px; }
.trend-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.trend-table th, .trend-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.trend-table th { color: var(--text-muted); font-weight: 600; font-size: .78rem; }

.info-card {
    background: var(--card);
    padding: 28px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    line-height: 2;
}
.info-card b { color: var(--text-muted); font-weight: 500; }

.item-list { margin-top: 16px; }
.item-card {
    background: var(--card);
    padding: 16px 22px;
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color .15s;
}
.item-card:hover { border-color: var(--primary-light); }
.item-card-muted { opacity: .75; }
.item-card-main { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.item-card-meta { display: flex; align-items: center; gap: 8px; margin: 0 12px; }
.item-card-actions { display: flex; gap: 8px; flex-shrink: 0; }
.message-body { flex-direction: column; align-items: flex-start; gap: 4px; }
.message-body div { font-size: .9rem; line-height: 1.5; }
.logo-preview-sm { width: 48px; height: 48px; }
.i18n-sync-hint {
    margin-left: 6px;
    font-weight: 400;
    font-size: .78rem;
    color: var(--text-muted);
}

/* ========== 页面排版 ========== */
.layout-page-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
    padding: 18px 22px;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 55%, #faf5ff 100%);
    border: 1px solid #ddd6fe;
    border-radius: 14px;
    box-shadow: 0 4px 18px rgba(109, 40, 217, .07);
}
.layout-page-icon {
    width: 42px; height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem; flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(109, 40, 217, .28);
}
.layout-page-info { flex: 1; }
.layout-page-info h4 { margin: 0 0 4px; font-size: .98rem; font-weight: 700; }
.layout-page-info p { margin: 0; font-size: .82rem; color: var(--text-muted); line-height: 1.5; }
.layout-save-status {
    font-size: .78rem; font-weight: 600; padding: 4px 10px; border-radius: 20px;
    white-space: nowrap; align-self: center;
}
.layout-save-saving { background: #fef3c7; color: #b45309; }
.layout-save-ok { background: #d1fae5; color: #047857; }
.layout-save-err { background: #fee2e2; color: #b91c1c; }
.layout-page-actions { margin-top: 4px; }

.layout-page-tabs {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-bottom: 16px;
}
.layout-page-tab {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--card);
    font-size: .82rem; font-weight: 600; color: var(--text);
    cursor: pointer; transition: border-color .2s, background .2s, color .2s;
}
.layout-page-tab:hover { border-color: #c4b5fd; background: #faf5ff; }
.layout-page-tab.active {
    border-color: #7c3aed; background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    color: #6d28d9;
}
.layout-page-tab-count {
    min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 10px; background: rgba(109, 40, 217, .12);
    font-size: .72rem; display: inline-flex; align-items: center; justify-content: center;
}
.layout-page-tab.active .layout-page-tab-count { background: #7c3aed; color: #fff; }

.block-type-picker {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px;
}
.block-type-card {
    display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
    padding: 12px 14px; border-radius: 12px;
    border: 2px solid var(--border); background: #fafafa;
    cursor: pointer; text-align: left; transition: border-color .2s, background .2s;
}
.block-type-card:hover { border-color: #c4b5fd; background: #faf5ff; }
.block-type-card.active { border-color: #7c3aed; background: #f5f3ff; }
.block-type-card-icon { font-size: 1.3rem; }
.block-type-card-label { font-size: .88rem; font-weight: 700; color: var(--text); }
.block-type-card-desc { font-size: .72rem; color: var(--text-muted); line-height: 1.4; }

.modal-select {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border);
    border-radius: 8px; font-size: .9rem; background: #fff;
}

.block-list { margin: 0 0 16px; display: flex; flex-direction: column; gap: 12px; }
.block-empty {
    text-align: center; padding: 48px 24px;
    background: var(--card); border: 2px dashed var(--border);
    border-radius: 14px; color: var(--text-muted);
}
.block-empty-icon { font-size: 2rem; margin-bottom: 10px; opacity: .6; }
.block-empty p { margin: 0 0 6px; font-weight: 600; color: var(--text); font-size: .95rem; }
.block-empty span { font-size: .82rem; }

.block-item {
    display: flex; gap: 0;
    background: var(--card);
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: border-color .2s, box-shadow .2s, transform .15s;
}
.block-item:hover { border-color: #c4b5fd; box-shadow: 0 6px 20px rgba(109, 40, 217, .08); }
.block-item.block-item-hidden { opacity: .72; background: #fafafa; }
.block-item.dragging { opacity: .55; border-color: #7c3aed; transform: scale(.985); }

.block-drag-handle {
    width: 36px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(180deg, #f5f3ff, #ede9fe);
    color: #a78bfa; font-size: .9rem; font-weight: 700;
    cursor: grab; user-select: none; letter-spacing: -2px;
    border-right: 1px solid #ede9fe;
}
.block-item:active .block-drag-handle { cursor: grabbing; }

.block-item-body { flex: 1; padding: 14px 18px; min-width: 0; }
.block-item-top {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
    margin-bottom: 12px;
}
.block-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 20px;
    font-size: .75rem; font-weight: 600;
}
.block-badge-banner { background: #ede9fe; color: #6d28d9; }
.block-badge-html, .block-badge-custom { background: #e0f2fe; color: #0369a1; }
.block-badge-image { background: #fce7f3; color: #be185d; }
.block-badge-stats { background: #ffedd5; color: #c2410c; }
.block-badge-advantage { background: #ecfccb; color: #4d7c0f; }
.block-badge-default { background: #f1f5f9; color: #64748b; }
.block-page-select {
    font-size: .72rem; color: var(--text);
    background: #f8fafc; padding: 4px 8px; border-radius: 6px;
    border: 1px solid var(--border); cursor: pointer;
}
.block-title-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; margin-bottom: 6px;
}
.block-title-row > label:first-child { margin: 0; }
.block-title-toggle { flex-shrink: 0; }
.block-title-toggle .block-toggle-text { font-size: .72rem; color: var(--text-muted); }

.message-fields-card {
    margin-bottom: 16px;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 55%, #f8fafc 100%);
    border: 1px solid #bbf7d0; border-radius: 14px; overflow: hidden;
}
.message-fields-head {
    display: flex; gap: 12px; width: 100%; padding: 14px 16px;
    align-items: center; text-align: left;
    background: transparent; border: none; cursor: pointer;
    font: inherit; color: inherit;
}
.message-fields-head:hover { background: rgba(255, 255, 255, .45); }
.message-fields-icon {
    width: 36px; height: 36px; border-radius: 10px; background: #10b981; color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0;
}
.message-fields-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.message-fields-title { font-size: .95rem; font-weight: 700; }
.message-fields-desc { font-size: .8rem; color: var(--text-muted); line-height: 1.4; }
.message-fields-chevron {
    width: 28px; height: 28px; flex-shrink: 0; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #059669; font-size: .85rem; transition: transform .2s;
}
.message-fields-chevron::before { content: '▾'; }
.message-fields-card.collapsed .message-fields-chevron { transform: rotate(-90deg); }
.message-fields-card.collapsed .message-fields-desc { display: none; }
.message-fields-body {
    padding: 0 16px 16px;
    border-top: 1px solid rgba(187, 247, 208, .8);
}
.message-fields-card.collapsed .message-fields-body { display: none; }
.message-fields-toolbar { margin: 12px 0; gap: 8px; flex-wrap: wrap; }
.contact-field-list { display: flex; flex-direction: column; gap: 10px; }
.contact-field-item {
    display: flex; background: var(--card); border: 1px solid var(--border);
    border-radius: 12px; overflow: hidden; box-shadow: var(--shadow);
    transition: border-color .2s, box-shadow .2s, transform .15s;
}
.contact-field-item:hover { border-color: #86efac; box-shadow: 0 4px 16px rgba(16, 185, 129, .1); }
.contact-field-item.contact-field-hidden { opacity: .72; background: #fafafa; }
.contact-field-item.dragging { opacity: .55; border-color: #10b981; transform: scale(.985); }
.contact-field-item.drag-over { border-color: #10b981; box-shadow: 0 0 0 2px rgba(16, 185, 129, .2); }
.contact-field-item .block-drag-handle {
    background: linear-gradient(180deg, #ecfdf5, #d1fae5);
    color: #10b981; border-right: 1px solid #bbf7d0;
}
.contact-field-item .block-drag-handle:active { cursor: grabbing; }
.contact-field-body { flex: 1; padding: 12px 14px; }
.contact-field-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.contact-field-name { color: var(--text-muted); font-size: .78rem; }
.contact-field-toggle { margin-left: auto; }
.contact-field-actions { display: flex; gap: 8px; }
.message-list-section { margin-top: 8px; }
.message-list-title { margin: 0 0 12px; font-size: .95rem; font-weight: 700; }

.message-list-toolbar {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
    margin-bottom: 14px; padding: 12px 14px;
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
}
.message-search-input {
    flex: 1; min-width: 200px; padding: 9px 12px;
    border: 1px solid var(--border); border-radius: 8px; font-size: .9rem;
}
.message-search-input:focus { outline: none; border-color: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, .12); }
.message-filter-bar { margin: 0; gap: 8px; flex-wrap: wrap; }
.message-filter-bar .btn-outline.active { border-color: #10b981; background: #ecfdf5; color: #047857; }
.message-pagination { margin-top: 12px; }
.message-pagination-bar { justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; }
.message-page-info { font-size: .85rem; color: var(--text-muted); }
.message-page-hint { margin: 8px 0 0; text-align: center; }

.message-toolbar { margin-bottom: 12px; gap: 8px; }
.message-toolbar .btn-outline.active { border-color: #7c3aed; background: #f5f3ff; color: #6d28d9; }
.chat-panel { max-height: 320px; overflow-y: auto; padding: 12px; background: #f8fafc; border-radius: 10px; border: 1px solid var(--border); }
.chat-line { margin-bottom: 10px; line-height: 1.5; }
.chat-line b { display: block; font-size: .78rem; color: var(--text-muted); margin-bottom: 2px; }
.chat-line-staff b { color: #6d28d9; }

.form-grid-2 {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px;
}
@media (max-width: 768px) {
    .form-grid-2 { grid-template-columns: 1fr; }
}
.badge-purple { background: #f3e8ff; color: #7e22ce; }
.im-settings-section-title {
    font-size: .88rem; font-weight: 700; color: var(--text);
    margin-top: 4px; padding-top: 8px; border-top: 1px dashed var(--border);
}
.im-avatar-upload { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.im-avatar-preview {
    width: 56px; height: 56px; border-radius: 50%; overflow: hidden;
    border: 1px solid var(--border); background: #f8fafc; flex-shrink: 0;
}
.im-avatar-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.im-avatar-empty {
    display: flex; align-items: center; justify-content: center;
    font-size: .68rem; color: var(--text-muted); text-align: center; padding: 4px;
}
.im-avatar-btn { cursor: pointer; position: relative; }
.im-avatar-btn input { display: none; }
.im-settings-card { margin-bottom: 16px; }
.im-settings-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-bottom: 12px;
}
.im-settings-head h4 { margin: 0; font-size: 1rem; }
.im-settings-body { display: flex; flex-direction: column; gap: 12px; }
.im-settings-card.im-settings-collapsed .im-settings-body { display: none; }
.im-settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.im-online-badge {
    font-size: .78rem; font-weight: 600; padding: 4px 10px; border-radius: 999px;
    background: #dcfce7; color: #15803d;
}
.im-online-badge.im-badge-offline { background: #f3f4f6; color: #6b7280; }
.im-toggle-label {
    display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none;
    font-size: .88rem;
}
.im-toggle-label input { display: none; }
.im-toggle-ui {
    width: 40px; height: 22px; border-radius: 11px; background: #d1d5db; position: relative; flex-shrink: 0;
    transition: background .2s;
}
.im-toggle-ui::after {
    content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
    border-radius: 50%; background: #fff; transition: transform .2s;
}
.im-toggle-label input:checked + .im-toggle-ui { background: #7c3aed; }
.im-toggle-label input:checked + .im-toggle-ui::after { transform: translateX(18px); }
.im-quick-replies {
    grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px;
}
.im-quick-replies[hidden] { display: none !important; }
.im-quick-btn {
    font-size: .78rem; padding: 5px 10px; border-radius: 999px;
    border: 1px solid #ddd6fe; background: #faf5ff; color: #6d28d9; cursor: pointer;
    max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.im-quick-btn:hover { background: #f5f3ff; border-color: #c4b5fd; }

.im-workspace {
    display: grid; grid-template-columns: 300px 1fr; gap: 16px;
    min-height: calc(100vh - 140px);
}
.im-sidebar {
    background: var(--card); border: 1px solid var(--border); border-radius: 14px;
    display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow);
}
.im-sidebar-head { padding: 14px 14px 10px; border-bottom: 1px solid var(--border); }
.im-sidebar-title { margin: 0 0 10px; font-size: .95rem; }
.im-filter-bar { margin: 0; gap: 6px; flex-wrap: wrap; }
.im-filter-bar .btn-outline.active { border-color: #7c3aed; background: #f5f3ff; color: #6d28d9; }
.im-session-list { flex: 1; overflow-y: auto; padding: 8px; }
.im-session-empty { padding: 16px 10px; text-align: center; }
.im-session-item {
    display: block; width: 100%; text-align: left; padding: 12px;
    border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px;
    background: #fff; cursor: pointer; transition: border-color .15s, background .15s;
}
.im-session-item:hover { border-color: #c4b5fd; background: #faf5ff; }
.im-session-item.im-session-active { border-color: #7c3aed; background: #f5f3ff; box-shadow: 0 0 0 1px #ddd6fe; }
.im-session-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.im-session-preview { font-size: .82rem; color: var(--text-muted); line-height: 1.4; margin-bottom: 6px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.im-session-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.im-unread-badge {
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
    background: #ef4444; color: #fff; font-size: .72rem; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}
.im-main {
    background: var(--card); border: 1px solid var(--border); border-radius: 14px;
    display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow);
    min-height: 520px; height: 100%;
}
.im-chat-empty {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; padding: 40px; color: var(--text-muted); text-align: center;
}
.im-chat-empty[hidden], .im-chat-panel[hidden] { display: none !important; }
.im-chat-panel {
    flex: 1; display: flex; flex-direction: column; min-height: 0; height: 100%;
}
.im-chat-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 16px; border-bottom: 1px solid var(--border); background: #fafafa;
}
.im-chat-visitor strong { display: block; font-size: .95rem; }
.im-chat-visitor small { color: var(--text-muted); font-size: .78rem; }
.im-chat-messages { flex: 1; overflow-y: auto; padding: 16px; background: #f8fafc; min-height: 0; }
.im-chat-hint { text-align: center; margin-top: 40px; }
.im-bubble-row { display: flex; margin-bottom: 12px; }
.im-bubble-row.im-bubble-visitor { justify-content: flex-start; }
.im-bubble-row.im-bubble-staff { justify-content: flex-end; }
.im-bubble {
    max-width: 75%; padding: 10px 12px; border-radius: 12px; line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.im-bubble-visitor .im-bubble { background: #fff; border: 1px solid #e5e7eb; border-bottom-left-radius: 4px; }
.im-bubble-staff .im-bubble { background: #ede9fe; border: 1px solid #ddd6fe; border-bottom-right-radius: 4px; }
.im-bubble-name { font-size: .72rem; color: var(--text-muted); margin-bottom: 4px; }
.im-bubble-staff .im-bubble-name { color: #6d28d9; text-align: right; }
.im-bubble-text { font-size: .9rem; white-space: pre-wrap; word-break: break-word; }
.im-bubble-time { display: block; margin-top: 4px; font-size: .68rem; color: var(--text-muted); }
.im-bubble-staff .im-bubble-time { text-align: right; }
.im-chat-compose {
    display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; padding: 12px 16px;
    border-top: 1px solid var(--border); background: #fff; flex-shrink: 0; position: relative;
}
.im-reply-label {
    grid-column: 1 / -1; font-size: .82rem; font-weight: 600; color: var(--text-muted); margin: 0;
}
.im-compose-tools {
    grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; position: relative;
}
.im-emoji-btn { font-size: .82rem; }
.im-emoji-picker {
    position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 20;
    width: min(320px, 100%); max-height: 200px; overflow-y: auto;
    padding: 10px; background: var(--card); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
    display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px;
}
.im-emoji-picker[hidden] { display: none !important; }
.im-emoji-item {
    width: 100%; aspect-ratio: 1; border: none; background: transparent; border-radius: 8px;
    font-size: 1.25rem; cursor: pointer; line-height: 1; padding: 0;
}
.im-emoji-item:hover { background: #f5f3ff; }
.im-chat-compose textarea {
    grid-column: 1; resize: vertical; padding: 10px 12px; border: 1px solid var(--border);
    border-radius: 10px; font: inherit; min-height: 72px; max-height: 160px; width: 100%;
}
.im-chat-compose .btn-primary { grid-column: 2; align-self: end; min-width: 72px; min-height: 44px; }
.im-chat-compose textarea:focus { outline: none; border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124,58,237,.12); }
.im-chat-compose textarea:disabled { background: #f3f4f6; color: var(--text-muted); }

@media (max-width: 900px) {
    .im-workspace { grid-template-columns: 1fr; min-height: auto; }
    .im-sidebar { max-height: 280px; }
}
.block-page-tag {
    font-size: .72rem; color: var(--text-muted);
    background: #f8fafc; padding: 3px 8px; border-radius: 6px;
    border: 1px solid var(--border);
}

.block-toggle {
    display: inline-flex; align-items: center; gap: 8px;
    margin-left: auto; cursor: pointer; user-select: none;
}
.block-toggle input { display: none; }
.block-toggle-ui {
    width: 38px; height: 22px; border-radius: 11px;
    background: #cbd5e1; position: relative;
    transition: background .2s;
}
.block-toggle-ui::after {
    content: ''; position: absolute; top: 3px; left: 3px;
    width: 16px; height: 16px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15);
    transition: transform .2s;
}
.block-toggle input:checked + .block-toggle-ui { background: #0891b2; }
.block-toggle input:checked + .block-toggle-ui::after { transform: translateX(16px); }
.block-toggle-text { font-size: .8rem; font-weight: 600; color: var(--text-muted); }
.block-toggle input:checked ~ .block-toggle-text { color: #0e7490; }

.block-item-main {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
}
.block-field { display: flex; flex-direction: column; gap: 5px; }
.block-field-grow { flex: 1; min-width: 200px; }
.block-field label {
    font-size: .75rem; font-weight: 600; color: #64748b;
    letter-spacing: .02em;
}
.block-title-input {
    width: 100%; padding: 10px 14px;
    border: 1.5px solid var(--border); border-radius: 10px;
    font-size: .92rem; background: #fff;
    transition: border-color .2s, box-shadow .2s;
}
.block-title-input:focus {
    outline: none; border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, .12);
}
.block-btn-group { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-block-action {
    padding: 9px 14px; border-radius: 10px;
    border: 1.5px solid var(--border); background: #fff;
    font-size: .82rem; font-weight: 600; color: var(--text);
    cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn-block-action:hover { border-color: #7c3aed; color: #6d28d9; background: #faf5ff; }
.btn-block-danger:hover { border-color: #fca5a5; color: #dc2626; background: #fef2f2; }

/* 排版弹窗表单 */
.modal-form-section {
    margin-bottom: 20px; padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}
.modal-form-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.modal-form-section-title {
    font-size: .88rem; font-weight: 700; color: var(--text);
    margin-bottom: 12px; padding-left: 10px;
    border-left: 3px solid #7c3aed;
}
.modal-form-hint { margin: -6px 0 12px !important; font-size: .8rem !important; }
.modal-textarea {
    min-height: 140px; resize: vertical; line-height: 1.6;
    font-family: inherit;
}

.banner-mode-tabs { display: flex; gap: 10px; flex-wrap: wrap; }
.banner-mode-tab {
    flex: 1; min-width: 140px; cursor: pointer;
    border: 2px solid var(--border); border-radius: 12px;
    padding: 12px 16px; text-align: center;
    font-weight: 600; font-size: .88rem;
    transition: all .15s; background: #fff;
}
.banner-mode-tab input { display: none; }
.banner-mode-tab.active {
    border-color: #7c3aed; background: #faf5ff; color: #6d28d9;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, .1);
}
.banner-mode-tab:hover:not(.active) { border-color: #c4b5fd; }

.slide-list { display: flex; flex-direction: column; gap: 14px; }
.slide-item {
    display: flex; gap: 16px; padding: 14px;
    background: #f8fafc; border: 1px solid var(--border);
    border-radius: 12px; align-items: flex-start;
}
.slide-preview { flex-shrink: 0; }
.slide-thumb {
    width: 160px; height: 80px; object-fit: cover;
    border-radius: 8px; border: 1px solid var(--border); display: block;
}
.slide-thumb-empty {
    width: 160px; height: 80px; border-radius: 8px;
    background: linear-gradient(135deg, #e2e8f0, #f1f5f9);
    display: flex; align-items: center; justify-content: center;
    font-size: .75rem; color: var(--text-muted); text-align: center; padding: 8px;
    border: 1px dashed #cbd5e1;
}
.slide-fields { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; min-width: 0; }
.slide-field { display: flex; flex-direction: column; gap: 4px; }
.slide-field label { font-size: .72rem; font-weight: 600; color: #64748b; }
.slide-field input {
    padding: 8px 12px; border: 1.5px solid var(--border);
    border-radius: 8px; font-size: .88rem; background: #fff;
}
.slide-field input:focus { outline: none; border-color: #7c3aed; box-shadow: 0 0 0 2px rgba(124,58,237,.1); }
.slide-upload { grid-column: 1 / -1; }
.slide-file-input { font-size: .82rem; }
.slide-remove { grid-column: 1 / -1; justify-self: start; }
.btn-add-slide { margin-top: 4px; }
#modal .modal-panel:has(#slideList) { width: 680px; }
#modal .modal-panel:has(#blkContent) { width: 640px; }

@media (max-width: 720px) {
    .block-item-main { flex-direction: column; align-items: stretch; }
    .block-toggle { margin-left: 0; width: 100%; }
    .slide-item { flex-direction: column; }
    .slide-fields { grid-template-columns: 1fr; }
    .slide-thumb, .slide-thumb-empty { width: 100%; height: 120px; }
}
.hint { color: var(--text-muted); margin-bottom: 14px; font-size: .88rem; }

/* ========== 徽章 & 弹窗 ========== */
.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: .75rem; font-weight: 600; }
.badge-green { background: #d1fae5; color: #047857; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-blue { background: #e0e7ff; color: #4338ca; }
.badge-gray { background: #f1f5f9; color: #64748b; }

/* Toast 通知 */
.admin-toast-host {
    position: fixed; top: 20px; right: 20px; z-index: 9999;
    display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.admin-toast {
    display: flex; align-items: center; gap: 12px;
    min-width: 260px; max-width: 380px;
    padding: 14px 18px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(15,23,42,.12), 0 2px 8px rgba(15,23,42,.06);
    border: 1px solid var(--border);
    transform: translateX(120%); opacity: 0;
    transition: transform .35s cubic-bezier(.22,1,.36,1), opacity .35s;
    pointer-events: auto;
}
.admin-toast-show { transform: translateX(0); opacity: 1; }
.admin-toast-icon { width: 22px; height: 22px; flex-shrink: 0; }
.admin-toast-icon svg { width: 100%; height: 100%; }
.admin-toast-text { font-size: .9rem; font-weight: 500; color: var(--text); line-height: 1.4; }
.admin-toast-success { border-left: 4px solid #10b981; }
.admin-toast-success .admin-toast-icon { color: #10b981; }
.admin-toast-error { border-left: 4px solid #ef4444; }
.admin-toast-error .admin-toast-icon { color: #ef4444; }
.admin-toast-warning { border-left: 4px solid #f59e0b; }
.admin-toast-warning .admin-toast-icon { color: #f59e0b; }
.admin-toast-info { border-left: 4px solid #3b82f6; }
.admin-toast-info .admin-toast-icon { color: #3b82f6; }

/* Alert / Confirm / Prompt */
.admin-dialog-overlay {
    position: fixed; inset: 0; z-index: 9998;
    background: rgba(15,23,42,.45);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center; justify-content: center;
    padding: 20px;
    opacity: 0; transition: opacity .2s;
    pointer-events: none;
}
.admin-dialog-overlay.admin-dialog-visible {
    opacity: 1;
    pointer-events: auto;
}
.admin-dialog {
    background: #fff;
    border-radius: 16px;
    padding: 28px 28px 22px;
    width: 100%; max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(15,23,42,.25);
    text-align: center;
    transform: scale(.92) translateY(8px);
    transition: transform .25s cubic-bezier(.22,1,.36,1);
}
.admin-dialog-visible .admin-dialog { transform: scale(1) translateY(0); }
.admin-dialog-icon {
    width: 52px; height: 52px; margin: 0 auto 16px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.admin-dialog-icon svg { width: 26px; height: 26px; }
.admin-dialog-icon-success { background: #d1fae5; color: #059669; }
.admin-dialog-icon-error { background: #fee2e2; color: #dc2626; }
.admin-dialog-icon-warning { background: #fef3c7; color: #d97706; }
.admin-dialog-icon-info { background: #dbeafe; color: #2563eb; }
.admin-dialog-icon-question { background: #e0e7ff; color: #4f46e5; }
.admin-dialog-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.admin-dialog-message { font-size: .9rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 20px; white-space: pre-wrap; }
.admin-dialog-extra { margin-bottom: 20px; text-align: left; }
.admin-dialog-input {
    width: 100%; padding: 10px 14px;
    border: 1px solid var(--border); border-radius: 10px;
    font-size: .9rem; transition: border-color .2s, box-shadow .2s;
}
.admin-dialog-input:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.admin-dialog-preview {
    max-height: 160px; overflow-y: auto;
    background: #f8fafc; border: 1px solid var(--border);
    border-radius: 10px; padding: 12px; margin-bottom: 12px;
    font-size: .85rem; line-height: 1.6;
}
.admin-dialog-preview .chat-line { margin-bottom: 6px; }
.admin-dialog-preview .chat-line b { color: var(--text); margin-right: 6px; }
.admin-dialog-actions { display: flex; gap: 10px; justify-content: center; }
.admin-dialog-actions .btn-primary,
.admin-dialog-actions .btn-outline { min-width: 96px; padding: 10px 20px; }

/* 表单弹层 Modal */
.modal {
    position: fixed; inset: 0;
    background: rgba(15,23,42,.45);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center; justify-content: center;
    z-index: 200;
    padding: 20px;
    opacity: 0; transition: opacity .22s;
    pointer-events: none;
}
.modal.modal-open {
    opacity: 1;
    pointer-events: auto;
}
.modal-panel {
    position: relative;
    background: var(--card);
    border-radius: 16px;
    width: 500px; max-width: 95vw;
    max-height: 88vh;
    display: flex; flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(15,23,42,.28);
    transform: scale(.94) translateY(12px);
    transition: transform .28s cubic-bezier(.22,1,.36,1);
}
.modal.modal-open .modal-panel { transform: scale(1) translateY(0); }
.modal-close {
    position: absolute; top: 14px; right: 14px; z-index: 2;
    width: 32px; height: 32px;
    border: none; background: #f1f5f9;
    border-radius: 8px;
    font-size: 1.25rem; line-height: 1;
    color: var(--text-muted); cursor: pointer;
    transition: background .2s, color .2s;
}
.modal-close:hover { background: #e2e8f0; color: var(--text); }
.modal-body-inner {
    padding: 28px 32px 32px;
    overflow-y: auto;
    flex: 1;
}
.modal-header { padding-bottom: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.modal-header h3 { margin: 0; font-size: 1.15rem; font-weight: 700; padding-right: 36px; }
.modal-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.modal-footer {
    display: flex; gap: 10px; justify-content: flex-end;
    margin-top: 24px; padding-top: 20px;
    border-top: 1px solid var(--border);
}
.modal-body-inner > h3:first-child {
    margin: 0 0 20px; font-size: 1.15rem; font-weight: 700;
    padding-right: 36px; padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

/* 企业后台主题色微调 */
.enterprise-theme .sidebar-brand { color: #fff; }
.enterprise-theme .sidebar nav a.active {
    background: linear-gradient(135deg, #0891b2, #0e7490);
    box-shadow: 0 4px 14px rgba(8,145,178,.35);
}
.enterprise-theme .btn-primary {
    background: linear-gradient(135deg, #0891b2, #0e7490);
    box-shadow: 0 2px 8px rgba(8,145,178,.25);
}
/* btn-sm 会覆盖主按钮底色，组合使用时保持可读 */
.btn-primary.btn-sm {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    font-weight: 600;
}
.btn-primary.btn-sm:hover {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}
.enterprise-theme .btn-primary.btn-sm {
    background: linear-gradient(135deg, #0891b2, #0e7490);
    box-shadow: 0 2px 8px rgba(8,145,178,.25);
}
.enterprise-theme .btn-primary.btn-sm:hover {
    color: #fff;
    background: linear-gradient(135deg, #0e7490, #155e75);
    box-shadow: 0 4px 14px rgba(8, 145, 178, .35);
}
.enterprise-theme .stat-card.purple h3 { color: #0891b2; }

@media (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
/* ========== 产品网格 ========== */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; margin-top: 20px; }
.product-card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
}
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.product-thumb { width: 100%; height: 160px; object-fit: cover; background: #f1f5f9; display: block; }
.product-thumb-empty { width: 100%; height: 160px; background: linear-gradient(135deg, #e2e8f0, #f1f5f9); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: .85rem; }
.product-body { padding: 14px 16px; }
.product-body h4 { font-size: .95rem; margin-bottom: 6px; font-weight: 700; }
.product-body p { font-size: .8rem; color: var(--text-muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-actions { padding: 0 16px 14px; display: flex; gap: 8px; }
.thumb-preview { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); margin-top: 8px; }
.upload-row { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.upload-box { border: 2px dashed var(--border); border-radius: 10px; padding: 20px; text-align: center; cursor: pointer; flex: 1; min-width: 140px; transition: border-color .2s; }
.upload-box:hover { border-color: var(--primary); }
.upload-box input { display: none; }

.logo-upload-row { display: flex; gap: 16px; align-items: flex-start; }
.logo-preview { height: 48px; max-width: 200px; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; padding: 6px; background: #fff; }
.logo-preview-empty { height: 48px; min-width: 120px; display: flex; align-items: center; justify-content: center; font-size: .8rem; color: var(--text-muted); border: 1px dashed var(--border); border-radius: 8px; }
.btn-sm { padding: 4px 10px; font-size: .8rem; }
.news-settings-card {
    margin-bottom: 16px;
    padding: 18px 22px;
    background: linear-gradient(135deg, #f0fdfa 0%, #ecfeff 55%, #f8fafc 100%);
    border: 1px solid #99f6e4;
    border-radius: 14px;
    box-shadow: 0 4px 18px rgba(8, 145, 178, .08);
}
.news-settings-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}
.news-settings-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #0891b2, #0e7490);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(8, 145, 178, .28);
}
.news-settings-info h4 {
    margin: 0 0 4px;
    font-size: .98rem;
    font-weight: 700;
    color: var(--text);
}
.news-settings-info p {
    margin: 0;
    font-size: .82rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.news-settings-body {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px 18px;
    padding-top: 14px;
    border-top: 1px dashed #a5f3fc;
}
.news-range-group {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex: 1;
    min-width: 260px;
}
.news-range-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    max-width: 160px;
}
.news-range-field span {
    font-size: .78rem;
    font-weight: 600;
    color: #0e7490;
    letter-spacing: .02em;
}
.news-range-field input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #a5f3fc;
    border-radius: 10px;
    font-size: .95rem;
    font-weight: 600;
    color: var(--text);
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}
.news-range-field input:focus {
    outline: none;
    border-color: #0891b2;
    box-shadow: 0 0 0 3px rgba(8, 145, 178, .15);
}
.news-range-field input::placeholder { color: #94a3b8; font-weight: 400; }
.news-range-sep {
    padding-bottom: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #67e8f9;
    user-select: none;
}
.news-range-save {
    min-width: 108px;
    padding: 10px 18px !important;
    border-radius: 10px !important;
    white-space: nowrap;
    color: #fff !important;
    background: linear-gradient(135deg, #0891b2, #0e7490) !important;
    border: none !important;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(8, 145, 178, .28);
}
.news-range-save:hover {
    color: #fff !important;
    background: linear-gradient(135deg, #0e7490, #155e75) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(8, 145, 178, .35);
}
@media (max-width: 640px) {
    .news-settings-body { flex-direction: column; align-items: stretch; }
    .news-range-group { min-width: 0; }
    .news-range-field { max-width: none; }
    .news-range-save { width: 100%; }
}
.views-input-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.views-input-row input { width: 160px; }
.news-form-card { margin-bottom: 20px; }
.news-form-card h3 { margin: 0 0 18px; font-size: 1.1rem; }
.rich-editor-host {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}
.rich-editor-host .ql-toolbar {
    border: none;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
    border-radius: 10px 10px 0 0;
}
.rich-editor-host .ql-container {
    border: none;
    font-size: .95rem;
    min-height: 280px;
}
.rich-editor-host .ql-editor {
    min-height: 280px;
    line-height: 1.7;
}
.rich-editor-host .ql-editor.ql-blank::before {
    color: #94a3b8;
    font-style: normal;
}
#modal .modal-panel:has(#pfContentEditor),
#modal .modal-panel:has(#cfContentEditor) { width: 720px; max-width: 95vw; }
#modal .modal-panel:has(#nfContentEditor) { width: 720px; }
#modal .modal-panel:has(#shopSkuList),
#modal .modal-panel:has(#spDetailEditor) { width: 720px; max-width: 95vw; }
.form-section-title { font-size: .9rem; font-weight: 700; margin: 8px 0 10px; color: var(--text); }
.sku-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.sku-row { display: grid; grid-template-columns: 1.2fr 1.2fr 0.8fr 0.7fr auto; gap: 8px; align-items: center; }
.sku-row-extended { display: block; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: #fafbfc; }
.sku-row-main { display: grid; grid-template-columns: 1fr 1fr 1fr 0.8fr 0.7fr auto; gap: 8px; align-items: center; }
.sku-row-extended .sku-virtual { width: 100%; margin-top: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: .85rem; resize: vertical; }
.sku-row input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: .85rem; width: 100%; }
.zone-product-checks { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; }

/* 企业管理 — 有效期 */
.expiry-cell { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.expiry-cell > span:first-child { font-weight: 600; font-size: .88rem; }
.tenant-name-cell { min-width: 140px; }
.tenant-name-main { line-height: 1.35; }
.tenant-login-title { margin-top: 4px; font-size: .78rem; color: #64748b; line-height: 1.35; }
.tenant-login-title .hint-tag { margin-left: 6px; font-size: .72rem; color: #94a3b8; }
.tenant-actions { width: 1%; white-space: nowrap; vertical-align: middle; }
.tenant-actions-bar {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
}
.tenant-actions-bar .btn-sm {
    padding: 5px 10px;
    font-size: .78rem;
    line-height: 1.2;
    font-weight: 600;
}
.tenant-btn { border-width: 1px; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; }
.tenant-btn-clone { color: #6d28d9; border-color: #ddd6fe; background: #f5f3ff; }
.tenant-btn-clone:hover { color: #5b21b6; border-color: #c4b5fd; background: #ede9fe; }
.tenant-btn-domain { color: #0369a1; border-color: #bae6fd; background: #f0f9ff; }
.tenant-btn-domain:hover { color: #075985; border-color: #7dd3fc; background: #e0f2fe; }
.tenant-btn-delete { color: #b91c1c; border-color: #fecaca; background: #fef2f2; }
.tenant-btn-delete:hover { color: #991b1b; border-color: #f87171; background: #fee2e2; }
.tenant-btn-more { color: #475569; border-color: #e2e8f0; background: #f8fafc; }
.tenant-btn-more:hover { color: #334155; border-color: #cbd5e1; background: #f1f5f9; }
.tenant-more-btn { min-width: 52px; }
.tenant-more-btn::after {
    content: '▾';
    margin-left: 4px;
    font-size: .7rem;
    opacity: .75;
}
.tenant-actions-dropdown {
    min-width: 152px;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .14);
}
.tenant-actions-dropdown--float {
    position: fixed;
    z-index: 1200;
    margin: 0;
}
.tenant-action-item {
    display: block;
    width: 100%;
    padding: 9px 12px 9px 14px;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-size: .84rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    line-height: 1.3;
    border-left: 3px solid transparent;
    transition: background .15s, border-color .15s;
}
.tenant-action-login { color: #4338ca; }
.tenant-action-login:hover { background: #eef2ff; border-left-color: #6366f1; }
.tenant-action-expiry { color: #b45309; }
.tenant-action-expiry:hover { background: #fffbeb; border-left-color: #f59e0b; }
.tenant-action-success { color: #047857; }
.tenant-action-success:hover { background: #ecfdf5; border-left-color: #10b981; }
.tenant-action-warn { color: #c2410c; }
.tenant-action-warn:hover { background: #fff7ed; border-left-color: #f97316; }
.tenant-action-mall { color: #1d4ed8; }
.tenant-action-mall:hover { background: #eff6ff; border-left-color: #3b82f6; }
.tenant-action-im { color: #7e22ce; }
.tenant-action-im:hover { background: #faf5ff; border-left-color: #a855f7; }
.tenant-action-pwd { color: #0f766e; }
.tenant-action-pwd:hover { background: #f0fdfa; border-left-color: #14b8a6; }
.tenant-actions-divider {
    height: 1px;
    margin: 4px 6px;
    background: var(--border);
}
#page-tenants .data-table { min-width: 1080px; }
#page-tenants .table-scroll-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}
#page-tenants .table-scroll-wrap .data-table {
    margin: 0;
    border: none;
    border-radius: 0;
    overflow: visible;
}
.tenant-actions-col { width: 188px; }
.expiry-quick-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.expiry-quick-btns .btn-outline { padding: 8px 6px; font-size: .82rem; text-align: center; }
.expiry-quick-btns .expiry-minus { color: #b91c1c; border-color: #fecaca; }
.expiry-quick-btns .expiry-minus:hover { background: #fef2f2; border-color: #f87171; }
.expiry-custom-row { display: flex; gap: 8px; align-items: center; }
.expiry-custom-row input { flex: 1; }

/* 企业管理 — 域名 */
.domain-cell { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.domain-cell code { font-size: .82rem; }
.domain-default-box {
    background: #f8fafc; border: 1px solid var(--border); border-radius: 10px;
    padding: 12px 14px; margin-bottom: 16px;
    display: flex; flex-direction: column; gap: 4px;
}
.domain-default-label { font-size: .78rem; color: var(--text-muted); font-weight: 600; }
.domain-default-box small { font-size: .75rem; color: var(--text-muted); line-height: 1.5; }
.domain-default-box a { color: var(--primary); text-decoration: none; }
.domain-default-box a:hover { text-decoration: underline; }
.domain-admin-hint { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); }
.domain-section-title { font-size: .88rem; font-weight: 700; margin-bottom: 10px; color: var(--text); }
.domain-primary-status {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    padding: 10px 14px; margin-bottom: 12px;
    background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px;
    font-size: .85rem; color: var(--text);
}
.domain-primary-status code { font-size: .82rem; }
.domain-primary-hint { font-size: .78rem; color: var(--text-muted); margin: -4px 0 12px; line-height: 1.5; }
.domain-item.is-primary-item { border-color: #93c5fd; background: #f8fbff; }
.domain-list { display: flex; flex-direction: column; gap: 10px; }
.domain-item {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: #fff;
    flex-wrap: wrap;
}
.domain-item-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.domain-item-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.domain-item-actions .domain-del { color: #b91c1c; border-color: #fecaca; }
.domain-item-actions .domain-del:hover { background: #fef2f2; }
#modal .modal-panel:has(#domainListBox) { width: 580px; }

@media (max-width: 768px) {
    .sidebar { display: none; }
    .stat-grid { grid-template-columns: 1fr; }
    #content { padding: 16px; }
    .product-grid { grid-template-columns: repeat(2, 1fr); }
    .menu-switch-grid { grid-template-columns: 1fr; }
}
