/* ── Tokens ────────────────────────────────────────────── */
:root {
  --bg:          #f0f2f5;
  --surface:     #ffffff;
  --surface-2:   #f8f9fb;
  --surface-3:   #f1f3f6;
  --ink:         #0d1117;
  --ink-2:       #24292f;
  --ink-3:       #444c56;
  --muted:       #6e7781;
  --line:        #d8dee4;
  --line-2:      #eaeef2;

  --brand:       #0b6e63;
  --brand-hover: #0a5f55;
  --brand-soft:  #e6f2f0;
  --brand-glow:  rgba(11,110,99,.18);

  --accent:      #c2410c;
  --accent-soft: #fff1ed;

  --sidebar-w:   240px;
  --sidebar-bg:  #0d1117;
  --sidebar-ink: rgba(255,255,255,.85);
  --sidebar-sub: rgba(255,255,255,.4);
  --sidebar-line: rgba(255,255,255,.08);
  --sidebar-hover: rgba(255,255,255,.07);
  --sidebar-active: rgba(255,255,255,.12);

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;

  --shadow-xs: 0 1px 2px rgba(13,17,23,.06);
  --shadow-sm: 0 1px 3px rgba(13,17,23,.08), 0 1px 2px rgba(13,17,23,.05);
  --shadow-md: 0 4px 8px -1px rgba(13,17,23,.08), 0 2px 4px -2px rgba(13,17,23,.05);
  --shadow-lg: 0 10px 20px -4px rgba(13,17,23,.1),  0 4px 8px -4px rgba(13,17,23,.06);
  --shadow-xl: 0 24px 40px -8px rgba(13,17,23,.14), 0 8px 16px -6px rgba(13,17,23,.06);

  --t-fast: 140ms cubic-bezier(.4,0,.2,1);
  --t-base: 220ms cubic-bezier(.4,0,.2,1);
  --t-slow: 360ms cubic-bezier(.4,0,.2,1);
}

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

body {
  font-family: "Inter", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  /* subtle dot grid */
  background-image: radial-gradient(circle, #c9d1d9 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── App shell ─────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(255,255,255,.06);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 18px;
  border-bottom: 1px solid var(--sidebar-line);
}

.brand-mark {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--brand), #14a090);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.5px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(11,110,99,.4);
}

.brand-name {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}
.brand-tagline {
  font-size: 11px;
  color: var(--sidebar-sub);
  line-height: 1.3;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  border-radius: var(--r-md);
  padding: 9px 10px;
  cursor: pointer;
  text-align: left;
  transition: background var(--t-fast);
  color: var(--sidebar-ink);
  text-decoration: none;
}
.nav-link-item { box-sizing: border-box; }
.nav-item:hover { background: var(--sidebar-hover); }
.nav-item.active { background: var(--sidebar-active); }

.nav-icon {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  background: rgba(255,255,255,.07);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--sidebar-ink);
  transition: background var(--t-fast);
}
.nav-item.active .nav-icon {
  background: var(--brand);
  box-shadow: 0 2px 8px var(--brand-glow);
}
.nav-icon svg { width: 16px; height: 16px; }

.nav-text { display: flex; flex-direction: column; gap: 1px; }
.nav-label {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,.9);
  line-height: 1.3;
}
.nav-desc {
  font-size: 11px;
  color: var(--sidebar-sub);
  line-height: 1.3;
}
.nav-item.active .nav-label { color: #fff; }

.nav-divider {
  height: 1px;
  background: var(--sidebar-line);
  margin: 8px 2px;
}

/* Upgrade nav item */
.nav-upgrade .nav-icon { background: rgba(194,65,12,.25); }
.nav-upgrade.active .nav-icon { background: var(--accent); }
.nav-upgrade .nav-label { color: #fca07a; }
.nav-upgrade.active .nav-label { color: #fca07a; }

/* Sidebar bottom — LLM settings */
.sidebar-settings {
  border-top: 1px solid var(--sidebar-line);
  padding: 8px;
}

/* ── Auth sidebar UI ────────────────────────────────── */
.auth-login-prompt { padding: 4px 0 8px; }
.auth-open-btn {
  display: flex; align-items: center; gap: 7px;
  width: 100%; padding: 9px 10px;
  background: var(--sidebar-hover); border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--r-md); color: var(--sidebar-ink); font-size: 13px;
  cursor: pointer; transition: background var(--t-fast);
}
.auth-open-btn:hover { background: var(--sidebar-active); }

.auth-user-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0 8px;
}
.auth-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.auth-user-meta { flex: 1; min-width: 0; }
.auth-user-email { display: block; font-size: 11.5px; color: var(--sidebar-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-user-type { display: inline-block; font-size: 10px; font-weight: 600; margin-top: 2px; padding: 1px 6px; border-radius: 20px; background: rgba(94,234,212,.18); color: #5eead4; }
.auth-signout { background: transparent; border: none; color: var(--sidebar-sub); font-size: 15px; cursor: pointer; padding: 4px; border-radius: 4px; flex-shrink: 0; }
.auth-signout:hover { color: var(--sidebar-ink); background: var(--sidebar-hover); }

/* ── Auth modal ─────────────────────────────────────── */
.auth-modal-box { max-width: 400px; }
.auth-tabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--surface-2); border-radius: var(--r-md); padding: 4px; }
.auth-tab { flex: 1; padding: 8px; border: none; background: transparent; border-radius: var(--r-sm); font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; transition: all var(--t-fast); }
.auth-tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs); }
.auth-field { margin-bottom: 14px; }
.auth-field label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-3); margin-bottom: 5px; }
.auth-field input { width: 100%; }
.auth-error { font-size: 13px; color: #dc2626; background: #fef2f2; border: 1px solid #fecaca; border-radius: var(--r-sm); padding: 8px 12px; margin-bottom: 12px; }
.auth-success { font-size: 13px; color: #065f46; background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: var(--r-sm); padding: 10px 14px; text-align: center; }
.auth-submit-btn { width: 100%; padding: 12px; background: linear-gradient(135deg, var(--brand), #14a090); color: #fff; border: none; border-radius: var(--r-md); font-size: 14px; font-weight: 600; cursor: pointer; margin-top: 4px; }
.auth-submit-btn:hover { opacity: .92; }
.auth-submit-btn:disabled { opacity: .5; cursor: not-allowed; }
.auth-footer-links { text-align: center; margin-top: 14px; }
.auth-link { background: transparent; border: none; color: var(--muted); font-size: 12.5px; cursor: pointer; text-decoration: underline; }
.auth-link:hover { color: var(--brand); }
.auth-disabled-note { font-size: 12px; color: var(--muted); text-align: center; margin-top: 12px; }

/* LLM 只读状态指示器 */
.llm-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--r-md);
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.status-checking { background: rgba(255,255,255,.3); }
.status-dot.status-ok       { background: #5eead4; box-shadow: 0 0 6px rgba(94,234,212,.5); }
.status-dot.status-error    { background: #f87171; }
.status-text { font-size: 12px; color: var(--sidebar-sub); }
.hint { font-size: 11px; color: var(--sidebar-sub); line-height: 1.5; margin-top: 2px; }

/* ── Main content ──────────────────────────────────────── */
.main-content {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: hidden;
}

/* ── Panel header ──────────────────────────────────────── */
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 28px 28px 0;
  margin-bottom: 20px;
}

.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.panel-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -.4px;
  line-height: 1.2;
  margin-bottom: 5px;
}

.panel-subtitle {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

/* ── Panel ─────────────────────────────────────────────── */
.panel {
  display: none;
  flex: 1;
  padding: 0 24px 28px;
  animation: fadeUp var(--t-slow) both;
}
.panel.active { display: flex; flex-direction: column; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Script panel overrides */
#panel-script { gap: 14px; }

.material-selection { display: grid; gap: 8px; }
.material-selection[hidden] { display: none; }
.material-selection-status,
.material-selection-meta,
.material-selection-hint { color: var(--muted); font-size: 12.5px; }
.material-selection-list { display: grid; gap: 6px; }
.material-selection-option { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 8px; align-items: baseline; margin: 0; color: var(--ink-3); }
.material-selection-option input { grid-row: span 2; margin-top: 4px; }
.material-selection-title { color: var(--ink); }
.material-selection-meta { grid-column: 2; line-height: 1.45; }
.material-selection-source { margin-top: 4px; }
.material-selection-source summary { cursor: pointer; color: var(--ink-3); font-size: 13px; }
.material-selection-free { padding-top: 8px; border-top: 1px solid var(--line-2); color: var(--ink); }

/* ── Creator workspace ───────────────────────────────── */
#panel-workspace { gap: 16px; }

.workspace-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  padding: 34px;
  min-height: 300px;
  background:
    linear-gradient(135deg, rgba(11,110,99,.96), rgba(8,61,57,.98)),
    var(--brand);
  border-radius: var(--r-xl);
  color: #fff;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.workspace-hero::after {
  content: '';
  position: absolute;
  width: 260px;
  height: 260px;
  right: 16%;
  top: -120px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(255,255,255,.04), 0 0 0 58px rgba(255,255,255,.025);
  pointer-events: none;
}

.workspace-hero-copy { position: relative; z-index: 1; max-width: 680px; }
.workspace-hero .eyebrow { color: rgba(255,255,255,.68); }
.workspace-hero .panel-title { color: #fff; font-size: clamp(25px, 3.2vw, 38px); max-width: 620px; }
.workspace-hero .panel-subtitle { color: rgba(255,255,255,.78); max-width: 560px; font-size: 15px; }

.workspace-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.workspace-actions .primary-action { background: #fff; color: var(--brand); }
.workspace-actions .primary-action:hover { background: #f3fffd; color: var(--brand-hover); }
.workspace-actions .secondary-action,
.workspace-actions .text-button { color: rgba(255,255,255,.88); border-color: rgba(255,255,255,.32); background: rgba(255,255,255,.08); }
.workspace-actions .secondary-action:hover,
.workspace-actions .text-button:hover { background: rgba(255,255,255,.16); color: #fff; }

.workspace-status {
  align-self: end;
  display: flex;
  gap: 12px;
  padding: 16px;
  border-left: 1px solid rgba(255,255,255,.2);
  position: relative;
  z-index: 1;
}
.workspace-status-dot { width: 9px; height: 9px; margin-top: 7px; border-radius: 50%; background: #fbbf24; box-shadow: 0 0 0 5px rgba(251,191,36,.16); flex-shrink: 0; }
.workspace-status-dot.ready { background: #5eead4; box-shadow: 0 0 0 5px rgba(94,234,212,.16); }
.workspace-status strong { display: block; color: #fff; font-size: 13px; }
.workspace-status p { margin-top: 3px; color: rgba(255,255,255,.68); font-size: 12px; line-height: 1.55; }

.workspace-next-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 4px 4px;
  border-bottom: 1px solid var(--line);
}
.workspace-next-step h2 { font-size: 19px; line-height: 1.3; margin: 4px 0 5px; }
.workspace-next-step p:not(.eyebrow) { color: var(--muted); font-size: 13px; max-width: 720px; }
.workspace-note { color: var(--muted); font-size: 12px; padding: 0 4px; }
.result-continue-btn { margin-top: 4px; align-self: flex-start; }

.inspiration-quick-start {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 1.15fr);
  gap: 24px;
  align-items: end;
  padding: 18px 20px;
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xs);
}
.inspiration-quick-copy h2 { font-size: 18px; line-height: 1.35; margin: 3px 0 4px; }
.inspiration-quick-copy p:not(.eyebrow) { color: var(--muted); font-size: 12.5px; line-height: 1.55; max-width: 560px; }
.inspiration-quick-controls { display: flex; flex-direction: column; align-items: stretch; gap: 7px; }
.inspiration-quick-input { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.inspiration-quick-input input { min-width: 0; }
.inspiration-field-hint,
.inspiration-connection-status { margin: 0; font-size: 11px; line-height: 1.5; }
.inspiration-field-hint { color: var(--muted); }
.inspiration-connection-status { color: var(--muted); }
.inspiration-connection-status[data-tone="ready"] { color: var(--brand); }
.inspiration-connection-status[data-tone="fallback"] { color: #8a6415; }
.inspiration-connection-status[data-tone="blocked"] { color: #b54736; }
.inspiration-quick-controls .text-button { align-self: flex-start; color: var(--brand); background: transparent; padding: 4px 0; font-size: 12px; }
.inspiration-quick-controls .text-button:hover { background: transparent; color: var(--brand-hover); box-shadow: none; }

/* ── Split ─────────────────────────────────────────────── */
.split {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 14px;
  flex: 1;
  min-height: 0;
}

/* ── Chat pane ─────────────────────────────────────────── */
.chat {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 560px;
}

.chat-box {
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

/* bubbles */
.bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: var(--r-lg);
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  animation: bubbleIn 200ms both;
}
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(4px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.assistant {
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-bottom-left-radius: 3px;
  color: var(--ink-2);
}
.user {
  align-self: flex-end;
  background: var(--ink);
  color: rgba(255,255,255,.92);
  border-bottom-right-radius: 3px;
  box-shadow: var(--shadow-sm);
}

/* input */
.input-row {
  padding: 12px 14px;
  border-top: 1px solid var(--line-2);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  background: var(--surface-2);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}

/* ── Shared form elements ──────────────────────────────── */
textarea, input, select, button { font: inherit; }

textarea, input[type=text], input[type=password], input[type=number], select {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: 9px 12px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
textarea:focus, input:focus, select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
textarea { resize: vertical; }

button {
  border: none;
  border-radius: var(--r-md);
  padding: 9px 16px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: background var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
  white-space: nowrap;
}
button:hover { background: var(--brand-hover); box-shadow: 0 4px 12px var(--brand-glow); }
button:active { transform: scale(.97); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

.ghost-btn {
  background: var(--surface);
  border: 1.5px solid var(--line);
  color: var(--muted);
  padding: 7px 16px;
  font-size: 13px;
  border-radius: 999px;
  font-weight: 500;
}
.ghost-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); box-shadow: none; }

/* ── Result aside ──────────────────────────────────────── */
.result {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.result-block { display: flex; flex-direction: column; gap: 10px; }

.topic-cards {
  display: grid;
  gap: 7px;
}

.topic-card {
  width: 100%;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 10px 11px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--ink-2);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}

.topic-card:hover {
  border-color: rgba(11,110,99,.35);
  background: var(--brand-soft);
  transform: translateY(-1px);
}

.topic-card.is-selected {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
  box-shadow: 0 0 0 2px rgba(11,110,99,.08);
}

.topic-card-index {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.topic-card.is-selected .topic-card-index {
  background: var(--brand);
  color: #fff;
}

.topic-card-text {
  min-width: 0;
  font-size: 12.5px;
  line-height: 1.5;
}

.topic-card-badge {
  color: var(--brand);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.result-title, .card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .06em;
}

pre {
  white-space: pre-wrap;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 14px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.75;
  color: var(--ink-3);
  flex: 1;
}

.used-assets {
  margin-top: 12px;
  border-top: 1px solid var(--line-2);
  padding-top: 12px;
}
.used-assets summary {
  color: var(--ink-3);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  list-style-position: outside;
}
.used-assets summary span { color: var(--muted); font-weight: 500; }
.used-asset-list { display: grid; gap: 0; margin-top: 10px; }
.used-asset-item {
  display: grid;
  gap: 5px;
  padding: 12px 0;
  border-top: 1px solid var(--line-2);
}
.used-asset-item:first-child { border-top: 0; }
.used-asset-kicker { color: var(--brand); font-size: 10px; font-weight: 700; letter-spacing: .06em; }
.used-asset-title { color: var(--ink-2); font-size: 13px; font-weight: 650; line-height: 1.5; }
.used-asset-summary, .used-asset-source { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.65; overflow-wrap: anywhere; }
.used-asset-link { width: fit-content; color: var(--brand); font-size: 11px; text-decoration: none; }
.used-asset-link:hover { text-decoration: underline; }

/* ── Hot topics ────────────────────────────────────────── */
.hot-search {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.hot-source-label { color: var(--muted); font-size: 12px; line-height: 1.4; }
.hot-search button { flex: 0 0 auto; padding: 9px 10px; font-size: 13px; }

.hot-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 260px;
  overflow-y: auto;
}
.hot-list li {
  flex-shrink: 0;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  color: var(--ink-3);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  cursor: default;
  transition: background var(--t-fast), border-color var(--t-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hot-list li:hover { background: var(--brand-soft); border-color: rgba(11,110,99,.2); }

/* ── Script layout ─────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.card label {
  display: block;
  margin: 12px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
}
.card label input,
.card label select,
.card label textarea { margin-top: 5px; font-size: 13.5px; }

.writing-output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.writing-output-actions,
.article-draft-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.writing-output-actions .ghost-btn,
.article-draft-actions .primary-action {
  padding: 6px 10px;
  font-size: 12px;
}

.writing-output-actions .primary-action {
  padding: 6px 10px;
  font-size: 12px;
}

.writing-feedback {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(20, 30, 28, 0.035);
}

.writing-feedback-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.writing-feedback p {
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
}

.writing-feedback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.writing-feedback[hidden] { display: none; }

@media (max-width: 640px) {
  .writing-feedback-header {
    flex: 1 1 100%;
    justify-content: space-between;
  }
}

.writing-output-status {
  color: var(--brand);
  font-size: 11px;
  white-space: nowrap;
}

.article-editor-shell {
  width: 100%;
}
.article-editor-shell[hidden] { display: none; }

.article-editor-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  border: 1px solid var(--line-2);
  border-bottom: 0;
  border-radius: var(--r-md) var(--r-md) 0 0;
  padding: 8px 10px;
  background: var(--surface-3);
}

.editor-tool {
  min-width: 30px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-3);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.editor-tool:hover,
.editor-tool:focus-visible {
  border-color: var(--brand);
  color: var(--brand);
}
.editor-tool-italic { font-style: italic; }
.editor-tool-divider {
  width: 1px;
  height: 22px;
  margin: 0 4px;
  background: var(--line);
}
.editor-version-label {
  color: var(--muted);
  font-size: 11px;
}
.article-version-select {
  max-width: 190px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-3);
  font: inherit;
  font-size: 11px;
}

.article-editor {
  width: 100%;
  min-height: 520px;
  display: block;
  border: 1px solid var(--line-2);
  border-radius: 0 0 var(--r-md) var(--r-md);
  padding: 14px;
  background: var(--surface-2);
  color: var(--ink-3);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.85;
  overflow-y: auto;
}
.article-editor[hidden] { display: none; }
.article-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}

.article-editor p,
.article-editor h2,
.article-editor h3,
.article-editor blockquote,
.article-editor ul,
.article-editor ol { margin: 0 0 12px; }
.article-editor h2 { font-size: 21px; line-height: 1.4; color: var(--ink); }
.article-editor h3 { font-size: 17px; line-height: 1.5; color: var(--ink); }
.article-editor blockquote {
  border-left: 3px solid var(--brand);
  padding-left: 12px;
  color: var(--muted);
}

.article-editor:focus {
  border-color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 3px rgba(11,110,99,.1);
}

.article-draft-actions {
  justify-content: space-between;
  margin-top: 10px;
}
.article-draft-actions[hidden] { display: none; }

.article-version-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.wechat-publishing-panel {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface-3);
}
.wechat-publishing-panel[hidden] { display: none; }
.wechat-publishing-heading,
.wechat-publishing-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.wechat-publishing-heading strong { color: var(--ink); }
.wechat-publishing-status { color: var(--muted); font-size: 12px; }
.wechat-publishing-status[data-tone="ready"] { color: var(--brand); }
.wechat-publishing-status[data-tone="blocked"] { color: #8a6415; }
.wechat-publishing-actions button:disabled { cursor: not-allowed; opacity: .55; }

.article-draft-actions .hint {
  margin: 0;
}

/* ── Blueprint card (script panel) ────────────────────── */
.blueprint-card { margin-bottom: 14px; }

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

.blueprint-status {
  font-size: 11px;
  color: var(--muted);
}

.blueprint-empty {
  color: var(--muted);
  font-size: 13.5px;
  padding: 8px 0;
  margin: 0;
}

.bp-local-rule-notice {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #d6a84b;
  border-radius: var(--r-md);
  color: #795714;
  background: #fff8e6;
  font-size: 12px;
  line-height: 1.6;
}

.bp-topic {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-2);
  line-height: 1.4;
}

.bp-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.bp-row {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: baseline;
  font-size: 13.5px;
}

.bp-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding-top: 1px;
}

.bp-val { color: var(--ink-3); line-height: 1.55; }

.bp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line-2);
  margin-top: 4px;
}

.bp-tag {
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px solid rgba(11,110,99,.18);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 500;
}

.bp-note {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--muted);
  padding: 8px 12px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
}

/* ── Portrait Library ──────────────────────────────────── */
/* ── 画像库 Modal ─────────────────────────────────────────────────────── */

.portrait-library-modal-box {
  max-width: 680px;
  padding: 28px 28px 24px;
}

.portrait-library-modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.portrait-library-count {
  font-size: 12px;
  color: var(--ink-3);
}

.portrait-library-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  max-height: 420px;
  overflow-y: auto;
}

.portrait-library-empty {
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
  padding: 32px 0;
}

.portrait-item {
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: default;
  transition: border-color .15s;
}

.portrait-item:hover {
  border-color: var(--ink-3);
}

.portrait-item--default {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 6%, var(--surface));
}

.portrait-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-1);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
}

.portrait-item-meta {
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portrait-item-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.portrait-action-btn {
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.portrait-action-btn:hover:not(:disabled) { background: var(--surface-2); }
.portrait-action-btn:disabled { opacity: .45; cursor: default; }

.portrait-action-btn.portrait-delete-btn {
  color: #c0392b;
  border-color: #f5c6c2;
}
.portrait-action-btn.portrait-delete-btn:hover:not(:disabled) {
  background: #fff0ee;
}

.portrait-default-badge {
  font-size: 11px;
  color: var(--brand);
  font-weight: 600;
  padding: 3px 6px;
}

/* ── Scrollbars ────────────────────────────────────────── */
.chat-box::-webkit-scrollbar,
.hot-list::-webkit-scrollbar,
.result::-webkit-scrollbar { width: 4px; }
.chat-box::-webkit-scrollbar-track,
.hot-list::-webkit-scrollbar-track,
.result::-webkit-scrollbar-track { background: transparent; }
.chat-box::-webkit-scrollbar-thumb,
.hot-list::-webkit-scrollbar-thumb,
.result::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }

/* ── Upgrade / Pricing ─────────────────────────────────── */
.founder-banner {
  background: linear-gradient(135deg, #07443b 0%, #0b6e63 55%, #16948a 100%);
  color: #fff;
  padding: 28px 28px 24px;
  border: none;
  box-shadow: var(--shadow-lg);
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}
.founder-banner::before {
  content: '';
  position: absolute;
  top: -80px; right: -50px;
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(255,255,255,.1) 0%, transparent 65%);
  border-radius: 50%;
}

.founder-badge {
  display: inline-block;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.founder-headline { font-size: 22px; font-weight: 700; margin-bottom: 14px; letter-spacing: -.2px; }
.founder-slots { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.slots-bar { flex: 1; height: 6px; background: rgba(255,255,255,.2); border-radius: 999px; overflow: hidden; }
.slots-bar-fill { height: 100%; background: linear-gradient(90deg, #fbbf24, #f59e0b); border-radius: 999px; transition: width .8s ease; }
.slots-label { font-size: 13px; opacity: .85; white-space: nowrap; }
.founder-desc { font-size: 13.5px; opacity: .82; line-height: 1.7; position: relative; z-index: 1; }

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.pricing-card {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--r-xl);
  padding: 28px 22px 22px;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t-base), transform var(--t-base);
}
.pricing-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.pricing-founder { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand), var(--shadow-md); }
.pricing-founder:hover { box-shadow: 0 0 0 2px var(--brand), var(--shadow-xl); }
.pricing-year { border-color: var(--accent); }

.pricing-tag {
  position: absolute; top: -11px; left: 20px;
  font-size: 11px; font-weight: 700;
  padding: 2px 11px; border-radius: 999px;
  letter-spacing: .05em; text-transform: uppercase;
}
.pricing-founder .pricing-tag { background: var(--brand); color: #fff; }
.pricing-year    .pricing-tag { background: var(--accent); color: #fff; }

.pricing-name { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 10px; }
.pricing-price { font-size: 44px; font-weight: 800; color: var(--ink); line-height: 1; letter-spacing: -2px; margin-bottom: 4px; }
.pricing-price span { font-size: 15px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.pricing-save { font-size: 12px; color: var(--accent); font-weight: 600; margin-bottom: 14px; }

.pricing-perks { list-style: none; flex: 1; display: flex; flex-direction: column; gap: 9px; margin: 14px 0 22px; }
.pricing-perks li {
  font-size: 13px; color: var(--ink-3);
  display: flex; align-items: center; gap: 8px;
}
.pricing-perks li::before {
  content: '';
  width: 16px; height: 16px; flex-shrink: 0; border-radius: 50%;
  background: var(--brand-soft);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.5 8L6.5 11L12.5 5' stroke='%230b6e63' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: contain;
}

.pricing-cta {
  width: 100%; padding: 12px; font-size: 13.5px; font-weight: 700;
  border-radius: var(--r-md); background: var(--brand); color: #fff;
  border: none; cursor: pointer; letter-spacing: .01em;
  transition: all var(--t-fast);
}
.pricing-cta:hover { background: var(--brand-hover); box-shadow: 0 6px 16px var(--brand-glow); transform: translateY(-1px); }
.pricing-cta-secondary { background: var(--surface-2); color: var(--muted); border: 1.5px solid var(--line); cursor: default; font-weight: 500; }
.pricing-cta-secondary:hover { background: var(--surface-2); box-shadow: none; transform: none; }

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

/* ── Modal ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(13,17,23,.6);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px;
  animation: fadeIn var(--t-fast) both;
}
.modal-overlay[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 32px 28px 28px;
  width: 100%; max-width: 420px;
  position: relative;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--line);
  animation: scaleIn var(--t-base) both;
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.94) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 28px; height: 28px;
  border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--muted); font-size: 13px; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t-fast);
}
.modal-close:hover { background: var(--line); color: var(--ink); box-shadow: none; transform: none; }

.modal-title { font-size: 19px; font-weight: 700; margin-bottom: 6px; }
.modal-hint { font-size: 13px; color: var(--muted); margin-bottom: 18px; line-height: 1.6; }
.modal-amount { text-align: center; font-size: 12.5px; color: var(--muted); padding: 8px 12px; background: var(--surface-2); border-radius: var(--r-sm); border: 1px solid var(--line); margin: 8px 0 18px; }

.qr-wrap { display: flex; justify-content: center; margin-bottom: 4px; }
.qr-img { width: 180px; height: 180px; object-fit: contain; border-radius: var(--r-md); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.qr-placeholder { width: 180px; height: 180px; border: 2px dashed var(--line); border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; text-align: center; font-size: 12px; color: var(--muted); line-height: 1.7; background: var(--surface-2); }

.modal-label { display: block; margin-bottom: 12px; font-size: 13.5px; font-weight: 500; }
.modal-label input { margin-top: 5px; font-weight: 400; }

#orderSubmitBtn { width: 100%; margin-top: 6px; padding: 13px; font-size: 14px; background: linear-gradient(135deg, var(--brand), #14a090); border-radius: var(--r-md); }
#orderSubmitBtn:hover { background: linear-gradient(135deg, var(--brand-hover), var(--brand)); }

.order-status { margin: 10px 0 0; font-size: 13px; text-align: center; min-height: 18px; }
.order-status.ok  { color: var(--brand); font-weight: 500; }
.order-status.err { color: var(--accent); }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 1100px) {
  :root { --sidebar-w: 200px; }
}

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

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    padding: 0;
  }
  .sidebar-brand { border-bottom: none; border-right: 1px solid var(--sidebar-line); padding: 12px 16px; }
  .sidebar-nav { flex-direction: row; flex: 1; padding: 8px; gap: 4px; overflow-x: auto; }
  .nav-item { flex-direction: column; padding: 8px 10px; gap: 4px; min-width: 64px; align-items: center; }
  .nav-text { align-items: center; }
  .nav-desc { display: none; }
  .nav-icon { width: 28px; height: 28px; }
  .sidebar-settings { display: none; }

  .split, .pricing-grid { grid-template-columns: 1fr; }
  .inspiration-quick-start { grid-template-columns: 1fr; gap: 14px; }
  .inspiration-quick-input { grid-template-columns: 1fr; }
  .workspace-hero { grid-template-columns: 1fr; padding: 24px; min-height: 0; }
  .workspace-hero::after { right: -100px; top: -90px; }
  .workspace-status { border-left: 0; border-top: 1px solid rgba(255,255,255,.2); padding: 16px 0 0; }
  .workspace-next-step { align-items: flex-start; flex-direction: column; }
  .panel-header { padding: 16px 16px 0; }
  .panel { padding: 0 12px 20px; }
  .chat { min-height: 440px; }
  .bubble { max-width: 90%; }
}

/* Legal footer */
.site-footer {
  margin: 22px 6px 4px;
  padding: 16px 14px 12px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 8px;
}

.site-footer-links a {
  color: var(--brand);
  text-decoration: none;
}

.site-footer-links a:hover {
  text-decoration: underline;
}

.site-footer-meta {
  margin-top: 2px;
}

.site-footer-note {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
}
