@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  /* 文案工坊 · 墨青工位：青绿主色 + 橙 CTA，扁平 SaaS */
  --canvas: #f0fdfa;
  --surface: #ffffff;
  --surface-muted: #f0f9f8;
  --surface-inset: #e8f5f3;
  --ink: #134e4a;
  --ink-secondary: #3f6864;
  --ink-muted: #5f7f7b;
  --line: #cce8e4;
  --line-strong: #99d5cd;
  --accent: #0d9488;
  --accent-hover: #0f766e;
  --accent-soft: #ccfbf1;
  --accent-ink: #ffffff;
  --accent-ring: rgba(13, 148, 136, 0.28);
  --cta: #ea580c;
  --cta-hover: #c2410c;
  --cta-ink: #ffffff;
  --cta-ring: rgba(234, 88, 12, 0.28);
  --success: #0d9488;
  --danger: #dc2626;
  --warn-soft: #fff7ed;
  --warn-ink: #9a3412;
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-w: 420px;
  --topbar-h: 56px;
  --font: "Plus Jakarta Sans", system-ui, sans-serif;
  --ease: 160ms ease;
  --shadow-modal: 0 18px 48px rgba(19, 78, 74, 0.14);

  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 16px;
  --text-lg: 18px;
  --leading-body: 1.6;
  --leading-snug: 1.45;
  --leading-tight: 1.3;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 480px at 12% -10%, rgba(13, 148, 136, 0.10), transparent 60%),
    radial-gradient(900px 420px at 100% 0%, rgba(234, 88, 12, 0.06), transparent 55%),
    var(--canvas);
  color: var(--ink);
  line-height: var(--leading-body);
  font-size: var(--text-base);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button,
a,
[role="button"],
.chip-btn,
.option-btn,
.platform-btn,
.section-nav-btn,
.history-item {
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 本地 SVG 图标 */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 0;
  color: inherit;
}

.icon svg {
  width: 1em;
  height: 1em;
  display: block;
}

.icon-sm svg { width: 16px; height: 16px; }
.icon-sm img { width: 16px; height: 16px; display: block; }

.app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Topbar ── */
.topbar {
  position: sticky;
  top: 0;
  flex-shrink: 0;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  z-index: 20;
}

.topbar-main {
  height: 100%;
  padding: 0 clamp(16px, 2vw, 28px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: transform var(--ease), background var(--ease);
}

.brand:hover .brand-mark {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.brand-mark svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
}

.brand-text { min-width: 0; }

.brand-text h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: var(--leading-tight);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}

.brand-text p {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
  z-index: 21;
}

.topbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.topbar-divider {
  width: 1px;
  height: 20px;
  background: var(--line-strong);
  flex-shrink: 0;
  opacity: 0.85;
}

.topbar-account {
  gap: 6px;
  padding: 3px 4px 3px 6px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.topbar-tools:not(:has(> :not([hidden]))),
.topbar-tools:not(:has(> :not([hidden]))) + .topbar-divider {
  display: none;
}

#accessKeyBtn.has-key {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.access-modal-hint {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  line-height: var(--leading-body);
  margin-bottom: 16px;
}

.modal-form {
  padding: 18px;
}

.modal-form .field {
  margin-bottom: 12px;
}

.modal-form .field input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-inset);
  font: inherit;
  font-size: var(--text-base);
}

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

.modal-form-actions .btn-submit {
  flex: 1 1 auto;
  min-width: 120px;
}

.btn-danger-text {
  color: var(--danger, #c0392b);
}

.btn-danger-text:hover {
  color: var(--danger, #c0392b);
  background: color-mix(in srgb, var(--danger, #c0392b) 8%, transparent);
}

.input-toggle-wrap {
  position: relative;
}

.input-toggle-wrap input {
  padding-right: 42px;
}

.input-toggle-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
}

.input-toggle-btn:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.input-toggle-btn img {
  display: block;
  opacity: 0.72;
}

.input-toggle-btn:hover img {
  opacity: 1;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 6px;
}

.btn-icon img {
  display: block;
}

.modal-form .field input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.service-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  background: var(--surface);
  white-space: nowrap;
}

.service-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-muted);
}

.service-pill.online .service-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.18);
}

.service-pill.offline .service-dot { background: var(--danger); }

.quota-pill {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  background: var(--surface);
  white-space: nowrap;
}

/* ── Workspace: full-screen split ── */
.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
}

/* ── Sidebar ── */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 96%, var(--accent-soft));
}

.sidebar-form {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.section-nav {
  flex-shrink: 0;
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.section-nav-btn {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-muted);
  font: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
  transition: border-color var(--ease), background var(--ease), color var(--ease), transform var(--ease);
}

.section-nav-btn:hover {
  border-color: var(--line-strong);
  color: var(--ink-secondary);
  background: var(--surface-muted);
}

.section-nav-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--accent);
}

.section-nav-btn .nav-num {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 1.2;
}

.section-nav-btn .nav-label {
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.sidebar-foot {
  flex-shrink: 0;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 90%, var(--accent-soft));
  position: relative;
  z-index: 3;
}

.sidebar-foot-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.gen-hint {
  font-size: var(--text-xs);
  color: var(--ink-muted);
  text-align: center;
  margin-bottom: 8px;
}

.form-section {
  --section-pad-x: 18px;
  padding: 16px var(--section-pad-x);
  border-bottom: 1px solid var(--line);
  position: relative;
}

.form-section-compact {
  padding-top: 14px;
  padding-bottom: 14px;
}

.form-section:last-child { border-bottom: none; }

.form-section:not(.is-open) > :not(.section-toggle) {
  display: none;
}

.section-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% + var(--section-pad-x) * 2);
  margin: 0 calc(-1 * var(--section-pad-x));
  padding: 12px var(--section-pad-x);
  border: none;
  border-radius: 0;
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  user-select: none;
  position: relative;
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}

.section-toggle:hover {
  background: var(--surface-muted);
}

.section-toggle:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent);
}

.section-chevron {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-right: 1.5px solid var(--ink-muted);
  border-bottom: 1.5px solid var(--ink-muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.form-section.is-open .section-toggle {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.form-section.is-open .section-chevron {
  transform: rotate(-135deg);
}

.section-num {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--accent-hover);
  background: var(--accent-soft);
  padding: 2px 6px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.section-title {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--ink);
  line-height: var(--leading-tight);
}

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

.field label {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
}

.field-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.4;
}

/* 创作偏好：标签在上，选项在下 */
.pref-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pref-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pref-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-secondary);
  line-height: 1.3;
}

.pref-mode-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.pref-mode-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.pref-mode-note {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--ink-muted);
  line-height: 1.45;
}

.pref-hint {
  margin: 0;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: var(--text-xs);
  line-height: 1.45;
  color: var(--ink-secondary);
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.pref-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 2px;
}

.pref-block[hidden] {
  display: none !important;
}

.pref-block-title {
  margin: 0;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.pref-list.is-recommended .pref-row .chip-btn:not(.active) {
  opacity: 0.72;
}

.chip-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

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

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

.chip-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.field input,
.field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-inset);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-base);
  line-height: var(--leading-snug);
  resize: vertical;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.field input::placeholder,
.field textarea::placeholder { color: var(--ink-muted); }

.field-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-tag.required {
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.field-tag.recommended {
  color: var(--ink-secondary);
  background: var(--surface-inset);
  border: 1px solid var(--line);
}

.field-tag.optional {
  color: var(--ink-muted);
  background: var(--surface-inset);
  border: 1px solid var(--line);
}

.chip-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  cursor: pointer;
  text-align: center;
  line-height: 1.3;
  white-space: normal;
  word-break: keep-all;
  transition: border-color var(--ease), background var(--ease), color var(--ease);
}

.chip-btn:hover {
  border-color: var(--line-strong);
  background: var(--surface-muted);
}

.chip-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

/* Industry options */
.option-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  text-align: left;
  min-height: 40px;
  transition: border-color var(--ease), background var(--ease), color var(--ease);
}

.option-btn:hover {
  border-color: var(--line-strong);
  background: var(--surface-muted);
}

.option-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 600;
}

.option-icon {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-inset);
  border-radius: 5px;
  flex-shrink: 0;
  color: var(--ink-secondary);
}

.option-icon .icon svg { width: 15px; height: 15px; }

.option-btn.active .option-icon {
  background: var(--accent);
  color: var(--accent-ink);
}

/* Template note */
.template-note {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.template-note summary {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.template-note summary::-webkit-details-marker { display: none; }
.template-note summary::before {
  content: '▸ ';
  display: inline-block;
  transition: transform 0.15s;
}
.template-note[open] summary::before { transform: rotate(90deg); }

.template-body {
  margin-top: 8px;
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  line-height: var(--leading-body);
}

.template-line { margin-bottom: 6px; }
.template-line:last-child { margin-bottom: 0; }
.template-line strong { font-weight: 600; color: var(--ink); }

.tag-inline { display: inline; color: var(--ink-muted); }
.tag-inline + .tag-inline::before { content: ' · '; }

.industry-toolbar { margin-bottom: 8px; }
.industry-search {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  background: var(--surface);
  color: var(--ink);
}
.industry-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

.industry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 4px;
}

.skill-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 8px 0;
}
.skill-tab {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: var(--text-xs);
  color: var(--ink-secondary);
  cursor: pointer;
}
.skill-tab.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent);
  font-weight: 600;
}
.skill-summary {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  line-height: var(--leading-body);
}
.skill-list {
  margin: 0;
  padding-left: 1.1em;
  font-size: var(--text-sm);
  color: var(--ink-secondary);
}
.skill-list li { margin-bottom: 4px; }
.skill-list li:last-child { margin-bottom: 0; }

.product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.trends-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  vertical-align: middle;
}
.trends-badge-industry {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
}
.trends-badge-ai {
  background: color-mix(in srgb, #7c3aed 15%, transparent);
  color: #7c3aed;
}

.trends-ai-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.trends-ai-block h4 {
  margin: 0 0 8px;
  font-size: var(--text-sm);
  color: var(--ink);
}

.industry-insight {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 15%, var(--border));
  font-size: var(--text-sm);
}
.insight-line { margin: 0; color: var(--ink-secondary); line-height: 1.5; }
.insight-tag {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
  font-weight: 600;
  font-size: var(--text-xs);
}
.insight-warns {
  margin: 6px 0 0;
  padding-left: 1.1em;
  color: var(--warn, #b45309);
  font-size: var(--text-xs);
}
.insight-ok {
  margin: 6px 0 0;
  color: var(--ok, #059669);
  font-size: var(--text-xs);
}

.doc-extras-wrap {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.doc-extras-label {
  margin: 0 0 8px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.doc-extra {
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}

.doc-compliance {
  color: var(--text-muted);
  font-size: var(--text-sm);
  background: var(--surface-muted);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

.validate-industry-tag {
  display: inline-block;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
  vertical-align: middle;
}

.topbar-more {
  display: none;
  position: relative;
}
.topbar-more summary {
  list-style: none;
  cursor: pointer;
}
.topbar-more summary::-webkit-details-marker { display: none; }
.topbar-more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  min-width: 120px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,.08));
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.topbar-more-menu .btn {
  width: 100%;
  justify-content: flex-start;
}

/* Platform grid */
.platform-picker {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.platform-line {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.platform-line-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 0 2px;
}

.platform-line-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--accent);
  flex-shrink: 0;
}

.platform-line-icon .icon svg {
  width: 16px;
  height: 16px;
}

.platform-line-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.platform-line-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.platform-line-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.platform-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.platform-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font: inherit;
  text-align: center;
  min-height: 80px;
  transition: border-color var(--ease), background var(--ease), transform var(--ease);
}

.platform-btn:hover {
  border-color: var(--line-strong);
  background: var(--surface-muted);
  transform: translateY(-1px);
}

.platform-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.platform-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.platform-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  border: none;
  box-shadow: none;
}

.platform-logo img {
  width: 32px;
  height: 32px;
  display: block;
  object-fit: contain;
  border: none;
  box-shadow: none;
}

.doc-badge .platform-logo img {
  width: 24px;
  height: 24px;
}

.platform-icon .icon svg { width: 17px; height: 17px; }

.platform-label {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  align-items: center;
}

.platform-name {
  font-size: var(--text-sm);
  color: var(--ink);
  font-weight: 500;
  line-height: 1.3;
}

.platform-btn.active .platform-name {
  color: var(--ink);
  font-weight: 500;
  line-height: 1.3;
}

.platform-type {
  font-size: var(--text-xs);
  color: var(--ink-muted);
  line-height: 1.3;
}

/* ── Main panel ── */
.main-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: color-mix(in srgb, var(--surface) 88%, var(--canvas));
  transition: box-shadow 0.3s ease;
}

.main-panel.is-focused {
  box-shadow: inset 3px 0 0 var(--accent);
}

.main-sticky {
  position: sticky;
  top: 0;
  z-index: 5;
  flex-shrink: 0;
  background: var(--surface);
}

.main-head {
  flex-shrink: 0;
  padding: 14px clamp(16px, 2vw, 28px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.main-head h2 {
  font-size: var(--text-md);
  font-weight: 600;
}

.output-meta {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  margin-top: 3px;
}

.main-head-tools {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.main-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(16px, 2vw, 28px);
}

.main-foot {
  flex-shrink: 0;
  padding: 10px clamp(16px, 2vw, 28px);
  border-top: 1px solid var(--line);
  background: var(--surface);
  font-size: var(--text-xs);
  color: var(--ink-muted);
  text-align: center;
}

/* Output empty */
.output-empty {
  height: 100%;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 55%, white), var(--surface));
  border: 1px dashed var(--line-strong);
  border-radius: calc(var(--radius) + 2px);
  padding: 28px 20px;
  position: relative;
  overflow: hidden;
}

.output-empty::before {
  content: "";
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: var(--accent);
  box-shadow: 0 10px 24px rgba(13, 148, 136, 0.28);
  /* pen mark */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20h4l10.5-10.5a2.828 2.828 0 1 0-4-4L4 16v4'/%3E%3Cpath d='M13.5 6.5l4 4'/%3E%3C/svg%3E") center / 26px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20h4l10.5-10.5a2.828 2.828 0 1 0-4-4L4 16v4'/%3E%3Cpath d='M13.5 6.5l4 4'/%3E%3C/svg%3E") center / 26px no-repeat;
}

.empty-title {
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 6px;
}

.empty-desc {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  max-width: 320px;
  line-height: var(--leading-body);
  margin-bottom: 16px;
}

.progress-bar {
  padding: 10px clamp(16px, 2vw, 28px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.progress-track {
  height: 4px;
  background: var(--surface-inset);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--cta));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  margin-top: 6px;
}

.output-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  width: 100%;
}

/* Platform output cards */
.platform-doc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  transition: border-color var(--ease), box-shadow var(--ease);
}

.platform-doc:hover {
  border-color: var(--line-strong);
  box-shadow: 0 8px 24px rgba(19, 78, 74, 0.06);
}

.doc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.doc-head h3 { flex: 1; min-width: 80px; }

.doc-head-tools {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.doc-status {
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

.doc-skeleton {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.platform-doc.is-loading { opacity: 0.85; }

.platform-error .error-msg {
  font-size: var(--text-sm);
  color: var(--danger);
  padding: 12px;
  background: #fef2f2;
  border-radius: 6px;
}

.doc-badge {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-secondary);
  flex-shrink: 0;
  overflow: hidden;
}

.doc-badge .platform-logo img {
  width: 24px;
  height: 24px;
}

.doc-badge .icon svg { width: 16px; height: 16px; }

.doc-head h3 {
  font-size: var(--text-md);
  font-weight: 600;
  line-height: var(--leading-tight);
}

.doc-section { margin-bottom: 14px; }
.doc-section:last-child { margin-bottom: 0; }

.doc-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 8px;
}

.section-tools {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.btn-regen-section {
  padding: 3px 8px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--ink-muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}

.btn-regen-section:hover:not(:disabled) {
  color: var(--ink);
  border-color: var(--accent);
}

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

.doc-section-head h4 {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.doc-text {
  font-size: var(--text-base);
  line-height: var(--leading-body);
  white-space: pre-wrap;
  word-break: break-word;
}

.title-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.title-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--text-base);
  line-height: var(--leading-snug);
}

.title-list .title-text { flex: 1; min-width: 0; }

.btn-copy-title {
  flex-shrink: 0;
  padding: 2px 8px;
  font-size: var(--text-xs);
  color: var(--ink-muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}

.btn-copy-title:hover {
  color: var(--ink);
  border-color: var(--accent);
}

.title-list li:last-child { border-bottom: none; }

.title-list .num {
  flex-shrink: 0;
  width: 20px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.hook-line {
  padding: 12px 14px;
  background: var(--surface-inset);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: var(--text-base);
  line-height: var(--leading-body);
}

.cover-line {
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 14px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-inset);
}

.hash-list { display: flex; flex-wrap: wrap; gap: 6px; }

.hash-item {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  background: var(--surface-inset);
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: var(--text-base);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--ease), color var(--ease), border-color var(--ease), transform 100ms ease, box-shadow var(--ease);
}

.btn-sm { padding: 7px 12px; font-size: var(--text-sm); min-height: 34px; }

.btn-submit {
  width: 100%;
  padding: 13px 16px;
  min-height: 46px;
  background: var(--cta);
  color: var(--cta-ink);
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 18px rgba(234, 88, 12, 0.22);
}

.btn-submit:hover:not(:disabled) {
  background: var(--cta-hover);
  box-shadow: 0 10px 22px rgba(234, 88, 12, 0.28);
}

.btn-submit:active:not(:disabled) { transform: scale(0.99); }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.btn-submit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--cta-ring), 0 8px 18px rgba(234, 88, 12, 0.22);
}

.btn-ghost {
  background: var(--surface);
  color: var(--ink-secondary);
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  background: var(--surface-muted);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-copy {
  padding: 3px 10px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--ink-muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}

.btn-copy:hover { color: var(--ink); border-color: var(--accent); }

.spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

.spinner.dark {
  border-color: rgba(15, 23, 42, 0.1);
  border-top-color: var(--accent);
}

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

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  opacity: 0;
  transition: transform 0.25s, opacity 0.25s;
  z-index: 100;
  pointer-events: none;
  box-shadow: 0 10px 28px rgba(19, 78, 74, 0.22);
}

.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.ok { background: var(--accent-hover); }
.toast.err { background: var(--danger); }

/* Modal */
.modal:not([open]) {
  display: none !important;
}

.modal[open] {
  display: block;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  padding: 0;
  max-width: 480px;
  width: calc(100% - 32px);
  max-height: calc(100vh - 32px);
  overflow: hidden;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-modal);
}

.modal::backdrop {
  background: rgba(19, 78, 74, 0.42);
  backdrop-filter: blur(2px);
}

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

.modal-head h3 {
  font-size: var(--text-md);
  font-weight: 600;
}

.modal-body {
  max-height: 50vh;
  overflow-y: auto;
  padding: 8px;
}

.modal-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  text-align: right;
}

.history-empty {
  padding: 24px;
  text-align: center;
  color: var(--ink-muted);
  font-size: var(--text-sm);
}

.history-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.history-item:hover {
  background: var(--surface-muted);
  border-color: var(--line);
}

.history-name {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--ink);
}

.history-meta {
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

.history-time {
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

/* ── Responsive ── */

/* Wide: wider sidebar + 2-col output */
@media (min-width: 1200px) {
  :root { --sidebar-w: 440px; }

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

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

  .output-list {
    grid-template-columns: repeat(2, 1fr);
    align-items: start;
  }
}

@media (min-width: 1400px) {
  :root { --sidebar-w: 460px; }
}

@media (min-width: 1600px) {
  :root { --sidebar-w: 420px; }
}

/* Tablet: stack vertically */
@media (max-width: 900px) {
  html, body { overflow: auto; }

  .app {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
  }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
    max-height: none;
  }

  .section-nav {
    position: sticky;
    top: 0;
    z-index: 6;
  }

  .sidebar-form { overflow: visible; }

  .sidebar-foot {
    position: sticky;
    bottom: 0;
    z-index: 5;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .main-panel { min-height: 60vh; }

  .main-body { overflow: visible; }

  .brand-text p { display: none; }

  .topbar {
    height: auto;
    min-height: var(--topbar-h);
  }

  .topbar-main {
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 8px;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-left: auto;
    gap: 8px;
  }

  .topbar-divider {
    display: none;
  }
}

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

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

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

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

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

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

  .topbar-main { padding: 0 12px; }

  .topbar-mobile-hide { display: none !important; }
  .topbar-more { display: block; }

  .form-section { padding: 14px 16px; --section-pad-x: 16px; }

  .main-body { padding: 12px; }
}

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

/* ── 套餐功能 UI ── */
.modal-wide {
  max-width: min(640px, 92vw);
  width: min(640px, 92vw);
  max-height: 85vh;
}

.modal-wide .modal-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  resize: vertical;
}

.quota-pill.quota-warn {
  background: var(--warn-soft);
  color: var(--warn-ink);
  border-color: #fdba74;
}

.account-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.account-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  background: var(--surface-muted);
  border-radius: 6px;
  font-size: var(--text-sm);
}

.account-item.account-full { grid-column: 1 / -1; }

.account-label {
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

.account-plan { font-weight: 600; }

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

.feature-hint {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  margin-bottom: 12px;
}

.account-loading {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  padding: 12px 0;
}

.account-warn {
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: var(--text-sm);
}

.project-list { display: flex; flex-direction: column; gap: 8px; }

.project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.project-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--text-sm);
}

.project-info span { color: var(--ink-muted); font-size: var(--text-xs); }

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

.calendar-list { display: flex; flex-direction: column; gap: 8px; }

.calendar-item {
  display: grid;
  grid-template-columns: 48px 80px 1fr auto;
  gap: 8px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: var(--text-sm);
}

.calendar-item .cal-topics {
  grid-column: 1 / -1;
}

.calendar-item [data-cal-apply],
.calendar-item .btn {
  grid-column: 1 / -1;
  justify-self: start;
  margin-top: 4px;
}

.feature-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.batch-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.check-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: var(--text-sm);
  background: var(--surface);
}

.check-cat {
  display: inline-block;
  align-self: flex-start;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-hover);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.5;
}

.check-text {
  margin: 0;
  line-height: 1.55;
  color: var(--ink-secondary);
}

.sub-item .project-info .key-mono {
  font-family: ui-monospace, monospace;
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

.calendar-item.soon {
  border-color: var(--line-strong);
  background: var(--surface-muted);
}

.cal-date { font-weight: 600; }
.cal-name { font-weight: 500; }
.cal-tip { color: var(--ink-muted); font-size: var(--text-xs); }
.cal-countdown { font-size: var(--text-xs); color: var(--ink-secondary); white-space: nowrap; }

.analysis-card h4 {
  font-size: var(--text-sm);
  font-weight: 600;
  margin: 14px 0 6px;
}

.analysis-card h4:first-child { margin-top: 0; }

.analysis-card ul {
  padding-left: 18px;
  font-size: var(--text-sm);
  color: var(--ink-secondary);
}

.checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.check-high { border-left: 3px solid var(--cta); }
.check-medium { border-left: 3px solid var(--accent); }
.check-low { border-left: 3px solid var(--line-strong); }

.check-tips {
  padding-left: 18px;
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  margin-bottom: 12px;
}

.ab-platform-pick {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.ab-pick {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  cursor: pointer;
}

.ab-results {
  margin-top: 16px;
}

.ab-compare-notes {
  padding: 12px 14px;
  margin-bottom: 14px;
  background: var(--surface-muted);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  line-height: var(--leading-body);
  color: var(--ink-muted);
}

.ab-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ab-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  display: flex;
  flex-direction: column;
}

.ab-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--line);
}

.ab-card-head h4 {
  font-size: var(--text-sm);
  font-weight: 600;
  margin: 0;
}

.ab-card .platform-doc-readonly {
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 14px 16px 16px;
}

.ab-card .platform-doc-readonly:hover {
  border-color: transparent;
  box-shadow: none;
}

/* A/B 对比弹窗 — 加宽加高，双栏并排阅读 */
.modal-ab[open] {
  display: flex;
  flex-direction: column;
}

.modal-ab {
  max-width: min(1180px, 96vw);
  width: min(1180px, 96vw);
  max-height: min(92vh, 900px);
}

.modal-ab .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding: 16px 20px 20px;
}

.modal-ab .ab-grid {
  gap: 16px;
}

.modal-ab .ab-card .platform-doc-readonly {
  padding: 16px 18px 18px;
}

.split-block {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.split-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface-muted);
  font-size: var(--text-sm);
}

.split-text {
  padding: 12px;
  font-size: var(--text-sm);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  font-family: inherit;
}

.case-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 8px;
}

.case-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.case-platform {
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

.case-hook {
  font-size: var(--text-sm);
  margin-bottom: 6px;
}

.case-result {
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

.main-head-tools {
  flex-wrap: wrap;
  gap: 4px;
}

/* Platform validation */
.platform-validate {
  margin: 0 16px 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-muted);
}

.platform-validate-ok {
  background: color-mix(in srgb, var(--accent-soft) 45%, white);
  border-color: color-mix(in srgb, var(--accent) 25%, var(--line));
}

.platform-validate-warn {
  background: #fffbeb;
  border-color: #fcd34d;
}

.platform-validate-error {
  background: #fef2f2;
  border-color: #fca5a5;
}

.validate-badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 700;
  margin-bottom: 6px;
}

.validate-badge.ok { color: var(--accent-hover); }
.validate-badge.warn { color: #b45309; }
.validate-badge.error { color: var(--danger); }

.validate-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--text-xs);
  color: var(--ink-secondary);
  line-height: 1.55;
}

.validate-list li {
  padding: 8px 0;
  border-top: 1px dashed color-mix(in srgb, var(--line) 80%, transparent);
}

.validate-list li:first-child {
  border-top: none;
  padding-top: 2px;
}

.validate-msg {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.5;
}

.validate-fix {
  margin: 4px 0 0;
  padding: 6px 8px;
  font-size: var(--text-xs);
  line-height: 1.5;
  color: var(--ink-muted);
  background: color-mix(in srgb, var(--surface) 70%, var(--accent-soft));
  border-radius: var(--radius-sm);
}

.validate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}

.validate-list li + li { margin-top: 0; }

.version-nav {
  margin: 0 16px 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent-soft) 35%, var(--surface));
  border: 1px dashed color-mix(in srgb, var(--accent) 25%, var(--line));
}

.version-nav-historical {
  background: #fffbeb;
  border-color: #fcd34d;
}

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

.version-nav-label {
  flex: 1;
  min-width: 120px;
  font-size: var(--text-xs);
  color: var(--ink-muted);
  text-align: center;
}

.btn-version-restore {
  margin-top: 6px;
  width: 100%;
  justify-content: center;
}

.doc-head-tools {
  flex-wrap: wrap;
  gap: 4px;
}

.check-item.check-rules {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 35%, white);
}

/* Trends panel */
.trends-panel {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}

.trends-note {
  font-size: var(--text-xs);
  color: var(--ink-muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

.trends-block + .trends-block { margin-top: 16px; }

.trends-block h4 {
  font-size: var(--text-sm);
  font-weight: 700;
  margin-bottom: 8px;
}

.trends-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.trends-apply {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font: inherit;
  transition: border-color var(--ease), background var(--ease);
}

.trends-apply:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 40%, white);
}

.trends-apply.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.trends-apply strong {
  display: block;
  font-size: var(--text-sm);
  color: var(--ink);
  margin-bottom: 2px;
}

.trends-apply span {
  font-size: var(--text-xs);
  color: var(--ink-muted);
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

/* ── 首次使用引导 ── */
.guide[hidden] {
  display: none !important;
}

.guide {
  position: fixed;
  inset: 0;
  z-index: 240;
}

body.guide-open {
  overflow: hidden;
}

.guide-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
}

.guide-spotlight {
  position: fixed;
  z-index: 241;
  border-radius: calc(var(--radius) + 2px);
  box-shadow: 0 0 0 9999px rgba(19, 78, 74, 0.48);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  pointer-events: none;
  transition: top var(--ease), left var(--ease), width var(--ease), height var(--ease);
}

.guide-card {
  position: fixed;
  z-index: 242;
  width: min(340px, calc(100vw - 32px));
  padding: 16px 16px 14px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-modal);
  transition: top var(--ease), left var(--ease), bottom var(--ease);
}

.guide-progress {
  font-size: var(--text-xs);
  color: var(--accent-hover);
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.guide-card h3 {
  font-size: var(--text-md);
  font-weight: 700;
  margin-bottom: 6px;
  line-height: var(--leading-tight);
}

.guide-card p#guideDesc {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  line-height: var(--leading-body);
  margin-bottom: 14px;
}

.guide-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.guide-target-pulse {
  position: relative;
  z-index: 3;
}

.btn-ghost.feature-locked,
.btn-ghost.btn-sm.feature-locked {
  opacity: 0.55;
  cursor: not-allowed;
  border-style: dashed;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.check-row input {
  margin-top: 3px;
  flex-shrink: 0;
}

.check-row .check-cat,
.check-row .check-text {
  display: inline;
}

.account-renew {
  margin: 12px 0 4px;
}

.account-renew .btn {
  width: 100%;
  justify-content: center;
}

@media (prefers-reduced-motion: reduce) {
  .guide-spotlight,
  .guide-card {
    transition: none;
  }
}

@media (max-width: 900px) {
  .ab-grid { grid-template-columns: 1fr; }
  .calendar-item { grid-template-columns: 1fr 1fr; }
  .account-grid { grid-template-columns: 1fr; }

  .guide-card {
    left: 16px !important;
    right: 16px;
    width: auto;
    bottom: max(16px, env(safe-area-inset-bottom));
    top: auto !important;
  }
}
