/* ============================================================
   税务通 /tools/tax-hub — 样式（txh-* 前缀）
   深/浅双主题：变量定义在 :root 与 [data-theme="light"]
   浮层（toast / 阅读抽屉 / 编辑弹窗）在 .txh 内，统一 [hidden] 守卫
   ============================================================ */

:root {
  --txh-bg: #0f1318;
  --txh-card: #171c23;
  --txh-card-2: #1d232c;
  --txh-card-3: #232b36;
  --txh-line: rgba(255, 255, 255, .11);
  --txh-line-2: rgba(255, 255, 255, .18);
  --txh-text: #e9edf2;
  --txh-sub: #9aa6b4;
  --txh-faint: #aab6c4;
  --txh-accent: #57b6f0;
  --txh-accent-2: #3d8fd0;
  --txh-accent-soft: rgba(87, 182, 240, .13);
  --txh-on-accent: #07131c;
  --txh-ok: #4ec99a;
  --txh-ok-soft: rgba(78, 201, 154, .13);
  --txh-warn: #e8b65a;
  --txh-warn-soft: rgba(232, 182, 90, .13);
  --txh-err: #f07c7c;
  --txh-err-soft: rgba(240, 124, 124, .13);
  --txh-zebra: rgba(127, 127, 127, .055);
  --txh-shadow: 0 10px 34px rgba(0, 0, 0, .34);
  --txh-shadow-sm: 0 2px 10px rgba(0, 0, 0, .18);
  --txh-r-lg: 16px;
  --txh-r-md: 11px;
  --txh-r-sm: 8px;
  --txh-maxw: 1720px;
}

[data-theme="light"] {
  --txh-bg: #f5f7fa;
  --txh-card: #ffffff;
  --txh-card-2: #f4f7fa;
  --txh-card-3: #eaf0f6;
  --txh-line: rgba(15, 20, 25, .10);
  --txh-line-2: rgba(15, 20, 25, .19);
  --txh-text: #16202b;
  --txh-sub: #5c6875;
  --txh-faint: #4b5a69;
  --txh-accent: #1269b8;
  --txh-accent-2: #0d5293;
  --txh-accent-soft: rgba(18, 105, 184, .10);
  --txh-on-accent: #ffffff;
  --txh-ok: #137a53;
  --txh-ok-soft: rgba(19, 122, 83, .10);
  --txh-warn: #96650a;
  --txh-warn-soft: rgba(150, 101, 10, .10);
  --txh-err: #b23535;
  --txh-err-soft: rgba(178, 53, 53, .10);
  --txh-zebra: rgba(15, 20, 25, .038);
  --txh-shadow: 0 10px 30px rgba(25, 40, 60, .12);
  --txh-shadow-sm: 0 2px 8px rgba(25, 40, 60, .08);
}

/* 满屏（保留左侧导航）+ 把滚动权交还 html，使页内 sticky 生效 */
body.page-tax-hub-full { overflow: visible; }
body.page-tax-hub-full .app,
body.page-tax-hub-full .main-content,
body.page-tax-hub-full .page-container { max-width: 100%; }
body.page-tax-hub-full .main-content { width: 100%; border-right: 0; min-width: 0; }

.txh {
  box-sizing: border-box;
  max-width: var(--txh-maxw);
  margin: 0;
  padding: 22px 26px 72px;
  color: var(--txh-text);
  font-size: 14px;
  line-height: 1.7;
}
.txh *, .txh *::before, .txh *::after { box-sizing: border-box; }
.txh [hidden] { display: none !important; }
.txh button, .txh input, .txh select, .txh textarea { font-family: inherit; }
.txh button { cursor: pointer; }
.txh a { color: var(--txh-accent); }
.txh :focus-visible { outline: 2px solid var(--txh-accent); outline-offset: 2px; }

/* ---------------- Hero ---------------- */
.txh-hero {
  position: relative;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 20px 22px;
  border: 1px solid var(--txh-line);
  border-radius: var(--txh-r-lg);
  background: var(--txh-card);
  box-shadow: var(--txh-shadow-sm);
}
.txh-hero-ic {
  flex: 0 0 auto;
  width: 50px; height: 50px;
  display: grid; place-items: center;
  font-size: 26px;
  border-radius: 14px;
  background: var(--txh-accent-soft);
  border: 1px solid var(--txh-line);
}
.txh-hero-tx { flex: 1 1 auto; min-width: 0; }
.txh-hero-top { display: flex; align-items: center; gap: 10px; }
.txh-hero-t { margin: 0; font-size: 22px; line-height: 1.4; font-weight: 700; letter-spacing: .2px; }
.txh-hero-sub { margin: 8px 0 0; color: var(--txh-sub); font-size: 13.2px; max-width: 96ch; }
.txh-hero-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.txh-tag {
  font-size: 11.5px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--txh-line); background: var(--txh-card-2); color: var(--txh-sub);
}
.txh-fold, .txh-icon-btn {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  display: inline-grid; place-items: center;
  border: 0; border-radius: var(--txh-r-sm);
  background: transparent; color: var(--txh-sub);
  transition: background .15s ease, color .15s ease, transform .18s ease;
}
.txh-fold:hover, .txh-icon-btn:hover { background: var(--txh-card-2); color: var(--txh-accent); }
.txh-fold svg { transition: transform .18s ease; }
.txh-hero.is-collapsed .txh-fold svg { transform: rotate(-90deg); }
.txh-hero.is-collapsed .txh-hero-extra { display: none; }

/* 统计仪表盘 */
.txh-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 14px 0 18px;
  padding: 12px 6px;
  border: 1px solid var(--txh-line);
  border-radius: var(--txh-r-lg);
  background: var(--txh-card);
  box-shadow: var(--txh-shadow-sm);
}
.txh-stat { padding: 4px 18px; border-left: 1px solid var(--txh-line); min-width: 0; }
.txh-stat:first-child { border-left: 0; }
.txh-stat b { display: block; font-size: 21px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.txh-stat:nth-child(1) b { color: var(--txh-accent); }
.txh-stat:nth-child(2) b { color: var(--txh-ok); }
.txh-stat:nth-child(3) b { color: var(--txh-warn); }
.txh-stat:nth-child(4) b { color: var(--txh-text); }
.txh-stat em { display: block; font-style: normal; font-size: 11.8px; color: var(--txh-sub); margin-top: 2px; }

/* ---------------- Tabs ---------------- */
.txh-tabs {
  display: flex; flex-wrap: wrap; gap: 6px;
  position: sticky; top: 0; z-index: 30;
  padding: 10px 0;
  background: var(--txh-bg);
  border-bottom: 1px solid var(--txh-line);
  margin-bottom: 18px;
}
.txh-tab {
  min-height: 38px; padding: 7px 14px;
  border: 1px solid transparent; border-radius: 999px;
  background: transparent; color: var(--txh-sub);
  font-size: 13.5px; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.txh-tab:hover { background: var(--txh-card-2); color: var(--txh-text); }
.txh-tab.is-on {
  background: var(--txh-accent-soft); color: var(--txh-accent);
  border-color: var(--txh-accent-soft); font-weight: 600;
}
.txh-tab.is-admin { margin-left: auto; border-color: var(--txh-line-2); }

/* ---------------- 通用卡片 / 工具条 ---------------- */
.txh-card {
  border: 1px solid var(--txh-line);
  border-radius: var(--txh-r-lg);
  background: var(--txh-card);
  box-shadow: var(--txh-shadow-sm);
}
.txh-card-h {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--txh-line);
}
.txh-card-h h2 { margin: 0; font-size: 15.5px; font-weight: 700; }
.txh-card-h .txh-h-note { color: var(--txh-sub); font-size: 12px; }
.txh-card-b { padding: 16px 18px; }
.txh-h-acts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.txh-btn {
  min-height: 36px; padding: 7px 14px;
  border: 1px solid var(--txh-line-2); border-radius: var(--txh-r-sm);
  background: var(--txh-card-2); color: var(--txh-text); font-size: 13px;
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
}
.txh-btn:hover { background: var(--txh-card-3); border-color: var(--txh-accent); }
.txh-btn:active { transform: translateY(1px); }
.txh-btn:disabled { opacity: .5; cursor: not-allowed; }
.txh-btn-pri {
  background: var(--txh-accent); color: var(--txh-on-accent); border-color: var(--txh-accent); font-weight: 600;
}
.txh-btn-pri:hover { background: var(--txh-accent-2); border-color: var(--txh-accent-2); }
.txh-btn-danger { color: var(--txh-err); border-color: var(--txh-err-soft); }
.txh-btn-danger:hover { background: var(--txh-err-soft); border-color: var(--txh-err); }
.txh-btn-ghost { background: transparent; }
.txh-btn-sm { min-height: 30px; padding: 4px 10px; font-size: 12px; }

.txh-in, .txh-sel, .txh-ta {
  width: 100%; min-height: 38px; padding: 8px 11px;
  border: 1px solid var(--txh-line-2); border-radius: var(--txh-r-sm);
  background: var(--txh-bg); color: var(--txh-text); font-size: 13.5px;
}
.txh-in:focus, .txh-sel:focus, .txh-ta:focus { border-color: var(--txh-accent); outline: none; }
.txh-in::placeholder, .txh-ta::placeholder { color: var(--txh-sub); }
.txh-ta { min-height: 120px; resize: vertical; line-height: 1.7; }
.txh-in[type="search"]::-webkit-search-cancel-button,
.txh-in[type="search"]::-webkit-search-decoration { display: none; }
.txh-in[type="number"] { font-variant-numeric: tabular-nums; }

.txh-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 9px;
  padding: 12px 14px; margin-bottom: 14px;
  border: 1px solid var(--txh-line); border-radius: var(--txh-r-md);
  background: var(--txh-card);
}
.txh-search-wrap { position: relative; flex: 1 1 300px; max-width: 560px; min-width: 0; }
.txh-search-wrap .txh-in { padding-right: 34px; }
.txh-search-clr {
  position: absolute; right: 4px; top: 4px; width: 30px; height: 30px;
  border: 0; border-radius: var(--txh-r-sm); background: transparent; color: var(--txh-sub);
}
.txh-search-clr:hover { background: var(--txh-card-3); color: var(--txh-text); }
.txh-sel-sm { width: auto; min-width: 128px; }
.txh-count { margin-left: auto; color: var(--txh-sub); font-size: 12.5px; white-space: nowrap; }
.txh-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.txh-chip {
  min-height: 32px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--txh-line-2); background: var(--txh-card);
  color: var(--txh-sub); font-size: 12.8px;
}
.txh-chip:hover { background: var(--txh-card-2); color: var(--txh-text); }
.txh-chip.is-on { background: var(--txh-accent-soft); border-color: var(--txh-accent); color: var(--txh-accent); font-weight: 600; }
.txh-chip-n { opacity: .75; margin-left: 4px; font-size: 11.5px; }

.txh-note {
  padding: 10px 14px; border-radius: var(--txh-r-md);
  border: 1px solid var(--txh-line); background: var(--txh-card-2);
  color: var(--txh-sub); font-size: 12.8px;
}
.txh-note.is-err { background: var(--txh-err-soft); border-color: var(--txh-err); color: var(--txh-err); }
.txh-note.is-ok { background: var(--txh-ok-soft); border-color: var(--txh-ok); color: var(--txh-ok); }
.txh-note.is-warn { background: var(--txh-warn-soft); border-color: var(--txh-warn); color: var(--txh-warn); }

/* ---------------- 概览 ---------------- */
.txh-ov-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.txh-ov-cat {
  display: block; width: 100%; text-align: left; padding: 16px;
  border: 1px solid var(--txh-line); border-radius: var(--txh-r-md);
  background: var(--txh-card); color: var(--txh-text);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.txh-ov-cat:hover { border-color: var(--txh-accent); transform: translateY(-1px); box-shadow: var(--txh-shadow-sm); }
.txh-ov-cat-ic { font-size: 22px; }
.txh-ov-cat-t { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; font-size: 15px; font-weight: 700; }
.txh-ov-cat-t small { font-weight: 400; color: var(--txh-sub); font-size: 12px; }
.txh-ov-cat-d { margin-top: 6px; color: var(--txh-sub); font-size: 12.5px; }
.txh-cal { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.txh-cal-i { padding: 11px 13px; border: 1px solid var(--txh-line); border-radius: var(--txh-r-md); background: var(--txh-card-2); }
.txh-cal-m { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-weight: 700; }
.txh-cal-m b { color: var(--txh-accent); font-variant-numeric: tabular-nums; }
.txh-cal-i p { margin: 0; color: var(--txh-sub); font-size: 12.3px; }
.txh-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.txh-mini-list { display: flex; flex-direction: column; gap: 6px; }
.txh-mini-i {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; text-align: left; border: 1px solid var(--txh-line);
  border-radius: var(--txh-r-sm); background: var(--txh-card-2); color: var(--txh-text); font-size: 12.8px;
}
.txh-mini-i:hover { border-color: var(--txh-accent); }
.txh-mini-i span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txh-mini-i i { margin-left: auto; font-style: normal; color: var(--txh-sub); font-size: 11px; }
.txh-quick { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------------- 内容列表 ---------------- */
.txh-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 13px; }
.txh-item {
  display: flex; flex-direction: column; gap: 8px;
  padding: 15px 16px; min-width: 0;
  border: 1px solid var(--txh-line); border-radius: var(--txh-r-md);
  background: var(--txh-card);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.txh-item:hover { border-color: var(--txh-accent); transform: translateY(-1px); box-shadow: var(--txh-shadow-sm); }
.txh-item.is-pinned { border-left: 3px solid var(--txh-accent); }
.txh-item-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.txh-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--txh-card-3); color: var(--txh-sub); border: 1px solid var(--txh-line);
}
.txh-badge.is-level { background: var(--txh-accent-soft); color: var(--txh-accent); border-color: transparent; }
.txh-badge.is-date { font-variant-numeric: tabular-nums; }
.txh-item-t {
  margin: 0; font-size: 15px; font-weight: 650; line-height: 1.5;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.txh-item-s {
  margin: 0; color: var(--txh-sub); font-size: 12.6px; line-height: 1.65;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.txh-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.txh-tagn { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--txh-card-2); color: var(--txh-faint); }
.txh-item-f { display: flex; align-items: center; gap: 7px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--txh-line); }
.txh-item-f .txh-meta { color: var(--txh-sub); font-size: 11.5px; margin-right: auto; }
.txh-fav {
  width: 30px; height: 30px; border: 1px solid var(--txh-line); border-radius: var(--txh-r-sm);
  background: transparent; color: var(--txh-sub); font-size: 14px; line-height: 1;
}
.txh-fav:hover { border-color: var(--txh-warn); color: var(--txh-warn); }
.txh-fav.is-on { color: var(--txh-warn); background: var(--txh-warn-soft); border-color: var(--txh-warn); }
.txh-link-card { border-left: 3px solid var(--txh-ok); }
.txh-policy-card { border-left: 3px solid var(--txh-accent); }
.txh-empty { padding: 42px 20px; text-align: center; color: var(--txh-sub); }
.txh-empty b { display: block; color: var(--txh-text); font-size: 15px; margin-bottom: 6px; }
.txh-loading { padding: 32px; text-align: center; color: var(--txh-sub); }
.txh-spin { display: inline-block; width: 18px; height: 18px; margin-right: 8px; vertical-align: -4px; border: 2px solid var(--txh-line-2); border-top-color: var(--txh-accent); border-radius: 50%; animation: txh-spin .8s linear infinite; }
@keyframes txh-spin { to { transform: rotate(360deg); } }

/* ---------------- 阅读抽屉 ---------------- */
.txh-mask {
  position: fixed; inset: 0; z-index: 100000;
  display: flex; align-items: stretch; justify-content: flex-end;
  background: rgba(0, 0, 0, .5);
}
.txh-mask[hidden] { display: none !important; }
.txh-reader {
  width: min(760px, 100%); height: 100%;
  display: flex; flex-direction: column;
  background: var(--txh-card); color: var(--txh-text);
  box-shadow: var(--txh-shadow); isolation: isolate;
}
.txh-reader-h {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 13px 18px; border-bottom: 1px solid var(--txh-line); background: var(--txh-card);
}
.txh-reader-h h2 { margin: 0; font-size: 17px; font-weight: 700; flex: 1 1 240px; min-width: 0; }
.txh-reader-meta { padding: 10px 20px; border-bottom: 1px solid var(--txh-line); color: var(--txh-sub); font-size: 12.3px; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.txh-reader-b { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 24px 60px; scrollbar-width: thin; }
.txh-reader-b::-webkit-scrollbar { width: 10px; }
.txh-reader-b::-webkit-scrollbar-thumb { background: var(--txh-line-2); border-radius: 8px; }
.txh-reader-f { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--txh-line); }
.txh-reader-f .txh-spacer { flex: 1 1 auto; }
.txh-md { font-size: 14.5px; line-height: 1.85; }
.txh-md > :first-child { margin-top: 0; }
.txh-md-h { margin: 24px 0 10px; font-weight: 700; line-height: 1.45; scroll-margin-top: 14px; }
.txh-md h3.txh-md-h { font-size: 17px; }
.txh-md h4.txh-md-h { font-size: 15.5px; }
.txh-md h5.txh-md-h, .txh-md h6.txh-md-h { font-size: 14.5px; }
.txh-md-p { margin: 0 0 12px; }
.txh-md-list { margin: 0 0 14px; padding-left: 24px; }
.txh-md-list li { margin: 3px 0; }
.txh-md-quote { margin: 0 0 14px; padding: 9px 14px; border-left: 3px solid var(--txh-accent); background: var(--txh-accent-soft); color: var(--txh-text); border-radius: 0 var(--txh-r-sm) var(--txh-r-sm) 0; }
.txh-md-hr { border: 0; border-top: 1px solid var(--txh-line); margin: 20px 0; }
.txh-md-code-inline { padding: 1px 5px; border-radius: 4px; background: var(--txh-card-3); font-size: .9em; }
.txh-md-pre { margin: 0 0 16px; padding: 13px 15px; border-radius: var(--txh-r-sm); background: var(--txh-card-2); border: 1px solid var(--txh-line); overflow-x: auto; font-size: 12.8px; line-height: 1.65; }
.txh-md-pre code { white-space: pre; }
.txh-md-table-wrap { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--txh-line); border-radius: var(--txh-r-sm); }
.txh-md-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.txh-md-table th, .txh-md-table td { padding: 8px 11px; text-align: left; border-right: 1px solid var(--txh-line); border-bottom: 1px solid var(--txh-line); vertical-align: top; }
.txh-md-table th:last-child, .txh-md-table td:last-child { border-right: 0; }
.txh-md-table tr:last-child td { border-bottom: 0; }
.txh-md-table thead th { position: sticky; top: 0; background: var(--txh-card-2); font-weight: 650; z-index: 1; }
.txh-md-table tbody tr:nth-child(even) { background: var(--txh-zebra); }
.txh-md-link { text-decoration: underline; text-underline-offset: 2px; }
.txh-toc { padding: 10px 18px; border-bottom: 1px solid var(--txh-line); background: var(--txh-card-2); font-size: 12.3px; max-height: 140px; overflow-y: auto; }
.txh-toc b { color: var(--txh-sub); font-weight: 600; }
.txh-toc a { display: inline-block; margin: 2px 8px 2px 0; white-space: nowrap; }

/* ---------------- 计算器 ---------------- */
.txh-calc { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.txh-calc-form { display: flex; flex-direction: column; gap: 11px; }
.txh-field { display: flex; flex-direction: column; gap: 5px; }
.txh-field > label { font-size: 12.6px; color: var(--txh-sub); }
.txh-field .txh-hint { font-size: 11.5px; color: var(--txh-sub); }
.txh-calc-out { min-height: 220px; }
.txh-res {
  padding: 16px; border-radius: var(--txh-r-md);
  background: var(--txh-accent-soft); border: 1px solid var(--txh-accent-soft);
}
.txh-res-b { font-size: 26px; font-weight: 700; color: var(--txh-accent); font-variant-numeric: tabular-nums; line-height: 1.35; }
.txh-res-l { font-size: 12.5px; color: var(--txh-sub); }
.txh-res-rows { margin-top: 12px; width: 100%; border-collapse: collapse; font-size: 12.8px; }
.txh-res-rows th, .txh-res-rows td { padding: 6px 8px; border-bottom: 1px solid var(--txh-line); text-align: left; }
.txh-res-rows th { color: var(--txh-sub); font-weight: 500; width: 48%; }
.txh-res-rows td { text-align: right; font-variant-numeric: tabular-nums; }
.txh-formula { margin-top: 12px; padding: 10px 12px; border-radius: var(--txh-r-sm); background: var(--txh-card-2); font-size: 12.4px; color: var(--txh-sub); }

/* ---------------- 管理面板 ---------------- */
.txh-adm-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 13px; }
.txh-adm-bar .txh-count { margin-left: auto; }
.txh-table-wrap { overflow-x: auto; border: 1px solid var(--txh-line); border-radius: var(--txh-r-md); }
.txh-table { width: 100%; min-width: 780px; border-collapse: separate; border-spacing: 0; font-size: 12.8px; }
.txh-table th, .txh-table td { padding: 9px 12px; text-align: left; border-right: 1px solid var(--txh-line); border-bottom: 1px solid var(--txh-line); vertical-align: middle; }
.txh-table th:last-child, .txh-table td:last-child { border-right: 0; }
.txh-table tr:last-child td { border-bottom: 0; }
.txh-table thead th { position: sticky; top: 0; z-index: 2; background: var(--txh-card-2); font-weight: 650; }
.txh-table tbody tr:nth-child(even) { background: var(--txh-zebra); }
.txh-table tbody tr:hover { background: var(--txh-accent-soft); }
.txh-table .txh-t-name { min-width: 220px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txh-table .txh-t-acts { white-space: nowrap; }
.txh-table .txh-t-acts .txh-btn { margin-right: 5px; }
.txh-admin-note { margin-top: 14px; }

/* ---------------- 编辑弹窗 ---------------- */
.txh-modal {
  width: min(880px, 100%); max-height: min(92vh, 900px);
  margin: auto; display: flex; flex-direction: column;
  background: var(--txh-card); color: var(--txh-text);
  border-radius: var(--txh-r-lg); box-shadow: var(--txh-shadow); isolation: isolate;
  overflow: hidden;
}
.txh-modal-mask { align-items: center; justify-content: center; padding: 20px; }
.txh-modal-h { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--txh-line); }
.txh-modal-h h2 { margin: 0; font-size: 16px; font-weight: 700; }
.txh-modal-b { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 18px 20px; }
.txh-modal-f { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--txh-line); }
.txh-modal-f .txh-spacer { flex: 1 1 auto; }
.txh-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.txh-form-grid .txh-span2 { grid-column: 1 / -1; }
.txh-check { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; font-size: 13px; color: var(--txh-text); }
.txh-check input { width: 17px; height: 17px; accent-color: var(--txh-accent); }
.txh-edit-body { min-height: 260px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }
.txh-preview { padding: 14px 16px; border: 1px solid var(--txh-line); border-radius: var(--txh-r-sm); background: var(--txh-card-2); max-height: 320px; overflow-y: auto; }

/* ---------------- Toast ---------------- */
.txh-toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 200000;
  max-width: min(90vw, 560px); padding: 10px 16px;
  border-radius: 999px; background: var(--txh-card-3); color: var(--txh-text);
  border: 1px solid var(--txh-line-2); box-shadow: var(--txh-shadow);
  font-size: 13px; text-align: center;
}
.txh-toast[hidden] { display: none !important; }
.txh-toast.is-ok { border-color: var(--txh-ok); }
.txh-toast.is-err { border-color: var(--txh-err); }

/* ---------------- 响应式 ---------------- */
@media (min-width: 1600px) {
  .txh { padding: 26px 36px 80px; }
  .txh-list { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
}

@media (max-width: 1100px) {
  .txh { padding: 18px 20px 64px; }
  .txh-calc { grid-template-columns: minmax(0, 1fr); }
  .txh-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
  .txh-stat:nth-child(3) { border-left: 0; }
  .txh-stat:nth-child(n+3) { border-top: 1px solid var(--txh-line); }
}

@media (max-width: 900px) {
  .txh-tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .txh-tabs::-webkit-scrollbar { display: none; }
  .txh-tab { flex: 0 0 auto; }
  .txh-tab.is-admin { margin-left: 0; }
  .txh-hero { padding: 16px; }
  .txh-hero-t { font-size: 19px; }
  .txh-ov-grid, .txh-cal, .txh-two { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}

@media (max-width: 767px) {
  .txh { padding: 14px 12px 72px; font-size: 14.5px; }
  .txh-hero { gap: 10px; }
  .txh-hero-ic { width: 40px; height: 40px; font-size: 21px; border-radius: 11px; }
  .txh-hero-t { font-size: 17px; }
  .txh-hero-sub { font-size: 12.8px; }
  .txh-tag { font-size: 11px; }
  .txh-fold, .txh-icon-btn { width: 34px; height: 34px; }
  .txh-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .txh-stat { padding: 6px 12px; }
  .txh-stat b { font-size: 18px; }
  .txh-tabs { top: 53px; }
  .txh-tab { min-height: 40px; padding: 8px 13px; }
  .txh-toolbar { padding: 10px; }
  .txh-search-wrap { flex: 1 1 100%; max-width: none; }
  .txh-in, .txh-sel, .txh-ta, .txh-btn { font-size: 16px; }
  .txh-btn { min-height: 44px; }
  .txh-btn-sm { min-height: 38px; font-size: 14px; }
  .txh-fav { width: 40px; height: 40px; font-size: 17px; }
  .txh-chip { min-height: 40px; padding: 8px 14px; font-size: 13.5px; }
  .txh-list { grid-template-columns: minmax(0, 1fr); }
  .txh-card-h, .txh-card-b { padding: 13px; }
  .txh-reader { width: 100%; height: 100%; }
  .txh-reader-b { padding: 14px 14px 60px; }
  .txh-mask.txh-modal-mask { padding: 0; align-items: flex-end; }
  .txh-modal { width: 100%; max-width: none; max-height: 94dvh; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .txh-form-grid { grid-template-columns: minmax(0, 1fr); }
  .txh-form-grid .txh-span2 { grid-column: auto; }
  .txh-modal-f { padding: 12px; }
  .txh-modal-f .txh-btn { flex: 1 1 auto; }
  .txh-md { font-size: 14.5px; }
  .txh-md-table { font-size: 12.5px; }
  .txh-calc-form .txh-in, .txh-calc-form .txh-sel { font-size: 16px; }
  .txh-search-clr { width: 40px; height: 40px; right: 3px; top: 3px; }
}

@media (max-width: 420px) {
  .txh-stat b { font-size: 16px; }
  .txh-hero-tags { gap: 5px; }
  .txh-tag { padding: 3px 7px; font-size: 10.8px; }
  .txh-reader-h h2 { font-size: 15px; }
  .txh-reader-f .txh-btn { font-size: 12.5px; padding: 6px 9px; }
}

@media (hover: none) {
  .txh-item:hover, .txh-ov-cat:hover { transform: none; }
  .txh-btn:active { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .txh *, .txh *::before, .txh *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .txh-spin { animation-duration: 1.6s !important; }
}

/* ---------------- 修复补充：滚动锁 / 表头吸顶 / 大列表渲染 ---------------- */
/* 本页 body 被设为 overflow:visible，滚动容器是 html，弹层打开时必须锁 html */
html.txh-locked { overflow: hidden; }
/* 只写 overflow-x:auto 会让 overflow-y 计算成 auto，但没有高度上限时
   容器永不纵向滚动，position:sticky 的表头永远不会吸顶。 */
.txh-table-wrap { max-height: min(70vh, 720px); overflow-y: auto; overscroll-behavior: contain; }
.txh-md-table-wrap { max-height: min(60vh, 520px); overflow-y: auto; overscroll-behavior: contain; }
.txh-modal-b { overscroll-behavior: contain; }
/* 全局提示条里的重试按钮：与说明文字保持间距、不换行挤在一起 */
.txh-note .txh-btn { margin-left: 10px; vertical-align: middle; }
/* 89 张卡片的长列表：限制布局/样式影响范围，减少重排扩散 */
.txh-list { contain: layout style; }
.txh-item { contain: layout style; }

@media print {
  .txh-tabs, .txh-toolbar, .txh-chips, .txh-adm-bar, .txh-reader-f, .txh-toast, .txh-fold, .txh-icon-btn { display: none !important; }
  .txh { padding: 0; }
  .txh-card, .txh-item { box-shadow: none; break-inside: avoid; }
  .txh-table-wrap, .txh-md-table-wrap { max-height: none; overflow: visible; }
}
