/*!
 * ui-system.css — 干活呗官网组件级规范（v26 批次 4 · 腾讯云式 P2/P3 收尾）
 *
 * 背景：layout-v2.css 只解决了「容器宽 + section 节奏 + 标题区」三件事，
 *       组件级（卡片密度 / 空态 / 加载 / 错误 / 表格 / 表单 / 权限降级）一直没有单一真源，
 *       结果是每个页面各写一套：section 间距实测 32 种、卡片宽度实测 16 种。
 *
 * 本文件是这六件套的**唯一真源**，只在 :root 上追加变量、只新增 .ghb-* 类，
 * 不修改任何既有 token，也不覆盖既有类 —— 回滚只需删掉这一行 link。
 *
 * 引入顺序：site.css → layout-v2.css → ui-system.css（必须最后）
 *
 * 达标口径（真浏览器可断言）：
 *   · 内容宽     1296（1680 视口下 1457）
 *   · section 间距 ∈ {0, 60, 96, 120}
 *   · 卡片宽度   ∈ {240, 306, 416, 636}（1296 内容宽下 repeat(N,1fr) + gap 24 的自然结果）
 * ========================================================================== */

:root {
  /* ---- 间距档位：只保留四档，禁止再出现 22/36/48/52/76/88/100 这类游离值 ---- */
  --sp-0: 0;
  --sp-sec: 60px;      /* 标准 section 上下间距（腾讯云式，紧凑高信息密度） */
  --sp-sec-lg: 96px;   /* 大节：章节之间 */
  --sp-sec-xl: 120px;  /* 特大节：长页面收尾前的呼吸位 */
  --sp-gap: 24px;      /* 卡片栅格间距（唯一值） */

  /* ---- 卡片圆角 / 边框：与 site.css token 对齐，避免各页自造 8px ---- */
  --ghb-radius-card: var(--radius-card, 20px);
  --ghb-border: 1px solid var(--green-100, #fbeee1);
  --ghb-shadow: var(--shadow-card, 0 1px 2px rgba(122, 22, 22, .04), 0 8px 24px rgba(122, 22, 22, .05));

  /* ---- 状态色（与品牌砖红同族，不引 Google 蓝） ---- */
  --ghb-ok: #1f7a4d;
  --ghb-ok-bg: #e8f5ee;
  --ghb-warn: #b26a00;
  --ghb-warn-bg: #fdf3e2;
  --ghb-err: #b42424;
  --ghb-err-bg: #fdeceb;
  --ghb-info: #55554e;
  --ghb-info-bg: #f2f1ec;
}

/* ==========================================================================
   0. 共享补齐：site.css 里少数几个类的实测间距不在四档内，这里只补上下间距，
      不动其它声明（site.css 是共享真源，能不改就不改）
      · .page-hero 实测 52/56 → 60/60
   ========================================================================== */
.page-hero { padding-top: 60px; padding-bottom: 60px; }

/* ==========================================================================
   1. 卡片栅格：四档，一律 repeat(N, minmax(0,1fr)) + gap 24
      1296 内容宽下的自然列宽：5→240 / 4→306 / 3→416 / 2→636
      🔴 禁止再写 px 定宽或 auto-fill minmax(280px,1fr) —— 那是列宽失控的根源
   ========================================================================== */
.ghb-grid,
.ghb-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-gap);
}
.ghb-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-gap); }
.ghb-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-gap); }
.ghb-grid-5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--sp-gap); }
.ghb-grid-6 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--sp-gap); }

@media (max-width: 1100px) {
  .ghb-grid, .ghb-grid-4, .ghb-grid-5, .ghb-grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ghb-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .ghb-grid, .ghb-grid-2, .ghb-grid-3,
  .ghb-grid-4, .ghb-grid-5, .ghb-grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 460px) {
  .ghb-grid, .ghb-grid-2, .ghb-grid-3,
  .ghb-grid-4, .ghb-grid-5, .ghb-grid-6 { grid-template-columns: minmax(0, 1fr); }
}

/* 卡片本体：圆角/边框/阴影统一，不再各页自造 */
.ghb-card {
  position: relative;
  background: var(--card, #fff);
  border: var(--ghb-border);
  border-radius: var(--ghb-radius-card);
  box-shadow: var(--ghb-shadow);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}
.ghb-card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(122, 22, 22, .10); }
.ghb-card-bd { padding: 20px; }
.ghb-card-ttl { font-size: 17px; font-weight: 600; color: var(--ink-900); line-height: 1.4; margin: 0 0 8px; }
.ghb-card-sum { font-size: 14px; color: var(--ink-500); line-height: 1.6; margin: 0 0 12px; }
.ghb-card-meta { font-size: 12px; color: var(--ink-400); }

/* ==========================================================================
   2. 空态：空态即引导（为什么空 + 下一步做什么 + 一键行动）
      🔴 一个光秃秃的「暂无数据」不算空态
   ========================================================================== */
.ghb-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 56px 24px; text-align: center;
  background: var(--green-50, #fdf6ef);
  border: 1px dashed var(--green-200, #f3cfb8);
  border-radius: var(--ghb-radius-card);
}
.ghb-empty .ghb-empty-ic {
  width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center; font-size: 24px;
  background: #fff; color: var(--green-700); border: var(--ghb-border);
}
.ghb-empty h4 { font-size: 16px; font-weight: 600; color: var(--ink-900); margin: 0; }
.ghb-empty p { font-size: 14px; color: var(--ink-500); line-height: 1.7; margin: 0; max-width: 520px; }
.ghb-empty .ghb-empty-act { margin-top: 6px; display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.ghb-empty .ghb-empty-act a,
.ghb-empty .ghb-empty-act button {
  font-size: 14px; font-weight: 500; color: #fff; background: var(--green-700);
  border: 0; border-radius: var(--radius-button, 999px); padding: 10px 22px; cursor: pointer;
  text-decoration: none;
}
.ghb-empty .ghb-empty-act a.ghb-ghost,
.ghb-empty .ghb-empty-act button.ghb-ghost {
  background: #fff; color: var(--green-700); border: 1px solid var(--green-200);
}
/* 行内紧凑版（表格/小容器里的空态） */
.ghb-empty-sm { padding: 28px 16px; gap: 6px; }
.ghb-empty-sm .ghb-empty-ic { width: 38px; height: 38px; font-size: 18px; }
.ghb-empty-sm h4 { font-size: 14px; }
.ghb-empty-sm p { font-size: 13px; }

/* ==========================================================================
   3. 加载：骨架屏（卡片骨架 + 文本骨架），>3s 才出进度条
   ========================================================================== */
.ghb-skel { display: grid; gap: var(--sp-gap); }
.ghb-skel.ghb-skel-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ghb-skel.ghb-skel-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ghb-skel.ghb-skel-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ghb-skel-card {
  background: #fff; border: var(--ghb-border); border-radius: var(--ghb-radius-card);
  padding: 0; overflow: hidden;
}
.ghb-skel-card .sk-cov { display: block; height: 140px; }
.ghb-skel-card .sk-bd { padding: 18px 20px 22px; }
.ghb-sk {
  display: block; height: 14px; border-radius: 6px; margin: 10px 0;
  background: linear-gradient(90deg, #f2efe9 25%, #e9e5dd 50%, #f2efe9 75%);
  background-size: 200% 100%; animation: ghbSk 1.4s infinite;
}
.ghb-sk.w40 { width: 40%; } .ghb-sk.w60 { width: 60%; }
.ghb-sk.w80 { width: 80%; } .ghb-sk.w100 { width: 100%; }
@keyframes ghbSk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .ghb-sk { animation: none; } }

/* ==========================================================================
   4. 错误：四段式（发生了什么 + 为什么 + 怎么办 + 重试）
   ========================================================================== */
.ghb-err {
  padding: 32px 28px; border-radius: var(--ghb-radius-card);
  background: var(--ghb-err-bg); border: 1px solid rgba(180, 36, 36, .18);
  color: var(--ink-700);
}
.ghb-err .ghb-err-hd { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; color: var(--ghb-err); }
.ghb-err .ghb-err-hd::before { content: "!"; width: 22px; height: 22px; border-radius: 50%; background: var(--ghb-err); color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 700; }
.ghb-err dl { margin: 14px 0 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; font-size: 14px; }
.ghb-err dt { color: var(--ink-400); }
.ghb-err dd { margin: 0; color: var(--ink-700); line-height: 1.7; }
.ghb-err .ghb-err-act { margin-top: 18px; display: flex; gap: 12px; flex-wrap: wrap; }
.ghb-err .ghb-err-act a,
.ghb-err .ghb-err-act button {
  font-size: 14px; padding: 9px 20px; border-radius: var(--radius-button, 999px);
  background: var(--green-700); color: #fff; border: 0; cursor: pointer; text-decoration: none;
}
.ghb-err .ghb-err-act a.ghb-ghost { background: #fff; color: var(--green-700); border: 1px solid rgba(180, 36, 36, .3); }

/* ==========================================================================
   5. 表格：关键列 5–7；数字右对齐；状态用 tag；分页 20；批量操作选中后出现
   ========================================================================== */
.ghb-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; background: #fff; }
.ghb-table th {
  text-align: left; font-weight: 600; color: var(--ink-500); font-size: 13px;
  padding: 12px 16px; background: var(--green-50); border-bottom: 1px solid var(--green-100);
  white-space: nowrap;
}
.ghb-table td { padding: 13px 16px; border-bottom: 1px solid var(--ink-200); color: var(--ink-700); vertical-align: middle; }
.ghb-table tbody tr:hover td { background: var(--green-50); }
.ghb-table .num, .ghb-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.ghb-table .ops { text-align: right; white-space: nowrap; }
.ghb-table .ops a, .ghb-table .ops button {
  color: var(--green-700); background: none; border: 0; cursor: pointer; font-size: 13px; padding: 0 6px;
}

/* ==========================================================================
   6. 表单：必填标记统一；错误在字段下方就近提示；提交中禁用；失败保留已填
   ========================================================================== */
.ghb-field { margin-bottom: 18px; }
.ghb-field > label { display: block; font-size: 14px; font-weight: 500; color: var(--ink-700); margin-bottom: 8px; }
.ghb-field > label .req { color: var(--ghb-err); margin-left: 3px; }
.ghb-field input,
.ghb-field select,
.ghb-field textarea {
  width: 100%; padding: 12px 14px; font-size: 14px; color: var(--ink-900);
  background: #fff; border: 1px solid var(--ink-200); border-radius: var(--radius-input, 14px);
}
.ghb-field input:focus,
.ghb-field select:focus,
.ghb-field textarea:focus { outline: 0; border-color: var(--green-700); }
.ghb-field.is-err input,
.ghb-field.is-err select,
.ghb-field.is-err textarea { border-color: var(--ghb-err); }
.ghb-field .ghb-msg { margin-top: 6px; font-size: 13px; color: var(--ink-400); }
.ghb-field.is-err .ghb-msg { color: var(--ghb-err); }
.ghb-form-act { display: flex; gap: 12px; align-items: center; margin-top: 24px; }
.ghb-form-act [disabled] { opacity: .6; cursor: not-allowed; }

/* ==========================================================================
   7. 权限降级：显示入口 + 说明 + 申请路径（不静默隐藏）
   ========================================================================== */
.ghb-deny {
  display: flex; align-items: flex-start; gap: 14px; padding: 22px 24px;
  background: var(--ghb-info-bg); border: 1px solid var(--ink-200);
  border-radius: var(--ghb-radius-card);
}
.ghb-deny .ghb-deny-ic { flex: 0 0 34px; height: 34px; border-radius: 50%; background: #fff; display: grid; place-items: center; color: var(--ink-400); font-size: 16px; }
.ghb-deny h5 { font-size: 15px; font-weight: 600; color: var(--ink-900); margin: 0 0 4px; }
.ghb-deny p { font-size: 13px; color: var(--ink-500); line-height: 1.7; margin: 0; }
.ghb-deny .ghb-deny-act { margin-top: 10px; }
.ghb-deny .ghb-deny-act a { font-size: 13px; color: var(--green-700); font-weight: 500; }

/* ==========================================================================
   8. 状态标签（品牌同族，不引外来色板）
   ========================================================================== */
.ghb-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: var(--radius-tag, 8px);
  background: var(--ghb-info-bg); color: var(--ghb-info); white-space: nowrap;
}
.ghb-tag--ok { background: var(--ghb-ok-bg); color: var(--ghb-ok); }
.ghb-tag--warn { background: var(--ghb-warn-bg); color: var(--ghb-warn); }
.ghb-tag--err { background: var(--ghb-err-bg); color: var(--ghb-err); }
.ghb-tag--brand { background: var(--green-100); color: var(--green-700); }

/* ==========================================================================
   9. Toast（3s；破坏性操作带「撤销」）
   ========================================================================== */
.ghb-toast {
  position: fixed; left: 50%; top: 88px; transform: translateX(-50%);
  z-index: 9999; display: flex; align-items: center; gap: 14px;
  padding: 12px 20px; border-radius: var(--radius-button, 999px);
  background: var(--ink-900); color: #fff; font-size: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}
.ghb-toast .ghb-undo { color: var(--green-200); font-weight: 500; cursor: pointer; }
.ghb-toast--err { background: var(--ghb-err); }
.ghb-toast--ok { background: var(--ghb-ok); }

/* ==========================================================================
   10. 列表工具栏：筛选永远在左，操作永远在右
   ========================================================================== */
.ghb-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.ghb-toolbar .ghb-tb-l { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ghb-toolbar .ghb-tb-r { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.ghb-pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 24px; font-size: 13px; color: var(--ink-500); }
.ghb-pager a, .ghb-pager button {
  min-width: 32px; height: 32px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--ink-200); background: #fff; color: var(--ink-700);
  display: inline-grid; place-items: center; cursor: pointer; font-size: 13px;
}
.ghb-pager .is-on { background: var(--green-700); color: #fff; border-color: var(--green-700); }

/* ==========================================================================
   11. 法务/文档页组件：目录导航滚动高亮 + 文档工具条（v26-B4）
   —— 由 assets/legal-toc.js 驱动；两页共用，不新增维护点
   ========================================================================== */
.ghb-doc-anchor { scroll-margin-top: 96px; }
.ghb-doc-toc a {
  padding-left: 8px; padding-right: 8px; margin-left: -8px;
  border-radius: 8px; transition: background-color .15s, color .15s;
}
.ghb-doc-toc a.is-active {
  color: var(--green-700); font-weight: 600; background: var(--green-100);
}
.ghb-doc-toc a.is-active::before { font-weight: 800; }
.ghb-toolbar.ghb-toolbar-doc {
  margin: 18px 0 0; padding-top: 16px;
  border-top: 1px dashed var(--green-100);
}
.ghb-toolbar.ghb-toolbar-doc .ghb-doc-cur {
  font-size: 13px; color: var(--ink-500);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px;
}
.ghb-toolbar.ghb-toolbar-doc .ghb-btn-doc {
  height: 30px; padding: 0 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--ink-200); background: #fff; color: var(--ink-700);
  font-size: 13px; display: inline-grid; place-items: center;
  transition: border-color .15s, color .15s;
}
.ghb-toolbar.ghb-toolbar-doc .ghb-btn-doc:hover {
  border-color: var(--green-700); color: var(--green-700);
}
@media (max-width: 600px) {
  .ghb-toolbar.ghb-toolbar-doc { gap: 10px; }
  .ghb-toolbar.ghb-toolbar-doc .ghb-doc-cur { max-width: 100%; }
}
