/* ==========================================================================
   登录 / 注册
   ========================================================================== */

.auth {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  background: var(--bg-base);
}
.auth[hidden] { display: none; }

.auth-aside {
  width: 46%;
  max-width: 620px;
  flex: none;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px 56px 40px;
  color: #fff;
  background:
    radial-gradient(120% 90% at 10% 0%, rgba(255, 255, 255, .16), transparent 55%),
    linear-gradient(150deg, #4a74ff 0%, #2f52d8 45%, #1f2f7a 100%);
  overflow: hidden;
}
.auth-aside::after {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  right: -180px;
  bottom: -220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .16), transparent 65%);
  pointer-events: none;
}
.auth-aside-inner { position: relative; z-index: 1; }
.auth-mark {
  display: block;
  width: 156px;
  height: 25px;
  background: #fff;
  -webkit-mask: url("assets/logo-full.svg") no-repeat left center / 156px 25px;
  mask: url("assets/logo-full.svg") no-repeat left center / 156px 25px;
}
.auth-mark.sm { width: 118px; height: 19px; background: var(--brand); -webkit-mask-size: 118px 19px; mask-size: 118px 19px; }
.auth-slogan {
  font-size: 34px;
  line-height: 1.28;
  font-weight: 600;
  letter-spacing: -.02em;
  margin: 40px 0 16px;
}
.auth-desc {
  font-size: 14px;
  line-height: 1.8;
  color: rgba(255, 255, 255, .82);
  margin: 0 0 32px;
}
.auth-points { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.auth-points li {
  position: relative;
  padding-left: 22px;
  font-size: 13px;
  color: rgba(255, 255, 255, .9);
}
.auth-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .7);
}
.auth-aside-foot {
  position: relative;
  z-index: 1;
  font-size: 12px;
  color: rgba(255, 255, 255, .6);
}

.auth-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  overflow-y: auto;
}
.auth-card {
  width: 100%;
  max-width: 366px;
  padding: 8px 0 24px;
  animation: auth-in 260ms ease-out;
}
@keyframes auth-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.auth-brand { margin-bottom: 26px; display: none; }

.auth-tabs {
  display: flex;
  gap: 24px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border-l1);
}
.auth-tabs button {
  position: relative;
  padding: 0 0 10px;
  font-size: 17px;
  font-weight: 500;
  color: var(--text-tertiary);
  transition: color var(--transition);
}
.auth-tabs button:hover { color: var(--text-secondary); }
.auth-tabs button[aria-selected="true"] { color: var(--text-primary); }
.auth-tabs button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand);
}

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form[hidden] { display: none; }
.auth-field { display: flex; flex-direction: column; gap: 7px; }
.auth-field label { font-size: 12px; color: var(--text-tertiary); }
.auth-field .opt { color: var(--text-dimmed); font-size: 11px; }

.auth-input {
  height: 44px;
  width: 100%;
  padding: 0 14px;
  border-radius: 11px;
  border: 1px solid var(--border-l2);
  background: var(--bg-layer-1);
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
  outline: 0;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.auth-input::placeholder { color: var(--text-dimmed); }
.auth-input:focus {
  border-color: var(--ds-deepchat-400);
  box-shadow: 0 0 0 3px rgba(57, 100, 254, .12);
}
.auth-input.invalid { border-color: var(--ds-red-500); box-shadow: 0 0 0 3px rgba(239, 68, 68, .1); }

.auth-pass { position: relative; }
.auth-pass .auth-input { padding-right: 60px; }
.auth-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-tertiary);
}
.auth-eye:hover { background: var(--bg-hover); color: var(--text-primary); }

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  margin-top: -2px;
}
.auth-check { display: inline-flex; align-items: center; gap: 7px; color: var(--text-secondary); cursor: pointer; }
.auth-check input { accent-color: var(--brand); width: 14px; height: 14px; }
.auth-link { color: var(--brand); }
.auth-link:hover { text-decoration: underline; }

.auth-error {
  padding: 9px 12px;
  border-radius: 9px;
  background: rgba(239, 68, 68, .09);
  border: 1px solid rgba(239, 68, 68, .22);
  color: #c62f2f;
  font-size: 12.5px;
  line-height: 1.6;
}
.auth-error[hidden] { display: none; }
[data-theme="dark"] .auth-error { background: rgba(239, 68, 68, .14); color: #ff9494; }

.auth-submit {
  height: 46px;
  border-radius: 11px;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  transition: background var(--transition), opacity var(--transition), transform var(--transition);
}
.auth-submit:hover { background: var(--brand-hover); }
.auth-submit:active { transform: scale(.995); }
.auth-submit[disabled] { opacity: .6; cursor: default; }
.auth-submit.loading::after {
  content: "";
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-left: 8px;
  vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.auth-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--text-dimmed);
}
.auth-fill {
  padding: 4px 9px;
  border-radius: 7px;
  border: 1px dashed var(--border-l3);
  font-size: 11.5px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}
.auth-fill:hover { background: var(--bg-hover); color: var(--text-primary); border-style: solid; }

.auth-terms {
  margin: 2px 0 0;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--text-dimmed);
}

/* 未登录时隐藏主界面 */
.app[data-auth="out"] { display: none; }
.auth-shake { animation: shake 320ms ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@media (max-width: 900px) {
  .auth-aside { display: none; }
  .auth-brand { display: block; }
  .auth-card { max-width: 380px; }
}

/* ==========================================================================
   用户 / 管理后台 / 组件
   ========================================================================== */

/* ------------------------------ 顶栏补充 -------------------------------- */

.head-actions { gap: 6px; }

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border-l2);
  color: var(--text-secondary);
  font-size: 13px;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.ghost-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.ghost-btn.is-active {
  background: var(--ds-deepchat-50);
  border-color: var(--ds-deepchat-300);
  color: var(--brand);
}
[data-theme="dark"] .ghost-btn.is-active {
  background: rgba(57, 100, 254, .16);
  border-color: rgba(103, 158, 254, .45);
  color: #8ab0ff;
}

/* ------------------------------ 控制台外壳 ------------------------------ */

.console {
  display: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 32px 48px;
}
.app[data-view="console"] .console { display: block; }

/* 三个独立视图：对话 / 我的账户 / 管理后台 */
.app[data-view="home"] #chatScroll,
.app[data-view="chat"] #chatScroll { display: flex; }
.app[data-view="home"] #account,
.app[data-view="home"] #admin,
.app[data-view="chat"] #account,
.app[data-view="chat"] #admin { display: none; }

.app[data-view="account"] #chatScroll,
.app[data-view="admin"] #chatScroll { display: none; }
.app[data-view="account"] #account { display: block; }
.app[data-view="admin"] #admin { display: block; }
.app[data-view="account"] .chat-title,
.app[data-view="admin"] .chat-title { visibility: hidden; }
.app[data-view="account"] #btnShare,
.app[data-view="admin"] #btnShare { display: none; }

/* ---------------------------- 余额卡片 -------------------------------- */

.balance-card {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 24px 26px;
  margin-bottom: 16px;
  border-radius: 16px;
  border: 1px solid var(--border-l1);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(57, 100, 254, .08), transparent 60%),
    var(--bg-layer-1);
}
.balance-main { flex: 1; min-width: 0; }
.balance-label { font-size: 12px; color: var(--text-tertiary); margin-bottom: 6px; }
.balance-value {
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.1;
}
.balance-value small { font-size: 13px; font-weight: 400; color: var(--text-tertiary); margin-left: 6px; }
.balance-usd { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.balance-meter {
  height: 6px;
  border-radius: 6px;
  background: var(--bg-inline-code);
  overflow: hidden;
  margin: 14px 0 8px;
  max-width: 420px;
}
.balance-meter span {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #6f8dff, var(--brand));
  transition: width 320ms ease;
}
.balance-foot {
  display: flex;
  gap: 18px;
  font-size: 12px;
  color: var(--text-tertiary);
  flex-wrap: wrap;
}
.balance-aside { flex: none; text-align: center; }
.balance-aside .btn { height: 38px; padding: 0 26px; font-size: 14px; }

/* ---------------------------- 直方图 ---------------------------------- */

.chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 180px;
  padding-top: 18px;
}
.chart-col {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
}
.chart-bar {
  position: relative;
  border-radius: 5px 5px 3px 3px;
  background: linear-gradient(180deg, #7b96ff, var(--brand));
  min-height: 3px;
  transition: height 320ms ease, filter 120ms ease;
}
.chart-col:hover .chart-bar { filter: brightness(1.08); }
.chart-bar span {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--text-tertiary);
  opacity: 0;
  transition: opacity 120ms ease;
}
.chart-col:hover .chart-bar span { opacity: 1; }
.chart-lb {
  font-size: 11px;
  color: var(--text-dimmed);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
}
.chart:has(.chart-col:nth-child(15)) .chart-lb { font-size: 9px; }
.chart:has(.chart-col:nth-child(22)) .chart-col:nth-child(2n) .chart-lb { visibility: hidden; }

/* ---------------------------- 分段控件 -------------------------------- */

.seg {
  display: inline-flex;
  padding: 2px;
  border-radius: 8px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-l1);
}
.seg button {
  height: 26px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-tertiary);
}
.seg button[aria-selected="true"] {
  background: var(--bg-base);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}

/* ------------------------------ 弹窗 ---------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal[hidden] { display: none; }
.modal-mask {
  position: absolute;
  inset: 0;
  background: var(--bg-mask);
  animation: fade-in 140ms ease-out;
}
.modal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  border-radius: 16px;
  background: var(--bg-dialog);
  border: 1px solid var(--border-l1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .22);
  animation: modal-in 160ms ease-out;
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 48px);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
}
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-body {
  padding: 0 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-body .field label { font-size: 12px; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 18px;
  border-top: 1px solid var(--border-l1);
  margin-top: 16px;
}
.modal-foot .btn { height: 34px; padding: 0 18px; }

.topup-amounts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.topup-amounts button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 4px;
  border-radius: 10px;
  border: 1px solid var(--border-l2);
  font-size: 14px;
  color: var(--text-primary);
  transition: border-color var(--transition), background var(--transition);
}
.topup-amounts button small { font-size: 10px; color: var(--text-tertiary); }
.topup-amounts button:hover { background: var(--bg-hover); }
.topup-amounts button[aria-selected="true"] {
  border-color: var(--ds-deepchat-300);
  background: var(--ds-deepchat-50);
  color: var(--brand);
}
[data-theme="dark"] .topup-amounts button[aria-selected="true"] {
  background: rgba(57, 100, 254, .16);
  border-color: rgba(103, 158, 254, .45);
  color: #8ab0ff;
}

.pay-methods { display: flex; gap: 8px; }
.pay-methods button {
  flex: 1;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border-l2);
  font-size: 13px;
  color: var(--text-secondary);
}
.pay-methods button:hover { background: var(--bg-hover); }
.pay-methods button[aria-selected="true"] {
  border-color: var(--ds-deepchat-300);
  background: var(--ds-deepchat-50);
  color: var(--brand);
}
[data-theme="dark"] .pay-methods button[aria-selected="true"] {
  background: rgba(57, 100, 254, .16);
  border-color: rgba(103, 158, 254, .45);
  color: #8ab0ff;
}

.topup-summary {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-sidebar);
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
}
.topup-summary[data-invalid="1"] { color: var(--ds-red-600); background: rgba(239, 68, 68, .07); }

.pay-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-dimmed);
  margin-top: -4px;
}
.pay-brand b { color: var(--text-secondary); font-weight: 500; }

/* ---------------------------- 支付步骤 -------------------------------- */

.pay-head { text-align: center; padding: 6px 0 2px; }
.pay-amount {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--text-primary);
}
.pay-meta { font-size: 11.5px; color: var(--text-tertiary); margin-top: 6px; font-family: var(--font-mono); }

.pay-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px;
  border-radius: 12px;
  background: var(--bg-sidebar);
  border: 1px dashed var(--border-l2);
}
.pay-qr img { border-radius: 8px; background: #fff; padding: 6px; }
.pay-redirect { padding: 26px 14px; }

.pay-actions { display: flex; gap: 8px; }
.pay-actions .btn { flex: 1; height: 36px; }
.pay-actions a.btn { display: inline-flex; }

.pay-status {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-tertiary);
  padding: 4px;
}
.pay-status[data-state="success"] { color: #178a45; font-weight: 500; }
.pay-status[data-state="closed"] { color: var(--ds-red-600); }

/* ---------------------------- 品牌标志（SVG 文本） --------------------- */

.brand svg,
.auth-mark,
.whale-mark,
.auth-brand svg {
  display: block;
}

.console-inner { max-width: 1080px; margin: 0 auto; }

.console-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 18px;
  border-bottom: 1px solid var(--border-l1);
  margin-bottom: 20px;
}
.console-title { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
.console-sub { font-size: 12px; color: var(--text-tertiary); }
.console-sub code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-inline-code);
  padding: 2px 6px;
  border-radius: 5px;
}

.tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-l1);
}
.tab {
  height: 30px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}
.tab:hover { color: var(--text-primary); }
.tab[aria-selected="true"] {
  background: var(--bg-base);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}

.panel { display: none; }
.panel.is-active { display: block; animation: panel-in 160ms ease-out; }
@keyframes panel-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* -------------------------------- 卡片 ---------------------------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border-l1);
  background: var(--bg-layer-1);
}
.stat .k { font-size: 12px; color: var(--text-tertiary); margin-bottom: 8px; }
.stat .v { font-size: 22px; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
.stat .v small { font-size: 12px; font-weight: 400; color: var(--text-tertiary); margin-left: 4px; }
.stat .d { font-size: 11px; color: var(--text-dimmed); margin-top: 6px; }

.card {
  border: 1px solid var(--border-l1);
  border-radius: 14px;
  background: var(--bg-layer-1);
  overflow: hidden;
}
.card + .card { margin-top: 14px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-l1);
}
.card-title { font-size: 14px; font-weight: 600; }
.card-title span { font-weight: 400; color: var(--text-tertiary); font-size: 12px; margin-left: 8px; }
.card-body { padding: 16px; }
.card-body.tight { padding: 4px; }

.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }

/* ------------------------------- 柱状图 --------------------------------- */

.bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 148px;
  padding-top: 12px;
}
.bars .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; height: 100%; }
.bars .stack { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.bars .bar {
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, #6f8dff, var(--brand));
  min-height: 3px;
  transition: height 320ms ease;
}
.bars .bar.alt { background: linear-gradient(180deg, #b9c9ff, #8ea6fd); }
.bars .lb { font-size: 11px; color: var(--text-dimmed); text-align: center; }
.bars .col:hover .bar { filter: brightness(1.06); }

.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-tertiary); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; background: var(--brand); }
.legend i.alt { background: #a9bcff; }

.rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border-l1);
}
.rank-row:last-child { border-bottom: 0; }
.rank-row .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .m { color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.rank-bar { width: 84px; height: 5px; border-radius: 4px; background: var(--bg-inline-code); overflow: hidden; }
.rank-bar span { display: block; height: 100%; background: var(--brand); border-radius: 4px; }

/* -------------------------------- 表格 ---------------------------------- */

.table-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  color: var(--text-tertiary);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-l1);
  white-space: nowrap;
  background: transparent;
}
table.data td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-l1);
  vertical-align: middle;
  color: var(--text-primary);
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--bg-hover); }
table.data .num { font-variant-numeric: tabular-nums; }
table.data .right { text-align: right; }
.mono { font-family: var(--font-mono); font-size: 12px; }
.muted { color: var(--text-tertiary); }
.tiny { font-size: 12px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}
.badge.ok { background: rgba(34, 197, 94, .12); color: #178a45; }
.badge.err { background: rgba(239, 68, 68, .12); color: #ce2b2b; }
.badge.off { background: var(--bg-inline-code); color: var(--text-tertiary); }
.badge.mock { background: var(--ds-deepchat-50); color: var(--brand); }
[data-theme="dark"] .badge.ok { background: rgba(34, 197, 94, .16); color: #5fd98d; }
[data-theme="dark"] .badge.err { background: rgba(239, 68, 68, .18); color: #ff8b8b; }
[data-theme="dark"] .badge.mock { background: rgba(57, 100, 254, .18); color: #8ab0ff; }

.chip-models { display: flex; flex-wrap: wrap; gap: 4px; }
.chip-sm {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--bg-inline-code);
  color: var(--text-secondary);
  font-size: 11px;
  font-family: var(--font-mono);
}

/* -------------------------------- 按钮 ---------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  transition: background var(--transition), opacity var(--transition), color var(--transition);
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); }
.btn.primary[disabled] { opacity: .5; }
.btn.ghost { border: 1px solid var(--border-l2); color: var(--text-secondary); }
.btn.ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn.danger { color: var(--ds-red-600); }
.btn.danger:hover { background: rgba(236, 19, 19, .06); }
.btn.xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 6px; }

.row-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* -------------------------------- 表单 ---------------------------------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; color: var(--text-tertiary); }
.field .hint { font-size: 11px; color: var(--text-dimmed); }

.input,
.select {
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border-l2);
  background: var(--bg-base);
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  outline: 0;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input:focus,
.select:focus {
  border-color: var(--ds-deepchat-300);
  box-shadow: 0 0 0 3px rgba(57, 100, 254, .08);
}
.input[readonly] { color: var(--text-tertiary); background: var(--bg-sidebar); cursor: not-allowed; }
.input.mono { font-family: var(--font-mono); font-size: 12px; }

.switch-set { display: flex; flex-wrap: wrap; gap: 6px; }
.switch-set label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid var(--border-l2);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.switch-set input { accent-color: var(--brand); }
.switch-set label:has(input:checked) {
  border-color: var(--ds-deepchat-300);
  background: var(--ds-deepchat-50);
  color: var(--brand);
}
[data-theme="dark"] .switch-set label:has(input:checked) {
  background: rgba(57, 100, 254, .16);
  border-color: rgba(103, 158, 254, .45);
  color: #8ab0ff;
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-l1);
}

.notice {
  display: flex;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--ds-deepchat-50);
  border: 1px solid var(--ds-deepchat-200);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.7;
  margin-bottom: 14px;
}
[data-theme="dark"] .notice {
  background: rgba(57, 100, 254, .1);
  border-color: rgba(103, 158, 254, .3);
}
.notice b { color: var(--brand); font-weight: 600; }

/* ------------------------------- 小工具 --------------------------------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.toolbar .spacer { flex: 1; }

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border-l1);
}

.empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-dimmed);
  font-size: 13px;
}

.loading { padding: 28px; text-align: center; color: var(--text-dimmed); font-size: 13px; }

/* 侧栏底部：额度条 */
.quota-mini { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.quota-mini .q-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quota-mini .q-bar { height: 3px; border-radius: 3px; background: var(--bg-inline-code); overflow: hidden; }
.quota-mini .q-bar span { display: block; height: 100%; background: var(--brand); }

/* 响应式 */
@media (max-width: 980px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .console { padding: 8px 16px 40px; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ---------------------------- brand mask --------------------------- */
.brand-mark {
  display: block;
  width: 143px;
  height: 23px;
  background: var(--brand);
  -webkit-mask: url("assets/logo-full.svg") no-repeat left center / 143px 23px;
  mask: url("assets/logo-full.svg") no-repeat left center / 143px 23px;
}
.whale-mark {
  display: inline-block;
  width: 28px;
  height: 23px;
  background: var(--brand);
  -webkit-mask: url("assets/logo-full.svg") no-repeat left center / 143px 23px;
  mask: url("assets/logo-full.svg") no-repeat left center / 143px 23px;
}
/* 首页也要显示顶栏动作（控制台入口） */
.app[data-view="home"] .head-actions { visibility: visible; }
.quota-mini .q-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}
/* 柱状图：两个系列并排而不是堆叠 */
.bars .stack { flex-direction: row; align-items: flex-end; gap: 4px; }
.bars .bar { flex: 1; }
/* 表格里的按钮不要被挤成竖排 */
.btn { white-space: nowrap; }
table.data td .row-actions { white-space: nowrap; }
table.data th:last-child,
table.data td:last-child { min-width: 116px; }
/* 调用量为 0 时的柱子：细线占位，不要变成"满格白条" */
.chart-col .chart-bar[data-zero="1"] {
  background: var(--bg-inline-code);
  min-height: 2px;
  max-height: 2px;
}