/* page.css — 模型价格页（/usage/pricing/）专属样式，版本 pr4
   只用 usage.css / portal.css 的变量（深浅色自动适配），不写死颜色；无内联样式 / 外部资源，兼容 CSP。
   类名前缀 pr-（price）避免与共享样式冲突。目录：1 筛选条  2 价格表  3 说明  4 怎么用  5 手机 */

/* ============================== 1. 筛选条（复用看板的 .controls / .ctl-row / .field / .seg） ============================== */
.pr-tools .ctl-row { gap: 8px 14px; }
.pr-search { flex: 1 1 260px; min-width: 200px; max-width: 420px; }
.pr-search .input { -webkit-appearance: none; appearance: none; }
.pr-tools select.input { width: auto; min-width: 150px; max-width: 100%; }
.pr-tools .seg button .seg-n { margin-left: 4px; font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.pr-tools .seg button[aria-pressed="true"] .seg-n { color: var(--accent-ink); }
.pr-clear { margin-left: auto; }

/* ============================== 2. 价格表 ============================== */
.pr-card .card-h .count { margin-left: auto; }
.pr-name { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; vertical-align: middle; }
.pr-id { min-width: 0; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--ink); }
.pr-desc { display: block; max-width: 300px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 400; color: var(--muted); }
.pr-name-wrap { display: grid; min-width: 0; }
.pr-copy.btn { flex: none; width: 24px; height: 24px; padding: 0; border-radius: 7px; color: var(--ink-2); opacity: .72; transition: opacity .15s, background .15s, color .15s; }
.pr-copy.btn .ico svg { width: 14px; height: 14px; }
.tbl tbody tr:hover .pr-copy.btn, .pr-copy.btn:hover, .pr-copy.btn:focus-visible { opacity: 1; }
.pr-copy.btn:hover { color: var(--accent-ink); }

/* 价格列：输入 / 输出 / 缓存读 / 缓存写 与看板里 Token 类型色一致（圆点见 .dot.k-*，手机卡片用左侧色条） */
.pr-table th .dot { margin-right: 6px; vertical-align: 0; }
.pr-table td.pr-price { font-variant-numeric: tabular-nums; }
.pr-na { color: var(--muted); cursor: help; }
.pr-bill { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.pr-bill-v { font-variant-numeric: tabular-nums; color: var(--ink); }
.pr-groups, .pr-protos { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 5px; }
.pr-name .badge-outline.badge-orange { color: var(--warn-ink); }
.badge.is-mine { box-shadow: inset 0 0 0 1px var(--accent-line); }
/* 登录后：标题下面的「你可用的分组」一行 */
.pr-mine { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.pr-mine-note { min-width: 0; }
.badge .pr-x { font-weight: 500; opacity: .8; font-variant-numeric: tabular-nums; }

/* 合并表头：「官方价（美元 / 百万 token）」盖住输入 / 输出 / 缓存读 / 缓存写四列 */
.pr-table thead tr.pr-supers th { height: 26px; padding: 0 10px; border-top: 1px solid var(--line); border-bottom: 0; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; text-align: center; color: var(--muted); }
.pr-table thead tr.pr-supers th.pr-sup-g { box-shadow: inset 0 -1px 0 var(--line-strong); }
.pr-table thead tr:not(.pr-supers) th { border-top: 0; }
/* 实际扣费列（元）：倍率相同的分组合并成一行；左边是倍率（有多种倍率时带分组名），右边两行价格 */
.pr-table td.pr-actual { min-width: 250px; }
.pr-act { display: grid; gap: 5px; min-width: 0; }
.pr-act-line { display: flex; align-items: baseline; gap: 4px 10px; min-width: 0; }
.pr-act-g { flex: none; min-width: 34px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--accent-ink); white-space: nowrap; }
.pr-act-v { display: grid; gap: 1px; min-width: 0; line-height: 1.45; }
.pr-act-main { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); white-space: nowrap; }
.pr-act-sub { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }

/* ============================== 3. 说明（价格表下方的紧凑图例） ============================== */
.pr-legend { display: flex; align-items: flex-start; gap: 8px; padding: 10px 16px 11px; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.7; color: var(--muted); }
.pr-legend > .ico { margin-top: 4px; }
.pr-legend-body { min-width: 0; }
.pr-legend ul { display: flex; flex-wrap: wrap; gap: 0 10px; margin: 0; padding: 0; list-style: none; }
.pr-legend li:not(:last-child)::after { content: "·"; margin-left: 10px; opacity: .7; }
.pr-legend a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.pr-legend a:hover { color: var(--accent); }
.pr-legend p { margin: 2px 0 0; }

/* ============================== 4. 怎么用（复用看板「API 地址」卡片 .api-card） ============================== */
.api-desc a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.api-desc a:hover { color: var(--accent); }
.api-card > .pr-howto-foot {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 18px; padding: 8px 16px 10px;
  border-left: 0; border-top: 1px solid var(--line); font-size: 12.5px; line-height: 1.7; color: var(--ink-2);
}
.pr-howto-links { display: inline-flex; flex-wrap: wrap; gap: 2px 16px; }
.pr-howto-foot a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.pr-howto-foot a:hover { color: var(--accent); }
/* 两个地址对齐成表格（浏览器支持 subgrid 时；不支持就保持每行各自排版） */
@media (min-width: 901px) {
  @supports (grid-template-columns: subgrid) {
    .pr-howto .api-list { grid-template-columns: auto minmax(0, max-content) auto minmax(0, 1fr); column-gap: 12px; }
    .pr-howto .api-row { grid-column: 1 / -1; grid-template-columns: subgrid; }
  }
}

/* ============================== 5. 手机（表格 → 卡片：价格四项排成一行，上面是小字标签，左侧色条同 Token 类型色） ============================== */
@media (max-width: 760px) {
  .pr-table.tbl-cards tr { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 6px; }
  .pr-table.tbl-cards td.pr-price {
    flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 1px; padding-left: 8px; border-left: 3px solid var(--line-strong);
    text-align: left; font-size: 13.5px; font-weight: 600;
  }
  .pr-table.tbl-cards td.pr-price::before { font-weight: 400; white-space: nowrap; }
  .pr-table.tbl-cards td.pr-in { border-left-color: var(--tk-in); }
  .pr-table.tbl-cards td.pr-out { border-left-color: var(--tk-out); }
  .pr-table.tbl-cards td.pr-read { border-left-color: var(--tk-read); }
  .pr-table.tbl-cards td.pr-write { border-left-color: var(--tk-write); }
  .pr-table.tbl-cards td.cell-primary .pr-name { flex-wrap: wrap; }
  .pr-table.tbl-cards .pr-id, .pr-table.tbl-cards .pr-desc { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .pr-table.tbl-cards td.cell-wide { align-items: flex-start; }
  .pr-table.tbl-cards td.pr-actual { min-width: 0; }
  .pr-table.tbl-cards .pr-act { justify-items: end; text-align: right; }
  .pr-table.tbl-cards .pr-act-line { flex-direction: column; align-items: flex-end; gap: 1px; }
  .pr-table.tbl-cards .pr-act-v { justify-items: end; }
  .pr-table.tbl-cards .pr-groups, .pr-table.tbl-cards .pr-protos { justify-content: flex-end; }
  .pr-copy.btn { opacity: 1; }
  .pr-legend { padding: 10px 12px 12px; }
  .pr-legend ul { flex-direction: column; gap: 1px; }
  .pr-legend li:not(:last-child)::after { display: none; }
  .api-card > .pr-howto-foot { padding: 8px 11px 10px; }
}
@media (max-width: 560px) {
  .pr-search { flex: 1 1 100%; max-width: none; }
  .pr-tools .field { flex: 1 1 100%; flex-wrap: nowrap; }
  .pr-tools .field > .lbl { flex: none; width: 36px; }
  .pr-tools select.input { flex: 1; width: auto; min-width: 0; }
  .pr-tools .seg { flex: 1; min-width: 0; }
  .pr-tools .seg button { flex: 1; padding: 0 6px; }
  .pr-clear { margin-left: 0; }
}
@media (hover: none) and (pointer: coarse) {
  .pr-copy.btn { width: 32px; height: 32px; opacity: 1; }
}
