/* ==========================================================================
   智慧实验室信息管理系统 · 用户手册 样式表
   纯静态，无外部依赖；主色与系统保持一致（#4f46e5）
   ========================================================================== */

:root {
    --brand: #4f46e5;
    --brand-dark: #4338ca;
    --brand-soft: #eef2ff;
    --brand-line: #c7d2fe;
    --ok: #059669;
    --ok-soft: #ecfdf5;
    --warn: #d97706;
    --warn-soft: #fffbeb;
    --danger: #e11d48;
    --danger-soft: #fff1f2;
    --info: #0891b2;
    --info-soft: #ecfeff;

    --ink: #0f172a;
    --ink-2: #334155;
    --ink-3: #64748b;
    --ink-4: #94a3b8;
    --bg: #ffffff;
    --bg-2: #f8fafc;
    --bg-3: #f1f5f9;
    --line: #e2e8f0;
    --line-2: #cbd5e1;

    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 30px -18px rgba(15, 23, 42, .28);
    --sidebar-w: 268px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 24px; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.78;
    color: var(--ink-2);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); text-decoration: underline; }

/* ---------- 骨架 ---------- */
.shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
}

/* ---------- 侧边栏 ---------- */
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: var(--bg-2);
    border-right: 1px solid var(--line);
    padding: 20px 0 40px;
    overscroll-behavior: contain;
}

.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: #dbe2ea; border-radius: 8px; }

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px 18px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--line);
}

.brand__mark {
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 9px;
    background: linear-gradient(135deg, #6366f1, #4338ca);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .5px;
    box-shadow: 0 4px 12px -4px rgba(67, 56, 202, .6);
}

.brand__text { line-height: 1.3; }
.brand__title { font-size: 14px; font-weight: 700; color: var(--ink); }
.brand__sub { font-size: 11.5px; color: var(--ink-4); letter-spacing: .04em; }

.nav-group { padding: 14px 10px 0; }
.nav-group__label {
    padding: 0 10px 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    color: var(--ink-4);
    text-transform: uppercase;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    margin-bottom: 1px;
    border-radius: 7px;
    color: var(--ink-2);
    font-size: 13.5px;
    line-height: 1.5;
    text-decoration: none;
    transition: background .15s, color .15s;
}

.nav-item:hover {
    background: #eef2f7;
    color: var(--ink);
    text-decoration: none;
}

.nav-item.is-active {
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-weight: 600;
}

.nav-item__no {
    flex: none;
    width: 20px;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    color: var(--ink-4);
    text-align: right;
}

.nav-item.is-active .nav-item__no { color: var(--brand); }

.sidebar__foot {
    margin: 22px 18px 0;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 11.5px;
    color: var(--ink-4);
    line-height: 1.7;
}

.sidebar__foot a { color: var(--ink-3); }

/* ---------- 主体 ---------- */
.main { min-width: 0; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 14px;
    height: 56px;
    padding: 0 34px;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--line);
}

.crumb {
    flex: 1;
    min-width: 0;
    font-size: 12.5px;
    color: var(--ink-4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crumb b { color: var(--ink-3); font-weight: 600; }

.topbar__actions { display: flex; align-items: center; gap: 8px; }

.search-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 32px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink-3);
    font-size: 12.5px;
    font-family: inherit;
    cursor: pointer;
}

.search-btn:hover { border-color: var(--line-2); color: var(--ink-2); }
.search-btn kbd {
    padding: 1px 5px;
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 4px;
    background: var(--bg-2);
    font-family: var(--mono);
    font-size: 10.5px;
    color: var(--ink-4);
}

/* ---------- 正文排版 ---------- */
.doc {
    padding: 30px 40px 90px;
}

.doc__inner { max-width: 880px; margin: 0 auto; }

.eyebrow {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .12em;
    color: var(--brand);
    text-transform: uppercase;
    margin-bottom: 6px;
}

h1 {
    margin: 0 0 10px;
    font-size: 30px;
    line-height: 1.32;
    letter-spacing: -.015em;
    color: var(--ink);
    font-weight: 700;
}

.lede {
    margin: 0 0 22px;
    font-size: 15.5px;
    line-height: 1.8;
    color: var(--ink-3);
}

h2 {
    margin: 44px 0 12px;
    padding-top: 10px;
    font-size: 21px;
    line-height: 1.4;
    color: var(--ink);
    font-weight: 700;
    letter-spacing: -.01em;
    border-top: 1px solid var(--line);
}

h2:first-of-type { border-top: 0; padding-top: 0; }

h3 {
    margin: 26px 0 8px;
    font-size: 16.5px;
    color: var(--ink);
    font-weight: 650;
}

h4 {
    margin: 20px 0 6px;
    font-size: 14.5px;
    color: var(--ink);
    font-weight: 650;
}

p { margin: 0 0 12px; }
ul, ol { margin: 0 0 14px; padding-left: 22px; }
li { margin: 4px 0; }
li > ul, li > ol { margin: 4px 0; }

strong { color: var(--ink); font-weight: 650; }

code {
    padding: 1px 5px;
    border-radius: 5px;
    background: var(--bg-3);
    border: 1px solid var(--line);
    font-family: var(--mono);
    font-size: 12.8px;
    color: #be185d;
    word-break: break-word;
}

pre {
    margin: 0 0 16px;
    padding: 14px 16px;
    overflow-x: auto;
    border-radius: var(--radius);
    background: #0f172a;
    color: #e2e8f0;
    font-size: 12.8px;
    line-height: 1.7;
}

pre code {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font-size: inherit;
}

kbd {
    padding: 1px 5px;
    border: 1px solid var(--line-2);
    border-bottom-width: 2px;
    border-radius: 4px;
    background: #fff;
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--ink-2);
}

hr { margin: 32px 0; border: 0; border-top: 1px solid var(--line); }

/* 本页目录 */
.toc {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 26px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-2);
}

.toc__label {
    flex: none;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--ink-4);
    line-height: 24px;
    margin-right: 2px;
}

.toc a {
    padding: 2px 9px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid var(--line);
    font-size: 12.5px;
    color: var(--ink-3);
    text-decoration: none;
    line-height: 20px;
}

.toc a:hover { border-color: var(--brand-line); color: var(--brand-dark); background: var(--brand-soft); }

/* ---------- 提示块 ---------- */
.note {
    position: relative;
    margin: 16px 0;
    padding: 12px 16px 12px 42px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--ink-4);
    border-radius: 8px;
    background: var(--bg-2);
    font-size: 14px;
    line-height: 1.75;
    color: var(--ink-2);
}

.note::before {
    position: absolute;
    left: 14px;
    top: 12px;
    font-size: 14px;
    line-height: 1.75;
    font-weight: 700;
}

.note > :last-child { margin-bottom: 0; }
.note > :first-child { margin-top: 0; }

.note--tip { border-left-color: var(--brand); background: var(--brand-soft); border-color: var(--brand-line); }
.note--tip::before { content: "TIP"; font-size: 10px; letter-spacing: .06em; color: var(--brand); top: 15px; }

.note--warn { border-left-color: var(--warn); background: var(--warn-soft); border-color: #fde68a; }
.note--warn::before { content: "注意"; color: var(--warn); }

.note--danger { border-left-color: var(--danger); background: var(--danger-soft); border-color: #fecdd3; }
.note--danger::before { content: "重要"; color: var(--danger); }

.note--ok { border-left-color: var(--ok); background: var(--ok-soft); border-color: #a7f3d0; }
.note--ok::before { content: "说明"; color: var(--ok); }

.note--info { border-left-color: var(--ink-3); background: #f8fafc; border-color: #e2e8f0; }
.note--info::before { content: "口径"; color: var(--ink-3); }

/* ---------- 表格 ---------- */
.table-wrap {
    margin: 0 0 18px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    line-height: 1.65;
    background: #fff;
}

thead th {
    padding: 9px 13px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-weight: 650;
    font-size: 12.5px;
    color: var(--ink-2);
    white-space: nowrap;
}

tbody td {
    padding: 9px 13px;
    border-bottom: 1px solid #eef2f6;
    color: var(--ink-2);
    vertical-align: top;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfcfe; }
td.nowrap, th.nowrap { white-space: nowrap; }

/* ---------- 步骤 ---------- */
.steps {
    counter-reset: step;
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
}

.steps > li {
    position: relative;
    padding: 0 0 2px 40px;
    margin: 0 0 18px;
    counter-increment: step;
}

.steps > li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 1px;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: var(--brand-soft);
    border: 1px solid var(--brand-line);
    color: var(--brand-dark);
    font-size: 12.5px;
    font-weight: 700;
    display: grid;
    place-items: center;
}

.steps > li::after {
    content: "";
    position: absolute;
    left: 12px;
    top: 30px;
    bottom: -14px;
    width: 1px;
    background: var(--line);
}

.steps > li:last-child::after { display: none; }
.steps > li > :last-child { margin-bottom: 0; }
.steps__title { display: block; font-weight: 650; color: var(--ink); margin-bottom: 2px; }

/* ---------- 图片 ---------- */
figure {
    margin: 20px 0 22px;
}

figure img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

figcaption {
    margin-top: 8px;
    font-size: 12.5px;
    color: var(--ink-4);
    text-align: center;
    line-height: 1.6;
}

/* ---------- 字段说明卡 ---------- */
.fields {
    display: grid;
    gap: 10px;
    margin: 0 0 18px;
}

.field {
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.field__name {
    font-size: 13.5px;
    font-weight: 650;
    color: var(--ink);
    margin-bottom: 2px;
}

.field__name em {
    font-style: normal;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: 4px;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 11px;
    font-weight: 600;
    vertical-align: 1px;
}

.field__desc { font-size: 13.5px; color: var(--ink-3); line-height: 1.7; }

/* ---------- 卡片网格 ---------- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
    margin: 16px 0 20px;
}

.card {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.card__t {
    font-size: 14px;
    font-weight: 650;
    color: var(--ink);
    margin-bottom: 4px;
}

.card__d { font-size: 13.5px; color: var(--ink-3); line-height: 1.7; }

/* ---------- 状态徽标 ---------- */
.badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}

.badge--gray { background: var(--bg-3); color: var(--ink-3); }
.badge--blue { background: var(--brand-soft); color: var(--brand-dark); }
.badge--green { background: var(--ok-soft); color: var(--ok); }
.badge--cyan { background: var(--info-soft); color: #0e7490; }
.badge--amber { background: var(--warn-soft); color: #b45309; }
.badge--red { background: var(--danger-soft); color: var(--danger); }

/* ---------- 页脚导航 ---------- */
.pager {
    display: flex;
    gap: 12px;
    margin-top: 52px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.pager a {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s;
}

.pager a:hover {
    border-color: var(--brand-line);
    box-shadow: var(--shadow);
    text-decoration: none;
}

.pager__dir { display: block; font-size: 11.5px; color: var(--ink-4); margin-bottom: 2px; }
.pager__title { display: block; font-size: 14px; font-weight: 600; color: var(--ink); }
.pager a:last-child { text-align: right; }

.doc-foot {
    margin-top: 34px;
    font-size: 12px;
    color: var(--ink-4);
    display: flex;
    justify-content: flex-start;
    gap: 8px 18px;
    flex-wrap: wrap;
}

.doc-foot #foot-page { margin-left: auto; }
.doc-foot__beian a { color: var(--ink-3); }
.doc-foot__beian a:hover { color: var(--brand); text-decoration: none; }

/* ---------- 搜索弹层 ---------- */
.search-mask {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    padding: 10vh 16px 16px;
    background: rgba(15, 23, 42, .42);
    backdrop-filter: blur(2px);
}

.search-mask.is-open { display: block; }

.search-panel {
    max-width: 620px;
    margin: 0 auto;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 30px 70px -20px rgba(15, 23, 42, .45);
    overflow: hidden;
}

.search-panel__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}

.search-panel__head input {
    flex: 1;
    border: 0;
    outline: 0;
    font-family: inherit;
    font-size: 15px;
    color: var(--ink);
    background: none;
}

.search-panel__head input::placeholder { color: var(--ink-4); }

.search-results {
    max-height: 58vh;
    overflow-y: auto;
    padding: 8px;
}

.search-hit {
    display: block;
    padding: 9px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
}

.search-hit:hover, .search-hit.is-cursor { background: var(--brand-soft); text-decoration: none; }
.search-hit__t { font-size: 14px; font-weight: 600; color: var(--ink); }
.search-hit__p { font-size: 12px; color: var(--ink-4); margin-bottom: 2px; }
.search-hit__d { font-size: 12.8px; color: var(--ink-3); line-height: 1.6; }
.search-empty { padding: 26px 16px; text-align: center; color: var(--ink-4); font-size: 13.5px; }

/* ---------- 返回顶部 ---------- */
.to-top {
    position: fixed;
    right: 26px;
    bottom: 26px;
    z-index: 40;
    width: 38px;
    height: 38px;
    display: none;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
    color: var(--ink-3);
    cursor: pointer;
    box-shadow: var(--shadow);
}

.to-top.is-show { display: grid; }
.to-top:hover { color: var(--brand); border-color: var(--brand-line); }

/* ---------- 移动端 ---------- */
.menu-toggle {
    display: none;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink-2);
    cursor: pointer;
    place-items: center;
}

@media (max-width: 1024px) {
    .shell { grid-template-columns: minmax(0, 1fr); }

    .sidebar {
        position: fixed;
        z-index: 60;
        top: 0;
        left: 0;
        width: 280px;
        transform: translateX(-102%);
        transition: transform .2s ease;
        box-shadow: 0 0 40px rgba(15, 23, 42, .18);
        background: #fff;
    }

    body.nav-open .sidebar { transform: translateX(0); }

    body.nav-open::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 50;
        background: rgba(15, 23, 42, .35);
    }

    .menu-toggle { display: grid; }
    .topbar { padding: 0 16px; }
    .doc { padding: 22px 18px 70px; }
    h1 { font-size: 24px; }
    h2 { font-size: 19px; margin-top: 34px; }
    .pager { flex-direction: column; }
    .pager a:last-child { text-align: left; }
}

/* ---------- 打印 ---------- */
@media print {
    .sidebar, .topbar, .pager, .to-top, .search-mask, .toc, .doc-foot__beian { display: none !important; }
    .shell { display: block; }
    .doc { padding: 0; }
    .doc__inner { max-width: none; }
    body { font-size: 11pt; }
    a { color: #000; text-decoration: none; }
    h2 { page-break-after: avoid; }
    figure, table, .note { page-break-inside: avoid; }
    pre { background: #f4f4f4; color: #111; border: 1px solid #ddd; }
}
