/* ==========================================================================
   Ozon跨境铺货平台 — PWA 样式表
   移动优先 · 深色主题 · 响应式
   ========================================================================== */

/* ==================== CSS 变量 (主题色) ==================== */
:root {
  /* 背景色 */
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-2: #232734;
  --surface-3: #2d3242;
  --border: #2e3344;

  /* 强调色 */
  --accent: #0066ff;
  --accent-hover: #1a75ff;
  --accent-soft: rgba(0, 102, 255, 0.12);
  --accent2: #00d4aa;
  --accent2-soft: rgba(0, 212, 170, 0.12);

  /* 文字色 */
  --text: #e8eaf0;
  --text-secondary: #b4bac8;
  --muted: #8b92a5;
  --text-disabled: #5a6072;

  /* 语义色 */
  --success: #00d4aa;
  --warning: #ffb020;
  --danger: #ff5252;
  --info: #0066ff;

  /* 间距 */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;

  /* 圆角 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* 字号 */
  --font-xs: 11px;
  --font-sm: 13px;
  --font-base: 15px;
  --font-lg: 17px;
  --font-xl: 20px;
  --font-2xl: 24px;

  /* 阴影 */
  --shadow-sm: 0 1px 3px 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);

  /* 布局 */
  --nav-height: 60px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --max-width: 480px;

  /* 动画 */
  --transition: 0.2s ease;
}

/* ==================== 登录页 ==================== */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-base);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-card);
  border-radius: 16px;
  padding: 40px 24px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.login-logo {
  font-size: 48px;
  margin-bottom: 12px;
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 28px;
}

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

.login-input {
  padding: 12px 16px;
  font-size: 16px;
  border-radius: 8px;
}

.login-btn {
  margin-top: 8px;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
}

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

.login-error {
  color: var(--accent-red);
  font-size: 13px;
  margin-top: 12px;
  min-height: 18px;
}

.nav-logout {
  opacity: 0.6;
}

/* ==================== 模态框 ==================== */

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.modal-content {
  background: var(--bg-card);
  border-radius: 12px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
}

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

.modal-header h2 {
  font-size: 18px;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
}

.modal-body {
  padding: 20px;
}

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

.modal-overlay .btn-sm {
  font-size: 13px;
}

/* ==================== 基础重置 ==================== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: var(--font-base);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  padding-top: var(--safe-top);
  /* 底部留出导航栏空间 */
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom));
}

a {
  color: var(--accent);
  text-decoration: none;
}

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

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: var(--text);
}

img {
  display: block;
  max-width: 100%;
}

ul,
ol {
  list-style: none;
}

/* ==================== App 容器 ==================== */
#app {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

/* ==================== 页面视图 ==================== */
.view {
  display: none;
  padding: var(--space-lg);
  animation: fadeIn 0.25s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  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: var(--space-lg);
}

.page-title {
  font-size: var(--font-2xl);
  font-weight: 700;
  letter-spacing: -0.5px;
}

.page-subtitle {
  font-size: var(--font-sm);
  color: var(--muted);
  margin-top: 2px;
}

/* ==================== 卡片组件 ==================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  transition: border-color var(--transition);
}

.card:active {
  border-color: var(--accent);
}

.card-title {
  font-size: var(--font-lg);
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
}

.card-row + .card-row {
  border-top: 1px solid var(--border);
}

/* ==================== 网格布局 ==================== */
.grid {
  display: grid;
  gap: var(--space-md);
}

.grid-2 {
  grid-template-columns: 1fr 1fr;
}

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

/* ==================== 统计卡片 ==================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  text-align: center;
}

.stat-value {
  font-size: var(--font-2xl);
  font-weight: 700;
  color: var(--accent2);
  line-height: 1.2;
}

.stat-label {
  font-size: var(--font-sm);
  color: var(--muted);
  margin-top: var(--space-xs);
}

.stat-card.accent .stat-value {
  color: var(--accent);
}

/* ==================== 快捷操作按钮 ==================== */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg) var(--space-sm);
  min-height: 88px;
  transition: all var(--transition);
}

.quick-btn:active {
  background: var(--surface-2);
  transform: scale(0.96);
}

.quick-btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 20px;
}

.quick-btn.accent2 .quick-btn-icon {
  background: var(--accent2-soft);
  color: var(--accent2);
}

.quick-btn-label {
  font-size: var(--font-sm);
  color: var(--text-secondary);
}

/* ==================== 底部导航栏 ==================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: var(--max-width);
  margin: 0 auto;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(26, 29, 39, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: var(--font-xs);
  transition: color var(--transition);
  min-height: 44px;
  position: relative;
}

.nav-item.active {
  color: var(--accent);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  background: var(--accent);
  border-radius: 0 0 3px 3px;
}

.nav-icon {
  font-size: 22px;
  line-height: 1;
}

.nav-badge {
  position: absolute;
  top: 6px;
  right: 50%;
  margin-right: -22px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  font-weight: 600;
}

/* ==================== 表单控件 ==================== */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-size: var(--font-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  font-weight: 500;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px var(--space-md);
  color: var(--text);
  font-size: var(--font-base);
  transition: border-color var(--transition);
  min-height: 44px;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-3);
}

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

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238b92a5' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-hint {
  font-size: var(--font-xs);
  color: var(--muted);
  margin-top: var(--space-xs);
}

.form-row {
  display: flex;
  gap: var(--space-md);
}

.form-row > .form-group {
  flex: 1;
}

/* ==================== 按钮 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px var(--space-xl);
  border-radius: var(--radius-sm);
  font-size: var(--font-base);
  font-weight: 600;
  min-height: 44px;
  transition: all var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:active {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn-success {
  background: var(--accent2);
  color: #0f1117;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

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

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 8px var(--space-md);
  font-size: var(--font-sm);
  min-height: 36px;
}

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

/* ==================== 开关 (Toggle) ==================== */
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  min-height: 44px;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  width: 48px;
  height: 28px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  position: relative;
  transition: background var(--transition);
  flex-shrink: 0;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
}

.toggle input:checked + .toggle-track {
  background: var(--accent);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(20px);
}

.toggle-label {
  margin-left: var(--space-md);
  font-size: var(--font-base);
  color: var(--text);
}

/* ==================== 滑块 (Range Slider) ==================== */
.range-group {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  outline: none;
}

input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

input[type='range']::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.range-value {
  min-width: 56px;
  text-align: right;
  font-weight: 600;
  color: var(--accent2);
  font-size: var(--font-sm);
}

/* ==================== 可折叠区域 ==================== */
.collapse {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--space-lg);
}

.collapse-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--surface-2);
  font-weight: 600;
  font-size: var(--font-base);
  min-height: 44px;
  cursor: pointer;
}

.collapse-arrow {
  transition: transform var(--transition);
  color: var(--muted);
}

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

.collapse-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.collapse.open .collapse-body {
  max-height: 600px;
  padding: var(--space-lg);
}

/* ==================== 徽章 (Badge) ==================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  font-weight: 600;
  white-space: nowrap;
}

.badge-success {
  background: var(--accent2-soft);
  color: var(--accent2);
}

.badge-warning {
  background: rgba(255, 176, 32, 0.15);
  color: var(--warning);
}

.badge-danger {
  background: rgba(255, 82, 82, 0.15);
  color: var(--danger);
}

.badge-info {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-muted {
  background: var(--surface-3);
  color: var(--muted);
}

/* ==================== 进度条 ==================== */
.progress {
  width: 100%;
  height: 8px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.progress-bar.danger {
  background: var(--danger);
}

/* ==================== 加载动画 ==================== */
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--surface-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

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

.loading-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-2xl);
  color: var(--muted);
}

.loading-inline {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ==================== 空状态 ==================== */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-state-text {
  font-size: var(--font-base);
  margin-bottom: var(--space-lg);
}

/* ==================== Toast 通知 ==================== */
.toast-container {
  position: fixed;
  top: calc(var(--safe-top) + var(--space-md));
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: calc(100% - 32px);
  max-width: 400px;
  pointer-events: none;
}

.toast {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-sm);
  animation: toastIn 0.3s ease;
  pointer-events: auto;
}

.toast-error {
  border-color: var(--danger);
  background: rgba(255, 82, 82, 0.1);
}

.toast-success {
  border-color: var(--accent2);
  background: rgba(0, 212, 170, 0.1);
}

.toast-warning {
  border-color: var(--warning);
  background: rgba(255, 176, 32, 0.1);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast.fade-out {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* ==================== 模态框 ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
  animation: overlayIn 0.2s ease;
}

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

@keyframes overlayIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: var(--max-width);
  max-height: 85vh;
  overflow-y: auto;
  padding: var(--space-xl);
  padding-bottom: calc(var(--space-xl) + var(--safe-bottom));
  animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.modal-title {
  font-size: var(--font-xl);
  font-weight: 700;
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  font-size: 20px;
  color: var(--muted);
  flex-shrink: 0;
}

.modal-close:active {
  background: var(--surface-3);
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-lg);
}

/* ==================== 任务卡片 ==================== */
.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  transition: border-color var(--transition);
}

.task-card:active {
  border-color: var(--accent);
}

.task-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.task-status-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.task-status-icon.pending {
  background: var(--surface-3);
  color: var(--muted);
}

.task-status-icon.running {
  background: var(--accent-soft);
  color: var(--accent);
}

.task-status-icon.success {
  background: var(--accent2-soft);
  color: var(--accent2);
}

.task-status-icon.failed {
  background: rgba(255, 82, 82, 0.15);
  color: var(--danger);
}

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

.task-source-url {
  font-size: var(--font-xs);
  color: var(--muted);
  word-break: break-all;
  margin-bottom: var(--space-xs);
}

.task-current-step {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.task-translated-title {
  font-size: var(--font-sm);
  color: var(--accent2);
  margin-top: var(--space-sm);
  font-style: italic;
}

.task-pricing {
  display: flex;
  gap: var(--space-lg);
  margin-top: var(--space-sm);
  font-size: var(--font-sm);
}

.task-pricing-item {
  color: var(--muted);
}

.task-pricing-item strong {
  color: var(--text);
  font-weight: 600;
}

/* ==================== 商品卡片 ==================== */
.product-card {
  display: flex;
  gap: var(--space-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  transition: border-color var(--transition);
}

.product-card:active {
  border-color: var(--accent);
}

.product-thumb {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  object-fit: cover;
  flex-shrink: 0;
}

.product-thumb-placeholder {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}

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

.product-name {
  font-size: var(--font-sm);
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: var(--space-xs);
}

.product-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: var(--font-sm);
  color: var(--muted);
  flex-wrap: wrap;
}

.product-price {
  color: var(--accent2);
  font-weight: 600;
  font-size: var(--font-base);
}

/* ==================== 搜索栏 ==================== */
.search-bar {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.search-bar .form-input {
  flex: 1;
}

/* ==================== 聊天界面 ==================== */
.chat-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  min-height: 64px;
}

.chat-list-item:active {
  background: var(--surface-2);
}

.chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-lg);
  font-weight: 600;
  flex-shrink: 0;
}

.chat-list-body {
  flex: 1;
  min-width: 0;
}

.chat-list-name {
  font-size: var(--font-base);
  font-weight: 600;
  margin-bottom: 2px;
}

.chat-list-preview {
  font-size: var(--font-sm);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-list-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.chat-list-time {
  font-size: var(--font-xs);
  color: var(--muted);
}

.unread-badge {
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  font-weight: 600;
}

.unread-summary {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.unread-summary-text {
  color: var(--accent);
  font-weight: 600;
  font-size: var(--font-base);
}

/* ==================== 对话视图 ==================== */
.conversation {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nav-height) - var(--safe-top) - var(--safe-bottom) - 120px);
}

.conversation-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-md);
}

.conversation-back {
  font-size: 22px;
  color: var(--accent);
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.conversation-name {
  font-size: var(--font-lg);
  font-weight: 600;
}

.conversation-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.message-bubble {
  max-width: 80%;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--font-sm);
  word-break: break-word;
}

.message-bubble.buyer {
  align-self: flex-start;
  background: var(--surface-2);
  border-bottom-left-radius: 4px;
}

.message-bubble.seller {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message-original {
  font-size: var(--font-sm);
  margin-bottom: 4px;
}

.message-translation {
  font-size: var(--font-xs);
  opacity: 0.75;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.message-bubble.buyer .message-translation {
  border-top-color: var(--border);
}

.message-time {
  font-size: 10px;
  opacity: 0.6;
  margin-top: 4px;
}

/* AI 建议回复卡片 */
.ai-suggestion {
  background: var(--accent2-soft);
  border: 1px solid var(--accent2);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}

.ai-suggestion-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.ai-suggestion-intent {
  font-size: var(--font-xs);
  background: var(--accent2);
  color: #0f1117;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.ai-suggestion-reply {
  font-size: var(--font-sm);
  color: var(--text);
  margin-bottom: var(--space-xs);
}

.ai-suggestion-translation {
  font-size: var(--font-xs);
  color: var(--muted);
  margin-bottom: var(--space-sm);
}

/* 聊天输入栏 */
.chat-input-bar {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-md) 0;
  border-top: 1px solid var(--border);
  align-items: flex-end;
}

.chat-input-bar .form-input {
  flex: 1;
  min-height: 44px;
}

.chat-action-btns {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
}

/* ==================== 分析图表 (CSS 条形图) ==================== */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.bar-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.bar-label {
  width: 80px;
  font-size: var(--font-xs);
  color: var(--text-secondary);
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  flex: 1;
  height: 24px;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: var(--radius-sm);
  transition: width 0.6s ease;
  min-width: 2px;
}

.bar-value {
  min-width: 60px;
  font-size: var(--font-xs);
  color: var(--muted);
  text-align: right;
  flex-shrink: 0;
}

/* ==================== 新闻列表 ==================== */
.news-item {
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border);
}

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

.news-title {
  font-size: var(--font-sm);
  font-weight: 600;
  margin-bottom: var(--space-xs);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-xs);
  color: var(--muted);
}

.news-source {
  background: var(--surface-3);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* ==================== 健康状态指示器 ==================== */
.health-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.health-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.health-dot.ok {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.health-dot.warn {
  background: var(--warning);
}

.health-dot.error {
  background: var(--danger);
}

/* ==================== 离线指示器 ==================== */
.offline-indicator {
  position: fixed;
  top: calc(var(--safe-top) + var(--space-sm));
  left: 50%;
  transform: translateX(-50%);
  background: var(--danger);
  color: #fff;
  font-size: var(--font-xs);
  padding: 4px var(--space-lg);
  border-radius: var(--radius-full);
  z-index: 500;
  display: none;
  font-weight: 600;
}

.offline-indicator.show {
  display: block;
}

/* ==================== 下拉刷新 ==================== */
.pull-refresh {
  text-align: center;
  padding: var(--space-md);
  color: var(--muted);
  font-size: var(--font-sm);
  display: none;
}

.pull-refresh.show {
  display: block;
}

/* ==================== 分割线与间距 ==================== */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-lg) 0;
  border: none;
}

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.text-muted { color: var(--muted); }
.text-sm { font-size: var(--font-sm); }
.text-xs { font-size: var(--font-xs); }
.text-accent { color: var(--accent); }
.text-accent2 { color: var(--accent2); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

/* ==================== 步骤列表 (任务详情) ==================== */
.step-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.step-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
}

.step-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
  background: var(--surface-3);
  color: var(--muted);
}

.step-dot.success {
  background: var(--accent2);
  color: #0f1117;
}

.step-dot.running {
  background: var(--accent);
  color: #fff;
  animation: pulse 1.5s ease infinite;
}

.step-dot.failed {
  background: var(--danger);
  color: #fff;
}

.step-dot.skipped {
  background: var(--surface-3);
  color: var(--text-disabled);
}

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

.step-name {
  flex: 1;
  font-size: var(--font-sm);
}

.step-duration {
  font-size: var(--font-xs);
  color: var(--muted);
}

/* ==================== 响应式断点 ==================== */
@media (min-width: 768px) {
  :root {
    --max-width: 720px;
    --font-base: 16px;
  }

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

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

@media (min-width: 1024px) {
  :root {
    --max-width: 960px;
  }

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

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

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

::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: var(--radius-full);
}

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

/* ==================== PWA 显示模式适配 ==================== */
@media (display-mode: standalone) {
  body {
    user-select: none;
    -webkit-user-select: none;
  }

  input,
  textarea {
    user-select: text;
    -webkit-user-select: text;
  }
}
