
:root {
  --bg-color: #0b0f17;
  --surface-color: #131b26;
  --surface-hover: #1c2736;
  --card-border: rgba(255, 255, 255, 0.08);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --primary: #10b981;
  --primary-glow: rgba(16, 185, 129, 0.25);
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.25);
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* 当选中 AG 引擎时的主题微调 */
body.theme-ag {
  --primary: #38bdf8;
  --primary-glow: rgba(56, 189, 248, 0.25);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 96px;
  overflow-x: hidden;
  transition: background-color 0.3s ease;
}

/* 顶部导航与引擎分段切换 */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 15, 23, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--card-border);
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #10b981, #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  font-size: 16px;
  box-shadow: 0 0 12px var(--primary-glow);
  transition: all 0.3s ease;
}

body.theme-ag .brand-icon {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  box-shadow: 0 0 12px var(--accent-glow);
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-badge {
  font-size: 10px;
  padding: 2px 7px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent);
  border-radius: var(--radius-full);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.15);
  color: var(--primary);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: currentColor;
  box-shadow: 0 0 6px currentColor;
}

/* 核心创新：双引擎无缝分段切换器 */
.engine-switcher-bar {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-full);
  padding: 3px;
  position: relative;
}

.engine-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  position: relative;
  z-index: 2;
  min-width: 0;
  white-space: nowrap;
}

.engine-tab > span { white-space: nowrap; flex-shrink: 0; }

.engine-tab.active {
  color: #fff;
}

.engine-tab.active.wb-active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.8), rgba(5, 150, 105, 0.9));
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
}

.engine-tab.active.ag-active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.8), rgba(2, 132, 199, 0.9));
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.35);
}

.engine-badge-mini {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
}

/* 窄屏：引擎切换文字不换行，先收紧间距和字号，再窄就隐藏「腾讯 / Google」小标签 */
@media (max-width: 420px) {
  .engine-tab { gap: 5px; padding: 7px 8px; font-size: 12px; }
  .engine-badge-mini { padding: 1px 5px; }
}
@media (max-width: 340px) {
  .engine-badge-mini { display: none; }
}

/* Tab 主内容区域 */
.tab-content {
  display: none;
  padding: 16px;
  max-width: 600px;
  margin: 0 auto;
  animation: fadeIn 0.2s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 卡片体系 */
.card {
  background: var(--surface-color);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.metric-card {
  background: var(--surface-color);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.metric-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.metric-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  font-family: var(--font-mono);
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* 账号卡片流 (上下分层) */
.account-card {
  background: var(--surface-color);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.account-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.item-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #334155, #1e293b);
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-main);
  flex-shrink: 0;
}

.account-card-info {
  flex: 1;
  min-width: 0;
}

.account-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.account-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  word-break: break-word;
}

.account-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  line-height: 1.5;
  word-break: break-all;
}

/* 工整两行操作栏 */
.account-actions-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.account-actions-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.account-actions-row .btn {
  flex: 1;
  padding: 6px 4px;
  font-size: 12px;
  min-height: 36px;
  white-space: nowrap;
}

.account-test-banner {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-mono);
  display: none;
  animation: fadeIn 0.2s ease;
  line-height: 1.4;
  word-break: break-all;
}

.account-test-banner.success {
  display: block;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.account-test-banner.warning {
  display: block;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.account-test-banner.error {
  display: block;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

/* 标签 Pills */
.tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  display: inline-block;
}

.tag-global { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.tag-google { background: rgba(234, 67, 53, 0.15); color: #ea4335; }
.tag-online { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.tag-offline { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

/* 按钮规范 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  min-height: 38px;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-primary {
  background: var(--primary);
  color: #0b0f17;
  font-weight: 700;
}

.btn-primary:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.btn-outline {
  background: transparent;
  border-color: var(--card-border);
  color: var(--text-main);
}

.btn-outline:active {
  background: var(--surface-hover);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  min-height: 32px;
}

/* 对话 Tab 样式 */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 215px);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-bubble {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.chat-bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: var(--surface-color);
  border: 1px solid var(--card-border);
  border-bottom-left-radius: 4px;
}

.thinking-drawer {
  background: rgba(0, 0, 0, 0.35);
  border-left: 2px solid var(--primary);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.thinking-title {
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  user-select: none;
  margin-bottom: 4px;
}

.chat-input-bar {
  display: flex;
  gap: 8px;
  background: var(--surface-color);
  padding: 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--card-border);
  margin-top: 8px;
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 14px;
  padding: 0 12px;
}

/* 日志卡片 */
.log-card {
  background: var(--surface-color);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.log-path-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.log-path-text {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-main);
}

.log-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  gap: 8px;
}

.log-model-text {
  font-family: var(--font-mono);
  color: var(--accent);
}

.log-metrics-text {
  font-family: var(--font-mono);
  font-size: 11px;
}

/* 浮动胶囊底栏 */
.bottom-nav {
  position: fixed;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  width: calc(100% - 32px);
  max-width: 440px;
  background: rgba(19, 27, 38, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-full);
  padding: 5px;
  display: flex;
  justify-content: space-around;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 6px 0;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-full);
  transition: all 0.2s ease;
  min-height: 42px;
  user-select: none;
}

.nav-item.active {
  color: var(--primary);
  background: rgba(16, 185, 129, 0.12);
}

body.theme-ag .nav-item.active {
  background: rgba(56, 189, 248, 0.12);
}

.nav-icon {
  font-size: 17px;
  margin-bottom: 2px;
}

/* 浮层 Toast */
.toast-container {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 90%;
}

.toast-msg {
  background: rgba(20, 26, 38, 0.95);
  color: #fff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-full);
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: fadeInDown 0.25s ease, fadeOutUp 0.25s ease 2s forwards;
  text-align: center;
}

.toast-msg.success { border-color: rgba(16, 185, 129, 0.4); color: #34d399; }
.toast-msg.error { border-color: rgba(239, 68, 68, 0.4); color: #f87171; }
.toast-msg.warn { border-color: rgba(245, 158, 11, 0.4); color: #fbbf24; }

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeOutUp {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-10px); }
}

.input-field {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  margin-bottom: 10px;
}
.input-field:focus { border-color: var(--primary); }

.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: rgba(255,255,255,0.12);
  border-radius: 24px; transition: .25s;
}
.slider:before {
  content: ""; position: absolute;
  height: 18px; width: 18px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: .25s;
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider:before { transform: translateX(20px); }

/* 优雅展示切换动画 */
.engine-view-wrap {
  animation: fadeIn 0.25s ease;
}
  
/* ── 弹窗（沿用旧版） ── */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 100;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-sheet {
  background: var(--surface-color);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  border-bottom: none;
  width: 100%;
  max-width: 500px;
  padding: 20px;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--card-border);
  border-radius: 2px;
  margin: 0 auto 16px;
}

.log-note-box {
  font-size: 11px;
  color: var(--danger);
  font-family: var(--font-mono);
  word-break: break-all;
  background: rgba(239, 68, 68, 0.08);
  padding: 4px 8px;
  border-radius: 4px;
  margin-top: 2px;
}

/* ── 现代轻量 Toast 浮动提示 ── */

/* ── v2 新增：明细统计 / 额度 / 趋势 ── */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 4px; }
.stat-cell { background: rgba(0,0,0,0.25); border: 1px solid var(--card-border); border-radius: var(--radius-sm); padding: 10px 8px; text-align: center; }
.stat-cell .k { font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }
.stat-cell .v { font-size: 16px; font-weight: 700; font-family: var(--font-mono); color: var(--text-main); }
.stat-cell .v.hl { color: var(--primary); }
.sub-tabs { display: flex; gap: 6px; }
.sub-tab { font-size: 12px; padding: 4px 10px; border-radius: var(--radius-full); border: 1px solid var(--card-border); color: var(--text-muted); cursor: pointer; }
.sub-tab.active { color: var(--primary); border-color: var(--primary); background: var(--primary-glow); }
.trend { display: flex; align-items: flex-end; gap: 3px; height: 72px; margin-top: 12px; }
.trend .bar { flex: 1; background: var(--primary); opacity: 0.85; border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.trend .bar.err { background: var(--danger); }
.trend .bar.zero { background: rgba(255,255,255,0.08); }
.trend-axis { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-dim); margin-top: 4px; font-family: var(--font-mono); }
.quota-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 4px; }
.quota-row { display: grid; grid-template-columns: 74px 1fr 64px; align-items: center; gap: 8px; font-size: 12px; }
.quota-row .qn { color: var(--text-muted); }
.quota-row .qp { text-align: right; white-space: nowrap; font-family: var(--font-mono); font-weight: 700; }
.quota-row .qr { grid-column: 2 / 4; font-size: 11px; color: var(--text-dim); margin-top: -4px; }
.qbar { height: 7px; border-radius: 4px; background: rgba(255,255,255,0.08); overflow: hidden; }
.qbar > i { display: block; height: 100%; border-radius: 4px; background: var(--primary); }
.qbar > i.mid { background: var(--warning); }
.qbar > i.low { background: var(--danger); }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-muted); }
.kv .v { font-family: var(--font-mono); color: var(--text-main); text-align: right; word-break: break-all; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--text-muted); font-size: 12px; line-height: 1.6; }
.mono { font-family: var(--font-mono); }
.empty { text-align: center; padding: 36px 12px; color: var(--text-dim); font-size: 13px; }
.engine-off { text-align: center; padding: 28px 16px; }
.engine-off .big { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.model-chip { display: inline-block; font-family: var(--font-mono); font-size: 11px; padding: 3px 8px; margin: 3px 4px 0 0; border-radius: 6px; background: rgba(255,255,255,0.05); border: 1px solid var(--card-border); color: var(--text-muted); cursor: pointer; }
.code-box { font-family: var(--font-mono); font-size: 12px; background: rgba(0,0,0,0.4); border: 1px solid var(--card-border); border-radius: var(--radius-sm); padding: 10px; white-space: pre-wrap; word-break: break-all; color: var(--text-main); margin-top: 8px; }
.engine-tab.disabled { opacity: 0.45; }
.log-tokens { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); margin-top: 6px; }
.log-tokens b { color: var(--text-muted); font-weight: 600; }

/* ── 独立运行（Linux / 源码版）：只有 AG ── */
.standalone-only { display: none; }
body.standalone .standalone-only { display: inline; }
body.standalone .android-only { display: none !important; }
/* Linux / 源码版双引擎：没有安卓宿主，端口等宿主设置不显示 */
body.dual .host-only,
body.standalone .host-only { display: none !important; }
.nav-brand { display: none; }

/* ── 电脑端：左侧导航 + 宽内容区 ── */
@media (min-width: 900px) {
  body { padding-bottom: 0; padding-left: 232px; font-size: 14.5px; }

  .bottom-nav {
    top: 0; bottom: 0; left: 0; transform: none;
    width: 232px; max-width: none; height: 100vh;
    flex-direction: column; justify-content: flex-start; gap: 4px;
    border-radius: 0; border: none; border-right: 1px solid var(--card-border);
    padding: 0 14px 20px; box-shadow: none;
    background: #0e141e;
  }
  .nav-brand {
    display: flex; flex-direction: column; gap: 2px;
    font-size: 20px; font-weight: 800; letter-spacing: 0.3px;
    padding: 24px 12px 22px; margin-bottom: 6px;
    border-bottom: 1px solid var(--card-border);
  }
  .nav-brand span { font-size: 12px; font-weight: 600; color: var(--primary); font-family: var(--font-mono); }
  .nav-item {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 12px;
    padding: 11px 14px; min-height: 0; border-radius: 10px; font-size: 14px;
  }
  .nav-item:hover:not(.active) { background: var(--surface-hover); color: var(--text-main); }
  .nav-icon { font-size: 17px; margin-bottom: 0; width: 22px; text-align: center; }

  .app-header {
    flex-direction: row; align-items: center; justify-content: space-between;
    padding: 14px 32px; gap: 20px;
  }
  .app-header .brand-wrap { display: none; }
  .app-header .header-top { order: 2; }
  .engine-switcher-bar { order: 1; width: 380px; margin: 0; }
  body.standalone .app-header { justify-content: flex-end; }

  .tab-content { max-width: 1240px; padding: 24px 32px 40px; }

  /* 概览：指标一行四个，明细与趋势并排 */
  #view-overview.active {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-content: start;
  }
  #view-overview > * { margin-bottom: 0; }
  #view-overview .metric-grid { grid-column: 1 / -1; grid-template-columns: repeat(4, 1fr); gap: 16px; }
  #view-overview .metric-card { padding: 18px 20px; }
  #view-overview .metric-value { font-size: 26px; }
  #agEngineCard, #view-overview > .card:last-child { grid-column: 1 / -1; }
  .trend { height: 150px; }

  /* 账号、日志：卡片网格 */
  #accountList { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 16px; align-items: start; }
  #accountList .account-card, #accountList > .card, #accountList > .empty { margin-bottom: 0; }
  #accountList > .empty, #accountList > .card { grid-column: 1 / -1; }
  #logList { display: grid; grid-template-columns: repeat(auto-fill, minmax(480px, 1fr)); gap: 12px; align-items: start; }
  #logList .log-card { margin-bottom: 0; }
  #logList > .empty { grid-column: 1 / -1; }

  /* 接入、对话：限制阅读宽度 */
  #view-keys.active { max-width: 900px; }
  #view-chat.active { max-width: 1000px; }
  .chat-container { height: calc(100vh - 150px); }
  .chat-bubble { max-width: 72%; }

  /* 弹窗居中 */
  .modal-overlay { align-items: center; }
  .modal-sheet { border-radius: var(--radius-lg); border-bottom: 1px solid var(--card-border); max-width: 560px; animation: fadeIn 0.2s ease; }
  .sheet-handle { display: none; }
  .toast-container { left: calc(50% + 116px); }
}
