/* API Key 页增强（20261122）：本月节省卡片、本月用量列、“管理”菜单、表头字号统一、接口地址两行。配合 user-keys-pro-20261122.js。 */

/* ---------- 本月节省 ---------- */
.app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .kp-save{order:0;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px 32px;align-items:center;margin:0 0 16px;padding:20px 24px;border:1px solid #d9e2ff;border-radius:14px;background:linear-gradient(135deg,#f3f6ff 0%,#fbfcff 60%)}
.app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .kp-save-main{display:grid;gap:4px;min-width:0}
.app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .kp-save-label{font-size:13px;font-weight:600;color:#3e5bf2}
.app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .kp-save-value{font-size:30px;line-height:1.15;font-weight:700;color:#101b33;letter-spacing:-.5px;font-variant-numeric:tabular-nums}
.app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .kp-save-sub{font-size:13px;color:#64718a;font-variant-numeric:tabular-nums}
.app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .kp-save-parts{display:flex;gap:28px;margin:0}
.app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .kp-save-parts div{display:grid;gap:2px}
.app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .kp-save-parts dt{font-size:12.5px;color:#64718a}
.app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .kp-save-parts dd{margin:0;font-size:18px;font-weight:650;color:#1f2a44;font-variant-numeric:tabular-nums}
.app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .kp-save-note{grid-column:1/-1;margin:6px 0 0;font-size:12px;color:#8592a6}
.app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .kp-save-link{margin-left:8px;color:#3e5bf2;font-weight:600;text-decoration:none}
.app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .kp-save-link:hover{text-decoration:underline}
@media (max-width:640px){
  .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .kp-save{grid-template-columns:minmax(0,1fr);padding:16px}
  .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .kp-save-value{font-size:26px}
}

/* ---------- 表格：名称 | Key | 本月用量 | 额度 | 操作 ---------- */
@media (min-width:641px){
  .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-card{grid-template-columns:minmax(114px,.85fr) minmax(160px,1fr) minmax(208px,1.25fr) minmax(146px,.88fr) auto}
  .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-identity>div{grid-column:1}
  .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-identity code{grid-column:2}
  .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .kp-usage{grid-column:3}
  .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-card>strong,.app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-card:has(.key-daily)>strong{grid-column:4}
  .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-daily{grid-column:4}
  .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-card .row-actions{grid-column:5;grid-row:1/span 2;position:relative}
  .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-card:has(.key-daily) .kp-usage{grid-row:1/span 2;align-self:center}
}
.app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .kp-usage{display:grid;grid-template-columns:minmax(0,1fr);min-width:0;font-variant-numeric:tabular-nums}
.app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .kp-usage b{font-size:14px;font-weight:600;color:#1f2a44;line-height:1.45;overflow-wrap:anywhere}
.app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .kp-usage small{font-size:12px;color:#657086;line-height:1.45;overflow-wrap:anywhere}
.app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .kp-metric{min-width:0;margin:0}
.app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .key-card>strong{font-size:13px;color:#64718a}

#app .app-shell:not(.admin-shell) .keys-page .key-identity code {
  display: block;
  box-sizing: border-box;
  width: 78px;
  max-width: 100%;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#app .app-shell:not(.admin-shell) .keys-page .key-identity code::after {
  content: none;
}

/* API Key 列表的列标题；移动端卡片复用同一组指标标签。 */
.keys-page {
  --kp-name-width: 124px;
  --kp-heading-color:#283447;
  --kp-heading-font:"PingFang SC",-apple-system,BlinkMacSystemFont,"Microsoft YaHei",sans-serif;
}
html[data-console-theme="dark"] .keys-page {--kp-heading-color:#dce3ee}
#app .app-shell:not(.admin-shell) .keys-page .key-card:first-child .key-identity>div::before,
#app .app-shell:not(.admin-shell) .keys-page .key-card:first-child .key-identity code::before,
#app .app-shell:not(.admin-shell) .keys-page .key-card:first-child>strong::before,
#app .app-shell:not(.admin-shell) .keys-page .key-card:first-child .row-actions::before,
#app .app-shell:not(.admin-shell) .keys-page .key-card .kp-metric dt {
  font-family:var(--kp-heading-font)!important;
  color:var(--kp-heading-color)!important;
  font-size:12px!important;font-weight:600!important;line-height:18px!important;letter-spacing:.02em!important;
}
.keys-page .kp-metric dd{display:grid;gap:3px;margin:0}
.keys-page .kp-metric dt{margin:0;font-size:12px;font-weight:600;color:var(--cu-muted,#657086)}
@media(min-width:641px) {
  .keys-page .kp-metric dt{position:absolute;width:1px;height:1px;clip-path:inset(50%);overflow:hidden}
  .keys-page .key-card:first-child .kp-metric dt{top:-29px;width:auto;height:auto;clip-path:none;white-space:nowrap}
}
@media(max-width:640px) {
  .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .kp-usage{grid-column:1/-1;width:100%;padding-block:4px}
  .keys-page .kp-metric dt{margin-bottom:4px}
}

.app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-card:first-child>strong::before{content:"设置额度"}
.app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-card:first-child .row-actions::before{content:"";margin:0}
@media (min-width:641px) and (max-width:1180px){
  .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-card{grid-template-columns:minmax(75px,.75fr) minmax(116px,.95fr) minmax(156px,1.2fr) auto}
  .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-card>strong,.app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-card:has(.key-daily)>strong,.app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-daily{display:none}
  .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-card .row-actions{grid-column:4}
}
@media (max-width:640px){
  /* 手机：沿用原来的单列卡片，顺序为 名称 → Key → 本月用量 → 管理按钮 */
  #app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-card .row-actions{grid-column:1/-1!important;grid-row:auto!important;order:9!important;justify-content:flex-start!important;margin:4px 0 0!important}
}

/* ---------- “管理”菜单 ---------- */
#app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .row-actions .kp-hidden{display:none!important}
#app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .row-actions .kp-more{display:inline-flex!important;align-items:center!important;gap:6px!important;min-height:32px!important;padding:0 12px!important;border:1px solid #dfe5ef!important;border-radius:8px!important;background:#fff!important;color:#2d3a56!important;font-size:13px!important;font-weight:500!important;cursor:pointer!important}
#app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .row-actions .kp-more i{font-style:normal!important;font-size:10px!important;color:#8592a6!important}
#app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .row-actions .kp-more:hover,#app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .row-actions .kp-more[aria-expanded="true"]{border-color:#b9c6ff!important;background:#f5f7ff!important;color:#1f2a44!important}
#app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .row-actions .kp-menu{display:block;position:fixed;z-index:1000;min-width:148px;padding:6px;border:1px solid #e3e8f1;border-radius:10px;background:#fff;box-shadow:0 10px 30px rgba(24,39,68,.14),0 2px 6px rgba(24,39,68,.06)}
#app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .row-actions .kp-menu[hidden]{display:none!important}
#app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .row-actions .kp-menu .kp-item{display:block!important;width:100%!important;min-height:34px!important;padding:0 12px!important;border:0!important;border-radius:7px!important;background:none!important;color:#2d3a56!important;font-size:13px!important;text-align:left!important;cursor:pointer!important}
#app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .row-actions .kp-menu .kp-item:hover,#app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .row-actions .kp-menu .kp-item:focus-visible{background:#f2f5fb!important;outline:none!important}
#app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .row-actions .kp-menu .kp-danger{color:#c2463b!important}
#app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .row-actions .kp-menu .kp-danger:hover{background:#fdf0ee!important}
.app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .row-actions .kp-menu hr{margin:6px 4px;border:0;border-top:1px solid #edf0f6}

/* ---------- 接入配置：两个地址 ---------- */
.app-shell.app-shell.app-shell:not(.admin-shell) .kc dl>div.kp-addr{grid-column:1/-1;margin-bottom:4px;justify-content:start}
.app-shell.app-shell.app-shell:not(.admin-shell) .kc .kp-addr dd{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.app-shell.app-shell.app-shell:not(.admin-shell) .kc .kp-addr small{font-size:12.5px;color:#64718a}

/* ---------- 深色模式 ---------- */
html[data-console-theme="dark"]:is([data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme]) .app-shell:not(.admin-shell) .keys-page .kp-save{background:linear-gradient(135deg,#1a2338 0%,#161b22 70%);border-color:#2d3a5c}
html[data-console-theme="dark"]:is([data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme]) .app-shell:not(.admin-shell) .keys-page .kp-save-label,html[data-console-theme="dark"]:is([data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme]) .app-shell:not(.admin-shell) .keys-page .kp-save-link{color:#8fa4ff}
html[data-console-theme="dark"]:is([data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme]) .app-shell:not(.admin-shell) .keys-page .kp-save-value,html[data-console-theme="dark"]:is([data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme]) .app-shell:not(.admin-shell) .keys-page .kp-save-parts dd,html[data-console-theme="dark"]:is([data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme]) .app-shell:not(.admin-shell) .keys-page .kp-usage b{color:#e6ebf3}
html[data-console-theme="dark"]:is([data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme]) .app-shell:not(.admin-shell) .keys-page .kp-save-sub,html[data-console-theme="dark"]:is([data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme]) .app-shell:not(.admin-shell) .keys-page .kp-save-parts dt,html[data-console-theme="dark"]:is([data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme]) .app-shell:not(.admin-shell) .keys-page .kp-usage small{color:#9aa6b8}
html[data-console-theme="dark"]:is([data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme]) #app .app-shell:not(.admin-shell) .keys-page .row-actions .kp-more{background:#1b2230!important;border-color:#334053!important;color:#d5dce8!important}
html[data-console-theme="dark"]:is([data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme]) .app-shell:not(.admin-shell) .keys-page .row-actions .kp-menu{background:#1b2230;border-color:#334053;box-shadow:0 10px 30px rgba(0,0,0,.45)}
html[data-console-theme="dark"]:is([data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme]) #app .app-shell:not(.admin-shell) .keys-page .row-actions .kp-menu .kp-item{color:#d5dce8!important}
html[data-console-theme="dark"]:is([data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme]) #app .app-shell:not(.admin-shell) .keys-page .row-actions .kp-menu .kp-item:hover{background:#243044!important}
html[data-console-theme="dark"]:is([data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme]) #app .app-shell:not(.admin-shell) .keys-page .row-actions .kp-menu .kp-danger{color:#f0a8a8!important}
html[data-console-theme="dark"]:is([data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme][data-console-theme]) .app-shell:not(.admin-shell) .keys-page .row-actions .kp-menu hr{border-top-color:#2b3648}
@media (min-width:641px) and (max-width:1180px) {
  #app .app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-list .key-card {
    grid-template-columns:minmax(58px,.74fr) minmax(95px,.92fr) minmax(144px,1.25fr) auto!important;
    column-gap:10px;
  }
  #app .app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-list .key-card .row-actions {
    grid-column:6!important;grid-row:1!important;margin-left:0;
  }
}

/* Keep the table columns aligned; give the remaining space to real action buttons. */
@media (min-width:1181px) {
  #app .app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-list .key-card {
    grid-template-columns:var(--kp-name-width) 82px minmax(94px,.8fr) minmax(110px,.9fr) minmax(96px,.75fr) minmax(76px,.75fr) minmax(100px,1.8fr)!important;
    column-gap:14px;
  }
}
@media (min-width:641px) and (max-width:1180px) {
  #app .app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-list .key-card {
    grid-template-columns:var(--kp-name-width) 78px minmax(78px,1fr) minmax(85px,1fr) minmax(70px,.85fr) minmax(64px,1.32fr)!important;
  }
}
#app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .key-list .row-actions {
  width:100%!important;min-width:0;box-sizing:border-box;justify-content:flex-start!important;
  align-items:center;flex-wrap:nowrap!important;gap:4px!important;position:static;
}
#app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .row-actions > button {
  flex:none;white-space:nowrap;width:auto!important;
}
#app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .row-actions > button:not(.kp-more) {
  padding:0 6px!important;min-height:32px!important;font-size:13px!important;font-weight:500;
  border:1px solid transparent!important;border-radius:6px!important;background:transparent!important;
}
#app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .row-actions > button:not(.danger):not(.kp-more) {
  color:var(--cu-action,#4548ae)!important;
}
#app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .row-actions > button:not(.kp-more):is(:hover,:focus-visible) {
  background:var(--cu-hover,rgba(94,102,165,.09))!important;
}
#app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .row-actions > button.kp-folded {
  position:absolute!important;visibility:hidden!important;pointer-events:none;left:0;top:0;
}
@media (min-width:641px) {
  #app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-card:first-child .row-actions::before {
    content:"操作";position:absolute;top:-29px;pointer-events:none;
  }
}
@media (max-width:640px) {
  #app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .row-actions > button {min-height:40px!important}
}
#app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .key-list .key-card .row-actions {
  display:flex!important;
}
#app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .key-list .row-actions > button {
  flex:0 0 auto!important;min-width:0!important;
}
#app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .row-actions > button:not(.kp-more):not(.danger):nth-child(n+3) {
  color:var(--cu-muted,#52617b)!important;
}
#app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .row-actions > button.kd-output-cap:not(.danger) {
  border-color:var(--cu-border,#dce1ea)!important;
  background:var(--cu-surface,#fff)!important;
}
@media (min-width:1181px) {
  #app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-list .key-card .row-actions {
    grid-column:7!important;grid-row:1/span 2!important;margin-left:0!important;
  }
}

#app .app-shell:not(.admin-shell) .keys-page .key-list .row-actions > button.kp-field-source {display:none!important}
#app .app-shell:not(.admin-shell) .keys-page .key-card .kp-field-edit {
  display:inline-grid!important;place-items:center;vertical-align:middle;flex:none;
  width:26px!important;height:26px!important;min-width:0!important;min-height:0!important;
  padding:0!important;border:0!important;border-radius:6px;background:transparent!important;
  color:var(--cu-muted,#617086)!important;cursor:pointer;
}
.kp-field-edit::after {
  content:"";width:14px;height:14px;background:currentColor;
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 5 4 4M3.5 20.5l4.8-1.1L20 7.7a2.8 2.8 0 0 0-4-4L4.6 15.5z'/%3E%3C/svg%3E") center/contain no-repeat;
}
#app .app-shell:not(.admin-shell) .keys-page .key-list .key-card .key-identity button.kp-field-edit:is(:hover,:active,:focus) {
  color:var(--cu-ink,#243149)!important;background:transparent!important;box-shadow:none!important;
}
.kp-field-edit:focus-visible {outline:2px solid currentColor;outline-offset:1px}
#app .keys-page .key-identity>div:has(.kp-field-edit) {gap:3px}
#app .keys-page .key-identity .kp-field-edit+.status-pill {margin-left:4px}
@media (min-width:641px) and (max-width:1180px) {
  #app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-list .key-card>strong {
    display:block!important;grid-column:2!important;grid-row:2!important;
    font-size:12px;line-height:1.45;max-width:100%;overflow-wrap:anywhere;
  }
  #app .app-shell:not(.admin-shell) .keys-page .key-list .key-card:first-child>strong::before {content:none!important}
  #app .keys-page .key-card .key-identity code {grid-row:1}
  #app .keys-page .key-identity>div:has(.kp-field-edit) {display:grid;grid-template-columns:minmax(0,auto) auto;justify-content:start;gap:0}
  #app .keys-page .key-identity .kp-field-edit+.status-pill {grid-column:1/-1;margin:0}
}
@media (pointer:coarse) {
  #app .app-shell:not(.admin-shell) .keys-page .key-card .kp-field-edit {width:32px!important;height:32px!important}
}
@media (min-width:641px) and (max-width:900px) {
  .keys-page { --kp-name-width: 96px; }
  #app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-list .key-card {
    grid-template-columns:minmax(56px,.95fr) minmax(48px,.8fr) minmax(72px,1fr) minmax(84px,1.1fr) minmax(66px,.85fr) minmax(64px,.8fr)!important;
  }
  #app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-list .key-card>strong {grid-column:2/span 2!important}
}

#app .keys-page .key-card .key-identity .status-pill.active {display:none!important}

#app .app-shell:not(.admin-shell) .keys-page .key-identity .tag {
  min-width: 0;
  max-width: calc(var(--kp-name-width) - 30px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kp-column-grip { display: none; }
@media (min-width:641px) {
  #app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-list.kp-custom-widths .key-card {
    grid-template-columns: var(--kp-custom-tracks)!important;
  }
  #app .app-shell:not(.admin-shell) .keys-page .kp-custom-widths .key-identity .tag {
    max-width: 100%;
    min-width: 0;
  }
  #app .app-shell:not(.admin-shell) .keys-page .kp-custom-widths .key-identity code {
    width: max-content;
    max-width: 100%;
  }
  .keys-page .key-card:first-child > .kp-column-grip {
    display: grid;
    place-items: center;
    position: absolute;
    inset-block-start: -39px;
    inset-inline-end: -13px;
    width: 14px;
    height: 38px;
    z-index: 2;
    cursor: col-resize;
    touch-action: none;
    user-select: none;
    outline-offset: -2px;
  }
  .kp-column-grip::after {
    content: "";
    width: 1px;
    height: 16px;
    background: var(--cu-muted, #687487);
    opacity: .45;
  }
  .kp-column-grip:is(:hover,:focus-visible,.kp-dragging)::after { width: 3px; height: 23px; opacity: 1; background: var(--key-action, #514ee8); }
}

.kp-column-label { display: none; }
@media (min-width:641px) {
  .keys-page .key-card:first-child > .kp-column-label {
    display: grid;
    place-items: center;
    position: absolute;
    inset-inline: 0;
    inset-block-start: -40px;
    height: 40px;
    font: 600 14px/20px var(--kp-heading-font);
    color: var(--kp-heading-color);
    white-space: nowrap;
    pointer-events: none;
  }
  #app .keys-page .key-card:first-child:has(> .kp-column-label) :is(.key-identity>div, .key-identity code, .row-actions)::before,
  #app .keys-page .key-card:first-child:has(> .kp-column-label) > strong::before {
    display: none!important;
  }
  .keys-page .key-card:first-child:has(> .kp-column-label) .kp-metric dt {
    width: 1px;
    height: 1px;
    clip-path: inset(50%);
    overflow: hidden;
  }
}

/* Match each value or control group to the center of its resizable track. */
@media (min-width:641px) {
  #app .app-shell:not(.admin-shell) .keys-page .key-list .key-identity > div {
    justify-content: center;
  }
  #app .app-shell:not(.admin-shell) .keys-page .key-list .key-identity code {
    justify-self: center;
    text-align: center;
  }
  #app .app-shell:not(.admin-shell) .keys-page .key-list .kp-metric dd {
    justify-items: center;
    text-align: center;
  }
  #app .app-shell:not(.admin-shell) .keys-page .key-list .key-card > :is(strong, .key-daily) {
    justify-self: center;
    text-align: center;
  }
  #app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page .key-list .key-card .row-actions {
    justify-content: center!important;
  }
}

#app .keys-page .key-card .kd-editor {
  display:grid; justify-items:center; align-content:center; gap:4px;
  min-width:0; margin:0; align-self:center; text-align:center;
}
#app .keys-page .kd-editor label {min-width:0;max-width:100%}
#app .keys-page .kd-editor .kd-amount {
  box-sizing:border-box;width:100px;max-width:100%;min-width:0;height:32px;
  border:1px solid var(--key-line);border-radius:6px;padding:3px 6px;
  color:var(--key-ink);background:var(--card,#fff);text-align:center;font:inherit;font-size:13px;
  font-variant-numeric:tabular-nums;
}
#app .app-shell:not(.admin-shell) .keys-page .kd-editor .kd-amount::placeholder {
  color:var(--cu-text)!important;opacity:1!important;font-weight:500;
}
#app .keys-page .kd-amount:focus-visible {outline:2px solid var(--key-action);outline-offset:1px}
#app .keys-page .kd-editor small {font-size:12px;color:var(--key-muted);overflow-wrap:anywhere}
#app .keys-page .kd-editor small:is(.kd-error,.dl-full) {color:var(--cu-danger,#b94545)}
#app .keys-page .kd-editor .kd-save {color:var(--key-action);min-height:26px;cursor:pointer}
#app .keys-page .kd-editor :is([hidden], small:empty, .kd-mobile-label) {display:none!important}
html[data-console-theme="dark"] #app .keys-page .kd-editor .kd-amount {background:#161b22}
@media (min-width:1181px) {
  #app .keys-page .key-card .kd-editor {grid-column:5;grid-row:1/span 2}
}
@media (min-width:641px) and (max-width:1180px) {
  #app .keys-page .key-card .kd-editor {grid-column:4;grid-row:1/span 2}
}
@media (max-width:640px) {
  #app .keys-page .key-card .kd-editor {grid-column:1/-1;justify-items:start}
  #app .keys-page .kd-editor .kd-mobile-label {display:inline!important;margin-right:8px}
}

#app .keys-page .key-card .km-access {
  grid-column:6;grid-row:1/span 2;justify-self:center;align-self:center;
  min-width:0;max-width:100%;padding:5px 2px;min-height:32px;border:0;
  background:transparent;color:var(--key-action);font:inherit;font-size:13px;white-space:nowrap;cursor:pointer;
}
#app .keys-page .km-access:hover {text-decoration:underline;text-underline-offset:3px}
@media (min-width:641px) and (max-width:1180px) {
  #app .keys-page .key-card .km-access {grid-column:5}
}
@media (max-width:640px) {
  #app .keys-page .key-card .km-access {grid-column:1/-1;grid-row:auto;justify-self:start}
  #app .keys-page .km-access::before {content:"模型权限";margin-right:10px;color:var(--key-ink)}
}
#app .keys-page .km-dialog {
  color-scheme:light;
  position:fixed;inset:0;margin:auto;box-sizing:border-box;width:min(440px,calc(100% - 28px));
  max-height:85dvh;overflow:auto;padding:22px;border:1px solid var(--key-line);border-radius:12px;
  background:var(--cu-surface,#fff);color:var(--key-ink);box-shadow:0 16px 60px #10182b26;
}
html[data-console-theme="dark"] #app .keys-page .km-dialog {color-scheme:dark}
#app .km-dialog::backdrop {background:rgb(15 23 42 / 38%)}
#app .km-dialog h2 {margin:0;font-size:19px}
#app .km-dialog .km-key-name {margin:4px 0 18px;overflow-wrap:anywhere;color:var(--key-muted)}
#app .km-dialog .km-controls {display:flex;gap:18px;border:0;padding:0;margin:0}
#app .km-dialog label {display:flex;align-items:center;gap:8px;min-height:34px;cursor:pointer;font-size:14px}
#app .km-dialog input {appearance:auto;width:16px;height:16px;margin:0;accent-color:var(--key-action)}
#app .km-dialog .km-options:not([hidden]) {display:grid;max-height:38dvh;overflow:auto;margin-top:10px;padding:6px 10px;border:1px solid var(--key-line);border-radius:6px}
#app .km-dialog .km-feedback {color:var(--key-muted);font-size:13px;margin:10px 0 16px}
#app .km-dialog footer {display:flex;justify-content:flex-end;gap:8px}
#app .km-dialog footer button {font:inherit;font-size:14px;padding:6px 16px;cursor:pointer;border-radius:6px;border:1px solid var(--key-line);background:transparent;color:inherit}
#app .km-dialog footer .km-save {color:white;background:var(--key-action)}
#app .km-dialog footer button:disabled {opacity:.5;cursor:default}

/* The quota label is centered over a full-size, keyboard-accessible edit target. */
#app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-list .key-card > strong:has(> .kp-field-edit) {
  display:inline-flex!important;align-items:center;justify-content:center;gap:3px;
  position:relative;box-sizing:border-box;width:fit-content;min-width:min(100%,100px);
  max-width:100%;padding:2px 5px;border:1px solid var(--key-line);
  background:var(--cu-surface,#fff);cursor:pointer;
}
#app .app-shell:not(.admin-shell) .keys-page .key-card > strong .kp-field-edit {
  position:absolute;inset:0;width:100%!important;height:100%!important;opacity:0;
}
#app .keys-page .key-card > strong .kp-field-edit::after {
  content:none;
}
#app .keys-page .key-card > strong:has(> .kp-field-edit:focus-visible) {
  outline:2px solid var(--key-action);outline-offset:2px;
}
#app .app-shell:not(.admin-shell) .keys-page .key-list .key-card :is(strong:has(> .kp-field-edit), .kd-amount, .km-access) {
  box-sizing:border-box;
  min-height:var(--key-pill-height,40px)!important;
  border-radius:999px!important;
}
@media (min-width:641px) {
  #app .app-shell:not(.admin-shell) .keys-page .key-card .km-access {width:min(100px,100%);padding-inline:4px}
}
@media (max-width:640px) {
  .keys-page {--key-pill-height:44px}
}

#app .kd-cap-dialog {color-scheme:light}
html[data-console-theme="dark"] #app .kd-cap-dialog {color-scheme:dark}
#app .kd-cap-dialog label[for="kd-cap-mode"] {display:block;margin:16px 0 6px}
#app .kd-cap-dialog #kd-cap-mode {width:100%;max-width:100%;color:var(--cu-ink);background:var(--cu-surface)}
#app .lg-cap-detail summary {cursor:pointer;white-space:normal}
#app .lg-cap-detail[open] {min-width:9em}


#app .keys-page .key-list .kp-dates {
  grid-column:1/-1;grid-row:3;display:flex;flex-wrap:wrap;gap:4px 20px;
  margin:0;min-width:0;color:var(--key-muted);font-size:13px;line-height:1.5;
  font-variant-numeric:tabular-nums;
}
#app .keys-page .kp-date {display:flex;gap:6px;align-items:baseline}
#app .keys-page .kp-date :is(dt,dd) {margin:0;white-space:nowrap}
#app .keys-page .kp-date dd {color:var(--key-ink)}
@media (min-width:1181px) {
  #app .app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-list:not(.kp-custom-widths) .key-card {
    grid-template-columns:minmax(64px,1fr) minmax(54px,.8fr) minmax(84px,1fr) minmax(90px,1fr) minmax(82px,1fr) minmax(76px,1fr) minmax(82px,.94fr) minmax(88px,1fr) minmax(86px,1.7fr)!important;
    column-gap:10px;
  }
  #app .keys-page .key-list .kp-dates {display:contents}
  #app .keys-page .key-list .kp-date {grid-row:1/span 2;align-self:center;justify-self:center}
  #app .keys-page .kp-date:first-child {grid-column:7}
  #app .keys-page .kp-date:last-child {grid-column:8}
  #app .keys-page .kp-date dt {position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
  #app .app-shell.app-shell.app-shell:not(.admin-shell) .keys-page.kp-usage-ready .key-list .key-card .row-actions {grid-column:9!important}
}
@media (max-width:640px) {
  #app .keys-page .key-list .kp-dates {grid-row:auto;order:8}
}

/* One-time key delivery and creation share a centered native modal. */
#app .keys-page dialog.key-flow {
  --flow-bg:#fff;--flow-ink:#111318;--flow-muted:#626a74;--flow-line:#dedfe2;
  --flow-field:#f0f1f2;--flow-action:#101216;--flow-on-action:white;
  position:fixed;inset:0;box-sizing:border-box;width:min(380px,calc(100vw - 32px));max-height:90dvh;
  height:fit-content;overflow:auto;margin:auto;padding:22px 24px;color:var(--flow-ink);
  border:0;border-radius:24px;background:var(--flow-bg);box-shadow:0 12px 32px #1018281a;
  font:inherit;color-scheme:light;
}
html[data-console-theme="dark"] #app .keys-page dialog.key-flow {
  --flow-bg:#202328;--flow-ink:#f1f2f4;--flow-muted:#afb5bf;--flow-line:#474c54;
  --flow-field:#2a2e34;--flow-action:#f0f1f3;--flow-on-action:#14161a;color-scheme:dark;
}
#app .key-flow::backdrop {background:rgb(15 18 22 / 34%)}
#app .keys-page .key-flow .key-flow-head {display:flex;align-items:center;justify-content:space-between;gap:12px}
#app .keys-page .key-flow h2 {margin:0;font-family:inherit;font-size:16px;font-weight:600;line-height:24px;color:var(--flow-ink)}
#app .keys-page .key-flow :is(.key-flow-hint,.key-flow-security,.key-flow-error) {font:inherit;font-size:14px;line-height:1.6;margin:12px 0 6px;color:var(--flow-muted)}
#app .keys-page .key-flow .key-flow-security {margin:18px 0 0;color:var(--flow-ink)!important}
#app .keys-page .key-flow .key-flow-error {color:var(--cu-danger,#b44747)}
#app .app-shell:not(.admin-shell) .keys-page .key-flow button {
  box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;gap:5px;
  min-height:36px;height:36px;padding:0 16px;border:1px solid transparent;border-radius:999px;
  line-height:1.2;font-family:inherit;font-size:14px;font-weight:500;cursor:pointer;
  color:var(--flow-ink)!important;background:var(--flow-bg)!important;
}
#app .app-shell:not(.admin-shell) .keys-page .key-flow .key-flow-x {
  width:28px;height:28px;min-height:28px;padding:0;margin:-2px -8px -2px 0;background:transparent!important;
}
#app .keys-page .key-flow .key-flow-icon {width:15px;height:15px;background:currentColor;mask:var(--icon) center/contain no-repeat}
#app .app-shell:not(.admin-shell) .keys-page .key-flow input {
  box-sizing:border-box;min-width:0;max-width:100%;width:100%;height:40px;min-height:40px;
  border:1px solid var(--flow-ink)!important;border-radius:999px!important;padding:0 13px;
  background:var(--flow-bg)!important;color:var(--flow-ink)!important;font:inherit;font-size:14px;
}
#app .keys-page .key-flow .key-flow-name::placeholder {color:var(--flow-muted);opacity:.72}
#app .keys-page .key-flow .key-flow-actions {display:flex;justify-content:flex-end;gap:12px;margin-top:20px}
#app .keys-page .key-flow .key-flow-actions button {min-width:72px}
#app .app-shell:not(.admin-shell) .keys-page .key-flow .key-flow-cancel {border-color:var(--flow-line)!important}
#app .app-shell:not(.admin-shell) .keys-page .key-flow :is(.key-flow-primary,.key-flow-copy) {background:var(--flow-action)!important;color:var(--flow-on-action)!important}
#app .keys-page .key-flow button:disabled {opacity:.4;cursor:default}
#app .keys-page .key-flow :is(button,input):focus-visible {outline:2px solid var(--flow-muted);outline-offset:2px}
#app .app-shell:not(.admin-shell) .keys-page .key-flow input.key-flow-name:focus {
  box-shadow:none!important;border-color:var(--flow-ink)!important;outline:1px solid var(--flow-ink)!important;outline-offset:-1px;
}
#app .keys-page .key-flow .key-delivery {display:flex;align-items:center;gap:6px;margin-top:18px;padding:4px;border:1px solid var(--flow-line);border-radius:999px;background:var(--flow-field)}
#app .app-shell:not(.admin-shell) .keys-page .key-flow .key-delivery input {flex:1;height:34px;min-height:34px;background:transparent!important;border:0!important;padding:0 0 0 10px;font-size:13px;text-overflow:ellipsis}
#app .app-shell:not(.admin-shell) .keys-page .key-flow .key-flow-copy {flex:none;padding-inline:14px}
#app .app-shell:not(.admin-shell) .keys-page .key-flow .key-flow-copy.is-copied {background:#60676c!important;color:white!important}
.key-flow .icon-close {--icon:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iY3VycmVudENvbG9yIiBjbGFzcz0iYmkgYmkteC1sZyIgdmlld0JveD0iMCAwIDE2IDE2Ij4KICA8cGF0aCBkPSJNMi4xNDYgMi44NTRhLjUuNSAwIDEgMSAuNzA4LS43MDhMOCA3LjI5M2w1LjE0Ni01LjE0N2EuNS41IDAgMCAxIC43MDguNzA4TDguNzA3IDhsNS4xNDcgNS4xNDZhLjUuNSAwIDAgMS0uNzA4LjcwOEw4IDguNzA3bC01LjE0NiA1LjE0N2EuNS41IDAgMCAxLS43MDgtLjcwOEw3LjI5MyA4eiIvPgo8L3N2Zz4=")}
.key-flow .icon-copy {--icon:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iY3VycmVudENvbG9yIiBjbGFzcz0iYmkgYmktY29weSIgdmlld0JveD0iMCAwIDE2IDE2Ij4KICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik00IDJhMiAyIDAgMCAxIDItMmg4YTIgMiAwIDAgMSAyIDJ2OGEyIDIgMCAwIDEtMiAySDZhMiAyIDAgMCAxLTItMnptMi0xYTEgMSAwIDAgMC0xIDF2OGExIDEgMCAwIDAgMSAxaDhhMSAxIDAgMCAwIDEtMVYyYTEgMSAwIDAgMC0xLTF6TTIgNWExIDEgMCAwIDAtMSAxdjhhMSAxIDAgMCAwIDEgMWg4YTEgMSAwIDAgMCAxLTF2LTFoMXYxYTIgMiAwIDAgMS0yIDJIMmEyIDIgMCAwIDEtMi0yVjZhMiAyIDAgMCAxIDItMmgxdjF6Ii8+Cjwvc3ZnPg==")}
.key-flow .icon-check {--icon:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iY3VycmVudENvbG9yIiBjbGFzcz0iYmkgYmktY2hlY2syIiB2aWV3Qm94PSIwIDAgMTYgMTYiPgogIDxwYXRoIGQ9Ik0xMy44NTQgMy42NDZhLjUuNSAwIDAgMSAwIC43MDhsLTcgN2EuNS41IDAgMCAxLS43MDggMGwtMy41LTMuNWEuNS41IDAgMSAxIC43MDgtLjcwOEw2LjUgMTAuMjkzbDYuNjQ2LTYuNjQ3YS41LjUgMCAwIDEgLjcwOCAwIi8+Cjwvc3ZnPg==")}
