/* 知識庫／工具／管理／教學（public/pages.js）專用樣式。
   共用 token 與基礎元件在 ../styles.css（.card／.btn／.chip／.callout／.kv／.tl／.bar／.empty／.note／.hl…），
   這裡只放此區塊獨有的 class（前綴 .pg-）。原則：疊加、不改共用 class。 */

/* ========================================================================
   1. 頁面層級：分頁列（共用 .tabs 已由設計系統設為黏頂）＋目前分頁一句白話說明
   ======================================================================== */
.pg-tabbar { margin: 0 0 16px; }
.pg-tabbar .tabs { margin: 0; }
.pg-tabbar .tabs a.active { font-weight: 700; }
.pg-tabbar .tabs a .count { background: var(--red); color: #fff; }
.pg-tabintro { display: flex; gap: 8px; align-items: flex-start; padding: 12px 2px 0; font-size: 14px; color: var(--text-2); line-height: 1.6; max-width: 80ch; }
.pg-tabintro .icon { width: 16px; height: 16px; color: var(--primary); margin-top: 3px; }
.pg-tabintro b { color: var(--text); font-weight: 700; }
@media (max-width: 899px) {
  .pg-tabbar { margin-bottom: 14px; }
  .pg-tabintro { font-size: 13.5px; padding-top: 10px; }
}

/* ========================================================================
   2. 卡片頭：圖示方磚（共用 .ic-tile）＋標題＋一句白話說明＋狀態 chip
   ======================================================================== */
.pg-card { padding: 20px 22px; }
.pg-card-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; flex-wrap: wrap; }
.pg-card-head > .grow { flex: 1 1 220px; }
.pg-card-head > .ic-tile { margin-top: 1px; }
.pg-card-head h2 { font-size: 17px; line-height: 1.35; }
.pg-card-desc { font-size: 13.5px; color: var(--text-2); margin-top: 4px; line-height: 1.6; max-width: 80ch; }
.pg-card-head .pg-status { margin-left: auto; align-self: center; display: inline-flex; gap: 6px; align-items: center; flex: 0 0 auto; }
.pg-card-head .chip { height: 26px; font-size: 12.5px; padding: 0 10px; }
.pg-card.danger { border-color: color-mix(in srgb, var(--red) 45%, transparent); background: color-mix(in srgb, var(--red-soft) 38%, var(--surface)); }
.pg-danger-note { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--red); font-weight: 600; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--red) 10%, transparent); margin-top: 12px; line-height: 1.6; }
.pg-danger-note .icon { flex: 0 0 auto; margin-top: 2px; }
.pg-details > summary { list-style: none; display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 700; font-size: 15px; }
.pg-details > summary::-webkit-details-marker { display: none; }
.pg-details > summary .icon.chev { transition: transform .15s; color: var(--text-3); margin-left: auto; flex: 0 0 auto; }
.pg-details[open] > summary .icon.chev { transform: rotate(180deg); }
.pg-details > summary .pg-card-desc { font-weight: 400; }
.pg-details .pg-details-body { margin-top: 16px; }

/* 表單分組：小標＋細線 */
.pg-group { margin-top: 18px; }
.pg-group:first-of-type { margin-top: 0; }
.pg-group-title { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--text-3); letter-spacing: .04em; margin-bottom: 12px; }
.pg-group-title::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.pg-admin .field > label { color: var(--text); }
@media (max-width: 640px) { .pg-admin .form-grid, .pg-tool .form-grid { grid-template-columns: 1fr; } }

/* 動作列與儲存列（不黏底：避免蓋住內容與結果區塊） */
.pg-actions { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; margin-top: 16px; }
.pg-actions .pg-hint { font-size: 13.5px; color: var(--text-3); flex: 1 1 220px; min-width: 0; line-height: 1.55; }
.pg-savebar { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border-2); box-shadow: var(--shadow-card); margin-top: 4px; }
.pg-savebar .pg-savehint { font-size: 13.5px; color: var(--text-2); flex: 1; min-width: 0; line-height: 1.5; }
.pg-savebar .pg-savehint b { color: var(--text); }
@media (max-width: 640px) { .pg-savebar { flex-direction: column; align-items: stretch; } .pg-savebar .btn { width: 100%; } }

/* ========================================================================
   3. 結果區塊（測試類按鈕）：走共用 .callout success／danger，這裡只管顯示切換與內部排版
   ======================================================================== */
.pg-result { display: none; flex: 1 1 100%; margin-top: 2px; }
.pg-result.show { display: flex; }
.pg-result > .grow { min-width: 0; }
.pg-result-head { font-size: 14.5px; line-height: 1.5; }
.pg-result-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pg-result-meta .chip .k { color: var(--text-3); font-weight: 500; margin-right: 4px; }
.pg-result-meta .chip.soft { color: var(--text); background: color-mix(in srgb, var(--surface) 72%, transparent); border-color: var(--border); }
.pg-result-body { margin-top: 10px; line-height: 1.6; }
.pg-notes { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.pg-notes li { display: flex; gap: 8px; align-items: flex-start; line-height: 1.55; }
.pg-notes li .icon { flex: 0 0 auto; margin-top: 3px; color: var(--text-2); }
.callout.success .pg-notes li .icon { color: var(--green); }
.callout.danger .pg-notes li .icon { color: var(--red); }
.pg-detail-k { font-size: 12.5px; color: var(--text-3); font-weight: 600; margin-top: 10px; }
.pg-detail { margin: 6px 0 0; padding: 10px 12px; background: color-mix(in srgb, var(--surface) 75%, transparent); border: 1px solid var(--border); border-radius: 10px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto; color: var(--text); }
.pg-result-hint { display: flex; gap: 6px; align-items: flex-start; margin-top: 10px; font-size: 13px; color: var(--text-2); line-height: 1.55; }
.pg-result-hint .icon { flex: 0 0 auto; margin-top: 3px; }
.pg-models { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pg-models .chip { font-family: var(--mono); font-weight: 500; color: var(--text-2); background: color-mix(in srgb, var(--surface) 72%, transparent); border-color: var(--border); }
.pg-spin { animation: pg-spin 1s linear infinite; }
@keyframes pg-spin { to { transform: rotate(360deg); } }

/* 中轉相容性卡 */
.pg-quirks { display: grid; gap: 8px; }
.pg-quirk { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.pg-quirk .icon { color: var(--amber); margin-top: 2px; flex: 0 0 auto; }
.pg-quirk b { display: block; font-size: 14.5px; line-height: 1.45; }
.pg-quirk span { font-size: 13px; color: var(--text-2); line-height: 1.55; }
.pg-quirk-empty { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 10px; border: 1px dashed var(--border-2); color: var(--text-2); font-size: 13.5px; line-height: 1.6; }
.pg-quirk-empty .icon { color: var(--green); flex: 0 0 auto; }

/* ========================================================================
   4. KPI 磁貼：沿用共用 .kpi；只補小字數值（日期）
   ======================================================================== */
.pg-admin .kpi .v.pg-v-sm { font-size: 15px; line-height: 1.3; font-weight: 700; padding-right: 40px; }

/* ========================================================================
   5. 用量：純 CSS 30 天長條圖（時間序列）＋依模型佔比（共用 .bar）＋錯誤列表
   ======================================================================== */
.pg-chart { margin-top: 4px; }
.pg-chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.pg-chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.pg-chart-legend i.ok { background: var(--primary); } .pg-chart-legend i.err { background: var(--red); }
.pg-chart-legend .max { margin-left: auto; color: var(--text-3); font-variant-numeric: tabular-nums; }
.pg-bars { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 3px; align-items: end; height: 150px; border-bottom: 1px solid var(--border-2); position: relative; margin-top: 26px; }
.pg-bars::before { content: ''; position: absolute; left: 0; right: 0; top: 0; border-top: 1px dashed var(--border); }
.pg-bar { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; border-radius: 4px 4px 0 0; }
.pg-bar:hover { background: color-mix(in srgb, var(--surface-3) 60%, transparent); }
.pg-bar .ok-part, .pg-bar .err-part { width: 100%; flex: 0 0 auto; }
.pg-bar .ok-part { height: var(--ok); background: var(--primary); border-radius: 4px 4px 0 0; }
.pg-bar .err-part { height: var(--err); background: var(--red); border-radius: 4px 4px 0 0; margin-bottom: 2px; }
.pg-bar.has-err .ok-part { border-radius: 0; }
.pg-bar.empty .ok-part { height: 2px; background: var(--border-2); border-radius: 0; }
.pg-bar .lbl { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--ok) + var(--err) + 4px); font-size: 12.5px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none; }
.pg-bar.has-err .lbl { bottom: calc(var(--ok) + var(--err) + 6px); }
.pg-bar .pg-tip { display: none; position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); font-size: 12.5px; font-weight: 600; padding: 6px 10px; border-radius: 8px; white-space: nowrap; z-index: 3; box-shadow: var(--shadow); font-variant-numeric: tabular-nums; pointer-events: none; }
[data-theme='dark'] .pg-bar .pg-tip { background: var(--paper); color: var(--ink); }
.pg-bar:hover .pg-tip { display: block; }
.pg-bar:nth-child(-n+5) .pg-tip { left: 0; transform: none; }
.pg-bar:nth-last-child(-n+5) .pg-tip { left: auto; right: 0; transform: none; }
.pg-axis { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); margin-top: 6px; font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.pg-axis span { grid-row: 1; white-space: nowrap; }
.pg-axis span.r { text-align: right; }
.pg-chart-empty { text-align: center; color: var(--text-3); font-size: 13.5px; padding: 24px 0; }
.pg-chart details { margin-top: 12px; }
.pg-chart details > summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--text-2); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.pg-chart details > summary::-webkit-details-marker { display: none; }
.pg-chart details[open] > summary .icon { transform: rotate(180deg); }
.pg-chart details .tablewrap { margin-top: 8px; }
@media (max-width: 640px) { .pg-bars { height: 120px; gap: 2px; } .pg-bar .lbl { display: none; } }
.pg-share { min-width: 150px; }
.pg-share .bar { display: inline-block; width: 100px; vertical-align: middle; margin-right: 8px; }
.pg-share .pct { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* 錯誤列表：標籤淡（共用 .kv）、訊息粗且完整換行 */
.pg-errlist { display: grid; gap: 10px; }
.pg-err { border: 1px solid color-mix(in srgb, var(--red) 30%, transparent); background: color-mix(in srgb, var(--red-soft) 55%, var(--surface)); border-radius: 10px; padding: 12px 14px; }
.pg-err-kv { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-bottom: 8px; }
.pg-err-kv > div { display: flex; gap: 6px; align-items: baseline; }
.pg-err-kv dd { font-size: 13px; }
.pg-err-kv dd.mono { font-size: 12.5px; }
.pg-err-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 8px; font-size: 13px; color: var(--text-3); }
.pg-err-msg { font-size: 14px; font-weight: 600; color: var(--text); white-space: pre-wrap; word-break: break-word; line-height: 1.6; }
.pg-err-path { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); word-break: break-all; }

/* ========================================================================
   6. 表格式清單（成員）：桌機表格、手機卡片
   ======================================================================== */
.pg-tlist { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.pg-tlist-head, .pg-tlist .list-item { display: grid; grid-template-columns: minmax(0, 2.2fr) 104px 118px minmax(0, 1.6fr) 84px; gap: 12px; align-items: center; padding: 10px 14px; }
.pg-tlist-head { background: var(--surface-2); font-size: 12.5px; font-weight: 700; color: var(--text-2); border-bottom: 1px solid var(--border); }
.pg-tlist .list-item { padding: 12px 14px; }
.pg-tlist .list-item:hover { background: var(--surface-2); }
.pg-tlist .list-item.off { opacity: .62; }
.pg-tlist .list-item.off:hover { opacity: .9; }
.pg-cell { min-width: 0; font-size: 13.5px; line-height: 1.5; }
.pg-cell::before { content: attr(data-l); display: none; font-size: 12.5px; color: var(--text-3); margin-right: 6px; }
.pg-cell.who { display: flex; align-items: center; gap: 10px; }
.pg-cell.who .nm { font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-cell.who .un { font-size: 12.5px; color: var(--text-3); font-family: var(--mono); }
.pg-cell.act { display: flex; justify-content: flex-end; }
.pg-cell .chip + .chip { margin-left: 4px; }
.pg-cell.stats { color: var(--text-2); font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .pg-tlist-head { display: none; }
  .pg-tlist .list-item { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; }
  .pg-cell.who { grid-column: 1; }
  .pg-cell.act { grid-column: 2; grid-row: 1 / span 3; align-self: start; }
  .pg-cell.role, .pg-cell.status, .pg-cell.stats { grid-column: 1; }
  .pg-cell::before { display: inline; }
  .pg-cell.who::before { display: none; }
}
.pg-roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.pg-role { padding: 12px 14px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; color: var(--text-2); line-height: 1.6; }
.pg-role .chip { margin-bottom: 6px; }

/* ========================================================================
   7. 中繼與診斷：代理事實格、來源列表
   ======================================================================== */
.pg-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.pg-fact { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.pg-fact .k { font-size: 12.5px; color: var(--text-3); }
.pg-fact .v { font-size: 15px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; word-break: break-word; line-height: 1.35; }
.pg-fact .v.sm { font-size: 13.5px; font-weight: 600; }
.pg-srcsum { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 10px; font-size: 13px; color: var(--text-3); }
.pg-srcs { display: grid; gap: 6px; }
.pg-src { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.pg-src .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); }
.pg-src.bad { border-color: color-mix(in srgb, var(--red) 35%, transparent); background: color-mix(in srgb, var(--red-soft) 45%, var(--surface)); }
.pg-src.bad .dot { background: var(--red); }
.pg-src .nm { font-weight: 600; font-size: 14px; }
.pg-src .url { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); }
.pg-src .st { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pg-src .st .note { max-width: 180px; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
@media (max-width: 640px) { .pg-src { grid-template-columns: 10px minmax(0, 1fr); } .pg-src .st { grid-column: 2; justify-content: flex-start; flex-wrap: wrap; white-space: normal; } .pg-src .st .note { max-width: none; } }
.pg-code { margin: 10px 0 0; padding: 12px 14px; background: var(--ink); color: var(--paper); border-radius: 10px; font-family: var(--mono); font-size: 12.5px; line-height: 1.7; overflow: auto; white-space: pre; }
[data-theme='dark'] .pg-code { background: #0d0c0a; }
.pg-code .c { color: #9a9384; }

/* ========================================================================
   8. 動態：共用 .tl 時間軸，這裡只補列內排版與 detail 標籤
   ======================================================================== */
.pg-tl-row { display: flex; gap: 12px; align-items: flex-start; }
.pg-tl-row .bold { font-size: 14.5px; line-height: 1.5; }
.pg-tl-row .when { margin-top: 2px; }
.pg-tl-detail { font-size: 12.5px; color: var(--text-3); margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.pg-tl-detail code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; color: var(--text-2); }

/* ========================================================================
   9. 知識庫
   ======================================================================== */
.pg-kb-search { display: flex; gap: 10px; align-items: stretch; }
.pg-kb-search .search { flex: 1; min-width: 0; }
.pg-kb-search .search .icon { left: 14px; width: 20px; height: 20px; }
.pg-kb-search .input { height: 48px; font-size: 15.5px; border-radius: 12px; padding-left: 42px; box-shadow: var(--shadow-sm); }
.pg-kb-search .select { height: 48px; border-radius: 12px; }
.pg-examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center; font-size: 13px; color: var(--text-3); }
.pg-examples .chip { cursor: pointer; background: var(--surface); border-color: var(--border); color: var(--text-2); height: 26px; font-weight: 600; }
.pg-examples .chip:hover { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.pg-kb-sum { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 13.5px; color: var(--text-2); margin: 16px 0 12px; }
.pg-kb-sum b { color: var(--text); font-size: 15px; }
/* 命中卡三層：來源 chip 列 → 標題 → 片段 */
.pg-kb .kb-hit { padding: 16px 0; }
.pg-hit-src { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pg-hit-src .sp { flex: 1; }
.pg-hit-src a { display: inline-flex; align-items: center; gap: 4px; }
.pg-kb .kb-hit .t { font-size: 15.5px; line-height: 1.45; margin-top: 8px; }
.pg-kb .kb-hit .b { font-size: 14px; line-height: 1.7; margin-top: 8px; color: var(--text-2); }
.pg-kb .kb-hit .b:not(.open)::after { background: linear-gradient(transparent, var(--surface)); }
.pg-kb .kb-hit .pg-hit-actions { display: flex; gap: 6px; margin-top: 10px; align-items: center; }
.pg-kb .kb-hit .pg-hit-actions .spacer { flex: 1; }
.pg-src-chip { font-weight: 700; }
.pg-src-chip.playbook { background: var(--teal-soft); color: var(--teal); }
.pg-src-chip.case-card { background: var(--copper-soft); color: var(--copper); }
.pg-src-chip.verified-facts { background: var(--green-soft); color: var(--green); }
.pg-src-chip.document-sources { background: var(--blue-soft); color: var(--blue); }
.pg-src-chip.pricing-log { background: var(--amber-soft); color: var(--amber); }
.pg-src-chip.case-note { background: var(--purple-soft); color: var(--purple); }
.pg-src-chip.custom { background: var(--gray-soft); color: var(--gray); }
[data-theme='dark'] .pg-src-chip.case-card { color: var(--primary); }
.pg-caselink { display: flex; align-items: center; gap: 10px; }
.pg-caselink .ic { width: 34px; height: 34px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex: 0 0 auto; }
.pg-pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 14px; font-size: 13.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pg-toolbar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.pg-toolbar .search { flex: 1 1 240px; min-width: 0; }
.pg-toolbar .select { width: auto; }
.pg-toolbar .note { flex: 1 1 320px; }
.pg-lead { font-size: 13.5px; color: var(--text-2); line-height: 1.6; }
.pg-lead b { color: var(--text); }

/* 案例卡 */
.pg-cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.pg-ccard { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px 16px 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); cursor: pointer; text-decoration: none; color: inherit; position: relative; overflow: hidden; transition: transform .15s, box-shadow .15s, border-color .15s; box-shadow: var(--shadow-card); }
.pg-ccard::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--primary); }
.pg-ccard.green::before { background: var(--green); } .pg-ccard.red::before { background: var(--red); } .pg-ccard.gray::before { background: var(--gray); } .pg-ccard.amber::before { background: var(--amber); } .pg-ccard.teal::before { background: var(--teal); }
.pg-ccard:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-2); text-decoration: none; }
.pg-ccard .top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pg-ccard .top .sp { flex: 1; }
.pg-ccard .top .topic { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pg-ccard .ttl { font-weight: 700; font-size: 15.5px; line-height: 1.45; }
.pg-ccard .sum { font-size: 13.5px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.65; }
.pg-ccard .kv { display: flex; gap: 8px; align-items: baseline; font-size: 13px; line-height: 1.5; margin: 0; }
.pg-ccard .kv .k { color: var(--text-3); flex: 0 0 auto; font-size: 12.5px; }
.pg-ccard .kv .v { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pg-ccard .foot { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--text-3); margin-top: auto; padding-top: 8px; border-top: 1px dashed var(--border); flex-wrap: wrap; }
.pg-ccard .n { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.pg-ccard .n small { font-size: 12.5px; font-weight: 500; color: var(--text-3); margin-left: 3px; }

/* 閱讀版面：側邊目錄（桌機）／頂部錨點（手機、彈窗）；內文走共用 .md（行高 1.75、段距、銅色短線標題、斑馬紋表格、strong／.hl 劃重點） */
.pg-reader { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.pg-toc { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.pg-toc .h { font-size: 12.5px; font-weight: 700; color: var(--text-3); letter-spacing: .04em; margin-bottom: 4px; padding-left: 10px; }
.pg-toc a { padding: 6px 10px; border-left: 2px solid var(--border); color: var(--text-2); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; line-height: 1.45; cursor: pointer; }
.pg-toc a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.pg-toc a.on { border-left-color: var(--primary); color: var(--primary); font-weight: 700; }
.pg-toc a.lvl3 { padding-left: 22px; font-size: 12.5px; }
.pg-reader .pg-body { min-width: 0; }
@media (min-width: 1000px) {
  .pg-reader.with-toc { grid-template-columns: 220px minmax(0, 1fr); }
  .pg-reader.with-toc .pg-toc { position: sticky; top: calc(var(--topbar-h) + var(--tabs-h, 46px) + 16px); max-height: calc(100dvh - var(--topbar-h) - var(--tabs-h, 46px) - 32px); overflow: auto; }
  .pg-reader.in-modal.with-toc .pg-toc { top: 0; max-height: none; }
}
@media (max-width: 999px) {
  .pg-toc { flex-direction: row; overflow-x: auto; gap: 6px; scrollbar-width: none; padding-bottom: 4px; position: sticky; top: calc(var(--topbar-h) + var(--tabs-h, 46px)); z-index: 4; background: var(--bg); padding-top: 4px; }
  .pg-reader.in-modal .pg-toc { top: -16px; background: var(--surface); }
  .pg-toc::-webkit-scrollbar { display: none; }
  .pg-toc .h { display: none; }
  .pg-toc a { border-left: 0; border: 1px solid var(--border); border-radius: 999px; padding: 5px 11px; flex: 0 0 auto; background: var(--surface); font-size: 12.5px; }
  .pg-toc a.on { background: var(--primary-soft); border-color: var(--primary); }
  .pg-toc a.lvl3 { display: none; }
}
.pg-reader .md h2:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.pg-reader .md p, .pg-reader .md li { line-height: 1.75; }
.pg-reader.in-modal .md h2 { scroll-margin-top: 16px; }
.pg-readhead { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 13.5px; color: var(--text-2); margin-bottom: 14px; line-height: 1.5; }
.pg-readhead .chip { font-weight: 700; }
/* 規則文件預覽：提示詞原文走等寬字型、行距 1.7；標題維持介面字型 */
.pg-rule-view.md { font-family: var(--mono); font-size: 13.5px; line-height: 1.7; }
.pg-rule-view.md h1, .pg-rule-view.md h2, .pg-rule-view.md h3, .pg-rule-view.md h4 { font-family: var(--font); }
.pg-rule-view.md p { margin: 12px 0; }
.pg-rule-view.md li { margin: 6px 0; }
.pg-topic-list { display: grid; gap: 10px; }
.pg-topic-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); text-decoration: none; color: inherit; align-items: center; }
.pg-topic-row:hover { background: var(--surface-2); text-decoration: none; }
.pg-topic-row .ttl { font-weight: 700; font-size: 14.5px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pg-topic-row .sum { font-size: 13.5px; color: var(--text-2); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 報價紀錄表：欄位多，寬度不夠時整張橫向捲動（不讓儲存格逐字換行） */
.pg-pricing .table { min-width: 1180px; }
.pg-pricing .table th { position: sticky; top: 0; z-index: 1; }
.pg-pricing .table td { font-size: 13.5px; }
.pg-pricing .table .num { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.pg-pricing .table .cond { min-width: 220px; max-width: 320px; color: var(--text-2); }
.pg-pricing .table .outs { min-width: 170px; color: var(--text-2); }
.pg-pricing .tablewrap { max-height: 70vh; overflow: auto; }

/* 知識提案審核列 */
.pg-prop .pg-prop-body { margin-top: 10px; font-size: 14px; color: var(--text-2); white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border-radius: 10px; padding: 12px 14px; max-height: 280px; overflow: auto; line-height: 1.7; }
.pg-prop .pg-prop-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.pg-prop .pg-prop-actions .sp { flex: 1; }
.pg-prop .pg-prop-actions .btn.ghost.danger { border-color: transparent; }
.pg-prop .pg-prop-actions .btn.ghost.danger:hover { background: var(--red-soft); }

/* 匯入 */
.pg-drop { border: 2px dashed var(--border-2); border-radius: 16px; padding: 24px 18px 20px; text-align: center; background: var(--surface-2); transition: border-color .15s, background .15s; }
.pg-drop.over { border-color: var(--primary); background: var(--primary-soft); }
.pg-drop > .icon { width: 32px; height: 32px; color: var(--primary); }
.pg-drop .t { font-weight: 700; margin-top: 6px; font-size: 15px; }
.pg-drop .d { font-size: 13.5px; color: var(--text-2); margin-top: 4px; line-height: 1.6; max-width: 60ch; margin-left: auto; margin-right: auto; }
.pg-drop .ctl { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; margin-top: 14px; }
.pg-drop .ctl .select { width: auto; min-width: 170px; }
.pg-filetypes { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.pg-filetypes span { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 12.5px; font-family: var(--mono); color: var(--text-2); }
.pg-filetypes span i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.pg-implog { display: grid; gap: 6px; margin-top: 12px; }
.pg-implog:empty { display: none; }
.pg-implog > div { padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; border-left: 3px solid var(--border-2); line-height: 1.55; word-break: break-word; }
.pg-implog > .ok { border-left-color: var(--green); }
.pg-implog > .err { border-left-color: var(--red); color: var(--red); }
.pg-steps-inline { display: grid; gap: 8px; margin-top: 12px; font-size: 14px; color: var(--text-2); padding-left: 0; counter-reset: s; }
.pg-steps-inline li { display: flex; gap: 10px; align-items: flex-start; counter-increment: s; line-height: 1.6; }
.pg-steps-inline li > span { flex: 1; min-width: 0; }
.pg-steps-inline li::before { content: counter(s); width: 22px; height: 22px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); font-size: 12.5px; font-weight: 700; display: grid; place-items: center; flex: 0 0 auto; margin-top: 1px; }

/* ========================================================================
   10. 工具
   ======================================================================== */
.pg-tool .pg-card-head { margin-bottom: 14px; }
.pg-tool .pg-example { font-size: 13px; color: var(--text-3); }
.pg-tool .pg-example code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.pg-tool .pg-inline { display: flex; gap: 8px; align-items: center; }
.pg-tool .pg-inline .input { flex: 1; min-width: 0; }
.pg-tool .pg-inline .btn { flex: 0 0 auto; }
@media (max-width: 640px) { .pg-tool .pg-inline { flex-wrap: wrap; } .pg-tool .pg-inline .input { flex: 1 1 100%; } .pg-tool .pg-inline .btn { flex: 1; } .pg-tool .pg-inline .input[style] { width: 100% !important; } }
.pg-toolres .pg-toolres-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pg-toolres .pg-toolres-head h3 { font-size: 15px; display: flex; gap: 8px; align-items: center; }
.pg-toolres .pg-toolres-head .meta { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.pg-toolres .pg-toolres-head .sp { flex: 1; }
.pg-toolres .result-box { max-height: 56vh; font-size: 13.5px; line-height: 1.65; }
.pg-verdict { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 12px; font-weight: 800; font-size: 18px; line-height: 1.3; }
.pg-verdict .icon { width: 22px; height: 22px; flex: 0 0 auto; }
.pg-verdict.warn { background: var(--amber-soft); color: var(--amber); }
.pg-verdict.ok { background: var(--green-soft); color: var(--green); }
.pg-toolres .pg-law-row { display: flex; gap: 10px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.pg-toolres .pg-law-row:first-child { border-top: 0; }
.pg-toolres .pg-law-row .nm { font-weight: 700; font-size: 14.5px; line-height: 1.45; }
.pg-toolres .pg-law-row .mt-x { font-size: 12.5px; color: var(--text-3); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pg-toolres .pg-law-row .mt-x code { background: var(--surface-2); padding: 0 5px; border-radius: 4px; }
.pg-toolres .pg-web-row { padding: 12px 0; border-top: 1px solid var(--border); }
.pg-toolres .pg-web-row:first-child { border-top: 0; }
.pg-toolres .pg-web-row .url { font-size: 12.5px; color: var(--text-3); word-break: break-all; margin: 2px 0 6px; }
.pg-toolres .pg-web-row .sn { font-size: 14px; color: var(--text-2); line-height: 1.65; }
.pg-toolres .pg-company { padding: 12px 0; border-top: 1px solid var(--border); }
.pg-toolres .pg-company:first-child { border-top: 0; }
.pg-toolres .pg-company .nm { font-weight: 700; font-size: 15.5px; margin-bottom: 8px; }

/* ========================================================================
   11. 教學頁
   ======================================================================== */
.pg-hero { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.pg-hero img { width: 46px; height: 46px; }
.pg-hero .tx { flex: 1 1 200px; min-width: 0; }
.pg-hero h1 { font-size: 22px; letter-spacing: -0.01em; }
.pg-hero p { font-size: 13.5px; color: var(--text-2); margin-top: 2px; line-height: 1.5; }
.pg-video { position: relative; border-radius: 12px; overflow: hidden; background: #000; box-shadow: var(--shadow); }
.pg-video video { display: block; width: 100%; max-height: 68vh; background: #000; }
.pg-video .dur { position: absolute; right: 10px; top: 10px; background: rgba(0, 0, 0, .62); color: #fff; font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; font-variant-numeric: tabular-nums; pointer-events: none; display: none; backdrop-filter: blur(4px); }
.pg-video .dur.show { display: inline-block; }
.pg-chapters-head { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 13.5px; color: var(--text-2); }
.pg-chapters-head b { color: var(--text); }
.pg-chapters { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 2px 16px; margin-top: 8px; padding: 0; list-style: none; counter-reset: ch; }
.pg-chapters li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; counter-increment: ch; font-size: 13.5px; line-height: 1.5; }
.pg-chapters li::before { content: counter(ch); width: 22px; height: 22px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); font-size: 12.5px; font-weight: 700; display: grid; place-items: center; flex: 0 0 auto; margin-top: 1px; }
.pg-chapters li:hover { background: var(--surface-2); }
.pg-chapters li.on { background: var(--primary-soft); }
.pg-chapters li.on::before { background: var(--primary); color: var(--on-primary); }
.pg-chapters li a { color: var(--text); flex: 1; min-width: 0; text-decoration: none; }
.pg-chapters li a:hover { text-decoration: underline; }
.pg-chapters .tm { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; flex: 0 0 auto; padding-top: 1px; }
.pg-chapters li.muted-row { color: var(--text-3); }
.pg-chapters li.muted-row::before { display: none; }
/* 九步：每步一張卡 */
.pg-steps { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; padding: 0; list-style: none; counter-reset: st; }
.pg-step { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 14px; padding: 16px 18px; counter-increment: st; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.pg-step::before { content: counter(st); width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-weight: 800; display: grid; place-items: center; font-size: 15px; font-variant-numeric: tabular-nums; }
.pg-step b { font-size: 15.5px; display: block; line-height: 1.4; }
.pg-step p { font-size: 14px; color: var(--text-2); margin-top: 6px; line-height: 1.65; }
.pg-faq details { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin-bottom: 8px; overflow: hidden; }
.pg-faq summary { list-style: none; padding: 13px 14px; font-weight: 700; font-size: 14.5px; display: flex; gap: 10px; align-items: center; cursor: pointer; line-height: 1.45; }
.pg-faq summary::-webkit-details-marker { display: none; }
.pg-faq summary::before { content: 'Q'; width: 24px; height: 24px; border-radius: 7px; background: var(--primary-soft); color: var(--primary); font-size: 12.5px; font-weight: 800; display: grid; place-items: center; flex: 0 0 auto; }
.pg-faq summary .q { flex: 1; }
.pg-faq summary .icon { color: var(--text-3); transition: transform .15s; flex: 0 0 auto; }
.pg-faq details[open] summary .icon { transform: rotate(180deg); }
.pg-faq details[open] summary { border-bottom: 1px solid var(--border); background: var(--surface-2); }
.pg-faq .body { padding: 14px 14px 16px 48px; font-size: 14px; color: var(--text-2); line-height: 1.65; }
@media (max-width: 640px) { .pg-faq .body { padding-left: 14px; } }
.pg-foot { font-size: 12.5px; color: var(--text-3); text-align: center; margin-top: 16px; }

/* ========================================================================
   12. 動效降級
   ======================================================================== */
@media (prefers-reduced-motion: reduce) {
  .pg-ccard, .pg-faq summary .icon, .pg-drop, .pg-details > summary .icon.chev, .pg-chart details > summary .icon { transition: none; }
  .pg-ccard:hover { transform: none; }
  .pg-spin { animation: none; }
}
