/* app.css · 小海豚 2.7.0 网页前端共用样式（T2）
 * 🔴 零外部资源：无 @import、无 url()、无 CDN、无外部字体；字体只用系统字体栈，离线可完整渲染。
 */

:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1c1f24;
  --muted: #5b6572;
  --line: #dfe3e8;
  --accent: #0b57d0;
  --danger: #b3261e;
  /* 应用壳（2026-11-17）：圆角收敛成两枚变量，账单页与登录页共用同一套 ⇒ 风格天然对齐。 */
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 24px 16px 48px;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

main {
  max-width: 880px;
  margin: 0 auto;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.card--narrow {
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; color: var(--muted); }

/* 版面改造（2026-11-17）：卡内多列栅格 —— 概览三列、兑换两列；窄屏自动堆叠为单列。 */
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 24px; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.pane { min-width: 0; }
.cols-3 > dl > dt:first-child { margin-top: 0; }

.muted { color: var(--muted); margin: 0 0 16px; }

label { display: block; margin: 12px 0 4px; font-weight: 600; }

input {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

select {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button {
  font: inherit;
  padding: 9px 16px;
  margin: 16px 8px 0 0;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

button.secondary {
  color: var(--ink);
  background: #eef1f5;
  border: 1px solid var(--line);
}

button[disabled] { opacity: .55; cursor: default; }

.message { min-height: 24px; margin: 12px 0 0; }
.message.error { color: var(--danger); }
.message.done { color: #14672e; }

dl { margin: 0; }
dt { color: var(--muted); font-size: 14px; margin-top: 10px; }
dd { margin: 2px 0 0; font-size: 17px; }

dd.amount { font-size: 26px; font-weight: 700; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 15px;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}

th { color: var(--muted); font-weight: 600; font-size: 14px; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* T22：时间列两行（发生日 / 记账时刻）；ref 详情悬停看 title、点一下在本格展开。
 * 版面改造（2026-11-17）：pre-line 会让「发生 2026-11-08」在窄列里折成两三行、
 * 行高爆掉（真机截图实锤），改为 pre：保留换行符但每行内部不再折行。 */
td.ledger-time { white-space: pre; }
td.ref-cell { cursor: pointer; color: var(--accent); }

/* 版面改造（2026-11-17）：增减列按符号着色（纯排版，判据仍在服务端）；
 * 机器码等宽字体 + 缩写显示（全值在 title）。 */
td.delta-neg { color: var(--danger); text-align: right; font-variant-numeric: tabular-nums; }
td.delta-pos { color: #14672e; text-align: right; font-variant-numeric: tabular-nums; }
td.machine-code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
td.ref-cell.show-ref::after {
  content: attr(data-ref);
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* 用量图表（2026-11-17 方案三）：手画 SVG 堆叠柱状图（固定 30 日历槽）；窄屏整图横向滚动，不挤压别的卡。 */
.usage-chart-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.usage-chart-wrap svg { display: block; width: 100%; height: auto; min-width: 480px; }
.bar-in { fill: var(--accent); }
.bar-out { fill: #14672e; }
.chart-axis { stroke: var(--line); stroke-width: 1; }
.chart-label { fill: var(--muted); font-size: 12px; }

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

.pager { color: var(--muted); font-size: 14px; margin: 8px 0 0; }

ul.notes { margin: 8px 0 0; padding-left: 20px; color: var(--muted); }

.hidden { display: none; }

a { color: var(--accent); }

/* 版面改造（2026-11-17）：中等宽度以下卡内栅格先降为单列，避免三列各挤 ~280px。 */
@media (max-width: 720px) {
  .cols-3, .cols-2 { grid-template-columns: 1fr; gap: 16px 0; }
  .cols-3 > dl > dt:first-child { margin-top: 0; }
  .cols-3 > dl + dl, .cols-2 > .pane + .pane { border-top: 1px solid var(--line); padding-top: 12px; }
}

/* ---------- 登录页（2026-11-17 用户点名：与账单页统一设计） ----------
 * 桌面左右分栏：左列品牌说明、右列表单；窄屏（≤860px）降单列。
 * 左右都用同一套 --card/--line/--accent/--radius 变量，与账单页共用本文件
 * ⇒ 两页的圆角、边框、配色天然一致，不新增任何外部资源。 */
.auth {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 20px;
  align-items: start;
}

.auth-brand {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 32px;
}

.auth-logo { width: 48px; height: 48px; color: var(--accent); }

.auth-logo svg { display: block; width: 100%; height: 100%; }

.auth-brand h1 { font-size: 26px; margin: 16px 0 4px; }

.auth-tagline { color: var(--muted); margin: 0 0 20px; }

.auth-points {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 15px;
}

.auth-points li { position: relative; padding-left: 18px; margin-bottom: 10px; }

.auth-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .6;
}

.auth-main { min-width: 0; }

/* 右列本身已经是 420px：卡片的窄版上限在这里让位给列宽，避免双重居中留白。 */
.auth-main .card--narrow { max-width: none; }

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; gap: 16px; }
  .auth-brand { padding: 24px 20px; }
  .auth-brand h1 { font-size: 22px; }
}

@media (max-width: 520px) {
  body { padding: 16px 10px 32px; }
  .card { padding: 18px; }
  dd.amount { font-size: 22px; }
}

/* ---------- 紧凑登录窗（2026-11-17 用户点名） ----------
 * 结构对齐用户给的参考图：用户名 / 密码 / 全宽登录 / 免费版入口 / 邀请码注册。
 * 窗口本体由 WebView2 宿主按 /login 自动收成小窗；本文件只负责卡片内部的紧凑排版。
 * 仍只用 --bg/--card/--ink/--muted/--line/--accent/--radius 这套既有变量。 */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px;
}

.login-shell {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-window {
  margin: 0;
  padding: 26px 28px 16px;
  /* 设计稿的登录/注册是「窗口」而不是普通卡片：圆角用 16px，与面板窗口一致。 */
  border-radius: 16px;
}

.login-brand {
  margin: 0 0 20px;
  text-align: center;
}

.login-brand .auth-logo {
  width: 40px;
  height: 40px;
  margin: 0 auto 8px;
}

.login-brand h1 {
  margin: 0;
  font-size: 20px;
}

.login-brand h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.login-brand .muted {
  margin: 4px 0 0;
  font-size: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.login-field {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.login-field input {
  height: 44px;
  padding: 0 44px 0 38px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.login-field input:hover { border-color: #b9c0c9; }

.login-field input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

/* 注册表单的下拉框与输入框同尺寸、同圆角；原生箭头隐藏，右侧用 chevron 图标。 */
.login-field select {
  width: 100%;
  height: 44px;
  padding: 0 44px 0 38px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.login-field select:hover { border-color: #b9c0c9; }

.login-field select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.login-field select:disabled {
  color: var(--muted);
  background: #f4f5f7;
  cursor: default;
}

/* 错误态：设计稿（login-error）里两个输入框都描红，改输入后即时清除。 */
.login-field.is-error input { border-color: var(--danger); }
.login-field.is-error input:hover { border-color: var(--danger); }
.login-field.is-error input:focus-visible {
  outline-color: var(--accent);
  border-color: var(--accent);
}
.login-field.is-error .login-field-icon { color: var(--danger); }

.login-field-icon,
.login-field-affix {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

.login-field-icon { left: 12px; }
.login-field-affix { right: 14px; }

.login-field-icon svg,
.login-field-affix svg {
  display: block;
  width: 100%;
  height: 100%;
}

.login-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.login-eye:hover { background: #eef1f5; color: var(--ink); }
.login-eye:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.login-eye svg { width: 16px; height: 16px; }
.login-eye .eye-closed { display: none; }
.login-eye[aria-pressed="true"] .eye-open { display: none; }
.login-eye[aria-pressed="true"] .eye-closed { display: block; }

.login-submit {
  width: 100%;
  height: 44px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  transition: transform .16s ease, filter .16s ease;
}

.login-submit svg { width: 16px; height: 16px; }
.login-submit:hover { transform: translateY(-1px); filter: brightness(1.06); }
.login-submit:active { transform: translateY(0); filter: brightness(.96); }
.login-submit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.login-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  font-size: 13px;
}

.login-links a,
.link-button {
  margin: 0;
  padding: 0;
  color: var(--accent);
  background: transparent;
  border: 0;
  font: inherit;
  cursor: pointer;
}

.link-button { color: var(--muted); }
.login-links a:hover,
.link-button:hover { text-decoration: underline; }
.login-links a:focus-visible,
.link-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.login-hint {
  margin: 10px 0 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
}

.login-forgot {
  margin: 12px 0 0;
  text-align: center;
  font-size: 12px;
}

.login-billing { margin: 0; text-align: center; }

/* 错误提示带（设计稿 login-error）：浅红底 + 圆形感叹号。
 * 文案仍由 JS 只写服务端原文，这里只负责形状。 */
.login-body .message.error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 4px 0 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--danger) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
  font-size: 12.5px;
  line-height: 1.5;
}

.login-body .message.error::before {
  content: "!";
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.login-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
}

.login-foot-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  text-align: center;
}

.login-status-dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: #14672e;
}

.login-register { padding: 24px 28px; }
.login-register h2 { margin-bottom: 4px; }
.login-register .muted { margin-bottom: 8px; }
.login-register .login-brand .muted { margin-bottom: 0; }
.login-register .login-field { margin-bottom: 12px; }
.login-register input,
.login-register select { height: 44px; }

@media (max-width: 520px) {
  .login-body { padding: 16px 10px 32px; }
  .login-window { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .login-submit,
  .login-eye {
    transition-duration: .01ms;
  }
}

/* ---------- 应用壳（2026-11-17 用户点名）：左侧菜单 + 右侧视图 ----------
 * 网格换位：HTML 里主内容在前、侧栏在最后（表头条数判据要词的全文首现落在各自小节，
 * 理由见 billing.html 文件头注释）；视觉左右完全由 grid-template-areas 决定。
 * 侧栏 sticky：内容滚、菜单留在视口内；每项左键点击切换（行为在 billing.js）。 */
.shell {
  max-width: 1160px;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  grid-template-areas: "side main";
  gap: 0 16px;
  align-items: start;
}

.shell-main { grid-area: main; min-width: 0; }

.shell-side {
  grid-area: side;
  position: sticky;
  top: 16px;
  padding: 16px 10px;
}

.side-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  margin: 0 0 6px;
  padding: 10px 12px;
  text-align: left;
  color: var(--ink);
  background: #eef1f5;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.side-item:hover { border-color: var(--accent); }

.side-item.is-active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.side-icon { width: 1.2em; height: 1.2em; flex: 0 0 auto; }

.side-foot {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.side-foot a { color: var(--muted); }
.side-foot a:hover { color: var(--accent); }

/* 窄屏（新起一块，上面那块 720px 卡内栅格规则照旧并行生效）：
 * 侧栏降为**顶部横条**——文字常显、可横向滚动，不做折叠菜单（零额外状态、零存储）。 */
@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; grid-template-areas: "side" "main"; gap: 12px 0; }
  .shell-side {
    position: static;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    overflow-x: auto;
    padding: 12px;
  }
  .side-item { width: auto; flex: 0 0 auto; margin: 0; white-space: nowrap; }
  .side-foot {
    flex: 0 0 auto;
    margin: 0 0 0 10px;
    padding: 0 0 0 10px;
    border-top: 0;
    border-left: 1px solid var(--line);
    white-space: nowrap;
  }
}

/* ---------- 账号面板（2026-11-17 用户点名）：品牌侧栏 + 用户中心概览 ----------
 * 五个视图 / 表格 / 图表的既有判据都不动，这里只加面板外观与概览卡的排版。 */
.shell { grid-template-columns: 220px minmax(0, 1fr); }

.panel-side {
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px 14px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.side-brand-mark { width: 30px; height: 30px; flex: none; color: var(--accent); }
.side-brand-name { font-size: 15px; font-weight: 600; line-height: 1.25; }
.side-brand-sub { font-size: 11px; color: var(--muted); }

.side-nav { display: flex; flex-direction: column; gap: 4px; }

.side-item.is-active {
  color: var(--accent);
  background: #e8f0fe;
  border-color: var(--accent);
}

.side-item.is-active .side-icon { color: var(--accent); }

.side-foot {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
}

.side-account { display: flex; flex-direction: column; gap: 2px; }
.side-account-label { font-size: 11px; color: var(--muted); }
.side-account-name { font-size: 12px; font-weight: 600; word-break: break-all; }
.side-version { font-size: 11px; color: #8a939e; }

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 20px 24px;
}

.panel-head-copy h1 { margin: 0; font-size: 20px; }
.panel-head-copy .muted { margin: 4px 0 0; font-size: 12.5px; }
.panel-head .toolbar { gap: 8px; }
.panel-head .toolbar button { margin-top: 0; }
.panel-head .message { flex-basis: 100%; margin: 0; }

.panel-view { display: flex; flex-direction: column; gap: 16px; }

.panel-card { margin: 0; padding: 18px 20px; }

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

.panel-card-head h2 { margin: 0; font-size: 14px; }
.panel-meta { font-size: 11.5px; color: var(--muted); }

.panel-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
}

.legend-in,
.legend-out {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--accent);
}

.legend-out { opacity: .45; margin-left: 6px; }

.panel-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 16px;
}

.ov-list { display: flex; flex-direction: column; }

.ov-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, .9fr) minmax(0, 1.1fr) minmax(0, .7fr);
  gap: 8px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}

.ov-row:last-child { border-bottom: 0; }
.ov-time { color: var(--muted); font-size: 12px; white-space: pre-line; line-height: 1.35; }
.ov-kind { color: var(--muted); }
.ov-model { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-delta { text-align: right; font-variant-numeric: tabular-nums; }
.ov-delta.delta-neg { color: var(--danger); }
.ov-delta.delta-pos { color: #14672e; }
.ov-row-device { grid-template-columns: minmax(0, 1fr) auto; }
.ov-machine { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; }
.ov-empty { margin: 6px 0 0; font-size: 12px; }

.linkish {
  margin: 0;
  padding: 0;
  font-size: 12px;
  color: var(--accent);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.linkish:hover { text-decoration: underline; }

@media (max-width: 900px) {
  .panel-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .panel-side {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    min-height: 0;
    padding: 12px;
  }
  .side-brand {
    flex: 0 0 auto;
    padding: 0;
    margin: 0;
    border-bottom: 0;
  }
  .side-brand-sub { display: none; }
  .side-nav { flex-direction: row; gap: 4px; }
  .side-item { width: auto; flex: 0 0 auto; margin: 0; white-space: nowrap; }
  .side-foot { display: none; }
  .panel-head { padding: 16px 18px; }
  .panel-card { padding: 16px 18px; }
}

/* ---------- 账号面板 · 按设计画布落地（2026-11-17） ---------- */

  *, *::before, *::after { box-sizing: border-box; }
  body { margin: 0; background: var(--xht-background); }

  .xht-stage {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 24px;
    background: var(--xht-background);
  }

  .xht-window {
    width: 100%;
    max-width: 1240px;
    min-height: 760px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--xht-card);
    border: 1px solid var(--xht-border);
    border-radius: var(--xht-radius-lg);
    box-shadow: var(--xht-shadow-2);
  }

  /* 标题栏 */
  .xht-titlebar {
    flex: none;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 8px 0 14px;
    background: var(--xht-card);
    border-bottom: 1px solid var(--xht-border);
  }
  .xht-titlebar-brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .xht-titlebar-brand > svg { width: 18px; height: 18px; flex: none; color: var(--xht-primary); }
  .xht-app-name { font-size: 13px; font-weight: 600; color: var(--xht-foreground); }
  .xht-app-sub { font-size: 13px; color: var(--xht-ink-3); white-space: nowrap; }
  .xht-window-controls { display: flex; align-items: center; gap: 8px; }
  .xht-win-btn {
    width: 32px; height: 28px;
    display: grid; place-items: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--xht-radius-sm);
    background: transparent;
    color: var(--xht-ink-3);
    cursor: pointer;
    transition: background-color .16s ease, color .16s ease;
  }
  .xht-win-btn svg { width: 14px; height: 14px; }
  .xht-win-btn:hover { background: var(--xht-muted); color: var(--xht-foreground); }
  .xht-win-btn:active { background: var(--xht-border); }
  .xht-win-btn:focus-visible { outline: 2px solid var(--xht-ring); outline-offset: 1px; }

  /* 账号面板主体：侧栏 + 主视图 */
  .xht-shell {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    min-height: 0;
  }

  .xht-sidebar {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 20px 14px;
    background: var(--xht-card);
    border-right: 1px solid var(--xht-border);
  }

  .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 6px;
    margin-bottom: 20px;
    min-width: 0;
  }
  .sidebar-brand > svg { width: 30px; height: 30px; flex: none; color: var(--xht-primary); }
  .sidebar-brand-text { min-width: 0; }
  .sidebar-brand-name { font-size: 15px; font-weight: 600; line-height: 1.3; color: var(--xht-foreground); }
  .sidebar-brand-sub { margin-top: 2px; font-size: 11px; line-height: 1.3; color: var(--xht-ink-3); }

  .sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
  .nav-item {
    width: 100%;
    height: 38px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    border: none;
    border-radius: var(--xht-radius-sm);
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
    color: var(--xht-ink-2);
    text-align: left;
    cursor: pointer;
    transition: background-color .16s ease, color .16s ease;
  }
  .nav-item svg { width: 16px; height: 16px; flex: none; }
  .nav-item:hover { background: var(--xht-muted); color: var(--xht-foreground); }
  .nav-item:active { background: var(--xht-border); }
  .nav-item:focus-visible { outline: 2px solid var(--xht-ring); outline-offset: 1px; }
  .nav-item[aria-current="page"] {
    background: var(--xht-primary-soft);
    color: var(--xht-primary);
    font-weight: 600;
  }

  .sidebar-foot {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--xht-border);
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .sidebar-account { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 0 2px; }
  .sidebar-account > svg { width: 16px; height: 16px; flex: none; color: var(--xht-ink-3); }
  .sidebar-account-name { font-size: 12.5px; font-weight: 500; line-height: 1.3; color: var(--xht-foreground); }
  .sidebar-account-plan { margin-top: 1px; font-size: 11px; line-height: 1.3; color: var(--xht-ink-3); }
  .sidebar-version { padding: 0 2px; font-size: 11px; line-height: 1.3; color: var(--xht-ink-3); }
  .logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: 32px;
    padding: 0 10px;
    border: none;
    border-radius: var(--xht-radius-sm);
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    color: var(--xht-ink-2);
    text-align: left;
    cursor: pointer;
    transition: background-color .16s ease, color .16s ease;
  }
  .logout-btn svg { width: 16px; height: 16px; flex: none; }
  .logout-btn:hover { background: var(--xht-muted); color: var(--xht-foreground); }
  .logout-btn:focus-visible { outline: 2px solid var(--xht-ring); outline-offset: 1px; }

  /* 主视图 */
  .xht-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
    background: var(--xht-background);
  }

  .view-head {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
  }
  .view-title { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.3; color: var(--xht-foreground); }
  .view-sub { margin: 4px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--xht-ink-2); }
  .view-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  .btn-secondary {
    height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    background: var(--xht-card);
    border: 1px solid var(--xht-border);
    border-radius: var(--xht-radius-sm);
    font-family: inherit;
    font-size: 13px;
    line-height: 1;
    color: var(--xht-foreground);
    cursor: pointer;
    transition: transform .16s ease, background-color .16s ease, border-color .16s ease;
  }
  .btn-secondary svg { width: 16px; height: 16px; flex: none; color: var(--xht-ink-2); }
  .btn-secondary:hover { background: var(--xht-muted); transform: translateY(-1px); }
  .btn-secondary:active { transform: translateY(0); background: var(--xht-border); }
  .btn-secondary:focus-visible { outline: 2px solid var(--xht-ring); outline-offset: 1px; }
  .auto-refresh { font-size: 11px; line-height: 1.4; color: var(--xht-ink-3); white-space: nowrap; }

  /* 卡片 */
  .xht-card {
    min-width: 0;
    padding: 18px 20px;
    background: var(--xht-card);
    border: 1px solid var(--xht-border);
    border-radius: var(--xht-radius-md);
  }
  .card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .card-head-actions { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .card-title { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.4; color: var(--xht-foreground); }
  .card-meta { font-size: 12px; line-height: 1.4; color: var(--xht-ink-3); white-space: nowrap; }

  /* 账户概览 KPI */
  .kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 16px;
  }
  .kpi-cell { min-width: 0; padding-left: 20px; border-left: 1px solid var(--xht-border); }
  .kpi-cell:first-child { padding-left: 0; border-left: 0; }
  .kpi-label { font-size: 11.5px; line-height: 1.4; color: var(--xht-ink-3); }
  .kpi-value-lg { margin-top: 6px; font-size: 28px; font-weight: 600; line-height: 1.2; color: var(--xht-foreground); font-variant-numeric: tabular-nums; }
  .kpi-value { margin-top: 8px; display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--xht-foreground); }
  .kpi-dot { width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--xht-state-success); }
  .kpi-sub { margin-top: 4px; font-size: 11.5px; line-height: 1.4; color: var(--xht-ink-3); }

  /* 用量卡 */
  .usage-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
  .usage-legend { display: flex; align-items: center; gap: 14px; margin-left: auto; margin-right: auto; }
  .legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; line-height: 1.4; color: var(--xht-ink-3); }
  .legend-swatch { width: 10px; height: 10px; flex: none; border-radius: 2px; background: var(--xht-primary); }
  .legend-swatch.is-output { opacity: .45; }
  .usage-peak { margin-left: auto; font-size: 11.5px; line-height: 1.4; color: var(--xht-ink-3); white-space: nowrap; }

  .chart-scroll { margin-top: 14px; overflow-x: auto; }
  .chart-inner { min-width: 520px; }
  .usage-chart { display: block; width: 100%; height: auto; }
  .bar-input { opacity: .92; transition: opacity .16s ease; }
  .bar-output { opacity: .45; transition: opacity .16s ease; }
  .chart-col:hover .bar-input { opacity: 1; }
  .chart-col:hover .bar-output { opacity: .6; }

  .chart-metrics { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 24px; }
  .chart-metric { display: inline-flex; align-items: baseline; gap: 6px; }
  .chart-metric-label { font-size: 11.5px; line-height: 1.4; color: var(--xht-ink-3); }
  .chart-metric-value { font-size: 13px; font-weight: 600; line-height: 1.4; color: var(--xht-foreground); font-variant-numeric: tabular-nums; }

  /* 下方两列 */
  .panel-bottom { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; align-items: stretch; }

  .table-scroll { margin-top: 10px; overflow-x: auto; }
  .ledger-table { width: 100%; min-width: 480px; border-collapse: collapse; }
  .ledger-table th {
    padding: 0 10px 8px;
    border-bottom: 1px solid var(--xht-border);
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--xht-ink-3);
    text-align: left;
    white-space: nowrap;
  }
  .ledger-table td {
    height: 40px;
    padding: 0 10px;
    border-bottom: 1px solid var(--xht-border);
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--xht-foreground);
    white-space: nowrap;
    vertical-align: middle;
  }
  .ledger-table th:first-child, .ledger-table td:first-child { padding-left: 0; }
  .ledger-table th:last-child, .ledger-table td:last-child { padding-right: 0; }
  .ledger-table tbody tr { transition: background-color .16s ease; }
  .ledger-table tbody tr:hover { background: var(--xht-muted); }
  .ledger-table tbody tr:last-child td { border-bottom: 0; }
  .cell-time { font-variant-numeric: tabular-nums; }
  .cell-model { color: var(--xht-ink-2); white-space: normal; word-break: break-word; }
  .cell-num { text-align: right; font-variant-numeric: tabular-nums; }
  .delta-neg { color: var(--xht-state-error); }
  .delta-pos { color: var(--xht-state-success); }

  /* 在用设备 */
  .device-list { margin-top: 12px; display: flex; flex-direction: column; gap: 14px; }
  .device-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
  .device-icon {
    width: 40px; height: 40px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: var(--xht-radius-sm);
    background: var(--xht-muted);
    color: var(--xht-ink-2);
  }
  .device-icon svg { width: 18px; height: 18px; }
  .device-body { min-width: 0; }
  .device-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--xht-foreground);
    word-break: break-all;
  }
  .device-sub { margin-top: 2px; font-size: 11.5px; line-height: 1.4; color: var(--xht-ink-3); }
  .device-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--xht-border); font-size: 11.5px; line-height: 1.4; color: var(--xht-ink-3); }

  /* 底部状态栏 */
  .xht-statusbar {
    flex: none;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 6px 16px;
    background: var(--xht-card);
    border-top: 1px solid var(--xht-border);
    font-size: 12px;
    line-height: 1.5;
    color: var(--xht-ink-3);
  }
  .status-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .status-dot { width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--xht-state-success); }
  .status-right { white-space: nowrap; }

  svg.lucide { stroke-width: 1.75; }

  @media (max-width: 1024px) {
    .xht-shell { grid-template-columns: 190px minmax(0, 1fr); }
    .sidebar-brand { padding: 0 2px; }
    .panel-bottom { grid-template-columns: minmax(0, 1fr); }
  }

  @media (max-width: 820px) {
    .xht-stage { padding: 0; }
    .xht-window { max-width: none; min-height: 0; border-radius: 0; border-left: 0; border-right: 0; }
    .xht-shell { grid-template-columns: minmax(0, 1fr); }
    .xht-sidebar {
      flex-direction: row;
      align-items: center;
      gap: 14px;
      padding: 10px 14px;
      border-right: 0;
      border-bottom: 1px solid var(--xht-border);
      overflow: hidden;
    }
    .sidebar-brand { margin-bottom: 0; padding: 0; flex: none; }
    .sidebar-brand > svg { width: 26px; height: 26px; }
    .sidebar-brand-name { font-size: 14px; }
    .sidebar-brand-sub { display: none; }
    .sidebar-nav { flex: 1 1 auto; flex-direction: row; gap: 4px; overflow-x: auto; padding-bottom: 2px; }
    .nav-item { width: auto; flex: 0 0 auto; height: 34px; white-space: nowrap; padding: 0 10px; }
    .sidebar-foot {
      flex: none;
      flex-direction: row;
      align-items: center;
      margin-top: 0;
      padding-top: 0;
      border-top: 0;
    }
    .sidebar-account, .sidebar-version { display: none; }
    .logout-btn { width: 34px; height: 34px; padding: 0; justify-content: center; }
    .logout-btn span { display: none; }
    .xht-main { padding: 18px; }
    .view-head { min-height: 0; }
  }

  @media (max-width: 640px) {
    .xht-main { gap: 14px; }
    .xht-card { padding: 16px; }
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kpi-cell { padding-left: 0; border-left: 0; }
    .kpi-cell:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--xht-border); }
    .kpi-cell:nth-child(n+3) { border-top: 1px solid var(--xht-border); padding-top: 14px; }
    .kpi-value-lg { font-size: 25px; }
    .usage-legend { margin-left: 0; margin-right: 0; }
    .usage-peak { margin-left: 0; }
    .chart-metrics { gap: 16px 24px; }
    .xht-statusbar { padding: 8px 14px; row-gap: 4px; }
    .status-right { white-space: normal; }
  }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: .01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: .01ms !important;
      scroll-behavior: auto !important;
    }
  }


/* 设计画布同名令牌（账号面板用；与既有 --bg/--card/--accent 同一套值） */
:root {
  --xht-background: #f4f5f7;
  --xht-foreground: #1c1f24;
  --xht-card: #ffffff;
  --xht-border: #dfe3e8;
  --xht-primary: #0b57d0;
  --xht-primary-soft: #e8f0fe;
  --xht-primary-tint: #dbe7fb;
  --xht-muted: #eef1f5;
  --xht-muted-foreground: #5b6572;
  --xht-ink-2: #5b6572;
  --xht-ink-3: #8a939e;
  --xht-state-success: #14672e;
  --xht-state-warning: #8a5a00;
  --xht-state-error: #b3261e;
  --xht-radius-sm: 8px;
  --xht-radius-md: 12px;
  --xht-radius-lg: 16px;
  --xht-shadow-2: 0 8px 24px -8px rgba(15, 23, 42, .18);
  --xht-ring: #0b57d0;
}

/* 概览图表与设计稿同一套单色堆叠：输出段用主色 45% 透明度 */
.bar-out { fill: var(--xht-primary); opacity: .45; }

/* ---------- 兑换中心卡片 · 按设计画布落地 ---------- */

  *, *::before, *::after { box-sizing: border-box; }
  body { margin: 0; background: var(--xht-background); }
  h1, h2, h3, p, ul, dl, dd { margin: 0; }

  /* 桌面舞台 */
  .xht-stage {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 32px 24px;
    background: var(--xht-background);
  }

  /* 应用窗口 */
  .xht-window {
    width: 100%;
    max-width: 1240px;
    min-height: 760px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--xht-card);
    border: 1px solid var(--xht-border);
    border-radius: 16px;
    box-shadow: var(--xht-shadow-2);
  }

  /* 标题栏 */
  .xht-titlebar {
    flex: none;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 8px 0 14px;
    background: var(--xht-card);
    border-bottom: 1px solid var(--xht-border);
  }
  .xht-titlebar-brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .xht-titlebar-brand > svg { width: 18px; height: 18px; flex: none; color: var(--xht-primary); }
  .xht-app-name { font-size: 13px; font-weight: 600; color: var(--xht-foreground); }
  .xht-app-sub { font-size: 13px; color: var(--xht-ink-3); white-space: nowrap; }
  .xht-window-controls { display: flex; align-items: center; gap: 8px; }
  .xht-win-btn {
    width: 32px; height: 28px;
    display: grid; place-items: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--xht-ink-3);
    cursor: pointer;
    transition: background-color .16s ease, color .16s ease;
  }
  .xht-win-btn svg { width: 14px; height: 14px; }
  .xht-win-btn:hover { background: var(--xht-muted); color: var(--xht-foreground); }
  .xht-win-btn:active { background: var(--xht-border); }
  .xht-win-btn:focus-visible { outline: 2px solid var(--xht-ring); outline-offset: 1px; }

  /* 侧栏 + 主视图 */
  .xht-shell {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    min-height: 0;
  }

  .xht-sidebar {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 20px 14px;
    background: var(--xht-card);
    border-right: 1px solid var(--xht-border);
  }

  .side-brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
  .side-brand > svg { width: 30px; height: 30px; flex: none; color: var(--xht-primary); }
  .side-brand-name { font-size: 15px; line-height: 1.3; font-weight: 600; color: var(--xht-foreground); }
  .side-brand-sub { margin-top: 1px; font-size: 11px; line-height: 1.4; color: var(--xht-ink-3); }

  .side-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 20px; }
  .side-item {
    width: 100%;
    height: 38px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    font-family: inherit;
    font-size: 13px;
    line-height: 1;
    text-align: left;
    color: var(--xht-ink-2);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color .16s ease, color .16s ease;
  }
  .side-item svg { width: 16px; height: 16px; flex: none; }
  .side-item:hover { background: var(--xht-muted); color: var(--xht-foreground); }
  .side-item:focus-visible { outline: 2px solid var(--xht-ring); outline-offset: 1px; }
  .side-item.is-active {
    background: var(--xht-primary-soft);
    color: var(--xht-primary);
    font-weight: 600;
  }

  .side-foot {
    margin-top: auto;
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid var(--xht-border);
  }
  .side-account { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 0 4px; }
  .side-avatar {
    width: 30px; height: 30px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--xht-primary-soft);
    color: var(--xht-primary);
  }
  .side-avatar svg { width: 16px; height: 16px; }
  .side-account-text { min-width: 0; }
  .side-account-name {
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--xht-foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .side-account-meta { font-size: 11px; line-height: 1.4; color: var(--xht-ink-3); }
  .side-version { display: flex; align-items: center; padding: 0 4px; font-size: 11px; line-height: 1.4; color: var(--xht-ink-3); }
  .side-logout {
    width: 100%;
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 10px;
    font-family: inherit;
    font-size: 12px;
    color: var(--xht-ink-2);
    background: transparent;
    border: 1px solid var(--xht-border);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease;
  }
  .side-logout svg { width: 14px; height: 14px; flex: none; }
  .side-logout:hover { background: var(--xht-muted); border-color: var(--xht-ink-3); color: var(--xht-foreground); }
  .side-logout:focus-visible { outline: 2px solid var(--xht-ring); outline-offset: 2px; }

  .xht-view {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
    background: var(--xht-background);
  }

  .view-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 16px;
    flex-wrap: wrap;
  }
  .view-title { font-size: 20px; line-height: 1.25; font-weight: 600; color: var(--xht-foreground); }
  .view-sub { margin-top: 4px; font-size: 12.5px; line-height: 1.5; color: var(--xht-ink-2); }
  .view-note { padding-top: 4px; font-size: 11px; line-height: 1.5; color: var(--xht-ink-3); }

  /* 额度摘要 */
  .summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 14px 20px;
    background: var(--xht-card);
    border: 1px solid var(--xht-border);
    border-radius: 12px;
  }
  .summary-item { min-width: 0; padding: 0 20px; border-left: 1px solid var(--xht-border); }
  .summary-item:first-child { padding-left: 0; border-left: 0; }
  .summary-item:last-child { padding-right: 0; }
  .summary-label { font-size: 11.5px; line-height: 1.4; color: var(--xht-ink-3); }
  .summary-value { margin-top: 4px; font-size: 14px; line-height: 1.4; font-weight: 600; color: var(--xht-foreground); overflow-wrap: anywhere; }

  /* 兑换表单 */
  #exchange-forms {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
  .ex-card {
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: var(--xht-card);
    border: 1px solid var(--xht-border);
    border-radius: 12px;
  }
  .ex-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .ex-card-title { display: flex; align-items: center; gap: 8px; font-size: 15px; line-height: 1.3; font-weight: 600; color: var(--xht-foreground); }
  .ex-card-title svg { width: 16px; height: 16px; flex: none; color: var(--xht-primary); }
  .ex-tag {
    flex: none;
    padding: 2px 8px;
    font-size: 11px;
    line-height: 1.5;
    letter-spacing: .02em;
    color: var(--xht-ink-2);
    background: var(--xht-muted);
    border-radius: 6px;
  }
  .ex-desc { margin-top: 10px; font-size: 12.5px; line-height: 1.6; color: var(--xht-ink-2); }

  .ex-form { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
  .ex-field label {
    display: block;
    margin-bottom: 8px;
    font-size: 12.5px;
    line-height: 1.4;
    font-weight: 500;
    color: var(--xht-foreground);
  }
  .ex-input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    font-family: inherit;
    font-size: 14px;
    color: var(--xht-foreground);
    background: var(--xht-input);
    border: 1px solid var(--xht-border);
    border-radius: 8px;
    transition: border-color .16s ease;
  }
  .ex-input::placeholder { color: var(--xht-ink-3); }
  .ex-input:hover { border-color: var(--xht-ink-3); }
  .ex-input:focus-visible {
    outline: 2px solid var(--xht-ring);
    outline-offset: 1px;
    border-color: var(--xht-primary);
  }

  .ex-submit {
    width: 100%;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--xht-primary-foreground);
    background: var(--xht-primary);
    border: 1px solid var(--xht-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: transform .16s ease, filter .16s ease;
  }
  .ex-submit:hover { transform: translateY(-1px); filter: brightness(1.07); }
  .ex-submit:active { transform: translateY(0); filter: brightness(.96); }
  .ex-submit:focus-visible { outline: 2px solid var(--xht-ring); outline-offset: 2px; }

  .form-message {
    min-height: 18px;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--xht-ink-2);
    border-radius: 4px;
  }
  .form-message:focus, .form-message:focus-visible { outline: 2px solid var(--xht-ring); outline-offset: 3px; }

  .ex-card-foot {
    margin-top: auto;
    padding-top: 14px;
    font-size: 11.5px;
    line-height: 1.55;
    color: var(--xht-ink-3);
    border-top: 1px solid var(--xht-border);
  }

  /* 兑换说明 */
  .ex-notes {
    padding: 18px 20px;
    background: var(--xht-card);
    border: 1px solid var(--xht-border);
    border-radius: 12px;
  }
  .ex-notes-title { font-size: 14px; line-height: 1.35; font-weight: 600; color: var(--xht-foreground); }
  .notes-list { list-style: none; margin-top: 12px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
  .notes-list li { display: flex; align-items: flex-start; gap: 10px; font-size: 12.5px; line-height: 1.6; color: var(--xht-ink-2); }
  .notes-list svg { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--xht-ink-3); }

  /* 底部状态栏 */
  .xht-statusbar {
    flex: none;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 6px 16px;
    background: var(--xht-card);
    border-top: 1px solid var(--xht-border);
    font-size: 12px;
    line-height: 1.5;
    color: var(--xht-ink-3);
  }
  .status-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .status-dot { width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--xht-state-success); }
  .status-right { white-space: nowrap; }

  /* 响应式 */
  @media (max-width: 1024px) {
    .xht-shell { grid-template-columns: 190px minmax(0, 1fr); }
    #exchange-forms { grid-template-columns: minmax(0, 1fr); }
  }

  @media (max-width: 820px) {
    .xht-stage { padding: 16px; }
    .xht-window { min-height: 0; }
    .xht-shell { grid-template-columns: minmax(0, 1fr); }
    .xht-sidebar {
      display: grid;
      grid-template-columns: auto minmax(0, 1fr);
      grid-template-areas: "brand nav" "foot foot";
      align-items: center;
      gap: 10px 12px;
      padding: 12px 14px;
      border-right: 0;
      border-bottom: 1px solid var(--xht-border);
    }
    .side-brand { grid-area: brand; padding: 0; }
    .side-nav {
      grid-area: nav;
      flex-direction: row;
      gap: 6px;
      margin-top: 0;
      padding-bottom: 2px;
      overflow-x: auto;
      scrollbar-width: none;
    }
    .side-nav::-webkit-scrollbar { display: none; }
    .side-item { width: auto; flex: none; height: 34px; padding: 0 12px; white-space: nowrap; }
    .side-foot {
      grid-area: foot;
      margin-top: 0;
      padding-top: 0;
      flex-direction: row;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
      border-top: 0;
    }
    .side-account { padding: 0; }
    .side-version { padding: 0; margin-left: auto; }
    .side-logout { width: auto; min-height: 30px; padding: 0 12px; }
    .xht-view { padding: 18px; }
  }

  @media (max-width: 640px) {
    .summary { grid-template-columns: minmax(0, 1fr); padding: 6px 16px; }
    .summary-item { padding: 12px 0; border-left: 0; border-top: 1px solid var(--xht-border); }
    .summary-item:first-child { padding-top: 10px; border-top: 0; }
    .summary-item:last-child { padding-bottom: 10px; }
    .view-head { flex-direction: column; gap: 6px; }
    .view-note { padding-top: 0; }
  }

  @media (max-width: 520px) {
    .xht-stage { padding: 12px; }
    .xht-window { border-radius: 12px; }
    .xht-statusbar { padding: 8px 14px; row-gap: 4px; }
    .status-right { white-space: normal; }
    .ex-card { padding: 18px 16px; }
    .ex-notes { padding: 16px; }
  }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: .01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: .01ms !important;
      scroll-behavior: auto !important;
    }
  }


/* ---------- 账号面板：页面壳与 KPI/兑换网格收口 ---------- */
.xht-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--xht-background);
}

.panel-view { display: flex; flex-direction: column; gap: 16px; }

/* 🔴 .hidden 必须真正盖住 .panel-view 的 display:flex，否则五个视图会全部竖着摊开，
 *    左侧菜单只改 aria-current、页面看起来"点了没变化"（2026-11-21 实测）。 */
.panel-view.hidden { display: none; }

/* 设计稿的套餐状态已经在 KPI「套餐到期」里；这一行是旧接口的布尔回执，只保留 DOM 供自检。 */
#plan-view { display: none; }

.panel-view .cols-3 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: 16px;
}

.panel-view .cols-3 > .kpi-cell {
  min-width: 0;
  padding-left: 20px;
  border-left: 1px solid var(--xht-border);
}

.panel-view .cols-3 > .kpi-cell:first-child { padding-left: 0; border-left: 0; }

.panel-view .cols-3 > .kpi-cell dt {
  margin: 0;
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--xht-ink-3);
}

.panel-view .cols-3 > .kpi-cell dd { margin: 0; }
.panel-view .cols-3 > .kpi-cell .kpi-value { margin-top: 8px; }
.panel-view .cols-3 > .kpi-cell .kpi-value-lg { margin-top: 6px; }
.panel-view .cols-3 > .kpi-cell .kpi-sub { margin-top: 4px; }

.panel-view .cols-2 { gap: 16px; align-items: stretch; }

.ex-card-title-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ex-card-title-wrap svg { width: 16px; height: 16px; flex: none; color: var(--xht-primary); }
.ex-card-title-wrap h3 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--xht-foreground); }

@media (max-width: 700px) {
  .panel-view .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 0; }
  .panel-view .cols-3 > .kpi-cell { padding-left: 0; border-left: 0; }
  .panel-view .cols-3 > .kpi-cell:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--xht-border); }
  .panel-view .cols-3 > .kpi-cell:nth-child(n+3) { border-top: 1px solid var(--xht-border); padding-top: 14px; }
}

@media (max-width: 520px) {
  .panel-view .cols-3 { grid-template-columns: 1fr; gap: 14px 0; }
  .panel-view .cols-3 > .kpi-cell:nth-child(even) { padding-left: 0; border-left: 0; }
}

/* DOM 顺序保持「主内容在前、侧栏在后」（表头判据），视觉用 grid areas 换位：
   桌面侧栏在左，≤820px 侧栏变成顶部横条。 */
.xht-shell {
  grid-template-columns: 220px minmax(0, 1fr);
  grid-template-areas: "side main";
}

.xht-sidebar { grid-area: side; }
.xht-main { grid-area: main; }

@media (max-width: 820px) {
  .xht-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "side" "main";
  }
}

/* 1000px 左右的面板窗口是桌面工作区，不是平板：保留画布的 220px 侧栏与两列底部，
   避免落到 1024px 断点的 190px/单列版本。 */
@media (min-width: 900px) {
  .xht-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .sidebar-brand { padding: 0 6px; }
  .panel-bottom { grid-template-columns: 1.55fr 1fr; }
}

/* 固定应用壳：顶部 view-head 与左下账号/退出固定，主内容滚动，其他块随宽度适配 */
.xht-page { height: 100vh; min-height: 0; overflow: hidden; }
.xht-shell { flex: 1 1 auto; min-height: 0; }
.xht-sidebar { height: 100%; min-height: 0; overflow-y: auto; }
.xht-main { min-height: 0; overflow-y: auto; padding: 0 24px 24px; }
.sidebar-foot {
  position: sticky;
  bottom: 0;
  z-index: 5;
  background: var(--xht-card);
}
.view-head {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--xht-background);
  padding: 24px 0 12px;
}
.xht-main > .message { margin: 0; padding-top: 12px; }

@media (max-width: 820px) {
  .xht-sidebar { height: auto; min-height: 0; overflow: visible; }
  .sidebar-foot { position: static; }
  .xht-main { padding: 0 18px 18px; }
  .view-head { padding: 18px 0 10px; }
}

/* 版本号挪到品牌区右侧，不再在账号/退出之间单独占一行 */
.sidebar-version-badge {
  margin-left: auto;
  font-size: 10.5px;
  line-height: 1.3;
  color: var(--xht-ink-3);
  white-space: nowrap;
}

@media (max-width: 820px) {
  .sidebar-version-badge { display: none; }
}

/* 明细表在 .ledger-table 下的单元格约束（时间两行、模型/关联可折行、增减保留状态色） */
.ledger-table td.ledger-time { white-space: pre; }
.ledger-table td.conversation-range { white-space: pre; }
.card-meta.ok { color: var(--xht-state-success); }
.card-meta.error { color: var(--xht-state-error); }
.ledger-table td.cell-time { white-space: pre-line; }
.ledger-table td.cell-model,
.ledger-table td.ref-cell { white-space: normal; word-break: break-word; }
.ledger-table td.delta-neg { color: var(--xht-state-error); }
.ledger-table td.delta-pos { color: var(--xht-state-success); }

/* ===== P1 控制台骨架（2026-11-21）=====
   只补结构与空态，不新增设计令牌：颜色/圆角全部复用既有变量。
   这些类只服务 /billing 里新增的五个网关视图，不影响账户组既有版面。 */
.nav-group-label {
  margin: 14px 10px 4px;
  font-size: 10.5px;
  line-height: 1.4;
  letter-spacing: .08em;
  color: var(--xht-ink-3);
}
.nav-group-label:first-child { margin-top: 2px; }

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border: 1px solid var(--xht-border);
  border-radius: 999px;
  background: var(--xht-muted);
  color: var(--xht-ink-2);
  font-size: 11.5px;
  line-height: 1;
  white-space: nowrap;
}

.console-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.console-cards--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.kv-list { display: flex; flex-direction: column; margin-top: 12px; }
.kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--xht-border);
}
.kv-row:first-child { border-top: 0; padding-top: 0; }
.kv-key { font-size: 12.5px; line-height: 1.5; color: var(--xht-ink-3); }
.kv-value { font-size: 13px; line-height: 1.5; font-weight: 500; color: var(--xht-foreground); text-align: right; }

.empty-block {
  margin-top: 12px;
  padding: 22px 18px;
  border: 1px dashed var(--xht-border);
  border-radius: var(--radius-sm);
  background: var(--xht-muted);
  text-align: center;
}
.empty-title { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.5; color: var(--xht-ink-2); }
.empty-desc {
  margin: 6px auto 0;
  max-width: 460px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--xht-ink-3);
}

.console-hint { margin: 0; font-size: 12px; line-height: 1.6; color: var(--xht-ink-3); }

/* 线路页（P1-09）：只读目录。行是按钮（可点开详情），不用表格 ⇒ 窄屏也不横向溢出。 */
.line-search,
.line-sort {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--xht-border);
  border-radius: var(--radius-sm);
  background: var(--xht-background);
  color: var(--xht-foreground);
  font-size: 12.5px;
}
.line-search { width: 200px; }
.line-list { display: flex; flex-direction: column; margin-top: 12px; }
.line-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto minmax(0, 2fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--xht-border);
  border-radius: var(--radius-sm);
  background: var(--xht-background);
  color: var(--xht-foreground);
  text-align: left;
  cursor: pointer;
}
.line-row + .line-row { margin-top: 8px; }
.line-row:hover { background: var(--xht-muted); }
.line-row.is-active { border-color: var(--xht-foreground); }
.line-name { font-size: 13px; font-weight: 600; }
.line-state {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--xht-muted);
  color: var(--xht-ink-2);
  font-size: 11.5px;
  line-height: 1.6;
  white-space: nowrap;
}
.line-state.state-available { color: var(--xht-ok, #1a7f37); }
.line-state.state-cooling { color: var(--xht-warn, #9a6700); }
.line-state.state-offline { color: var(--xht-ink-3); }
.line-models {
  overflow: hidden;
  font-size: 12px;
  line-height: 1.5;
  color: var(--xht-ink-3);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.line-detail {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--xht-border);
  border-radius: var(--radius-sm);
  background: var(--xht-muted);
}
.line-detail-title { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.4; }

/* 路由页（P2-01）：候选链按线路目录顺序展示，序号 + 名称 + 状态 + 模型。 */
.route-row {
  display: grid;
  grid-template-columns: 24px minmax(120px, 1fr) auto minmax(0, 2fr);
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--xht-border);
  border-radius: var(--radius-sm);
  background: var(--xht-background);
}
.route-row + .route-row { margin-top: 8px; }
.route-no {
  font-size: 11.5px;
  color: var(--xht-ink-3);
  text-align: center;
}
.route-default-editor { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.route-default-editor select { flex: 1 1 180px; min-width: 0; }
.model-chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.model-chip {
  padding: 4px 10px;
  border: 1px solid var(--xht-border);
  border-radius: 999px;
  background: var(--xht-muted);
  font-size: 12px;
  line-height: 1.6;
  color: var(--xht-ink-2);
}

.client-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.client-card-name { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.4; color: var(--xht-foreground); }
.client-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.client-confirm { margin-top: 16px; }
.client-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* 3.0 控制台入口：账单页侧栏底部的返回链接（纯导航，不改账单页结构）。 */
.side-foot-back {
  display: block;
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12.5px;
  text-decoration: none;
}
.side-foot-back:hover { text-decoration: underline; }

/* 登录页返回控制台（纯导航，不参与登录表单与自检判据）。 */
.login-back {
  display: inline-block;
  margin-top: 14px;
  color: var(--accent);
  font-size: 12.5px;
  text-decoration: none;
}
.login-back:hover { text-decoration: underline; }

@media (max-width: 820px) {
  .console-cards,
  .console-cards--3 { grid-template-columns: minmax(0, 1fr); }
  /* 窄屏侧栏变成横向滚动条：分组标题是纵向菜单的产物，横排时隐藏。 */
  .nav-group-label { display: none; }
}

/* ===== 在线充值（P8-07，2026-11-23）=====
   只补组件类，不新增设计令牌：颜色/圆角全部复用既有变量。
   金额与客服文案都由服务端下发，这里只负责排版。 */
.pay-online { margin-top: 16px; }
.pay-tiers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0 4px;
}
.pay-tier {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--xht-border);
  border-radius: var(--radius-sm);
  background: var(--xht-card);
}
/* 未开放：整张卡降透明度 + 按钮禁用（不区分"未开通"与"不在灰度名单"）。 */
.pay-tier.is-locked { opacity: .55; }
.pay-tier-amount { font-size: 20px; line-height: 1.2; color: var(--xht-ink-1); }
.pay-tier-points { font-size: 12.5px; color: var(--xht-ink-3); }
.pay-tier-btn { width: 100%; margin-top: 4px; }
.pay-order {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--xht-border);
  border-radius: var(--radius-sm);
  background: var(--xht-muted);
  color: var(--xht-ink-2);
  font-size: 13px;
}
.pay-order.done {
  border-color: var(--xht-state-success);
  color: var(--xht-state-success);
}
.pay-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pay-actions .ex-submit { width: auto; padding: 0 16px; }
.ex-submit-quiet {
  background: transparent;
  border: 1px solid var(--xht-border);
  color: var(--xht-ink-2);
}
.pay-cs {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--xht-border);
  color: var(--xht-ink-3);
  font-size: 12.5px;
  line-height: 1.7;
  word-break: break-word;
}

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