/* This file is auto-generated by scripts/build_web_css.py. */
/* Edit the sources in web/styles/ instead.                      */


/* ══ base.css ══ */

/* base — domain styles for ThesisMind */

/* ── 主题：浅蓝（默认） ─────────────────────────────────── */
:root, [data-theme="blue"] {
  color-scheme: light;
  --bg: #eaf5ff;
  --bg-strong: #d9ecff;
  --panel: #fafdff;
  --panel-2: #f2f8ff;
  --surface: #ffffff;
  --surface2: #f5f8fc;
  --border: #d0dae5;
  --danger: #c5221f;
  --line: #c6d9eb;
  --line-strong: #8eb6dc;
  --text: #000;
  --muted: #666;
  --text-secondary: #888;
  --hint: #999;
  --primary: #1f7bd7;
  --primary-strong: #155fa9;
  --green: #2d9a68;
  --violet: #7d5fd1;
  --shadow: 0 22px 55px rgba(54, 101, 147, 0.16);
  --nav-bg: #f0f6fc;
  --chat-bg: #ffffff;
  --input-bg: #ffffff;
  --hover-bg: #e8f1fa;
  --code-bg: #f0f5fa;
  --badge-bg: #e8f1fa;
  --step-hover: #e2edf7;
}

/* ── 主题：暗紫 ──────────────────────────────────────── */
[data-theme="purple"] {
  color-scheme: dark;
  --bg: #0f0f23;
  --bg-strong: #151530;
  --panel: #1a1a2e;
  --panel-2: #1e1e35;
  --surface: #1a1a2e;
  --surface2: #222240;
  --border: #2a2a4a;
  --danger: #ef4444;
  --line: #2a2a4a;
  --line-strong: #4a3a7a;
  --text: #e0e0e0;
  --muted: #999;
  --text-secondary: #888;
  --hint: #777;
  --primary: #7c3aed;
  --primary-strong: #a78bfa;
  --green: #34d399;
  --violet: #a78bfa;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  --nav-bg: #12122a;
  --chat-bg: #1a1a2e;
  --input-bg: #0f0f23;
  --hover-bg: #222240;
  --code-bg: #0a0a1a;
  --badge-bg: #1e1e35;
  --step-hover: #1e1e40;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0) 34%),
    radial-gradient(circle at 24% 18%, rgba(98, 168, 232, 0.22), transparent 32%),
    linear-gradient(180deg, #f5fbff 0%, var(--bg) 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 22px;
  min-height: 100vh;
  padding: 22px;
}

.sidebar,
.panel {
  border: 1px solid var(--line);
  background: rgba(250, 253, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.sidebar {
  position: sticky;
  top: 22px;
  height: calc(100vh - 44px);
  display: flex;
  flex-direction: column;
  padding: 20px;
  border-radius: 22px;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.25s ease, padding 0.25s ease, border-radius 0.25s ease;
}

/* ── 主题切换器 ─────────────────────────────────────── */
.theme-switcher {
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}
.theme-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .2s;
  flex-shrink: 0;
}
.theme-dot:hover { transform: scale(1.15); }
.theme-dot.active { border-color: var(--text); box-shadow: 0 0 8px rgba(124,58,237,0.4); }
.theme-dot.blue  { background: linear-gradient(135deg, #1f7bd7, #7d5fd1); }
.theme-dot.purple { background: linear-gradient(135deg, #7c3aed, #a78bfa); }

.workspace {
  min-width: 0;
}

.panel {
  min-height: calc(100vh - 44px);
  padding: 26px;
  border-radius: 24px;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.page-head.compact {
  align-items: center;
}

.head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}
.method-next-actions[hidden] {
  display: none;
}
.workflow-next-actions[hidden],
.workflow-next-btn[hidden] {
  display: none;
}
.primary.workflow-next-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 230px;
  height: auto;
  min-height: 56px;
  padding: 10px 18px;
  line-height: 1.2;
  text-align: center;
  box-shadow: 0 7px 18px rgba(31, 123, 215, 0.16);
  white-space: nowrap;
}
.framework-head-actions .ghost {
  min-width: auto;
  height: 40px;
  padding-inline: 13px;
}
.primary.workflow-next-btn span {
  font-size: 0.88rem;
}
.primary.workflow-next-btn small {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.68rem;
  font-weight: 500;
}
.primary.workflow-next-btn:disabled {
  border-color: var(--line);
  background: var(--panel-2);
  box-shadow: none;
  color: var(--muted);
  cursor: not-allowed;
}
.primary.workflow-next-btn:disabled small {
  color: var(--muted);
}
.workflow-bottom-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.workflow-bottom-actions[hidden] {
  display: none;
}
.primary.workflow-next-bottom-btn {
  min-width: 260px;
}

.eyebrow {
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
}

.page-head h2 {
  max-width: 720px;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 130px);
  gap: 10px;
}

.feature-grid span {
  padding: 12px;
  border: 1px solid #c8def2;
  border-radius: 12px;
  background: #f3f9ff;
  color: #375a78;
  text-align: center;
  font-size: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 28px;
}

.form-grid.form-grid-compact {
  gap: 12px;
  margin-top: 16px;
}

.field,
.word-select {
  display: grid;
  gap: 9px;
}
.field[hidden] { display: none; }

.field.wide {
  grid-column: 1 / -1;
}

.project-context-field textarea {
  min-height: 260px;
}

.project-context-pair {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.project-context-field textarea[readonly] {
  color: #45627d;
  background: #f4f9ff;
}

.example-toggle {
  min-width: auto !important;
  height: 26px !important;
  padding: 0 10px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
}

.project-context-field textarea[hidden] {
  display: none;
}

.project-actions-field button {
  height: 46px;
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.button-row .save-tip {
  margin-left: auto;
}

.field span,
.word-select span {
  color: #506a83;
  font-size: 14px;
  font-weight: 700;
}

.field-hint {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  margin-top: 2px;
}

@keyframes cute-bounce {

  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.6;
  }

  40% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

.ghost.loading {
  position: relative;
  color: #0f4d92;
  background: #e8f4ff;
  border-color: #8ac1ff;
}

.ghost.loading::after {
  content: "🌱";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  animation: spin-plant 1.4s linear infinite;
}

@keyframes spin-plant {
  0% {
    transform: translateY(-50%) rotate(0deg);
  }

  50% {
    transform: translateY(-52%) rotate(12deg);
  }

  100% {
    transform: translateY(-50%) rotate(360deg);
  }
}

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

.primary,
.ghost {
  min-width: 128px;
  height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  font-weight: 700;
}

.primary {
  border: 1px solid var(--primary);
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #38a7dc);
}

.primary:hover {
  background: linear-gradient(135deg, var(--primary-strong), #248fc3);
}

.primary.connected {
  border-color: #77bf91;
  color: #fff;
  background: linear-gradient(135deg, #2d9a68, #4ab88a);
  cursor: default;
}

.ghost {
  border: 1px solid #bcd4ea;
  color: #31526f;
  background: #f8fcff;
}

.ghost:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

@keyframes snail-bob {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-3px);
  }
}

@keyframes dot-pulse {
  0%, 20% { content: "."; }
  40% { content: ".."; }
  60%, 100% { content: "..."; }
}

@keyframes dot-bounce {
  0%, 80%, 100% { transform: scale(0.3); opacity: 0.35; }
  40% { transform: scale(1); opacity: 1; }
}


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


/* ══ layout.css ══ */

/* layout — domain styles for ThesisMind */

/* ── Sidebar collapse ── */

.sidebar-collapse-btn {
  position: absolute;
  top: 18px;
  right: 10px;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: transform 0.25s ease, right 0.25s ease;
  padding: 0;
  line-height: 1;
}
.sidebar-collapse-btn:hover { color: var(--text); border-color: var(--line-strong); }

.shell.sidebar-collapsed { grid-template-columns: 50px minmax(0, 1fr); }
.shell.sidebar-collapsed .sidebar {
  padding: 20px 8px;
  overflow: hidden;
}
.shell.sidebar-collapsed .sidebar-collapse-btn {
  right: 12px;
  transform: rotate(180deg);
}
.shell.sidebar-collapsed .brand,
.shell.sidebar-collapsed .steps,
.shell.sidebar-collapsed .services-sub,
.shell.sidebar-collapsed .license-badge,
.shell.sidebar-collapsed .model-badge,
.shell.sidebar-collapsed .hosted-quota-global,
.shell.sidebar-collapsed .theme-switcher { display: none; }

/* ── end sidebar collapse ── */

/* rest of sidebar styles unchanged */

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 68px;
  height: 68px;
  border-radius: 16px;
  flex-shrink: 0;
  object-fit: contain;
}

.brand h1,
.brand p,
.page-head h2,
.page-head p {
  margin: 0;
}

.brand h1 {
  font-size: 17px;
  letter-spacing: 0;
}

.brand p,
.status-card small,
.label,
.eyebrow {
  color: var(--muted);
}

.steps {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.steps:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  font-size: 13px;
}

.step span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 26px;
  border-radius: 9px;
  background: #e8f3ff;
  color: #4274a6;
  font-size: 12px;
  font-weight: 700;
}

.step.active {
  color: var(--text);
  border-color: #9dc8ef;
  background: #edf7ff;
}

.step-stars {
  margin-left: auto;
  font-size: 10px;
  letter-spacing: 1px;
  color: #d4a017;
  font-weight: 400;
  opacity: 0.85;
}

.services-toggle,
.vip-toggle {
  width: 100%;
}
.services-toggle .chevron,
.vip-toggle .chevron {
  display: inline;
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: 10px;
  font-weight: normal;
  opacity: 0.5;
  margin-left: auto;
}

.services-sub {
  display: grid;
  gap: 4px;
  padding: 2px 0 0 0;
}
.services-sub[hidden] { display: none; }
.sub-item {
  font-size: 12px !important;
  height: 32px !important;
  padding-left: 48px !important;
  opacity: 0.75;
}
.sub-item:first-child {
  margin-top: 2px;
}
.sub-item.active {
  opacity: 1;
  color: var(--primary);
}
.sub-item span { display: none; }

.model-badge {
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.model-badge .mb-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.35);
}
.model-badge .mb-name {
  font-weight: 600;
  color: var(--text);
}
.hosted-quota-global {
  display: grid;
  gap: 7px;
  margin: 12px 0 2px;
  padding: 10px 14px 11px;
  border: 1px solid rgba(45, 154, 104, 0.24);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(45, 154, 104, 0.08), rgba(255, 255, 255, 0.35));
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.hosted-quota-global:hover,
.hosted-quota-global:focus-visible {
  border-color: rgba(45, 154, 104, 0.52);
  box-shadow: 0 7px 18px rgba(32, 89, 65, 0.10);
  outline: none;
  transform: translateY(-1px);
}
.hosted-quota-global[hidden] {
  display: none;
}
.hosted-quota-global-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}
.hosted-quota-global-row strong {
  color: var(--green);
  font-size: 15px;
}
.hosted-quota-global-track {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
}
.hosted-quota-global-track span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2d9a68, #51c28b);
  transition: width 0.35s ease, background 0.2s ease;
}
.hosted-quota-global small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}
.hosted-quota-global.warning .hosted-quota-global-row strong {
  color: #d97706;
}
.hosted-quota-global.warning .hosted-quota-global-track span {
  background: #f59e0b;
}
.hosted-quota-global.exhausted .hosted-quota-global-row strong {
  color: #dc2626;
}
.hosted-quota-global.exhausted .hosted-quota-global-track span {
  background: #ef4444;
}

/* ── Setup page: model panel + API key ── */
.setup-model-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.hosted-ai-banner {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(45, 154, 104, 0.34);
  border-radius: 12px;
  background:
    radial-gradient(circle at 100% 0, rgba(45, 154, 104, 0.16), transparent 42%),
    linear-gradient(135deg, rgba(45, 154, 104, 0.10), rgba(255, 255, 255, 0.92));
}
.hosted-ai-banner[hidden] {
  display: none;
}
.hosted-ai-main {
  display: flex;
  align-items: center;
  gap: 11px;
}
.hosted-ai-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(45, 154, 104, 0.16);
  font-size: 1.4rem;
}
.hosted-ai-copy {
  min-width: 0;
}
.hosted-ai-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.hosted-ai-banner strong,
.hosted-ai-banner p {
  display: block;
  margin: 0;
}
.hosted-ai-copy p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
}
.hosted-ai-badge {
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}
.hosted-ai-quota {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 5px;
  padding: 11px 13px;
  border: 1px solid rgba(45, 154, 104, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.76);
  color: #385246;
  font-size: 0.8rem;
}
.hosted-ai-quota-label {
  margin-right: 3px;
  color: var(--muted);
}
.hosted-ai-quota strong {
  color: var(--green);
  font-size: 1.35rem;
  line-height: 1;
}
.hosted-ai-quota small {
  margin-left: auto;
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 600;
}
.hosted-ai-byok-guide {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 11px;
  border-top: 1px dashed rgba(45, 154, 104, 0.30);
}
.hosted-ai-byok-guide > div {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
}
.hosted-ai-byok-guide strong {
  font-size: 0.82rem;
}
.hosted-ai-byok-guide span {
  color: var(--muted);
  font-size: 0.75rem;
}
.hosted-ai-byok-toggle {
  flex: 0 0 auto;
  border-color: rgba(45, 154, 104, 0.42);
  background: #fff;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 700;
}
.hosted-ai-byok-toggle:hover {
  border-color: var(--green);
  background: rgba(45, 154, 104, 0.08);
}
.setup-model-grid[hidden],
.setup-model-meta[hidden],
#modelAdvice[hidden],
#byokConfigField[hidden],
#saveConfig[hidden] {
  display: none !important;
}
.field-optional {
  color: var(--green);
  font-weight: 500;
}
.setup-model-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(260px, 1.2fr);
  gap: 12px;
}
.setup-provider-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}
.setup-field-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.setup-provider-field small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.setup-field-control {
  position: relative;
  display: block;
}
.setup-field-control::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 1.8px solid #64748b;
  border-bottom: 1.8px solid #64748b;
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}
.setup-provider-field select {
  width: 100%;
  min-height: 42px;
  appearance: none;
  -webkit-appearance: none;
  padding: 9px 36px 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.setup-provider-field select:hover {
  border-color: #94a3b8;
  background: #fdfefe;
}
.setup-provider-field select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.setup-model-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
  color: var(--muted);
  font-size: 12px;
}
.setup-model-meta code {
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid #dbe3ec;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.setup-model-advice {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}
.setup-model-advice:empty { display: none; }
.setup-model-advice div {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.setup-model-advice strong { color: var(--text); font-size: 14px; }
.setup-model-advice div span {
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 700;
}
.setup-model-advice p,
.setup-model-advice small {
  display: block;
  margin: 0;
  line-height: 1.6;
}
.setup-model-advice small { color: #92400e; }
.setup-model-advice.is-risk {
  border-color: #fbbf24;
  background: #fffbeb;
}
.setup-model-advice.is-risk div span {
  background: #fef3c7;
  color: #92400e;
}
@media (max-width: 720px) {
  .hosted-ai-quota small {
    width: 100%;
    margin-left: 0;
  }
  .hosted-ai-byok-guide {
    align-items: stretch;
    flex-direction: column;
  }
  .hosted-ai-byok-toggle {
    width: 100%;
  }
  .setup-model-grid {
    grid-template-columns: 1fr;
  }
  .setup-model-meta {
    align-items: flex-start;
    flex-direction: column;
  }
}
.apikey-row { display: flex; gap: 8px; align-items: center; }
.apikey-row input { flex:1; border:1px solid var(--border); border-radius:8px; padding:10px 14px; font-size:14px; background:var(--surface); }
.apikey-row button { white-space:nowrap; height:44px; padding:0 20px; }
.apikey-guide {
  display: flex; gap: 6px; align-items: flex-start;
  margin-top: 8px; padding: 10px 14px;
  background: #fefce8; border: 1px solid #fde68a; border-radius: 8px;
  font-size: 12px; line-height: 1.6; color: #92400e;
}
.apikey-guide a { color: #92400e; font-weight: 600; text-decoration: underline; }

@media (max-width: 980px) {
  .paper-import-methods {
    grid-template-columns: 1fr;
  }
}
.paper-import-roundtrip-stats {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid #b7e0ca;
  border-radius: 9px;
  color: #166534;
  background: #f0fdf4;
  font-size: 12px;
  line-height: 1.6;
}
.paper-assistant-callout {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin: 0 0 18px;
  padding: 18px 20px;
  overflow: hidden;
  border: 1px solid rgba(75, 99, 255, 0.28);
  border-radius: 16px;
  background:
    radial-gradient(circle at 92% 10%, rgba(139, 92, 246, 0.17), transparent 34%),
    linear-gradient(135deg, #f3f7ff 0%, #f8f5ff 100%);
  box-shadow: 0 10px 28px rgba(75, 99, 255, 0.10);
}
.paper-assistant-callout::after {
  position: absolute;
  right: -35px;
  bottom: -55px;
  width: 130px;
  height: 130px;
  border: 18px solid rgba(75, 99, 255, 0.06);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}
.paper-assistant-callout-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  background: linear-gradient(135deg, #4b63ff, #8b5cf6);
  box-shadow: 0 8px 20px rgba(75, 99, 255, 0.24);
  font-size: 23px;
}
.paper-assistant-callout-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.paper-assistant-callout-copy > span {
  color: #6d5cae;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.paper-assistant-callout-copy > strong {
  color: #273552;
  font-size: 17px;
  line-height: 1.4;
}
.paper-assistant-callout-copy > p {
  max-width: 720px;
  margin: 0;
  color: #60708c;
  font-size: 12px;
  line-height: 1.65;
}
.paper-assistant-callout-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 3px;
}
.paper-assistant-callout-tags i {
  padding: 3px 8px;
  border-radius: 999px;
  color: #52627d;
  background: rgba(255, 255, 255, 0.82);
  font-size: 10px;
  font-style: normal;
}
.paper-assistant-callout-action {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 190px;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(75, 99, 255, 0.20);
  white-space: nowrap;
}
.paper-assistant-callout-action b {
  font-size: 17px;
  transition: transform 0.16s ease;
}
.paper-assistant-callout-action:hover b {
  transform: translateX(3px);
}
@media (max-width: 860px) {
  .paper-assistant-callout {
    grid-template-columns: 42px minmax(0, 1fr);
  }
  .paper-assistant-callout-icon {
    width: 42px;
    height: 42px;
  }
  .paper-assistant-callout-action {
    grid-column: 1 / -1;
    width: 100%;
  }
}
.paper-import-confirm-actions {
  align-items: center;
  justify-content: flex-start;
  padding: 4px 0;
}
.paper-sync-diff {
  display: grid;
  gap: 14px;
  margin-top: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}
.paper-sync-diff[hidden] { display: none; }
.paper-sync-risk {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.paper-sync-risk.low {
  color: #166534;
  background: #dcfce7;
}
.paper-sync-risk.medium {
  color: #92400e;
  background: #fef3c7;
}
.paper-sync-risk.high {
  color: #991b1b;
  background: #fee2e2;
}
.paper-sync-diff-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.paper-sync-diff-grid > section {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
}
.paper-sync-diff-grid h4 {
  margin: 0 0 9px;
  font-size: 13px;
}
.paper-sync-diff-grid section > div {
  display: grid;
  gap: 6px;
  max-height: 360px;
  overflow: auto;
}
.paper-sync-diff-item {
  display: grid;
  gap: 4px;
  padding: 8px;
  border-radius: 7px;
  background: var(--bg);
}
.paper-sync-diff-item b {
  font-size: 12px;
  line-height: 1.45;
}
.paper-sync-diff-item small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}
.paper-sync-diff-item > span {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.paper-sync-diff-item i {
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(75, 99, 255, 0.1);
  color: var(--primary);
  font-size: 10px;
  font-style: normal;
}
.paper-sync-diff-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.paper-sync-diff-preview p {
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  max-height: 140px;
  overflow: auto;
}
.paper-sync-diff-preview p b {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}
.danger-action {
  background: #b42318;
  border-color: #b42318;
}
.version-history-card {
  width: min(1060px, calc(100vw - 32px));
  max-width: 1060px;
  max-height: min(820px, calc(100vh - 32px));
}
.version-history-card .modal-head > div {
  display: grid;
  gap: 3px;
}
.version-history-card .modal-head h2,
.version-history-card .modal-head p {
  margin: 0;
}
.version-history-card .modal-head p {
  color: var(--muted);
  font-size: 12px;
}
.version-history-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}
.version-history-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: 480px;
  overflow: hidden;
}
.version-history-list {
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 14px;
  border-right: 1px solid var(--line);
  overflow: auto;
}
.version-history-item {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.version-history-item:hover,
.version-history-item.selected {
  border-color: var(--primary);
  background: rgba(75, 99, 255, 0.07);
}
.version-history-item > span {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.version-history-item > span b {
  flex: 0 0 auto;
  color: var(--primary);
}
.version-history-item > span {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.version-history-item small,
.version-history-item i {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}
.version-history-detail {
  padding: 18px;
  overflow: auto;
}
.version-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.version-detail-head h3 {
  margin: 5px 0 0;
}
.version-detail-meta {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 12px;
}
.version-content-preview {
  max-height: 500px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.7;
  overflow: auto;
  white-space: pre-wrap;
}
.version-citation-preview {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}
.version-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-bottom: 12px;
}
.version-summary-grid > div {
  display: grid;
  gap: 3px;
  padding: 12px;
  border-radius: 9px;
  background: var(--panel-2);
  text-align: center;
}
.version-summary-grid b {
  color: var(--primary);
  font-size: 20px;
}
.version-summary-grid span {
  color: var(--muted);
  font-size: 11px;
}
.version-draft-preview {
  display: grid;
  gap: 6px;
}
.version-draft-preview p {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 8px;
  margin: 0;
  padding: 9px;
  border-radius: 7px;
  background: var(--panel-2);
  font-size: 12px;
}
.version-draft-preview span {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 900px) {
  .paper-info-mode-cards {
    grid-template-columns: 1fr;
    max-width: 560px;
  }
}
@media (max-width: 720px) {
  .paper-import-head,
  .paper-import-result-head,
  .paper-import-section-title,
  .paper-import-confirm-actions { flex-direction: column; }
  .paper-import-type,
  .paper-import-metadata { grid-template-columns: 1fr; }
  .paper-import-metadata .wide { grid-column: auto; }
  .paper-sync-diff-grid { grid-template-columns: 1fr; }
  .paper-sync-diff-preview { grid-template-columns: 1fr; }
  .version-history-layout {
    grid-template-columns: 1fr;
    overflow: auto;
  }
  .version-history-list {
    max-height: 250px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

.outline-draft-grid {
  grid-template-columns: 1fr;
}

.outline-draft-grid .paper-info-draft-item {
  background: #fbfcff;
}

.outline-draft-grid ul {
  margin: 6px 0 0;
  padding-left: 18px;
  color: #4a5568;
  font-size: 0.86rem;
  line-height: 1.65;
}

.outline-draft-grid li {
  margin: 3px 0;
}

.meta-label {
  color: #7593af;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.meta-value {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #bdd2e6;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input,
select {
  height: 46px;
  padding: 0 14px;
}

textarea {
  resize: vertical;
  padding: 14px;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(31, 123, 215, 0.12);
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
}

.save-tip,
.progress-tip {
  color: var(--green);
  font-size: 14px;
  font-weight: 700;
}

.cute-loader {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.08);
  color: var(--primary);
}

.cute-loader span {
  width: 8px;
  height: 8px;
  display: inline-block;
  border-radius: 50%;
  background: var(--primary);
  animation: cute-bounce 1s infinite ease-in-out;
}

.cute-loader span:nth-child(2) {
  animation-delay: 0.12s;
}

.cute-loader span:nth-child(3) {
  animation-delay: 0.24s;
}

@media (max-width: 900px) {
  .outline-workflow-tab {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 6px;
    padding: 8px;
  }

  .outline-workflow-tab > b {
    width: 24px;
    height: 24px;
  }

  .outline-workflow-tab small {
    display: none;
  }

  .outline-next-step {
    grid-template-columns: 1fr;
  }

  .outline-next-step ol {
    flex-wrap: wrap;
    white-space: normal;
  }

  .outline-next-step .primary {
    width: 100%;
  }

  .outline-draft-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .outline-draft-footer > span {
    margin-right: 0;
  }

  .outline-draft-footer .primary {
    align-self: flex-end;
  }
}

.citation-note,
.empty-state {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid #c4d8eb;
  border-radius: 14px;
  color: #31526f;
  background: #f6fbff;
  line-height: 1.65;
  font-size: 14px;
}

.citation-list:not([hidden]) {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 18px;
}

.citation-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.citation-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #41637f;
  font-size: 12px;
  font-weight: 800;
}

.citation-meta span,
.citation-meta strong,
.citation-meta em {
  padding: 4px 8px;
  border-radius: 999px;
  background: #edf7ff;
  font-style: normal;
}

.citation-meta em {
  color: #8a6424;
  background: #fff6df;
}

.citation-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 86px minmax(0, 0.8fr);
  gap: 8px;
}

.citation-card textarea {
  min-height: 260px;
  width: 100%;
  resize: vertical;
}

.citation-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.citation-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.citation-col-head {
  font-size: 0.82rem;
  font-weight: 800;
  color: #31526f;
  padding: 8px 12px;
  background: #f2f8ff;
  border-radius: 10px;
}

.citation-llm-section {
  margin-top: 18px;
}

.citation-group {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.citation-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
  user-select: none;
}

.citation-group-header.citation-local {
  background: #eaf4e8;
  color: #2d5a27;
}

.citation-group-header.citation-llm {
  background: #eef3ff;
  color: #2a4080;
}

.citation-group-header.citation-method {
  background: #f3eef9;
  color: #4a3080;
}

.citation-group-header.citation-merged {
  background: #fef7e6;
  color: #6b5000;
}

.citation-group-count {
  font-size: 0.73rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.65);
}

.citation-group-text {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 14px;
  font-size: 0.78rem;
  line-height: 1.8;
  font-family: inherit;
  background: #fcfcfc;
}

.citation-merged-section {
  margin-top: 18px;
}

.reference-card textarea {
  min-height: 320px;
  width: 100%;
  resize: vertical;
  background: #f6fbff;
  border-color: #c4d8eb;
}

.citation-row {
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: start;
}

.citation-row small {
  grid-column: 2;
  color: var(--muted);
  line-height: 1.5;
}

.citation-count {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #506a83;
  font-size: 13px;
  font-weight: 800;
}

.citation-count input {
  width: 92px;
  height: 38px;
}

.task-log {
  display: grid;
  gap: 8px;
  max-height: 180px;
  margin-top: 16px;
  overflow: auto;
  border: 1px solid #c4d8eb;
  border-radius: 14px;
  background: #f8fcff;
}

.task-log:empty {
  display: none;
}

.task-log div {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #e7f0f8;
  color: #31526f;
  font-size: 13px;
}

.task-log div:last-child {
  border-bottom: 0;
}

.task-log time {
  color: #6f879e;
  font-weight: 700;
}

@media (max-width: 900px) {
  .chapter-workspace-summary {
    grid-template-columns: repeat(2, minmax(100px, 1fr));
  }

  .imported-formula-card {
    grid-template-columns: 1fr;
  }
}

.inline-draft {
  min-height: 160px;
  margin: 0 18px 16px;
  width: calc(100% - 36px);
  background: #fbfdff;
}

.table-preview {
  margin: 0 18px 10px;
  overflow-x: auto;
}

.table-preview table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.table-preview th,
.table-preview td {
  border: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}

.table-preview th {
  background: #eef4fa;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.table-preview tr:nth-child(even) td {
  background: #fafcff;
}

.table-preview h4 {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--text);
}

.section-prompt {
  min-height: 74px;
  margin: 0 18px 10px;
  width: calc(100% - 36px);
  border-color: #c7ddf1;
  background: #f6fbff;
  font-size: 13px;
}

.consistency-feedback {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #dde7f0;
  font-size: 0.82rem;
  line-height: 1.6;
}

.cf-item {
  padding: 4px 0;
}

.cf-item.cf-ok {
  color: #2e7d32;
}

.cf-item.cf-warn {
  color: #c62828;
  font-weight: 500;
}

.cf-item.cf-stale {
  color: #e65100;
  font-weight: 500;
}

.cf-tag {
  display: inline-block;
  margin: 0 3px;
  padding: 1px 8px;
  border-radius: 4px;
  background: #ffebee;
  color: #b71c1c;
  font-size: 0.78rem;
}

.stale-chapter-badge {
  display: none;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 10px;
  background: #fff3e0;
  color: #e65100;
  font-size: 0.72rem;
  font-weight: 600;
  vertical-align: middle;
  cursor: help;
}

.serial-progress {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #bcd4ea;
  border-radius: 16px;
  background: #f6fbff;
}

.snail-track {
  position: relative;
  height: 42px;
  border-bottom: 3px solid #9fc4e5;
}

.snail-track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 3px;
  background: linear-gradient(90deg, #7db8ee, #80d0b6, #b9a7ef);
}

.snail {
  position: absolute;
  bottom: 0;
  left: -18px;
  width: 44px;
  height: 30px;
  transition: left 0.5s ease;
  animation: snail-bob 1.4s ease-in-out infinite;
}

.snail-shell {
  position: absolute;
  left: 4px;
  bottom: 3px;
  width: 22px;
  height: 22px;
  border: 3px solid #7d5fd1;
  border-radius: 50%;
  background: #d8ccff;
}

.snail-shell::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 2px solid #7d5fd1;
  border-radius: 50%;
}

.snail-body {
  position: absolute;
  right: 0;
  bottom: 3px;
  width: 26px;
  height: 13px;
  border-radius: 14px 16px 8px 8px;
  background: #69bfa2;
}

.snail-eye {
  position: absolute;
  right: 2px;
  bottom: 18px;
  width: 4px;
  height: 14px;
  border-radius: 999px;
  background: #69bfa2;
}

.snail-eye::after {
  content: "";
  position: absolute;
  top: -2px;
  left: -1px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #18324d;
}

.serial-progress-text {
  margin-top: 10px;
  color: #31526f;
  font-size: 13px;
  font-weight: 800;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(560px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fafdff;
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
}

.icon-button {
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

/* ---- Chat Bottom Bar ---- */
.chat-bar {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20vh;
  min-height: 140px;
  border-top: 1px solid var(--line);
  background: rgba(250, 253, 255, 0.97);
  backdrop-filter: blur(12px);
  z-index: 100;
}
.chat-bar[hidden] { display: none; }

.chat-bar-resize {
  position: absolute;
  top: -4px;
  left: 0;
  right: 0;
  height: 8px;
  cursor: ns-resize;
  z-index: 10;
}
.chat-bar-resize:hover { background: rgba(31, 123, 215, 0.08); }

.chat-bar-left {
  flex: 0 0 35%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  border-right: 1px solid var(--line);
}

.chat-bar-left textarea {
  flex: 1;
  min-height: 0;
  padding: 10px 14px;
  border: 1px solid #bdd2e6;
  border-radius: 10px;
  background: #fff;
  resize: none;
  font-size: 14px;
  line-height: 1.5;
  font-family: inherit;
}

.chat-bar-left textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 123, 215, 0.1);
  outline: none;
}

.chat-bar-left .primary {
  min-width: 64px;
  height: 36px;
  align-self: flex-end;
}

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

.chat-bar-right-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 16px;
  border-bottom: 1px solid var(--line);
  background: #f6fbff;
  flex-shrink: 0;
}

.chat-bar-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.chat-bar-right-head .ghost {
  min-width: auto;
  height: 26px;
  padding: 0 8px;
  font-size: 12px;
}

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

/* retain existing chat message styles */
.chat-empty {
  color: var(--muted);
  text-align: center;
  padding: 20px 16px;
  font-size: 13px;
  line-height: 1.6;
}

.chat-msg {
  max-width: 92%;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.chat-msg.user {
  align-self: flex-start;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.chat-msg.assistant {
  align-self: flex-end;
  background: #e5f0ff;
  color: var(--text);
  border: 1px solid #c4d8f0;
}

.chat-msg.system-msg {
  align-self: center;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 12px;
  padding: 2px 10px;
  max-width: 100%;
}

.chat-msg h3,
.chat-msg h4 {
  margin: 0 0 4px;
  color: var(--text);
}

.chat-msg h3 { font-size: 14px; }
.chat-msg h4 { font-size: 13px; }

.chat-msg p { margin: 2px 0; }

.chat-msg strong { color: var(--primary-strong); }

.chat-msg.assistant { position: relative; }

.msg-bookmark {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  display: grid;
  place-items: center;
}

.chat-msg.assistant:hover .msg-bookmark { opacity: 1; }

.msg-bookmark:hover {
  background: #e8f3ff;
  color: var(--primary);
}

.msg-bookmark.saved {
  opacity: 1;
  color: #d4a017;
}

/* ---- Best Practices Panel (slide-in) ---- */
.bp-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  height: 100vh;
  z-index: 110;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: #fafdff;
  box-shadow: -12px 0 44px rgba(54, 101, 147, 0.14);
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.bp-panel.open { transform: translateX(0); }

.bp-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: #f6fbff;
}

.bp-panel-head h3 { margin: 0; font-size: 17px; }

.bp-panel-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.bp-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.bp-card h4 { margin: 0 0 6px; font-size: 14px; color: var(--text); }

.bp-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

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

.bp-card-tags { display: flex; flex-wrap: wrap; gap: 4px; }

.bp-card-tags span {
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf7ff;
  color: #41637f;
  font-size: 11px;
  font-weight: 700;
}

.bp-card-delete {
  border: 0;
  background: transparent;
  color: #c44;
  cursor: pointer;
  font-size: 12px;
  padding: 4px 8px;
}

.bp-overlay {
  position: fixed;
  inset: 0;
  z-index: 105;
  background: rgba(24, 50, 77, 0.24);
}

.chat-table {
  width: 100%;
  margin: 4px 0;
  border-collapse: collapse;
  font-size: 12px;
}

.chat-table th,
.chat-table td {
  padding: 4px 8px;
  border: 1px solid var(--line);
  text-align: left;
}

.chat-table th {
  background: #f0f7ff;
  font-weight: 700;
  color: var(--primary-strong);
}

.chat-typing {
  align-self: flex-start;
  padding: 8px 14px;
  color: var(--muted);
  font-size: 12px;
}

.chat-typing::after {
  content: "...";
  animation: dot-pulse 1.2s infinite;
}

/* Push workspace up so content isn't hidden behind chat bar */
.shell {
  padding-bottom: 20vh;
}

@media (max-width: 720px) {
  .chat-bar {
    height: 30vh;
    flex-direction: column;
  }
  .chat-bar-left {
    flex: 0 0 auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 8px 12px;
  }
  .chat-bar-right {
    flex: 1;
  }
  .shell {
    padding-bottom: 30vh;
  }
}

/* ---------- Chat bar minimized state ---------- */
.chat-bar .chat-bar-minimize {
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  min-width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 6px;
  color: var(--text);
  opacity: 0.5;
  transition: opacity 0.2s;
}
.chat-bar .chat-bar-minimize:hover {
  opacity: 1;
}

/* Minimized: shrink to a floating circle in bottom-right */
.chat-bar.minimized {
  left: auto;
  right: 20px;
  bottom: 20px;
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  max-width: 48px;
  max-height: 48px;
  border-radius: 50%;
  border: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  cursor: pointer;
  padding: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.chat-bar.minimized > * {
  display: none;
}
/* Floating chat bubble icon */
.chat-bar.minimized::before {
  content: "💬";
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
/* Restore hint on hover */
.chat-bar.minimized::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  pointer-events: none;
}
.chat-bar.minimized:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
}

/* Restore button inside the minimized circle (takes over click) */
.chat-bar .chat-bar-restore {
  display: none;
}
.chat-bar.minimized .chat-bar-restore {
  display: flex;
  position: absolute;
  inset: 0;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 2;
}

/* Inline loading indicator: three bouncing dots for chat bubbles */
.thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  vertical-align: middle;
  margin-right: 5px;
}

.thinking-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary, #7d5fd1);
  animation: dot-bounce 1.2s ease-in-out infinite;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

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

  .sidebar {
    position: static;
    height: auto;
  }

  .method-list,
  .method-zone-cards,
  .svg-editor,
  .citation-list {
    grid-template-columns: 1fr;
  }

  .feature-grid {
    display: none;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 12px;
  }

  .panel {
    padding: 20px;
  }

  .page-head,
  .form-grid,
  .project-context-pair {
    grid-template-columns: 1fr;
    display: grid;
  }

  .page-head h2 {
    font-size: 26px;
  }

  .head-actions,
  .workflow-next-btn {
    width: 100%;
  }

  .workflow-next-btn {
    min-width: 0;
  }

  .method-list,
  .method-zone-cards {
    grid-template-columns: 1fr;
  }

  .section-row {
    grid-template-columns: 1fr;
  }
}

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

.figure-presets {
  margin-top: -6px;
  padding: 10px 12px;
  background: var(--surface2);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.figure-presets-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.figure-presets-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.figure-preset-btn {
  padding: 5px 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.figure-preset-btn:hover {
  background: #e6f7ff;
  border-color: #91d5ff;
}
.figure-upload-zone {
  margin-top: 8px;
  padding: 14px 18px;
  border: 2px dashed var(--border);
  border-radius: 8px;
  text-align: center;
  background: var(--surface2);
  transition: border-color 0.15s, background 0.15s;
}
.figure-upload-zone.drag-over { border-color: #3b82f6; background: #eff6ff; }
.figure-upload-zone .figure-upload-label {
  font-size: 13px;
  color: var(--muted);
}
.figure-upload-zone .figure-upload-icon {
  font-size: 22px;
  display: block;
  margin-bottom: 4px;
}
.figure-upload-zone .figure-upload-file {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 6px 10px; background: var(--surface); border-radius: 6px;
  border: 1px solid var(--border); font-size: 13px;
}

@media (max-width: 720px) {
  .peer-review-source, .peer-strengths-weaknesses { grid-template-columns: 1fr; }
}

@media (max-width: 720px) { .aigc-source-row { grid-template-columns: 1fr; } }

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

@media (max-width: 720px) {
  .ppt-source-row,
  .ppt-style-controls { grid-template-columns: 1fr; }
  .ppt-template-preview img,
  .ppt-template-preview-empty { height: 66px; }
}

.ppt-history { margin-top: 16px; border: 1px solid var(--border); border-radius: 8px; padding: 0 14px; }
.ppt-history summary { padding: 10px 0; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
.ppt-history-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; }
.ppt-history-topic { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ppt-history-meta { color: var(--muted); white-space: nowrap; }
.ppt-history-dl-btn { flex-shrink: 0; }


/* ══ paper-info.css ══ */

/* paper-info — domain styles for ThesisMind */

/* ---- paper_info top row ---- */
.paper-info-top-row {
  grid-column: 1 / -1;
}

.inline-field.project-history-field .inline-select-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.inline-field.project-history-field select {
  max-width: 320px;
  flex: 1;
}

.inline-field.project-history-field .ghost {
  white-space: nowrap;
  height: 42px;
  padding: 0 16px;
}

.inline-field.project-history-field .project-delete-btn {
  color: #b42318;
  border-color: #f0b4ae;
}

.inline-field.project-history-field .project-delete-btn:disabled {
  color: var(--muted);
  border-color: var(--line);
}

.custom-direction-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.custom-direction-row[hidden] {
  display: none;
}

.custom-direction-row input {
  flex: 1;
}

/* ---- paper_info meta display ---- */
.paper-info-meta-row {
  grid-column: 1 / -1;
  display: flex;
  gap: 32px;
  padding: 14px 20px;
  background: #f6fafd;
  border-radius: 12px;
  border: 1px solid #dfecf7;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.paper-info-chat-panel {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px 0;
}

.paper-info-draft {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.paper-info-draft-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.paper-info-draft-head h3 {
  margin: 0;
  font-size: 1rem;
}

.paper-info-draft-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.paper-info-draft-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcff;
}

.paper-info-draft-grid b {
  display: block;
  color: var(--text);
  font-size: 0.86rem;
  margin-bottom: 6px;
}

.paper-info-draft-grid p {
  margin: 0;
  color: #4a5568;
  font-size: 0.88rem;
  line-height: 1.65;
}
.paper-info-draft-grid p span {
  display: inline-block;
  margin-top: 4px;
  color: #6b7280;
  font-size: 0.82rem;
}

.paper-info-mode-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 900px;
}
.paper-info-mode-cards .mode-card { padding: 28px 18px; }
.paper-import-panel {
  max-width: 1040px;
  margin: 0 auto;
  padding: 8px 0 24px;
}
.paper-import-head,
.paper-import-result-head,
.paper-import-section-title,
.paper-import-confirm-actions,
.paper-import-upload-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.paper-import-head { margin-bottom: 18px; }
.paper-import-head h3,
.paper-import-result-head h3 { margin: 5px 0 4px; }
.paper-import-head p,
.paper-import-result-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.paper-import-type {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.paper-import-type-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
}
.paper-import-type-option.selected {
  border-color: var(--primary);
  background: rgba(75, 99, 255, 0.07);
  box-shadow: 0 0 0 2px rgba(75, 99, 255, 0.08);
}
.paper-import-type-option input,
.paper-import-section-title input,
.paper-import-chapter input {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: var(--primary);
}
.paper-import-type-option span,
.paper-import-section-title > span,
.paper-import-section-title label > span {
  display: grid;
  gap: 3px;
}
.paper-import-type-option small,
.paper-import-section-title small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.paper-import-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 20px;
  border: 2px dashed var(--line);
  border-radius: 14px;
  background: rgba(75, 99, 255, 0.025);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
}
.paper-import-upload:hover,
.paper-import-upload.drag-over {
  border-color: var(--primary);
  background: rgba(75, 99, 255, 0.07);
}
.paper-import-upload > span {
  color: var(--muted);
  font-size: 12px;
}
.paper-import-upload-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--primary);
  background: rgba(75, 99, 255, 0.12);
  font-size: 24px;
  font-weight: 700;
}
.paper-import-selected-file {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--panel);
}
.paper-import-selected-file[hidden] { display: none; }
.paper-import-upload-actions {
  align-items: center;
  justify-content: flex-start;
  margin: 12px 0 18px;
}
.paper-import-result {
  display: grid;
  gap: 14px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.paper-import-result[hidden] { display: none; }
.paper-import-version-id {
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-family: "SF Mono", "Menlo", monospace;
  font-size: 11px;
}
.paper-import-warnings {
  padding: 12px 14px;
  border: 1px solid #f4c46f;
  border-radius: 10px;
  background: #fff9e8;
  color: #7a4a04;
  font-size: 13px;
}
.paper-import-warnings p { margin: 5px 0 0; }
.paper-import-section {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}
label.paper-import-section-title,
.paper-import-section-title label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}
.paper-import-section-title > div {
  display: flex;
  gap: 7px;
}
.paper-import-scope-options {
  display: flex;
  flex-wrap: wrap;
  gap: 18px !important;
}
.paper-import-section-title .ghost {
  padding: 5px 9px;
  font-size: 12px;
}
.paper-import-metadata {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 12px;
}
.paper-import-metadata > div {
  min-width: 0;
  padding: 11px;
  border-radius: 8px;
  background: var(--panel-2);
}
.paper-import-metadata .wide { grid-column: 1 / -1; }
.paper-import-metadata span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}
.paper-import-metadata b,
.paper-import-metadata p {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
}
.paper-import-chapters {
  display: grid;
  gap: 5px;
  margin-top: 12px;
}
.paper-import-chapter {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 10px 9px calc(10px + (var(--chapter-level) - 1) * 20px);
  border-radius: 8px;
  background: var(--panel-2);
}
.paper-import-chapter-path {
  flex: 0 0 48px;
  color: var(--primary);
  font-family: "SF Mono", "Menlo", monospace;
  font-size: 11px;
}
.paper-import-chapter-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}
.paper-import-chapter-copy b { font-size: 13px; }
.paper-import-chapter-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.paper-import-references {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  max-height: 360px;
  overflow: auto;
}
.paper-import-reference {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  padding: 9px;
  border-radius: 8px;
  background: var(--panel-2);
}
.paper-import-reference > span {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}
.paper-import-reference p {
  display: grid;
  gap: 3px;
  margin: 0;
}
.paper-import-reference b {
  font-size: 12px;
  line-height: 1.5;
}
.paper-import-reference small,
.paper-import-more,
.paper-import-empty {
  color: var(--muted);
  font-size: 11px;
}
.paper-import-more,
.paper-import-empty {
  padding: 12px;
  text-align: center;
}
.paper-import-methods {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.paper-import-method-phase {
  --phase-color: #3b82f6;
  --phase-bg: #eff6ff;
  min-width: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--phase-color) 28%, white);
  border-radius: 12px;
  background: #fff;
}
.paper-import-method-phase.phase-solve {
  --phase-color: #d97706;
  --phase-bg: #fffbeb;
}
.paper-import-method-phase.phase-validate {
  --phase-color: #7c3aed;
  --phase-bg: #f5f3ff;
}
.paper-import-method-phase > header {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 11px 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--phase-color) 20%, white);
  background: var(--phase-bg);
}
.paper-import-method-phase > header i {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: #fff;
  background: var(--phase-color);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}
.paper-import-method-phase > header span {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.paper-import-method-phase > header b {
  color: var(--text);
  font-size: 13px;
}
.paper-import-method-phase > header small {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.paper-import-method-phase > header em {
  min-width: 24px;
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--phase-color);
  background: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  text-align: center;
}
.paper-import-method-phase-cards {
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 9px;
}
.paper-import-method-phase-cards > p {
  margin: 0;
  padding: 15px 6px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}
.paper-import-method {
  display: grid;
  grid-template-columns: 17px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.paper-import-method:hover,
.paper-import-method:has(input:checked) {
  border-color: color-mix(in srgb, var(--phase-color) 55%, white);
  background: var(--phase-bg);
}
.paper-import-method:has(input:checked) {
  box-shadow: inset 3px 0 0 var(--phase-color);
}
.paper-import-method input {
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  accent-color: var(--phase-color);
}
.paper-import-method b {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.paper-import-method span {
  display: grid;
  gap: 2px;
}
.paper-import-method small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

/* ---- Import result tabs ---- */

.paper-import-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 14px 0 16px;
}

.paper-import-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.paper-import-tab:hover {
  border-color: var(--accent);
}

.paper-import-tab.active {
  border-color: var(--accent);
  background: var(--accent-bg, #e6f7ff);
}

.paper-import-tab-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--fg);
}

.paper-import-tab-hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.paper-import-tab-panels > .paper-import-section[hidden] {
  display: none;
}

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

@media (max-width: 720px) {
  .paper-import-tabs {
    grid-template-columns: repeat(2, 1fr);
  }
}


/* ══ methods.css ══ */

/* methods — domain styles for ThesisMind */

/* ---- Method panel: toolbar & tabs ---- */
.method-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
}
.method-toolbar input {
  max-width: 400px;
}
.method-toolbar span {
  color: var(--muted);
  font-size: 0.82rem;
}

.hint {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.method-tabs {
  --method-tab-phase: #2563eb;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 18px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel-2);
  box-shadow: inset 0 1px 2px rgba(31, 61, 89, 0.04);
}
.method-tab {
  --method-tab-phase: #2563eb;
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 58px;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: color .16s, border-color .16s, background .16s, box-shadow .16s, transform .16s;
}
.method-tab[data-method-phase="solve"] {
  --method-tab-phase: #d97706;
}
.method-tab[data-method-phase="validate"] {
  --method-tab-phase: #7c3aed;
}
.method-tab:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--method-tab-phase) 6%, var(--surface));
}
.method-tab.active {
  border-color: color-mix(in srgb, var(--method-tab-phase) 24%, var(--line));
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 5px 14px rgba(31, 61, 89, 0.09);
  transform: translateY(-1px);
}
.method-tab.active::after {
  position: absolute;
  right: 12px;
  bottom: -1px;
  left: 12px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--method-tab-phase);
  content: "";
}
.method-tab-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--method-tab-phase) 10%, var(--surface));
  font-size: 16px;
}
.method-tab.active .method-tab-icon {
  background: color-mix(in srgb, var(--method-tab-phase) 16%, var(--surface));
}
.method-tab-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.method-tab-copy strong {
  overflow: hidden;
  color: inherit;
  font-size: 0.86rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.method-tab-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.method-tab-count {
  min-width: 25px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
}
.method-tab.active .method-tab-count {
  border-color: transparent;
  background: color-mix(in srgb, var(--method-tab-phase) 12%, var(--surface));
  color: var(--method-tab-phase);
}
.method-tab.drag-over {
  border-color: var(--method-tab-phase);
  background: color-mix(in srgb, var(--method-tab-phase) 12%, var(--surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--method-tab-phase) 18%, transparent);
}

.custom-method {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 14px;
}

/* ---- Method zones ---- */
.method-zone {
  margin-top: 20px;
}
.method-zone-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 9px;
  margin-bottom: 12px;
  font-size: 0.82rem;
  font-weight: 700;
}
.zone-icon { font-size: 0.9rem; }
.zone-count {
  margin-left: auto;
  font-size: 0.72rem;
  padding: 2px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.6);
}

.method-zone-recommended .method-zone-header {
  background: linear-gradient(135deg, #d4edda 0%, #c8e6d0 100%);
  color: #1b5e31;
}
.method-zone-general .method-zone-header {
  background: #eef1f5;
  color: #5b6875;
}
.method-zone-cross .method-zone-header {
  background: linear-gradient(135deg, #e8eaf6 0%, #d1d9ff 100%);
  color: #1a237e;
}

.method-zone-pool {
  margin-bottom: 16px;
  padding: 4px;
  border: 2px dashed #bbdefb;
  border-radius: 14px;
  background: #fafcff;
}

.method-zone-pool .method-zone-header {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  color: #0d47a1;
  border: none;
  border-radius: 10px 10px 0 0;
}

.pool-hint {
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.7;
  margin-left: 4px;
}

.pool-remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 8px;
  border: 1px solid #ef9a9a;
  border-radius: 6px;
  background: #fff;
  color: #c62828;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.15s;
  z-index: 2;
}

.pool-remove-btn:hover {
  background: #ffebee;
  border-color: #e53935;
}

.method-zone-pool .method-card {
  border-color: #90caf9;
  background: #fafcff;
}

.saved-flash {
  background: #e8f5e9 !important;
  border-color: #66bb6a !important;
  color: #2e7d32 !important;
}

.method-zone-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

/* ---- Method cards ---- */
.method-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1.5px solid #dae3ed;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: all 0.18s;
}
.method-card:hover {
  border-color: #a8c8e8;
  box-shadow: 0 2px 12px rgba(24,50,77,0.06);
  transform: translateY(-1px);
  z-index: 50;
}
.method-card.selectable:has(.method-check:checked) {
  border-color: #4a9adf;
  background: #f2f9ff;
  box-shadow: 0 4px 18px rgba(41,112,178,0.10);
}

.method-check {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-right: 12px;
  margin-top: 1px;
  accent-color: var(--primary);
}

.method-card-inner {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.method-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.method-card-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.method-card-tooltip {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  width: 100%;
  min-width: 260px;
  max-width: 380px;
  background: #fff;
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.65;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid #d0dce8;
  z-index: 200;
  box-shadow: 0 6px 28px rgba(24,50,77,0.12);
  white-space: normal;
  word-break: break-word;
}
.method-card-tooltip::before {
  content: "";
  position: absolute;
  left: 18px;
  top: -8px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid #d0dce8;
}
.method-card-tooltip::after {
  content: "";
  position: absolute;
  left: 19px;
  top: -6px;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 7px solid #fff;
}
.method-card-tooltip.empty-tip {
  background: #fafafa;
  color: var(--muted);
  font-style: italic;
}
.method-card:hover .method-card-tooltip {
  display: block;
}
.method-card-detail {
  font-size: 0.73rem;
  color: var(--muted);
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.method-icon {
  flex-shrink: 0;
  font-size: 0.75rem;
  opacity: 0.7;
}

.method-diff {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.method-diff-beginner { background: #e6f4ea; color: #216e39; }
.method-diff-intermediate { background: #fff3d6; color: #8a6300; }
.method-diff-advanced { background: #fde8e8; color: #9b1c1c; }

.method-zone-recommended .method-card {
  border-left: 4px solid #5bb974;
}
.method-zone-cross .method-card {
  border-left: 4px solid #5c6bc0;
}
.method-zone-general .method-card {
  border-left: 4px solid #c0c7cf;
}

/* Pair / conflict indicators */
.method-tag {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
}
.method-tag-pair { background: #d6ecfb; color: #175d8f; }
.method-tag-conflict { background: #fde8e8; color: #9b1c1c; }

.method-card-paired {
  border-color: #8bc4ea !important;
  box-shadow: 0 0 0 3px rgba(74,154,223,0.12);
}
.method-card-conflict {
  border-color: #e69c9c !important;
  box-shadow: 0 0 0 3px rgba(220,80,80,0.10);
}
.method-card-conflict.method-card-paired {
  border-color: #d4a04a !important;
  box-shadow: 0 0 0 3px rgba(200,150,60,0.12);
}

.method-card-hint {
  color: #5b8cbf !important;
  font-size: 0.7rem !important;
  margin-top: 2px;
}

.svg-preview {
  display: grid;
  place-items: center;
  min-height: 580px;
  margin-top: 24px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #eef7ff;
}

.svg-preview svg {
  width: 100%;
  height: auto;
}

/* ---- Method Mode Chooser ---- */
.method-mode-chooser {
  padding: 24px 0;
}
.mode-chooser-guide {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto 16px;
  padding: 14px 16px;
  border: 1px solid rgba(75, 99, 255, 0.24);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(75, 99, 255, 0.10), rgba(139, 92, 246, 0.08));
  color: var(--text);
}
.mode-chooser-guide-icon {
  flex: 0 0 auto;
  font-size: 1.45rem;
}
.mode-chooser-guide div {
  display: grid;
  gap: 3px;
}
.mode-chooser-guide strong {
  font-size: 0.92rem;
}
.mode-chooser-guide div > span {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}
.mode-chooser-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 560px;
  margin: 0 auto;
}
.mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 20px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--bg);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  width: 100%;
  position: relative;
}
.mode-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}
.mode-card-icon {
  font-size: 2.4rem;
  margin-bottom: 12px;
}
.mode-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.mode-card-desc {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}
.mode-card-preferred {
  border-color: var(--primary);
  background: linear-gradient(160deg, rgba(75, 99, 255, 0.12), rgba(139, 92, 246, 0.05) 70%);
  box-shadow: 0 8px 28px rgba(75, 99, 255, 0.18);
}
.mode-card-preferred:hover {
  box-shadow: 0 12px 34px rgba(75, 99, 255, 0.27);
}
.mode-card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.mode-card-action {
  margin-top: 12px;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 700;
}
.mode-card-secondary {
  opacity: 0.86;
}
.chooser-return-attention {
  border-color: #f59e0b !important;
  color: #92400e !important;
  background: #fffbeb !important;
  font-weight: 700 !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16), 0 4px 14px rgba(146, 64, 14, 0.12);
  animation: chooser-return-pulse 1.7s ease-in-out infinite;
}
.chooser-return-attention:hover {
  border-color: #d97706 !important;
  color: #78350f !important;
  background: #fef3c7 !important;
  box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.20), 0 7px 18px rgba(146, 64, 14, 0.18);
}
@keyframes chooser-return-pulse {
  0%, 100% {
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.14), 0 4px 14px rgba(146, 64, 14, 0.10);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(245, 158, 11, 0.06), 0 6px 20px rgba(146, 64, 14, 0.20);
  }
}
@media (prefers-reduced-motion: reduce) {
  .chooser-return-attention {
    animation: none;
  }
}

/* ---- Method Assistant Chat ---- */
.method-chat-panel {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px 0;
}
.method-chat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.questionnaire-step {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--line-light, #f0f2f5);
  padding: 4px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
}
.method-chat-head h3 {
  font-size: 1.15rem;
  margin: 0 0 4px;
}
.method-chat-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}
.assistant-info-gate {
  margin: 12px 0 16px;
  padding: 18px;
  border: 1px solid #f2c36b;
  border-left: 5px solid #f59e0b;
  border-radius: 14px;
  background: linear-gradient(135deg, #fffbeb, #fff7df);
  color: #4b2e08;
  box-shadow: 0 8px 24px rgba(146, 64, 14, 0.10);
}
.assistant-info-gate[hidden] {
  display: none;
}
.assistant-info-gate-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.assistant-info-gate-icon {
  font-size: 1.35rem;
  line-height: 1.2;
}
.assistant-info-gate h4 {
  margin: 0 0 5px;
  font-size: 1rem;
}
.assistant-info-gate p {
  margin: 0;
  color: #78520f;
  font-size: 0.84rem;
  line-height: 1.55;
}
.assistant-info-missing {
  display: grid;
  gap: 7px;
  margin: 14px 0;
  padding: 0;
  list-style: none;
}
.assistant-info-missing li {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
  line-height: 1.45;
}
.assistant-info-missing li::before {
  content: "•";
  color: #d97706;
  font-weight: 800;
}
.assistant-info-missing b {
  white-space: nowrap;
}
.assistant-info-gate-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.assistant-info-gate .assistant-info-complete {
  border-color: #d97706;
  background: #d97706;
  color: #fff;
}
.assistant-info-gate .assistant-info-skip {
  color: #78520f;
  border-color: #d6a84f;
  background: rgba(255, 255, 255, 0.68);
}
.assistant-info-gate-note {
  flex-basis: 100%;
  color: #8a641c !important;
  font-size: 0.76rem !important;
}
.method-chat-messages {
  min-height: 260px;
  max-height: 460px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  padding: 14px;
}
.method-chat-empty {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 88px 16px;
}
.method-chat-message {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}
.method-chat-message.user {
  align-items: flex-end;
}
.method-chat-role {
  color: var(--muted);
  font-size: 0.75rem;
}
.method-chat-bubble {
  max-width: min(680px, 88%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.65;
}
.method-chat-bubble .chat-loading-text {
  color: var(--muted);
  animation: chat-pulse 1.5s ease-in-out infinite;
}
.thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-right: 5px;
  vertical-align: middle;
}
.thinking-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary, #7d5fd1);
  animation: thinking-dot-bounce 1.2s ease-in-out infinite;
}
.thinking-dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.thinking-dots span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes chat-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
@keyframes thinking-dot-bounce {
  0%, 80%, 100% {
    transform: scale(0.3);
    opacity: 0.35;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}
.method-chat-message.user .method-chat-bubble {
  background: #eef4ff;
  border-color: #d8e5ff;
}
.method-chat-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 12px;
}
.method-chat-input-row textarea {
  min-height: 76px;
  resize: vertical;
}
.q-loading {
  text-align: center;
  padding: 16px;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---- Recommend Results ---- */
.method-recommend-results {
  padding: 16px 0;
}
.results-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.results-head h3 {
  margin: 0;
  font-size: 1.05rem;
}
.results-head span {
  font-size: 0.82rem;
  color: var(--muted);
}
.recommend-reasons {
  margin-bottom: 20px;
}
.recommend-reason-box {
  padding: 14px 18px;
  background: #f6f8fc;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #4a5568;
}
.recommend-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 10px;
  background: var(--bg);
}
.recommend-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.recommend-card-name {
  font-weight: 700;
  font-size: 0.95rem;
}
.recommend-card-phase {
  font-size: 0.75rem;
  color: var(--muted);
}
.recommend-card-reason {
  font-size: 0.84rem;
  color: #555;
  line-height: 1.5;
  margin-bottom: 10px;
}
.recommend-card-details {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}
.recommend-card-section {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  font-size: 0.84rem;
  line-height: 1.55;
}
.recommend-card-section b {
  color: var(--text);
  font-weight: 700;
}
.recommend-card-section span {
  color: #555;
}
.recommend-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.recommend-add-btn {
  font-size: 0.8rem;
}
.recommend-add-btn.added {
  color: #2a7d4f;
  cursor: default;
  opacity: 0.7;
}

/* Phased recommend tabs */
.recommend-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 18px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel-2);
  box-shadow: inset 0 1px 2px rgba(31, 61, 89, 0.04);
}
.recommend-tab {
  --recommend-phase: #2563eb;
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 58px;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  transition: color .16s, border-color .16s, background .16s, box-shadow .16s, transform .16s;
}
.recommend-tab[data-recommend-phase="solve"] {
  --recommend-phase: #d97706;
}
.recommend-tab[data-recommend-phase="validate"] {
  --recommend-phase: #7c3aed;
}
.recommend-tab:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--recommend-phase) 6%, var(--surface));
}
.recommend-tab.active {
  border-color: color-mix(in srgb, var(--recommend-phase) 24%, var(--line));
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 5px 14px rgba(31, 61, 89, 0.09);
  transform: translateY(-1px);
}
.recommend-tab.active::after {
  position: absolute;
  right: 12px;
  bottom: -1px;
  left: 12px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--recommend-phase);
  content: "";
}
.recommend-tab-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--recommend-phase) 10%, var(--surface));
  font-size: 16px;
}
.recommend-tab.active .recommend-tab-icon {
  background: color-mix(in srgb, var(--recommend-phase) 16%, var(--surface));
}
.recommend-tab-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.recommend-tab-copy strong {
  overflow: hidden;
  color: inherit;
  font-size: 0.86rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recommend-tab-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recommend-tab-count {
  min-width: 25px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
}
.recommend-tab.active .recommend-tab-count {
  border-color: transparent;
  background: color-mix(in srgb, var(--recommend-phase) 12%, var(--surface));
  color: var(--recommend-phase);
}
.recommend-phase-content {
  --recommend-phase: #2563eb;
  min-height: 120px;
}
.recommend-phase-content[data-recommend-phase="solve"] {
  --recommend-phase: #d97706;
}
.recommend-phase-content[data-recommend-phase="validate"] {
  --recommend-phase: #7c3aed;
}
.recommend-phase-content .recommend-card {
  border-left: 3px solid var(--recommend-phase);
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(31, 61, 89, 0.055);
}
.recommend-phase-content .recommend-card-actions {
  justify-content: flex-end;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}
.recommend-phase-content .recommend-add-btn:not(.added) {
  border-color: color-mix(in srgb, var(--recommend-phase) 34%, var(--line));
  background: color-mix(in srgb, var(--recommend-phase) 7%, var(--surface));
  color: var(--recommend-phase);
}
.recommend-phase-content .recommend-add-btn:not(.added):hover {
  border-color: var(--recommend-phase);
  background: color-mix(in srgb, var(--recommend-phase) 12%, var(--surface));
}
.recommend-phase-empty {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 150px;
  padding: 28px 18px;
  border: 1px dashed color-mix(in srgb, var(--recommend-phase) 28%, var(--line));
  border-radius: 13px;
  background: color-mix(in srgb, var(--recommend-phase) 4%, var(--surface));
  text-align: center;
}
.recommend-phase-empty > span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: color-mix(in srgb, var(--recommend-phase) 12%, var(--surface));
  font-size: 20px;
}
.recommend-phase-empty strong {
  margin-top: 3px;
  color: var(--text);
  font-size: 0.9rem;
}
.recommend-phase-empty p {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}
.recommend-card-multiphase {
  font-size: 0.7rem;
  color: #7c3aed;
  font-weight: 600;
  background: #f5f3ff;
  padding: 2px 8px;
  border-radius: 999px;
}

@media (max-width: 720px) {
  .mode-chooser-cards {
    grid-template-columns: 1fr;
  }
  .mode-chooser-guide {
    align-items: flex-start;
  }
  .method-chat-head {
    flex-direction: column;
  }
  .paper-info-draft-head {
    flex-direction: column;
  }
  .method-chat-input-row {
    grid-template-columns: 1fr;
  }
  .method-chat-bubble {
    max-width: 100%;
  }
  .recommend-card-section {
    grid-template-columns: 1fr;
    gap: 3px;
  }
  .recommend-tabs,
  .method-tabs {
    gap: 4px;
    padding: 4px;
    border-radius: 12px;
  }
  .recommend-tab,
  .method-tab {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px;
    min-height: 48px;
    padding: 7px 8px;
    border-radius: 9px;
  }
  .recommend-tab-icon,
  .recommend-tab-copy small,
  .method-tab-icon,
  .method-tab-copy small {
    display: none;
  }
  .recommend-tab-copy strong,
  .method-tab-copy strong {
    font-size: 0.76rem;
    text-align: center;
  }
  .recommend-tab-count,
  .method-tab-count {
    min-width: 21px;
    padding: 2px 5px;
    font-size: 0.66rem;
  }
  .recommend-tab.active::after,
  .method-tab.active::after {
    right: 8px;
    left: 8px;
  }
}

/* Supplement button in method cards */
.supplement-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 12px;
  margin-top: 8px;
  min-width: auto !important;
  width: auto;
  height: auto !important;
  color: #e65100;
  border: 1.5px solid #ff9800;
  border-radius: 8px;
  background: #fff8e1;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.supplement-btn:hover {
  background: #ffecd2;
  border-color: #e65100;
  color: #bf360c;
}
.supplement-btn.supplemented {
  color: #1a7a1a;
  border-color: #66bb6a;
  background: #e8f5e9;
  cursor: default;
}

/* 方法候选池中的卡片始终勾选（视觉反馈） */
.method-zone-pool .method-card .method-check {
  accent-color: var(--primary);
}



/* ══ ppt.css ══ */

/* ppt — domain styles for ThesisMind */

/* ── PPT confirmation card ── */
.confirm-spec-card {
  margin-top: 12px;
  border: 1px solid #c4d8eb;
  border-radius: 14px;
  background: #f8fcff;
  overflow: hidden;
}
.confirm-spec-card h4 {
  margin: 0;
  padding: 14px 18px;
  background: #eaf3fb;
  font-size: 15px;
  color: #1a3c5e;
}
.confirm-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 10px 18px;
  font-size: 13px;
  color: #4a6a85;
  border-bottom: 1px solid #e7f0f8;
}
.confirm-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,.12);
  vertical-align: middle;
}
.confirm-slides-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.confirm-slides-table th {
  text-align: left;
  padding: 8px 14px;
  background: #eef5fb;
  color: #31526f;
  font-weight: 700;
}
.confirm-slides-table td {
  padding: 7px 14px;
  border-bottom: 1px solid #eef4f8;
  color: #2c4b65;
}
.confirm-slide-id {
  font-weight: 700;
  color: #6f879e;
  width: 40px;
}
.confirm-slide-hint {
  font-size: 11px;
  color: #809bb3;
}
.confirm-slide-desc {
  color: #54738c;
  font-size: 12px;
}
.confirm-actions {
  display: flex;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid #e7f0f8;
}

/* ── PPT confirm modal ─────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9998;
}
.modal-container {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: #fff; border-radius: 16px; box-shadow: 0 8px 40px rgba(0,0,0,.18);
  z-index: 9999; max-width: 820px; width: 95vw; max-height: 85vh; display: flex; flex-direction: column;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.modal-header h3 { margin: 0; font-size: 17px; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #999; padding: 4px 8px; border-radius: 6px; }
.modal-close:hover { background: #f0f0f0; color: #333; }
.modal-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.modal-footer { display: flex; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); justify-content: flex-end; }

.ppt-confirm-modal { max-width: 860px; }
.ppt-confirm-meta { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.ppt-confirm-meta strong { color: var(--text); }
.ppt-edit-table-wrap { max-height: 50vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.ppt-edit-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ppt-edit-table th { background: #f5f8fb; padding: 8px 10px; text-align: left; font-weight: 600; position: sticky; top: 0; }
.ppt-edit-table td { padding: 6px 8px; border-bottom: 1px solid #f0f0f0; }
.ppt-edit-row:hover td { background: #fafcfe; }
.ppt-edit-row.dragging td,
.desc-edit-row.dragging { opacity: 0.55; background: #eef4ff; }
.ppt-edit-id { color: var(--muted); font-weight: 600; text-align: center; width: 40px; }
.ppt-edit-order { display: flex; align-items: center; gap: 6px; }
.ppt-drag-handle { color: var(--muted); cursor: grab; font-weight: 700; line-height: 1; }
.ppt-row-move { display: flex; gap: 3px; }
.ppt-row-move .ghost { min-width: 26px !important; height: 26px !important; padding: 0 !important; font-size: 12px !important; }
.ppt-page-no-input { max-width: 58px; text-align: center; }
.ppt-show-page-cell label,
.ppt-show-page-inline { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.ppt-edit-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.ppt-edit-table input { width: 100%; border: 1px solid #dde; border-radius: 4px; padding: 5px 8px; font-size: 13px; }
.ppt-edit-table input:focus { border-color: var(--primary); outline: none; }
.ppt-edit-table select { width: 100%; border: 1px solid #dde; border-radius: 4px; padding: 5px 6px; font-size: 13px; background: #fff; }
.ppt-remove-slide { color: #d33 !important; padding: 4px 8px !important; font-size: 14px !important; }
.ppt-remove-slide:hover { background: #fdf0f0 !important; }
.desc-edit-toolbar { padding: 12px 24px 0; display: flex; justify-content: flex-end; }
.desc-edit-list { max-height: 60vh; overflow-y: auto; padding: 16px 24px; }
.desc-edit-row { margin-bottom: 16px; border-bottom: 1px solid #eee; padding-bottom: 12px; }
.desc-edit-head { display: grid; grid-template-columns: auto auto auto auto minmax(160px, 1fr) auto auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.desc-edit-head .ppt-edit-name { width: 100%; border: 1px solid #dde; border-radius: 4px; padding: 5px 8px; font-size: 13px; }
.ppt-page-no-label { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.desc-chapter { color: #888; font-size: 12px; white-space: nowrap; }
.desc-edit-text { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; resize: vertical; }

.chapter-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}

.chapter-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #f2f8ff;
  font-weight: 800;
}

.chapter-head input[data-kind="chapter"] {
  height: 36px;
  border: 0;
  background: transparent;
  font-weight: 800;
  flex: 1;
  min-width: 200px;
}

.chapter-title-input {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.chapter-title-input span {
  flex-shrink: 0;
  color: #31526f;
}

.writing-chapter-head {
  align-items: flex-start;
}

.writing-chapter-head strong {
  color: #000;
}

.writing-chapter-head small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

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

.chapter-tools button {
  height: 34px;
  border: 1px solid #bcd4ea;
  border-radius: 10px;
  color: #31526f;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.section-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px 86px auto;
  gap: 12px;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid #edf3f9;
}

.section-row:last-child {
  border-bottom: 0;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title.stacked {
  display: grid;
  align-items: start;
}

.section-title.stacked>div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title input {
  height: 38px;
  max-width: 80%;
}

.subsection-line {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 68px 62px auto;
  gap: 8px;
  align-items: center;
  margin: 4px 0 0 34px;
  color: #6f879e;
  font-size: 12px;
  line-height: 1.45;
}

.formula-toggle {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: #6f879e;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.formula-toggle input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: #3b82f6;
}

.subsection-line input:not(.word-input) {
  height: 30px;
  padding: 0 8px;
  font-size: 12px;
}

.word-chip {
  padding: 7px 8px;
  border: 1px solid #c8dbea;
  border-radius: 10px;
  color: #000;
  background: #f6fbff;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.word-input {
  width: 82px;
  height: 34px;
  padding: 0 4px;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

.word-input.small {
  width: 72px;
  height: 30px;
  font-size: 11px;
}

.word-summary,
.actual-chip {
  color: #000;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.word-summary {
  padding: 8px 10px;
  border: 1px solid #c8dbea;
  border-radius: 10px;
  background: #f6fbff;
}

.actual-chip {
  padding: 6px 8px;
  border-radius: 9px;
  background: #eef7ff;
}

.outline-mini-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.outline-mini-tools button {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid #bcd4ea;
  border-radius: 9px;
  color: #31526f;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.mini-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-actions button {
  height: 34px;
  min-width: 66px;
  border: 1px solid #bcd4ea;
  border-radius: 10px;
  color: #31526f;
  background: #fff;
  font-weight: 700;
}

.mini-actions button.saved {
  border-color: #77bf91;
  color: #187047;
  background: #eaf8f0;
}

.draft-save-state {
  color: #2f7d55;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.writing-section {
  border-bottom: 1px solid #edf3f9;
}

.writing-section .section-title span,
.writing-section .section-title strong {
  color: #000;
}

.writing-section:last-child {
  border-bottom: 0;
}

.chapter-workspace-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(90px, 1fr));
  gap: 10px;
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid #dbeaf7;
  border-radius: 14px;
  background: linear-gradient(135deg, #f7fbff, #f1f8ff);
}

.chapter-workspace-summary > div {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.chapter-workspace-summary strong {
  color: #16639a;
  font-size: 22px;
}

.chapter-workspace-summary span {
  color: #60788d;
  font-size: 12px;
}

.chapter-workbench-nav {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  margin-bottom: 10px;
  scrollbar-width: thin;
}

.chapter-workbench-tab {
  display: grid;
  min-width: 170px;
  gap: 3px;
  padding: 11px 13px;
  text-align: left;
  border: 1px solid #d8e5f1;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
}

.chapter-workbench-tab span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.chapter-workbench-tab small {
  color: var(--muted);
  font-size: 11px;
}

.chapter-workbench-tab.active {
  border-color: var(--primary);
  background: #edf6ff;
  box-shadow: 0 0 0 2px rgba(31, 123, 215, 0.1);
}

.imported-asset-gallery {
  margin: 0 14px 18px;
  padding: 14px;
  border: 1px solid #dceaf5;
  border-radius: 12px;
  background: #f8fbfe;
}

.imported-asset-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.imported-asset-head span,
.imported-asset-card figcaption {
  color: var(--muted);
  font-size: 12px;
}

.imported-asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.imported-asset-card {
  margin: 0;
  padding: 10px;
  border: 1px solid #e1e9f0;
  border-radius: 10px;
  background: #fff;
}

.imported-asset-card img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  margin-bottom: 8px;
  background: #fff;
}

.imported-asset-card .replace-document-image {
  width: 100%;
  margin-top: 6px;
}

.imported-formula-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 260px);
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 13px 15px;
  border: 1px solid #d9e4ed;
  border-radius: 10px;
  background: #fff;
}

.imported-formula-canvas {
  min-width: 0;
  overflow-x: auto;
  color: #172d3e;
  font-size: 18px;
  text-align: center;
}

.imported-formula-canvas math {
  max-width: 100%;
  font-family: "STIX Two Math", "Cambria Math", "Times New Roman", serif;
}

.imported-formula-canvas code {
  white-space: pre-wrap;
  color: #234f6e;
  font-family: "Cambria Math", "Times New Roman", serif;
}

.imported-formula-card figcaption {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.imported-formula-card figcaption small {
  color: #52758e;
}

.mixed-formula-block {
  display: grid;
  gap: 8px;
  overflow: hidden;
  border: 1px solid #c9dced;
  border-radius: 12px;
  background: #f8fbfe;
}

.mixed-formula-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  background: #eaf4fc;
  color: #245879;
  font-size: 12px;
  font-weight: 700;
}

.mixed-formula-label span {
  color: var(--muted);
  font-weight: 400;
}

.mixed-formula-block .imported-formula-card {
  margin: 0 10px 10px;
}

.mixed-chart-block {
  display: grid;
  gap: 8px;
  overflow: hidden;
  border: 1px solid #c8d9e7;
  border-radius: 12px;
  background: #f8fbfe;
}

.mixed-image-block {
  display: grid;
  gap: 10px;
  overflow: hidden;
  border: 1px solid #c8d9e7;
  border-radius: 12px;
  background: #f8fbfe;
}

.mixed-image-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  color: #245879;
  background: #eaf4fc;
  font-size: 12px;
  font-weight: 700;
}

.mixed-image-label span {
  color: var(--muted);
  font-weight: 400;
}

.mixed-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
  padding: 0 10px 10px;
}

.mixed-chart-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  color: #245879;
  background: #eaf4fc;
  font-size: 12px;
  font-weight: 700;
}

.mixed-chart-label span {
  color: var(--muted);
  font-weight: 400;
}

.imported-chart-card {
  display: grid;
  gap: 8px;
  margin: 0 10px 10px;
  padding: 12px;
  border: 1px solid #d9e4ed;
  border-radius: 10px;
  background: #fff;
}

.imported-chart-canvas {
  min-height: 180px;
  overflow-x: auto;
}

.imported-chart-canvas svg {
  display: block;
  width: 100%;
  min-width: 440px;
  max-height: 320px;
}

.imported-chart-canvas text {
  fill: #61798b;
  font-size: 11px;
}

.imported-chart-canvas .chart-axis {
  stroke: #aebfcb;
  stroke-width: 1;
}

.imported-chart-empty {
  display: grid;
  min-height: 150px;
  place-items: center;
  padding: 20px;
  border: 1px dashed #c5d5e2;
  border-radius: 9px;
  color: var(--muted);
  background: #fbfdff;
  text-align: center;
  font-size: 12px;
}

.imported-chart-card figcaption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.imported-chart-card figcaption strong {
  color: #2c4f68;
}

.mixed-draft-editor {
  display: grid;
  gap: 14px;
  margin-top: 10px;
}

.mixed-text-block {
  width: 100%;
  min-height: 150px;
  padding: 14px;
  border: 1px solid #cfddea;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  line-height: 1.8;
  resize: vertical;
}

.mixed-table-block {
  overflow: hidden;
  border: 1px solid #bfd5e8;
  border-radius: 12px;
  background: #fff;
}

.mixed-table-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  background: #edf6fd;
  color: #245879;
  font-size: 12px;
  font-weight: 700;
}

.mixed-table-label span {
  color: var(--muted);
  font-weight: 400;
}

.mixed-table-scroll {
  overflow-x: auto;
  padding: 10px;
}

.mixed-table-block table {
  width: 100%;
  border-collapse: collapse;
}

.mixed-table-block th,
.mixed-table-block td {
  min-width: 120px;
  padding: 9px 10px;
  border: 1px solid #ccd9e5;
  text-align: left;
  outline: none;
}

.mixed-table-block th {
  background: #f2f6fa;
}

.mixed-table-block [contenteditable="true"]:focus {
  background: #fff8dc;
  box-shadow: inset 0 0 0 2px #efc958;
}

.imported-asset-card.asset-load-failed {
  min-height: 90px;
  border-style: dashed;
}

.citation-chip {
  color: #705400;
  background: #fff8d8;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  white-space: nowrap;
}

.chapter-status-select {
  height: 34px;
  border: 1px solid #bcd4ea;
  border-radius: 9px;
  padding: 0 8px;
  color: #31526f;
  background: #fff;
  font-weight: 700;
}

.chapter-status-select.status-completed {
  color: #187047;
  border-color: #77bf91;
  background: #eaf8f0;
}

/* ============ 09 开题报告 ============ */
.proposal-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 32px;
  min-height: auto;
  overflow-y: auto;
  line-height: 1.8;
  color: var(--text);
}
.proposal-result:not(:empty) {
  min-height: 200px;
  max-height: 60vh;
}
.proposal-result[contenteditable]:focus {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
.proposal-revision {
  display: flex; gap: 8px; align-items: center;
  margin-top: 12px; padding: 10px 14px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px;
}
.proposal-revision input {
  flex: 1; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 13px; background: var(--surface);
}
.proposal-revision button {
  white-space: nowrap; height: 38px; padding: 0 16px;
}
#ppt_proposal .proposal-result:empty::after {
  content: "点击「生成PPT」按钮，系统将基于开题报告内容自动生成开题答辩PPT。";
  color: var(--muted);
  font-style: italic;
}
#ppt_midterm .proposal-result:empty::after {
  content: "点击「生成PPT」按钮，系统将基于论文已写作内容自动生成中期答辩PPT。";
  color: var(--muted);
  font-style: italic;
}
#ppt_defense .proposal-result:empty::after {
  content: "点击「生成PPT」按钮，系统将基于论文全文内容自动生成毕业答辩PPT。";
  color: var(--muted);
  font-style: italic;
}
.proposal-result h2 {
  font-size: 20px;
  margin: 28px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
  color: var(--text);
}
.proposal-result h3 {
  font-size: 16px;
  margin: 20px 0 8px;
  color: var(--text);
}
.proposal-result p {
  margin: 8px 0;
  text-indent: 2em;
}
.proposal-result ul, .proposal-result ol {
  margin: 8px 0 8px 20px;
}
.proposal-result li {
  margin-bottom: 4px;
}

/* ── PPT progress bar ── */
.ppt-progress-wrap {
  padding: 16px 20px;
}
.ppt-progress-phase {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.ppt-progress-bar-track {
  width: 100%;
  height: 8px;
  background: var(--hover-bg);
  border-radius: 4px;
  overflow: hidden;
}
.ppt-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #4ea5f3);
  border-radius: 4px;
  transition: width 0.5s ease;
  min-width: 2%;
}
.ppt-progress-pct {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  margin-top: 4px;
}
.ppt-progress-msg {
  font-size: 12px;
  color: var(--hint);
  margin-top: 6px;
}

/* ── PPT file upload ── */
.ppt-source-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.ppt-source-card {
  display: flex; flex-direction: column; padding: 10px 14px;
  border: 2px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer;
}
.ppt-source-card input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.ppt-source-card:has(input[type="radio"]:checked) { border-color: #1890ff; background: #e6f7ff; }
.ppt-source-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.ppt-source-desc { font-size: 11px; color: var(--muted); }

.ppt-upload-zone {
  border: 2px dashed var(--border); border-radius: 8px; padding: 14px 18px;
  margin-bottom: 14px; text-align: center; background: var(--surface2);
}
.ppt-upload-zone.drag-over { border-color: #3b82f6; background: #eff6ff; }
.ppt-upload-zone .ppt-upload-label { font-size: 13px; color: var(--muted); }
.ppt-upload-file {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 6px 10px; background: var(--surface); border-radius: 6px;
  border: 1px solid var(--border); font-size: 13px;
}
.ppt-upload-file[hidden] { display: none; }


/* ══ writing.css ══ */

/* writing — domain styles for ThesisMind */

/* ---- Mermaid Editor ---- */
.mermaid-toggle-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.mermaid-toggle-bar .ghost.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.mermaid-editor-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: #fafdff;
}

.mermaid-editor {
  width: 100%;
  min-height: 400px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: 13px;
  line-height: 1.7;
  resize: vertical;
  background: #1e2a3a;
  color: #cdd7e2;
}

.mermaid-preview {
  min-height: 400px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: auto;
  padding: 12px;
}

.mermaid-preview svg {
  max-width: 100%;
  height: auto;
}

.mermaid-error {
  grid-column: 1 / -1;
  color: #c44;
  padding: 8px;
  background: #fff0f0;
  border-radius: 8px;
  margin-top: 8px;
  font-size: 12px;
}

/* ---- Table Generator ---- */
.table-generator {
  margin-top: 36px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.table-gen-head { margin-bottom: 14px; }

.table-gen-head h3 {
  margin: 0 0 6px;
  font-size: 18px;
  color: var(--text);
}

.table-upload-area {
  border: 2px dashed var(--line-strong);
  border-radius: 14px;
  padding: 24px;
  text-align: center;
  background: #f8fcff;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.table-upload-area:hover { border-color: var(--primary); }

.table-upload-area.drag-over {
  border-color: var(--primary);
  background: #eef5ff;
}

.table-upload-icon { font-size: 36px; margin: 0 0 8px; }

.table-upload-label { font-size: 13px; color: var(--muted); margin: 0 0 10px; }

.table-desc {
  width: 100%;
  min-height: 80px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  resize: vertical;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.table-result { margin-top: 20px; }

.table-result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.table-result-head h4 { margin: 0; }

.table-result-content {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: #fff;
}

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

.table-result-content th,
.table-result-content td {
  padding: 8px 12px;
  border: 1px solid #d8dde3;
  text-align: left;
}

.table-result-content th {
  background: #f2f7fc;
  font-weight: 700;
  color: #18324d;
}

.table-result-content tr:nth-child(even) td {
  background: #fafcfe;
}

/* Table Modal */
.table-modal {
  max-width: 820px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.table-modal .modal-head { margin-bottom: 12px; flex-shrink: 0; }
.table-modal .form-grid { gap: 10px; margin-top: 0; }
.table-modal .field textarea { max-height: 120px; }
.table-modal > .field { flex-shrink: 0; }

.table-modal-result {
  margin-top: 12px;
  flex: 1 1 auto;
  overflow: auto;
  min-height: 0;
}

.table-modal-result .table-result-content {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.table-modal-result .table-result-content table {
  min-width: 100%;
  white-space: nowrap;
}

.table-modal-result .table-result-content th,
.table-modal-result .table-result-content td {
  padding: 6px 12px;
  font-size: 12px;
}

.table-modal .actions.split {
  margin-top: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 8px;
}

.file-name {
  display: inline-block;
  margin-left: 10px;
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
}

.word-select {
  min-width: 180px;
}

/* Outline toolbar */
.outline-workflow-tabs {
  position: sticky;
  z-index: 8;
  top: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 860px;
  margin: 4px auto 18px;
  padding: 6px;
  border: 1px solid #d6e3ef;
  border-radius: 14px;
  background: rgba(247, 251, 255, 0.96);
  box-shadow: 0 8px 24px rgba(44, 88, 122, 0.08);
  backdrop-filter: blur(12px);
}

.outline-workflow-tab {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  color: #6c8091;
  background: transparent;
  text-align: left;
}

.outline-workflow-tab > b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid #c8d7e4;
  border-radius: 50%;
  background: #fff;
}

.outline-workflow-tab > span {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.outline-workflow-tab strong {
  color: inherit;
  font-size: 13px;
}

.outline-workflow-tab small {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.outline-workflow-tab.active {
  color: #155f92;
  background: #e6f3fd;
  box-shadow: inset 0 0 0 1px #b8d8ee;
}

.outline-workflow-tab.active > b {
  border-color: #1f7bd7;
  color: #fff;
  background: #1f7bd7;
}

.outline-workflow-tab.complete:not(.active) {
  color: #287050;
}

.outline-workflow-tab.complete:not(.active) > b {
  border-color: #74b391;
  color: #287050;
  background: #e9f7ef;
}

.outline-workflow-tab.pending:not(.active) {
  color: #9a641d;
  background: #fff8e8;
}

.outline-workflow-tab:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.outline-tab-panel[hidden] {
  display: none !important;
}

.outline-draft-stage {
  max-width: 860px;
  margin: 0 auto;
}

.outline-draft-stage .paper-info-draft {
  margin-top: 0;
}

.outline-quick-prompts {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.outline-quick-prompts > span {
  color: var(--muted);
  font-size: 11px;
}

.outline-quick-prompts button {
  padding: 6px 9px;
  border-color: #cbddec;
  border-radius: 999px;
  color: #315f7f;
  background: #f6fbff;
  font-size: 11px;
}

.outline-quick-prompts button:hover {
  border-color: #77acd2;
  background: #eaf5fd;
}

.outline-edit-stage {
  max-width: 1040px;
  margin: 26px auto 0;
  padding-top: 22px;
  border-top: 1px solid #dce7f2;
}

.outline-edit-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.outline-edit-head h3 {
  margin: 0 0 5px;
}

.outline-edit-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.outline-toolbar {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}
.ot-main {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ot-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
}

.outline-draft-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e1e9f0;
}

.outline-draft-footer > span {
  margin-right: auto;
  color: var(--muted);
  font-size: 12px;
}
.outline-draft-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}
.outline-draft-back-chat {
  flex-shrink: 0;
}

.outline-apply-note {
  margin-bottom: 10px;
  padding: 9px 11px;
  border: 1px solid #c9dfef;
  border-radius: 9px;
  color: #42657d;
  background: #f4faff;
  font-size: 12px;
}

#outlineDraftPanel .paper-info-draft-head .primary,
#outlineDraftPanel .outline-draft-footer .primary {
  flex-shrink: 0;
  margin-left: auto;
}

.outline-empty-guide {
  display: grid;
  justify-items: center;
  gap: 7px;
  margin-top: 16px;
  padding: 38px 20px;
  border: 1px dashed #b9ccdc;
  border-radius: 14px;
  color: #5f7487;
  background: #f8fbfd;
  text-align: center;
}

.outline-empty-guide[hidden] {
  display: none;
}

.outline-empty-guide b {
  color: #334e63;
  font-size: 16px;
}

.outline-empty-guide button {
  margin-top: 5px;
}

.outline-next-step {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  margin-top: 22px;
  padding: 20px 22px;
  border: 1px solid #b8d9c6;
  border-radius: 16px;
  background:
    radial-gradient(circle at 92% 12%, rgba(55, 142, 92, 0.12), transparent 32%),
    linear-gradient(135deg, #f5fcf8, #f8fbff);
}

.outline-next-step.is-disabled {
  border-color: #d8e1e9;
  background: #f8fafc;
}

.outline-next-step-copy {
  display: grid;
  gap: 4px;
}

.outline-next-step-copy > span {
  color: #39805a;
  font-size: 11px;
  font-weight: 800;
}

.outline-next-step-copy strong {
  color: #25483a;
  font-size: 17px;
}

.outline-next-step-copy p {
  margin: 0;
  color: #63776d;
  font-size: 12px;
  line-height: 1.55;
}

.outline-next-step ol {
  display: flex;
  gap: 18px;
  margin: 0;
  padding: 0;
  color: #526b5f;
  font-size: 11px;
  list-style-position: inside;
  white-space: nowrap;
}

.outline-next-step .primary {
  min-height: 46px;
  padding-inline: 18px;
  box-shadow: 0 8px 20px rgba(37, 120, 75, 0.18);
  white-space: nowrap;
}

.outline-next-step .primary:disabled {
  box-shadow: none;
}

.citation-entry-guide {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 13px 16px;
  border: 1px solid #c8dded;
  border-radius: 12px;
  color: #31556f;
  background: #f5faff;
  font-size: 12px;
}

.citation-entry-guide b {
  white-space: nowrap;
}

.citation-entry-guide span {
  color: #60788d;
}
.word-select-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}
.word-select-inline span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
.word-select-inline select {
  width: 72px;
  height: 32px;
  border: none;
  background: transparent;
  font-weight: 700;
  color: var(--text);
  padding: 0 4px;
  cursor: pointer;
}
.word-select-inline select:focus {
  outline: none;
  box-shadow: none;
}

.outline-preview,
.writing-list {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

/* ---- Blind Review Risk Check ---- */
.risk-summary {
  margin: 12px 0;
}
.risk-summary-grid {
  display: flex;
  gap: 16px;
}
.risk-stat {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 20px;
  text-align: center;
  min-width: 80px;
}
.risk-stat strong {
  display: block;
  font-size: 1.6rem;
  color: var(--text);
}
.risk-stat small {
  color: var(--muted);
  font-size: 0.75rem;
}
.risk-stat.triggered strong { color: #d03801; }
.risk-stat.critical strong { color: #9b1c1c; }
.risk-stat.high strong { color: #d03801; }

.risk-results {
  margin-top: 16px;
}
.risk-chapter {
  margin-bottom: 20px;
}
.risk-chapter h3 {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.risk-card {
  background: var(--panel-2);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.risk-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.risk-sev {
  display: inline-block;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.risk-cat {
  font-size: 0.72rem;
  color: var(--muted);
  margin-left: auto;
}
.risk-evidence {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}
.risk-evidence ul {
  margin: 4px 0 0 16px;
}
.risk-evidence li {
  margin-bottom: 2px;
  font-style: italic;
}
.risk-detail {
  margin-top: 6px;
  font-size: 0.82rem;
}
.risk-detail summary {
  color: var(--text);
  cursor: pointer;
  font-weight: 500;
}
.risk-detail ul {
  margin: 4px 0 0 18px;
  color: var(--muted);
}
.risk-detail li {
  margin-bottom: 2px;
}

/* ---- AIGC Rate Check Two-Column ---- */
.aigc-layout {
  display: flex;
  gap: 0;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  min-height: 55vh;
  max-height: 65vh;
}
.aigc-overall {
  padding: 12px 16px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  border-radius: 10px 10px 0 0;
  font-size: 0.9rem;
  color: var(--text);
}
.aigc-overall strong { font-size: 1.1rem; }
.aigc-overall strong.risk-无 { color: #047857; }
.aigc-overall strong.risk-低 { color: #854d0e; }
.aigc-overall strong.risk-中 { color: #c2410c; }
.aigc-overall strong.risk-高 { color: #b91c1c; }
.aigc-text-panel {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  background: var(--panel);
}
.aigc-reason-panel {
  width: 320px;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 20px;
  background: var(--panel-2);
  border-left: 1px solid var(--line);
}
.aigc-reason-placeholder {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding-top: 60px;
  line-height: 1.8;
}
.aigc-mark-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: #f0c040;
  vertical-align: middle;
  margin: 0 4px;
}
.aigc-chapter {
  margin-bottom: 24px;
}
.aigc-chapter-title {
  font-size: 0.95rem;
  color: var(--text);
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.aigc-risk-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  vertical-align: middle;
}
.aigc-risk-badge.risk-无 { background: #ecfdf5; color: #047857; }
.aigc-risk-badge.risk-低 { background: #fef9c3; color: #854d0e; }
.aigc-risk-badge.risk-中 { background: #ffedd5; color: #9a3412; }
.aigc-risk-badge.risk-高 { background: #fee2e2; color: #991b1b; }
.aigc-chapter-text {
  font-size: 0.9rem;
  line-height: 2;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
}
.aigc-highlight {
  cursor: pointer;
  border-radius: 2px;
  padding: 1px 0;
  transition: background 0.15s;
}
.aigc-highlight.aigc-medium {
  background: #fef08a;
}
.aigc-highlight.aigc-high {
  background: #fca5a5;
}
.aigc-highlight.aigc-low {
  background: #fef9c3;
}
.aigc-highlight:hover {
  filter: brightness(0.9);
}
.aigc-highlight.selected {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  background: #fbbf24;
}
.aigc-reason-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}
.aigc-reason-card h5 {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: var(--text);
}
.aigc-reason-severity {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 8px;
}
.aigc-reason-detail {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 10px;
}
.aigc-reason-snippet {
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--panel-2);
  padding: 10px;
  border-radius: 6px;
  line-height: 1.6;
}

/* ============ Citation Maintenance Page ============ */
/* --- Merged Citation Library (generate + pending + library) --- */

.library-section {
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.library-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #f8fcff;
  border-bottom: 1px solid var(--line);
}

.lib-tabs {
  display: flex;
  gap: 0;
}

.lib-tab {
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: #f0f4f8;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.lib-tab:first-child {
  border-radius: 6px 0 0 6px;
}

.lib-tab:last-child {
  border-radius: 0 6px 6px 0;
  border-left: none;
}

.lib-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.lib-tab:not(.active):hover {
  background: #e8eef4;
}

.lib-count-inline {
  font-size: 12px;
  color: var(--muted);
  margin-left: 12px;
  flex: 1;
}

/* ── Citation check reminder modal ── */
.citation-check-modal {
  max-width: 520px;
  text-align: center;
  padding: 36px 32px 24px;
}

.ccm-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.ccm-icon.warn { filter: hue-rotate(-20deg) saturate(1.5); }
.ccm-icon.danger { filter: hue-rotate(-40deg) saturate(2); }

#ccmTitle {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 16px;
}

.ccm-body {
  text-align: left;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

.ccm-lead {
  margin: 0 0 12px;
  color: var(--text);
}

.ccm-lead strong {
  color: var(--danger);
}

.ccm-checklist {
  margin: 0 0 16px;
  padding-left: 20px;
}

.ccm-checklist li {
  margin-bottom: 6px;
}

.ccm-checklist li strong {
  color: var(--text);
}

.ccm-status {
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 6px;
  margin: 0;
}

.ccm-status.ok {
  background: #e8f5e9;
  color: #2e7d32;
}

.ccm-status.warn {
  background: #fff3e0;
  color: #e65100;
}

.ccm-actions {
  margin-top: 24px;
}

.ccm-actions button {
  min-width: 140px;
}

.library-head h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.library-head h3 span {
  font-weight: 400;
  font-size: 12px;
  color: var(--muted);
}

.library-actions {
  display: flex;
  gap: 8px;
}

.library-actions button {
  min-width: auto;
  height: 30px;
  padding: 0 12px;
  font-size: 11px;
}

.library-table-wrap {
  overflow: auto;
  max-height: 40vh;
  background: #fff;
}

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

.lib-col-type { width: 60px; }
.lib-col-year { width: 44px; }
.lib-col-status { width: 74px; }
.lib-col-actions { width: 96px; }
.lib-col-abstract { width: 180px; }

.lib-cell-abstract {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: #666;
  cursor: default;
  line-height: 1.5;
}

.abstract-expandable {
  cursor: pointer;
}

.abstract-expandable:hover {
  background: #f5f5f5;
}

.abstract-short { }

.abstract-full {
  display: none;
  white-space: normal;
}

.abstract-expandable:hover .abstract-short,
.abstract-expanded .abstract-short {
  display: none;
}

.abstract-expandable:hover .abstract-full,
.abstract-expanded .abstract-full {
  display: inline;
  white-space: normal;
}

.abstract-expandable:hover,
.abstract-expanded {
  white-space: normal;
  overflow: visible;
  max-width: 360px;
  background: #fffef5;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.abstract-more {
  color: #1890ff;
  font-size: 10px;
  white-space: nowrap;
}

.lib-actions-cell {
  display: flex;
  gap: 4px;
  align-items: center;
}

.lib-actions-cell button {
  height: 28px;
  padding: 0 8px;
  font-size: 11px;
  min-width: auto;
  white-space: nowrap;
}

.lib-actions-cell .lib-add-btn { min-width: 42px; }
.lib-actions-cell .lib-edit-btn { min-width: 32px; color: var(--muted); }
.lib-actions-cell .checklist-remove-btn { color: #c44; min-width: 36px; }

.lib-added-label {
  display: inline-block;
  padding: 0 8px;
  font-size: 11px;
  color: #2d9a68;
  white-space: nowrap;
}

.library-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.library-table th {
  padding: 8px 6px;
  background: #f2f8ff;
  border-bottom: 2px solid var(--line);
  color: #41637f;
  font-weight: 700;
  font-size: 11px;
  text-align: left;
  white-space: nowrap;
}

.library-table td {
  padding: 6px;
  border-bottom: 1px solid #edf3f9;
  vertical-align: middle;
}

.library-table tbody tr:hover { background: #fafeff; }

.lib-cell-text {
  max-width: 500px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
  line-height: 1.5;
}

.lib-empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 32px !important;
}

.lib-status-ok { color: #2d9a68; font-weight: 600; font-size: 12px; }
.lib-status-warn { color: #d97706; font-weight: 600; font-size: 12px; }
.lib-status-pend { color: var(--muted); font-size: 12px; }

.library-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ---- Library filter toolbar ---- */

.lib-toolbar {
  background: #f8fcff;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
}

.lib-toolbar-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.lib-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lib-field span {
  font-size: 10px;
  font-weight: 600;
  color: #41637f;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lib-field select,
.lib-field input {
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  font-size: 12px;
  background: #fff;
  color: var(--text);
}

.lib-field select { min-width: 140px; }
.lib-field input { min-width: 160px; }

.lib-field-sm select,
.lib-field-sm input {
  min-width: 80px;
  width: 90px;
}

.lib-method-wrap {
  display: flex;
  gap: 4px;
  align-items: center;
}

.lib-method-wrap input { flex: 1; min-width: 180px; }

#libSearch {
  height: 30px;
  padding: 0 20px;
  font-size: 12px;
  white-space: nowrap;
}

/* Keep cm-edit-modal styles (used for editing library entries) */
.cm-edit-modal { max-width: 640px; }
.cm-edit-modal .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}

.cm-edit-modal .form-grid .wide {
  grid-column: 1 / -1;
}

/* Citation selector in writing sections */
.cite-box {
  margin: 4px 0 8px;
  border: 1px solid #d8dde3;
  border-radius: 4px;
  font-size: 12px;
}
.cite-head {
  padding: 4px 10px;
  color: #5a7a9a;
  background: #f6f9fc;
  font-size: 12px;
  border-bottom: 1px solid #eef2f6;
}
.cite-head small { color: #999; font-weight: normal; }
.cite-grid {
  padding: 4px 10px;
  max-height: 200px;
  overflow-y: auto;
}
.cite-row {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  padding: 1px 0;
}
.cite-row input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
}
.cite-text {
  font-size: 11px;
  color: #333;
  line-height: 1.6;
  word-break: break-all;
}

/* ---------- Generation progress bar ---------- */
.gen-progress {
  margin: 8px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.gen-progress .gen-bar-track {
  flex: 1;
  height: 6px;
  background: #e0e8f0;
  border-radius: 3px;
  overflow: hidden;
}
.gen-progress .gen-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  border-radius: 3px;
  width: 0%;
  transition: width 0.4s ease;
}
.gen-progress .gen-status-text {
  font-size: 12px;
  color: #5a7a9a;
  white-space: nowrap;
}

/* ---------- Citation outline tree (citations page) ---------- */
.citation-outline {
  margin-bottom: 16px;
}
.cite-outline-chapter {
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--panel-2);
  border-radius: 6px;
  border: 1px solid var(--line);
}
.cite-outline-chapter h3 {
  font-size: 14px;
  color: var(--primary-strong);
  margin: 0 0 8px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.cite-outline-section {
  margin-bottom: 2px;
}
.cite-outline-section-head {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 2px 8px;
}
.cite-outline-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 24px;
  border-radius: 4px;
  font-size: 12px;
  transition: background 0.15s;
}
.cite-outline-row:hover {
  background: rgba(31, 123, 215, 0.06);
}
.cite-outline-row.active {
  background: #e8f0fe;
  border-left: 3px solid var(--primary);
  padding-left: 21px;
}
.cite-outline-section-row {
  padding-left: 8px;
  font-weight: 600;
}
.cite-outline-section-row.active {
  background: #e8f0fe;
  border-left: 3px solid var(--primary);
  padding-left: 5px;
}
.cite-outline-num {
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 11px;
  color: var(--muted);
  min-width: 40px;
}
.cite-outline-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.cite-outline-count {
  color: var(--green);
  font-size: 11px;
  min-width: 52px;
  text-align: right;
  font-weight: 500;
}
.cite-manage-btn {
  font-size: 11px !important;
  padding: 2px 10px !important;
  min-width: auto !important;
  height: 26px !important;
  border: 1px solid var(--primary) !important;
  color: var(--primary) !important;
  border-radius: 3px !important;
}
.cite-manage-btn:hover {
  background: var(--primary) !important;
  color: #fff !important;
}

/* ---------- Per-subsection citation panel ---------- */
.citation-subsection-panel {
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  margin-bottom: 16px;
  background: var(--panel);
  overflow: hidden;
}
.citation-subsection-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.citation-subsection-head h3 {
  font-size: 13px;
  margin: 0;
  color: var(--primary-strong);
}
.citation-subsection-panel .library-section {
  margin: 0;
  border: none;
  border-bottom: 1px solid var(--line);
}
.citation-subsection-panel .library-section:last-of-type {
  border-bottom: none;
}

.citation-source-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #f7fbff;
}

.citation-source-tab {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  align-items: center;
  min-height: 66px;
  padding: 10px 14px;
  border: 1px solid #c9dced;
  border-radius: 10px;
  background: #fff;
  color: #45647e;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

.citation-source-tab > span {
  grid-row: 1 / span 2;
  font-size: 20px;
}

.citation-source-tab b {
  font-size: 13px;
}

.citation-source-tab small {
  color: var(--muted);
  font-size: 11px;
}

.citation-source-tab:hover {
  border-color: #86bce6;
  background: #fafdff;
}

.citation-source-tab.active {
  border-color: var(--primary);
  background: #edf7ff;
  box-shadow: 0 0 0 2px rgba(31, 132, 214, 0.1);
  color: var(--primary-strong);
}

.hunter-tab-desc {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.hunter-tab-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.hunter-tab-actions input {
  width: min(360px, 34vw);
  min-width: 220px;
}

.hunter-tab-actions .primary {
  min-width: 96px;
  white-space: nowrap;
}

.hunter-result-cards {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  background: #f8fcff;
}

.hunter-result-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.hunter-result-main {
  min-width: 0;
  flex: 1;
}

.hunter-result-main strong,
.hunter-result-main p {
  display: block;
  margin: 0;
  overflow-wrap: anywhere;
  white-space: normal;
  word-break: break-word;
}

.hunter-result-main strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

.hunter-result-main p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.hunter-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.hunter-result-meta span {
  padding: 2px 7px;
  border-radius: 999px;
  background: #edf7ff;
  color: #41637f;
  font-size: 10px;
}

.hunter-result-action {
  flex: 0 0 auto;
  padding-top: 2px;
}

.hunter-result-action .primary {
  min-width: 96px;
  white-space: nowrap;
}

#hunterResultsSection .hunter-result-table {
  display: none;
}

@media (max-width: 760px) {
  .citation-source-tabs {
    grid-template-columns: 1fr;
  }

  .hunter-tab-actions,
  .hunter-result-card {
    align-items: stretch;
    flex-direction: column;
  }

  .hunter-tab-actions input {
    width: 100%;
    min-width: 0;
  }

  .hunter-tab-actions .primary,
  .hunter-result-action .primary {
    width: 100%;
  }
}

/* ── Blind review file upload ── */
.blind-upload-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 16px;
  text-align: center;
  background: var(--surface2);
  transition: border-color 0.2s, background 0.2s;
}
.blind-upload-zone.drag-over {
  border-color: #3b82f6;
  background: #eff6ff;
}
.blind-upload-zone .blind-upload-label {
  font-size: 14px;
  color: var(--muted);
}
.blind-upload-zone .blind-upload-icon {
  font-size: 28px;
  display: block;
  margin-bottom: 6px;
}
.blind-upload-zone .blind-upload-file {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 13px;
}
.blind-upload-zone .blind-upload-file span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.blind-upload-zone .blind-upload-file button {
  flex-shrink: 0;
  padding: 2px 6px;
  font-size: 12px;
  line-height: 1;
}
.blind-upload-zone #blindUploadScan {
  margin-top: 12px;
}

/* ── Figure generator ── */
.head-actions { display: flex; align-items: center; gap: 10px; }
.quota-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background: #e8f5e8;
  color: #2d7a3e;
  border: 1px solid #b8e0b8;
}
.quota-badge.warning { background: #fffbe6; color: #ad6800; border-color: #ffe58f; }
.quota-badge.exhausted { background: #fff2f0; color: #cf1322; border-color: #ffccc7; }
.quota-badge.unlimited { background: #e6f7ff; color: #0050b3; border-color: #91d5ff; }

.figure-generator { display: flex; flex-direction: column; gap: 14px; }
.ppt-style-controls {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin: 14px 0;
}
.ppt-style-controls label { display: flex; flex-direction: column; gap: 6px; }
.ppt-style-controls span { font-size: 12px; color: var(--muted); }
.ppt-style-palette { display: flex; gap: 6px; margin-top: 4px; }
.ppt-swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.ppt-style-controls select {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.ppt-template-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.ppt-template-picker-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.ppt-template-picker-head small {
  color: var(--muted);
  font-size: 11px;
}
.ppt-template-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
}
.ppt-template-upload-status {
  color: var(--muted);
  font-size: 12px;
}
.ppt-template-grid {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.ppt-template-grid::-webkit-scrollbar { height: 4px; }
.ppt-template-grid::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }
.ppt-template-card {
  flex: 0 0 auto;
  width: 132px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ppt-template-card:hover { border-color: #91d5ff; }
.ppt-template-card.selected {
  border-color: #1890ff;
  box-shadow: 0 0 0 2px rgba(24,144,255,0.15);
}
.ppt-template-preview {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
  margin-bottom: 6px;
}
.ppt-template-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.ppt-template-preview-empty {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  color: var(--muted); font-size: 11px; font-weight: 600;
}
.ppt-template-info strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Template preview modal ── */
.ppt-preview-modal { max-width: 860px; width: min(860px, calc(100vw - 60px)); overflow-y: auto; max-height: 85vh; }
.ppt-preview-modal .modal-head { margin-bottom: 12px; flex-shrink: 0; }
.ppt-preview-gallery { display: flex; flex-direction: column; gap: 14px; }
.ppt-preview-slide { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.ppt-preview-slide { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.ppt-preview-slide-head { display: flex; justify-content: space-between; padding: 8px 12px; background: var(--surface2); border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 600; }
.ppt-preview-slide img { display: block; width: 100%; height: auto; background: #fff; }
.visual-generator-tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0 12px;
  border-bottom: 1px solid var(--border);
}
.visual-generator-tab {
  padding: 9px 16px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
}
.visual-generator-tab.active {
  border-bottom-color: var(--primary);
  color: var(--primary);
}
.visual-table-mode {
  margin-top: 0;
  border-top: 0;
  padding-top: 6px;
}
.figure-type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.figure-type-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.figure-type-card:hover { border-color: #91d5ff; background: #f0f9ff; }
.figure-type-card input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.figure-type-card:has(input[type="radio"]:checked) {
  border-color: #1890ff;
  background: #e6f7ff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(24,144,255,0.15);
}
.figure-type-icon { font-size: 28px; line-height: 1; margin-bottom: 6px; }
.figure-type-name { font-weight: 600; font-size: 14px; }
.figure-type-desc { font-size: 11px; color: var(--muted); margin-top: 2px; }

.figure-desc {
  width: 100%;
  min-height: 110px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  resize: vertical;
  font-family: inherit;
}
.figure-actions-top, .figure-actions-bottom {
  display: flex;
  align-items: center;
  gap: 12px;
}
.figure-result {
  margin-top: 6px;
  padding: 16px;
  background: var(--surface2);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.figure-result img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 14px;
  background: white;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.figure-spec-detail {
  margin-top: 12px;
  font-size: 12px;
}
.figure-spec-detail summary {
  cursor: pointer;
  color: var(--muted);
  padding: 4px 0;
}
.figure-spec-detail pre {
  background: var(--surface);
  padding: 10px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 11px;
  border: 1px solid var(--border);
}
/* ── Peer Review ── */
.peer-review-source {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.peer-source-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}
.peer-source-card input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.peer-source-card:has(input[type="radio"]:checked) {
  border-color: #1890ff;
  background: #e6f7ff;
}
.peer-source-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.peer-source-desc { font-size: 12px; color: var(--muted); }

.peer-upload-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 18px 24px;
  margin-bottom: 14px;
  text-align: center;
  background: var(--surface2);
}
.peer-upload-zone.drag-over { border-color: #3b82f6; background: #eff6ff; }
.peer-upload-label { font-size: 14px; color: var(--muted); }
.peer-upload-icon { font-size: 28px; display: block; margin-bottom: 6px; }
.peer-upload-file {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 12px; background: var(--surface); border-radius: 6px;
  border: 1px solid var(--border); font-size: 13px;
}

.peer-actions { display: flex; align-items: center; gap: 12px; margin: 8px 0 14px; }

.peer-result { margin-top: 14px; display: flex; flex-direction: column; gap: 14px; }

.peer-verdict-card {
  padding: 18px 22px;
  border-radius: 10px;
  text-align: center;
  background: linear-gradient(135deg, #e8f5e8 0%, #d4ecd4 100%);
  border: 1px solid #b8e0b8;
}
.peer-verdict-card.verdict-Minor { background: linear-gradient(135deg, #fffbe6 0%, #fff1b8 100%); border-color: #ffe58f; }
.peer-verdict-card.verdict-Major { background: linear-gradient(135deg, #fff7e6 0%, #ffd591 100%); border-color: #ffbf85; }
.peer-verdict-card.verdict-Reject { background: linear-gradient(135deg, #fff2f0 0%, #ffccc7 100%); border-color: #ffaaa3; }
.peer-verdict-label {
  display: inline-block; padding: 4px 14px;
  border-radius: 12px; background: white;
  font-weight: 700; font-size: 14px; margin-bottom: 6px;
}
.peer-verdict-score { font-size: 36px; font-weight: 700; margin: 2px 0; }
.peer-verdict-desc { font-size: 12px; color: var(--muted); }

.peer-dimensions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.peer-dim-card {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.peer-dim-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.peer-dim-name { font-weight: 600; font-size: 13px; }
.peer-dim-weight { font-size: 11px; color: var(--muted); }
.peer-dim-score {
  font-size: 24px; font-weight: 700; margin-right: 6px;
}
.peer-dim-score.high { color: #2d7a3e; }
.peer-dim-score.med { color: #ad6800; }
.peer-dim-score.low { color: #cf1322; }
.peer-dim-comment { font-size: 12px; color: #333; line-height: 1.5; }

.peer-strengths-weaknesses {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.peer-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
}
.peer-block h4 { margin: 0 0 8px; font-size: 14px; }
.peer-strengths { border-left: 4px solid #2d7a3e; }
.peer-weaknesses { border-left: 4px solid #cf1322; }
.peer-priorities { border-left: 4px solid #1890ff; }
.peer-block ul, .peer-block ol { margin: 0; padding-left: 22px; }
.peer-block li { font-size: 13px; line-height: 1.6; margin-bottom: 4px; }

.peer-section-item {
  padding: 10px 12px;
  background: var(--surface2);
  border-radius: 6px;
  margin-bottom: 8px;
}
.peer-section-title { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.peer-section-issues, .peer-section-suggestions { font-size: 12px; margin: 4px 0; }
.peer-section-issues strong { color: #cf1322; }
.peer-section-suggestions strong { color: #2d7a3e; }

/* ── Revision Coach ── */
#revisionInput {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  min-height: 180px;
}
.revision-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }

.revision-result { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.revision-summary-card {
  padding: 14px 18px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f0ff 100%);
  border: 1px solid #91d5ff;
  border-radius: 8px;
}
.revision-summary-card .verdict-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  background: white;
  margin-right: 8px;
}
.revision-filters {
  display: flex; gap: 14px; align-items: center;
  padding: 8px 0;
  font-size: 13px;
}
.revision-filters label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.revision-filters .ghost { margin-left: auto; }

.revision-comment-card {
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
}
.revision-comment-card.cat-Major { border-left-color: #cf1322; }
.revision-comment-card.cat-Minor { border-left-color: #ad6800; }
.revision-comment-card.cat-Comment { border-left-color: #1890ff; }
.revision-comment-head {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 6px; margin-bottom: 6px;
}
.revision-tag {
  display: inline-block; padding: 2px 8px;
  border-radius: 10px; font-size: 11px; font-weight: 600;
}
.revision-tag.cat-Major { background: #fff2f0; color: #cf1322; }
.revision-tag.cat-Minor { background: #fff7e6; color: #ad6800; }
.revision-tag.cat-Comment { background: #e6f7ff; color: #0050b3; }
.revision-tag.priority-P0 { background: #fff2f0; color: #cf1322; }
.revision-tag.priority-P1 { background: #fffbe6; color: #ad6800; }
.revision-tag.priority-P2 { background: #f0f9ff; color: #0050b3; }
.revision-tag.section { background: #f0f0f0; color: #555; }
.revision-tag.effort { background: #e6fff0; color: #2d7a3e; }
.revision-comment-summary { font-size: 14px; font-weight: 600; margin: 4px 0 6px; }
.revision-comment-raw {
  font-size: 12px; color: var(--muted);
  font-style: italic; margin-bottom: 8px;
  padding: 4px 8px; background: var(--surface2);
  border-radius: 4px;
}
.revision-comment-actions { font-size: 13px; margin: 4px 0; }
.revision-comment-actions ol { margin: 4px 0; padding-left: 22px; }
.revision-comment-actions li { line-height: 1.6; margin-bottom: 2px; }

/* ── AIGC upload row (shared by check/reduce) ── */
.aigc-source-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.aigc-source-card {
  position: relative;
  display: flex; flex-direction: column;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}
.aigc-source-card input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.aigc-source-card:has(input[type="radio"]:checked) {
  border-color: #1890ff;
  background: #e6f7ff;
}
.aigc-source-title { font-weight: 600; font-size: 13px; margin-bottom: 3px; }
.aigc-source-desc { font-size: 11px; color: var(--muted); }

.aigc-upload-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 14px;
  text-align: center;
  background: var(--surface2);
}
.aigc-upload-zone.drag-over { border-color: #3b82f6; background: #eff6ff; }
.aigc-upload-zone .aigc-upload-label { font-size: 13px; color: var(--muted); }
.aigc-upload-zone .aigc-upload-icon { font-size: 22px; display: block; margin-bottom: 4px; }
.aigc-upload-zone .aigc-upload-file {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 6px 10px; background: var(--surface); border-radius: 6px;
  border: 1px solid var(--border); font-size: 13px;
}


/* ══ legacy.css ══ */

/* legacy — domain styles for ThesisMind */

/* ── License badge in sidebar ── */
.license-badge {
  margin-top: auto;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 12px;
}
.license-badge:hover {
  background: var(--panel);
}
.license-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.license-dot.active { background: #10b981; }
.license-dot.trial { background: #f59e0b; }
.license-dot.expired { background: #ef4444; }
.license-dot.none { background: #94a3b8; }

.license-label {
  color: #5a7a9a;
  flex: 1;
}
.license-days {
  color: #3b6080;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ── License page ── */
.license-status-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 32px;
  text-align: center;
  margin-bottom: 24px;
}
.license-tier-icon {
  font-size: 48px;
  margin-bottom: 8px;
}
.license-tier-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}
.license-tier-desc {
  font-size: 13px;
  color: #5a7a9a;
  margin-bottom: 12px;
}
.license-meta {
  font-size: 12px;
  color: #7a9ab8;
  line-height: 1.7;
}
.license-meta .days-warning {
  color: #f59e0b;
  font-weight: 600;
}
.license-meta .days-critical {
  color: #ef4444;
  font-weight: 600;
}

.license-actions {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.license-actions h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 6px;
}
.license-input-row {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.license-code-input {
  flex: 1;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: monospace;
  font-size: 13px;
  background: var(--panel);
  color: var(--text);
}
.license-code-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

/* ── Inline license activation (setup page) ── */
.license-inline {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 18px;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.license-inline-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.license-inline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}
.license-inline-dot.active { background: #10b981; }
.license-inline-dot.trial { background: #f59e0b; }
.license-inline-dot.expired { background: #ef4444; }
.license-inline-label {
  font-weight: 600;
  color: var(--text);
}
.license-inline-days {
  color: #7a9ab8;
  margin-left: auto;
}
.license-inline-activate {
  display: flex;
  gap: 8px;
  align-items: center;
}
.license-inline-activate[hidden] { display: none; }
.license-code-input.compact {
  flex: 1;
  padding: 7px 10px;
  font-size: 11px;
}
.license-inline-trial {
  display: flex;
  gap: 8px;
  align-items: center;
}
.license-inline-trial[hidden] { display: none; }

/* ── Menu gating ── */
.step.gated {
  opacity: 0.45;
  cursor: not-allowed;
  position: relative;
}
.step.gated::after {
  content: "🔒";
  font-size: 10px;
  margin-left: 4px;
}
.step.sub-item.gated::after {
  content: "🔒";
  font-size: 10px;
  margin-left: 4px;
}

/* ── License upgrade cards ── */
.license-upgrade-section {
  margin-top: 8px;
}
.license-upgrade-section h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 10px;
}
.upgrade-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.upgrade-card {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
}
.upgrade-card:hover {
  border-color: var(--primary);
}
.upgrade-tier {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-strong);
  margin-bottom: 4px;
}
.upgrade-price {
  font-size: 14px;
  color: #f59e0b;
  font-weight: 600;
  margin-bottom: 10px;
}
.upgrade-features {
  list-style: none;
  padding: 0;
  margin: 0 0 10px;
  text-align: left;
  font-size: 13px;
  color: var(--text-secondary);
}
.upgrade-features li {
  padding: 3px 0;
}
.upgrade-features li::before {
  content: "✓ ";
  color: #10b981;
  font-weight: 700;
}
.upgrade-hint {
  font-size: 12px;
  color: var(--hint);
  margin: 0;
}

/* ═══════════════════════════════════════════
   Welcome / Landing Page
   ═══════════════════════════════════════════ */

.brand {
  cursor: pointer;
  transition: opacity 0.2s;
}
.brand:hover {
  opacity: 0.78;
}

.welcome-hero {
  padding: 68px 32px 42px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(117, 181, 241, 0.16), transparent 38%),
    linear-gradient(180deg, rgba(245, 251, 255, 0.78), rgba(250, 253, 255, 0));
}

.welcome-badge {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid #c4ddf4;
  background: rgba(245, 251, 255, 0.92);
  color: #3472aa;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  margin-bottom: 22px;
}

.welcome-title {
  margin: 0;
  color: #172f45;
  font-size: clamp(34px, 4vw, 54px);
  font-weight: 800;
  letter-spacing: -1.8px;
  line-height: 1.2;
}
.welcome-title strong {
  color: var(--primary-strong);
}

.welcome-subtitle {
  max-width: 720px;
  margin: 20px auto 0;
  color: #64788b;
  font-size: 16px;
  line-height: 1.8;
}
.welcome-trial-note {
  margin: 13px 0 0;
  color: #8495a5;
  font-size: 12px;
}

/* ── Welcome API Key 状态引导 ── */
.welcome-apikey-status {
  max-width: 520px;
  margin: 22px auto 0;
  border-radius: 10px;
  padding: 14px 20px;
  font-size: 14px;
  animation: welcomeApikeyFadeIn 0.4s ease;
}
@keyframes welcomeApikeyFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.welcome-apikey-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.welcome-apikey-status.no-key {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
}
.welcome-apikey-status.has-key {
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  color: #065f46;
}
.welcome-apikey-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.welcome-apikey-text {
  flex: 1;
  min-width: 200px;
  text-align: left;
  line-height: 1.5;
}
.welcome-apikey-btn {
  flex-shrink: 0;
  font-size: 13px;
  padding: 6px 16px;
  border-radius: 6px;
}

.welcome-product-preview {
  max-width: 1060px;
  margin: 4px auto 0;
  overflow: hidden;
  border: 1px solid #bfd5e8;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(48, 93, 134, 0.17);
}
.preview-browser-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 42px;
  padding: 0 16px;
  border-bottom: 1px solid #d9e7f2;
  background: #f7fbfe;
  color: #7790a6;
  font-size: 11px;
}
.preview-browser-bar b {
  margin-left: auto;
  color: #4f9a73;
  font-size: 11px;
  font-weight: 700;
}
.preview-window-dots {
  display: flex;
  gap: 5px;
}
.preview-window-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #bed2e3;
}
.preview-workspace {
  display: grid;
  grid-template-columns: 174px minmax(0, 1fr) 212px;
  min-height: 370px;
}
.preview-nav {
  padding: 24px 14px;
  border-right: 1px solid #e1ebf3;
  background: #f8fbfd;
}
.preview-nav p,
.preview-score p {
  margin: 0 0 14px;
  color: #8497a8;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
}
.preview-nav div {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding: 9px 8px;
  border-radius: 8px;
  color: #6e8396;
  font-size: 11px;
}
.preview-nav div.is-active {
  background: #eaf4fd;
  color: #286da9;
  font-weight: 700;
}
.preview-nav span {
  color: #9aabba;
  font-size: 10px;
}
.preview-document {
  padding: 28px 26px;
}
.preview-document-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.preview-document-head p {
  margin: 0 0 7px;
  color: #7690a7;
  font-size: 11px;
}
.preview-document-head h3 {
  margin: 0;
  color: #294a67;
  font-size: 18px;
}
.preview-document-head > span {
  padding: 5px 8px;
  border-radius: 999px;
  background: #edf6ff;
  color: #3478b4;
  font-size: 11px;
}
.preview-outline {
  margin-top: 26px;
}
.preview-outline div {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 8px;
  border-bottom: 1px solid #edf2f6;
  color: #647c91;
  font-size: 12px;
}
.preview-outline div.is-current {
  border-radius: 8px;
  border-bottom-color: transparent;
  background: #f3f9ff;
  color: #276da8;
}
.preview-outline i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d2dfe9;
}
.preview-outline i.is-blue,
.preview-outline .is-current i {
  background: #5b9ed9;
}
.preview-outline b {
  color: #96a7b6;
  font-size: 10px;
  font-weight: 600;
}
.preview-editor-lines {
  display: grid;
  gap: 8px;
  margin-top: 25px;
}
.preview-editor-lines i {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: #edf2f6;
}
.preview-editor-lines i:nth-child(2) { width: 92%; }
.preview-editor-lines i:nth-child(3) { width: 96%; }
.preview-editor-lines i:nth-child(4) { width: 72%; }
.preview-editor-lines i:nth-child(5) { width: 84%; }
.preview-insights {
  padding: 25px 17px;
  border-left: 1px solid #e1ebf3;
  background: #fbfdff;
}
.preview-score strong {
  display: block;
  color: #286ea9;
  font-size: 38px;
  line-height: 1;
}
.preview-score strong span {
  font-size: 18px;
}
.preview-score small,
.preview-source-count small {
  display: block;
  margin-top: 7px;
  color: #8a9bab;
  font-size: 11px;
}
.preview-insight-list {
  margin-top: 25px;
  padding-top: 13px;
  border-top: 1px solid #e4edf4;
}
.preview-insight-list p {
  margin: 9px 0;
  color: #6b8194;
  font-size: 11px;
}
.preview-insight-list span {
  display: inline-grid;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  place-items: center;
  border-radius: 50%;
  background: #e6f5ed;
  color: #388b60;
  font-size: 10px;
  font-weight: 800;
}
.preview-insight-list p:last-child span {
  background: #fff3dc;
  color: #ad751d;
}
.preview-source-count {
  margin-top: 24px;
  padding: 13px;
  border-radius: 10px;
  background: #f0f7fd;
}
.preview-source-count span {
  display: block;
  color: #6a849b;
  font-size: 11px;
}
.preview-source-count strong {
  display: block;
  margin-top: 5px;
  color: #2e6fa7;
  font-size: 24px;
}

.welcome-section-head {
  margin: 74px 8px 22px;
  text-align: center;
}
.welcome-section-head p {
  margin: 0 0 6px;
  color: #4785bd;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
}
.welcome-section-head h3 {
  margin: 0;
  color: #243e55;
  font-size: 25px;
}

.welcome-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 0 8px;
}

.wfc-card {
  padding: 26px 24px;
  border: 1px solid #d7e4ee;
  border-radius: 12px;
  background: #fff;
  transition: transform 0.2s, box-shadow 0.2s;
}
.wfc-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(24, 50, 77, 0.08);
  border-color: #add0ee;
}
.wfc-number {
  display: inline-grid;
  width: 34px;
  height: 34px;
  margin-bottom: 30px;
  place-items: center;
  border-radius: 9px;
  background: #eef6fd;
  color: #4d8cc4;
  font-size: 11px;
  font-weight: 800;
}
.wfc-card h3 {
  margin: 0 0 9px;
  color: #29465e;
  font-size: 16px;
  font-weight: 700;
}
.wfc-card p {
  margin: 0;
  color: #728494;
  font-size: 13px;
  line-height: 1.8;
}

.welcome-toolbox {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(420px, 1.1fr);
  gap: 46px;
  align-items: center;
  margin: 78px 8px 0;
  padding: 38px 42px;
  border: 1px solid #d4e3ef;
  border-radius: 16px;
  background: linear-gradient(135deg, #f4f9fd, #fbfdff);
}
.welcome-toolbox-copy p {
  margin: 0 0 7px;
  color: #4785bd;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
}
.welcome-toolbox-copy h3 {
  margin: 0;
  color: #27445d;
  font-size: 24px;
  line-height: 1.45;
}
.welcome-toolbox-copy span {
  display: block;
  margin-top: 12px;
  color: #728494;
  font-size: 13px;
  line-height: 1.8;
}
.welcome-toolbox-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.welcome-toolbox-grid div {
  padding: 17px 16px;
  border: 1px solid #dbe8f1;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.8);
}
.welcome-toolbox-grid b,
.welcome-toolbox-grid span {
  display: block;
}
.welcome-toolbox-grid b {
  color: #346d9e;
  font-size: 14px;
}
.welcome-toolbox-grid span {
  margin-top: 6px;
  color: #8495a5;
  font-size: 12px;
}

.welcome-cta {
  margin: 78px 8px 8px;
  text-align: center;
  padding: 46px 24px 30px;
  border-top: 1px solid #dce8f1;
}
.welcome-cta h3 {
  margin: 0 0 9px;
  color: #243e55;
  font-size: 24px;
}
.welcome-cta p {
  max-width: 600px;
  margin: 0 auto 22px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted);
}
.welcome-cta strong {
  color: var(--text);
}

.welcome-disclaimer {
  max-width: 520px !important;
  margin: 20px auto 0 !important;
  font-size: 12px !important;
  line-height: 1.6 !important;
  color: #8a9bb5 !important;
}

.welcome-start-btn {
  font-size: 15px;
  padding: 12px 48px;
  height: 48px;
  border-radius: 14px;
}
.welcome-cta-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
}
.welcome-plan-btn {
  min-width: 140px;
  height: 48px;
  border-radius: 14px;
  font-size: 15px;
}

.welcome-path-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 150px;
  height: 48px;
  border-radius: 14px;
  font-size: 15px;
}

.welcome-pain-path {
  max-width: 1120px;
  margin: 42px auto 0;
  padding: 18px;
  border: 1px solid #d8e6f1;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 42px rgba(45, 83, 116, 0.08);
  scroll-margin-top: 18px;
}
.welcome-pain-path > p {
  margin: 0 0 12px;
  color: #6f8496;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}
.welcome-pain-path nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.welcome-pain-path a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 9px 10px;
  border-radius: 10px;
  color: #4e687f;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}
.welcome-pain-path a:hover {
  background: #eef7ff;
  color: #246fae;
  transform: translateY(-1px);
}
.welcome-pain-path a span {
  display: grid;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: #edf5fc;
  color: #4c87ba;
  font-size: 10px;
}

.welcome-pain-stories {
  display: grid;
  gap: 34px;
  max-width: 1160px;
  margin: 34px auto 0;
}
.welcome-pain-story {
  min-width: 0;
  overflow: hidden;
  padding: 42px;
  border: 1px solid #d6e5f0;
  border-radius: 26px;
  background:
    radial-gradient(circle at 90% 0, rgba(107, 173, 230, 0.13), transparent 35%),
    linear-gradient(180deg, #f9fcff, #f3f8fc);
  scroll-margin-top: 18px;
}
.welcome-pain-story.pain-project {
  background:
    radial-gradient(circle at 8% 0, rgba(101, 190, 152, 0.13), transparent 35%),
    linear-gradient(180deg, #fbfefd, #f3faf7);
}
.welcome-pain-story.pain-method {
  background:
    radial-gradient(circle at 92% 0, rgba(151, 125, 220, 0.13), transparent 35%),
    linear-gradient(180deg, #fdfcff, #f7f4fc);
}
.welcome-pain-story.pain-writing {
  background:
    radial-gradient(circle at 8% 0, rgba(238, 169, 86, 0.13), transparent 35%),
    linear-gradient(180deg, #fffdfa, #fcf7ef);
}
.welcome-pain-story.pain-citation {
  background:
    radial-gradient(circle at 92% 0, rgba(63, 153, 173, 0.13), transparent 35%),
    linear-gradient(180deg, #f9fdfe, #f1f9fa);
}
.pain-story-copy {
  max-width: 850px;
  margin: 0 auto 28px;
  text-align: center;
}
.pain-story-index {
  display: inline-block;
  margin-bottom: 10px;
  color: #3d82ba;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .8px;
  text-transform: uppercase;
}
.pain-project .pain-story-index { color: #34845f; }
.pain-method .pain-story-index { color: #7658bd; }
.pain-writing .pain-story-index { color: #ad711f; }
.pain-citation .pain-story-index { color: #2d7c8e; }
.pain-story-copy h3 {
  margin: 0;
  color: #213d55;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.3;
  letter-spacing: -.5px;
}
.pain-story-copy > p {
  max-width: 760px;
  margin: 14px auto 0;
  color: #687e91;
  font-size: 14px;
  line-height: 1.85;
}
.pain-story-notes,
.pain-story-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}
.pain-story-notes {
  margin-top: 15px;
}
.pain-story-notes span {
  padding: 6px 10px;
  border: 1px solid rgba(92, 139, 178, .2);
  border-radius: 999px;
  background: rgba(255, 255, 255, .74);
  color: #60798f;
  font-size: 11px;
  font-weight: 700;
}
.pain-story-actions {
  align-items: center;
  margin-top: 18px;
}
.pain-story-actions button {
  height: 42px;
  border-radius: 11px;
}
.pain-story-actions a {
  color: #397bac;
  font-size: 12px;
  font-weight: 700;
}

.pain-demo {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 1040px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid #bed4e5;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 22px 56px rgba(36, 70, 101, .14);
}
.pain-demo-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 42px;
  padding: 0 15px;
  border-bottom: 1px solid #dce8f1;
  background: #f7fafc;
  color: #778c9f;
  font-size: 11px;
}
.pain-demo-bar i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c5d5e2;
}
.pain-demo-bar i:first-child { background: #f0a5a0; }
.pain-demo-bar i:nth-child(2) { background: #eed08a; }
.pain-demo-bar i:nth-child(3) { margin-right: 7px; background: #91cfad; }
.pain-demo-bar b {
  margin-left: auto;
  color: #4f8a70;
  font-size: 10px;
}
.pain-demo-body {
  position: relative;
  min-width: 0;
  min-height: 410px;
  padding: 34px;
}
.demo-cursor {
  position: absolute;
  z-index: 5;
  color: #255f91;
  font-size: 27px;
  filter: drop-shadow(0 2px 2px rgba(255,255,255,.9));
  pointer-events: none;
}

.demo-step,
.demo-message,
.ai-bubble,
.ai-input-bar,
.demo-paper-info,
.demo-question,
.demo-method-card,
.demo-method-tip,
.demo-outline-tree > div,
.demo-writing-check,
.demo-search,
.demo-citation-row,
.demo-citation-foot {
  animation: demoStage 9s ease-in-out infinite both;
}
.pain-demo .d1 { animation-delay: .2s; }
.pain-demo .d2 { animation-delay: .8s; }
.pain-demo .d3 { animation-delay: 1.4s; }
.pain-demo .d4 { animation-delay: 2s; }
.pain-demo .d5 { animation-delay: 2.6s; }
@keyframes demoStage {
  0%, 5% { opacity: 0; transform: translateY(8px); }
  14%, 78% { opacity: 1; transform: translateY(0); }
  90%, 100% { opacity: .45; transform: translateY(0); }
}

/* API Key demo */
.api-demo-body {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(340px, 1.2fr);
  gap: 34px;
  align-items: center;
  background: linear-gradient(135deg, #f5faff, #fff);
}
.actual-api-demo {
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: stretch;
  gap: 18px;
}
.actual-page-sidebar {
  display: grid;
  align-content: start;
  gap: 9px;
  padding: 16px 12px;
  border: 1px solid #d6e5f0;
  border-radius: 15px;
  background: rgba(244, 250, 255, .95);
}
.actual-step {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  color: #6c8295;
  font-size: 11px;
  font-weight: 700;
}
.actual-step span {
  display: grid;
  width: 25px;
  height: 23px;
  place-items: center;
  border-radius: 8px;
  background: #e8f3ff;
  color: #4274a6;
  font-size: 10px;
}
.actual-step.active {
  border: 1px solid #9dc8ef;
  background: #edf7ff;
  color: #214c73;
}
.actual-setup-page {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.actual-banner {
  display: grid;
  padding: 14px;
}
.actual-model-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.actual-select {
  display: block;
  min-height: 42px;
  padding: 11px 34px 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}
.actual-key-field {
  padding: 14px;
  border: 1px solid #dbe7f1;
  border-radius: 12px;
  background: #fff;
}
.actual-key-action-strip {
  position: relative;
  display: grid;
  grid-template-columns: minmax(180px, .9fr) 1fr 24px;
  gap: 12px;
  align-items: center;
  min-height: 78px;
  padding: 12px;
  border: 1px dashed #c8ddec;
  border-radius: 14px;
  background: linear-gradient(135deg, #f8fcff, #fff);
}
.actual-deepseek-card {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid #d8e5ef;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(52, 93, 129, .08);
  animation: demoStage 9s ease-in-out infinite both;
}
.actual-deepseek-card small {
  color: #6f879c;
  font-size: 10px;
  font-weight: 800;
}
.actual-deepseek-card strong {
  color: #34536b;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}
.actual-deepseek-card button {
  width: 76px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: #2d79b5;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}
.actual-key-chip {
  justify-self: start;
  padding: 10px 12px;
  border: 1px solid #bbd5e9;
  border-radius: 999px;
  background: #eaf5ff;
  color: #285d86;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(45, 121, 181, .13);
  animation: actualKeyFly 9s ease-in-out infinite both;
}
.actual-flow-arrow {
  color: #70a4cc;
  font-size: 18px;
  font-weight: 900;
  animation: demoStage 9s 1.1s ease-in-out infinite both;
}
.actual-key-input {
  position: relative;
  display: grid;
  align-items: center;
  min-height: 42px;
  flex: 1;
  padding: 0 12px;
  border: 1px solid #d6e2ec;
  border-radius: 9px;
  background: #fff;
  color: #36536b;
  overflow: hidden;
}
.actual-key-placeholder,
.actual-key-typed {
  grid-area: 1 / 1;
  font-size: 12px;
}
.actual-key-placeholder {
  color: #9aacb9;
  animation: actualPlaceholder 9s ease-in-out infinite both;
}
.actual-key-typed {
  width: 0;
  overflow: hidden;
  color: #36536b;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 800;
  white-space: nowrap;
  animation: actualTypeKey 9s ease-in-out infinite both;
}
.actual-test-button {
  position: relative;
  overflow: hidden;
  animation: actualTestPulse 9s ease-in-out infinite both;
}
.actual-connection-success {
  opacity: 0;
  animation: actualConnectionSuccess 9s ease-in-out infinite both;
}
.actual-api-cursor {
  right: 70px;
  bottom: 78px;
  animation: actualApiCursor 9s ease-in-out infinite both;
}
@keyframes actualKeyFly {
  0%, 18% { opacity: 0; transform: translate(-40px, -6px) scale(.92); }
  26%, 38% { opacity: 1; transform: translate(0, 0) scale(1); }
  49%, 100% { opacity: 0; transform: translate(210px, 76px) scale(.86); }
}
@keyframes actualPlaceholder {
  0%, 42% { opacity: 1; }
  48%, 100% { opacity: 0; }
}
@keyframes actualTypeKey {
  0%, 42% { width: 0; opacity: 0; }
  52%, 82% { width: 168px; opacity: 1; }
  92%, 100% { width: 168px; opacity: .45; }
}
@keyframes actualTestPulse {
  0%, 56% { transform: scale(1); box-shadow: none; }
  62%, 68% { transform: scale(.96); box-shadow: 0 0 0 4px rgba(45, 121, 181, .14); }
  76%, 100% { transform: scale(1); box-shadow: none; }
}
@keyframes actualConnectionSuccess {
  0%, 68% { opacity: 0; transform: translateY(6px); }
  76%, 90% { opacity: 1; transform: translateY(0); }
  100% { opacity: .45; }
}
@keyframes actualApiCursor {
  0%, 18% { opacity: 0; transform: translate(-330px, -120px); }
  25%, 35% { opacity: 1; transform: translate(-245px, -92px); }
  45%, 55% { opacity: 1; transform: translate(-24px, -8px); }
  62%, 70% { opacity: 1; transform: translate(0, 0) scale(.9); }
  82%, 100% { opacity: 0; transform: translate(0, 0) scale(.9); }
}
.demo-steps {
  display: grid;
  gap: 12px;
}
.demo-step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 2px 10px;
  padding: 14px;
  border: 1px solid #d9e6f0;
  border-radius: 12px;
  background: #fff;
}
.demo-step b {
  grid-row: 1 / 3;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: #eaf4fd;
  color: #367bb2;
  font-size: 12px;
}
.demo-step span { color: #36536c; font-size: 13px; font-weight: 800; }
.demo-step em { color: #8a9baa; font-size: 10px; font-style: normal; }
.demo-config-card {
  display: grid;
  gap: 12px;
  padding: 24px;
  border: 1px solid #ccdeeb;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 15px 35px rgba(52, 93, 129, .1);
}
.ai-workbench-head,
.ai-chat-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 2px;
  color: #506b81;
  font-size: 11px;
  font-weight: 800;
}
.ai-workbench-head b,
.ai-chat-title b {
  padding: 4px 7px;
  border-radius: 999px;
  background: #e8f5ee;
  color: #3f8a66;
  font-size: 9px;
}
.ai-chat-mini {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #e0edf6;
  border-radius: 12px;
  background: linear-gradient(180deg, #f7fbff, #fff);
}
.ai-bubble {
  max-width: 88%;
  padding: 9px 10px;
  border-radius: 12px 12px 12px 4px;
  background: #edf5fc;
  color: #446077;
  font-size: 10px;
  line-height: 1.55;
}
.ai-bubble.user {
  justify-self: end;
  border-radius: 12px 12px 4px 12px;
  background: #e5f5ed;
  color: #426853;
}
.demo-config-card > small { color: #7a90a3; font-weight: 700; }
.demo-config-card label {
  display: grid;
  gap: 6px;
  color: #718699;
  font-size: 11px;
}
.demo-config-card label strong {
  padding: 12px;
  border: 1px solid #d6e2ec;
  border-radius: 9px;
  color: #36536b;
  font-size: 12px;
}
.demo-config-card button {
  height: 40px;
  border: 0;
  border-radius: 9px;
  background: #2d79b5;
  color: #fff;
  font-weight: 800;
}
.demo-success {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  color: #2e7f59;
  font-size: 11px;
  font-weight: 700;
  animation: demoSuccess 9s 2.8s ease-in-out infinite;
}
.demo-success i {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: #dff4e8;
  font-style: normal;
}
.api-cursor {
  right: 28%;
  bottom: 78px;
  animation: apiCursor 9s ease-in-out infinite;
}
@keyframes apiCursor {
  0%, 35% { opacity: 0; transform: translate(-120px, -110px); }
  48%, 62% { opacity: 1; transform: translate(0, 0); }
  66%, 100% { opacity: 0; transform: translate(0, 0) scale(.85); }
}
@keyframes demoSuccess {
  0%, 30% { opacity: 0; transform: translateY(5px); }
  42%, 78% { opacity: 1; transform: translateY(0); }
  90%, 100% { opacity: 0; }
}

/* Project demo */
.project-demo-body {
  display: grid;
  grid-template-columns: minmax(360px, 1.05fr) minmax(310px, .95fr);
  gap: 28px;
  align-items: center;
  background: linear-gradient(135deg, #f4fbf7, #fff);
}
.actual-paper-demo {
  grid-template-columns: 230px minmax(0, 1fr);
  align-items: stretch;
}
.actual-mode-card {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 22px 18px;
  border: 2px solid #73c6a3;
  border-radius: 18px;
  background: linear-gradient(180deg, #f0fbf6, #fff);
  box-shadow: 0 14px 34px rgba(52, 105, 78, .08);
}
.actual-mode-card .mode-card-icon { font-size: 30px; }
.actual-mode-card .mode-card-title {
  color: #245b42;
  font-size: 18px;
  font-weight: 900;
}
.actual-mode-card .mode-card-desc {
  color: #60786b;
  font-size: 11px;
  line-height: 1.7;
}
.actual-mode-card .mode-card-action {
  margin-top: 8px;
  color: #2f8a63;
  font-size: 12px;
  font-weight: 900;
}
.actual-chat-page {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 12px;
  min-width: 0;
  padding: 18px;
  border: 1px solid #cfe5d9;
  border-radius: 16px;
  background: #fff;
}
.actual-chat-page .method-chat-head {
  display: block;
  padding-bottom: 0;
  border-bottom: 0;
}
.actual-chat-page .method-chat-head h3 {
  margin: 5px 0 4px;
  color: #315143;
  font-size: 15px;
}
.actual-chat-page .method-chat-head p {
  margin: 0;
  color: #6c8176;
  font-size: 10px;
}
.actual-chat-messages {
  display: grid;
  align-content: start;
  gap: 9px;
  min-height: 150px;
  padding: 12px;
  border-radius: 13px;
  background: #f7fbf8;
}
.actual-chat-messages .method-chat-message {
  max-width: 82%;
  margin: 0;
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.6;
}
.actual-chat-messages .method-chat-message.user {
  justify-self: end;
}
.actual-chat-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
}
.actual-chat-input textarea {
  min-height: 48px;
  resize: none;
  font-size: 10px;
}
.actual-chat-page .paper-info-draft {
  padding: 11px 13px;
  border-radius: 12px;
  font-size: 11px;
}
.actual-chat-page .paper-info-draft p {
  margin: 5px 0 0;
  color: #6a8175;
  line-height: 1.6;
}
.ai-chat-panel {
  display: grid;
  gap: 13px;
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(184, 213, 230, .86);
  border-radius: 16px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 14px 34px rgba(54, 91, 119, .09);
}
.demo-chat { display: grid; gap: 13px; }
.demo-message {
  max-width: 88%;
  padding: 13px 15px;
  border-radius: 14px 14px 14px 4px;
  background: #edf4fa;
  color: #405a70;
  font-size: 12px;
  line-height: 1.6;
}
.demo-message b {
  display: inline-grid;
  min-width: 24px;
  margin-right: 5px;
  color: #246fae;
  font-size: 10px;
}
.demo-message.user {
  justify-self: end;
  border-radius: 14px 14px 4px 14px;
  background: #dff3e8;
  color: #38614e;
}
.demo-message.user b { color: #3f8a66; }
.ai-input-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid #dceaf2;
  border-radius: 12px;
  background: #fff;
}
.ai-input-bar span {
  padding-left: 9px;
  color: #9aabb7;
  font-size: 10px;
}
.ai-input-bar button {
  padding: 8px 12px;
  border: 0;
  border-radius: 9px;
  background: #2d79b5;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}
.demo-paper-info {
  padding: 25px;
  border: 1px solid #cfe5d9;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(52, 105, 78, .1);
}
.demo-paper-info small { color: #4b946e; font-weight: 800; }
.demo-paper-info h4 { margin: 10px 0 8px; color: #315143; font-size: 17px; }
.demo-paper-info p { margin: 0; color: #6a8175; font-size: 12px; line-height: 1.8; }
.demo-paper-info > span {
  display: flex;
  justify-content: space-between;
  margin-top: 22px;
  padding-top: 13px;
  border-top: 1px solid #e4efe9;
  color: #82958b;
  font-size: 10px;
}
.demo-paper-info b { color: #3d8d65; }
.project-cursor {
  left: 39%;
  bottom: 100px;
  animation: projectCursor 9s ease-in-out infinite;
}
@keyframes projectCursor {
  0%, 25% { opacity: 0; transform: translate(-90px, 70px); }
  38%, 55% { opacity: 1; transform: translate(0, 0); }
  65%, 100% { opacity: 0; transform: translate(120px, -60px); }
}

/* Method demo */
.method-demo-body {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(380px, 1fr);
  gap: 18px;
  align-items: stretch;
  background: linear-gradient(135deg, #faf8ff, #fff);
}
.method-chat-demo {
  border-color: #ded5f1;
}
.method-chat-demo .ai-chat-title b {
  background: #eee8fa;
  color: #6e54ad;
}
.demo-question {
  padding: 16px 18px;
  border: 1px solid #ded5f1;
  border-radius: 13px;
  background: #fff;
}
.demo-question small { color: #836ac0; font-weight: 800; }
.demo-question p { margin: 7px 0 12px; color: #4e4567; font-size: 13px; }
.demo-question span {
  display: inline-block;
  padding: 7px 10px;
  border-radius: 8px;
  background: #eee8fa;
  color: #6e54ad;
  font-size: 11px;
  font-weight: 800;
}
.demo-method-flow {
  display: grid;
  grid-template-columns: 1fr;
  gap: 13px;
}
.demo-method-card {
  min-height: auto;
  padding: 17px;
  border: 1px solid #ddd5ed;
  border-radius: 13px;
  background: #fff;
}
.demo-method-card em,
.demo-method-card strong,
.demo-method-card small { display: block; }
.demo-method-card em { color: #8b77b9; font-size: 10px; font-style: normal; font-weight: 800; }
.demo-method-card strong { margin-top: 8px; color: #504267; font-size: 16px; }
.demo-method-card small { margin-top: 7px; color: #8b8399; font-size: 10px; line-height: 1.6; }
.demo-method-tip {
  grid-column: 1 / -1;
  padding: 11px;
  border-radius: 9px;
  background: #eaf6ef;
  color: #3b805d;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
}

/* Writing demo */
.writing-demo-body {
  display: grid;
  grid-template-columns: 210px minmax(360px, 1fr) 180px;
  gap: 18px;
  background: linear-gradient(135deg, #fffaf3, #fff);
}
.writing-chat-demo {
  border-color: #eadfce;
  background: rgba(255, 253, 249, .95);
}
.writing-chat-demo .ai-chat-title b {
  background: #fbedd7;
  color: #95631f;
}
.demo-outline-tree {
  padding: 16px;
  border: 1px solid #eadfce;
  border-radius: 13px;
  background: #fffdf9;
}
.demo-outline-tree > small { color: #a27438; font-weight: 800; }
.demo-outline-tree > div {
  display: grid;
  gap: 5px;
  margin-top: 13px;
  padding: 10px;
  border-radius: 8px;
  color: #706557;
  font-size: 10px;
}
.demo-outline-tree > div.active { background: #fbedd7; color: #95631f; font-weight: 800; }
.demo-outline-tree b { color: #ab9b87; font-size: 9px; }
.demo-writing-sheet {
  padding: 23px;
  border: 1px solid #e4ddd4;
  border-radius: 13px;
  background: #fff;
}
.demo-writing-sheet h4 { margin: 0 0 12px; color: #534a3f; font-size: 16px; }
.demo-writing-sheet p:not(.demo-text-line) {
  margin: 0 0 14px;
  color: #6f675e;
  font-size: 11px;
  line-height: 1.8;
}
.demo-text-line {
  height: 8px;
  margin: 11px 0;
  border-radius: 999px;
  background: #e8e2da;
  transform-origin: left;
  animation: demoWrite 9s ease-in-out infinite;
}
.demo-text-line.l2 { width: 94%; animation-delay: .3s; }
.demo-text-line.l3 { width: 88%; animation-delay: .6s; }
.demo-text-line.l4 { width: 97%; animation-delay: .9s; }
.demo-text-line.l5 { width: 68%; animation-delay: 1.2s; }
@keyframes demoWrite {
  0%, 18% { transform: scaleX(.05); opacity: .25; }
  45%, 82% { transform: scaleX(1); opacity: 1; }
  95%, 100% { opacity: .35; }
}
.demo-writing-check {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 17px;
  border: 1px solid #eadfce;
  border-radius: 13px;
  background: #fffdf9;
}
.demo-writing-check strong { color: #765d3a; font-size: 12px; }
.demo-writing-check span { color: #61806d; font-size: 10px; line-height: 1.5; }

/* Citation demo */
.citation-demo-body {
  display: grid;
  grid-template-columns: minmax(360px, .95fr) minmax(390px, 1.05fr);
  align-content: start;
  gap: 18px;
  background: linear-gradient(135deg, #f3fbfc, #fff);
}
.citation-chat-demo {
  border-color: #cfe2e6;
  background: rgba(255, 255, 255, .94);
}
.citation-chat-demo .ai-chat-title b {
  background: #e4f2f4;
  color: #397c8b;
}
.demo-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 9px;
  border: 1px solid #cfe2e6;
  border-radius: 12px;
  background: #fff;
}
.demo-search span {
  padding: 10px;
  color: #66818a;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}
.demo-search button,
.demo-citation-foot button {
  border: 0;
  border-radius: 8px;
  background: #397f90;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}
.demo-citation-list { display: grid; gap: 9px; }
.demo-citation-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid #d9e8eb;
  border-radius: 11px;
  background: #fff;
}
.demo-citation-row > i {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: #e4f2f4;
  color: #397c8b;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}
.demo-citation-row strong,
.demo-citation-row small { display: block; }
.demo-citation-row strong { overflow: hidden; color: #36555d; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.demo-citation-row small { margin-top: 5px; color: #879ba0; font-size: 9px; }
.demo-citation-row em { color: #36806b; font-size: 10px; font-style: normal; font-weight: 800; }
.demo-citation-foot {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #43816d;
  font-size: 10px;
  font-weight: 800;
}
.demo-citation-foot button { padding: 9px 12px; }

@media (max-width: 900px) {
  .welcome-hero {
    padding: 46px 16px 30px;
  }
  .welcome-title {
    font-size: 32px;
    letter-spacing: -1px;
  }
  .preview-workspace {
    grid-template-columns: 1fr;
  }
  .preview-nav,
  .preview-insights {
    display: none;
  }
  .preview-document {
    min-height: 330px;
    padding: 22px 18px;
  }
  .welcome-features {
    grid-template-columns: 1fr;
  }
  .welcome-toolbox {
    grid-template-columns: 1fr;
    gap: 22px;
    margin-top: 54px;
    padding: 26px 20px;
  }
  .welcome-toolbox-grid {
    grid-template-columns: 1fr;
  }
  .welcome-pain-path nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .welcome-pain-story {
    padding: 28px 20px;
  }
  .pain-demo-body {
    min-height: 460px;
    padding: 22px;
  }
  .api-demo-body,
  .project-demo-body,
  .method-demo-body,
  .citation-demo-body {
    grid-template-columns: 1fr;
  }
  .actual-api-demo,
  .actual-paper-demo,
  .actual-model-grid {
    grid-template-columns: 1fr;
  }
  .actual-page-sidebar {
    display: none;
  }
  .actual-chat-input {
    grid-template-columns: 1fr;
  }
  .api-demo-body { min-height: 590px; }
  .project-demo-body { min-height: 520px; }
  .method-demo-body,
  .citation-demo-body { min-height: auto; }
  .demo-method-flow {
    grid-template-columns: 1fr;
  }
  .writing-demo-body {
    grid-template-columns: 155px minmax(0, 1fr);
  }
  .demo-writing-check {
    grid-column: 1 / -1;
  }
  .writing-demo-body { min-height: 520px; }
}

@media (max-width: 1080px) {
  .shell:has(#welcome.active) {
    gap: 10px;
  }
  .shell:has(#welcome.active) .sidebar {
    position: static;
    height: auto;
    min-height: 66px;
    padding: 10px 16px;
    overflow: hidden;
  }
  .shell:has(#welcome.active) .sidebar > :not(.brand):not(.sidebar-collapse-btn) {
    display: none;
  }
  .shell:has(#welcome.active) .sidebar-collapse-btn {
    display: none;
  }
  .shell:has(#welcome.active) .brand {
    min-height: 44px;
    padding: 0;
    border: 0;
  }
  .shell:has(#welcome.active) .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 10px;
  }
  .shell:has(#welcome.active) .brand h1 {
    font-size: 15px;
  }
  .shell:has(#welcome.active) .brand p {
    font-size: 10px;
  }
}

@media (max-width: 560px) {
  #welcome {
    overflow: hidden;
  }
  .welcome-cta-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .welcome-cta-actions .welcome-start-btn,
  .welcome-cta-actions .welcome-path-btn,
  .welcome-cta-actions .welcome-plan-btn {
    width: 100%;
    min-width: 0;
  }
  .welcome-pain-path {
    padding: 12px;
  }
  .welcome-pain-path nav {
    grid-template-columns: 1fr;
  }
  .welcome-pain-story {
    padding: 24px 12px;
    border-radius: 20px;
  }
  .pain-story-copy h3 {
    font-size: 23px;
  }
  .pain-demo {
    border-radius: 14px;
  }
  .pain-demo-bar span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .pain-demo-body {
    padding: 16px;
  }
  .writing-demo-body {
    grid-template-columns: 1fr;
    min-height: 720px;
  }
  .demo-outline-tree,
  .demo-writing-check {
    grid-column: auto;
  }
  .demo-search {
    grid-template-columns: 1fr;
  }
  .demo-search button {
    min-height: 36px;
  }
  .demo-citation-row {
    grid-template-columns: 24px minmax(0, 1fr);
  }
  .demo-citation-row em {
    grid-column: 2;
  }
  .citation-demo-body {
    min-height: 560px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pain-demo *,
  .welcome-apikey-status {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .demo-cursor {
    display: none;
  }
}

/* ── Citation add modal preview ────────────────────────────── */
.cm-add-citation-modal {
  max-width: 680px;
  max-height: 85vh;
  overflow-y: auto;
}

.cm-preview-summary {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 0 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.cm-preview-summary span:first-child {
  font-weight: 600;
  color: var(--text);
}

.cm-preview-hint {
  font-size: 12px;
  color: var(--muted);
}

.cm-preview-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  max-height: 380px;
  overflow-y: auto;
}

.cm-preview-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--panel);
}

.cm-preview-card.selected {
  border-color: var(--line-strong);
  background: var(--bg);
}

.cm-preview-card.excluded {
  opacity: 0.55;
  background: #fafafa;
}

.cm-preview-card-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.cm-preview-card-header input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

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

.cm-preview-formatted {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  flex: 1;
  word-break: break-all;
}

.cm-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
}

.cm-preview-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.cm-tag-type {
  background: #e8f0fe;
  color: #1a73e8;
}

.cm-tag-year {
  background: #e6f4ea;
  color: #137333;
}

.cm-tag-doi {
  background: #fef7e0;
  color: #b06000;
}

.cm-tag-complete {
  background: #e6f4ea;
  color: #137333;
}

.cm-tag-incomplete {
  background: #fce8e6;
  color: #c5221f;
}

.cm-tag-no-citation {
  background: #f1f3f4;
  color: #5f6368;
}

.cm-preview-issues {
  margin-top: 6px;
  font-size: 12px;
  color: #c5221f;
  line-height: 1.5;
}

.cm-preview-issues li {
  margin: 0;
  padding: 0;
  list-style: disc inside;
}

/* ── Grade badges ────────────────────────────────────── */
.grade-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.grade-a { background: #e6f4ea; color: #137333; }
.grade-b { background: #e8f0fe; color: #1a73e8; }
.grade-c { background: #fef7e0; color: #b06000; }
.grade-d { background: #fce8e6; color: #c5221f; }
.grade-none { background: #f1f3f4; color: #5f6368; }

/* ── Relevance column ────────────────────────────────── */
.lib-col-rel { width: 78px; text-align: center; }
.lib-rel-cell { text-align: center; font-size: 12px; font-weight: 500; white-space: nowrap; }
.lib-rel-cell.rel-high { color: #137333; }
.lib-rel-cell.rel-mid  { color: #1a73e8; }
.lib-rel-cell.rel-low  { color: #b06000; }
.lib-rel-cell.rel-none { color: #999; }

/* ── Auth overlay ─────────────────────────────────────── */
.auth-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.auth-overlay.hidden { display: none; }

.auth-card {
  position: relative;
  background: var(--surface);
  border-radius: 12px;
  padding: 36px 32px 24px;
  width: 100%; max-width: 400px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.auth-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; font-size: 22px; color: #999;
  cursor: pointer; padding: 2px 6px; border-radius: 4px; line-height: 1;
}
.auth-close:hover { background: #f0f0f0; color: #333; }
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand h2 { font-size: 24px; margin: 0; color: var(--primary); }
.auth-brand p  { font-size: 13px; color: var(--muted); margin: 4px 0 0; }

.auth-tabs { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.auth-tab {
  flex: 1; padding: 10px; border: none; background: none;
  font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; transition: all .15s;
}
.auth-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.auth-fields { display: flex; flex-direction: column; gap: 14px; }
.auth-error {
  color: var(--danger); font-size: 13px; margin: 8px 0 0; padding: 6px 10px;
  background: #fce8e6; border-radius: 6px;
}
.auth-error.hidden { display: none; }

.disclaimer-check {
  display: flex; align-items: flex-start; gap: 8px; margin-top: 14px;
  font-size: 12px; color: var(--muted); cursor: pointer; user-select: none;
}
.disclaimer-check input[type="checkbox"] {
  flex-shrink: 0; margin-top: 1px; width: 15px; height: 15px; accent-color: var(--primary);
}
.disclaimer-check a { color: var(--primary); text-decoration: underline; }
.disclaimer-check[hidden] { display: none; }

.auth-submit { width: 100%; margin-top: 18px; }
.auth-footer { text-align: center; font-size: 11px; color: var(--muted); margin-top: 16px; }
.auth-footer-link { text-align: center; font-size: 12px; margin-top: 8px; }
.auth-footer-link a { color: var(--primary); text-decoration: underline; }
.auth-success { text-align: center; font-size: 14px; color: #16a34a; margin-top: 12px; padding: 12px 16px; background: #f0fdf4; border-radius: 8px; border: 1px solid #bbf7d0; line-height: 1.8; }
.auth-success.hidden { display: none; }
.auth-form.hidden { display: none; }
.auth-tabs.hidden { display: none; }

#disclaimerModal.modal-backdrop {
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: none;
}
.disclaimer-card {
  max-width: 680px; max-height: 85vh;
  background: #fff; border-radius: 12px; box-shadow: 0 12px 48px rgba(0,0,0,0.3);
  display: flex; flex-direction: column; overflow: hidden;
}
.disclaimer-card .modal-head {
  margin-bottom: 0; padding: 18px 22px; border-bottom: 1px solid #e5e7eb;
}
.disclaimer-card .modal-head h2 { color: #111; }
.disclaimer-card .modal-foot {
  padding: 14px 22px; border-top: 1px solid #e5e7eb;
  display: flex; justify-content: flex-end;
}
.disclaimer-body { font-size: 13px; line-height: 1.8; color: #1a1a1a; }
.disclaimer-body h3 { font-size: 15px; margin: 18px 0 8px; color: #111; }
.disclaimer-body h3:first-child { margin-top: 0; }
.disclaimer-body ol { padding-left: 20px; margin: 6px 0; }
.disclaimer-body li { margin-bottom: 4px; }
.disclaimer-body p { margin: 6px 0; }

/* Logged-in user badge in sidebar */
.user-badge {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; margin: 8px 12px;
  background: var(--surface2); border-radius: 8px;
  font-size: 12px; color: var(--text);
  cursor: pointer;
}
.user-badge .user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.user-badge .user-info { flex: 1; }
.user-badge .user-email { color: var(--muted); font-size: 11px; }
.user-badge .logout-btn { color: var(--muted); font-size: 11px; border: none; background: none; cursor: pointer; }

/* ── Purchase + Referral ────────────────────────────────────────── */
.purchase-plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.purchase-plan-card {
  padding: 22px 20px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  text-align: center;
  transition: border-color 0.15s, transform 0.1s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.purchase-plan-card:hover { border-color: #91d5ff; transform: translateY(-2px); }
.purchase-plan-card[data-tier="vip"]   { border-color: #faad14; background: linear-gradient(135deg, #fffbe6 0%, #ffefb3 100%); }
.purchase-plan-card[data-tier="pro"]   { border-color: #1890ff; background: linear-gradient(135deg, #f0f9ff 0%, #d6ebff 100%); }
.purchase-plan-card[data-tier="basic"] { border-color: #52c41a; }
.purchase-plan-tier { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 0.05em; }
.purchase-plan-card h3 { margin: 4px 0 2px; font-size: 17px; }
.purchase-plan-tagline { margin: 0 0 8px; font-size: 12px; color: #888; }
.purchase-plan-price {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin: 4px 0 10px;
}
.purchase-plan-original {
  font-size: 16px;
  font-weight: 500;
  color: #999;
  text-decoration: line-through;
}
.purchase-plan-current {
  font-size: 32px;
  font-weight: 700;
  color: #cf1322;
}
.purchase-plan-current small { font-size: 14px; color: #666; }
.purchase-plan-discount {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: #cf1322;
  padding: 2px 7px;
  border-radius: 4px;
  line-height: 1.4;
  vertical-align: middle;
}
.purchase-plan-duration { font-size: 12px; color: var(--muted); margin: 4px 0 12px; }
.purchase-plan-desc { font-size: 13px; color: #555; min-height: 36px; }
.purchase-plan-features {
  text-align: left;
  margin: 0;
  padding: 0 4px;
  list-style: none;
  font-size: 13px;
  color: #444;
  line-height: 1.8;
}
.purchase-plan-features li::before {
  content: "✓ ";
  color: #52c41a;
  font-weight: 700;
}
.purchase-plan-card button { width: 100%; margin-top: auto; }

.payment-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000; padding: 20px;
}
.payment-modal {
  background: white; padding: 24px 28px; border-radius: 12px;
  max-width: 420px; width: 100%; box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  display: flex; flex-direction: column; gap: 8px;
}
.payment-modal-wide { max-width: 480px; }
.payment-modal h3 { margin: 0 0 4px; }
.payment-method-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.payment-method-btn {
  padding: 12px 16px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; text-align: left; font-size: 14px;
  transition: background 0.15s;
}
.payment-method-btn:hover { background: #e6f7ff; border-color: #1890ff; }
.payment-qr-area {
  display: flex; flex-direction: column; align-items: center;
  margin: 12px 0; padding: 12px; background: var(--surface2); border-radius: 8px;
}
.payment-qr-img { max-width: 260px; width: 100%; height: auto; }
.payment-upload-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.payment-modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }

.referral-card {
  padding: 22px 24px;
  background: linear-gradient(135deg, #fff7e6 0%, #ffefb3 100%);
  border: 1px solid #ffd591;
  border-radius: 10px;
}
.referral-code-row {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; margin-bottom: 18px;
}
.referral-code-label { font-size: 13px; color: var(--muted); }
.referral-code-value {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 28px; font-weight: 700; color: #cf1322;
  padding: 6px 16px; background: white; border-radius: 8px;
  letter-spacing: 0.15em;
}
.referral-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
.referral-stat {
  text-align: center; padding: 10px;
  background: white; border-radius: 8px;
}
.referral-stat strong { font-size: 22px; display: block; color: #0050b3; }
.referral-stat small { font-size: 11px; color: var(--muted); }

.commission-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.commission-table th, .commission-table td {
  padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left;
}
.commission-table th { background: var(--surface2); font-weight: 600; }
.commission-table .status-pending { color: #ad6800; }
.commission-table .status-settled { color: #2d7a3e; font-weight: 600; }
.commission-table .status-cancelled { color: #cf1322; }

/* ── 紫色主题特殊覆盖（硬编码颜色修正） ──────────────── */
[data-theme="purple"] .model-badge .mb-dot { background: #a78bfa; box-shadow: 0 0 6px rgba(167,139,250,0.4); }
[data-theme="purple"] body { background: var(--bg); }
[data-theme="purple"] input,
[data-theme="purple"] textarea,
[data-theme="purple"] select { background: var(--input-bg); color: var(--text); border-color: var(--border); }
[data-theme="purple"] input:focus,
[data-theme="purple"] textarea:focus,
[data-theme="purple"] select:focus { border-color: var(--primary); }
[data-theme="purple"] .page-head { border-bottom-color: var(--line); }
[data-theme="purple"] .actions.split { border-top-color: var(--line); }
[data-theme="purple"] table th { background: var(--surface2); }
[data-theme="purple"] table td { border-bottom-color: var(--line); }
[data-theme="purple"] .chat-bar { background: var(--chat-bg); border-top-color: var(--border); }
[data-theme="purple"] .chat-bar input { background: var(--input-bg); }
[data-theme="purple"] .license-badge { border-top-color: var(--line); }
[data-theme="purple"] .model-badge { border-top-color: var(--line); }
[data-theme="purple"] #annBanner { background: linear-gradient(135deg, #2d1b69 0%, #5b21b6 100%) !important; }
[data-theme="purple"] .welcome-hero {
  background:
    radial-gradient(circle at 50% 0%, rgba(151, 125, 220, 0.20), transparent 38%),
    linear-gradient(180deg, rgba(249, 247, 255, 0.92), rgba(252, 251, 255, 0));
}
[data-theme="purple"] .upgrade-card { background: var(--surface); border-color: var(--border); }
[data-theme="purple"] .license-status-card { background: var(--surface); }
[data-theme="purple"] .step { color: var(--muted); }
[data-theme="purple"] .step.active { background: var(--hover-bg); color: var(--text); }
[data-theme="purple"] .step:hover { background: var(--step-hover); }
[data-theme="purple"] code { background: var(--code-bg); color: var(--violet); }
[data-theme="purple"] .brand { color: var(--text); }
[data-theme="purple"] .save-tip { color: var(--muted); }

/* ── 上传免责声明 ── */
.upload-disclaimer {
  margin: 8px 0 4px;
  padding: 8px 12px;
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: 8px;
  font-size: 12px;
  color: #92400e;
  line-height: 1.6;
}

/* ── 版本更新通知 ── */
.version-notice {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #1e293b, #334155);
  color: #f1f5f9;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.28);
  font-size: 14px;
  max-width: 520px;
  animation: versionSlideIn .4s ease;
}
@keyframes versionSlideIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.version-notice-icon { font-size: 18px; flex-shrink: 0; }
.version-notice-text { flex: 1; line-height: 1.5; }
.version-notice-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.version-notice-close:hover { color: #fff; background: rgba(255,255,255,.12); }

/* ── Admin: license code display ─────────────────────────── */
.license-code-cell {
  font-family: "SF Mono", "Cascadia Code", "Fira Code", monospace;
  font-size: 11px;
  line-height: 1.6;
  word-break: break-all;
  max-width: 280px;
  display: inline-block;
  vertical-align: middle;
}
.copy-code-btn {
  cursor: pointer;
  vertical-align: middle;
  opacity: 0.6;
  transition: opacity .15s;
}
.copy-code-btn:hover { opacity: 1; }

