/* 设计令牌见 tokens.css（页面里先 <link> tokens.css，再 <link> app.css） */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    font-family: var(--font);
    font-size: var(--fs);
    line-height: 1.5;
    color: var(--text);
    background:
        radial-gradient(1200px 500px at 10% -10%, var(--brand-soft) 0%, transparent 55%),
        radial-gradient(900px 400px at 100% 0%, var(--accent-soft) 0%, transparent 45%),
        var(--bg);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

/* ==================== 滚动条（统一细窄圆角，去除系统默认粗条与箭头） ====================
 * 说明：Chrome 121+ / Firefox 走 scrollbar-width + scrollbar-color；
 *      其余内核回退到 ::-webkit-scrollbar 伪元素，两套都写以保证一致观感。
 *      仅设伪元素在某些浏览器会被 scrollbar-color 覆盖，因此颜色必须两处同写。
 */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(100, 116, 139, .34) transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track,
::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, .34);
    border: 3px solid transparent;
    border-radius: 999px;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(71, 85, 105, .55); background-clip: padding-box; }
::-webkit-scrollbar-thumb:active { background: rgba(51, 65, 85, .7); background-clip: padding-box; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
/* 侧栏：常驻一条极细淡色滑轨，指针进入后加深，既不抢视线也保持可发现性 */
.sidebar {
    scrollbar-gutter: stable;
    scrollbar-color: rgba(100, 116, 139, .22) transparent;
}
.sidebar:hover { scrollbar-color: rgba(71, 85, 105, .5) transparent; }
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, .22);
    background-clip: padding-box;
    border-width: 2px;
    transition: background .2s ease;
}
.sidebar:hover::-webkit-scrollbar-thumb { background: rgba(71, 85, 105, .5); background-clip: padding-box; }
/* 表格横向滚动：滚动条贴着面板底部，避免大片空白感 */
.table-wrap, .dict-types, .dropdown-panel, .help-body { scrollbar-gutter: stable; }

.app {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(180deg, var(--surface-2) 0%, var(--sidebar) 100%);
    border-right: 1px solid var(--sidebar-border);
    padding: 14px 12px 24px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 16px;
}

.brand-badge {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(145deg, var(--fin-out-soft), var(--st-danger-fg));
    color: #fff;
    display: grid;
    place-items: center;
    font-size: var(--fs-xl);
    box-shadow: 0 8px 18px rgba(225, 29, 72, 0.28);
}

.brand h1 {
    margin: 0;
    font-size: var(--fs-h);
    font-weight: 700;
    letter-spacing: 0.2px;
}

.brand small {
    display: block;
    color: var(--muted);
    font-size: var(--fs-xs);
    margin-top: 2px;
}

.side-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 4px 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--st-info-bg);
    border: 1px solid var(--st-info-bg);
}
.side-user strong { display: block; font-size: var(--fs); }
.side-user span { display: block; font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }

.cell-link {
    color: var(--brand);
    font-weight: 600;
    border-bottom: 1px dashed rgba(37, 99, 235, .35);
}
.cell-link:hover { color: var(--st-info-fg); }

.side-search {
    display: flex;
    gap: 8px;
    padding: 0 4px 14px;
}

.side-search input {
    flex: 1;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 10px;
    padding: 9px 12px;
    outline: none;
    font-size: var(--fs);
}

.side-search input:focus {
    border-color: var(--st-info-line);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.side-search .add-btn {
    width: 38px;
    border: none;
    border-radius: 10px;
    background: var(--brand);
    color: #fff;
    cursor: pointer;
}

.nav-item, .nav-folder-title {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    color: var(--st-neutral-fg);
    font-size: var(--fs);
    margin-bottom: 3px;
}

.nav-item:hover, .nav-folder-title:hover {
    background: var(--st-info-bg);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--brand), var(--brand2));
    color: #fff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
}

.nav-item .dot-menu {
    margin-left: auto;
    opacity: 0.7;
}

.nav-icon {
    width: 18px;
    text-align: center;
    opacity: 0.9;
}

.nav-folder {
    margin-top: 6px;
}

.nav-folder-title {
    cursor: pointer;
    user-select: none;
    font-weight: 600;
}

.nav-folder-title .folder {
    color: var(--fin-warn);
}

.nav-folder-title .count {
    color: var(--muted);
    font-weight: 500;
}

.nav-folder-title .chev {
    margin-left: auto;
    transition: transform .2s ease;
    color: var(--muted-2);
}

.nav-folder.open .nav-folder-title .chev {
    transform: rotate(180deg);
}

.nav-children {
    display: none;
    padding: 2px 0 8px 12px;
}

.nav-folder.open .nav-children {
    display: block;
}

.nav-children a {
    display: block;
    padding: 6px 12px;
    border-radius: 8px;
    color: var(--text-2);
    font-size: var(--fs-sm);
    margin-bottom: 1px;
}

.nav-children a:hover {
    background: var(--line-soft);
}

.nav-children a.active {
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 600;
}

.main {
    padding: 22px 26px 40px;
    min-width: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.crumb {
    color: var(--muted);
    font-size: var(--fs-sm);
    margin-bottom: 4px;
}

.page-title {
    margin: 0;
    font-size: var(--fs-title);
    letter-spacing: 0.2px;
}

.page-desc {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: var(--fs);
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.actions .inline-action-form { display: inline-flex; margin: 0; }

.btn {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    border-radius: 10px;
    padding: 7px 13px;
    font-size: var(--fs);
    cursor: pointer;
    transition: .15s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn-primary {
    background: linear-gradient(135deg, var(--brand), var(--brand2));
    border-color: transparent;
    color: #fff;
}
.btn-ghost { background: transparent; }

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--panel);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
a.stat-card-link { display: block; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
a.stat-card-link:hover { transform: translateY(-2px); border-color: var(--st-info-line); box-shadow: 0 14px 34px rgba(37, 99, 235, 0.12); }

.stat-card::after {
    content: "";
    position: absolute;
    right: -20px;
    top: -20px;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(37,99,235,.12), rgba(15,118,110,.08));
}

.stat-label { color: var(--muted); font-size: var(--fs-sm); }
.stat-value { font-size: var(--fs-kpi); font-weight: 700; margin-top: 6px; }
.stat-foot { margin-top: 6px; font-size: var(--fs-xs); color: var(--accent); }

.grid-2 {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 14px;
    margin-bottom: 16px;
}

.panel {
    background: var(--panel);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}

.panel-head h3 {
    margin: 0;
    font-size: var(--fs-h);
}

.panel-body { padding: 0; }

.table-wrap { overflow: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

th, td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    font-size: var(--fs-sm);
    white-space: nowrap;
}

th {
    color: var(--text-3);
    font-weight: 600;
    background: var(--th-bg);
    position: sticky;
    top: 0;
}

tr:hover td { background: var(--surface-3); }

tr.row-link { cursor: pointer; }
tr.row-link:hover td { background: var(--brand-tint); }
tr.row-link td:first-child { position: relative; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: var(--fs-sm);
    font-weight: 600;
    white-space: nowrap;
}
/* 徽标与各业务中心页的状态胶囊共用同一套状态令牌，避免同一状态出现两种绿/两种橙 */
.badge-ok { background: var(--st-ok-bg); color: var(--st-ok-fg); }
.badge-warn { background: var(--st-warn-bg); color: var(--st-warn-fg); }
.badge-danger { background: var(--st-danger-bg); color: var(--st-danger-fg); }
.badge-info { background: var(--st-info-bg); color: var(--st-info-fg); }
.badge-muted { background: var(--st-muted-bg); color: var(--st-muted-fg); }

.timeline {
    list-style: none;
    margin: 0;
    padding: 16px 18px 8px;
}

.timeline li {
    display: grid;
    grid-template-columns: 16px 1fr;
    gap: 12px;
    padding-bottom: 16px;
}

.timeline .dot {
    width: 10px;
    height: 10px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}

.timeline .meta {
    color: var(--muted);
    font-size: var(--fs-sm);
    margin-bottom: 3px;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}

.toolbar .filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.toolbar input, .toolbar select {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 12px;
    background: #fff;
    min-width: 160px;
}

.empty {
    padding: 48px 20px;
    text-align: center;
    color: var(--muted);
}

.demo-tip {
    margin-top: 14px;
    color: var(--muted);
    font-size: var(--fs-sm);
}

.form-alert {
    margin-bottom: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: var(--fs);
}
.form-alert-ok { background: var(--st-ok-bg); color: var(--st-ok-fg); border: 1px solid var(--st-ok-line); }
.form-alert-error { background: var(--st-alert-bg); color: var(--st-danger-fg); border: 1px solid var(--st-danger-line); }

.form-panel .panel-head a { color: var(--brand); font-size: var(--fs); }
.biz-form { padding: 18px; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
}
.form-item-full { grid-column: 1 / -1; }
.form-item label {
    display: block;
    font-size: var(--fs);
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--st-neutral-fg);
}
.form-item .req { color: var(--st-danger-fg); margin-left: 2px; }
.form-item .hint { color: var(--muted); font-weight: 400; font-size: var(--fs-sm); margin-left: 8px; }
.form-item input,
.form-item select,
.form-item textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 9px 12px;
    background: #fff;
    outline: none;
}
.form-item input:focus,
.form-item select:focus,
.form-item textarea:focus {
    border-color: var(--st-info-line);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.check-line {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    font-weight: 500 !important;
}
.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}
.btn-danger {
    background: #fff;
    border-color: var(--st-danger-line);
    color: var(--st-danger-fg);
    margin-left: auto;
}
.btn-danger:hover { background: var(--st-alert-bg); }
.btn-sm {
    padding: 4px 10px;
    font-size: var(--fs-sm);
    border-radius: 8px;
}
.ops { white-space: nowrap; }

@media (max-width: 860px) {
    .form-grid { grid-template-columns: 1fr; }
}

.related-panel { margin-top: 14px; }
.related-panel .panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.related-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.inline-action { position: relative; }
.inline-action > summary { list-style: none; cursor: pointer; }
.inline-action > summary::-webkit-details-marker { display: none; }
.inline-action-form {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 30;
    width: min(360px, 86vw);
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, .16);
    text-align: left;
}
.inline-action-form textarea { width: 100%; margin-bottom: 10px; }
.related-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 4px 18px 18px;
}
.related-block {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--th-bg);
    padding: 12px 14px;
    min-height: 120px;
}
.related-block-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.related-block-head h4 {
    margin: 0;
    font-size: var(--fs-h);
    font-weight: 600;
    color: var(--text-strong);
}
.related-block-head h4 span {
    display: inline-block;
    margin-left: 6px;
    min-width: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--line);
    color: var(--text-2);
    font-size: var(--fs-sm);
    font-weight: 600;
    text-align: center;
}
.related-block-head a {
    font-size: var(--fs-sm);
    color: var(--brand);
    white-space: nowrap;
}
.related-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}
.related-list li {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;
    font-size: var(--fs);
}
.related-list li span {
    color: var(--text-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.related-empty {
    margin: 8px 0 0;
    color: var(--muted-2);
    font-size: var(--fs);
}
@media (max-width: 960px) {
    .related-grid { grid-template-columns: 1fr; }
}

.bars {
    display: grid;
    gap: 12px;
    padding: 18px;
}

.bar-row { display: grid; grid-template-columns: 72px 1fr 40px; gap: 10px; align-items: center; }
.bar-track {
    height: 10px;
    background: var(--st-info-bg);
    border-radius: 999px;
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand), var(--accent));
}

@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
    .app { grid-template-columns: 1fr; }
    .sidebar {
        position: relative;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--sidebar-border);
    }
    .main { padding: 16px; }
}

/* 页面引导提示条 */
.page-guide {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: linear-gradient(90deg, var(--brand-tint), var(--accent-soft));
    border: 1px solid var(--st-info-bg);
}
.guide-icon {
    flex: 0 0 20px;
    height: 20px;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-size: var(--fs);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.guide-body { margin: 0; color: var(--text-2); font-size: var(--fs); line-height: 1.7; }
.guide-body p { margin: 0; }
.guide-body p + p { margin-top: 4px; }

/* 穿透横幅 */
.drill-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--st-pink-bg);
    border: 1px solid var(--st-pink-line);
    color: var(--st-pink-fg);
    font-size: var(--fs);
}
.drill-icon {
    width: 22px; height: 22px;
    border-radius: 6px;
    background: var(--st-pink-fg);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs);
}
.drill-actions { margin-left: auto; display: flex; gap: 8px; }

/* M64 AI 助手条：业务页面内直接落单 */
.ai-strip { border-bottom: 1px dashed var(--line); background: linear-gradient(120deg, var(--th-bg), var(--brand-tint)); }
.ai-strip > summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 11px 16px;
    cursor: pointer;
    font-size: var(--fs-sm);
    color: var(--text-strong);
}
.ai-strip > summary::-webkit-details-marker { display: none; }
.ai-strip-icon {
    width: 22px; height: 22px; border-radius: 7px;
    background: var(--st-violet-bg); color: var(--st-violet-fg);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; flex: none;
}
.ai-strip-note { color: var(--text-3); font-size: var(--fs-xs); flex: 1; min-width: 220px; line-height: 1.6; }
.ai-strip-more { color: var(--st-violet-fg); font-size: var(--fs-xs); }
.ai-strip-form { padding: 0 16px 14px; display: grid; gap: 10px; }
.ai-strip-form textarea {
    width: 100%; min-height: 60px; padding: 9px 12px;
    border: 1px solid var(--line); border-radius: 9px;
    font: inherit; font-size: var(--fs-sm); line-height: 1.7;
    background: #fff; resize: vertical;
}
.ai-strip-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* 分页器 */
.pager {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid var(--line);
    color: var(--text-3);
    font-size: var(--fs);
}

/* 表单流程步骤条 */
.form-steps {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 12px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--th-bg);
}
.form-step {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--st-info-bg);
    color: var(--text-2);
    font-size: var(--fs-sm);
}
.form-step.on { background: var(--brand); color: #fff; }
.step-no {
    width: 18px; height: 18px;
    border-radius: 999px;
    background: rgba(255,255,255,.85);
    color: var(--brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-xs);
    font-weight: 700;
}
.form-step.on .step-no { background: rgba(255,255,255,.25); color: #fff; }
.step-arrow { color: var(--line-strong); font-size: var(--fs-sm); }

/* 字段帮助说明 */
.field-help {
    margin: 6px 0 0;
    font-size: var(--fs-sm);
    color: var(--text-3);
    line-height: 1.6;
    background: var(--th-bg);
    border-left: 3px solid var(--st-info-line);
    padding: 6px 10px;
    border-radius: 0 8px 8px 0;
}

/* 详情页 */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    padding: 6px 18px 18px;
}
.detail-item {
    padding: 12px 14px;
    border-bottom: 1px dashed var(--bg);
}
.detail-label {
    font-size: var(--fs-sm);
    color: var(--muted-2);
    margin-bottom: 4px;
}
.detail-value {
    font-size: var(--fs);
    color: var(--text-strong);
    font-weight: 500;
    word-break: break-all;
}
.rel-count {
    display: inline-block;
    margin-left: 6px;
    min-width: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--line);
    color: var(--text-2);
    font-size: var(--fs-sm);
    font-weight: 600;
    text-align: center;
}
@media (max-width: 960px) {
    .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .detail-grid { grid-template-columns: 1fr; }
}

/* ==================== 顶栏 / 侧栏折叠 / 说明抽屉（易用性增强） ==================== */
.app.nav-collapsed { grid-template-columns: 0 1fr; }
.app.nav-collapsed .sidebar { width: 0; padding: 0; overflow: hidden; border-right: none; }

.icon-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 10px;
    cursor: pointer;
    font-size: var(--fs-h);
    color: var(--st-neutral-fg);
    text-decoration: none;
    position: relative;
    transition: .15s ease;
}
.icon-btn:hover { border-color: var(--st-info-line); color: var(--brand); background: var(--surface-3); }
.icon-btn.has-badge { overflow: visible; }
.badge-dot {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--fin-out);
    color: #fff;
    font-size: var(--fs-xs);
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}
.nav-hide { width: 26px; height: 26px; font-size: var(--fs-lg); margin-left: auto; flex: 0 0 auto; }
.brand { position: relative; }
.brand-text { min-width: 0; }

.topbar { align-items: center; }
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-left > div { min-width: 0; }
.crumb i { margin: 0 6px; color: var(--line-strong); font-style: normal; }
.crumb span { color: var(--muted-2); }
.crumb span:last-child { color: var(--text-2); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.role-switch select {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 6px 10px;
    background: #fff;
    font-size: var(--fs-sm);
    color: var(--st-neutral-fg);
    max-width: 200px;
    cursor: pointer;
}
.role-switch select:hover { border-color: var(--st-info-line); }

.dropdown { position: relative; }
.dropdown-panel {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 320px;
    max-height: 400px;
    overflow: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, .16);
    z-index: 60;
}
.dropdown.open .dropdown-panel { display: block; }
.dropdown-head, .dropdown-foot {
    padding: 10px 14px;
    font-size: var(--fs-sm);
    color: var(--text-3);
    background: var(--th-bg);
}
.dropdown-head { font-weight: 600; color: var(--text-strong); border-bottom: 1px solid var(--line); }
.dropdown-foot { border-top: 1px solid var(--line); }
.dropdown-loading { padding: 22px 14px; text-align: center; color: var(--muted-2); font-size: var(--fs-sm); }
.todo-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--line-soft);
    font-size: var(--fs-sm);
}
.todo-row:hover { background: var(--surface-3); }
.todo-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); flex: 0 0 8px; }
.todo-danger .todo-dot { background: var(--fin-out); }
.todo-warn .todo-dot { background: var(--fin-warn); }
.todo-info .todo-dot { background: var(--brand); }
.todo-title { flex: 1; color: var(--st-neutral-fg); }
.todo-count {
    min-width: 24px;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--st-info-bg);
    color: var(--st-violet-fg);
    font-weight: 700;
    font-size: var(--fs-sm);
    text-align: center;
}

.quickbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: -6px 0 16px;
    padding: 8px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .72);
    border: 1px solid rgba(226, 232, 240, .9);
}
.quickbar-label { font-size: var(--fs-sm); color: var(--muted-2); font-weight: 600; }
.chip-ext { font-size: var(--fs-xs); color: var(--muted-2); margin-left: 1px; }
.quickbar-tip { margin-left: auto; font-size: var(--fs-xs); color: var(--line-strong); }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: 999px;
    background: var(--line-soft);
    color: var(--text-2);
    font-size: var(--fs-sm);
    transition: .15s ease;
}
.chip:hover { background: var(--st-info-bg); color: var(--st-violet-fg); }
.chip-on { background: var(--brand); color: #fff; }
.chip-on:hover { background: var(--brand2); color: #fff; }

.help-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 360px;
    max-width: 88vw;
    height: 100vh;
    background: #fff;
    border-left: 1px solid var(--line);
    box-shadow: -18px 0 40px rgba(15, 23, 42, .12);
    transform: translateX(102%);
    transition: transform .22s ease;
    z-index: 70;
    display: flex;
    flex-direction: column;
}
.help-drawer.open { transform: translateX(0); }
.help-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(90deg, var(--brand-tint), var(--accent-soft));
}
.help-head h3 { margin: 0; font-size: var(--fs-h); }
.help-head span { font-size: var(--fs-xs); color: var(--text-3); }
.help-body { padding: 14px 16px 24px; overflow: auto; font-size: var(--fs-sm); color: var(--st-neutral-fg); line-height: 1.7; }
.help-body h4 { margin: 14px 0 6px; font-size: var(--fs); color: var(--text-strong); }
.help-lead { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--st-sky-bg); border: 1px solid var(--st-info-bg); color: var(--st-info-fg); }
.help-body ul { margin: 0; padding-left: 18px; }
.help-body li + li { margin-top: 6px; }
.drawer-mask {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .28);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 65;
}
.drawer-mask.show { opacity: 1; pointer-events: auto; }

/* ==================== 批量操作条 ==================== */
.bulk-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 18px;
    background: var(--th-bg);
    border-bottom: 1px solid var(--line);
    font-size: var(--fs);
}
.bulk-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.muted-note { color: var(--text-3); font-size: var(--fs-sm); }
.col-check { width: 42px; }
.col-ops { width: 140px; }
.quick-panel { margin-bottom: 14px; }
.quick-links { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 18px; }
.pager-size select { border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }
.pager-size { margin-right: auto; color: var(--text-3); font-size: var(--fs); }
.empty-actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }

/* ==================== 导入页 ==================== */
.import-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    padding: 18px;
}
.import-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
    background: var(--th-bg);
}
.import-card h4 { margin: 0 0 8px; font-size: var(--fs); display: flex; align-items: center; gap: 8px; }
.import-card h4 .step-no { background: var(--brand); color: #fff; }
.import-form { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 8px; }
.import-form input[type="file"] { flex: 1; min-width: 0; font-size: var(--fs-sm); }
.import-preview { padding: 0 18px 18px; }
.import-preview h4 { margin: 12px 0 8px; font-size: var(--fs); }
.error-list { margin: 0 18px 16px; padding: 12px 16px; border-radius: 12px; background: var(--st-alert-bg); border: 1px solid var(--st-danger-line); }
.error-list h4 { margin: 0 0 8px; font-size: var(--fs); color: var(--st-danger-fg); }
.error-list ul { margin: 0; padding-left: 18px; max-height: 260px; overflow: auto; font-size: var(--fs-sm); color: var(--st-alert-fg); }

/* ==================== 手机填报 ==================== */
.mobile-hero {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 22px;
    padding: 20px;
}
.qr-box {
    text-align: center;
    padding: 14px;
    border: 1px dashed var(--line-strong);
    border-radius: 14px;
    background: var(--th-bg);
}
.qr-box img { border-radius: 8px; background: #fff; }
/* 二维码：本地 SVG 渲染（无外部请求，秒开） */
.qr-box > div[data-qr], .qr-box .qr-svg { max-width: 100%; }
.qr-svg { border-radius: 8px; background: #fff; display: block; margin: 0 auto; }
.qr-fallback {
    display: inline-block; padding: 28px 16px; border-radius: 8px; background: #fff;
    color: var(--brand); font-size: var(--fs-sm); word-break: break-all;
}
.mini-qr .qr-svg { width: 120px; height: 120px; }
.mobile-info h4 { margin: 4px 0 8px; font-size: var(--fs-h); }
.mobile-info p { margin: 0 0 12px; color: var(--text-3); font-size: var(--fs-sm); line-height: 1.7; }
.copy-line { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.copy-line input {
    flex: 1;
    min-width: 220px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: var(--fs-sm);
    color: var(--text-2);
    background: #fff;
}
.mobile-points { margin: 14px 0 0; padding-left: 18px; color: var(--text-2); font-size: var(--fs); line-height: 1.8; }
.mobile-sub { margin: 4px 20px 10px; font-size: var(--fs); }
.mobile-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    padding: 0 20px 20px;
}
.mobile-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    background: #fff;
    display: grid;
    gap: 10px;
    justify-items: start;
}
.mobile-card-head { display: flex; gap: 10px; align-items: flex-start; }
.mobile-ico {
    width: 30px; height: 30px; flex: 0 0 30px;
    border-radius: 9px;
    background: var(--st-info-bg);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: var(--fs-h);
}
.mobile-card h5 { margin: 0 0 4px; font-size: var(--fs); }
.mobile-card p { margin: 0; font-size: var(--fs-sm); color: var(--text-3); line-height: 1.6; }
.mini-qr { border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* ==================== 系统设置 ==================== */
.dict-layout { display: grid; grid-template-columns: 300px 1fr; gap: 14px; align-items: start; margin-bottom: 14px; }
.dict-types { list-style: none; margin: 0; padding: 10px 12px; max-height: 620px; overflow: auto; }
.dict-types li {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 4px;
}
.dict-types li:hover { background: var(--line-soft); }
.dict-types li.on { background: var(--brand-soft); }
.dict-types li a { flex: 1; min-width: 0; }
.dict-types li strong { display: block; font-size: var(--fs); color: var(--text-strong); }
.dict-types li code { font-size: var(--fs-xs); color: var(--muted-2); }
.dict-tag {
    font-size: var(--fs-xs);
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--st-info-bg);
    color: var(--st-violet-fg);
}
.dict-hint { margin: 0; padding: 10px 16px 14px; font-size: var(--fs-sm); color: var(--muted-2); line-height: 1.7; }
.dict-item-form { background: var(--th-bg); border-bottom: 1px solid var(--line); }
.perm-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.perm-group { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--th-bg); }
.perm-group h4 { margin: 0 0 8px; font-size: var(--fs); color: var(--text-strong); }
.perm-items { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: var(--fs); }
.theme-preview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 18px; }
.theme-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    background: #fff;
    display: grid;
    gap: 6px;
    font-size: var(--fs);
}
.theme-card.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.theme-card code { font-size: var(--fs-xs); color: var(--muted-2); }
.theme-swatch { height: 44px; border-radius: 9px; }
.std-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 18px; }
.std-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--th-bg); }
.std-card h4 { margin: 0 0 8px; font-size: var(--fs); color: var(--text-strong); }
.std-card ul { margin: 0; padding-left: 18px; color: var(--text-2); font-size: var(--fs); line-height: 1.8; }
.about-hero { display: flex; gap: 16px; align-items: center; padding: 18px; }
.about-logo {
    width: 62px; height: 62px; flex: 0 0 62px;
    border-radius: 16px;
    background: linear-gradient(145deg, var(--brand), var(--accent));
    color: #fff;
    font-size: var(--fs-hero);
    display: grid; place-items: center;
    box-shadow: 0 12px 26px rgba(37, 99, 235, .28);
}
.about-hero h4 { margin: 0 0 6px; font-size: var(--fs-title); }
.about-hero p { margin: 0 0 4px; }
.kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 0 18px 18px; }
.about-kpis .kpi a { display: block; }
.kpi {
    display: block;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    background: var(--th-bg);
    transition: .15s ease;
}
a.kpi:hover { border-color: var(--st-info-line); background: var(--surface-3); transform: translateY(-1px); }
.kpi span { display: block; font-size: var(--fs-sm); color: var(--muted); }
.kpi strong { display: block; font-size: calc(var(--fs-kpi) - 2px); margin: 4px 0 2px; color: var(--text); }
.kpi em { font-style: normal; font-size: var(--fs-xs); color: var(--muted-2); }
.field-error { margin: 6px 0 0; font-size: var(--fs-xs); color: var(--st-danger-fg); }
.input-error { border-color: var(--fin-out-soft) !important; background: var(--st-alert-bg) !important; }

/* 表单控件统一跟随界面字号，避免各浏览器默认 16px 显得突兀 */
.form-item label,
.form-item input,
.form-item select,
.form-item textarea {
    font-size: var(--fs);
}

@media (max-width: 1100px) {
    .import-grid, .mobile-grid, .theme-preview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dict-layout { grid-template-columns: 1fr; }
    .std-grid, .perm-groups { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mobile-hero { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .app.nav-collapsed { grid-template-columns: 1fr; }
    .import-grid, .mobile-grid, .theme-preview { grid-template-columns: 1fr; }
    .help-drawer { width: 100%; }
    .topbar { flex-direction: column; align-items: stretch; }
    .topbar-right { justify-content: flex-start; }
    .quickbar-tip { display: none; }
}

/* 紧凑密度（系统设置 → 布局密度） */
:root { --row-pad: 12px 14px; }
th, td { padding: var(--row-pad); }


/* 详情页：关联主体与经营指标 */
.detail-chain {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
    padding: 0 18px 12px;
}
.detail-chain .chain-label { font-size: var(--fs-xs); color: var(--muted); }
.detail-chain .chain-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 10px; border: 1px solid var(--st-info-bg); border-radius: 999px;
    background: var(--brand-tint); color: var(--st-info-fg); font-size: var(--fs-sm); text-decoration: none;
    transition: background .15s ease, border-color .15s ease;
}
.detail-chain .chain-chip:hover { background: var(--st-info-line); border-color: var(--st-info-line); }
.detail-chain .chain-chip em { font-style: normal; font-size: var(--fs-xs); color: var(--st-info-line); }
.detail-kpis {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px; padding: 0 18px 14px;
}
.detail-kpi {
    border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
    background: linear-gradient(180deg, var(--surface-3) 0%, var(--surface-3) 100%);
}
.detail-kpi span { display: block; font-size: var(--fs-xs); color: var(--text-3); }
.detail-kpi strong { display: block; margin-top: 4px; font-size: var(--fs-lg); color: var(--text-strong); letter-spacing: -.01em; }
@media (max-width: 860px) {
    .detail-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 系统管理导航卡片 */
.sys-nav-panel { margin-bottom: 14px; }
.sys-nav-grid {
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px; padding: 14px 16px;
}
.sys-nav-card {
    display: grid; gap: 3px; padding: 12px 14px; border-radius: 12px;
    border: 1px solid var(--line); background: var(--th-bg); transition: .15s ease;
}
.sys-nav-card:hover { border-color: var(--st-info-line); background: var(--brand-tint); transform: translateY(-1px); }
.sys-nav-card span { font-size: var(--fs-title); line-height: 1.2; }
.sys-nav-card strong { font-size: var(--fs); color: var(--text-strong); }
.sys-nav-card em { font-style: normal; font-size: var(--fs-xs); color: var(--muted-2); }
@media (max-width: 1100px) { .sys-nav-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .sys-nav-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }


/* ==========================================================================
   字体与层级统一（v40）
   - 所有正文字号走 --fs 标度，由「系统设置 → 界面字号」统一缩放；
   - 标题 / 表格 / 表单 / 按钮 / 徽标各归一个层级，避免同屏 10~18px 混排。
   ========================================================================== */
body { line-height: 1.55; letter-spacing: 0; }
h1, h2, h3, h4, h5 { line-height: 1.35; }
.page-title { font-size: var(--fs-title); font-weight: 700; margin: 0; letter-spacing: -.01em; }
.panel-head h3, .panel h3, .form-panel .panel-head h3 { font-size: var(--fs-h); font-weight: 700; }
.panel-head .muted-note, .muted-note { font-size: var(--fs-sm); line-height: 1.6; }
.form-item > label { font-size: var(--fs-sm); font-weight: 600; }
.field-help, .field-error { font-size: var(--fs-xs); line-height: 1.6; }
input, select, textarea { font-size: var(--fs); line-height: 1.5; }
.btn { font-size: var(--fs-sm); line-height: 1.45; }
.btn-sm { font-size: var(--fs-xs); }
.badge, .tag, .pill, .status-badge { font-size: var(--fs-sm); line-height: 1.45; }
.table-wrap th { font-size: var(--fs-sm); font-weight: 600; }
.table-wrap td { font-size: var(--fs); }
.crumb, .crumb a, .crumb span, .crumb i { font-size: var(--fs-xs); }
.side-user strong { font-size: var(--fs-sm); }
.side-user span { font-size: var(--fs-xs); }
.nav-item, .nav-children a, .nav-folder-title { font-size: var(--fs-sm); }
.brand h1 { font-size: var(--fs-h); }
.brand small { font-size: var(--fs-xs); }
.stat-card .label, .detail-kpi span { font-size: var(--fs-sm); }
.stat-card .value { font-size: var(--fs-kpi); }
.detail-kpi strong { font-size: var(--fs-kpi); }
.dropdown-panel, .popup-body, .quick-item strong, .rail-row { font-size: var(--fs-sm); }
.pager-info, .pager-jump, .pager-size { font-size: var(--fs-sm); }
.form-alert, .drill-banner { font-size: var(--fs-sm); line-height: 1.6; }
@media print { body { font-size: var(--fs-sm); } }
/* ==================== 模块状态色别名 ====================
 * 30+ 中心页各自定义了 .xx-ok / .xx-warn 等同义类，此前每个文件重复一遍。
 * 现统一在此定义：语义色只维护这一份，视图里只保留模块特有的横幅 / 边框变体。
 */

.ac-ok, .bw-ok, .cc-ok, .dc-ok, .dlv-ok, .fr-ok, .is-ok, .nc-ok, .pp-ok, .sw-ok, .tr-ok, .vc-ok { background: var(--st-ok-bg); color: var(--st-ok-fg); }
.ac-warn, .bw-warn, .cc-warn, .dc-warn, .dlv-warn, .fr-warn, .nc-warn, .pp-warn, .sw-warn, .tr-warn, .vc-warn { background: var(--st-warn-bg); color: var(--st-warn-fg); }
.bw-bad, .cc-bad, .dc-bad, .dlv-bad, .fr-bad, .is-bad, .nc-bad, .pp-bad, .tr-bad { background: var(--st-danger-bg); color: var(--st-danger-fg); }
.ac-danger, .dc-danger, .sw-danger { background: var(--st-danger-bg); color: var(--st-danger-fg); }
.ac-info, .cc-info, .dc-info, .dlv-info, .fr-info, .nc-info, .pp-info, .sw-info, .tr-info, .vc-info { background: var(--st-info-bg); color: var(--st-info-fg); }
.ac-muted, .bw-muted, .cc-muted, .dc-muted, .dlv-muted, .fr-muted, .is-muted, .nc-muted, .pp-muted, .sw-muted, .tr-muted, .vc-muted { background: var(--st-muted-bg); color: var(--st-muted-fg); }
