/* Weixin Bot 控制台 — 美化版 */

* { box-sizing: border-box; }

:root {
  --bg-primary: #0f1117;
  --bg-secondary: #181b23;
  --bg-tertiary: #1f242f;
  --border: #2a2f3a;
  --border-light: #353b48;
  --text-primary: #e6e8eb;
  --text-secondary: #9aa3b1;
  --text-muted: #6b7280;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: rgba(59, 130, 246, 0.15);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
  --radius: 12px;
  --radius-sm: 8px;
  /* 别名:插件市场/二维码等模块早期用的变量名,统一指到上面的主变量 */
  --primary: var(--accent);
  --bg-card: var(--bg-secondary);
  --radius-md: var(--radius);
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
               'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background:
    radial-gradient(circle at 10% 10%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.06) 0%, transparent 40%),
    var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Nav ── */
.nav {
  background: rgba(24, 27, 35, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
  transition: opacity 0.15s;
}
.brand:hover { opacity: 0.85; }
.brand-icon { font-size: 24px; }
.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.15s;
}
.nav-link:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.user-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 14px;
}
.user-dot {
  width: 8px; height: 8px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--success);
}
.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font-size: 14px;
}
.btn-link:hover { color: var(--accent-hover); text-decoration: underline; }

/* ── Container ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
  flex: 1;
  width: 100%;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 800px) {
  .grid { grid-template-columns: 1fr; }
}

/* ── Card ── */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.card.wide { grid-column: 1 / -1; }
.card.narrow { max-width: 400px; margin: 60px auto; }
.card-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.card-header h2 {
  margin: 0 0 4px;
  font-size: 17px;
  color: var(--text-primary);
  font-weight: 600;
}
.card-header p {
  margin: 0;
  font-size: 13px;
}
.card-header-inline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.card-header-inline h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}
.card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.card-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.card-footer p { margin: 0; }

/* ── Onboarding (首次使用引导) ── */
.onboarding {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(16, 185, 129, 0.05));
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}
.onboarding-icon { font-size: 36px; flex-shrink: 0; }
.onboarding-body { flex: 1; }
.onboarding-body h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--text-primary);
}
.onboarding-steps {
  margin: 0 0 12px;
  padding-left: 24px;
  color: var(--text-secondary);
  font-size: 14px;
}
.onboarding-steps li { margin: 4px 0; }
.onboarding-steps strong { color: var(--text-primary); }

/* ── Forms ── */
.form-stack { display: flex; flex-direction: column; gap: 16px; }
label {
  display: block;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 14px;
}
label > span { display: block; margin-bottom: 6px; }
input, select, textarea {
  display: block;
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
input:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.btn:hover:not(:disabled) {
  background: var(--border-light);
  border-color: var(--border-light);
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border-color: transparent;
  color: white;
  font-weight: 500;
}
.btn.primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn.danger {
  background: var(--danger);
  border-color: transparent;
  color: white;
  font-weight: 500;
}
.btn.danger:hover:not(:disabled) { background: #dc2626; }
.btn.small { padding: 5px 12px; font-size: 12px; }
.btn.lg, .btn.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { display: flex; width: 100%; }

.btn-row {
  display: flex;
  gap: 10px;
  margin: 16px 0;
  flex-wrap: wrap;
}

/* ── Status ── */
.status-block {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
}
.status-row + .status-row { border-top: 1px dashed var(--border); }
.status-row .label { color: var(--text-secondary); }
.status-row .value-mono {
  font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
  color: var(--text-primary);
}

.status-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  min-width: 70px;
  text-align: center;
}
.state-running, .state-starting {
  background: var(--success-bg);
  color: var(--success);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.3);
}
.state-stopped, .state-stopping {
  background: rgba(156, 163, 175, 0.15);
  color: var(--text-secondary);
}
.state-crashed {
  background: var(--danger-bg);
  color: var(--danger);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.3);
}

/* ── 插件市场 ── */
.market-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 28px 32px;
  margin-bottom: 18px;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--primary) 12%, transparent),
    color-mix(in srgb, var(--primary) 4%, transparent));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}
.market-hero h1 { margin: 0 0 6px; font-size: 28px; }
.market-hero p { margin: 0; max-width: 560px; }
.market-hero-stats { display: flex; gap: 12px; }
.stat-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 90px;
}
.stat-num { font-size: 26px; font-weight: 700; color: var(--primary); }
.stat-lbl { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.market-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  padding: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}
.market-tab {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.market-tab:hover { color: var(--text-primary); background: var(--bg-primary); }
.market-tab.active {
  background: var(--primary);
  color: white;
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.market-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.25s;
  position: relative;
}
.market-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  pointer-events: none;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--primary) 8%, transparent), transparent 50%);
  opacity: 0;
  transition: opacity 0.25s;
}
.market-card:hover {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  transform: translateY(-2px);
  box-shadow: 0 6px 20px -10px rgba(0,0,0,0.4);
}
.market-card.enabled {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), 0 0 24px -10px var(--primary);
}
.market-card.enabled::before { opacity: 1; }

.card-row1 {
  display: flex;
  align-items: center;
  gap: 12px;
}
.card-emoji { font-size: 32px; }
.card-title { flex: 1; min-width: 0; }
.card-title h3 { margin: 0; font-size: 16px; }
.card-version { font-family: monospace; }
.card-cats { display: flex; gap: 6px; flex-wrap: wrap; }
.cat-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.cat-tag.cat-proactive { color: #22c55e; border-color: #22c55e40; background: #22c55e10; }
.cat-tag.cat-info      { color: #3b82f6; border-color: #3b82f640; background: #3b82f610; }
.cat-tag.cat-ai        { color: #a855f7; border-color: #a855f740; background: #a855f710; }
.cat-tag.cat-tool      { color: #f59e0b; border-color: #f59e0b40; background: #f59e0b10; }

.card-desc { margin: 0; line-height: 1.55; }
.card-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-secondary);
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.card-actions { display: flex; gap: 8px; }
.card-actions .btn { flex: 1; }

/* modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: modalFade 0.2s;
}
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px -20px rgba(0,0,0,0.5);
}
.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-emoji { font-size: 24px; }
.modal-title { flex: 1; font-weight: 600; }
.modal-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
}
.modal-close:hover { color: var(--text-primary); border-color: var(--text-secondary); }
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
}
.preview-output {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 0;
  font-family: ui-monospace, "JetBrains Mono", Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-primary);
}
.modal-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

/* ── 插件配置表单 ── */
.config-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.config-field {
  margin: 0;
}
.config-field > span {
  margin-bottom: 6px;
}
.config-form textarea {
  resize: vertical;
  font-family: inherit;
}
.config-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.config-check input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

/* nav link active state */
.nav-link.active {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}
/* ── 插件 CTA(在 dashboard 上的引导) ── */
.plugin-cta {
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 22px 26px;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--primary) 8%, transparent),
    transparent 60%);
}
.plugin-cta-icon { font-size: 48px; }
.plugin-cta-body { flex: 1; }
.plugin-cta-body h3 { margin: 0 0 6px; }
.plugin-cta-body p { margin: 0 0 14px; max-width: 580px; }

/* marketplace 通用控件(开关 + 滑块,与市场页共用) */
.plugin-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
  margin-top: 2px;
}
.plugin-switch input { opacity: 0; width: 0; height: 0; }
.plugin-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-secondary);
  border-radius: 22px;
  transition: background 0.25s;
  border: 1px solid var(--border);
}
.plugin-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: transform 0.25s, background 0.25s;
}
.plugin-switch input:checked + .plugin-slider {
  background: var(--primary);
  border-color: var(--primary);
}
.plugin-switch input:checked + .plugin-slider::before {
  transform: translateX(18px);
  background: white;
}
.qr-flip {
  perspective: 1400px;
  -webkit-perspective: 1400px;
  width: 100%;
  min-height: 360px;
  position: relative;
}
.qr-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: inherit;
  transition: transform 0.75s cubic-bezier(0.4, 0.0, 0.2, 1);
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
}
.qr-flip.flipped .qr-flip-inner {
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
}
.qr-face {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: inherit;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.qr-face-front {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 0;
}
.qr-face-back {
  visibility: hidden;
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
  text-align: center;
  padding: 16px 20px 20px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.qr-flip.flipped .qr-face-back {
  visibility: visible;
}
.qr-face-back .qr-back-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.qr-face-back .qr-back-title {
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}
.qr-empty-icon {
  font-size: 52px;
  margin-bottom: 14px;
  display: inline-block;
  animation: qrHint 2.6s ease-in-out infinite;
}

/* 加载占位 */
.qr-stage {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 0;
}
.qr-stage.hidden { display: none !important; }
.qr-spinner {
  width: 44px;
  height: 44px;
  margin-bottom: 16px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: qrSpin 0.9s linear infinite;
}
@keyframes qrSpin {
  to { transform: rotate(360deg); }
}
.qr-stage-text {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
}
@keyframes qrHint {
  0%, 100% { transform: translateY(0); opacity: 0.85; }
  50%      { transform: translateY(-6px); opacity: 1; }
}
.qr-face-front p { margin: 0 0 22px; line-height: 1.6; color: var(--text-secondary); }

/* 扫码光圈 */
.qr-frame {
  position: relative;
  display: inline-block;
  background: white;
  padding: 14px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  margin: 8px 0 4px;
}
.qr-frame img {
  max-width: 220px;
  display: block;
}
.qr-frame::before,
.qr-frame::after,
.qr-scan-corner {
  /* 四角扫描框 */
}
.qr-scanbox {
  position: absolute;
  inset: 14px;
  pointer-events: none;
}
.qr-scanbox span {
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: var(--primary);
  border-style: solid;
  border-width: 0;
}
.qr-scanbox span:nth-child(1) { top: 0; left: 0; border-top-width: 3px; border-left-width: 3px; border-top-left-radius: 6px; }
.qr-scanbox span:nth-child(2) { top: 0; right: 0; border-top-width: 3px; border-right-width: 3px; border-top-right-radius: 6px; }
.qr-scanbox span:nth-child(3) { bottom: 0; left: 0; border-bottom-width: 3px; border-left-width: 3px; border-bottom-left-radius: 6px; }
.qr-scanbox span:nth-child(4) { bottom: 0; right: 0; border-bottom-width: 3px; border-right-width: 3px; border-bottom-right-radius: 6px; }
.qr-scanline {
  position: absolute;
  left: 18px;
  right: 18px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  box-shadow: 0 0 12px var(--primary);
  animation: qrScan 2.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes qrScan {
  0%   { top: 14px; opacity: 0.0; }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { top: calc(100% - 16px); opacity: 0.0; }
}
.status-line {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 10px 0 4px;
}
.hidden { display: none !important; }

/* ── Bound info ── */
.bound-info { padding: 8px 0; }
.bound-badge {
  display: inline-block;
  padding: 6px 14px;
  background: var(--success-bg);
  color: var(--success);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}
.kv-list {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px 16px;
  margin: 0 0 20px;
  padding: 16px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.kv-list dt {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}
.kv-list dd {
  margin: 0;
  font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
}

/* ── Auto-start ── */
.auto-start-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-size: 14px;
  margin: 12px 0;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.auto-start-label:hover { border-color: var(--border-light); }
.auto-start-label input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
  transform: scale(1.2);
}
.auto-start-label .hint {
  color: var(--text-muted);
  font-size: 13px;
  cursor: help;
}

.hint-block {
  margin: 12px 0 0;
  padding: 10px 14px;
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid var(--warning);
  border-radius: 4px;
  color: var(--warning);
  font-size: 13px;
}

/* ── Chats ── */
.send-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.send-row input {
  flex: 1;
}
.send-row .btn {
  flex-shrink: 0;
}
.chat-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.chat-controls select {
  width: 160px;
  flex-shrink: 0;
}
.chat-controls input {
  flex: 1;
}
.chat-list {
  max-height: 360px;
  overflow-y: auto;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
}
.chat-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  margin: 4px 0;
  border-radius: 6px;
  background: var(--bg-secondary);
}
.chat-row.chat-sent {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
}
.chat-row.chat-recv {
  border-left: 3px solid var(--success);
}
.chat-meta {
  font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
  font-size: 11px;
  color: var(--text-muted);
}
.chat-text {
  color: var(--text-primary);
  font-size: 14px;
  word-break: break-word;
  white-space: pre-wrap;
}

/* ── Log ── */
.log-box {
  background: #0a0c12;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
  font-size: 12px;
  color: #d1d5db;
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.5;
}

/* ── Help grid ── */
.help-card { background: var(--bg-secondary); }
.help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.help-item {
  padding: 18px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}
.help-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.help-icon {
  font-size: 28px;
  margin-bottom: 8px;
}
.help-item h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
}
.help-item p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.help-item strong { color: var(--text-primary); }

/* ── Flash ── */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 14px;
  border-left: 3px solid;
}
.flash-icon { font-size: 18px; }
.flash-error {
  background: var(--danger-bg);
  color: #fca5a5;
  border-left-color: var(--danger);
}
.flash-success {
  background: var(--success-bg);
  color: #6ee7b7;
  border-left-color: var(--success);
}

/* ── Footer ── */
.footer {
  margin-top: 40px;
  padding: 20px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
}

/* ── Misc ── */
.muted { color: var(--text-muted); font-size: 13px; }
.muted.small { font-size: 12px; }
.center { text-align: center; }
code {
  background: var(--bg-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--accent);
  font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
}

/* ── Animation ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s ease-out; }

/* ── Auth Page (登录/注册) ── 现代简约 ── */
body.auth-page {
  background: var(--bg-primary);
  min-height: 100vh;
  display: flex;
  padding: 32px 24px;
  position: relative;
  overflow-x: hidden;
}

/* 背景:一层很淡的渐变光,不抢内容 */
body.auth-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 55% at 12% 12%, rgba(59, 130, 246, 0.10) 0%, transparent 55%),
    radial-gradient(ellipse 55% 45% at 92% 88%, rgba(16, 185, 129, 0.07) 0%, transparent 55%);
  pointer-events: none;
  z-index: -1;
}

.auth-shell {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 56px;
  max-width: 1080px;
  width: 100%;
  margin: auto;
  align-items: center;
}

/* ── 左栏:品牌 + 功能 ── */
.auth-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-icon-lg { font-size: 34px; line-height: 1; }
.brand-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-primary);
}
.brand-sub {
  margin: 3px 0 0;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
}

.auth-tagline {
  margin: 0;
  font-size: 25px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text-primary);
}
.auth-tagline strong { color: var(--accent); font-weight: 700; }

.hero-lead {
  margin: 0;
  max-width: 480px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-secondary);
}

.feature-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 6px;
}
.feature {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  background: rgba(24, 27, 35, 0.55);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s, transform 0.15s;
}
.feature:hover {
  border-color: var(--border-light);
  transform: translateY(-1px);
}
.feature-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
}
.feature h4 {
  margin: 0 0 3px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.feature p {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.tech-tag {
  padding: 4px 11px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  color: var(--text-secondary);
  font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
}

/* ── 右栏:登录/注册表单 ── */
.auth-form-area {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-form-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: var(--shadow-md);
}
.auth-form-header {
  margin-bottom: 24px;
}
.auth-form-header h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}
.auth-form-header p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.auth-form-card input {
  background: var(--bg-primary);
  font-family: inherit;
}
.auth-form-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.auth-form-card .btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border: none;
  box-shadow: var(--shadow-sm);
  letter-spacing: 0.5px;
}

.auth-form-footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.auth-form-footer p { margin: 0; }
.auth-form-footer a {
  color: var(--accent);
  text-decoration: none;
}
.auth-form-footer a:hover { text-decoration: underline; }

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

/* ── Auth 响应式 ── */
@media (max-width: 900px) {
  body.auth-page { padding: 24px 18px; }
  .auth-shell {
    grid-template-columns: 1fr;
    gap: 28px;
    align-items: stretch;
  }
  .feature-list { grid-template-columns: 1fr; }
  .auth-form-card { padding: 28px 22px; }
}/* ── Responsive ── */
@media (max-width: 600px) {
  .container { padding: 16px; }
  .card { padding: 18px; }
  .onboarding { flex-direction: column; gap: 12px; padding: 16px; }
  .kv-list { grid-template-columns: 1fr; gap: 4px 0; }
  .kv-list dt { margin-top: 8px; }
  .kv-list dd { margin-bottom: 4px; }
  .nav { padding: 12px 16px; }
  .nav-right { gap: 8px; }
}
