/* ============================================================
 * 批 V21 V21-12 系统设置新结构（改法清单 #551，审核方 #4 11-21 01:3x 通过；稿 2 图 01、04、05、06）
 *   ① 左栏：层 → 组，当前组展开它的页（替掉 core-x-settings.css 里老的 9 类左栏）；页头路径「系统设置 › 层 › 组」
 *   ② 首页（public/js/settings-home.js）：大号搜索、配置体检四格、三层卡加系统卡、最近改动；sth- 开头
 *   ③ 收款闸页（public/js/paygate-set.js）：pgx- 开头
 *   ④ 手机 390：首页一列、体检两格一排；子页的左栏收起来（只留当前这一层、组排成一行）
 *   颜色、圆角只用 --u- 变量；排在 core-x-settings.css 后面，不进「零件 → 外壳 → 换皮 → 手机」那一串
 * ============================================================ */

/* ---------- ① 左栏：层 → 组 → 页 ---------- */
.stx-all { display: none; }
.stx-ly + .stx-ly { margin-top: 6px; }
.stx-lyh { display: flex; align-items: center; gap: 8px; padding: 8px 10px 4px; font-size: 12px; line-height: 18px; font-weight: 600; color: var(--u-ink-2); }
.stx-lyh svg { flex: none; color: var(--u-brand); }
.stx-gp { display: block; padding: 6px 10px 6px 34px; border-radius: var(--u-radius-md); font-size: 13px; line-height: 20px; color: var(--u-ink-2); text-decoration: none; }
.stx-gp:hover { background: var(--u-neutral-soft); color: var(--u-ink); }
.stx-gp.on { background: var(--u-brand-soft); color: var(--u-brand); font-weight: 600; }
.stx-gp:focus-visible, .stx-it:focus-visible { outline: 2px solid var(--u-brand); outline-offset: 1px; }
.stx-gpw { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px 34px; padding-left: 8px; border-left: 1px solid var(--u-line); }
.stx-it { display: block; padding: 4px 8px; border-radius: var(--u-radius-md); font-size: 12.5px; line-height: 18px; color: var(--u-ink-3); text-decoration: none; }
.stx-it:hover { background: var(--u-neutral-soft); color: var(--u-ink); }
.stx-it.on { color: var(--u-brand); font-weight: 600; background: var(--u-surface); box-shadow: inset 2px 0 0 var(--u-brand); }
/* 页头路径：系统设置（回首页）› 层 › 组 */
.stx-path { gap: 6px; flex-wrap: wrap; }
.stx-path a { color: var(--u-ink-3); text-decoration: none; }
.stx-path a:hover { color: var(--u-brand); }
.stx-path .sep { color: var(--u-ink-3); }
/* 搜索：命中老分类名时路径后面的「原：…」 */
.stx-q-al { color: var(--u-ink-3); font-size: 12px; }

/* ---------- ② 首页 ---------- */
.sth { display: flex; flex-direction: column; gap: 16px; font-size: 14px; line-height: 22px; color: var(--u-ink); }
.sth h3, .sth h4, .sth p { margin: 0; }
.sth-top { display: flex; align-items: center; gap: 12px; }
.sth-q { flex: 1; max-width: 560px; }
.sth-q .stx-q-big { width: 100%; height: 40px; border-radius: 10px; }
.sth-q .stx-q-big > input.stx-q-ipt { font-size: 14px; }
.sth-hint { font-size: 12px; color: var(--u-ink-3); }
.sth-body { display: flex; flex-direction: column; gap: 16px; }
.sth-card { background: var(--u-surface); border: 1px solid var(--u-line); border-radius: var(--u-radius-lg); min-width: 0; overflow: hidden; }
.sth-hd { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--u-line); }
.sth-hd b { font-size: 15px; font-weight: 600; }
.sth-hd small { font-size: 12px; color: var(--u-ink-3); }
.sth-hd .sp { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.sth-hd svg { color: var(--u-ink-3); }
/* 配置体检四格 */
.sth-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sth-tile { padding: 12px 16px 14px; border-left: 1px solid var(--u-line); min-width: 0; }
.sth-tile:first-child { border-left: 0; }
.sth-tile .k { font-size: 12px; line-height: 18px; color: var(--u-ink-3); }
.sth-tile .v { margin-top: 2px; display: flex; align-items: baseline; gap: 6px; font-size: 22px; line-height: 28px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 0; }
.sth-tile .v > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sth-tile .v small { font-size: 12px; font-weight: 400; color: var(--u-ink-3); }
.sth-tile .s { margin-top: 4px; display: flex; align-items: flex-start; gap: 6px; font-size: 12px; line-height: 18px; font-weight: 500; }
.sth-tile .s svg { flex: none; margin-top: 2px; }
.sth-tile .s.warn { color: var(--u-warning); }
.sth-tile .s.ok { color: var(--u-success); }
.sth-tile .s .u-link { margin-left: auto; flex: none; white-space: nowrap; }
.sth-bad { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-top: 1px solid var(--u-line); font-size: 13px; color: var(--u-danger); background: var(--u-danger-soft); }
.sth-bad .u-link { margin-left: auto; white-space: nowrap; }
/* 三层卡、系统卡 */
.sth-layers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.sth-lyh { display: flex; gap: 12px; align-items: flex-start; padding: 16px 16px 12px; min-width: 0; }
.sth-lyh > div { min-width: 0; }
.sth-lyh .bd { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--u-brand-soft); color: var(--u-brand); }
.sth .sth-ly > .sth-lyh h3 { font-size: 16px; line-height: 24px; font-weight: 600; }
.sth-lyh p { font-size: 12px; line-height: 18px; color: var(--u-ink-3); }
.sth-grp { border-top: 1px solid var(--u-line); padding: 8px; }
.sth-sys .sth-grp:first-of-type { border-top: 0; }
.sth-grp h4 { padding: 4px 8px 2px; font-size: 12px; line-height: 18px; font-weight: 500; color: var(--u-ink-3); }
.sth-it { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 8px; border-radius: var(--u-radius-md); color: var(--u-ink); text-decoration: none; min-width: 0; }
.sth-it:hover { background: var(--u-neutral-soft); }
.sth-it:focus-visible { outline: 2px solid var(--u-brand); outline-offset: 1px; }
.sth-it .n { flex: 0 1 auto; min-width: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sth-it .u-tag { flex: none; }
.sth-it .d { flex: 1; min-width: 0; font-size: 12px; color: var(--u-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sth-it .w { flex: none; font-size: 12px; font-weight: 500; color: var(--u-warning); }
.sth-it > svg { flex: none; color: var(--u-ink-3); }
/* 系统卡 + 最近改动 */
.sth-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px; align-items: stretch; }
.sth-rec .u-tbl td { vertical-align: top; }
.sth-rec .sth-tm { white-space: nowrap; color: var(--u-ink-3); }
.sth-rec .sth-who { white-space: nowrap; }
.sth-rec .sth-what b { font-weight: 500; }
.sth-rec .sth-what small { display: block; font-size: 12px; line-height: 18px; color: var(--u-ink-3); overflow-wrap: anywhere; }
.sth-rec .sth-imp { font-size: 12px; color: var(--u-ink-2); }

/* ---------- ③ 收款闸 ---------- */
.pgx { display: flex; flex-direction: column; gap: 16px; }
.pgx-card { background: var(--u-surface); border: 1px solid var(--u-line); border-radius: var(--u-radius-lg); overflow: hidden; }
.pgx-hd { padding: 14px 16px; border-bottom: 1px solid var(--u-line); }
.pgx .pgx-card > .pgx-hd h3 { margin: 0; font-size: 16px; line-height: 24px; font-weight: 600; color: var(--u-ink); }
.pgx-hd p { margin: 2px 0 0; font-size: 13px; line-height: 20px; color: var(--u-ink-3); }
.pgx-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--u-line); font-size: 14px; line-height: 22px; color: var(--u-ink); }
.pgx-row > .k { color: var(--u-ink-2); font-size: 13px; }
.pgx-row .tip { margin-top: 2px; font-size: 12px; line-height: 18px; color: var(--u-ink-3); }
.pgx-nodes { display: flex; flex-wrap: wrap; gap: 6px; }
.pgx-node { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px 2px 4px; border: 1px solid var(--u-line); border-radius: var(--u-radius-md); font-size: 13px; line-height: 20px; }
.pgx-node.bad { border-color: var(--u-danger); }
.pgx-miss { font-size: 12px; color: var(--u-danger); }
.pgx-none { color: var(--u-ink-3); }
.pgx-foot { padding: 10px 16px; font-size: 12px; line-height: 18px; color: var(--u-ink-3); }
.pgx-pick { display: flex; flex-direction: column; gap: 10px; }
.pgx-tip { margin: 0; font-size: 13px; line-height: 20px; color: var(--u-ink-3); }
.pgx-pick .u-search { width: 100%; }
.pgx-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 12px; max-height: 50vh; overflow-y: auto; }
.pgx-opt { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: var(--u-radius-md); cursor: pointer; min-width: 0; }
.pgx-opt:hover { background: var(--u-neutral-soft); }
.pgx-opt[hidden] { display: none; }
.pgx-opt .pgx-node { border: 0; padding: 0; min-width: 0; }
.pgx-err { font-size: 13px; line-height: 20px; color: var(--u-danger); white-space: pre-line; }
.pgx-err:empty { display: none; }

/* ---------- 窄屏 ---------- */
@media (max-width: 1100px) {
  .stx-nav .stx-ly { flex: 1 1 200px; }
  .stx-ly + .stx-ly { margin-top: 0; }
  .sth-layers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sth-two { grid-template-columns: minmax(0, 1fr); }
}
/* ④ 手机：首页一列、体检两格一排；子页左栏只留当前这一层，组排成一行，上面一个「全部设置」回首页 */
@media (max-width: 760px) {
  .sth-top { flex-wrap: wrap; }
  .sth-q { max-width: none; flex-basis: 100%; }
  .sth-hint { display: none; }
  .sth-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sth-tile:nth-child(3) { border-left: 0; }
  .sth-tile:nth-child(n+3) { border-top: 1px solid var(--u-line); }
  .sth-layers { grid-template-columns: minmax(0, 1fr); }
  .sth-rec .u-tbl thead { display: none; }
  .sth-rec .u-tbl, .sth-rec .u-tbl tbody, .sth-rec .u-tbl tr, .sth-rec .u-tbl td { display: block; }
  .sth-rec .u-tbl tr { padding: 10px 12px; border-bottom: 1px solid var(--u-line); }
  .sth-rec .u-tbl tr:last-child { border-bottom: 0; }
  .sth-rec .u-tbl > tbody > tr > td { padding: 0; border: 0; }
  .stx-all { display: block; flex-basis: 100%; padding: 2px 4px 6px; font-size: 13px; color: var(--u-brand); text-decoration: none; }
  .stx-nav .stx-ly:not(.on) { display: none; }
  .stx-nav .stx-ly.on { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 4px; }
  .stx-ly.on .stx-lyh { flex-basis: 100%; padding: 2px 4px; }
  .stx-ly.on .stx-gp { padding: 4px 10px; border: 1px solid var(--u-line); border-radius: var(--u-radius-pill); }
  .stx-ly.on .stx-gpw { flex-basis: 100%; flex-direction: row; flex-wrap: wrap; margin: 2px 0 0; padding-left: 0; border-left: 0; }
  .pgx-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}
