/* AI 中台门户样式：信息分层为小块，配色与上游演示页刻意不同 */

:root {
    --bg: #eef0f8;
    --bg-soft: #ffffff;
    --surface-2: #f6f7fb;
    --surface-3: #eef1f8;
    /* 氛围底三团光晕：左上暖桃、右上长春花蓝、左下青绿，参考图那种"整页有颜色但不脏"的效果 */
    --wash-1: rgba(99, 102, 241, .20);
    --wash-2: rgba(251, 146, 60, .17);
    --wash-3: rgba(20, 184, 166, .13);
    --ink: #171a2b;
    --ink-2: #4b5265;
    --ink-3: #626a7e;
    --line: #e4e7f0;
    --line-2: #cfd5e4;
    --radius: 20px;
    --radius-sm: 12px;
    --radius-xs: 9px;
    --shadow: 0 1px 2px rgba(23, 26, 43, .04), 0 18px 40px -22px rgba(23, 26, 43, .22);
    --shadow-hi: 0 2px 6px rgba(23, 26, 43, .06), 0 30px 60px -24px rgba(23, 26, 43, .3);
    --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    --green: #157a55;
    --green-bg: #e8f6f0;
    --amber: #9a6212;
    --amber-bg: #fdf3e3;
    --grey: #5f6774;
    --grey-bg: #eceef2;
    --red: #b4232b;
    --red-bg: #fdecec;
    --code-bg: #14161a;
    --code-ink: #dfe3ea;
    --wrap-w: 1400px;
    --accent: #14161a;
    --acc: var(--ink);
}

/* 深色：文字/色条用的强调色由 js/core/theme.js 按模块色提亮后写成 --acc（自定义属性在声明处解析，
   不能在这里用 var(--accent) 中转，否则会丢掉卡片上的模块色）；底色类仍由 color-mix 就地混合 */
html[data-theme="dark"] {
    --bg: #0e1117;
    --bg-soft: #161a22;
    --surface-2: #1b2029;
    --surface-3: #131822;
    --ink: #eaeef6;
    --ink-2: #b3bccd;
    --ink-3: #828da0;
    --line: #242b38;
    --line-2: #39424f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .34), 0 16px 40px -22px rgba(0, 0, 0, .6);
    --shadow-hi: 0 2px 8px rgba(0, 0, 0, .38), 0 28px 60px -26px rgba(0, 0, 0, .72);
    --green: #5ecfa2;
    --green-bg: #14312a;
    --amber: #e3ae6d;
    --amber-bg: #342816;
    --grey: #9aa4b3;
    --grey-bg: #232833;
    --red: #ef8488;
    --red-bg: #35202a;
    --code-bg: #0a0d12;
    --code-ink: #d5dae3;
    --wash-1: rgba(129, 140, 248, .22);
    --wash-2: rgba(251, 146, 60, .10);
    --wash-3: rgba(45, 212, 191, .12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

body {
    font-family: var(--sans);
    /* 氛围底：三团彩色光晕压在冷灰底上，随文档滚动（不贴视口，免得每屏重复一次晕染）。
       白色卡片浮在这种底上才分得出层；纯灰底会被眼睛读成"全白" */
    background:
        radial-gradient(1100px 620px at 88% -180px, var(--wash-1), transparent 66%),
        radial-gradient(900px 520px at 2% -120px, var(--wash-2), transparent 64%),
        radial-gradient(1000px 700px at -8% 42%, var(--wash-3), transparent 62%),
        linear-gradient(180deg, var(--surface-3), var(--bg) 520px),
        var(--bg);
    background-repeat: no-repeat;
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 15.5px;
    line-height: 1.78;
    -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: var(--wrap-w); margin: 0 auto; padding: 0 30px; }
.hidden { display: none !important; }
.muted { color: var(--ink-3); font-size: 14.5px; }

code { font-family: var(--mono); font-size: .92em; }

/* ── 顶栏 ───────────────────────────────────────────────── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: color-mix(in srgb, var(--bg-soft) 82%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 74px; }

.brand { display: flex; align-items: center; gap: 13px; text-decoration: none; color: inherit; }

.brand-mark {
    width: 40px; height: 40px;
    border-radius: 13px;
    background: linear-gradient(140deg, #4f46e5, #7c6cf0 55%, #4338ca);
    color: #fff;
    font-size: 14px; font-weight: 700; letter-spacing: .5px;
    display: grid; place-items: center;
    box-shadow: 0 8px 18px -8px rgba(79, 70, 229, .7);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { font-size: 17px; font-weight: 650; }
.brand-text em { font-style: normal; font-size: 13px; color: var(--ink-3); }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.chip {
    display: inline-flex; align-items: center; gap: 9px;
    padding: 9px 15px 9px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg-soft) 88%, var(--surface-3));
    box-shadow: 0 1px 2px rgba(23, 26, 43, .05);
    font-size: 14px; color: var(--ink-2);
}
.led { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); flex: none; }
.chip.ok .led { background: #22a06b; box-shadow: 0 0 0 4px rgba(34, 160, 107, .16); }
.chip.bad .led { background: var(--red); box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 18%, transparent); }

.ghost-btn, .solid-btn, .icon-btn {
    font: inherit; font-size: 14px;
    padding: 9px 16px;
    border-radius: 999px;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.ghost-btn { background: transparent; border: 1px solid var(--line-2); color: var(--ink-2); }
.ghost-btn:hover { border-color: var(--ink-3); color: var(--ink); background: var(--bg-soft); }
.solid-btn { background: var(--ink); border: 1px solid var(--ink); color: var(--bg); }
.solid-btn:hover { background: color-mix(in srgb, var(--ink) 80%, var(--bg)); }
.icon-btn {
    width: 38px; height: 38px; padding: 0;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg-soft) 88%, var(--surface-3)); color: var(--ink-2);
    font-size: 15px; line-height: 1;
    border-radius: 50%;
    display: grid; place-items: center;
    box-shadow: 0 1px 2px rgba(23, 26, 43, .05);
}
.icon-btn:hover { border-color: var(--line-2); color: var(--ink); box-shadow: var(--shadow); }

/* ── API 设置 ───────────────────────────────────────────── */
.settings { border-top: 1px solid var(--line); background: var(--surface-2); }
.settings-inner { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px 16px; padding: 20px 30px 22px; align-items: center; }
.settings label { font-size: 14px; color: var(--ink-2); }
.settings input {
    width: 100%; font: 14px/1.6 var(--mono);
    padding: 9px 12px;
    border: 1px solid var(--line-2); border-radius: 8px;
    background: var(--bg-soft); color: var(--ink);
}
.settings input:focus { outline: 2px solid color-mix(in srgb, var(--ink-3) 45%, transparent); border-color: var(--ink-3); }
.settings .solid-btn { grid-column: 2; justify-self: start; margin-top: 4px; }
.settings-tip { grid-column: 2; font-size: 13px; color: var(--ink-3); }

/* ── 账号管理与调用审计（抽屉内，只在 ADMIN_TOKEN 已设置时出现） ── */
.adm { grid-column: 1 / -1; margin-top: 6px; padding-top: 16px; border-top: 1px dashed var(--line-2); }
.adm-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.adm-head b { font-size: 15px; font-weight: 620; }
.adm-state { font: 12.5px/1.5 var(--mono); color: var(--ink-3); flex: 1; min-width: 200px; }
.adm-new { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.adm-new input { flex: 1; min-width: 150px; }
.adm-key {
    margin-top: 12px; padding: 12px 14px;
    background: var(--amber-bg); border-radius: var(--radius-xs);
    font-size: 13px; line-height: 1.7; color: var(--amber);
}
.adm-key b { display: block; margin-bottom: 6px; }
.adm-key code { display: block; font: 13px/1.6 var(--mono); color: var(--ink); word-break: break-all; user-select: all; }
.adm-list { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.adm-row {
    display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
    padding: 10px 13px; background: var(--surface-3);
    border: 1px solid var(--line); border-radius: var(--radius-xs);
}
.adm-row.off { opacity: .62; }
.adm-led { width: 8px; height: 8px; border-radius: 50%; background: var(--grey); flex: none; }
.adm-led.green { background: var(--green); }
.adm-name { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.adm-keyp { font: 12px var(--mono); color: var(--ink-2); background: var(--bg-soft); border: 1px solid var(--line); padding: 2px 7px; border-radius: 6px; }
.adm-meta { font-size: 12.5px; color: var(--ink-3); }
.adm-ops { margin-left: auto; display: flex; gap: 8px; }
.ghost-btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 34%, var(--line)); }
.adm-filter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; font-size: 13px; color: var(--ink-2); }
.adm-filter select { padding: 5px 8px; border: 1px solid var(--line-2); border-radius: var(--radius-xs); background: var(--bg-soft); color: var(--ink); font: inherit; }
.adm-check { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; white-space: nowrap; }
.adm-count { font: 12.5px var(--mono); color: var(--ink-3); }
.adm-pager { margin-left: auto; display: flex; gap: 8px; }
.adm-audit { margin-top: 10px; max-height: 380px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-xs); }
.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.adm-table th, .adm-table td { padding: 8px 11px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.adm-table th { position: sticky; top: 0; background: var(--surface-3); font-weight: 600; color: var(--ink-3); font-size: 12.5px; }
.adm-table td.c { text-align: center; }
.adm-table td.mono { font-family: var(--mono); color: var(--ink-3); }
.adm-table code { font: 12px var(--mono); color: var(--ink-2); }
.adm-code { display: inline-block; min-width: 34px; padding: 1px 6px; border-radius: 6px; font: 12px var(--mono); text-align: center; }
.adm-code.ok { color: var(--green); background: var(--green-bg); }
.adm-code.warn { color: var(--amber); background: var(--amber-bg); }
.adm-code.bad { color: var(--red); background: var(--red-bg); }
.adm-empty { padding: 14px 16px; font-size: 13.5px; color: var(--ink-3); }
.adm-hint { margin-top: 10px; font-size: 12.5px; line-height: 1.7; color: var(--ink-3); }

/* ── 主体：常驻左导航 + 右内容 ─────────────────────────── */
.shell {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
    flex: 1;
    padding: 24px 26px 52px;
}
.maincol { min-width: 0; }

/* 导航做成一块浮在氛围底上的圆角卡，而不是贴在页面边缘的一列文字 */
.sidenav {
    position: sticky;
    top: 92px;
    display: flex; flex-direction: column; gap: 2px;
    background: color-mix(in srgb, var(--bg-soft) 92%, var(--surface-3));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 11px 16px;
}
.sn-group {
    display: flex; align-items: center; gap: 7px;
    font-size: 11.5px; font-weight: 620; color: var(--ink-3); letter-spacing: 1px;
    padding: 12px 10px 5px;
}
.sn-group::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--line-2); }
.sn-group + .sn-group { margin-top: 6px; }
.sn-item {
    position: relative;
    display: flex; align-items: center; gap: 9px;
    width: 100%; text-align: left;
    font: inherit; font-size: 14px; color: var(--ink-2);
    background: transparent; border: 0; border-radius: var(--radius-sm);
    padding: 9px 10px; cursor: pointer;
    transition: background .14s, color .14s, box-shadow .14s;
}
.sn-item:hover { background: var(--surface-2); color: var(--ink); }
.sn-item.active {
    background: var(--surface-3);
    color: var(--ink); font-weight: 620;
    box-shadow: inset 0 0 0 1px var(--line);
}
.sn-item.active::before {
    content: ""; position: absolute; left: 0; top: 9px; bottom: 9px;
    width: 3px; border-radius: 0 3px 3px 0; background: var(--acc, var(--ink));
}
.sn-item.active::after {
    content: "›";
    width: 20px; height: 20px; flex: none;
    display: grid; place-items: center;
    border-radius: 50%; background: var(--bg-soft); border: 1px solid var(--line);
    color: var(--ink-3); font-size: 13px; line-height: 1;
}
.sn-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sn-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--line-2); }
.sn-dot.green { background: #22a06b; box-shadow: 0 0 0 3px rgba(34, 160, 107, .15); }
.sn-dot.amber { background: var(--amber); box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 18%, transparent); }
.sn-dot.grey { background: var(--ink-3); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink-3) 18%, transparent); }
.sn-dot.red { background: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 18%, transparent); }
.sn-badge {
    font: 12px/1.4 var(--mono);
    padding: 3px 8px; border-radius: 999px;
    background: var(--amber-bg); color: var(--amber);
}

/* 总览数字条：图标块 + 大数字 + 占比条，参考图里那排 KPI 卡的骨架 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat {
    position: relative;
    background: linear-gradient(158deg, var(--bg-soft), var(--surface-2));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 15px 17px 17px;
    overflow: hidden;
}
.st-top { display: flex; align-items: center; gap: 10px; }
.st-icon {
    width: 28px; height: 28px; flex: none;
    border-radius: 9px;
    display: grid; place-items: center;
    font-size: 13px; line-height: 1;
    background: var(--surface-3); border: 1px solid var(--line); color: var(--ink-3);
}
.st-top b { font-size: 25px; font-weight: 700; letter-spacing: -.6px; line-height: 1.15; }
.st-top i { font-style: normal; font-size: 12.5px; color: var(--ink-3); align-self: baseline; }
.st-label { font-size: 13.5px; font-weight: 600; color: var(--ink); margin-top: 9px; }
.st-hint { font-size: 12.5px; line-height: 1.6; color: var(--ink-3); margin-top: 2px; }
.st-bar { display: block; height: 3px; border-radius: 999px; background: var(--surface-3); margin-top: 11px; overflow: hidden; }
.st-bar > i { display: block; height: 100%; border-radius: 999px; background: var(--ink-3); }
.stat.green .st-icon { background: var(--green-bg); border-color: color-mix(in srgb, var(--green) 26%, transparent); color: var(--green); }
.stat.green .st-bar > i { background: var(--green); }
.stat.amber .st-icon { background: var(--amber-bg); border-color: color-mix(in srgb, var(--amber) 26%, transparent); color: var(--amber); }
.stat.amber .st-bar > i { background: var(--amber); }
.stat.grey .st-icon { background: var(--surface-3); color: var(--ink-3); }
.stat.grey .st-bar > i { background: var(--line-2); }

/* 详情：左侧内容目录（同样做成浮起的小卡，跟左导航一个语言） */
.detail-body { display: grid; grid-template-columns: 176px minmax(0, 1fr); gap: 20px; align-items: start; }
.toc {
    position: sticky; top: 92px;
    display: flex; flex-direction: column; gap: 2px;
    max-height: calc(100vh - 124px); overflow: auto;
    padding: 12px 10px;
    background: color-mix(in srgb, var(--bg-soft) 92%, var(--surface-3));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.toc a {
    position: relative;
    font-size: 13px; line-height: 1.5; color: var(--ink-3); text-decoration: none;
    padding: 8px 10px; border-radius: var(--radius-sm);
    transition: background .14s, color .14s;
}
.toc a:hover { color: var(--ink); background: var(--surface-2); }
.toc a.on { color: var(--ink); font-weight: 620; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line); }
.toc a.on::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--acc); }

/* ── 页首英雄区：左文案右拓扑图 ─────────────────────────── */
.hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 268px;
    gap: 28px;
    align-items: center;
    margin-bottom: 22px;
    padding: 26px 28px 27px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        radial-gradient(520px 260px at 96% -40%, color-mix(in srgb, var(--wash-1) 90%, transparent), transparent 70%),
        linear-gradient(118deg, color-mix(in srgb, var(--wash-2) 42%, var(--bg-soft)), var(--bg-soft) 58%);
    box-shadow: var(--shadow-hi);
    overflow: hidden;
}
.hero::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: linear-gradient(180deg, #6366f1, #f59e0b); }
.eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 12px; font-weight: 600; letter-spacing: .6px;
    padding: 5px 11px; border-radius: 999px;
    background: color-mix(in srgb, #6366f1 12%, var(--bg-soft));
    border: 1px solid color-mix(in srgb, #6366f1 26%, transparent);
    color: #4f46e5;
}
html[data-theme="dark"] .eyebrow { color: #b3baff; }
.hero h1 { font-size: 31px; font-weight: 700; letter-spacing: -.7px; line-height: 1.28; margin: 13px 0 10px; }
.hero p { color: var(--ink-2); font-size: 15px; line-height: 1.8; max-width: 760px; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.hero-chips code {
    font-size: 12px; line-height: 1.5;
    padding: 5px 11px; border-radius: 999px;
    background: var(--surface-3); border: 1px solid var(--line); color: var(--ink-3);
}
.hero-art { display: grid; place-items: center; }
.hero-art svg { width: 268px; height: 188px; overflow: visible; }
.hub-spoke { stroke: var(--line-2); stroke-width: 1.4; stroke-dasharray: 4 5; }
.hub-spoke.live { stroke-dasharray: none; stroke: color-mix(in srgb, #6366f1 45%, var(--line-2)); }
.hub-core { fill: var(--ink); }
.hub-core-ink { fill: var(--bg-soft); font: 600 13px/1 var(--sans); }
.hub-ring { stroke-width: 2; }
.hub-glyph { font: 600 14px/1 var(--sans); }
.hub-cap { fill: var(--ink-3); font: 11.5px var(--sans); }

/* ── 模块进度带：一条线上摆五个模块，点一下就进详情 ─────── */
.rail { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; margin-bottom: 24px; padding-top: 5px; }
.rail-node { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0 5px; background: none; border: 0; font: inherit; cursor: pointer; }
.rail-node::before { content: ""; position: absolute; top: 5px; left: -50%; width: 100%; height: 2px; background: var(--line); }
.rail-node:first-child::before { display: none; }
.rn-dot { position: relative; z-index: 1; width: 12px; height: 12px; border-radius: 50%; background: var(--line-2); box-shadow: 0 0 0 3px var(--bg); transition: transform .14s; }
.rn-dot.on { background: var(--acc); box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px color-mix(in srgb, var(--acc) 22%, transparent); }
.rn-dot.off { background: var(--surface-3); border: 2px solid var(--line-2); box-shadow: 0 0 0 3px var(--bg); }
.rn-name { font-size: 13px; font-weight: 560; color: var(--ink-2); text-align: center; line-height: 1.4; }
.rn-state { font-size: 11.5px; color: var(--ink-3); text-align: center; }
.rail-node:hover .rn-dot { transform: scale(1.25); }
.rail-node:hover .rn-name { color: var(--ink); }
.rail-node.current .rn-name { color: var(--ink); font-weight: 640; }

/* ── 能力卡片 ───────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }

/* 卡片网格里的分组标题：横跨整行，用来把「已就位」和「排期中」分开 */
.grid-label {
    grid-column: 1 / -1;
    display: flex; align-items: baseline; gap: 10px;
    margin: 8px 0 -4px;
    font-size: 14px; font-weight: 620; color: var(--ink);
}
.grid-label::before { content: ""; flex: none; width: 16px; height: 2px; border-radius: 2px; background: var(--line-2); align-self: center; }
.grid-label span { font-size: 13px; font-weight: 400; color: var(--ink-3); }

.module-card {
    position: relative;
    display: flex; flex-direction: column; gap: 12px;
    padding: 19px 20px 17px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    cursor: pointer;
    overflow: hidden;
    transition: transform .16s, box-shadow .16s, border-color .16s;
}
.module-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--acc); }
/* 右上角一抹模块色的柔光，卡片不再是平整的一块白 */
.module-card::after {
    content: ""; position: absolute; top: -56px; right: -48px; width: 148px; height: 148px;
    border-radius: 50%; background: color-mix(in srgb, var(--acc) 13%, transparent); filter: blur(4px); pointer-events: none;
}
.module-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hi); border-color: color-mix(in srgb, var(--acc) 30%, var(--line)); }
.module-card > * { position: relative; z-index: 1; }

/* 排期中的模块：不实心、不加投影，一眼和已实现的分开 */
.module-card.planned {
    background: color-mix(in srgb, var(--bg-soft) 74%, var(--surface-3));
    border-style: dashed;
    border-color: var(--line-2);
    box-shadow: none;
}
.module-card.planned::after { opacity: .45; }
.module-card.planned:hover { box-shadow: var(--shadow); border-color: var(--acc); }

/* 标题与角标同行；万一将来角标变长，让它整条换到第二行，而不是把标题挤成两行 */
.mc-top { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 7px 11px; }
.mc-top .pill { margin-left: auto; }
.mc-top h3 { font-size: 16.5px; font-weight: 680; letter-spacing: -.2px; flex: 1 1 auto; min-width: 0; line-height: 1.4; padding-top: 2px; }
.mc-icon {
    width: 34px; height: 34px; flex: none;
    border-radius: 11px;
    display: grid; place-items: center;
    font-size: 15px; line-height: 1;
    background: color-mix(in srgb, var(--acc) 15%, var(--bg-soft));
    border: 1px solid color-mix(in srgb, var(--acc) 28%, transparent);
    color: var(--acc);
}
.mc-hero { font-size: 14px; color: var(--ink-2); flex: 1; line-height: 1.72; }

.facts { display: flex; flex-direction: column; gap: 0; padding-top: 2px; }
.fact {
    display: grid; grid-template-columns: 84px 1fr; gap: 12px;
    font-size: 13.5px; line-height: 1.62;
    padding: 7px 0; border-top: 1px dashed var(--line);
}
.fact b { color: var(--ink-3); font-weight: 500; }
.fact span { color: var(--ink-2); }

.mc-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 2px; padding-top: 12px; border-top: 1px solid var(--line); }
.mc-entry { font: 12px/1.5 var(--mono); color: var(--acc); background: color-mix(in srgb, var(--acc) 12%, var(--bg-soft)); border: 1px solid color-mix(in srgb, var(--acc) 22%, transparent); padding: 5px 10px; border-radius: 999px; }
.mc-go { font-size: 13.5px; font-weight: 560; color: var(--ink-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.mc-go::after { content: "›"; font-size: 15px; color: var(--acc); transition: transform .16s; }
.module-card:hover .mc-go::after { transform: translateX(3px); }

.pill {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 560; line-height: 1.4;
    padding: 4px 10px; border-radius: 999px;
    background: var(--grey-bg); color: var(--grey);
    white-space: nowrap; flex: none;
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.amber { background: var(--amber-bg); color: var(--amber); }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.grey { background: var(--grey-bg); color: var(--grey); }

/* ── 能力自检条 ─────────────────────────────────────────── */
.linkup {
    margin-top: 24px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.linkup-head {
    display: flex; align-items: center; gap: 11px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(120deg, var(--surface-2), var(--bg-soft));
}
.linkup-head h2 { font-size: 16px; font-weight: 660; flex: 1; }
.lk-icon {
    width: 28px; height: 28px; flex: none; border-radius: 9px;
    display: grid; place-items: center; font-size: 14px; line-height: 1;
    background: color-mix(in srgb, var(--green) 14%, var(--bg-soft));
    border: 1px solid color-mix(in srgb, var(--green) 26%, transparent);
    color: var(--green);
}
.linkup-body { padding: 14px 16px 18px; }

.up-head, .up-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) auto; gap: 8px 18px; align-items: center; }
.up-head { padding: 0 10px 8px; border-bottom: 1px solid var(--line); font-size: 11.5px; font-weight: 600; letter-spacing: .7px; color: var(--ink-3); }
.up-head span:last-child { justify-self: end; }
.up-row { padding: 11px 10px; border-bottom: 1px dashed var(--line); border-radius: var(--radius-sm); transition: background .14s; }
.up-row:nth-child(even) { background: var(--surface-2); border-bottom-color: transparent; }
.up-row:hover { background: var(--surface-3); }
.up-row > .pill { justify-self: end; }
.up-row:last-child { border-bottom: 0; }
.up-name { font-size: 14px; font-weight: 600; }
.up-url { font: 12px/1.6 var(--mono); color: var(--ink-3); word-break: break-all; }
.up-lat { font-size: 13px; color: var(--ink-3); text-align: right; }
.up-detail { grid-column: 2 / -1; font: 12px/1.7 var(--mono); color: var(--ink-3); word-break: break-all; }
.linkup-summary { font-size: 13.5px; color: var(--ink-2); margin-bottom: 12px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }

/* ── 详情：返回 + 头部 ──────────────────────────────────── */
.back {
    display: inline-flex; align-items: center; gap: 8px;
    font: inherit; font-size: 13.5px;
    background: var(--bg-soft); border: 1px solid var(--line); color: var(--ink-2);
    border-radius: 999px; box-shadow: var(--shadow);
    cursor: pointer; padding: 7px 15px; margin-bottom: 18px;
    transition: border-color .14s, color .14s, transform .14s;
}
.back:hover { color: var(--ink); border-color: var(--line-2); transform: translateX(-2px); }

.detail-head {
    position: relative;
    background:
        radial-gradient(560px 260px at 100% -60px, color-mix(in srgb, var(--acc) 17%, transparent), transparent 70%),
        linear-gradient(150deg, var(--bg-soft), var(--surface-2));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hi);
    padding: 24px 26px;
    margin-bottom: 22px;
    overflow: hidden;
}
.detail-head::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
    background: linear-gradient(90deg, var(--acc), color-mix(in srgb, var(--acc) 25%, transparent));
}
.dh-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px 28px; align-items: start; }
.dh-title { display: flex; align-items: center; gap: 13px; }
.dh-icon {
    width: 42px; height: 42px; flex: none;
    border-radius: 13px;
    display: grid; place-items: center;
    font-size: 18px; line-height: 1;
    background: color-mix(in srgb, var(--acc) 15%, var(--bg-soft));
    border: 1px solid color-mix(in srgb, var(--acc) 30%, transparent);
    color: var(--acc);
    box-shadow: 0 10px 22px -14px var(--acc);
}
.dh-top h2 { font-size: 25px; font-weight: 700; letter-spacing: -.5px; line-height: 1.3; }
.dh-hero { color: var(--ink-2); font-size: 15px; margin-top: 10px; max-width: 820px; line-height: 1.8; }

.dh-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.demo-btn {
    display: inline-flex; align-items: center; gap: 9px;
    font-size: 14.5px; font-weight: 600;
    padding: 13px 22px;
    border-radius: 999px;
    background: linear-gradient(120deg, var(--acc), color-mix(in srgb, var(--acc) 72%, #ffffff));
    color: #fff; text-decoration: none;
    box-shadow: 0 10px 24px -12px var(--acc-shadow, rgba(23, 26, 43, .5));
    transition: filter .15s, transform .15s, box-shadow .15s;
}
.demo-btn:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 14px 30px -12px var(--acc-shadow, rgba(23, 26, 43, .55)); }
/* 深色主题下按钮底色被提亮，白字对比只有 2.7，改用深字 */
html[data-theme="dark"] .demo-btn { color: #101318; }
.demo-btn .arrow { font-size: 13.5px; }
.demo-note { font-size: 12.5px; color: var(--ink-3); max-width: 250px; text-align: right; }

.dh-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 16px; margin-top: 26px; }
.dh-meta > div { min-width: 0; background: color-mix(in srgb, var(--bg-soft) 78%, var(--surface-2)); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 16px; }
.dh-meta b { display: block; font-size: 12px; font-weight: 600; color: var(--ink-3); margin-bottom: 5px; letter-spacing: .7px; }
.dh-meta span { font: 13.5px/1.6 var(--mono); color: var(--ink-2); word-break: break-all; }

/* ── 详情：小块单列 ─────────────────────────────────────── */
/* 各块描述长短不一，两列并排会让同一行的两张卡差出一截高度，读起来是参差的；
   改成一块一行，长短只往下走，左边缘始终齐平。 */
.blocks { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }

.block {
    position: relative;
    min-width: 0; /* 契约表里有不换行的字段名，不放开最小宽度会把轨道顶宽 */
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 22px 19px;
    scroll-margin-top: 92px;
}

.block-head { display: flex; align-items: center; gap: 11px; margin-bottom: 15px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.block-icon {
    width: 30px; height: 30px; flex: none;
    border-radius: 10px;
    display: grid; place-items: center;
    font-size: 14px; line-height: 1;
    background: color-mix(in srgb, var(--acc) 14%, var(--bg-soft));
    border: 1px solid color-mix(in srgb, var(--acc) 26%, transparent);
    color: var(--acc);
}
.block-head h4 { font-size: 16px; font-weight: 660; letter-spacing: -.2px; }

/* 整行文字限一个阅读宽度，表格与代码不受限：中文一行超过 50 字就追着累了 */
.block > .b-list, .block > .steps, .block > .flow, .block > .pairs, .block > .contract-note { max-width: 720px; }

/* 列表块 */
.b-list { list-style: none; display: flex; flex-direction: column; gap: 11px; }
.b-list li { position: relative; padding-left: 19px; font-size: 14.5px; color: var(--ink-2); line-height: 1.78; }
.b-list li::before {
    content: ""; position: absolute; left: 0; top: 11px;
    width: 6px; height: 6px; border-radius: 2px; transform: rotate(45deg);
    background: color-mix(in srgb, var(--acc) 75%, var(--bg-soft));
}

/* 步骤块 */
.steps { list-style: none; display: flex; flex-direction: column; gap: 0; counter-reset: s; }
.steps li { position: relative; padding: 0 0 14px 38px; font-size: 14.5px; color: var(--ink-2); line-height: 1.75; counter-increment: s; }
.steps li::before {
    content: counter(s);
    position: absolute; left: 0; top: 1px;
    width: 25px; height: 25px; border-radius: 50%;
    display: grid; place-items: center;
    font-size: 12.5px; font-weight: 700;
    background: color-mix(in srgb, var(--acc) 14%, var(--bg-soft));
    border: 1px solid color-mix(in srgb, var(--acc) 30%, transparent);
    color: var(--acc);
}
.steps li::after { content: ""; position: absolute; left: 12px; top: 29px; bottom: 3px; width: 2px; border-radius: 2px; background: var(--line); }
.steps li:last-child { padding-bottom: 0; }
.steps li:last-child::after { display: none; }

/* 流程块：一条链路的节点，序号串成一条竖线 */
.flow { list-style: none; display: flex; flex-direction: column; }
.flow-node { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 13px; padding-bottom: 16px; }
.flow-node:last-child { padding-bottom: 0; }
.flow-node::before { content: ""; position: absolute; left: 13px; top: 32px; bottom: 3px; width: 2px; border-radius: 2px; background: var(--line); }
.flow-node:last-child::before { display: none; }
.fn-idx {
    width: 28px; height: 28px; border-radius: 50%;
    display: grid; place-items: center;
    font: 12.5px/1 var(--mono); font-weight: 600;
    background: color-mix(in srgb, var(--acc) 14%, var(--bg-soft));
    border: 1px solid color-mix(in srgb, var(--acc) 34%, var(--line));
    color: var(--acc);
}
.fn-body { min-width: 0; }
.fn-body b { display: block; font-size: 15px; font-weight: 640; line-height: 28px; color: var(--ink); }
.fn-body p { font-size: 14.5px; color: var(--ink-2); line-height: 1.75; }

/* 样例块：默认折起来，避免示例报文挤占正文 */
.sample { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); overflow: hidden; }
.sample > summary {
    cursor: pointer; list-style: none;
    display: flex; align-items: center; gap: 10px;
    padding: 12px 15px;
    font-size: 14px; color: var(--ink-2);
    transition: background .14s;
}
.sample > summary:hover { background: var(--surface-3); }
.sample > summary::-webkit-details-marker { display: none; }
.sample > summary::before { content: "▸"; font-size: 12px; color: var(--acc); }
.sample[open] > summary::before { content: "▾"; }
.sample[open] > summary { border-bottom: 1px dashed var(--line); }
.sample-tag {
    font-style: normal; font-size: 11.5px;
    padding: 3px 9px; border-radius: 999px;
    background: var(--grey-bg); color: var(--grey);
}
.sample .code-wrap { padding: 12px; }

/* 键值对块 */
.pairs { display: flex; flex-direction: column; }
.pair { display: grid; grid-template-columns: minmax(110px, 32%) 1fr; gap: 14px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 14.5px; line-height: 1.7; }
.pair:last-child { border-bottom: 0; padding-bottom: 0; }
.pair b { color: var(--ink); font-weight: 600; }
.pair span { color: var(--ink-2); }

/* 契约块 */
.contract-note { font-size: 14.5px; line-height: 1.75; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-left: 4px solid var(--acc); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 12px 16px; margin-bottom: 16px; }
.ct-group + .ct-group { margin-top: 20px; }
.ct-title { display: inline-flex; align-items: center; font-size: 12px; font-weight: 620; color: var(--acc); background: color-mix(in srgb, var(--acc) 11%, var(--bg-soft)); border: 1px solid color-mix(in srgb, var(--acc) 22%, transparent); padding: 4px 11px; border-radius: 999px; margin-bottom: 10px; letter-spacing: .5px; }
.ct-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table.ct { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.ct th, table.ct td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; line-height: 1.65; }
table.ct tr:last-child td { border-bottom: 0; }
table.ct tbody tr:nth-child(even) { background: var(--surface-2); }
table.ct th { color: var(--ink-3); font-weight: 600; background: var(--surface-3); font-size: 12px; letter-spacing: .5px; }
table.ct td.f { font-family: var(--mono); color: var(--ink); white-space: nowrap; }
table.ct td.t { font-family: var(--mono); font-size: 12.5px; color: var(--acc); white-space: nowrap; }
table.ct td.c { color: var(--ink-2); }
.req { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--grey-bg); color: var(--grey); margin-left: 6px; }
.req.yes { background: color-mix(in srgb, var(--acc) 15%, var(--bg-soft)); color: var(--acc); }
td .code-badge { font: 12.5px var(--mono); padding: 3px 8px; border-radius: 6px; background: var(--code-bg); color: var(--code-ink); white-space: nowrap; }

/* 代码块 */
.code-wrap { position: relative; }
pre.code {
    background: var(--code-bg);
    color: var(--code-ink);
    font: 13.5px/1.9 var(--mono);
    padding: 20px 22px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    white-space: pre;
    tab-size: 2;
}
.copy-btn {
    position: absolute; top: 12px; right: 12px;
    font: 12.5px var(--sans);
    padding: 5px 11px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, .2);
    background: rgba(255, 255, 255, .08);
    color: #cdd3dd;
    cursor: pointer;
}
.copy-btn:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.block-note { font-size: 13.5px; line-height: 1.75; color: var(--ink-3); margin-top: 14px; }

/* ── 治理层实时账面（kind:"ledger"）──────────────────────── */
.ledger { display: flex; flex-direction: column; gap: 16px; }
.ld-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ld-range { display: flex; gap: 6px; flex-wrap: wrap; }
.ld-btn {
    font: 13px/1 var(--sans); color: var(--ink-2);
    background: var(--surface-2); border: 1px solid var(--line);
    border-radius: 999px; padding: 7px 13px; cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}
.ld-btn:hover { border-color: color-mix(in srgb, var(--acc) 40%, var(--line)); color: var(--ink); }
.ld-btn.on { background: color-mix(in srgb, var(--acc) 14%, var(--bg-soft)); border-color: color-mix(in srgb, var(--acc) 34%, var(--line)); color: var(--acc); font-weight: 600; }
.ld-refresh { margin-left: auto; }
.ld-body { display: flex; flex-direction: column; gap: 4px; }
.ld-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 10px; }
.ld-tile { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 13px; min-width: 0; }
.ld-tile span { display: block; font: 600 19px/1.25 var(--mono); color: var(--ink); letter-spacing: -.3px; word-break: break-all; }
.ld-tile b { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-top: 3px; }
.ld-tile em { display: block; font-size: 11.5px; font-style: normal; line-height: 1.55; color: var(--ink-3); margin-top: 2px; }
.ld-group { margin-top: 14px; }
.ld-title { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; letter-spacing: .01em; }
.ld-mounts { display: flex; flex-direction: column; gap: 6px; }
.ld-mount { display: grid; grid-template-columns: minmax(150px, 26%) 1fr auto; gap: 12px; align-items: center;
            padding: 9px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.ld-mount b { font: 12.5px/1.5 var(--mono); color: var(--acc); word-break: break-all; }
.ld-mount span { font-size: 13.5px; color: var(--ink-2); }
.ld-empty { font-size: 14px; line-height: 1.8; color: var(--ink-2); background: var(--surface-2);
            border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 13px 15px; margin-top: 14px; }
.ld-empty code { font: 12.5px var(--mono); color: var(--acc); }
.ld-warn { font-size: 14px; line-height: 1.8; color: var(--red); }
.ld-share { display: flex; align-items: center; gap: 8px; min-width: 92px; }
.ld-share i { flex: 1 1 0; max-width: 74px; height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--acc) 82%, transparent); }
.ld-share span { font: 12px var(--mono); color: var(--ink-3); flex: none; }
.ld-days { display: flex; align-items: flex-end; gap: 3px; height: 88px; padding: 10px 12px 0;
           background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.ld-day { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; height: 100%; }
.ld-day i { width: 100%; max-width: 20px; border-radius: 3px 3px 0 0; background: color-mix(in srgb, var(--acc) 70%, transparent); }
.ld-day span { font: 10.5px/1.3 var(--mono); color: var(--ink-3); white-space: nowrap; }
.ld-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.ld-chip { font: 12.5px/1 var(--mono); color: var(--amber); background: var(--amber-bg); border: 1px solid color-mix(in srgb, var(--amber) 26%, transparent);
           border-radius: 999px; padding: 6px 11px; }
.ld-notes { margin-top: 12px; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }
.ld-notes li { font-size: 13px; line-height: 1.7; color: var(--ink-3); }

/* ── 在线试用 ─────────────────────────────────────────── */
.try {
    background: linear-gradient(180deg, color-mix(in srgb, var(--acc) 7%, var(--bg-soft)), var(--bg-soft) 120px);
    border: 1px solid var(--line);
    border-top: 4px solid var(--acc);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px 22px;
    margin-bottom: 22px;
}
.try-head { display: flex; align-items: center; gap: 11px; margin-bottom: 16px; }
.try-head::before {
    content: "▶";
    width: 30px; height: 30px; flex: none;
    border-radius: 10px; display: grid; place-items: center;
    font-size: 12px; line-height: 1;
    background: color-mix(in srgb, var(--acc) 14%, var(--bg-soft));
    border: 1px solid color-mix(in srgb, var(--acc) 26%, transparent);
    color: var(--acc);
}
.try-head h3 { font-size: 16.5px; font-weight: 660; letter-spacing: -.2px; flex: 1; min-width: 0; }
.try-head code { font-size: 12px; color: var(--acc); background: color-mix(in srgb, var(--acc) 12%, var(--bg-soft)); border: 1px solid color-mix(in srgb, var(--acc) 22%, transparent); padding: 5px 11px; border-radius: 999px; white-space: nowrap; }
.try-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.tf { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tf > label { font-size: 13.5px; color: var(--ink-3); }
.tf input[type=text], .tf input[type=number], .tf textarea, .tf select {
    font: 14.5px/1.6 var(--sans);
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--line-2); border-radius: 9px;
    background: var(--bg-soft); color: var(--ink);
}
.tf textarea { font-family: var(--mono); font-size: 14px; resize: vertical; }
/* 链：填了 result_id 就不再发正文，当场压暗这格，不留「看着还在用」的错觉 */
.tf.dim > label { opacity: .6; }
.tf.dim textarea { opacity: .45; background: var(--bg-soft); }
.tf input:focus, .tf textarea:focus, .tf select:focus { outline: 2px solid color-mix(in srgb, var(--ink-3) 45%, transparent); border-color: var(--ink-3); }
.tf input[type=file] { font-size: 14.5px; color: var(--ink-2); padding: 11px 14px; }
.tf-check { grid-column: 1 / -1; }
.tf-check label { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--ink-2); }
/* 模板挑选：整块占满两列，选中一条才长出变量与预览 */
.tpl-box {
    grid-column: 1 / -1;
    display: flex; flex-direction: column; gap: 12px;
    padding: 15px 16px;
    border: 1px dashed var(--line-2); border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--acc) 4%, var(--bg-soft));
}
.tpl-note { font-size: 13px; line-height: 1.7; color: var(--ink-3); }
.tpl-note.bad { color: var(--amber); }
.tpl-vars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.tpl-preview { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-soft); padding: 13px 15px; }
.pv-cap { font-size: 12.5px; line-height: 1.6; color: var(--ink-3); margin-bottom: 11px; }
.pv-seg { display: flex; align-items: flex-start; gap: 10px; }
.pv-seg + .pv-seg { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.pv-seg b {
    flex: none; font: 11.5px/1.8 var(--mono); color: var(--acc);
    background: color-mix(in srgb, var(--acc) 12%, var(--bg-soft));
    border-radius: 999px; padding: 2px 9px;
}
.pv-seg pre {
    flex: 1; min-width: 0; margin: 0;
    font: 13px/1.7 var(--mono); color: var(--ink-2);
    white-space: pre-wrap; word-break: break-word;
    max-height: 240px; overflow: auto;
}
.pv-foot { font-size: 12.5px; line-height: 1.7; color: var(--ink-3); margin-top: 11px; padding-top: 10px; border-top: 1px dashed var(--line); }
.try-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.try-state { font: 12.5px/1.5 var(--mono); color: var(--ink-3); }
.try-hint { font-size: 13.5px; line-height: 1.75; color: var(--ink-3); margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.try-out { margin-top: 20px; padding-top: 20px; border-top: 1px dashed var(--line); max-height: 620px; overflow: auto; }
.out-head { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 16px; }
.out-msg { font-size: 14.5px; line-height: 1.7; color: var(--ink-2); flex: 1; min-width: 0; }
.out-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13.5px; color: var(--ink-3); margin-bottom: 14px; }
/* 链：产物暂存后把 result_id 摆成可操作的一行 */
.out-chain {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin-top: 16px; padding: 12px 14px;
    font-size: 13.5px; line-height: 1.7; color: var(--ink-2);
    background: var(--surface-3); border: 1px dashed var(--line); border-radius: var(--radius-sm);
}
.out-chain code {
    font: 12.5px var(--mono); color: var(--acc); word-break: break-all;
    background: color-mix(in srgb, var(--acc) 14%, var(--bg-soft)); padding: 3px 9px; border-radius: 6px;
}
.out-chain .ghost-btn { padding: 6px 12px; font-size: 12.5px; }
.node { padding: 14px 0 15px; border-bottom: 1px dashed var(--line); margin-left: calc((var(--lv, 1) - 1) * 18px); }
.node:last-child { border-bottom: 0; }
.node-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 14.5px; }
.node-top code { font-size: 12px; color: var(--acc); background: color-mix(in srgb, var(--acc) 14%, var(--bg-soft)); padding: 2px 8px; border-radius: 6px; }
.node-top em { font-style: normal; font-size: 12.5px; color: var(--ink-3); }
.node-text { font-size: 14px; line-height: 1.8; color: var(--ink-2); margin-top: 7px; white-space: pre-wrap; word-break: break-word; }
.sr { background: var(--surface-3); border: 1px solid var(--line); border-radius: 11px; padding: 16px 18px 17px; margin-bottom: 14px; }
.sr h5 { font-size: 15px; font-weight: 620; margin-bottom: 6px; }
.sr p { font-size: 14px; line-height: 1.75; color: var(--ink-2); }
.sr-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 11px; font: 12.5px var(--mono); }
.sr-foot a { color: var(--acc); word-break: break-all; text-decoration: none; }
.sr-foot a:hover { text-decoration: underline; }
.sr-foot em { font-style: normal; color: var(--ink-3); white-space: nowrap; }
/* 模板出的是正文：按段落读，不像 JSON */
.prose { display: flex; flex-direction: column; gap: 13px; }
.prose p { font-size: 15px; line-height: 1.85; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.prose-reason {
    margin-top: 14px; padding: 12px 14px;
    font-size: 13.5px; line-height: 1.75; color: var(--ink-3);
    background: var(--surface-3); border: 1px dashed var(--line); border-radius: var(--radius-sm);
    white-space: pre-wrap; word-break: break-word;
}
.prose-reason b { display: block; font-size: 12px; color: var(--acc); margin-bottom: 6px; }
.prose-warn {
    margin-top: 14px; padding: 10px 13px;
    font-size: 13.5px; line-height: 1.7; color: var(--amber);
    background: var(--amber-bg); border-radius: var(--radius-sm);
}
/* 渲染结果：正文一栏、效果一栏。html 才两栏，其余格式一栏铺满——
   用 .one 显式收成单列，不用 auto-fit：那样会在宽容器里多算出一条空轨道，两栏反而铺不满 */
.rv-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.rv-split.one { grid-template-columns: minmax(0, 1fr); }
.rv-src, .rv-fx {
    min-width: 0; padding: 13px 15px;
    border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-3);
}
.rv-src .code-wrap .code { max-height: 340px; overflow: auto; }
.rv-frame {
    display: block; width: 100%; height: 340px;
    border: 1px solid var(--line-2); border-radius: var(--radius-xs); background: #fff;
}
.rv-binary { font-size: 14px; line-height: 1.8; color: var(--ink-2); }
.rv-dl {
    display: inline-flex; align-items: center; gap: 8px; margin-top: 15px; padding: 9px 15px;
    border: 1px solid var(--acc); border-radius: 10px; font-size: 13.5px; color: var(--acc);
    background: color-mix(in srgb, var(--acc) 10%, var(--bg-soft)); text-decoration: none;
}
.rv-dl:hover { background: color-mix(in srgb, var(--acc) 18%, var(--bg-soft)); }

/* ── 页脚 ───────────────────────────────────────────────── */
.foot { border-top: 1px solid var(--line); background: var(--bg-soft); padding: 20px 0 22px; }
.foot .wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--ink-3); }
.foot code { padding: 4px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-3); color: var(--ink-2); }

/* ── 窄屏 ───────────────────────────────────────────────── */
/* 1100 以下：左导航改成横条，仍在页面顶部常驻，不收进任何二级入口；英雄区收成单栏 */
@media (max-width: 1100px) {
    .shell { grid-template-columns: 1fr; gap: 18px; }
    .sidenav {
        position: static;
        flex-direction: row; align-items: center;
        overflow-x: auto; gap: 8px;
        padding: 12px 14px;
    }
    .sn-group { display: none; }
    .sn-item { width: auto; white-space: nowrap; padding: 9px 13px; border: 1px solid var(--line); }
    .sn-item.active { border-color: color-mix(in srgb, var(--acc) 45%, var(--line)); }
    .sn-item.active::after { display: none; }
    .hero { grid-template-columns: 1fr; gap: 22px; padding: 26px 24px 28px; }
    .hero-art { display: none; }
    .hero h1 { font-size: 27px; }
    .detail-body { grid-template-columns: 1fr; gap: 16px; }
    .toc {
        position: static; max-height: none; overflow: visible;
        flex-direction: row; flex-wrap: wrap; gap: 6px;
        padding: 12px;
    }
    .toc a { border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; }
    .toc a.on { border-color: color-mix(in srgb, var(--acc) 45%, var(--line)); background: color-mix(in srgb, var(--acc) 12%, var(--bg-soft)); }
    .toc a.on::before { display: none; }
}

@media (max-width: 720px) {
    .wrap { padding: 0 16px; }
    .shell { padding: 20px 16px 40px; }
    .hero { padding: 22px 18px 24px; }
    .hero h1 { font-size: 24px; letter-spacing: -.4px; }
    .hero p { font-size: 15px; }
    .rail { display: flex; overflow-x: auto; gap: 4px; padding-bottom: 8px; }
    .rail-node { flex: none; min-width: 96px; }
    .rail-node::before { display: none; }
    .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
    .grid { grid-template-columns: 1fr; }
    .module-card { padding: 18px 18px 16px; }
    .block { padding: 19px 18px 20px; }
    .detail-head { padding: 22px 18px; }
    .dh-top h2 { font-size: 24px; }
    .dh-icon { width: 42px; height: 42px; border-radius: 13px; font-size: 18px; }
    .try { padding: 20px 18px 22px; }
    .try-form { grid-template-columns: 1fr; }
    .tpl-vars { grid-template-columns: 1fr; }
    .rv-split { grid-template-columns: 1fr; }
    .settings-inner { grid-template-columns: 1fr; }
    .settings .solid-btn, .settings-tip { grid-column: 1; }
    .up-head { display: none; }
    .up-row { grid-template-columns: 1fr auto; }
    .up-url { grid-column: 1 / -1; }
    .dh-top { grid-template-columns: 1fr; gap: 16px; }
    .dh-actions { align-items: flex-start; }
    .demo-note { text-align: left; }
    .topbar-inner { height: 64px; }
    .brand-text em { display: none; }
}

/* ── 门户账号（人）：顶栏登录入口、登录弹窗、未登录空态 ─────────────────
   版式沿用设置页那套输入框与卡片，只有弹窗是新东西——登录这件事不该占一整页。 */
.auth-box { display: inline-flex; align-items: center; gap: 10px; }
button.demo-btn { border: none; cursor: pointer; font-family: var(--sans); }

.dlg {
    /* 顶部那条 * { margin: 0 } 把模态框默认的居中 margin 抹了，这里补回来 */
    margin: auto;
    width: min(420px, calc(100vw - 32px));
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-soft);
    color: var(--ink);
    box-shadow: var(--shadow-hi);
}
.dlg::backdrop { background: rgba(15, 18, 30, .46); }
.dlg-form { display: grid; gap: 10px; padding: 20px 22px 22px; }
.dlg-form label { font-size: 13.5px; color: var(--ink-2); }
.dlg-form input {
    width: 100%; font: 14px/1.6 var(--mono);
    padding: 9px 12px;
    border: 1px solid var(--line-2); border-radius: 8px;
    background: var(--surface-2); color: var(--ink);
}
.dlg-form input:focus { outline: 2px solid color-mix(in srgb, var(--ink-3) 45%, transparent); border-color: var(--ink-3); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.dlg-head b { font-size: 16px; font-weight: 660; }
.dlg-err {
    font-size: 13px; color: var(--red);
    background: color-mix(in srgb, var(--red) 10%, transparent);
    border-radius: var(--radius-xs); padding: 8px 11px;
}
.dlg-tip { font-size: 12.5px; line-height: 1.7; color: var(--ink-3); }
.dlg-actions { display: flex; gap: 10px; margin-top: 4px; }
.try-locked { font-size: 13.5px; line-height: 1.8; color: var(--ink-2); margin: 0 0 14px; max-width: 72ch; }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
    html { scroll-behavior: auto; }
}
