/* console.css · 3.0 控制台
 *
 * 视觉基线：CC Switch（src/index.css 的 v7 设计令牌）。
 * 浅色：白主区 + #f5f5f7 侧栏 + #e4e4e7 细边框 + 黑/白品牌色（小海豚图标）。
 * 深色：跟随系统 prefers-color-scheme（结构沿用 CC Switch 令牌，强调色换成本品牌黑/白）。
 * 零外部资源：无 @import、无 url()、无外部字体。
 */

:root {
  color-scheme: light dark;

  /* shadcn / v7 */
  --bg-app: #ffffff;
  --bg-sidebar: #f5f5f7;
  --bg-subtle: #efeff2;
  --bg-selected: #e4e4ea;
  --bg-card: #ffffff;
  --border: #e4e4e7;
  --border-strong: #cfcfd6;
  --text-1: #18181b;
  --text-2: #52525b;
  --text-3: #65656e;

  /* 品牌色取自小海豚图标（黑/白单色），不再沿用 CC Switch 的橙色。 */
  --action-bg: #18181b;
  --action-fg: #ffffff;
  --action-hover: #303036;
  --action-text: #18181b;
  --action-soft: #f0f0f2;
  --inverse-bg: #18181b;
  --inverse-fg: #ffffff;
  --overlay: rgba(9, 9, 11, 0.36);
  --control-off: #888890;

  --direct-fill: #18181b;
  --direct-text: #18181b;
  --direct-soft: #f4f4f5;
  --direct-solid: #18181b;
  --direct-on: #ffffff;
  --direct-border: #18181b;

  /* 图表跟品牌一致：主序列墨黑、次序列中性灰。 */
  --chart-in: #18181b;
  --chart-out: #a1a1aa;

  --success: #16a34a;
  --success-text: #007634;
  --success-soft: #e8f7ee;
  --warning: #d97706;
  --warning-text: #a64a00;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-text: #b91c1c;
  --danger-soft: #fee2e2;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 20px 40px rgba(16, 24, 40, 0.16), 0 4px 12px rgba(16, 24, 40, 0.08);

  --radius-control: 6px;
  --radius-panel: 10px;

  --fs-badge: 11px;
  --lh-badge: 16px;
  --fs-caption: 12px;
  --lh-caption: 18px;
  --fs-body: 13px;
  --lh-body: 20px;
  --fs-strong: 14px;
  --lh-strong: 20px;
  --fs-title: 16px;
  --lh-title: 24px;
  --fs-page: 18px;
  --lh-page: 26px;

  --h-control: 32px;
  --h-control-sm: 28px;
  --h-nav-row: 28px;
  --h-card: 58px;
  --card-py: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-app: #1c1c1e;
    --bg-sidebar: #161618;
    --bg-subtle: #26262a;
    --bg-selected: #313136;
    --bg-card: #2e2e33;
    --border: #3f3f46;
    --border-strong: #4a4a52;
    --text-1: #e4e4e7;
    --text-2: #ababb3;
    --text-3: #9a9aa2;

    --action-bg: #f4f4f5;
    --action-fg: #18181b;
    --action-hover: #ffffff;
    --action-text: #f4f4f5;
    --action-soft: rgba(244, 244, 245, 0.12);
    --inverse-bg: #f4f4f5;
    --inverse-fg: #18181b;
    --overlay: rgba(0, 0, 0, 0.55);
    --control-off: #6f6f77;

    --direct-fill: #f4f4f5;
    --direct-text: #f4f4f5;
    --direct-soft: rgba(244, 244, 245, 0.08);
    --direct-solid: #f4f4f5;
    --direct-on: #18181b;
    --direct-border: rgba(244, 244, 245, 0.6);

    --chart-in: #f4f4f5;
    --chart-out: #71717a;

    --success: #4ade80;
    --success-text: #4ade80;
    --success-soft: #0f2b1a;
    --warning: #fbbf24;
    --warning-text: #fcd34d;
    --warning-soft: #33260a;
    --danger: #f87171;
    --danger-text: #fca5a5;
    --danger-soft: #3a1414;

    --shadow-sm: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.4);
  }
}

/* ---------- 基础 ---------- */

* { box-sizing: border-box; }

html, body { height: 100%; }

.csw {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--bg-app);
  color: var(--text-1);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Hiragino Sans GB", "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI",
    "Microsoft YaHei", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
}

.csw button {
  margin: 0;
  font: inherit;
  color: inherit;
}

.csw input {
  margin: 0;
  font: inherit;
}

.csw svg { display: block; flex-shrink: 0; }

.hidden { display: none !important; }

/* ---------- 壳层 ---------- */

.shell {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
  transition: grid-template-columns 200ms cubic-bezier(0.2, 0, 0, 1);
}

@media (prefers-reduced-motion: reduce) {
  .shell { transition: none; }
}

/* ---------- 侧栏 ---------- */

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
}

.side-top {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  flex: 0 0 auto;
  padding: 0 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-right: auto;
  padding-left: 6px;
}

.brand-logo {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

/* 品牌图标用我们自己的 assets/icon.png（构建时复制到 web/assets/icons/）。
   CC Switch 的原始 SVG 仍留在 HTML 里做设计参照，但不重复显示。 */
.brand > svg.brand-logo { display: none; }
.brand-dolphin { object-fit: contain; border-radius: 5px; }

/* 图标是透明底黑色海豚：深色模式下反相成白色，跟着品牌色一起反转。 */
@media (prefers-color-scheme: dark) {
  .brand-dolphin { filter: invert(1); }
}

.brand-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text-1);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-collapse { color: var(--text-2); }
.side-collapse svg { transition: transform 150ms; }
.side-collapse.is-collapsed svg { transform: scaleX(-1); }

.side-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 0 8px;
}

.side-apps {
  display: flex;
  flex-direction: column;
}

.nav-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 16px);
  height: var(--h-nav-row);
  flex: 0 0 auto;
  margin: 0 8px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text-1);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  text-align: left;
  cursor: pointer;
  transition: background-color 150ms, color 150ms;
}

.nav-row.side-app-row { gap: 8px; }

.nav-row > svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--text-2);
}

.nav-row:hover { background: var(--bg-subtle); }

.nav-row.is-active {
  background: var(--bg-selected);
  font-weight: 500;
}

.nav-row.is-active > svg { color: var(--text-1); }

.nav-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-trailing {
  flex: 0 0 auto;
  color: var(--text-3);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.side-divider {
  height: 1px;
  flex: 0 0 auto;
  margin: 6px 16px;
  background: var(--border);
}

.side-globals { display: flex; flex-direction: column; flex: 0 0 auto; }

.side-foot {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  padding-bottom: 8px;
}

/* 应用图标：CC Switch 的 AppGlyph 是品牌图标 + 角标；
   这里用首字母 tile 等价占位，尺寸、圆角、角标位置一致。 */
.app-glyph {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border-radius: 5px;
  background: var(--bg-subtle);
  background: color-mix(in srgb, var(--glyph-color, #52525b) 14%, transparent);
  color: var(--glyph-color, #52525b);
  font-size: 10px;
  line-height: 1;
  font-weight: 700;
}

.app-glyph .app-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: var(--bg-sidebar);
  color: var(--text-2);
}

.app-glyph .app-badge svg { width: 9px; height: 9px; }

/* 官方品牌图标：不铺色块，只放原图；近黑图标在深色模式垫白底。 */
.app-glyph.is-logo { background: transparent; }
.app-glyph-img {
  width: var(--glyph-img-size, 16px);
  height: var(--glyph-img-size, 16px);
  object-fit: contain;
}
.head-glyph .app-glyph .app-badge { background: var(--bg-app); }

@media (prefers-color-scheme: dark) {
  .app-glyph.is-logo.is-dark-ink { background: #fff; padding: 1px; }
}

.nav-row.is-active .app-glyph .app-badge { background: var(--bg-selected); }

/* ---------- 主区 ---------- */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg-app);
}

.page-head {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 52px;
  flex: 0 0 auto;
  padding: 0 16px 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-app);
}

.head-ident {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 0 0 auto;
}

.head-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  color: var(--text-1);
}

.head-glyph.is-app {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--glyph-color, #52525b) 14%, transparent);
  color: var(--glyph-color, #52525b);
  font-size: 11px;
  font-weight: 700;
}

.page-title {
  margin: 0;
  overflow: hidden;
  color: var(--text-1);
  font-size: var(--fs-title);
  line-height: var(--lh-title);
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.page-title.is-page {
  font-size: var(--fs-page);
  line-height: var(--lh-page);
}

.head-sub {
  flex: 0 0 auto;
  color: var(--text-3);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  white-space: nowrap;
}

.head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  margin-left: auto;
}

/* ---------- 自绘标题栏（CC Switch WindowControls） ---------- */

/* 页头与侧栏顶条整条可拖窗口；里头的按钮/输入框自己处理点击。 */
[data-window-drag] {
  -webkit-user-select: none;
  user-select: none;
}

.window-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.window-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text-2);
  transition: background-color 150ms, color 150ms, scale 100ms;
}

.window-btn > svg {
  width: 16px;
  height: 16px;
}

.window-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-1);
}

.window-btn:active { scale: 0.96; }

.window-btn.is-close:hover {
  background: var(--danger-soft);
  color: var(--danger-text);
}

/* P9-14e：窗口固定尺寸（WS_THICKFRAME/WS_MAXIMIZEBOX 已摘、最大化按钮与
   缩放边条已删），缩放边条样式随之移除。 */

/* ---------- 搜索 ---------- */

.search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 240px;
  height: var(--h-control-sm);
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--bg-card);
  transition: border-color 150ms;
}

.search-wrap:focus-within { border-color: var(--border-strong); }

.search-wrap > svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--text-3);
}

.search-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-1);
  font-size: var(--fs-body);
}

.search-wrap input::placeholder { color: var(--text-3); }

.search-clear {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-3);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.search-clear:hover { background: var(--bg-subtle); color: var(--text-1); }

/* ---------- 模式行 ---------- */

.mode-row {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 48px;
  flex: 0 0 auto;
  padding: 12px 24px 0;
}

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 36px;
  flex: 0 0 auto;
  padding: 3px;
  border-radius: 10px;
  background: var(--bg-subtle);
}

.seg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  min-width: 96px;
  padding: 0 16px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  font-size: var(--fs-body);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms, color 150ms, box-shadow 150ms;
}

.seg-btn > svg { width: 14px; height: 14px; }

.seg-btn:hover { color: var(--text-1); }

.seg-btn.is-selected {
  background: var(--bg-card);
  color: var(--text-1);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.mode-spacer { flex: 1 1 auto; }

.mode-note {
  flex: 0 0 auto;
  color: var(--text-3);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  white-space: nowrap;
}

/* ---------- 内容 ---------- */

.content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 24px 48px;
}

/* CC Switch 的滚动条是细的、低对比的；不抢卡片和边框的注意力。 */
.side-scroll,
.content {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--text-3) 35%, transparent) transparent;
}

.side-scroll::-webkit-scrollbar,
.content::-webkit-scrollbar { width: 8px; height: 8px; }

.side-scroll::-webkit-scrollbar-track,
.content::-webkit-scrollbar-track { background: transparent; }

.side-scroll::-webkit-scrollbar-thumb,
.content::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text-3) 35%, transparent) padding-box;
}

.side-scroll::-webkit-scrollbar-thumb:hover,
.content::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--text-3) 55%, transparent) padding-box;
}

.view { min-width: 0; }

.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  margin-bottom: 8px;
}

.section-head h2 {
  margin: 0;
  color: var(--text-2);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  font-weight: 600;
}

.section-meta {
  color: var(--text-3);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
}

.section-spacer { flex: 1 1 auto; }

.message {
  margin: 0 0 10px;
  color: var(--danger-text);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
}

/* ---------- 供应商卡（CC Switch ProviderCard） ---------- */

.provider-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.provider-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--h-card);
  padding: var(--card-py) 12px var(--card-py) 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--bg-card);
  cursor: pointer;
  transition: border-color 150ms, box-shadow 150ms, background-color 150ms;
}

.provider-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.tool-card-body {
  flex: 1 1 auto;
  min-width: 0;
}

.tool-card-body strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text-1);
  font-size: var(--fs-body);
}

.tools-tabs {
  width: fit-content;
  margin-bottom: 12px;
}

.config-dir-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.45fr) auto minmax(180px, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.config-dir-row:last-child { border-bottom: 0; }
.config-dir-name { color: var(--text-1); font-weight: 600; }
.config-dir-row input,
.form-field input,
.form-field select,
.form-field textarea {
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  background: var(--bg-subtle);
  color: var(--text-1);
  font: inherit;
}

.config-dir-row input:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus { border-color: var(--accent); }

@media (max-width: 720px) {
  .config-dir-row { grid-template-columns: 1fr auto; }
  .config-dir-row input { grid-column: 1 / -1; grid-row: 2; }
}

.sync-panel {
  max-width: 760px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--bg-card);
}

.sync-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.sync-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.sync-divider {
  height: 1px;
  margin: 16px 0;
  background: var(--border);
}

.sync-auto {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.sync-auto .section-meta { margin-left: 8px; }

.sync-audit { margin-top: 16px; }

.sync-audit-list {
  max-height: 220px;
  margin: 8px 0 0;
  padding: 10px;
  overflow: auto;
  border-radius: 8px;
  background: var(--bg-subtle);
  color: var(--text-2);
  font: inherit;
  white-space: pre-wrap;
}

.sync-overwrite {
  margin-top: 12px;
}

.sync-result {
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: var(--bg-subtle);
}

.sync-result pre {
  margin: 8px 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  color: var(--text-1);
  font: inherit;
}

.sync-preview-facts p { margin: 6px 0; }

@media (max-width: 720px) {
  .sync-form { grid-template-columns: 1fr; }
}

.tool-unmanaged-head {
  margin-top: 18px;
}

.tool-batch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.repo-results { display: grid; gap: 8px; margin-top: 12px; }
.repo-result { cursor: default; }

.tool-probe-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: var(--fs-caption);
}

.tool-probe-status.is-ok { background: var(--success-soft); color: var(--success-text); }
.tool-probe-status.is-error { background: var(--danger-soft); color: var(--danger-text); }

.provider-card.is-current {
  border-color: var(--direct-border);
  background: var(--direct-soft);
  box-shadow: inset 3px 0 0 var(--direct-fill);
  transition: border-color 160ms, background 160ms, box-shadow 160ms;
}

.drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 24px;
  flex: 0 0 auto;
  color: var(--text-3);
  opacity: 0;
  transition: opacity 150ms;
}

.drag-handle svg { width: 14px; height: 14px; }
.provider-card:hover .drag-handle { opacity: 1; }

.provider-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-subtle);
  background: color-mix(in srgb, var(--icon-color, var(--text-1)) 12%, transparent);
  color: var(--icon-color, var(--text-1));
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
}

.provider-icon.is-logo { background: var(--bg-card); }
.provider-icon-img { width: 22px; height: 22px; object-fit: contain; }

@media (prefers-color-scheme: dark) {
  .provider-icon.is-logo.is-dark-ink { background: #fff; padding: 4px; }
}

.provider-main {
  min-width: 0;
  flex: 1 1 auto;
}

.provider-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.provider-name {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--text-1);
  font-size: var(--fs-strong);
  line-height: var(--lh-strong);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.provider-sub {
  margin-top: 2px;
  overflow: hidden;
  color: var(--text-2);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 18px;
  flex: 0 0 auto;
  padding: 0 6px;
  border-radius: 999px;
  font-size: var(--fs-badge);
  line-height: 18px;
  font-weight: 500;
  white-space: nowrap;
}

.chip-success { background: var(--success-soft); color: var(--success-text); }
.chip-warning { background: var(--warning-soft); color: var(--warning-text); }
.chip-danger { background: var(--danger-soft); color: var(--danger-text); }
.chip-direct { background: var(--direct-soft); color: var(--direct-text); }
.chip-muted { background: var(--bg-subtle); color: var(--text-2); }
.chip-outline { border: 1px solid var(--border-strong); color: var(--text-2); }

.provider-usage {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  width: 136px;
  flex: 0 0 auto;
}

.usage-text {
  color: var(--text-2);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.usage-bar {
  display: block;
  width: 96px;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-subtle);
}

.usage-bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--success);
}

.usage-bar > i.is-warn { background: var(--warning); }
.usage-bar > i.is-off { background: var(--danger); }

.provider-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}

/* 聚合供应商卡的「状态胶囊 + 写入配置」需要更松的间距。 */
.client-write-actions { gap: 8px; }

.provider-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 64px;
  justify-content: flex-end;
  padding: 0 4px;
  color: var(--text-1);
  font-size: var(--fs-body);
  font-weight: 500;
  white-space: nowrap;
}

.provider-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--direct-fill);
}

/* 卡片右上「更多」菜单 */
.card-menu {
  position: absolute;
  top: 48px;
  right: 12px;
  z-index: 20;
  width: 184px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
}

.card-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text-1);
  font-size: var(--fs-body);
  text-align: left;
  cursor: pointer;
}

.card-menu-item:hover { background: var(--bg-subtle); }
.card-menu-item:disabled { opacity: 0.45; cursor: not-allowed; }
.card-menu-item.is-danger { color: var(--danger-text); }
.card-menu-sep { height: 1px; margin: 4px 0; background: var(--border); }

/* 空态：CC Switch 的虚线空卡 */
.empty-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 92px;
  padding: 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-panel);
  color: var(--text-2);
  font-size: var(--fs-body);
  text-align: center;
}

.empty-text {
  margin: 4px 0;
  color: var(--text-3);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
}

/* ---------- 应用页（CC Switch AppsPage 的表格式布局） ---------- */

.apps-table {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--bg-card);
}

.apps-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 168px 96px 100px 28px;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-3);
  font-size: var(--fs-caption);
  font-weight: 600;
}

.apps-section-title {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: var(--fs-caption);
  font-weight: 600;
}

.app-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 168px 96px 100px 28px;
  align-items: center;
  gap: 16px;
  min-height: 58px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.app-row:last-child { border-bottom: 0; }
.app-row:hover { background: var(--bg-subtle); }

.app-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  cursor: pointer;
}

.app-cell .app-glyph { flex: 0 0 auto; }

.app-name { min-width: 0; }

.app-name strong {
  display: block;
  overflow: hidden;
  color: var(--text-1);
  font-size: var(--fs-strong);
  line-height: var(--lh-strong);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-name span {
  display: block;
  overflow: hidden;
  color: var(--text-2);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}

.app-state-sub {
  overflow: hidden;
  color: var(--text-3);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-actions {
  display: flex;
  justify-content: flex-end;
}

.app-toggle-cell {
  display: flex;
  align-items: center;
}

/* CC Switch 的「侧栏显示」开关。 */
.switch {
  position: relative;
  width: 32px;
  height: 18px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--control-off);
  cursor: pointer;
  transition: background-color 150ms;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 150ms;
}

.switch.is-on { background: var(--action-bg); }
.switch.is-on::after { transform: translateX(14px); }
.switch:disabled { opacity: 0.45; cursor: not-allowed; }

/* 深色模式的开态轨道是白色，白色滑块要反过来才看得见。 */
@media (prefers-color-scheme: dark) {
  .switch.is-on::after { background: #18181b; }
}

.app-actions .btn { height: var(--h-control-sm); padding: 0 10px; font-size: var(--fs-caption); }

.app-more { justify-self: end; }

/* ---------- 用量统计（CC Switch UsageDashboard 的指标条 + 趋势 + 表格） ---------- */

.usage-hero {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--bg-card);
}

.metric-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 12px 16px 14px;
  border-right: 1px solid var(--border);
}

.metric-cell:last-child { border-right: 0; }

.metric-cell span {
  color: var(--text-2);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
}

.metric-cell strong {
  overflow: hidden;
  color: var(--text-1);
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-cell em {
  color: var(--text-3);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  font-style: normal;
}

.usage-panel { padding-bottom: 12px; }

.usage-chart {
  width: 100%;
  height: 200px;
}

.usage-chart svg { display: block; width: 100%; height: 100%; }

.usage-chart .grid-line { stroke: var(--border); stroke-width: 1; }
.usage-chart .axis-label { fill: var(--text-3); font-size: 11px; }
.usage-chart .line-in { fill: none; stroke: var(--chart-in); stroke-width: 2; }
.usage-chart .line-out { fill: none; stroke: var(--chart-out); stroke-width: 2; }
.usage-chart .area-in { fill: var(--chart-in); opacity: 0.08; }
.usage-chart .area-out { fill: var(--chart-out); opacity: 0.08; }

.usage-legend {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  color: var(--text-2);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
}

.usage-legend span { display: inline-flex; align-items: center; gap: 6px; }

.usage-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.legend-in { background: var(--chart-in); }
.legend-out { background: var(--chart-out); }

.usage-tabs {
  display: flex;
  gap: 2px;
  margin-top: 12px;
  border-bottom: 1px solid var(--border);
}

.usage-tab {
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-2);
  font-size: var(--fs-body);
  font-weight: 500;
  cursor: pointer;
}

.usage-tab:hover { color: var(--text-1); }

.usage-tab.is-selected {
  border-bottom-color: var(--action-bg);
  color: var(--text-1);
  font-weight: 600;
}

.usage-table-wrap {
  overflow: hidden;
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--bg-card);
}

.usage-table-head,
.usage-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.6fr) 96px 96px;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
}

.usage-table-head {
  border-bottom: 1px solid var(--border);
  color: var(--text-3);
  font-size: var(--fs-caption);
  font-weight: 600;
}

/* P9-12（2026-11-25 用户实测「表头与数据列不对齐」）：数值列（第 3/4 格）的
 * 数据单元格带 .usage-num（右对齐 + tabular-nums），表头却是裸 span（左对齐），
 * 视觉上就是"标题和数字错开一条缝"。这里让表头同列也右对齐，纵向成线。
 * 用 DOM 位置选 nth-child 而不是复用 .usage-num：类会顺带改颜色（text-2），
 * 表头应保持 text-3；窄屏隐藏第 2 列后 DOM 位置不变，规则依旧成立。 */
.usage-table-head span:nth-child(3),
.usage-table-head span:nth-child(4) { text-align: right; }

.usage-row {
  min-height: 44px;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-body);
}

.usage-row:last-child { border-bottom: 0; }
.usage-row:hover { background: var(--bg-subtle); }

/* 状态胶囊是网格项，默认会被拉满整列；只占自己的文字宽度。 */
.usage-row > .chip { justify-self: start; }

.usage-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.usage-name img {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  object-fit: contain;
}

.usage-name strong {
  overflow: hidden;
  color: var(--text-1);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usage-sub {
  overflow: hidden;
  color: var(--text-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usage-num {
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

@media (max-width: 720px) {
  .apps-head { grid-template-columns: minmax(0, 1fr) 96px 28px; }
  .apps-head span:nth-child(3),
  .apps-head span:nth-child(4) { display: none; }
  .app-row { grid-template-columns: minmax(0, 1fr) 96px 28px; }
  .app-row .app-toggle-cell,
  .app-row .app-actions { display: none; }

  .usage-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-cell:nth-child(2) { border-right: 0; }
  .metric-cell:nth-child(3),
  .metric-cell:nth-child(4) { border-top: 1px solid var(--border); }

  .usage-table-head,
  .usage-row { grid-template-columns: minmax(0, 1.4fr) 88px 80px; }
  /* P9-12（2026-11-25 窄屏复验发现的既有错位）：旧规则藏 `.usage-sub` 会把明细行
   * 的**时间格和说明格一起藏掉**（两格共用同一类）⇒ 表头剩 3 项、数据行只剩
   * 2 项，数字落进错误的列（积分跑进 1.4fr 轨道、余额顶到 88px）。改为按 DOM
   * 第 2 格隐藏 —— 与表头的 `span:nth-child(2)` 同口径：明细藏「说明」、模型藏
   * 「线路」，时间列照常保留，三个可见格与三列轨道一一对应。 */
  .usage-table-head span:nth-child(2),
  .usage-row > span:nth-child(2) { display: none; }
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--h-control);
  flex: 0 0 auto;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: transparent;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms, border-color 150ms, color 150ms, filter 150ms, scale 100ms;
}

.btn:active:not(:disabled) { scale: 0.96; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn > svg { width: 16px; height: 16px; }

.btn.solid {
  border-color: transparent;
  background: var(--action-bg);
  color: var(--action-fg);
  font-weight: 600;
}

.btn.solid:hover:not(:disabled) { background: var(--action-hover); }

.btn.neutral {
  border-color: var(--border-strong);
  background: var(--bg-card);
  color: var(--text-1);
}

.btn.neutral:hover:not(:disabled) { background: var(--bg-subtle); }

.btn.quiet {
  border-color: transparent;
  background: transparent;
  color: var(--text-2);
}

.btn.quiet:hover:not(:disabled) { background: var(--bg-subtle); color: var(--text-1); }

.btn.icon {
  width: var(--h-control-sm);
  height: var(--h-control-sm);
  padding: 0;
}

.btn.icon > svg { width: 16px; height: 16px; }

/* ---------- 概览 / 面板 ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--bg-card);
}

.stat-label {
  color: var(--text-2);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
}

.stat-value {
  overflow: hidden;
  color: var(--text-1);
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-meta {
  overflow: hidden;
  color: var(--text-3);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.panel {
  min-width: 0;
  margin-bottom: 8px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--bg-card);
}

.panel:last-child { margin-bottom: 0; }

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head h2 {
  margin: 0;
  color: var(--text-1);
  font-size: var(--fs-strong);
  line-height: var(--lh-strong);
  font-weight: 600;
}

.panel-meta {
  color: var(--text-3);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
}

/* 概览「今日用量」的三格卡片。🔴 不能叫 .usage-row：用量统计表格的行也叫
   这个名字，后定义的 3 列栅格会把表格的 4 列挤成两行。 */
.usage-cells {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.usage-cell {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-subtle);
}

.usage-cell span {
  display: block;
  color: var(--text-2);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
}

.usage-cell strong {
  display: block;
  overflow: hidden;
  color: var(--text-1);
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.switch-box { min-height: 64px; }

.switch-event {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.switch-event strong {
  color: var(--text-1);
  font-size: var(--fs-strong);
  line-height: var(--lh-strong);
  font-weight: 500;
}

.switch-event span {
  color: var(--text-2);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
}

/* ---------- 账户 / 设置 ---------- */

/* 内嵌登录卡（不跳 /login 网页；本地模拟账号）。 */
.login-panel {
  max-width: 460px;
  margin: 8px auto 0;
  padding: 24px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.login-title {
  margin: 0;
  color: var(--text-1);
  font-size: var(--fs-page);
  line-height: var(--lh-page);
  font-weight: 600;
}

.login-sub {
  margin: 4px 0 0;
  color: var(--text-3);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field > span {
  color: var(--text-2);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  font-weight: 500;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--bg-card);
  color: var(--text-1);
  font-size: var(--fs-body);
  outline: 0;
  transition: border-color 150ms, box-shadow 150ms;
}

.form-field input::placeholder,
.form-field textarea::placeholder { color: var(--text-3); }

.form-field textarea {
  height: 72px;
  padding: 8px 10px;
  resize: vertical;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--action-bg);
  box-shadow: 0 0 0 3px var(--action-soft);
}

.login-actions {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.login-actions .btn { height: 36px; }
.login-actions .btn.solid { flex: 1 1 auto; }

/* 登录卡 ↔ 注册卡的切换行（P1-27 内嵌注册）。链接色跟品牌主操作色。 */
.login-switch {
  margin: 4px 0 0;
  color: var(--text-3);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  text-align: center;
}

.login-switch a {
  color: var(--action-bg);
  text-decoration: none;
  font-weight: 500;
}

.login-switch a:hover { text-decoration: underline; }

/* 注册卡：账号类型说明与错误提示复用 .message / .hint-text，这里只补布局差。 */
#account-register .form-field select { color: var(--text-1); }
#account-register .form-field select:disabled { color: var(--text-3); background: var(--bg-subtle); }

/* ---------- 账户中心 · 登录/注册合并卡（2026-11-23 用户定稿） ----------
 * 分段页签切换登录与邀请码注册；右侧推广位常驻，内容可在后台替换。 */

.account-auth {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  max-width: 760px;
}

.account-auth-form {
  max-width: none;
  margin: 0;
  padding: 16px 20px;
}

.account-auth-form .login-brand { margin-bottom: 12px; }

.account-auth-tabs { margin: 0 0 10px; }

.account-auth-panel { min-width: 0; }

/* 注册字段多，收紧一点行距，让 1000×650 窗口里不用滚动。 */
.account-auth-form .form-field { margin-bottom: 6px; }

.account-auth-ad {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.account-ad-card {
  position: relative;
  overflow: hidden;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background:
    radial-gradient(90% 70% at 100% 0%, rgba(229, 136, 80, .18), transparent 62%),
    radial-gradient(85% 70% at 0% 100%, rgba(84, 175, 170, .14), transparent 60%),
    var(--bg-card);
}

.account-ad-tag {
  display: inline-block;
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-3);
  font-size: var(--fs-badge);
  line-height: 16px;
  letter-spacing: .3px;
}

.account-ad-card h3 {
  margin: 12px 0 4px;
  color: var(--text-1);
  font-size: var(--fs-page);
  line-height: var(--lh-page);
  font-weight: 600;
}

.account-ad-card p {
  margin: 0;
  color: var(--text-2);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
}

.account-ad-card ul {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-2);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
}

.account-ad-card li {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.account-ad-card li::before {
  content: "✓";
  color: var(--action-bg);
  font-weight: 700;
}

.account-ad-cta {
  margin-top: 14px;
  height: 32px;
  text-decoration: none;
}

.account-ad-mark {
  position: absolute;
  right: -18px;
  bottom: -22px;
  width: 132px;
  height: 132px;
  object-fit: contain;
  opacity: .06;
  pointer-events: none;
}

@media (prefers-color-scheme: dark) {
  .account-ad-mark { filter: invert(1); opacity: .1; }
}

.account-ad-slot {
  height: 96px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-panel);
  color: var(--text-3);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  letter-spacing: .3px;
}

.account-ad-foot {
  text-align: center;
  color: var(--text-3);
  font-size: var(--fs-badge);
  line-height: 16px;
}

@media (max-width: 820px) {
  .account-auth { grid-template-columns: minmax(0, 1fr); }
}

.account-stats { margin-top: 8px; }

/* 积分明细 / 设备列表（两列：主信息 + 右侧数值）。 */
.account-list { display: flex; flex-direction: column; }

.account-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.account-list-row:last-child { border-bottom: 0; }

.account-list-main,
.account-list-side {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.account-list-side {
  align-items: flex-end;
  flex: 0 0 auto;
}

.account-list-main strong {
  overflow: hidden;
  color: var(--text-1);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-list-sub {
  overflow: hidden;
  color: var(--text-3);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-delta {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.account-delta.is-neg { color: var(--danger-text); }
.account-delta.is-pos { color: var(--success-text); }

#account-chart { height: 176px; }


.account-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
}

.account-ident {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.account-ident strong {
  display: block;
  color: var(--text-1);
  font-size: var(--fs-strong);
  line-height: var(--lh-strong);
  font-weight: 600;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--action-soft);
  color: var(--action-text);
  font-size: 16px;
  font-weight: 600;
}

.account-balance {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  text-align: right;
}

.balance-value {
  color: var(--text-1);
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hint-text {
  margin: 10px 0 0;
  color: var(--text-3);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
}

.kv-list { margin: 0; }

.kv-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.kv-list > div:last-child { border-bottom: 0; }

.kv-list dt {
  color: var(--text-2);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
}

.kv-list dd {
  margin: 0;
  color: var(--text-1);
  font-size: var(--fs-body);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ---------- 弹层（CC Switch Dialog） ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--overlay);
}

.modal-card {
  width: min(520px, 100%);
  max-height: 80vh;
  overflow-y: auto;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  box-shadow: var(--shadow-lg);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-head h2 {
  margin: 0;
  color: var(--text-1);
  font-size: var(--fs-title);
  line-height: var(--lh-title);
  font-weight: 600;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.modal-heading h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 编辑小海豚：模型列表 + 子代理（对齐 CC Switch） */
.modal-card.is-editor {
  width: min(920px, 100%);
  max-height: 88vh;
  padding: 18px 20px;
}

.modal-card.is-editor .modal-body { gap: 0; }

.editor-note {
  margin: 0 0 10px;
  color: var(--text-2);
  font-size: var(--fs-caption);
}

.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 10px;
}

.editor-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.editor-title h3 {
  margin: 0;
  color: var(--text-1);
  font-size: var(--fs-body);
  font-weight: 600;
}

.editor-info {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-3);
  font-size: 10px;
  line-height: 1;
  cursor: help;
}

.editor-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.editor-table {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.editor-grid {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) minmax(0, 1fr) 120px minmax(0, 1fr) 32px;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
}

/* 追加式客户端：显示名 + 实际模型 + 展开能力 + 删除。 */
.editor-grid.is-simple {
  grid-template-columns: 20px minmax(0, 1.2fr) minmax(0, 1fr) 28px 32px;
}

/* 追加式模型行的展开详情（工具调用/图片/思考、思考等级、token 上限）。 */
.editor-details {
  display: grid;
  gap: 10px;
  margin: 0 10px 10px 30px;
  padding: 10px 12px;
  border-left: 2px solid var(--border);
  background: var(--bg-subtle);
  border-radius: 0 6px 6px 0;
}
.editor-details.hidden { display: none; }

.editor-caps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.editor-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-1);
  font-size: var(--fs-caption);
  cursor: pointer;
}

.editor-row .editor-check input {
  width: 14px;
  height: 14px;
  padding: 0;
  border: 0;
  accent-color: var(--action-bg);
}

.editor-efforts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.editor-label {
  color: var(--text-2);
  font-size: var(--fs-caption);
}

.effort-chip {
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-2);
  font-size: var(--fs-caption);
  cursor: pointer;
}
.effort-chip.is-on {
  border-color: var(--action-bg);
  background: var(--action-soft);
  color: var(--text-1);
}
.effort-chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.editor-tokens {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.editor-token { display: grid; gap: 5px; }
.editor-token input { margin-top: 0; }

.editor-expand {
  justify-self: center;
  padding: 0 4px;
}
.editor-expand svg { transition: transform 0.15s ease; }
.editor-row.is-open .editor-expand svg { transform: rotate(90deg); }

.editor-grid-head {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  font-size: var(--fs-caption);
  font-weight: 500;
}

.editor-rows {
  max-height: 270px;
  overflow-y: auto;
}

.editor-row { border-top: 1px solid var(--border); }
.editor-row:first-child { border-top: 0; }
.editor-row.is-dragging { opacity: 0.45; }

.editor-grip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  cursor: grab;
}

.editor-row input,
.editor-row select,
.editor-subagent select,
.editor-section input {
  width: 100%;
  height: 30px;
  min-width: 0;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--bg-card);
  color: var(--text-1);
  font-size: var(--fs-caption);
  outline: 0;
}

.editor-row input:focus,
.editor-row select:focus,
.editor-subagent select:focus,
.editor-section input:focus {
  border-color: var(--action-bg);
  box-shadow: 0 0 0 3px var(--action-soft);
}

.editor-del { justify-self: end; }

.editor-section { margin-top: 16px; }

.editor-subagent {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 10px;
  margin-top: 8px;
}

.editor-section input { margin-top: 8px; }

@media (max-width: 760px) {
  .editor-grid {
    grid-template-columns: 16px minmax(0, 1fr) minmax(0, 1fr) 92px minmax(0, 1fr) 28px;
    gap: 6px;
  }
  .editor-grid.is-simple {
    grid-template-columns: 16px minmax(0, 1fr) minmax(0, 1fr) 24px 28px;
  }
  .editor-details { margin-left: 24px; }
  .editor-tokens { grid-template-columns: 1fr; }
  .editor-subagent { grid-template-columns: 1fr; }
}

.plan-list {
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.plan-list li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
}

.plan-list li:last-child { border-bottom: 0; }

.plan-list code,
.detail-model {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--text-2);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11px;
  line-height: 18px;
}

.plan-list code { flex: 0 0 auto; }

.plan-note {
  margin: 0;
  color: var(--text-2);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
}

.detail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-models {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-models-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}

.detail-models-head span {
  color: var(--text-3);
  font-size: var(--fs-caption);
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

/* ---------- Toast（右下角卡片） ---------- */

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  max-width: 420px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-3);
  border-radius: var(--radius-panel);
  background: var(--bg-card);
  color: var(--text-1);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  box-shadow: var(--shadow-md);
}

.toast.is-ok { border-left-color: var(--success); }
.toast.is-error { border-left-color: var(--danger); }

/* ---------- 折叠侧栏（CC Switch 72px 图标轨） ---------- */

.csw.is-collapsed .shell { grid-template-columns: 72px minmax(0, 1fr); }

.csw.is-collapsed .brand { margin: 0 auto; padding: 0; }
.csw.is-collapsed .brand-name,
.csw.is-collapsed .nav-label,
.csw.is-collapsed .nav-trailing,
.csw.is-collapsed .nav-tag { display: none; }

.csw.is-collapsed .side-top {
  flex-direction: column;
  height: 72px;
  gap: 6px;
  justify-content: center;
  padding: 8px 0 4px;
}
.csw.is-collapsed .side-collapse { display: inline-flex; }

.csw.is-collapsed .nav-row {
  width: 48px;
  margin-left: auto;
  margin-right: auto;
  padding: 0;
  justify-content: center;
}

.csw.is-collapsed .side-divider { margin-left: 18px; margin-right: 18px; }
.csw.is-collapsed .side-apps .empty-text { display: none; }

/* ---------- 响应式 ---------- */

@media (max-width: 959px) {
  .shell { grid-template-columns: 72px minmax(0, 1fr); }

  .brand { margin: 0 auto; padding: 0; }
  .brand-name,
  .nav-label,
  .nav-trailing,
  .nav-tag { display: none; }
  .side-apps .empty-text { display: none; }

  .side-top {
    flex-direction: column;
    height: 72px;
    gap: 6px;
    justify-content: center;
    padding: 8px 0 4px;
  }
  .side-collapse { display: inline-flex; }

  .nav-row {
    width: 48px;
    margin-left: auto;
    margin-right: auto;
    padding: 0;
    justify-content: center;
  }

  .side-divider { margin-left: 18px; margin-right: 18px; }
}

@media (max-width: 720px) {
  .page-head { gap: 12px; padding: 0 12px 0 16px; }
  .head-sub { display: none; }
  .mode-row { padding: 12px 16px 0; }
  .content { padding: 12px 16px 40px; }

  .seg-btn { min-width: 0; padding: 0 12px; }
  .search-wrap { width: 180px; }

  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }

  .provider-usage { display: none; }
  .provider-card { gap: 8px; padding-right: 8px; }
  .drag-handle { display: none; }
  .hint-code { display: none; }
}

/* ---------- 支付中心（P8 未开放形态先行，方案 §3.4） ---------- */

/* P8-11 没登录注册广告引导卡：内容全部来自服务端下发，这里只管版式。 */
.login-panel.is-promo {
  max-width: 560px;
  padding: 20px;
}

.pay-promo {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pay-promo-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.pay-promo-tag {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--action-soft);
  color: var(--action-text);
  font-size: var(--fs-badge);
  line-height: var(--lh-badge);
  font-weight: 600;
}

.pay-promo-paths {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.pay-promo-path {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--bg-subtle);
}

.pay-promo-path h3 {
  margin: 0;
  color: var(--text-1);
  font-size: var(--fs-strong);
  line-height: var(--lh-strong);
  font-weight: 600;
}

.pay-promo-path p {
  margin: 0;
  color: var(--text-3);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
}

.pay-promo-path .btn { align-self: flex-start; }

.pay-promo-cs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pay-cs-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
}

.pay-cs-label {
  flex: 0 0 auto;
  color: var(--text-3);
}

.pay-cs-value {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--text-1);
  font-family: "SF Mono", "Cascadia Mono", Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pay-cs-copy {
  flex: 0 0 auto;
  height: var(--h-control-sm);
  padding: 0 10px;
  border-color: var(--border);
  background: var(--bg-card);
  color: var(--text-2);
  font-size: var(--fs-caption);
}

.pay-cs-copy:hover { background: var(--bg-selected); }

.pay-cs-note {
  margin: 0;
  color: var(--text-3);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
}

#pay-login-foot-hint { margin: 14px 0 8px; }

@media (max-width: 720px) {
  .pay-promo-paths { grid-template-columns: minmax(0, 1fr); }
}

.pay-notice {
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: 13px;
}

.pay-tiers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.pay-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.pay-amount { font-size: 20px; line-height: 1.2; color: var(--text-1); }
.pay-points { font-size: 12px; color: var(--text-2); }
.pay-btn { margin-top: 4px; align-self: stretch; }

/* 骨架占位条：无金额数字，服务端价目表上线后由真实展示串替换。 */
.sk {
  display: block;
  border-radius: var(--radius-control);
  background: var(--bg-subtle);
  animation: pay-shimmer 1.4s ease-in-out infinite;
}
.sk-amount { width: 72px; height: 20px; }
.sk-points { width: 110px; height: 12px; }
.sk-btn { width: 100%; height: 32px; margin-top: 4px; }

@keyframes pay-shimmer {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* P8-10b：订单状态条与兜底键（我已支付 / 复制支付链接）。 */
.pay-order { font-size: 13px; color: var(--text-2); }
.pay-order.is-done { color: var(--ok, #16a34a); }
.pay-actions { display: flex; gap: 8px; margin-top: 10px; }
.pay-actions .btn { height: var(--h-control-sm, 30px); padding: 0 12px; font-size: 12px; }
.pay-actions.hidden { display: none; }

/* P9-14：兑换码卡改版（2026-11-25）。页签行（套餐卡/积分码）+ 输入行 +
   卡底内嵌客服卡；页签复用 seg-btn 的选中态，只把尺寸收到卡内一行。 */
.pay-redeem-tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  margin-top: 4px;
  border-radius: 10px;
  background: var(--bg-subtle);
}
.pay-redeem-tabs .seg-btn {
  min-width: 0;
  height: 28px;
  padding: 0 14px;
  font-size: var(--fs-caption);
}
.pay-redeem { display: flex; gap: 8px; margin-top: 10px; }
.pay-redeem .input {
  flex: 1 1 auto;
  min-width: 0;
  height: var(--h-control-sm, 30px);
  font-size: 13px;
}
.pay-redeem .btn { height: var(--h-control-sm, 30px); padding: 0 16px; font-size: 12px; flex: 0 0 auto; }

/* P9-14b：兑换卡主体 = 左列（页签+缩短的兑换框+提示+广告位）+ 右列客服卡
   （用户截图点名：兑换框缩短、边上加客服）。左列纵向排布，广告位撑满剩余
   高度、与客服卡等高；窄屏降单列。 */
.pay-redeem-grid {
  display: flex;
  gap: 16px;
  align-items: stretch;
  margin-top: 4px;
}
.pay-redeem-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.pay-redeem-tabs { align-self: flex-start; }
.pay-redeem-main .hint-text { margin: 6px 0 0; line-height: var(--lh-caption); }

/* P9-14b：右侧客服卡。联系方式是服务端下发的原文，每颗号码配复制键；
   微信搜一搜按钮点了同样复制微信号。头像用本机自带应用图标。 */
.pay-redeem-cs {
  flex: 0 0 auto;
  width: 236px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-panel);
  background: var(--bg-subtle);
}
.pay-redeem-cs.hidden { display: none; }
.pay-redeem-cs-top {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-width: 0;
}
.pay-redeem-cs-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
}
.pay-redeem-cs-id { flex: 1 1 auto; min-width: 0; }
.pay-redeem-cs-head {
  margin: 0 0 6px;
  color: var(--text-1);
  font-size: var(--fs-caption);
  font-weight: 600;
}
.pay-redeem-cs .pay-cs-row { justify-content: flex-start; }
.pay-redeem-cs .pay-cs-value { flex: 1 1 auto; }
.pay-redeem-cs .pay-cs-copy { padding: 0 8px; }

/* P9-14c：QQ 二维码（本机资产，运营 QQ 加好友卡裁剪版）+ 底部一句提示。
   白底卡片状呈现，扫码直达加好友。 */
.pay-redeem-cs-qr {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: #fff;
}
.pay-redeem-cs-qr-tip {
  margin: 0;
  text-align: center;
  color: var(--text-3);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
}

@media (max-width: 720px) {
  .pay-redeem-grid { flex-direction: column; }
  .pay-redeem-cs { width: auto; }
}

/* P9-14e：窗口固定尺寸后，广告位回到**撑满左列剩余高度**（与右侧客服卡
   等高、底边对齐）——画布恒定 1000×650，槽尺寸也随之恒定，不再有
   "最大化就变样"的问题。将来下发的素材用 object-fit:cover 铺放不变形；
   内容由运营经服务端下发，前端不写死素材；无内容时保持虚线空槽。 */
.pay-ad-slot {
  flex: 1 1 auto;
  min-height: 120px;
  margin-top: 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-panel);
  background: var(--bg-subtle);
  overflow: hidden;
}
.pay-ad-slot img,
.pay-ad-slot iframe {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* P9-14f：广告素材深浅色跟随系统主题 —— 默认显浅色版，
   深色系统切深色版。双 class 选择器压过上面的 .pay-ad-slot img 基线。 */
.pay-ad-slot .pay-ad-img-dark { display: none; }

@media (prefers-color-scheme: dark) {
  .pay-ad-slot .pay-ad-img-light { display: none; }
  .pay-ad-slot .pay-ad-img-dark { display: block; }
}

@media (max-width: 720px) {
  .pay-tiers { grid-template-columns: 1fr; }
}
