/* ===== AQUA 用户平台统一样式 v8.0 ===== */
/* 与网关控制台保持一致的深色主题 - 纯SVG图标 - 无Emoji */

:root {
  /* 主色调 - 与网关控制台完全一致 */
  --bg-primary: #0a0e27;
  --bg-secondary: #131836;
  --bg-card: #1a1f3a;
  --bg-hover: #232a4d;
  --bg-input: #0f1428;

  /* 文字 */
  --text-primary: #e6e9f5;
  --text-secondary: #8b92b8;
  --text-muted: #5a6188;

  /* 强调色 */
  --accent-primary: #00d4ff;
  --accent-success: #00e676;
  --accent-warning: #ffab00;
  --accent-danger: #ff5252;
  --accent-info: #448aff;
  --accent-purple: #7c4dff;

  /* 边框 */
  --border-color: #2a3052;
  --border-light: #1f2540;

  /* 状态色 */
  --status-active: #00e676;
  --status-cooling: #ff5252;
  --status-softbusy: #ffab00;
  --status-isolated: #5a6188;

  /* 尺寸 */
  --sidebar-width: 220px;
  --header-height: 56px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  /* 阴影 */
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 12px rgba(0, 212, 255, 0.3);

  /* 过渡 */
  --transition: all 0.2s ease;
  --transition-slow: all 0.3s ease;
}

/* 浅色主题 */
[data-theme="light"] {
  --bg-primary: #f5f7fa;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #e8eaed;
  --bg-input: #f0f2f5;
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted: #888;
  --accent-primary: #0066cc;
  --border-color: #ddd;
  --border-light: #eee;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

/* ===== 重置 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

a { color: var(--accent-primary); text-decoration: none; transition: var(--transition); }
a:hover { color: #66e6ff; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }

code { font-family: 'SF Mono', Monaco, 'Cascadia Code', Consolas, monospace; font-size: 0.92em; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* 旋转动画 */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.8s linear infinite; transform-origin: center; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== 顶部导航栏 ===== */
.navbar {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 24px;
}

.navbar-brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-weight: 700;
}

.brand-logo:hover { color: var(--accent-primary); }
.brand-logo svg { display: block; }

.brand-name { font-size: 17px; }

.brand-tag {
  font-size: 11px;
  padding: 2px 8px;
  background: linear-gradient(135deg, rgba(0,212,255,0.2), rgba(68,138,255,0.2));
  color: var(--accent-primary);
  border-radius: 10px;
  border: 1px solid rgba(0,212,255,0.3);
}

.navbar-links {
  display: flex;
  gap: 4px;
  flex: 1;
}

.navbar-links a {
  padding: 7px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  transition: var(--transition);
}

.navbar-links a:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.navbar-links a.active {
  color: var(--accent-primary);
  background: rgba(0,212,255,0.1);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.icon-btn svg { display: block; }

/* ===== 主布局 ===== */
.main-layout {
  display: flex;
  min-height: calc(100vh - var(--header-height));
}

.main-layout.with-sidebar .app-sidebar { display: flex; }

/* ===== 侧边栏 ===== */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: none;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-user {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-info));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0a0e27;
  flex-shrink: 0;
}

.sidebar-avatar svg { display: block; }

.sidebar-user-info { min-width: 0; flex: 1; }

.sidebar-user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-email {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 2px;
  transition: var(--transition);
  user-select: none;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(0,212,255,0.15), rgba(0,212,255,0.05));
  color: var(--accent-primary);
  border-left: 3px solid var(--accent-primary);
  padding-left: 9px;
}

.nav-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-icon svg { display: block; }

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border-color);
}

/* ===== 内容区 ===== */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  min-width: 0;
  min-height: 0;
}

/* ===== 页面通用 ===== */
.page {
  max-width: 1400px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.muted { color: var(--text-muted); font-size: 12px; }

/* ===== 卡片 ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
}

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

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===== 网格 ===== */
.grid {
  display: grid;
  gap: 16px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .navbar-links { display: none; }
  .navbar-inner { padding: 0 16px; }
  .app-sidebar { position: fixed; z-index: 99; height: calc(100vh - var(--header-height)); }
  .content-area { padding: 16px; }
}

/* ===== 统计卡片 ===== */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card.accent { border-left: 3px solid var(--accent-primary); }
.stat-card.success { border-left: 3px solid var(--accent-success); }
.stat-card.warning { border-left: 3px solid var(--accent-warning); }
.stat-card.danger { border-left: 3px solid var(--accent-danger); }
.stat-card.info { border-left: 3px solid var(--accent-info); }

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

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-trend {
  font-size: 11px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
}

.stat-trend.up { color: var(--accent-success); }
.stat-trend.down { color: var(--accent-danger); }
.stat-trend.flat { color: var(--text-muted); }

/* ===== 表格 ===== */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data-table thead {
  background: var(--bg-secondary);
}

table.data-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}

table.data-table th:hover { color: var(--text-primary); }
table.data-table th.sort-asc::after { content: " ↑"; color: var(--accent-primary); }
table.data-table th.sort-desc::after { content: " ↓"; color: var(--accent-primary); }

table.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}

table.data-table tbody tr {
  transition: background 0.15s;
}

table.data-table tbody tr:hover {
  background: var(--bg-hover);
}

table.data-table tbody tr:last-child td {
  border-bottom: none;
}

table.data-table td.numeric,
table.data-table th.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

table.data-table td.muted { color: var(--text-muted); }

/* Token颜色编码 */
.token-in { color: var(--accent-info); }
.token-out { color: var(--accent-success); }
.token-total { color: var(--accent-warning); font-weight: 600; }
.token-cell { display: inline-flex; gap: 4px; align-items: center; }

/* ===== 状态标签 ===== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(90,97,136,0.15);
  color: var(--text-muted);
}

.tag.active { background: rgba(0,230,118,0.15); color: var(--status-active); }
.tag.cooling { background: rgba(255,82,82,0.15); color: var(--status-cooling); }
.tag.softbusy { background: rgba(255,171,0,0.15); color: var(--status-softbusy); }
.tag.isolated { background: rgba(90,97,136,0.2); color: var(--status-isolated); }
.tag.info { background: rgba(68,138,255,0.15); color: var(--accent-info); }
.tag.warning { background: rgba(255,171,0,0.15); color: var(--accent-warning); }

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  flex-shrink: 0;
}

.status-dot.active { background: var(--status-active); }
.status-dot.cooling { background: var(--status-cooling); }
.status-dot.softbusy { background: var(--status-softbusy); }
.status-dot.isolated { background: var(--status-isolated); }
.status-dot.info { background: var(--accent-info); }
.status-dot.muted { background: var(--text-muted); }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  height: 34px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

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

.btn.primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-info));
  color: #0a0e27;
  border-color: transparent;
  font-weight: 600;
}

.btn.primary:hover {
  filter: brightness(1.1);
  box-shadow: var(--shadow-glow);
  color: #0a0e27;
}

.btn.danger {
  background: rgba(255,82,82,0.15);
  color: var(--accent-danger);
  border-color: rgba(255,82,82,0.3);
}

.btn.danger:hover {
  background: rgba(255,82,82,0.25);
  color: var(--accent-danger);
}

.btn.success {
  background: rgba(0,230,118,0.15);
  color: var(--accent-success);
  border-color: rgba(0,230,118,0.3);
}

.btn.ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn.ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn.sm { padding: 4px 10px; height: 28px; font-size: 12px; }
.btn.xs { padding: 2px 8px; height: 24px; font-size: 11px; }
.btn.lg { padding: 10px 24px; height: 44px; font-size: 15px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-group {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ===== 输入框 ===== */
.input, .select, textarea.input {
  width: 100%;
  padding: 8px 12px;
  height: 36px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b92b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.input:focus, .select:focus, textarea.input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(0,212,255,0.15);
}

.input::placeholder { color: var(--text-muted); }

.input:disabled { opacity: 0.6; cursor: not-allowed; }

textarea.input {
  height: auto;
  min-height: 80px;
  resize: vertical;
  line-height: 1.5;
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap .input { padding-right: 36px; }

.input-suffix {
  position: absolute;
  right: 8px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: 4px;
  transition: var(--transition);
}

.input-suffix:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.input-group {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.input-group .input { flex: 1; }

/* ===== 工具栏 ===== */
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

.search-box .input {
  padding-left: 32px;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  display: flex;
  pointer-events: none;
}

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-overlay.show {
  display: flex;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 540px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ===== Toast 通知 ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 13px;
  box-shadow: var(--shadow-md);
  min-width: 200px;
  max-width: 360px;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
  pointer-events: all;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-icon { display: flex; flex-shrink: 0; }
.toast-msg { flex: 1; }

.toast-success { border-left: 3px solid var(--accent-success); }
.toast-success .toast-icon { color: var(--accent-success); }
.toast-error { border-left: 3px solid var(--accent-danger); }
.toast-error .toast-icon { color: var(--accent-danger); }
.toast-warn { border-left: 3px solid var(--accent-warning); }
.toast-warn .toast-icon { color: var(--accent-warning); }
.toast-info { border-left: 3px solid var(--accent-info); }
.toast-info .toast-icon { color: var(--accent-info); }

/* ===== 加载状态 ===== */
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 12px;
  color: var(--text-muted);
}

.loader-spinner {
  display: flex;
  color: var(--accent-primary);
}

.loader-spinner svg { display: block; }

.loader-text {
  font-size: 13px;
}

/* ===== 空状态 ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 12px;
  color: var(--text-muted);
}

.empty-icon {
  display: flex;
  color: var(--text-muted);
  opacity: 0.5;
}

.empty-text {
  font-size: 13px;
  text-align: center;
}

/* ===== 分页器 ===== */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.pagination-info {
  font-size: 12px;
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  gap: 4px;
  align-items: center;
}

.page-ellipsis {
  color: var(--text-muted);
  padding: 0 4px;
}

/* ===== 首页 ===== */
.home-page { min-height: calc(100vh - var(--header-height)); }

.hero {
  position: relative;
  padding: 80px 24px 100px;
  text-align: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top, rgba(0,212,255,0.15), transparent 70%),
              radial-gradient(ellipse at bottom right, rgba(68,138,255,0.1), transparent 60%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(0,212,255,0.1);
  border: 1px solid rgba(0,212,255,0.3);
  border-radius: 20px;
  color: var(--accent-primary);
  font-size: 12px;
  margin-bottom: 24px;
}

.hero-title {
  font-size: 48px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-info));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 32px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 48px;
  flex-wrap: wrap;
}

.hero-stats {
  display: flex;
  gap: 32px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-stat .num {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-primary);
}

.hero-stat .lbl {
  font-size: 12px;
  color: var(--text-muted);
}

/* 特性卡片 */
.features {
  padding: 60px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: 40px;
}

.section-header h2 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.section-header p {
  font-size: 14px;
  color: var(--text-muted);
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
}

.feature-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.feature-icon.accent { background: rgba(0,212,255,0.15); color: var(--accent-primary); }
.feature-icon.success { background: rgba(0,230,118,0.15); color: var(--accent-success); }
.feature-icon.warning { background: rgba(255,171,0,0.15); color: var(--accent-warning); }
.feature-icon.info { background: rgba(68,138,255,0.15); color: var(--accent-info); }

.feature-card h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* CTA */
.cta {
  padding: 60px 24px;
}

.cta-card {
  max-width: 800px;
  margin: 0 auto;
  background: linear-gradient(135deg, rgba(0,212,255,0.1), rgba(68,138,255,0.1));
  border: 1px solid rgba(0,212,255,0.3);
  border-radius: var(--radius-xl);
  padding: 40px;
  text-align: center;
}

.cta-card h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.cta-card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* 页脚 */
.footer {
  padding: 32px 24px;
  border-top: 1px solid var(--border-color);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
}

.footer-links {
  display: flex;
  gap: 16px;
  font-size: 13px;
}

.footer-copy {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== 认证页 ===== */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-height) - 48px);
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-md);
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo {
  display: inline-flex;
  margin-bottom: 12px;
}

.auth-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.auth-header p {
  font-size: 13px;
  color: var(--text-muted);
}

.auth-form .form-group { margin-bottom: 16px; }

.auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.auth-footer a:hover { text-decoration: underline; }

/* ===== 模型卡片 ===== */
.model-card {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px;
  transition: var(--transition);
}

.model-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.model-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.model-id {
  font-size: 12px;
  color: var(--text-primary);
  word-break: break-all;
  font-weight: 500;
}

.model-caps {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.key-prefix {
  font-size: 13px;
  color: var(--accent-primary);
}

/* ===== API URL 区域 ===== */
.api-url-section { display: flex; flex-direction: column; gap: 12px; }

.api-urls { display: flex; flex-direction: column; gap: 8px; }

.api-url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.api-url-label {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 80px;
}

.api-url-row code {
  flex: 1;
  color: var(--accent-primary);
  font-size: 12px;
  word-break: break-all;
}

/* ===== 警告框 ===== */
.alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 12px;
}

.alert-warning {
  background: rgba(255,171,0,0.1);
  border: 1px solid rgba(255,171,0,0.3);
  color: var(--accent-warning);
}

.alert-info {
  background: rgba(68,138,255,0.1);
  border: 1px solid rgba(68,138,255,0.3);
  color: var(--accent-info);
}

.alert svg { flex-shrink: 0; }

/* ===== 聊天页面 ===== */
.chat-page {
  display: flex;
  height: calc(100vh - var(--header-height) - 48px);
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.chat-sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.chat-sidebar-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chat-sidebar-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.chat-history-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.chat-history-item {
  position: relative;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 4px;
}

.chat-history-item:hover {
  background: var(--bg-hover);
}

.chat-history-item.active {
  background: rgba(0,212,255,0.1);
}

.chat-history-title {
  font-size: 13px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 24px;
}

.chat-history-meta {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.chat-history-del {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: var(--bg-card);
}

.chat-history-item:hover .chat-history-del { display: flex; }

.chat-history-del:hover {
  color: var(--accent-danger);
  background: rgba(255,82,82,0.1);
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-secondary);
}

.chat-model-select {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.chat-model-select label {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.chat-model-select .select {
  max-width: 320px;
  height: 32px;
  padding: 4px 30px 4px 10px;
  font-size: 12px;
}

.chat-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

.chat-empty {
  margin: auto;
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
}

.chat-empty-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
  opacity: 0.4;
}

.chat-empty h3 {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.chat-empty p {
  font-size: 13px;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 80%;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.message-avatar.assistant {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-info));
  color: #0a0e27;
}

.message-avatar.user {
  background: linear-gradient(135deg, var(--accent-success), var(--accent-warning));
  color: #0a0e27;
}

.message-content {
  min-width: 0;
  flex: 1;
}

.message-role {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.message-text {
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
  white-space: pre-wrap;
}

.message.user .message-text {
  background: rgba(0,212,255,0.1);
  border-color: rgba(0,212,255,0.2);
}

/* 推理过程 */
.reasoning-block {
  margin-bottom: 8px;
  border: 1px solid rgba(124,77,255,0.3);
  border-radius: var(--radius-md);
  background: rgba(124,77,255,0.05);
  overflow: hidden;
}

.reasoning-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  color: var(--accent-purple);
  transition: var(--transition);
}

.reasoning-header:hover {
  background: rgba(124,77,255,0.1);
}

.reasoning-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.reasoning-toggle {
  display: flex;
  transition: transform 0.2s;
}

.reasoning-block.collapsed .reasoning-toggle {
  transform: rotate(-90deg);
}

.reasoning-content {
  padding: 8px 12px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  white-space: pre-wrap;
  border-top: 1px solid rgba(124,77,255,0.2);
  max-height: 400px;
  overflow-y: auto;
}

.reasoning-block.collapsed .reasoning-content {
  display: none;
}

/* 搜索结果 */
.search-results {
  margin-bottom: 8px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.search-result-item {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
}

.search-result-item:last-child { border-bottom: none; }

.search-result-title {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--accent-primary);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}

.search-result-title:hover { text-decoration: underline; }

.search-result-snippet {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* 聊天输入区 */
.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.chat-input-wrap {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  min-height: 40px;
  max-height: 200px;
  font-family: inherit;
  transition: border-color 0.15s;
}

.chat-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(0,212,255,0.15);
}

.chat-hints {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* ===== 代码块 ===== */
.code-block {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 8px 0;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--text-muted);
}

.code-block pre {
  padding: 12px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
}

.code-block code {
  color: var(--accent-primary);
  font-family: 'SF Mono', Monaco, Consolas, monospace;
}

/* ===== 进度条 ===== */
.progress-bar {
  position: relative;
  display: flex;
  align-items: center;
  height: 18px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  overflow: hidden;
  min-width: 100px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-info));
  transition: width 0.3s ease;
  border-radius: var(--radius-sm);
}

.progress-fill.active { background: var(--accent-success); }
.progress-fill.cooling { background: var(--accent-danger); }
.progress-fill.softbusy { background: var(--accent-warning); }
.progress-fill.info { background: var(--accent-info); }

.progress-bar span {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--text-primary);
  text-shadow: 0 0 4px rgba(0,0,0,0.5);
  white-space: nowrap;
}

/* ===== 图表 ===== */
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 100%;
  padding: 12px 0;
  min-height: 200px;
}

.chart-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.chart-bar-value {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
}

.chart-bar {
  width: 100%;
  max-width: 40px;
  background: linear-gradient(180deg, var(--accent-primary), var(--accent-info));
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: height 0.3s ease;
  min-height: 4px;
}

.chart-bar-label {
  font-size: 11px;
  color: var(--text-muted);
}

/* 状态分布 */
.status-dist, .model-dist {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0;
}

.status-dist-item, .model-dist-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.status-dist-label, .model-dist-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.status-dist-label .muted, .model-dist-label .muted {
  margin-left: auto;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ===== 日志详情 ===== */
.log-detail {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
  color: var(--text-muted);
  min-width: 80px;
}

.error-pre {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px;
  font-size: 12px;
  color: var(--accent-danger);
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ===== 设置 ===== */
.settings-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.theme-settings {
  display: flex;
  gap: 8px;
}

/* ===== 密钥创建信息 ===== */
.key-created-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===== 响应式补充 ===== */
@media (max-width: 768px) {
  .chat-page { flex-direction: column; height: auto; }
  .chat-sidebar { width: 100%; max-height: 240px; border-right: none; border-bottom: 1px solid var(--border-color); }
  .message { max-width: 95%; }
  .hero-title { font-size: 32px; }
  .hero-stats { gap: 16px; }
  .hero-stat .num { font-size: 20px; }
  .features, .cta { padding: 32px 16px; }
  .footer-inner { flex-direction: column; text-align: center; }
}
