/* ==================== CSS 变量 ==================== */
:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --secondary: #0ea5e9;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-focus: #4f46e5;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.05);
  --transition: 0.2s ease;
}

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

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);
  line-height: 1.6;
  min-height: 100vh;
}

/* ==================== 容器 ==================== */
.app-container {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* ==================== 头部 ==================== */
.app-header {
  text-align: center;
  padding: 8px 0 20px;
}

.site-logo {
  font-size: 28px;
  font-weight: 900;
  background: linear-gradient(135deg, #4f46e5, #a855f7, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  letter-spacing: 4px;
  line-height: 1.2;
  transition: opacity 0.2s;
}

.site-logo:hover {
  opacity: 0.8;
}

.brand-col {
  flex: 1;
}

.brand-col .site-logo {
  display: inline-block;
}

.app-header h1 {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}

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

@media (max-width: 640px) {
  .site-logo {
    font-size: 22px;
  }
  .app-header h1 { font-size: 22px; }
}

/* ==================== API 配置栏 ==================== */
.config-bar {
  margin-bottom: 20px;
  text-align: right;
}

.config-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.config-toggle:hover { border-color: var(--primary); color: var(--primary); }

.config-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 8px;
  text-align: left;
  box-shadow: var(--shadow);
}

.config-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
}

.config-row label {
  min-width: 110px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: right;
}

.config-row input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  transition: var(--transition);
}

.config-row input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.config-status {
  margin-left: 10px;
  font-size: 12px;
  color: var(--success);
}

.config-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

/* ==================== 步骤指示器 ==================== */
.steps-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  gap: 0;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0.4;
  transition: var(--transition);
}

.step.active { opacity: 1; }
.step.completed { opacity: 0.7; }

.step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-secondary);
  transition: var(--transition);
}

.step.active .step-num {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.step.completed .step-num {
  background: var(--success);
  color: #fff;
}

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

.step.active .step-label { color: var(--primary); font-weight: 600; }

.step-connector {
  width: 60px;
  height: 2px;
  background: var(--border);
  margin: 0 8px;
  margin-bottom: 22px;
}

.step.completed + .step-connector,
.step.active + .step-connector {
  background: var(--primary);
}

/* ==================== 阶段容器 ==================== */
.phase { transition: var(--transition); }

/* ==================== 卡片 ==================== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card h2 { font-size: 20px; margin-bottom: 4px; }
.card h3 { font-size: 16px; margin-bottom: 8px; }
.card-desc { color: var(--text-secondary); font-size: 14px; margin-bottom: 20px; }

/* 汇总卡片 */
.summary-card {
  border-left: 4px solid var(--primary);
  background: var(--primary-light);
}

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

/* ==================== 输入区 ==================== */
.input-group textarea {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.7;
  resize: vertical;
  transition: var(--transition);
  color: var(--text);
}

.input-group textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

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

.input-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

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

/* ==================== 按钮 ==================== */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: #fff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.btn-outline {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
}

.btn-danger {
  background: var(--error);
  color: #fff;
  border: 1px solid var(--error);
}

.btn-danger:hover:not(:disabled) {
  opacity: 0.85;
}

.btn-icon { font-size: 16px; }

/* ==================== 维度选择区 ==================== */
.dimension-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.dimension-card:hover {
  border-color: var(--primary-light);
}

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

.dimension-header h3 {
  font-size: 17px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dimension-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.dimension-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  padding-left: 34px;
}

/* 选项网格 */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-left: 34px;
}

.option-item {
  position: relative;
}

.option-label {
  display: block;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  height: 100%;
  user-select: none;
  position: relative;
}

.option-label:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* 选中状态 */
.option-label.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
}

/* 优先级编号徽标 */
.priority-badge {
  display: none;
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.35);
  z-index: 2;
}

.option-label.selected .priority-badge {
  display: inline-flex;
}

.option-label .option-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.option-label .option-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.option-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}

.option-badge.core {
  background: #dbeafe;
  color: #1d4ed8;
}

.option-badge.extended {
  background: #fef3c7;
  color: #b45309;
}

.option-label.selected .option-title {
  color: var(--primary);
}

/* 维度备注区 */
.dimension-note-area {
  padding-left: 34px;
  margin-top: 12px;
}

.btn-note-toggle {
  background: none;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  font-size: 12px;
  padding: 5px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-note-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-note-toggle.note-open {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.note-input-wrap {
  margin-top: 8px;
}

.note-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
  color: var(--text);
  transition: var(--transition);
}

.note-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

/* 选择操作区 */
.selection-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* 多选提示 */
.multi-select-hint {
  text-align: center;
  font-size: 13px;
  color: var(--primary);
  background: var(--primary-light);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

/* ==================== 结果区 ==================== */
.result-card .result-header {
  text-align: center;
  margin-bottom: 20px;
}

.result-card .result-header p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

.prompt-box {
  background: #1e293b;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.prompt-actions {
  display: flex;
  justify-content: flex-end;
  padding: 10px 16px;
  background: #334155;
  gap: 8px;
}

.prompt-actions .btn {
  background: rgba(255,255,255,0.1);
  color: #cbd5e1;
  border: 1px solid rgba(255,255,255,0.1);
}

.prompt-actions .btn:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

.prompt-content {
  padding: 24px;
  color: #e2e8f0;
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 120px;
  max-height: 500px;
  overflow-y: auto;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.btn-share {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  border: none;
}

.btn-share:hover {
  background: linear-gradient(135deg, #4338ca, #4f46e5);
}

/* 执行按钮区 */
.execute-area {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.btn-execute {
  padding: 12px 32px;
  font-size: 15px;
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}

.btn-execute:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.execute-hint {
  font-size: 13px;
  color: var(--text-muted);
}

/* 执行结果卡片 */
.execution-card {
  border-left: 4px solid #10b981;
}

.execution-output-box .prompt-content {
  background: #1e293b;
}

/* 按钮 loading 态 */
.btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

/* ==================== 加载动画 ==================== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(248, 250, 252, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.loading-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

/* 内联分析/生成 Loading 状态 */
.phase-input.card.analyzing {
  opacity: 0.6;
  pointer-events: none;
  user-select: none;
}

.phase-input.card.analyzing textarea {
  background: var(--bg-secondary);
}

.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}

#btnAnalyze.loading,
#btnGenerate.loading {
  pointer-events: none;
  opacity: 0.85;
}

/* 当进入选择阶段时，输入区域变为只读摘要 */
.phase-input.card.done {
  opacity: 0.7;
}

.phase-input.card.done textarea {
  background: var(--bg-secondary);
  resize: none;
  pointer-events: none;
}

/* ==================== 开关控件 ==================== */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  border-radius: 24px;
  transition: 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--success); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ==================== 范围滑块 ==================== */
.wd-slider {
  -webkit-appearance: none;
  width: 160px;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  outline: none;
}
.wd-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
}
.wd-slider-warn { background: linear-gradient(90deg, #fbbf24 50%, #e2e8f0 50%); }
.wd-slider-danger { background: linear-gradient(90deg, #ef4444 50%, #e2e8f0 50%); }
.wd-range-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  min-width: 60px;
  text-align: center;
}

/* 生成中的选择阶段 */
#phaseSelect.generating {
  opacity: 0.6;
  pointer-events: none;
}

/* 流式输出标识 */
.stream-badge {
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

/* 执行卡片优化 */
.execution-card {
  border-left: 4px solid var(--success);
}
.execution-output-box {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

/* ==================== 移动端优化 ==================== */
@media (max-width: 640px) {
  .card { padding: 18px 14px; }
  .card h2 { font-size: 17px; }
  .result-actions {
    flex-direction: column;
    gap: 8px;
  }
  .result-actions .btn { width: 100%; }
  .dimension-card { padding: 14px; }
  .option-label { padding: 10px 12px; }
  .dimension-header h3 { font-size: 15px; }
}

/* 阶段间过渡 */

/* ==================== 顶部用户栏 ==================== */
.top-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
  padding: 4px 0;
}

.top-bar-main {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.free-badge-inline {
  flex: 0 0 auto;
  text-align: center;
}

.free-text {
  display: inline-block;
  background: linear-gradient(135deg, #dbeafe, #ede9fe);
  color: #4f46e5;
  font-weight: 700;
  font-size: 14px;
  padding: 3px 16px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.free-unlimited .free-text {
  background: linear-gradient(135deg, #d1fae5, #dbeafe);
  color: #059669;
}

.top-bar-actions {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.top-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.user-badge {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.member-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.member-badge.vip {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
}

.usage-info {
  font-size: 13px;
  font-weight: 500;
}

/* ==================== 弹窗 ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg), 0 20px 60px rgba(0, 0, 0, 0.15);
  width: 400px;
  max-width: 92vw;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-card.modal-wide {
  width: 680px;
  max-width: 96vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 「我的」弹出页 */
.mine-modal-card {
  width: 360px;
}
.mine-username {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 8px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mine-content {
  padding: 0 24px 24px;
}
.mine-usage {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}
.mine-usage-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.mine-usage-icon {
  font-size: 24px;
}
.mine-usage-label {
  font-size: 12px;
  color: var(--text-secondary);
}
.mine-usage-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}
.mine-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mine-menu-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 14px 16px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s;
  color: var(--text);
}
.mine-menu-btn:hover {
  background: var(--bg);
}
.mine-menu-btn:active {
  background: var(--primary-light);
}
.mine-menu-icon {
  font-size: 20px;
  width: 32px;
  flex-shrink: 0;
}
.mine-menu-arrow {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 18px;
}

/* 顶栏「我的」按钮 */
.btn-mine {
  font-size: 13px;
  padding: 5px 14px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 0;
}

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

.btn-back-to-mine {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s;
  margin-right: auto;
  margin-left: 8px;
}
.btn-back-to-mine:hover { background: var(--primary-light); }

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: var(--transition);
}

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

.modal-body {
  padding: 20px 24px 24px;
}

/* ==================== 表单元素 ==================== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
  color: var(--text);
}

.form-group input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

.register-notice {
  background: linear-gradient(135deg, #eff6ff, #f0f9ff);
  color: #1e40af;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid #bfdbfe;
  margin-bottom: 12px;
  line-height: 1.6;
}

.form-error {
  background: #fef2f2;
  color: #991b1b;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  border: 1px solid #fecaca;
}

.form-actions {
  margin-bottom: 12px;
}

.form-actions .btn {
  width: 100%;
  justify-content: center;
  padding: 11px 20px;
}

.form-switch {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}

.btn-link:hover {
  text-decoration: underline;
}

.code-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.code-input-row input {
  flex: 1;
}

.code-input-row .btn {
  flex-shrink: 0;
  padding: 8px 14px;
}

.code-tip {
  font-size: 12px;
  margin-top: 6px;
}

.register-terms {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 8px;
  margin-bottom: 0;
}

.register-terms a,
.register-terms .doc-link {
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
}

.register-terms a:hover,
.register-terms .doc-link:hover {
  color: #4338ca;
}

/* ==================== 管理后台 ==================== */
/* ==================== 管理后台面板 ==================== */
.admin-modal-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  max-width: 820px;
  height: 92vh;
  max-height: 92vh;
}

.admin-nav {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 10px 14px 4px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.admin-nav-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-right: 10px;
  padding: 4px 0;
  white-space: nowrap;
}

.admin-nav-tab {
  display: inline-block;
  padding: 6px 12px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}

.admin-nav-tab:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.admin-nav-tab.active {
  background: var(--primary);
  color: #fff;
  font-weight: 500;
}

.admin-nav-close {
  padding: 4px 10px;
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.admin-nav-close:hover {
  color: var(--error);
  border-color: var(--error);
  background: rgba(239,68,68,0.06);
}

.admin-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px 24px;
}

.admin-tab-panel {
  display: none;
}

.admin-tab-panel.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.admin-tab-panel h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text);
}

/* 面板操作区通用紧凑布局 */
.admin-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.admin-section-header h3 {
  margin-bottom: 0;
}

.admin-user-stats {
  display: flex;
  gap: 14px;
}

.admin-user-stats .stat-item {
  font-size: 13px;
  color: var(--text-secondary);
}

.admin-user-stats .stat-item strong {
  color: var(--primary);
  font-size: 16px;
}

.admin-action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.admin-action-bar .btn {
  flex-shrink: 0;
}

/* 活动日志表格 */
.activity-table-wrap {
  max-height: 60vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

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

.activity-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.activity-table th {
  background: var(--bg);
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.activity-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.activity-table tbody tr:hover {
  background: #f8faff;
}

.action-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.action-tag.action-login            { background: #e0e7ff; color: #3730a3; }
.action-tag.action-analyze          { background: #dbeafe; color: #1e40af; }
.action-tag.action-execute          { background: #e0e7ff; color: #5b21b6; }
.action-tag.action-run              { background: #d1fae5; color: #065f46; }
.action-tag.action-run_blocked      { background: #fee2e2; color: #991b1b; }
.action-tag.action-save_history     { background: #fef3c7; color: #92400e; }
.action-tag.action-share            { background: #ede9fe; color: #5b21b6; }
.action-tag.action-redeem           { background: #fce7f3; color: #9d174d; }
.action-tag.action-feedback         { background: #f3f4f6; color: #374151; }

/* 列表通用样式 */
.admin-list-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-list-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.admin-list-item:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.admin-list-item .list-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.admin-list-item .list-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* 历史记录表格样式 */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th {
  text-align: left;
  padding: 8px 12px;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.admin-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: var(--bg);
}

.admin-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

/* SMTP 邮件配置 */
.smtp-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* 通用表单行 */
.form-row-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.form-row-inline label {
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.form-row-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
}

.form-row-stack label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.small-input {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  transition: var(--transition);
}

.small-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.smtp-help {
  margin-top: 28px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.smtp-help h4 {
  font-size: 13px;
  margin-bottom: 10px;
  color: var(--text);
}

.smtp-help ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.smtp-help li {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 0;
  line-height: 1.6;
}

.smtp-help li strong {
  color: var(--text);
}

.flex-input {
  flex: 1;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  transition: var(--transition);
}

.flex-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

.config-status {
  font-size: 12px;
}

/* API Key 列表 */
.admin-key-list {
  max-height: 60vh;
  overflow-y: auto;
}

.key-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  margin-bottom: 4px;
  background: #1e293b;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.key-masked {
  font-family: monospace;
  font-size: 13px;
  color: var(--text-secondary);
}

.key-name-input {
  width: 110px;
  padding: 4px 8px;
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: inherit;
}

.key-name-input:focus {
  border-color: var(--primary);
  outline: none;
}

.key-actions {
  display: flex;
  gap: 6px;
}

/* 兑换码 */
.redeem-input {
  width: 140px;
  padding: 4px 10px;
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: monospace;
  text-transform: uppercase;
}

.redeem-input:focus {
  border-color: var(--primary);
  outline: none;
}

.redeem-input::placeholder {
  color: var(--text-muted);
  font-family: inherit;
}

/* 兑换弹窗输入 */
.redeem-code-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-family: monospace;
  color: var(--text);
  background: var(--card-bg);
  transition: var(--transition);
}

.redeem-code-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

/* 活动邮件开关 */
.campaign-toggle {
  display: flex;
  align-items: center;
}

/* 兑换弹窗内的活动邮件区域 */
.campaign-toggle-in-modal {
  padding: 12px 14px;
  margin-bottom: 14px;
  background: var(--primary-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.campaign-toggle-in-modal .toggle-desc {
  font-size: 11px;
  color: var(--text-muted);
  max-width: 200px;
  line-height: 1.5;
}

/* 摇动动画 */
@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-6px); }
  30% { transform: translateX(6px); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
  90% { transform: translateX(2px); }
}

.campaign-toggle-in-modal.shake {
  animation: shakeX 0.6s ease;
  border-color: var(--error);
  background: #fef2f2;
}

.campaign-toggle-in-modal.shake .toggle-desc {
  max-width: none;
  color: var(--error);
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
}

.toggle-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* ==================== 订阅管理弹窗 ==================== */
.btn-subscribe {
  font-size: 18px;
  padding: 2px 6px;
  line-height: 1;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: transform 0.2s;
}

.btn-subscribe:hover {
  transform: scale(1.2);
}

.sub-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.sub-toggle-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sub-toggle-label span:first-child {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

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

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #d1d5db;
  border-radius: 26px;
  transition: 0.25s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.25s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

.sub-days-section {
  margin-bottom: 18px;
}

.sub-days-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.sub-days-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.sub-days-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sub-day-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: 0.15s;
  user-select: none;
}

.sub-day-item:hover {
  border-color: var(--primary);
  background: #f0f4ff;
}

.sub-day-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--primary);
}

.sub-day-item:has(input:checked) {
  border-color: var(--primary);
  background: #ede9fe;
  color: var(--primary);
  font-weight: 600;
}

.toggle-text {
  user-select: none;
  white-space: nowrap;
}

/* 活动统计卡片 */
.campaign-stat-card {
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  transition: var(--transition);
}

.campaign-stat-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

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

.cstat-date {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

.cstat-credits {
  font-size: 12px;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: 4px;
}

.cstat-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.6;
}

.cstat-numbers {
  display: flex;
  gap: 16px;
  margin-bottom: 10px;
}

.cstat-num {
  text-align: center;
  min-width: 48px;
}

.cstat-val {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.cstat-num:last-child .cstat-val {
  color: var(--primary);
}

.cstat-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.cstat-detail-btn {
  margin-top: 2px;
}

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

.cstat-summary strong {
  color: var(--text);
}

/* 站点文档 */
.doc-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.doc-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.doc-name {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

.doc-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.doc-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* 活动群发 */
.campaign-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--card-bg);
  resize: vertical;
  transition: var(--transition);
}

.campaign-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

.campaign-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  min-height: 36px;
  align-items: center;
}

.cimg-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #f1f5f9;
  flex-shrink: 0;
}

.cimg-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cimg-item .cimg-remove {
   position: absolute;
   top: 2px;
   right: 2px;
   background: rgba(0,0,0,0.55);
   border: none;
   color: #fff;
   border-radius: 4px;
   font-size: 12px;
   width: 18px;
   height: 18px;
   padding: 0;
   line-height: 18px;
   text-align: center;
   cursor: pointer;
 }

 .cimg-loading {
   position: absolute;
   inset: 0;
   background: rgba(0,0,0,0.4);
   color: #fff;
   font-size: 11px;
   display: flex;
   align-items: center;
   justify-content: center;
   border-radius: 6px;
 }

.cimg-item .cimg-error {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 11px;
  color: var(--error);
  text-align: center;
}

.campaign-add-image {
  display: flex;
  gap: 8px;
}

.btn-redeem {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #fff !important;
  border: none !important;
  padding: 4px 14px;
  font-size: 12px;
}

.btn-redeem:hover {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
}

.btn-invite {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff !important;
  border: none !important;
  padding: 4px 14px;
  font-size: 12px;
}

.btn-invite:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
}

/* ==================== 邀请弹窗 ==================== */
.invite-code-box {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 2px solid #f59e0b;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  margin-bottom: 12px;
}

.invite-label {
  font-size: 13px;
  color: #92400e;
  margin-bottom: 8px;
  font-weight: 500;
}

.invite-code-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.invite-code-text {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 4px;
  color: #92400e;
  font-family: monospace;
  background: #fff;
  padding: 6px 16px;
  border-radius: 8px;
}

.invite-stats {
  font-size: 12px;
  color: #a16207;
}

.invite-divider {
  display: flex;
  align-items: center;
  margin: 12px 0;
  color: var(--text-muted);
  font-size: 12px;
}

.invite-divider::before,
.invite-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.invite-divider span {
  padding: 0 12px;
}

.invite-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 4px 0 8px;
  line-height: 1.6;
}

.invite-email-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.invite-status {
  font-size: 12px;
  margin-top: 4px;
}

.invite-rules {
  margin-top: 16px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.8;
}

.invite-rules h4 {
  font-size: 13px;
  color: var(--text);
  margin: 0 0 6px;
}

.invite-rules ul {
  margin: 0;
  padding-left: 16px;
}

/* ==================== 邀请审核面板 ==================== */
.review-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.review-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

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

.review-status {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
  background: var(--bg-secondary);
}

.review-card-body {
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-secondary);
}

.review-card-body strong {
  color: var(--text);
}

.review-usage-info {
  margin-top: 6px;
}

.review-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ==================== 活动群发 ==================== */

.btn-voucher {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #fff !important;
  border: none !important;
  font-size: 12px;
}

.btn-voucher:hover {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
}

.voucher-list {
  max-height: 55vh;
  overflow-y: auto;
}

.voucher-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  margin-bottom: 4px;
  background: #1e293b;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.voucher-item.used {
  opacity: 0.55;
}

.voucher-item.expired {
  opacity: 0.6;
  background: #fef2f2;
}

.voucher-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.voucher-code {
  font-family: monospace;
  font-size: 13px;
  color: #8b5cf6;
  background: #0f172a;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
}

.voucher-credits {
  font-weight: 600;
  font-size: 13px;
  color: var(--success);
}

.voucher-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.voucher-unused {
  font-size: 11px;
  color: var(--success);
  background: rgba(16,185,129,0.15);
  padding: 2px 8px;
  border-radius: 10px;
}

.voucher-used {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(100,116,139,0.15);
  padding: 2px 8px;
  border-radius: 10px;
}

.voucher-expired {
  font-size: 11px;
  color: var(--error);
  background: rgba(239,68,68,0.12);
  padding: 2px 8px;
  border-radius: 10px;
}

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

.btn-copy-voucher {
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 12px;
}

.btn-copy-voucher:hover {
  background: var(--primary-dark);
}

/* 反馈系统 */
.feedback-count {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
  margin-top: 4px;
}

.feedback-list {
  max-height: 60vh;
  overflow-y: auto;
}

.feedback-item {
  padding: 12px;
  margin-bottom: 6px;
  background: #1e293b;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.feedback-info {
  margin-bottom: 8px;
}

.feedback-user {
  font-weight: 600;
  color: var(--primary);
  font-size: 14px;
}

.feedback-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 8px;
}

.feedback-content {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
}

.feedback-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* ==================== 历史记录 ==================== */
.history-list {
  display: flex;
  flex-direction: column;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

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

.history-item-main {
  flex: 1;
  min-width: 0;
}

.history-item-question {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-summary {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.history-item-time {
  font-size: 11px;
  color: var(--text-secondary);
}

.btn-del-history {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
  flex-shrink: 0;
  margin-left: 8px;
}

.btn-del-history:hover {
  color: var(--error);
  background: rgba(239,68,68,0.1);
}

/* 重放维度卡片（只读） */
.dimension-card.replay .option-label {
  cursor: default;
}

.dimension-card.replay .option-label.replay-option {
  pointer-events: none;
}

.priority-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 4px;
  font-weight: normal;
}

.note-display {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-card);
  padding: 8px 12px;
  border-radius: 6px;
  margin-top: 8px;
  border-left: 3px solid var(--primary);
}

.btn-recharge-mini {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff !important;
  border: none !important;
  font-size: 12px;
}

.btn-recharge-mini:hover {
  background: linear-gradient(135deg, #16a34a, #15803d);
}

.admin-user-list {
  max-height: 60vh;
  overflow-y: auto;
}

.admin-user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.admin-user-row.clickable {
  cursor: pointer;
}

.admin-user-row.clickable:hover {
  background: var(--bg-secondary);
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
  border-radius: 6px;
}

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

.user-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.badge-admin {
  display: inline-block;
  font-size: 10px;
  background: #dbeafe;
  color: #1d4ed8;
  padding: 1px 8px;
  border-radius: 10px;
  font-weight: 600;
  margin-left: 6px;
}

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

.user-recharge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

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

.credits-label strong {
  color: var(--primary);
  font-size: 15px;
}

.recharge-btns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.user-detail-recharge {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.btn-recharge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border: none;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-recharge:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.loading-text {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
}

/* ==================== 用户行操作区 ==================== */
.user-row-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.btn-user-detail {
  border-color: var(--primary);
  color: var(--primary);
  font-size: 11px;
  padding: 2px 10px;
}

/* ==================== 用户详情面板 ==================== */
.admin-user-detail {
  padding-top: 0;
}

.user-detail-info h4 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--text);
}

.user-detail-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.user-detail-table td {
  padding: 6px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.user-detail-table td:first-child {
  color: var(--text-muted);
  width: 90px;
}

.user-detail-table td:last-child {
  color: var(--text);
  font-weight: 500;
}

.user-detail-section {
  margin-top: 16px;
}

.user-detail-section h4 {
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--text);
}

/* 交易记录 */
.transaction-list {
  display: flex;
  flex-direction: column;
  max-height: 40vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.transaction-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

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

.tx-type {
  font-weight: 600;
  min-width: 36px;
  padding: 2px 8px;
  border-radius: 4px;
  text-align: center;
  font-size: 11px;
}

.tx-recharge .tx-type {
  background: rgba(34,197,94,0.15);
  color: #22c55e;
}

.tx-consume .tx-type {
  background: rgba(239,68,68,0.1);
  color: #ef4444;
}

.tx-detail {
  flex: 1;
  color: var(--text);
}

.tx-time {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}

/* 用户历史记录列表 */
.history-detail-list {
  display: flex;
  flex-direction: column;
  max-height: 40vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.history-detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

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

.history-detail-question {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  margin-right: 12px;
}

.history-detail-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-muted);
}

.history-detail-status {
  padding: 1px 8px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 500;
}

.history-detail-item.has-run .history-detail-status {
  background: rgba(34,197,94,0.15);
  color: #22c55e;
}

.history-detail-item:not(.has-run) .history-detail-status {
  background: rgba(148,163,184,0.15);
  color: #94a3b8;
}

/* ==================== Toast 提示 ==================== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  animation: toastIn 0.3s ease;
}

.toast.success {
  background: #065f46;
}

.toast.error {
  background: #991b1b;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

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

.loading-overlay p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ==================== 响应式 ==================== */
@media (max-width: 640px) {
  .app-container { padding: 16px 12px 40px; }

  .card { padding: 20px; }

  .options-grid {
    grid-template-columns: 1fr;
    padding-left: 0;
  }

  .dimension-header h3 { font-size: 15px; }

  .selection-actions {
    flex-direction: column;
    gap: 12px;
  }

  .selection-actions .btn { width: 100%; justify-content: center; }

  .config-row { flex-direction: column; align-items: stretch; }
  .config-row label { text-align: left; min-width: auto; }

  .steps-indicator { gap: 4px; }
  .step-connector { width: 30px; }

  /* 顶部：移动端主行保持紧凑 */
  .top-bar-main {
    gap: 4px;
  }
  .free-text {
    font-size: 12px;
    padding: 2px 10px;
  }

  /* 顶部栏：移动端换行 */
  .top-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .top-bar-row {
    flex-wrap: wrap;
    gap: 6px;
  }
  .user-area {
    flex-wrap: wrap;
    gap: 6px;
  }
  .user-area .btn-sm {
    padding: 5px 10px;
    font-size: 12px;
  }
  .usage-info {
     font-size: 12px;
   }

  /* 所有弹窗统一居中 */
  .modal-card:not(.modal-wide) {
    width: 92%;
    max-width: 400px;
    margin: 0;
    border-radius: var(--radius);
    max-height: 80vh;
  }
  .modal-header {
    padding: 18px 20px 0;
  }
  .modal-header h2 {
    font-size: 17px;
  }
  .modal-body {
    padding: 16px 20px 20px;
  }

  /* 验证码行：按钮文字精简 */
  .code-input-row {
    gap: 6px;
  }
  .code-input-row .btn {
    padding: 8px 10px;
    font-size: 12px;
  }

  /* 登录/注册提交按钮全宽 */
  .form-actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* 管理后台弹窗：手机端紧凑适配 */
  .admin-modal-card {
    width: 98vw;
    height: 92vh;
    max-height: 92vh;
    border-radius: 12px 12px 0 0;
  }
  .admin-nav {
    padding: 8px 10px 2px;
    gap: 2px;
  }
  .admin-nav-header {
    font-size: 12px;
    margin-right: 6px;
  }
  .admin-nav-tab {
    font-size: 11px;
    padding: 5px 8px;
  }
  .admin-nav-close {
    font-size: 11px;
    padding: 3px 8px;
  }
  .admin-content {
    padding: 12px 14px 16px;
  }
  .admin-tab-panel h3 {
    font-size: 14px;
    margin-bottom: 10px;
  }
  .admin-action-bar {
    padding: 10px 12px;
    gap: 6px;
  }
}

/* Toast 提示 */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 200;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2s forwards;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--error); }

@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }
