/* 舞美舞台设计平台 - 后台样式 */
:root {
    --primary: #3b6ef6;
    --primary-dark: #2f58d0;
    --success: #17a673;
    --danger: #e5534b;
    --sidebar: #1f2430;
    --sidebar-hover: #2b3140;
    --text: #30343f;
    --muted: #8b93a1;
    --border: #e6e9f0;
    --bg: #f4f6fb;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
code { background: #f1f3f8; padding: 1px 5px; border-radius: 4px; font-size: 12px; color: #556; }
.empty { text-align: center; color: var(--muted); padding: 24px 0; }

/* 布局 */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px; background: var(--sidebar); color: #d7dbe5; flex-shrink: 0;
    position: fixed; top: 0; bottom: 0; left: 0; overflow-y: auto;
}
.sidebar .logo { display: flex; align-items: center; gap: 10px; padding: 18px; border-bottom: 1px solid rgba(255,255,255,.06); }
.sidebar .logo .mark {
    width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg,#4f7cff,#7a5cff);
    display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700;
}
.sidebar .logo .name { font-size: 15px; font-weight: 600; color: #fff; }

.sidebar .menu { list-style: none; margin: 10px 0 0; padding: 0; }
.sidebar .menu li a { display: flex; align-items: center; gap: 10px; padding: 11px 18px; color: #c3c9d6; font-size: 14px; }
.sidebar .menu li a:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar .menu li a.active { background: var(--sidebar-hover); color: #fff; border-left: 3px solid var(--primary); }
.sidebar .menu .icon { width: 18px; text-align: center; }
.sidebar .menu .arrow { margin-left: auto; font-size: 12px; }
.sidebar .submenu { list-style: none; margin: 0; padding: 0; display: none; background: #191d27; }
.sidebar .menu-group.open .submenu { display: block; }
.sidebar .submenu li a { padding-left: 42px; font-size: 13px; }

.main { flex: 1; margin-left: 220px; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: 56px; background: #fff; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
    position: sticky; top: 0; z-index: 10;
}
.topbar .crumb strong { font-size: 16px; }
.userbox { display: flex; align-items: center; gap: 10px; }
.userbox .uname { font-weight: 600; }
.userbox .role { color: var(--muted); font-size: 12px; border: 1px solid var(--border); padding: 2px 8px; border-radius: 20px; }
.content { padding: 20px; flex: 1; }
.footer { padding: 16px 20px; color: var(--muted); font-size: 12px; text-align: center; }

/* 卡片 */
.card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* 统计卡片 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.stat-card .label { color: var(--muted); font-size: 13px; }
.stat-card .value { font-size: 26px; font-weight: 700; }
.stat-card .sub { font-size: 12px; color: var(--muted); }

/* 按钮 */
.btn {
    display: inline-block; padding: 7px 14px; border: 1px solid var(--border); background: #fff;
    color: var(--text); border-radius: 6px; cursor: pointer; font-size: 13px; line-height: 1.4; transition: .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); color: #fff; }
.btn.danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.block { width: 100%; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { background: #fafbfe; color: #5b6478; font-weight: 600; }
.table tr:hover td { background: #fafbfe; }
.table .thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.table .thumb.big { width: 120px; height: 90px; margin-top: 8px; }
.file-icon {
    display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px;
    border-radius: 6px; background: #eef1f8; color: #6b7488; font-size: 11px; font-weight: 600;
}

/* 徽章 */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; background: #eef1f8; color: #6b7488; }
.badge.on, .badge.published { background: #e6f7ef; color: var(--success); }
.badge.off, .badge.offline { background: #f1f2f5; color: #98a0ae; }
.badge.draft { background: #fff5e6; color: #c98214; }
.badge.super { background: #eaf0ff; color: var(--primary); }
.badge.type { background: #eef1f8; color: #6b7488; }

/* 表单 */
.form { max-width: 900px; }
.form .form-item { margin-bottom: 14px; }
.form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 800px) { .form .form-row { grid-template-columns: 1fr; } }
.form label { display: block; margin-bottom: 6px; font-size: 13px; color: #5b6478; }
.form label i { color: var(--danger); font-style: normal; }
.form input[type=text], .form input[type=password], .form input[type=number],
.form select, .form textarea, .filter input, .filter select,
.login-card input, .install-card input {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 13px; outline: none; background: #fff; color: var(--text);
}
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--primary); }
.form textarea.code { font-family: Consolas, Monaco, "Courier New", monospace; font-size: 13px; line-height: 1.6; }
.form .hint { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.form-actions { margin-top: 18px; display: flex; gap: 10px; }
.upload-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.upload-line input[type=file] { width: auto; }
.form.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form.inline-form .form-item { margin-bottom: 0; width: auto; min-width: 150px; }
.checkbox { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.checkbox input { width: auto; }
.filter { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filter input, .filter select { width: auto; min-width: 140px; }
fieldset.setting-group { border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; margin: 0 0 16px; }
fieldset.setting-group legend { padding: 0 8px; font-weight: 600; font-size: 14px; }

/* 提示 */
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 13px; }
.alert.success { background: #e8f8f1; color: #127a53; border: 1px solid #bfe8d5; }
.alert.error { background: #fdecea; color: #b8322b; border: 1px solid #f7c6c2; }
.alert.info { background: #eaf0ff; color: #2f58d0; border: 1px solid #cdd9ff; }

/* 分页 */
.pagination { margin-top: 14px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 5px 11px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text); font-size: 13px;
}
.pagination .active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .disabled { color: #b9bec9; }

/* 图表 / 时间线 */
.chart { list-style: none; margin: 0; padding: 0; }
.chart li { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.chart .c-label { width: 70px; color: #5b6478; }
.chart .c-bar { flex: 1; height: 10px; background: #eef1f8; border-radius: 6px; overflow: hidden; }
.chart .c-bar i { display: block; height: 100%; background: linear-gradient(90deg,#4f7cff,#7a5cff); }
.chart .c-value { width: 90px; text-align: right; color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.timeline li { padding: 7px 0; border-bottom: 1px dashed var(--border); color: #5b6478; }
.timeline .t-time { color: var(--muted); margin-right: 6px; }
.timeline .t-user { font-weight: 600; color: var(--text); margin-right: 6px; }
.timeline .t-module { color: var(--muted); margin-left: 4px; }

/* 权限分配 */
.perm-toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.perm-group { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; }
.perm-children { display: flex; flex-wrap: wrap; gap: 14px; padding: 8px 0 2px 22px; }

/* 素材选择器 */
.material-picker { display: flex; flex-wrap: wrap; gap: 10px; max-height: 320px; overflow-y: auto; padding: 6px 0; }
.picker-item {
    width: 110px; border: 1px solid var(--border); border-radius: 8px; padding: 6px;
    text-align: center; font-size: 12px; cursor: pointer; position: relative; background: #fff;
}
.picker-item.checked { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(59,110,246,.12); }
.picker-item img { width: 100%; height: 66px; object-fit: cover; border-radius: 6px; }
.picker-item .p-name { display: block; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-item input { position: absolute; top: 6px; right: 6px; }

/* 弹窗 */
.modal { display: none; position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 100; }
.modal.show { display: block; }
.modal-mask { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(20,24,33,.45); }
.modal-body {
    position: relative; width: 520px; max-width: 92%; margin: 8vh auto; background: #fff;
    border-radius: 10px; padding: 16px 18px; max-height: 84vh; overflow-y: auto;
}

/* 登录页 */
.login-body { background: linear-gradient(135deg,#2b3350,#1f2430); display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card { width: 400px; max-width: 100%; background: #fff; border-radius: 12px; padding: 30px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-card h2 { margin: 6px 0 4px; font-size: 20px; text-align: center; }
.login-card .muted { text-align: center; font-size: 12px; margin-bottom: 18px; }
.login-logo { display: flex; justify-content: center; }
.login-logo .mark {
    width: 46px; height: 46px; border-radius: 12px; background: linear-gradient(135deg,#4f7cff,#7a5cff);
    display: flex; align-items: center; justify-content: center; color: #fff; font-size: 20px; font-weight: 700;
}
.login-card .form-item { margin-bottom: 14px; }
.login-card label { display: block; margin-bottom: 6px; font-size: 13px; color: #5b6478; }

/* 预览页 */
.preview-body { background: var(--bg); }
.preview-bar { position: sticky; top: 0; z-index: 5; background: #fff; border-bottom: 1px solid var(--border); padding: 10px 18px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.preview-stage { max-width: 960px; margin: 20px auto; background: #fff; padding: 26px; border: 1px solid var(--border); border-radius: 10px; }
.preview-cover { width: 100%; border-radius: 8px; margin-bottom: 16px; }
.preview-meta { display: flex; gap: 18px; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.preview-content { line-height: 1.8; }
.preview-json { margin: 16px 0; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.preview-json summary { cursor: pointer; padding: 8px 12px; font-weight: bold; }
.preview-json pre {
    margin: 0; padding: 0 12px 12px; max-height: 320px; overflow: auto;
    font-size: 12px; line-height: 1.6; color: #4a5160;
}
.preview-materials { margin-top: 24px; border-top: 1px dashed var(--border); padding-top: 16px; }

/* 提示页 */
.empty-page { text-align: center; padding: 60px 0; color: var(--muted); }
.empty-page h1 { font-size: 42px; margin: 0 0 10px; color: var(--text); }

/* 站点 Logo（侧边栏 / 登录页） */
.sidebar .logo .logo-img {
    width: 30px; height: 30px; border-radius: 8px; object-fit: contain;
    background: #fff; padding: 2px;
}
.login-logo .logo-img {
    width: 46px; height: 46px; border-radius: 12px; object-fit: contain;
    background: #fff; padding: 3px;
}

/* 站点设置页 */
.setting-form { max-width: none; }
.setting-layout { display: grid; grid-template-columns: 196px minmax(0, 1fr); gap: 18px; align-items: start; }
.setting-main { min-width: 0; }

.setting-side {
    position: sticky; top: 76px; background: #fff; border: 1px solid var(--border);
    border-radius: 10px; padding: 14px 10px 12px;
}
.setting-side-title { padding: 0 8px 10px; font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.setting-nav { display: flex; flex-direction: column; gap: 2px; }
.setting-nav-item {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 9px 10px; border-radius: 7px; color: #5b6478; font-size: 13px; line-height: 1.4;
}
.setting-nav-item:hover { background: #f4f6fb; color: var(--text); }
.setting-nav-item.active { background: #eef2ff; color: var(--primary); font-weight: 600; }
.setting-nav-count { font-size: 11px; color: var(--muted); background: #f1f3f8; border-radius: 20px; padding: 1px 7px; }
.setting-nav-item.active .setting-nav-count { background: #fff; color: var(--primary); }
.setting-side-tip { margin: 12px 8px 0; padding-top: 10px; border-top: 1px dashed var(--border); font-size: 12px; line-height: 1.7; color: var(--muted); }

.setting-intro { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.setting-intro h3 { margin: 0 0 4px; font-size: 16px; }
.setting-intro p { margin: 0; font-size: 12px; line-height: 1.6; }

.setting-toolbar {
    position: sticky; top: 56px; z-index: 6;
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 8px 0 10px; margin: -8px 0 12px; background: var(--bg);
}
.setting-toolbar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.setting-search {
    flex: 1; min-width: 200px; max-width: 420px; padding: 8px 12px;
    border: 1px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; background: #fff;
}
.setting-search:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,110,246,.1); }

.setting-section { scroll-margin-top: 116px; }
.setting-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.setting-section-head h3 { margin: 0 0 3px; font-size: 15px; }
.setting-section-head p { margin: 0; font-size: 12px; line-height: 1.6; }

.setting-row {
    display: grid; grid-template-columns: minmax(180px, 280px) minmax(0, 1fr);
    gap: 10px 28px; padding: 16px 10px; border-bottom: 1px dashed var(--border);
    border-radius: 8px; margin: 0 -10px; transition: background .15s;
}
.setting-row:last-child { border-bottom: 0; }
.setting-row:hover { background: #fafbfe; }
.setting-row.is-dirty { background: #fffbf2; box-shadow: inset 3px 0 0 #f0b23c; }
.setting-label { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.setting-title { font-size: 13px; font-weight: 600; color: #3d4351; line-height: 1.5; }
.setting-desc { font-size: 12px; color: var(--muted); line-height: 1.65; }
.setting-key { align-self: flex-start; font-size: 11px; color: #a2a9b8; background: none; padding: 0; }
.setting-control { min-width: 0; }
.setting-control > input[type=text],
.setting-control > input[type=password],
.setting-control > input[type=number],
.setting-control > textarea { max-width: 560px; }

.setting-input-unit { position: relative; max-width: 240px; }
.setting-input-unit input { padding-right: 48px; }
.setting-input-unit .unit { position: absolute; top: 50%; right: 11px; transform: translateY(-50%); font-size: 12px; color: var(--muted); pointer-events: none; }

.setting-secret { display: flex; gap: 8px; align-items: center; max-width: 560px; }
.setting-secret input { flex: 1; min-width: 0; }

/* 开关 */
.form .switch { display: inline-flex; margin-bottom: 0; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input[type=checkbox] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch-track { position: relative; width: 42px; height: 24px; border-radius: 999px; background: #dfe3ec; transition: background .18s; flex-shrink: 0; }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(24,34,64,.25); transition: transform .18s; }
.switch input[type=checkbox]:checked + .switch-track { background: var(--primary); }
.switch input[type=checkbox]:checked + .switch-track .switch-thumb { transform: translateX(18px); }
.switch input[type=checkbox]:focus-visible + .switch-track { box-shadow: 0 0 0 3px rgba(59,110,246,.18); }
.switch-text { font-size: 13px; color: var(--muted); }

/* 图片类型设置项（Logo 上传 / 预览） */
.setting-image { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.setting-image-box {
    position: relative; width: 112px; height: 112px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
    background: #f7f9fd; border: 1px dashed #d6dceb; border-radius: 10px;
}
.setting-image-preview { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; }
.setting-image-empty { position: absolute; font-size: 12px; color: var(--muted); }
.setting-image-ops { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 260px; max-width: 460px; }
.setting-image-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.form .setting-upload-btn { position: relative; display: inline-block; margin-bottom: 0; }
.setting-file-name { font-size: 12px; }

.setting-actions {
    position: sticky; bottom: 12px; z-index: 6; margin-top: 16px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 10px 14px; background: rgba(255,255,255,.96);
    border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 10px 28px rgba(24,34,64,.1);
}
.setting-actions-state { display: flex; align-items: center; gap: 10px; }
.setting-actions-btns { display: flex; gap: 10px; }
.setting-dirty { font-size: 13px; color: #c98214; }

[hidden] { display: none !important; }

@media (max-width: 960px) {
    .setting-layout { grid-template-columns: 1fr; }
    .setting-side { position: static; }
    .setting-nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
    .setting-nav-item { flex: 0 0 auto; }
    .setting-side-tip { display: none; }
    .setting-row { grid-template-columns: 1fr; gap: 10px; }
}

@media (max-width: 760px) {
    .setting-toolbar { position: static; background: transparent; padding: 0; margin: 0 0 12px; }
    .setting-section { scroll-margin-top: 72px; }
}

/* 舞台供应商管理 */
.badge.strategic { background: #eaf0ff; color: var(--primary); }
.badge.preferred { background: #e6f7ef; color: var(--success); }
.badge.backup { background: #f1f2f5; color: #98a0ae; }
.badge.scope { background: #fff5e6; color: #c98214; }

/* 方案审核 */
.review-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.review-tabs .badge { margin-left: 4px; }
.review-form { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.review-form input[type=text] {
    width: 180px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
}

/* 审核流转记录 */
.audit-history { margin-top: 4px; font-size: 12px; }
.audit-history summary { cursor: pointer; color: var(--primary); }
.audit-history ul { margin: 6px 0 0; padding-left: 16px; color: var(--muted); line-height: 1.8; max-width: 520px; }

/* 仪表盘 7 天趋势 */
.trend-card { margin-bottom: 16px; }
/* 仪表盘订单 / 积分 */
.stat-card .value.warn { color: #c98214; }
.chart.wide .c-label { width: 84px; }
.chart.wide .c-value { width: 150px; text-align: right; color: var(--muted); }
.chart.wide .c-value .num-gain { color: var(--success); font-style: normal; }
.chart.wide .c-value .num-consume { color: var(--danger); font-style: normal; }
.chart-summary { margin: 12px 0 0; padding-top: 10px; border-top: 1px dashed var(--border); font-size: 12px; color: var(--muted); }
.trend-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.trend-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.trend-legend-item i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.trend-wrap { position: relative; width: 100%; overflow: hidden; }
.trend-svg { display: block; width: 100%; height: 220px; }
.trend-grid-line { stroke: #edf0f7; stroke-width: 1; }
.trend-axis-text { fill: #8a93a6; font-size: 11px; }
.trend-dot { cursor: default; }
.trend-empty {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    margin: 0; color: var(--muted); font-size: 13px; background: rgba(255,255,255,.8); padding: 2px 10px;
}
.tag-list { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.check-grid { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 2px 0; }
.form .form-row.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 800px) { .form .form-row.three { grid-template-columns: 1fr; } }
