/**
 * 运维与安全知识全书 /tools/secret-knowledge — 工具私有样式
 * 前缀 tb-；主题变量定义在 :root（弹窗/toast 挂在 body 下，不能只挂 .tb）
 */
:root {
    --tb-bg: #14171b;
    --tb-card: #1b1f25;
    --tb-card-2: #20252c;
    --tb-card-3: #262c34;
    --tb-line: #2c333c;
    --tb-line-2: rgba(255, 255, 255, .13);
    --tb-fg: #e8ecf1;
    --tb-sub: #9ba5b1;
    --tb-faint: #7d8894;
    --tb-accent: #5aa9ff;
    --tb-accent-soft: rgba(90, 169, 255, .13);
    --tb-ok: #4ec98a;
    --tb-ok-soft: rgba(78, 201, 138, .12);
    --tb-warn: #f0b429;
    --tb-warn-soft: rgba(240, 180, 41, .12);
    --tb-danger: #f26d6d;
    --tb-danger-soft: rgba(242, 109, 109, .12);
    --tb-code-bg: #10141a;
    --tb-shadow: 0 8px 28px rgba(0, 0, 0, .28);
    --tb-shadow-sm: 0 2px 8px rgba(0, 0, 0, .16);
    --tb-r: 14px;
    --tb-r-sm: 9px;
    --tb-zebra: rgba(127, 127, 127, .055);
}
[data-theme="light"] {
    --tb-bg: #f6f8fa;
    --tb-card: #ffffff;
    --tb-card-2: #f4f6f9;
    --tb-card-3: #eceff3;
    --tb-line: #e1e6ec;
    --tb-line-2: rgba(15, 20, 25, .16);
    --tb-fg: #1b232c;
    --tb-sub: #5b6673;
    --tb-faint: #6d7887;
    --tb-accent: #136ce9;
    --tb-accent-soft: rgba(19, 108, 233, .09);
    --tb-ok: #128a52;
    --tb-ok-soft: rgba(18, 138, 82, .1);
    --tb-warn: #9a6700;
    --tb-warn-soft: rgba(154, 103, 0, .1);
    --tb-danger: #c5362c;
    --tb-danger-soft: rgba(197, 54, 44, .1);
    --tb-code-bg: #f3f5f8;
    --tb-shadow: 0 8px 26px rgba(20, 30, 45, .1);
    --tb-shadow-sm: 0 2px 8px rgba(20, 30, 45, .07);
    --tb-zebra: rgba(15, 20, 25, .038);
}

/* 全屏（保留左侧导航）+ 把滚动权交还 html，页内 sticky 才生效 */
body.page-tbosk-full { overflow: visible; }
body.page-tbosk-full .app,
body.page-tbosk-full .main-content,
body.page-tbosk-full .page-container { max-width: 100%; width: 100%; }
body.page-tbosk-full .main-content { border-right: 0; min-width: 0; }

.tb [hidden], .tb-mask[hidden], .tb-side-mask[hidden], .tb-toast[hidden],
.tb-search-clr[hidden], .tb-modal [hidden] { display: none !important; }

.tb {
    width: 100%; max-width: 100%; box-sizing: border-box;
    padding: 16px 20px 64px;
    color: var(--tb-fg); font-size: 14px; line-height: 1.6;
}
.tb *, .tb *::before, .tb *::after { box-sizing: border-box; }
.tb-noscript { padding: 14px 18px; background: var(--tb-warn-soft); border-radius: 10px; }
.tb-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tb a { color: var(--tb-accent); }

/* ---------------- 头部 ---------------- */
.tb-hero {
    position: relative; display: flex; gap: 16px; align-items: flex-start;
    background: var(--tb-card); border: 1px solid var(--tb-line);
    border-radius: var(--tb-r); padding: 18px 20px; margin-bottom: 16px;
    box-shadow: var(--tb-shadow-sm);
}
.tb-hero-ic {
    flex: 0 0 auto; width: 50px; height: 50px; border-radius: 13px;
    display: grid; place-items: center; font-size: 26px;
    background: var(--tb-accent-soft); border: 1px solid var(--tb-line);
}
.tb-hero-tx { flex: 1 1 auto; min-width: 0; }
.tb-hero-row { display: flex; align-items: center; gap: 8px; }
.tb-hero-t { margin: 0; font-size: 21px; line-height: 1.35; font-weight: 700; letter-spacing: .2px; }
.tb-fold, .tb-set-btn {
    display: inline-grid; place-items: center; flex: 0 0 auto;
    width: 28px; height: 28px; padding: 0; cursor: pointer;
    color: var(--tb-sub); background: transparent;
    border: 1px solid transparent; border-radius: 8px;
}
.tb-fold:hover, .tb-set-btn:hover { color: var(--tb-accent); background: var(--tb-accent-soft); border-color: var(--tb-line); }
.tb-caret, .tb-about-caret { transition: transform .18s ease; }
.tb-hero.is-collapsed .tb-caret { transform: rotate(-90deg); }
.tb-hero.is-collapsed .tb-hero-extra { display: none; }
.tb-hero.is-collapsed { padding-top: 12px; padding-bottom: 12px; }
.tb-hero-sub { margin: 7px 0 10px; color: var(--tb-sub); font-size: 13px; line-height: 1.75; max-width: 92ch; }
.tb-hero-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tb-tag {
    font-size: 11.5px; line-height: 1.5; padding: 2px 9px; border-radius: 999px;
    color: var(--tb-sub); background: var(--tb-card-2); border: 1px solid var(--tb-line);
}
.tb-stat {
    flex: 0 0 auto; display: grid; grid-template-columns: repeat(2, minmax(74px, auto));
    gap: 8px 18px; align-content: center;
    padding-left: 18px; border-left: 1px solid var(--tb-line);
}
.tb-stat-i { font-size: 12px; color: var(--tb-sub); white-space: nowrap; }
.tb-stat-i b { font-size: 18px; font-weight: 700; color: var(--tb-fg); margin-right: 3px; }
.tb-stat-i:nth-child(2) b { color: var(--tb-accent); }
.tb-stat-i:nth-child(3) b { color: var(--tb-ok); }
.tb-stat-i:nth-child(6) b { color: var(--tb-warn); }
.tb-set-btn { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; }

/* ---------------- 工作台 ---------------- */
.tb-work { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 16px; align-items: start; }
.tb-main { min-width: 0; }
.tb-side {
    position: sticky; top: 12px; align-self: start;
    max-height: calc(100vh - 24px);       /* iOS Safari <15.4 不支持 dvh */
    max-height: calc(100dvh - 24px);
    overflow: auto;
    background: var(--tb-card); border: 1px solid var(--tb-line);
    border-radius: var(--tb-r); padding: 12px 10px 14px;
    scrollbar-width: thin; overscroll-behavior: contain;
}
.tb-side-hd {
    display: flex; align-items: center; justify-content: space-between;
    padding: 2px 6px 10px; font-weight: 700; font-size: 13px;
    border-bottom: 1px solid var(--tb-line); margin-bottom: 8px;
}
.tb-side-x { display: none; background: none; border: 0; color: var(--tb-sub); font-size: 16px; cursor: pointer; padding: 2px 8px; }
.tb-tree { display: flex; flex-direction: column; gap: 2px; }
.tb-cat { border-radius: var(--tb-r-sm); }
.tb-cat-btn {
    width: 100%; display: flex; align-items: center; gap: 7px; text-align: left;
    padding: 7px 8px; border: 0; border-radius: var(--tb-r-sm); cursor: pointer;
    background: transparent; color: var(--tb-fg); font-size: 13px; line-height: 1.4;
}
.tb-cat-btn:hover { background: var(--tb-card-2); }
.tb-cat-btn.is-on { background: var(--tb-accent-soft); color: var(--tb-accent); font-weight: 700; }
.tb-cat-ic { flex: 0 0 auto; font-size: 14px; }
.tb-cat-n { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-cat-c { flex: 0 0 auto; font-size: 11px; color: var(--tb-faint); font-variant-numeric: tabular-nums; }
.tb-cat-arrow { flex: 0 0 auto; font-size: 10px; color: var(--tb-faint); transition: transform .16s ease; }
.tb-cat.is-open .tb-cat-arrow { transform: rotate(90deg); }
.tb-secs { display: none; flex-direction: column; gap: 1px; padding: 2px 0 6px 20px; }
.tb-cat.is-open .tb-secs { display: flex; }
.tb-sec {
    display: flex; align-items: center; gap: 6px; width: 100%; text-align: left;
    padding: 5px 8px; border: 0; border-radius: 7px; cursor: pointer;
    background: transparent; color: var(--tb-sub); font-size: 12px;
}
.tb-sec:hover { background: var(--tb-card-2); color: var(--tb-fg); }
.tb-sec.is-on { color: var(--tb-accent); background: var(--tb-accent-soft); font-weight: 600; }
.tb-sec-n { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-sec-c { flex: 0 0 auto; font-size: 10.5px; color: var(--tb-faint); font-variant-numeric: tabular-nums; }
.tb-hosts { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--tb-line); }
.tb-hosts-h { margin: 0 0 8px; padding: 0 6px; font-size: 12px; color: var(--tb-sub); font-weight: 700; }
.tb-hosts-list { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 4px; }
.tb-host {
    font-size: 11px; padding: 3px 8px; border-radius: 999px; cursor: pointer;
    background: var(--tb-card-2); border: 1px solid var(--tb-line); color: var(--tb-sub);
}
.tb-host:hover, .tb-host.is-on { color: var(--tb-accent); border-color: var(--tb-accent); background: var(--tb-accent-soft); }

/* ---------------- 工具条 ---------------- */
.tb-tools {
    position: sticky; top: 0; z-index: 30;
    background: var(--tb-card); border: 1px solid var(--tb-line);
    border-radius: var(--tb-r); padding: 12px; margin-bottom: 12px;
    box-shadow: var(--tb-shadow-sm);
}
.tb-tools-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tb-tools-row2 { margin-top: 9px; }
.tb-search {
    flex: 1 1 300px; min-width: 0; display: flex; align-items: center; gap: 7px;
    background: var(--tb-card-2); border: 1px solid var(--tb-line);
    border-radius: 10px; padding: 0 9px; height: 38px;
}
.tb-search:focus-within { border-color: var(--tb-accent); box-shadow: 0 0 0 3px var(--tb-accent-soft); }
.tb-search-ic { flex: 0 0 auto; color: var(--tb-faint); }
.tb-search-in {
    flex: 1 1 auto; min-width: 0; height: 100%; border: 0; outline: 0;
    background: transparent; color: var(--tb-fg); font-size: 14px;
}
.tb-search-in::placeholder { color: var(--tb-faint); }
.tb-search-in::-webkit-search-cancel-button { display: none; }
.tb-search-clr {
    flex: 0 0 auto; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px;
    background: transparent; color: var(--tb-sub); cursor: pointer; font-size: 13px;
}
.tb-search-clr:hover { color: var(--tb-danger); background: var(--tb-danger-soft); }
.tb-side-toggle { display: none; }
.tb-btn {
    flex: 0 0 auto; min-height: 34px; padding: 6px 11px; cursor: pointer;
    border: 1px solid var(--tb-line-2); border-radius: 9px;
    background: var(--tb-card-2); color: var(--tb-fg); font-size: 12.5px; line-height: 1.4;
    white-space: nowrap;
}
.tb-btn:hover { border-color: var(--tb-accent); color: var(--tb-accent); }
.tb-btn.is-on { background: var(--tb-accent-soft); border-color: var(--tb-accent); color: var(--tb-accent); }
.tb-btn-pri { background: var(--tb-accent); border-color: var(--tb-accent); color: #fff; text-decoration: none; }
.tb-btn-pri:hover { color: #fff; filter: brightness(1.08); }
.tb-seg { display: inline-flex; flex: 0 0 auto; padding: 2px; gap: 2px; border-radius: 9px; background: var(--tb-card-2); border: 1px solid var(--tb-line); }
.tb-seg-btn {
    min-height: 28px; padding: 4px 10px; border: 0; border-radius: 7px; cursor: pointer;
    background: transparent; color: var(--tb-sub); font-size: 12px; white-space: nowrap;
}
.tb-seg-btn:hover { color: var(--tb-fg); }
.tb-seg-btn.is-on { background: var(--tb-card-3); color: var(--tb-accent); font-weight: 700; box-shadow: var(--tb-shadow-sm); }
.tb-select {
    flex: 0 0 auto; height: 34px; padding: 0 8px; cursor: pointer;
    border: 1px solid var(--tb-line-2); border-radius: 9px;
    background: var(--tb-card-2); color: var(--tb-fg); font-size: 12.5px;
}
.tb-select-sm { max-width: 92px; }
.tb-chips { flex: 1 1 220px; min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tb-chip {
    display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
    padding: 3px 8px; border-radius: 999px; font-size: 11.5px;
    background: var(--tb-accent-soft); border: 1px solid var(--tb-accent); color: var(--tb-accent);
}
.tb-chip-x { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0 2px; font-size: 12px; line-height: 1; }
.tb-tools-right { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-left: auto; }
.tb-count { margin-top: 9px; padding: 0 2px; font-size: 12px; color: var(--tb-sub); }
.tb-count b { color: var(--tb-accent); font-variant-numeric: tabular-nums; }

/* ---------------- 最近浏览 ---------------- */
.tb-recent {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 8px 10px; margin-bottom: 12px;
    background: var(--tb-card); border: 1px solid var(--tb-line); border-radius: var(--tb-r-sm);
}
.tb-recent-l { flex: 0 0 auto; font-size: 11.5px; color: var(--tb-faint); }
.tb-recent-list { flex: 1 1 auto; min-width: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.tb-recent-i {
    max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 11.5px; padding: 3px 9px; border-radius: 999px; cursor: pointer;
    background: var(--tb-card-2); border: 1px solid var(--tb-line); color: var(--tb-sub);
}
.tb-recent-i:hover { color: var(--tb-accent); border-color: var(--tb-accent); }
.tb-recent-x { flex: 0 0 auto; border: 0; background: none; color: var(--tb-faint); font-size: 11.5px; cursor: pointer; }
.tb-recent-x:hover { color: var(--tb-danger); }

/* ---------------- 结果：卡片 ---------------- */
.tb-result { min-height: 180px; }
.tb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 12px; }
.tb-card {
    display: flex; flex-direction: column; min-width: 0;
    background: var(--tb-card); border: 1px solid var(--tb-line); border-radius: var(--tb-r);
    padding: 12px 13px; box-shadow: var(--tb-shadow-sm);
    contain: layout style;
}
.tb-card:hover { border-color: var(--tb-line-2); box-shadow: var(--tb-shadow); }
.tb-card.is-fav { border-color: var(--tb-warn); }
.tb-card-hd { display: flex; align-items: flex-start; gap: 7px; min-width: 0; }
.tb-badge {
    flex: 0 0 auto; font-size: 10.5px; line-height: 1.5; padding: 1px 7px; border-radius: 6px;
    background: var(--tb-card-3); color: var(--tb-sub); border: 1px solid var(--tb-line);
}
.tb-badge.is-gh { background: var(--tb-accent-soft); color: var(--tb-accent); border-color: transparent; }
.tb-badge.is-cmd { background: var(--tb-ok-soft); color: var(--tb-ok); border-color: transparent; }
.tb-card-t {
    flex: 1 1 auto; min-width: 0; margin: 0; font-size: 14px; font-weight: 700; line-height: 1.45;
    overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word;
}
.tb-card-t button {
    border: 0; background: none; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.tb-card-t button:hover { color: var(--tb-accent); }
.tb-fav {
    flex: 0 0 auto; width: 26px; height: 26px; padding: 0; cursor: pointer;
    border: 1px solid transparent; border-radius: 7px; background: transparent;
    color: var(--tb-faint); font-size: 15px; line-height: 1;
}
.tb-fav:hover { color: var(--tb-warn); background: var(--tb-warn-soft); }
.tb-fav.is-on { color: var(--tb-warn); }
.tb-card-d {
    margin: 8px 0 0; font-size: 12px; line-height: 1.65; color: var(--tb-sub);
    overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
    -webkit-line-clamp: 3; -webkit-box-orient: vertical; word-break: break-word;
}
.tb-card-code {
    position: relative; margin: 9px 0 0; padding: 8px 9px; border-radius: 8px;
    background: var(--tb-code-bg); border: 1px solid var(--tb-line);
    font: 11.5px/1.6 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    color: var(--tb-fg); white-space: pre; overflow: auto; max-height: 170px;
    scrollbar-width: thin;
}
.tb-card-code.is-fold { display: none; }
.tb-code-more {
    align-self: flex-start; margin-top: 6px; padding: 2px 8px; font-size: 11px; cursor: pointer;
    border: 1px solid var(--tb-line); border-radius: 7px; background: var(--tb-card-2); color: var(--tb-sub);
}
.tb-code-more:hover { color: var(--tb-accent); border-color: var(--tb-accent); }
.tb-card-ft {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 10px;
    font-size: 11px; color: var(--tb-faint);
}
.tb-card-cat { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.tb-card-host { color: var(--tb-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 45%; }
.tb-card-ops { margin-left: auto; display: flex; gap: 5px; }
.tb-mini {
    padding: 3px 8px; font-size: 11px; line-height: 1.5; cursor: pointer; white-space: nowrap;
    border: 1px solid var(--tb-line-2); border-radius: 7px;
    background: var(--tb-card-2); color: var(--tb-sub); text-decoration: none;
}
.tb-mini:hover { color: var(--tb-accent); border-color: var(--tb-accent); }
.tb-mark { background: var(--tb-warn-soft); color: var(--tb-warn); border-radius: 3px; padding: 0 1px; }

/* ---------------- 结果：表格 ---------------- */
.tb-table-wrap { overflow: auto; max-height: min(70vh, 760px); border: 1px solid var(--tb-line); border-radius: var(--tb-r); background: var(--tb-card); scrollbar-width: thin; }
.tb-table { width: 100%; border-spacing: 0; border-collapse: separate; font-size: 12.5px; }
.tb-table th, .tb-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--tb-line); vertical-align: top; }
.tb-table thead th { position: sticky; top: 0; z-index: 2; background: var(--tb-card-2); color: var(--tb-sub); font-weight: 700; white-space: nowrap; }
.tb-table tbody tr:nth-child(even) { background: var(--tb-zebra); }
.tb-table tbody tr:hover { background: var(--tb-accent-soft); }
.tb-th-name { min-width: 170px; }
.tb-th-type { width: 68px; }
.tb-th-cat { width: 150px; }
.tb-th-op { width: 124px; }
.tb-td-name { font-weight: 600; word-break: break-word; }
.tb-td-name button { border: 0; background: none; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.tb-td-name button:hover { color: var(--tb-accent); }
.tb-td-desc { color: var(--tb-sub); max-width: 46ch; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.tb-td-cat { color: var(--tb-sub); }
.tb-td-op { white-space: nowrap; }
.tb-td-op .tb-mini { margin-right: 4px; }

/* ---------------- 空态 / 载入 / 分页 ---------------- */
.tb-empty, .tb-loading {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px;
    min-height: 220px; padding: 30px 16px; text-align: center;
    background: var(--tb-card); border: 1px dashed var(--tb-line); border-radius: var(--tb-r);
}
.tb-empty-ic { font-size: 34px; }
.tb-empty-t { margin: 0; font-size: 15px; font-weight: 700; }
.tb-empty-s { margin: 0; font-size: 12.5px; color: var(--tb-sub); }
.tb-spin { width: 22px; height: 22px; border: 2px solid var(--tb-line); border-top-color: var(--tb-accent); border-radius: 50%; animation: tb-spin .8s linear infinite; }
@keyframes tb-spin { to { transform: rotate(360deg); } }
.tb-pager { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tb-pg { min-height: 32px; padding: 5px 11px; cursor: pointer; border: 1px solid var(--tb-line-2); border-radius: 8px; background: var(--tb-card); color: var(--tb-fg); font-size: 12px; }
.tb-pg:hover:not(:disabled) { border-color: var(--tb-accent); color: var(--tb-accent); }
.tb-pg:disabled { opacity: .45; cursor: default; }
.tb-pager-info { font-size: 12px; color: var(--tb-sub); font-variant-numeric: tabular-nums; }
.tb-jump { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--tb-sub); }
.tb-jump-input { width: 52px; height: 30px; text-align: center; border: 1px solid var(--tb-line-2); border-radius: 7px; background: var(--tb-card-2); color: var(--tb-fg); font-size: 13px; }
.tb-jump-input:focus { outline: 0; border-color: var(--tb-accent); }

/* ---------------- 关于 ---------------- */
.tb-about { margin-top: 18px; background: var(--tb-card); border: 1px solid var(--tb-line); border-radius: var(--tb-r); overflow: hidden; }
.tb-about-t { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 15px; cursor: pointer; font-size: 13px; font-weight: 700; list-style: none; }
.tb-about-t::-webkit-details-marker { display: none; }
.tb-about-t::marker { content: ''; }
.tb-about[open] .tb-about-t { border-bottom: 1px solid var(--tb-line); }
.tb-about[open] .tb-about-caret { transform: rotate(180deg); }
.tb-about-body { padding: 6px 15px 14px; }
.tb-about-body p { margin: 10px 0; font-size: 12.5px; line-height: 1.8; color: var(--tb-sub); }
.tb-about-body b { color: var(--tb-fg); }
.tb-about-body code { padding: 1px 5px; border-radius: 5px; background: var(--tb-card-3); font-size: 11.5px; }

/* ---------------- 弹窗 / 抽屉 / toast ---------------- */
.tb-mask { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(0, 0, 0, .58); }
.tb-modal { display: flex; flex-direction: column; width: min(760px, 100%); max-height: min(86vh, 820px); background: var(--tb-card); border: 1px solid var(--tb-line); border-radius: 16px; box-shadow: var(--tb-shadow); overflow: hidden; }
.tb-modal-sm { width: min(440px, 100%); }
.tb-modal-head { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--tb-line); }
.tb-modal-title { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 15px; font-weight: 700; word-break: break-word; }
.tb-modal-x { flex: 0 0 auto; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--tb-sub); cursor: pointer; font-size: 15px; }
.tb-modal-x:hover { background: var(--tb-danger-soft); color: var(--tb-danger); }
.tb-modal-body { flex: 1 1 auto; overflow: auto; padding: 14px 16px; scrollbar-width: thin; }
.tb-modal-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--tb-line); }
.tb-spacer { flex: 1 1 auto; }
.tb-m-crumb { font-size: 12px; color: var(--tb-faint); margin-bottom: 10px; word-break: break-word; }
.tb-m-desc { margin: 0 0 12px; font-size: 13.5px; line-height: 1.8; color: var(--tb-fg); }
.tb-m-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin: 0 0 12px; }
.tb-m-kv div { padding: 8px 10px; border-radius: 9px; background: var(--tb-card-2); border: 1px solid var(--tb-line); min-width: 0; }
.tb-m-kv dt { font-size: 11px; color: var(--tb-faint); margin-bottom: 3px; }
.tb-m-kv dd { margin: 0; font-size: 12.5px; color: var(--tb-fg); overflow-wrap: anywhere; }
.tb-m-code { margin: 0; padding: 11px 12px; border-radius: 9px; background: var(--tb-code-bg); border: 1px solid var(--tb-line); font: 12px/1.65 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--tb-fg); max-height: 46vh; overflow: auto; }
.tb-m-rel { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--tb-line); }
.tb-m-rel h3 { margin: 0 0 8px; font-size: 12px; color: var(--tb-sub); }
.tb-m-rel-l { display: flex; flex-wrap: wrap; gap: 6px; }
.tb-m-rel button { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; padding: 4px 9px; border: 1px solid var(--tb-line); border-radius: 999px; background: var(--tb-card-2); color: var(--tb-sub); cursor: pointer; }
.tb-m-rel button:hover { color: var(--tb-accent); border-color: var(--tb-accent); }
/* 中英对照：英文原文副标题 */
.tb-sub {
    display: block; margin-top: 2px; font-size: 11px; line-height: 1.5;
    font-weight: 400; color: var(--tb-faint);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tb-card-t .tb-sub { -webkit-line-clamp: 1; }
.tb-td-name .tb-sub { max-width: 100%; }
.tb-faint-t { color: var(--tb-faint); font-size: 11.5px; }
.tb-m-orig {
    margin: 12px 0 0; padding: 9px 11px; border-radius: 9px;
    background: var(--tb-card-2); border: 1px solid var(--tb-line);
    color: var(--tb-sub); font-size: 12px; line-height: 1.7;
    overflow-wrap: anywhere;
}
.tb-m-orig-t { font-size: 11px; color: var(--tb-faint); margin-bottom: 4px; font-weight: 700; }
.tb-m-orig p { margin: 0; }
.tb-m-crumb + .tb-m-orig { margin-top: 0; }
.tb-set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--tb-line); font-size: 13px; }
.tb-set-row .tb-select { width: 150px; }
.tb-check { width: 18px; height: 18px; accent-color: var(--tb-accent); cursor: pointer; }
.tb-set-note { margin: 12px 0 0; font-size: 11.5px; color: var(--tb-faint); }
.tb-side-mask { position: fixed; inset: 0; z-index: 99998; background: rgba(0, 0, 0, .5); }
.tb-toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100010;
    max-width: min(90vw, 440px); padding: 9px 16px; border-radius: 999px;
    background: var(--tb-card-3); color: var(--tb-fg); border: 1px solid var(--tb-line-2);
    box-shadow: var(--tb-shadow); font-size: 12.5px; text-align: center;
    padding-bottom: calc(9px + env(safe-area-inset-bottom, 0px));
}

/* ---------------- 响应式 ---------------- */
@media (min-width: 1600px) {
    .tb { padding: 20px 28px 72px; }
    .tb-grid { grid-template-columns: repeat(auto-fill, minmax(292px, 1fr)); }
    .tb-work { grid-template-columns: 292px minmax(0, 1fr); }
}
@media (max-width: 1400px) {
    .tb-stat { grid-template-columns: repeat(3, minmax(70px, auto)); }
    .tb-work { grid-template-columns: 240px minmax(0, 1fr); }
}
@media (max-width: 1199px) {
    .tb-work { grid-template-columns: minmax(0, 1fr); }
    .tb-side {
        position: fixed; left: 0; top: 0; bottom: 0; z-index: 99999;
        width: min(84vw, 320px); max-height: none; border-radius: 0 16px 16px 0;
        transform: translateX(-102%); transition: transform .22s ease;
        box-shadow: var(--tb-shadow);
    }
    body.tb-side-open .tb-side { transform: translateX(0); }
    .tb-side-x, .tb-side-toggle { display: inline-grid; place-items: center; }
    .tb-tools { top: 0; }
    .tb-stat { grid-template-columns: repeat(3, minmax(70px, auto)); }
}
@media (max-width: 900px) {
    .tb-hero { flex-wrap: wrap; }
    .tb-stat { flex: 1 1 100%; padding-left: 0; border-left: 0; border-top: 1px solid var(--tb-line); padding-top: 12px; grid-template-columns: repeat(3, 1fr); }
    .tb-tools-right { margin-left: 0; }
    .tb-chips { flex: 1 1 100%; order: 2; }
    .tb-tools-row2 { align-items: flex-start; }
}
@media (max-width: 767px) {
    .tb { padding: 12px 12px calc(56px + env(safe-area-inset-bottom, 0px)); font-size: 13.5px; }
    .tb-hero { padding: 13px; gap: 10px; }
    .tb-hero-ic { width: 40px; height: 40px; font-size: 21px; border-radius: 10px; }
    .tb-hero-t { font-size: 18px; }
    .tb-hero-sub { font-size: 12.5px; }
    .tb-stat { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .tb-stat-i b { font-size: 16px; }
    .tb-set-btn { top: 8px; right: 8px; width: 34px; height: 34px; }
    .tb-tools { position: static; padding: 10px; }
    .tb-tools-row { gap: 7px; }
    .tb-search { flex: 1 1 100%; height: 40px; }
    .tb-search-in, .tb-select, .tb-jump-input { font-size: 16px; }
    .tb-seg { flex: 1 1 auto; }
    .tb-seg-btn { flex: 1 1 auto; min-height: 36px; font-size: 13px; }
    .tb-btn { min-height: 40px; padding: 8px 12px; font-size: 13px; }
    .tb-select { height: 40px; }
    .tb-tools-right { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
    .tb-tools-right > .tb-btn, .tb-tools-right > .tb-select { width: 100%; }
    .tb-tools-right .tb-seg-view { grid-column: 1 / -1; display: inline-flex; width: 100%; }
    .tb-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 10px; }
    .tb-card { padding: 11px; }
    .tb-table-wrap { max-height: 60vh; }
    .tb-mask { padding: 0; align-items: flex-end; }
    .tb-modal, .tb-modal-sm { width: 100%; max-width: none; max-height: 92vh; border-radius: 16px 16px 0 0; }
    .tb-modal-x { width: 40px; height: 40px; }
    .tb-modal-foot .tb-btn, .tb-modal-foot .tb-btn-pri { min-height: 40px; }
    .tb-about-body p { font-size: 12px; }
    .tb-toast { bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 420px) {
    .tb-hero-tags .tb-tag:nth-child(n+5) { display: none; }
    .tb-stat { grid-template-columns: repeat(2, 1fr); }
    .tb-tools-right { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tb-grid { grid-template-columns: minmax(0, 1fr); }
    .tb-jump { width: 100%; justify-content: center; }
}
@media (hover: none) {
    .tb-card:hover { box-shadow: var(--tb-shadow-sm); border-color: var(--tb-line); }
}
@media (prefers-reduced-motion: reduce) {
    .tb *, .tb *::before, .tb *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
:focus-visible { outline: 2px solid var(--tb-accent); outline-offset: 2px; }
@supports not selector(:focus-visible) {
    :focus { outline: 2px solid var(--tb-accent); outline-offset: 2px; }
}
@media print {
    .tb-tools, .tb-side, .tb-pager, .tb-recent, .tb-set-btn, .tb-fold, .tb-mask, .tb-toast, .tb-side-mask { display: none !important; }
    .tb-work { display: block; }
}
