/* ============================================
   Antigravity Proxy - 前端样式 V3
   修复弹窗居中、加载动画、错误信息显示
   支持移动端响应式布局
   ============================================ */

/* === 基础变量 === */
:root {
  /* 浅色主题 (默认) */
  --color-bg: #f8f9fa;
  --color-bg-gradient: radial-gradient(ellipse at 50% 0%, rgba(66, 133, 244, 0.04), transparent 50%);
  --color-surface: #ffffff;
  --color-surface-2: #f3f4f6;
  --color-surface-elevated: #ffffff;

  --color-border: rgba(0, 0, 0, 0.08);
  --color-border-hover: rgba(0, 0, 0, 0.15);

  --color-text: #1f2937;
  --color-text-secondary: #6b7280;
  --color-text-tertiary: #9ca3af;

  --color-primary: #4285f4;
  --color-primary-hover: #3b78e7;
  --color-primary-glow: rgba(66, 133, 244, 0.12);

  --color-success: #28a745;
  --color-warning: #f59e0b;
  --color-danger: #dc3545;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 40px rgba(66, 133, 244, 0.08);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;

  /* 安全区域支持 */
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-left: env(safe-area-inset-left, 0px);
  --safe-area-right: env(safe-area-inset-right, 0px);
}

/* 暗色主题 (可切换) */
:root.dark-mode {
  --color-bg: #0d0d12;
  --color-bg-gradient: radial-gradient(ellipse at 50% 0%, rgba(99, 102, 241, 0.08), transparent 50%);
  --color-surface: #16161f;
  --color-surface-2: #1c1c28;
  --color-surface-elevated: #22222e;

  --color-border: rgba(255, 255, 255, 0.06);
  --color-border-hover: rgba(255, 255, 255, 0.12);

  --color-text: #f2f2f7;
  --color-text-secondary: #8e8ea0;
  --color-text-tertiary: #5c5c6e;

  --color-primary: #6366f1;
  --color-primary-hover: #818cf8;
  --color-primary-glow: rgba(99, 102, 241, 0.2);

  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
}

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

html,
body {
  height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* === 动画 === */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Dialog 专用：保持 translate(-50%, -50%)，避免动画期间“先偏右下再回中间” */
@keyframes dialogIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

/* Spinner 加载动画 */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

/* 加载占位 */
.loading-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 20px;
  color: var(--color-text-secondary);
}

.loading-placeholder .spinner {
  width: 28px;
  height: 28px;
}

/* === 布局 === */
.app-shell {
  height: 100vh;
  width: 100%;
  background: var(--color-bg);
  overflow-y: scroll; /* 始终显示滚动条，避免页面切换时按钮抖动 */
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 20px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

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

.brand-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--color-primary);
}

.brand-tag {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--color-primary);
  color: white;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tabs-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.tabs {
  display: inline-flex;
  position: relative;
  background: linear-gradient(145deg, #f5f5f7, #e8e8ed);
  padding: 6px;
  border-radius: 14px;
  gap: 3px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  user-select: none;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

.tabs::-webkit-scrollbar {
  height: 0;
}

.tab-slider {
  position: absolute;
  top: 6px;
  left: 0;
  right: 0;
  height: calc(100% - 12px);
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.06);
  z-index: 0;
  pointer-events: none;
}

.tab-slider::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.8), transparent);
  border-radius: 10px 10px 0 0;
  opacity: 0.5;
}

.tab {
  position: relative;
  padding: 10px 18px;
  border: none;
  background: transparent;
  border-radius: 10px;
  color: #666;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s ease;
  z-index: 1;
  overflow: hidden;
}

.tab.active {
  color: #1a1a1a;
  font-weight: 600;
}

.tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.5);
  color: #333;
}

.tab::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(66, 133, 244, 0.15);
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease;
  z-index: -1;
}

.tab:active::before {
  width: 200%;
  height: 200%;
}

.tab-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

:root.dark-mode .tabs {
  background: linear-gradient(145deg, #1c1c28, #22222e);
}

:root.dark-mode .tab-slider {
  background: #2a2a3a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

:root.dark-mode .tab {
  color: #8e8ea0;
}

:root.dark-mode .tab.active {
  color: #f2f2f7;
}

:root.dark-mode .tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
}

#pageContent {
  min-height: 400px;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

#pageContent.page-exit {
  opacity: 0;
  transform: translateY(-8px);
}

#pageContent.page-enter {
  animation: pageEnter 0.25s ease forwards;
}

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

/* 页面头部 */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-info {
  font-size: 13px;
  color: var(--color-text-secondary);
  padding-right: 12px;
  border-right: 1px solid var(--color-border);
  margin-right: 4px;
}

.user-info strong {
  color: var(--color-text);
  font-weight: 600;
}

/* === 卡片 === */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  transition: all var(--transition-normal);
}

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

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

.card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-tertiary);
}

.card-value {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
  line-height: 1.1;
}

.card-subtitle {
  font-size: 14px;
  color: var(--color-text-secondary);
}

/* 统计网格 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 28px;
}

.stats-grid .card {
  padding: 28px;
}

/* 日志页面3列统计 */
.stats-grid--logs {
  grid-template-columns: repeat(3, 1fr);
}

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

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

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

@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid--logs {
    grid-template-columns: 1fr;
  }
}

/* 内容网格 */
.content-grid {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 24px;
}

.content-grid .card {
  min-height: 420px;
  display: flex;
  flex-direction: column;
}

.content-grid .card-header {
  flex-shrink: 0;
}

.content-grid .table-wrapper,
.content-grid .endpoint-list {
  flex: 1;
}

@media (max-width: 1000px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
}

/* === 按钮 === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn:hover {
  background: var(--color-surface-elevated);
  border-color: var(--color-border-hover);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), #7c3aed);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--color-primary-hover), #8b5cf6);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-danger {
  color: var(--color-danger);
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-icon {
  padding: 6px 10px;
  min-width: 32px;
}

/* === 徽章 === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-success {
  background: rgba(16, 185, 129, 0.12);
  color: var(--color-success);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.12);
  color: var(--color-warning);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--color-danger);
}

.badge-neutral {
  background: var(--color-surface-2);
  color: var(--color-text-secondary);
}

/* 层级徽章 */
.badge-tier-standard {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
  color: #7c3aed;
}

.badge-tier-payg {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(52, 211, 153, 0.15));
  color: var(--color-success);
}

.badge-tier-free {
  background: var(--color-surface-2);
  color: var(--color-text-tertiary);
}

.badge-tier-enterprise {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(251, 191, 36, 0.15));
  color: #d97706;
}

:root.dark-mode .badge-tier-standard {
  color: #a78bfa;
}

:root.dark-mode .badge-tier-enterprise {
  color: #fbbf24;
}

/* 状态指示器 */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  white-space: nowrap;
}

.status-indicator::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-indicator.status-active {
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
}

.status-indicator.status-active::before {
  background: var(--color-success);
  box-shadow: 0 0 6px var(--color-success);
}

.status-indicator.status-disabled {
  background: rgba(245, 158, 11, 0.1);
  color: var(--color-warning);
}

.status-indicator.status-disabled::before {
  background: var(--color-warning);
}

.status-indicator.status-error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-danger);
}

.status-indicator.status-error::before {
  background: var(--color-danger);
  box-shadow: 0 0 6px var(--color-danger);
}

.status-indicator.status-unknown {
  background: var(--color-surface-2);
  color: var(--color-text-tertiary);
}

.status-indicator.status-unknown::before {
  background: var(--color-text-tertiary);
}

/* === 表单 === */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 13px;
  color: var(--color-text);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

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

.form-textarea {
  min-height: 100px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 12px;
}

.form-row {
  display: flex;
  gap: 14px;
  align-items: flex-end;
}

.form-row>* {
  flex: 1;
  min-width: 0;
}

/* === 表格 === */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

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

.table th,
.table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.table th {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-tertiary);
  background: var(--color-surface-2);
}

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

.table tbody tr:hover td {
  background: var(--color-surface-2);
}

.table .mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.table .actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

/* === 配额弹窗 === */
.quota-dialog {
  max-width: 760px;
  width: min(92vw, 760px);
}

.quota-dialog .dialog-title {
  font-size: 20px;
  font-weight: 700;
}

.quota-dialog .dialog-subtitle {
  font-size: 14px;
}

.quota-dialog .dialog-body {
  font-size: 14px;
}

.quota-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.quota-card {
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.quota-card-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-tertiary);
}

.quota-card-value {
  margin-top: 6px;
  font-size: 18px;
  font-weight: 700;
}

.quota-card-value--mono {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.quota-empty {
  padding: 32px 0 8px;
}

.quota-table .table {
  font-size: 14px;
}

.quota-table .table th {
  font-size: 11px;
}

.quota-table .table td {
  vertical-align: top;
}

.quota-model-name {
  font-size: 14px;
  font-weight: 600;
}

.quota-model-id {
  margin-top: 2px;
  font-size: 11px;
  color: var(--color-text-tertiary);
  word-break: break-all;
}

.quota-meter {
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quota-meter-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.quota-percent {
  font-size: 14px;
  font-weight: 700;
}

.quota-fraction {
  font-size: 11px;
  color: var(--color-text-tertiary);
}

.quota-bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  overflow: hidden;
}

.quota-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  transition: width var(--transition-slow);
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-hover));
}

.quota-bar-fill.good {
  background: linear-gradient(90deg, var(--color-success), #34d399);
}

.quota-bar-fill.warn {
  background: linear-gradient(90deg, var(--color-warning), #fbbf24);
}

.quota-bar-fill.danger {
  background: linear-gradient(90deg, var(--color-danger), #f87171);
}

.quota-bar-fill.unknown {
  background: linear-gradient(90deg, var(--color-text-tertiary), #6b7280);
}

.quota-reset {
  font-size: 11px;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

/* 错误信息直接显示 */
.error-text {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-danger);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

/* 日志错误行样式 */
.log-row-error td {
  border-bottom: none !important;
}

.log-error-row td {
  padding-top: 0 !important;
  padding-bottom: 14px !important;
}

.log-error-cell {
  background: rgba(220, 53, 69, 0.04);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.log-error-cell .error-text {
  padding: 10px 14px;
  background: rgba(220, 53, 69, 0.06);
  border-left: 3px solid var(--color-danger);
  border-radius: var(--radius-sm);
}

/* === API 端点展示 === */
.endpoint-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.endpoint-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  transition: all var(--transition-fast);
}

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

.endpoint-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-tertiary);
}

.endpoint-url {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-primary);
  word-break: break-all;
  line-height: 1.5;
}

/* === Toast === */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  color: var(--color-text);
  font-size: 13px;
  z-index: 9999;
  transform: translateY(120px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.toast-icon {
  font-size: 18px;
}

/* === Dialog 弹窗 - 修复居中 === */
dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  color: var(--color-text);
  padding: 0;
  max-width: 520px;
  width: 90%;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  animation: dialogIn 0.25s ease;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
}

dialog[open] {
  display: flex;
  flex-direction: column;
}

.dialog-header {
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--color-border);
}

.dialog-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dialog-subtitle {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 6px;
}

.dialog-body {
  padding: 24px 28px;
  max-height: 60vh;
  overflow-y: auto;
}

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

/* === 登录页 === */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: var(--color-bg-gradient), var(--color-bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 40px;
}

.login-brand {
  text-align: center;
  margin-bottom: 40px;
}

.login-brand .brand-name {
  font-size: 28px;
}

/* === 工具类 === */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.text-secondary {
  color: var(--color-text-secondary);
}

.text-success {
  color: var(--color-success);
}

.text-warning {
  color: var(--color-warning);
}

.text-danger {
  color: var(--color-danger);
}

.font-mono {
  font-family: var(--font-mono);
}

.mb-0 {
  margin-bottom: 0;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-4 {
  margin-bottom: 16px;
}

.mb-6 {
  margin-bottom: 24px;
}

.mt-4 {
  margin-top: 16px;
}

.gap-2 {
  gap: 8px;
}

.gap-3 {
  gap: 12px;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

/* === 响应式 === */
@media (max-width: 768px) {
  html,
  body {
    height: auto;
  }

  body {
    overflow: auto;
  }

  .container {
    padding: 16px;
    padding-left: calc(16px + var(--safe-area-left));
    padding-right: calc(16px + var(--safe-area-right));
    padding-bottom: calc(16px + var(--safe-area-bottom));
  }

  .app-header {
    margin-bottom: 16px;
  }

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

  .brand-tag {
    font-size: 8px;
    padding: 2px 6px;
  }

  .header-right .user-info {
    display: none;
  }

  .tabs-container {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
  }

  .tabs {
    width: 100%;
    justify-content: flex-start;
    padding: 4px;
    border-radius: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab {
    flex: 0 0 auto;
    padding: 10px 16px;
    font-size: 13px;
    text-align: center;
    white-space: nowrap;
  }

  .tab-actions {
    justify-content: flex-end;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page-title {
    font-size: 20px;
  }

  .form-row {
    flex-direction: column;
    align-items: stretch;
  }

  .form-row > * {
    width: 100%;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .user-info {
    display: none;
  }

  .table-wrapper {
    border: none;
    background: transparent;
    overflow-x: visible;
    -webkit-overflow-scrolling: touch;
  }

  .table {
    display: block;
    width: 100%;
  }

  .table thead {
    display: none;
  }

  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table tr {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    margin-bottom: 12px;
    overflow: hidden;
  }

  .table td {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border);
    word-break: break-word;
  }

  .table td::before {
    content: attr(data-label);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-tertiary);
    margin-bottom: 2px;
  }

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

  .table td[colspan] {
    justify-content: center;
    text-align: center;
  }

  .table td[colspan]::before {
    display: none;
  }

  .table .actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .table .actions .btn {
    flex: 1 1 auto;
    min-width: 70px;
  }

  .endpoint-url {
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .error-text {
    max-width: 100%;
    white-space: pre-wrap;
    overflow-x: auto;
  }

  .card {
    padding: 16px;
    border-radius: var(--radius-md);
  }

  .card-value {
    font-size: 26px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px;
  }
}

/* ============================================
   新增 UI 组件样式
   ============================================ */

/* === Toast 容器 === */
.toast-container {
  position: fixed;
  /* Keep the container pinned to the bottom-right consistently across browsers. */
  inset: auto;
  top: auto;
  left: auto;
  bottom: 28px;
  right: 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
  background: transparent;
  border: 0;
  padding: 0;
}

.toast-container--in-dialog {
  position: absolute;
  bottom: 18px;
  right: 18px;
}

.toast-container .toast {
  position: relative;
  bottom: auto;
  right: auto;
  pointer-events: auto;
}

.toast-message {
  flex: 1;
}

.toast-action {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-primary);
  background: transparent;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-left: 12px;
  transition: all var(--transition-fast);
}

.toast-action:hover {
  background: var(--color-primary-glow);
}

.toast-close {
  padding: 4px 8px;
  background: transparent;
  border: none;
  color: var(--color-text-tertiary);
  cursor: pointer;
  margin-left: 8px;
  font-size: 14px;
  line-height: 1;
  transition: color var(--transition-fast);
}

.toast-close:hover {
  color: var(--color-text);
}

/* Toast 类型变体 */
.toast-success {
  border-left: 3px solid var(--color-success);
}

.toast-error {
  border-left: 3px solid var(--color-danger);
}

.toast-warning {
  border-left: 3px solid var(--color-warning);
}

.toast-loading {
  border-left: 3px solid var(--color-primary);
}

/* === 分页组件 === */
.pagination {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  flex-wrap: wrap;
}

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

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

.pagination-pages {
  display: flex;
  gap: 4px;
}

.pagination-ellipsis {
  padding: 6px 12px;
  color: var(--color-text-tertiary);
}

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

.form-select-sm,
.form-input-sm {
  padding: 6px 10px;
  font-size: 12px;
}

/* === 下拉选择组件 === */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  min-width: 160px;
  font-family: inherit;
  font-size: 13px;
  color: var(--color-text);
  transition: all var(--transition-fast);
}

.dropdown-trigger:hover {
  border-color: var(--color-border-hover);
}

.dropdown.open .dropdown-trigger {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.dropdown-value {
  flex: 1;
  text-align: left;
}

.dropdown-value.placeholder {
  color: var(--color-text-tertiary);
}

.dropdown-clear {
  padding: 2px 6px;
  font-size: 12px;
  color: var(--color-text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.dropdown-clear:hover {
  color: var(--color-danger);
  background: rgba(239, 68, 68, 0.1);
}

.dropdown-arrow {
  color: var(--color-text-tertiary);
  transition: transform var(--transition-fast);
}

.dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  animation: fadeIn 0.15s ease;
  overflow: hidden;
}

.dropdown-search {
  padding: 8px;
  border-bottom: 1px solid var(--color-border);
}

.dropdown-search .form-input {
  padding: 8px 12px;
}

.dropdown-options {
  max-height: 200px;
  overflow-y: auto;
}

.dropdown-option {
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.dropdown-option:hover {
  background: var(--color-surface-2);
}

.dropdown-option.selected {
  background: var(--color-primary-glow);
  color: var(--color-primary);
}

.dropdown-option.highlighted {
  background: var(--color-surface-2);
}

.dropdown-empty {
  padding: 20px;
  text-align: center;
  color: var(--color-text-tertiary);
}

/* === 确认对话框 === */
.confirm-dialog .dialog-body {
  padding: 24px 28px 32px;
}

.confirm-dialog p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-text-secondary);
}

.confirm-icon {
  display: inline-block;
  margin-right: 8px;
  font-size: 18px;
}

/* === 筛选器样式 === */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--color-primary-glow);
  color: var(--color-primary);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.filter-tag-remove {
  cursor: pointer;
  opacity: 0.7;
  font-size: 14px;
}

.filter-tag-remove:hover {
  opacity: 1;
}

.filter-active::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: var(--color-primary);
  border-radius: 50%;
}

/* === 卡片值子元素 === */
.card-value-sub {
  font-size: 18px;
  color: var(--color-text-secondary);
  font-weight: 400;
}

/* === 滚动条美化 === */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-border-hover);
}

/* === 响应式分页 === */
@media (max-width: 768px) {
  .pagination {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .pagination-controls {
    width: 100%;
    justify-content: center;
  }

  .pagination-size,
  .pagination-jump {
    width: 100%;
    justify-content: center;
  }
}

/* === 移动端 Dialog 优化 === */
@media (max-width: 768px) {
  dialog {
    width: 95%;
    max-width: none;
    max-height: 90vh;
    border-radius: var(--radius-lg);
  }

  .dialog-header {
    padding: 18px 20px 16px;
  }

  .dialog-title {
    font-size: 16px;
  }

  .dialog-subtitle {
    font-size: 12px;
  }

  .dialog-body {
    padding: 16px 20px;
    max-height: 55vh;
  }

  .dialog-footer {
    padding: 14px 20px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .dialog-footer .btn {
    flex: 1 1 auto;
    min-width: 100px;
  }

  /* 配额弹窗移动端 */
  .quota-dialog {
    width: 95%;
  }

  .quota-summary {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .quota-card {
    padding: 12px 14px;
  }

  .quota-card-value {
    font-size: 16px;
  }

  /* 配额表格移动端卡片式布局 */
  .quota-table .table tr {
    display: flex;
    flex-direction: column;
  }

  .quota-table .table td {
    padding: 10px 12px;
  }

  .quota-meter {
    min-width: 100%;
  }

  .quota-model-name {
    font-size: 13px;
  }

  .quota-model-id {
    font-size: 10px;
  }

  /* OAuth 弹窗移动端 */
  #oauthDialog .dialog-body .flex {
    flex-direction: column;
    align-items: stretch;
  }

  #oauthDialog .dialog-body .btn {
    width: 100%;
  }

  /* Toast 移动端 */
  .toast-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
  }

  .toast {
    bottom: 16px;
    right: 16px;
    left: 16px;
    max-width: none;
  }

  /* 内容网格移动端 */
  .content-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* 端点列表移动端 */
  .endpoint-item {
    padding: 12px 14px;
  }

  .endpoint-label {
    font-size: 9px;
  }

  .endpoint-url {
    font-size: 10px;
    line-height: 1.4;
  }

  /* 按钮移动端优化 */
  .btn {
    padding: 10px 14px;
    font-size: 13px;
  }

  .btn-sm {
    padding: 8px 12px;
    font-size: 12px;
  }

  .btn-icon {
    padding: 8px 10px;
    min-width: 36px;
  }

  /* 表单优化 */
  .form-input,
  .form-select,
  .form-textarea {
    padding: 12px 14px;
    font-size: 14px;
  }

  /* 下拉选择移动端 */
  .dropdown-trigger {
    min-width: 100%;
  }

  .dropdown-menu {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: auto;
    top: 50%;
    transform: translateY(-50%);
    max-height: 60vh;
    border-radius: var(--radius-lg);
  }

  /* 筛选条移动端 */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  /* 徽章移动端 */
  .badge {
    padding: 3px 8px;
    font-size: 10px;
  }
}

/* === 超小屏幕优化 (手机竖屏) === */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr !important;
  }

  .card-value {
    font-size: 22px;
  }

  .page-title {
    font-size: 18px;
  }

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

  .brand-tag {
    font-size: 8px;
    padding: 2px 6px;
  }

  .nav-item {
    padding: 10px 12px;
    font-size: 12px;
  }

  .nav-item .icon {
    font-size: 15px;
  }

  .header-actions .btn {
    flex: 1 1 auto;
  }

  .table td {
    padding: 10px 12px;
  }

  .table .actions .btn {
    min-width: 60px;
    font-size: 11px;
  }

  dialog {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .dialog-body {
    max-height: calc(100vh - 160px);
  }
}

/* === Import Dialog === */
.import-dialog {
  width: 480px;
  max-width: 90vw;
}

.import-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  padding: 4px;
}

.import-tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

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

.import-tab.active {
  background: var(--color-primary);
  color: white;
}

.import-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.import-form .form-group {
  margin: 0;
}

.file-import-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  transition: var(--transition-fast);
  cursor: pointer;
}

.file-import-zone:hover,
.file-import-zone.drag-over {
  border-color: var(--color-primary);
  background: rgba(99, 102, 241, 0.05);
}

.file-import-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.6;
}

.file-import-text {
  font-size: 14px;
  color: var(--color-text);
  margin-bottom: 8px;
}

.file-import-or {
  font-size: 12px;
  color: var(--color-text-tertiary);
  margin: 8px 0;
}

/* === 账号页面特定样式 === */
.accounts-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

/* 移动端全选按钮 - 桌面端隐藏 */
.mobile-select-all {
  display: none;
}

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

@media (max-width: 768px) {
  .accounts-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    margin-bottom: 24px;
  }

  /* 移动端显示全选按钮 */
  .mobile-select-all {
    display: inline-flex;
  }

  .accounts-toolbar-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .accounts-toolbar-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }
  
  .table .actions {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
  }

  .table .actions .btn {
    min-height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .table .actions .btn[data-cmd="accounts:toggle-status"] {
    grid-column: span 5;
    order: 10;
  }
}

.file-import-hint {
  font-size: 11px;
  color: var(--color-text-tertiary);
  margin-top: 16px;
  font-family: var(--font-mono);
}

/* === 账号表格样式 === */
.accounts-table {
  table-layout: auto;
}

.accounts-table th,
.accounts-table td {
  vertical-align: middle;
}

.account-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--color-primary);
}

.accounts-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.accounts-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.selection-count {
  color: var(--color-primary);
  font-weight: 600;
  font-size: 13px;
}

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

.row-selected {
  background: var(--color-primary-glow) !important;
}

.row-disabled {
  opacity: 0.6;
}

.account-email-cell {
  max-width: 240px;
}

.account-email {
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.quota-value {
  font-weight: 700;
  font-size: 14px;
}

.quota-value.text-success {
  color: var(--color-success) !important;
}

.quota-value.text-warning {
  color: var(--color-warning) !important;
}

.quota-value.text-danger {
  color: var(--color-danger) !important;
}

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

.btn-icon {
  padding: 6px 10px;
  min-width: 36px;
  min-height: 36px;
}

/* 旧的账号卡片样式 - 保留兼容 */
.account-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.account-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.account-card.disabled {
  opacity: 0.7;
  background: var(--color-surface-2);
}

.account-card-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  min-height: 60px;
}

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

.account-email {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-meta-mobile {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

.account-card-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-dot.status-active { background: var(--color-success); }
.status-dot.status-disabled { background: var(--color-warning); }
.status-dot.status-error { background: var(--color-danger); }
.status-dot.status-unknown { background: var(--color-text-tertiary); }

.btn-expand {
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-expand:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.account-card-details {
  display: none;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-2);
}

.account-card-details.expanded {
  display: block;
}

/* 详情网格布局 */
.account-details-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.detail-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-card-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-card-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.detail-card-value--lg {
  font-size: 20px;
  font-weight: 700;
}

/* 按钮操作栏 */
.account-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.account-actions-left,
.account-actions-right {
  display: flex;
  gap: 8px;
}

.account-actions-right {
  margin-left: auto;
}

/* 旧样式保留兼容 */
.account-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
}

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

.detail-label {
  font-size: 12px;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.detail-value {
  font-size: 13px;
  color: var(--color-text);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.status-badge.status-active {
  background: rgba(40, 167, 69, 0.1);
  color: var(--color-success);
}

.status-badge.status-disabled {
  background: rgba(245, 158, 11, 0.1);
  color: var(--color-warning);
}

.status-badge.status-error {
  background: rgba(220, 53, 69, 0.1);
  color: var(--color-danger);
}

.status-badge.status-unknown {
  background: var(--color-surface-2);
  color: var(--color-text-secondary);
}

.account-actions-mobile {
  display: none;
  padding: 12px 20px;
  background: var(--color-surface-2);
  border-top: 1px solid var(--color-border);
  gap: 8px;
  flex-wrap: wrap;
}

.account-actions-mobile.expanded {
  display: flex;
}

.account-actions-mobile .btn {
  flex: 1;
  min-width: 70px;
  justify-content: center;
}

.btn-warning {
  color: var(--color-warning);
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.2);
}

.btn-warning:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.3);
}

.btn-success {
  color: var(--color-success);
  background: rgba(40, 167, 69, 0.1);
  border-color: rgba(40, 167, 69, 0.2);
}

.btn-success:hover {
  background: rgba(40, 167, 69, 0.15);
  border-color: rgba(40, 167, 69, 0.3);
}

@media (max-width: 768px) {
  /* 账号表格移动端适配 */
  .accounts-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .accounts-toolbar-left {
    justify-content: center;
  }

  .accounts-toolbar-actions {
    justify-content: center;
  }

  .accounts-table th:nth-child(3),
  .accounts-table td:nth-child(3),
  .accounts-table th:nth-child(6),
  .accounts-table td:nth-child(6) {
    display: none;
  }

  .account-email-cell {
    max-width: 140px;
  }

  .row-actions {
    flex-wrap: wrap;
  }

  .btn-icon {
    min-width: 32px;
    min-height: 32px;
    padding: 4px 8px;
  }

  /* 旧的卡片样式兼容 */
  .account-card-main {
    padding: 14px 16px;
  }

  .account-email {
    font-size: 14px;
  }

  .account-meta-mobile {
    font-size: 11px;
  }

  .account-card-details {
    padding: 14px 16px 16px;
  }

  /* 网格在移动端变成2列 */
  .account-details-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .detail-card {
    padding: 10px 12px;
  }

  .detail-card-label {
    font-size: 10px;
  }

  .detail-card-value {
    font-size: 13px;
  }

  .detail-card-value--lg {
    font-size: 18px;
  }

  /* 按钮栏在移动端变成垂直布局 */
  .account-actions-bar {
    flex-direction: column;
    gap: 10px;
  }

  .account-actions-left,
  .account-actions-right {
    width: 100%;
    justify-content: stretch;
  }

  .account-actions-left .btn,
  .account-actions-right .btn {
    flex: 1;
    justify-content: center;
  }

  .account-detail-row {
    padding: 6px 0;
  }

  .detail-label {
    font-size: 11px;
  }

  .detail-value {
    font-size: 12px;
  }

  .account-actions-mobile {
    padding: 10px 16px;
  }

  .account-actions-mobile .btn {
    font-size: 12px;
    padding: 10px 8px;
    min-height: 44px;
  }

  .account-list {
    gap: 10px;
  }
}

/* === 触摸优化 === */
* {
  -webkit-tap-highlight-color: transparent;
}

button,
.btn,
.tab,
a {
  touch-action: manipulation;
}

.btn,
.tab,
.btn-expand {
  min-height: 40px;
}

.btn-sm {
  min-height: 36px;
}

.btn-icon {
  min-width: 40px;
  min-height: 40px;
}

.btn:active,
.tab:active {
  transform: scale(0.98);
  transition: transform 0.1s ease;
}

.btn:active:not(:disabled) {
  opacity: 0.85;
}

.btn:focus-visible,
.tab:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

@media (hover: none) {
  .btn:focus:not(:focus-visible),
  .tab:focus:not(:focus-visible) {
    outline: none;
  }
}
