/* =========================================================
 * CrossPost 设计系统
 * 深色优先，紫罗兰强调色；浅色主题通过 body[data-theme] 切换
 * ======================================================= */

:root {
  --font-sans: "Inter", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  --bg: #0d0e14;
  --bg-soft: #12141d;
  --surface: #171923;
  --surface-2: #1d2030;
  --ink: #eef0f8;
  --ink-2: #b8bdd0;
  --muted: #7c8199;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);

  --accent: #8b7bff;
  --accent-strong: #6e56cf;
  --accent-ink: #f4f1ff;
  --accent-soft: rgba(139, 123, 255, 0.14);

  --good: #3dd68c;
  --good-soft: rgba(61, 214, 140, 0.14);
  --warn: #f0b34e;
  --warn-soft: rgba(240, 179, 78, 0.14);
  --bad: #ff6474;
  --bad-soft: rgba(255, 100, 116, 0.14);

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 6px 22px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

body[data-theme="light"] {
  --bg: #f4f5fa;
  --bg-soft: #eceef6;
  --surface: #ffffff;
  --surface-2: #f6f6fc;
  --ink: #191b2a;
  --ink-2: #454a63;
  --muted: #7a7f97;
  --line: rgba(20, 22, 46, 0.1);
  --line-strong: rgba(20, 22, 46, 0.2);

  --accent: #6e56cf;
  --accent-strong: #5a43b8;
  --accent-soft: rgba(110, 86, 207, 0.12);

  --good: #14835a;
  --good-soft: rgba(20, 131, 90, 0.12);
  --warn: #9a6a08;
  --warn-soft: rgba(154, 106, 8, 0.12);
  --bad: #c73a4d;
  --bad-soft: rgba(199, 58, 77, 0.1);

  --shadow: 0 18px 48px rgba(28, 31, 68, 0.12);
  --shadow-soft: 0 6px 20px rgba(28, 31, 68, 0.08);
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(1000px 500px at 85% -10%, var(--accent-soft), transparent 60%),
    var(--bg);
  transition: background-color 200ms ease, color 200ms ease;
}

::selection { background: var(--accent-soft); }

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.015em; }
p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ---------- 布局骨架 ---------- */

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 26px 18px;
  border-right: 1px solid var(--line);
  background: var(--bg-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  padding: 4px 6px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 18px;
  color: #fff;
  background: linear-gradient(135deg, #8b7bff, #5a43b8 70%);
  box-shadow: 0 8px 22px rgba(110, 86, 207, 0.45);
}

.brand-copy { display: flex; flex-direction: column; line-height: 1.25; }
.brand-copy strong { font-size: 16px; letter-spacing: -0.02em; }
.brand-copy small { color: var(--muted); font-size: 11.5px; }

/* 主页 ⇄ 发布台 切换（两个页面共用） */
.page-switch {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.page-switch a {
  flex: 1;
  text-align: center;
  white-space: nowrap;
  padding: 7px 18px;
  border-radius: 9px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  transition: all 140ms ease;
}
.page-switch a:hover { color: var(--ink); }
.page-switch a.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 4px 14px rgba(110, 86, 207, 0.35);
}

.side-nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  transition: background 140ms ease, color 140ms ease;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-icon { width: 18px; text-align: center; opacity: 0.9; }
.nav-count {
  margin-left: auto;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--muted);
}

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }

.ai-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--ink-2);
}
.ai-pill strong { margin-left: auto; font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.on { background: var(--good); box-shadow: 0 0 8px var(--good); }

.theme-toggle {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  transition: border-color 140ms ease, color 140ms ease;
}
.theme-toggle:hover { border-color: var(--line-strong); color: var(--ink); }

.main { padding: 34px 40px 120px; max-width: 1240px; }

/* ---------- 视图与头部 ---------- */

.view { display: none; }
.view.active { display: block; }

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.view-head h1 { font-size: 24px; }
.view-sub { color: var(--muted); margin-top: 6px; font-size: 13.5px; }

.stat-row { display: flex; gap: 12px; }
.stat-tile {
  min-width: 96px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-tile small { color: var(--muted); font-size: 11.5px; }
.stat-tile strong { font-family: var(--font-mono); font-size: 19px; letter-spacing: -0.02em; }

/* ---------- 卡片 ---------- */

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 22px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.card-head h2 { font-size: 16px; }
.card-desc { color: var(--muted); font-size: 13px; margin: -6px 0 16px; }
.card-desc code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 6px;
}

.tag {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--muted);
}
.tag.on { background: var(--good-soft); color: var(--good); }

/* ---------- 编辑器 ---------- */

.compose-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
  gap: 18px;
  align-items: start;
}

.autosave-hint { font-size: 11.5px; color: var(--muted); transition: color 200ms ease; }
.autosave-hint.saved { color: var(--good); }

[hidden] { display: none !important; }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.field-label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.field-note { font-style: normal; font-weight: 500; color: var(--muted); margin-left: 6px; }

.field input,
.field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.65;
  transition: border-color 140ms ease, box-shadow 140ms ease;
  resize: vertical;
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.editor-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.strategy-picker { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.strategy-label { font-size: 12.5px; color: var(--muted); margin-right: 2px; }

.strategy-option { position: relative; }
.strategy-option input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.strategy-option span {
  display: inline-block;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  transition: all 140ms ease;
}
.strategy-option input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- 附件区 ---------- */

.attach-zone {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 140ms ease, background 140ms ease;
}
.attach-zone.dragging { border-color: var(--accent); background: var(--accent-soft); }

.attach-add {
  align-self: flex-start;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
}
.attach-add:hover { border-color: var(--accent); color: var(--accent); }

.attach-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.attach-grid:empty { display: none; }

.attach-thumb {
  position: relative;
  width: 86px;
  height: 86px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}
.attach-thumb img,
.attach-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-kind {
  position: absolute;
  left: 6px;
  top: 6px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
}
.attach-remove {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  opacity: 0;
  transition: opacity 120ms ease;
}
.attach-thumb:hover .attach-remove { opacity: 1; }
.attach-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
}

/* ---------- 敏感词 ---------- */

.word-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.word-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 99px;
}
.word-chip.replaced { background: var(--good-soft); color: var(--good); }
.word-chip.flagged { background: var(--bad-soft); color: var(--bad); }

mark.flag {
  background: var(--bad-soft);
  color: var(--bad);
  border-radius: 4px;
  padding: 0 2px;
  border-bottom: 1.5px dashed var(--bad);
}

.fit-badge.warn-badge { background: var(--warn-soft); color: var(--warn); }

.media-note { font-size: 12px; color: var(--muted); }
.media-warn { color: var(--warn); font-weight: 700; }

/* ---------- 发布流程附件 ---------- */

.flow-media {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
}
.flow-media-item {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.flow-media-item img,
.flow-media-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.flow-media-actions {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 120ms ease;
}
.flow-media-item:hover .flow-media-actions { opacity: 1; }
.flow-media-actions .mini-btn { padding: 4px 8px; font-size: 11px; background: var(--surface); }

.field select {
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--ink);
  font-size: 13.5px;
}
.field select:focus { outline: none; border-color: var(--accent); }

.ai-fallback-note {
  margin-top: 12px;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12.5px;
}

/* ---------- 平台选择 ---------- */

.platform-list { display: flex; flex-direction: column; gap: 9px; }

.platform-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--bg-soft);
  color: inherit;
  text-align: left;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}
.platform-item:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.platform-item.selected { border-color: var(--accent); background: var(--accent-soft); }

.platform-glyph {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 14px;
  flex: none;
}

.platform-copy { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.platform-copy strong { font-size: 13.5px; }
.platform-copy small { color: var(--muted); font-size: 11.5px; }

.platform-fit {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex: none;
}
.fit-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 99px;
}
.fit-badge.ok { background: var(--good-soft); color: var(--good); }
.fit-badge.over { background: var(--bad-soft); color: var(--bad); }
.platform-limit { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

.platform-check {
  width: 19px;
  height: 19px;
  border: 2px solid var(--line-strong);
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: transparent;
  flex: none;
  transition: all 140ms ease;
}
.platform-item.selected .platform-check {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

/* ---------- 平台预览 ---------- */

.preview-section { margin-top: 26px; }
.section-head { margin-bottom: 16px; }
.section-head h2 { font-size: 17px; }
.section-head p { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.preview-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview-head { display: flex; align-items: center; gap: 10px; }
.preview-head .platform-glyph { width: 30px; height: 30px; font-size: 12px; border-radius: 8px; }
.preview-head strong { font-size: 14px; }
.preview-head .preview-mode {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}

.meter { display: flex; flex-direction: column; gap: 5px; }
.meter-track {
  height: 6px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
  transition: width 220ms ease, background 220ms ease;
}
.meter.warn .meter-fill { background: var(--warn); }
.meter.over .meter-fill { background: var(--bad); }
.meter-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}
.meter-label .over-note { color: var(--bad); font-weight: 700; }
.meter-label .fit-note { color: var(--good); font-weight: 700; }

.preview-text {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow-y: auto;
  color: var(--ink-2);
}
.preview-text.title-line { font-weight: 700; color: var(--ink); max-height: none; }

.preview-strategy {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.preview-strategy select {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--ink);
  font-size: 12px;
}
.compressed-tag { color: var(--good); font-weight: 700; font-size: 11.5px; }

.premium-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.premium-toggle input { accent-color: var(--accent); cursor: pointer; }
.premium-toggle:has(input:checked) { color: var(--accent); }

.preview-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

.preview-empty, .history-empty {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 54px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}
.preview-empty.show { display: flex; }
.empty-glyph {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 20px;
  color: var(--accent);
}

/* ---------- 按钮 ---------- */

.primary-btn {
  padding: 11px 22px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 22px rgba(110, 86, 207, 0.35);
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}
.primary-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(110, 86, 207, 0.45); }
.primary-btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.ghost-btn, .mini-btn {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  transition: all 140ms ease;
}
.ghost-btn:hover, .mini-btn:hover { border-color: var(--line-strong); color: var(--ink); background: var(--surface-2); }

.mini-btn { padding: 7px 12px; font-size: 12px; }
.mini-btn.accent { border-color: transparent; background: var(--accent-soft); color: var(--accent); }
.mini-btn.accent:hover { background: var(--accent); color: #fff; }
.mini-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.icon-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }

/* ---------- 发布栏 ---------- */

.publish-bar {
  position: fixed;
  left: 264px;
  right: 24px;
  bottom: 20px;
  max-width: 1192px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  z-index: 30;
}
.publish-bar-info { display: flex; flex-direction: column; line-height: 1.4; }
.publish-bar-info strong { font-size: 13.5px; }
.publish-bar-info span { font-size: 12px; color: var(--muted); }

/* ---------- 发布流程弹窗 ---------- */

.publish-dialog {
  width: min(660px, calc(100vw - 40px));
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  padding: 0;
  box-shadow: var(--shadow);
}
.publish-dialog::backdrop { background: rgba(5, 6, 12, 0.62); backdrop-filter: blur(4px); }

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--line);
}
.dialog-head small { color: var(--accent); font-weight: 800; font-size: 10.5px; letter-spacing: 0.14em; }
.dialog-head h2 { font-size: 17px; margin-top: 3px; }

.flow-steps {
  display: flex;
  gap: 6px;
  padding: 16px 24px 0;
  flex-wrap: wrap;
}
.flow-step-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.flow-step-pill.current { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.flow-step-pill.done { border-color: transparent; background: var(--good-soft); color: var(--good); }
.flow-step-pill.skipped { text-decoration: line-through; opacity: 0.6; }

.flow-stage { padding: 18px 24px 24px; }

.flow-platform-head { display: flex; align-items: center; gap: 11px; margin-bottom: 13px; }
.flow-platform-head .platform-glyph { width: 34px; height: 34px; }
.flow-platform-head strong { font-size: 15px; }
.flow-platform-head small { display: block; color: var(--muted); font-size: 12px; }

.flow-text {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  padding: 13px 15px;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 8px;
  color: var(--ink-2);
}
.flow-text-label { font-size: 11.5px; font-weight: 700; color: var(--muted); margin: 10px 0 5px; }

.flow-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 16px; }
.flow-actions .spacer { flex: 1; }

.flow-done {
  text-align: center;
  padding: 26px 0 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.flow-done-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--good-soft);
  color: var(--good);
  font-size: 24px;
}

.dialog-note { margin-top: 14px; font-size: 12px; color: var(--muted); }

/* ---------- 发布记录 ---------- */

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

.history-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.history-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.history-time { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.history-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--ink-2);
}
.history-chip.published { background: var(--good-soft); color: var(--good); }
.history-chip.skipped { opacity: 0.55; }
.history-excerpt { font-size: 13px; color: var(--ink-2); }
.history-item .icon-btn { align-self: flex-end; }

/* ---------- 设置 ---------- */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 18px;
  align-items: start;
}
.settings-actions { display: flex; gap: 10px; margin-top: 6px; }

.limit-table { display: flex; flex-direction: column; }
.limit-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 110px;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.limit-row:last-child { border-bottom: 0; }
.limit-row .platform-glyph { width: 30px; height: 30px; font-size: 12px; border-radius: 8px; }
.limit-name { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.limit-name strong { font-size: 13px; }
.limit-name small { color: var(--muted); font-size: 11px; }
.limit-row input {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: right;
}
.limit-row input:focus { outline: none; border-color: var(--accent); }

/* ---------- 登录 / 账号 ---------- */

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(800px 420px at 50% -100px, var(--accent-soft), transparent 60%),
    color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
}
.auth-overlay[hidden] { display: none; }

.auth-card {
  width: min(400px, 100%);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px;
}

.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand strong { font-size: 17px; letter-spacing: -0.02em; }
.auth-brand small { display: block; color: var(--muted); font-size: 12px; }

.auth-tabs {
  display: flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
  margin-bottom: 18px;
}
.auth-tab {
  flex: 1;
  padding: 8px 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  transition: all 140ms ease;
}
.auth-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.auth-error { min-height: 18px; font-size: 12.5px; color: var(--bad); margin-bottom: 6px; }
.auth-submit { width: 100%; }

.account-pill .dot { flex: none; }
.account-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.logout-link {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  flex: none;
}
.logout-link:hover { color: var(--bad); }

/* ---------- Toast ---------- */

.toast-stack {
  position: fixed;
  right: 22px;
  top: 22px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  z-index: 100;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 600;
  animation: toast-in 240ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.toast.good { border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.toast.bad { border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.toast.out { opacity: 0; transform: translateX(12px); transition: all 240ms ease; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 响应式 ---------- */

@media (max-width: 1080px) {
  .compose-grid { grid-template-columns: 1fr; }
  .publish-bar { left: 264px; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 14px 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .side-nav { flex-direction: row; margin-left: auto; }
  .side-foot { margin: 0; flex-direction: row; }
  .ai-pill span { display: none; }
  .main { padding: 22px 18px 140px; }
  .publish-bar { left: 12px; right: 12px; }
  .stat-row { width: 100%; }
  .stat-tile { flex: 1; }
}

/* ======== 管理台 ======== */

.admin-table { overflow-x: auto; }
.admin-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th,
.admin-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.admin-table th { color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: 0.02em; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table code { font-family: var(--font-mono); font-size: 12px; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }
.admin-table .row-dim { color: var(--muted); }
.admin-table .ghost-btn { padding: 4px 10px; font-size: 12px; }

.invite-gen { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.invite-stepper {
  display: flex; align-items: center;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  overflow: hidden;
}
.invite-stepper input {
  width: 48px; padding: 9px 0; text-align: center;
  background: none; border: none; color: var(--ink); font: inherit; font-weight: 700;
  appearance: textfield; -moz-appearance: textfield;
}
.invite-stepper input::-webkit-outer-spin-button,
.invite-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.step-btn {
  width: 34px; padding: 9px 0; background: none; border: none;
  color: var(--muted); font-size: 15px; font-weight: 700; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.step-btn:hover { color: var(--accent); background: var(--accent-soft); }

.invite-fresh {
  background: var(--accent-soft); border: 1px dashed var(--accent);
  border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 14px;
}
.invite-fresh-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; font-size: 12.5px; color: var(--ink-2);
}
.invite-fresh-head strong { color: var(--accent); }
.invite-fresh-codes { display: flex; flex-wrap: wrap; gap: 8px; }
.invite-chip {
  font-family: var(--font-mono); font-size: 12.5px; font-weight: 700;
  padding: 6px 11px; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 8px; color: var(--ink); cursor: pointer;
  transition: border-color 0.15s, color 0.15s, transform 0.1s;
}
.invite-chip:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.invite-chip.copied { border-color: var(--good); color: var(--good); }
.invite-chip.copied::after { content: " ✓"; }

/* ======== 新手引导 / 使用指引 ======== */

.onboard-card {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  background: var(--accent-soft); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 14px 18px; margin-bottom: 18px;
}
.onboard-copy { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.onboard-copy strong { color: var(--ink); font-size: 14px; }
.onboard-actions { display: flex; gap: 8px; flex-shrink: 0; }

.ext-pill { position: relative; cursor: pointer; }
.ext-pill:hover { border-color: var(--line-strong); }

.pill-action {
  margin-left: auto; flex-shrink: 0;
  font-size: 11.5px; font-weight: 800; text-decoration: none; white-space: nowrap;
  color: var(--accent); background: var(--accent-soft);
  padding: 3px 9px; border-radius: 7px;
  transition: background 0.15s, color 0.15s;
}
.pill-action:hover { background: var(--accent); color: var(--accent-ink); }

.pill-tip {
  position: absolute; bottom: calc(100% + 10px); left: 0; width: 252px; z-index: 40;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 13px 15px;
  box-shadow: var(--shadow); font-size: 12px; line-height: 1.6; color: var(--ink-2);
  opacity: 0; visibility: hidden; transform: translateY(5px); pointer-events: none;
  transition: opacity 0.18s, transform 0.18s, visibility 0.18s;
  cursor: auto;
}
/* 隐形桥接条：填住气泡与胶囊之间 10px 的空隙，鼠标移过去不丢 hover */
.pill-tip::after {
  content: ""; position: absolute; top: 100%; left: 0; right: 0; height: 12px;
}
.ext-pill:hover .pill-tip, .ext-pill:focus-within .pill-tip {
  opacity: 1; visibility: visible; transform: none; pointer-events: auto;
}
@media (max-width: 860px) {
  /* 窄窗口下侧边栏变顶栏，气泡改为向下弹出，避免被视口裁剪 */
  .pill-tip { bottom: auto; top: calc(100% + 10px); transform: translateY(-5px); }
  .pill-tip::after { top: auto; bottom: 100%; }
}
.pill-tip strong { display: block; color: var(--ink); font-size: 12.5px; margin-bottom: 5px; }
.pill-tip p { margin: 0 0 8px; }
.pill-tip ol { margin: 0 0 8px; padding-left: 17px; display: flex; flex-direction: column; gap: 3px; }
.pill-tip code { font-family: var(--font-mono); font-size: 11px; background: var(--surface); padding: 1px 5px; border-radius: 5px; }
.pill-tip em { color: var(--muted); font-style: normal; font-size: 11.5px; }

.invite-gen-label { font-size: 13px; color: var(--ink-2); flex-shrink: 0; }

.guide-dialog { max-width: 620px; }
.guide-body {
  padding: 6px 24px 24px; overflow-y: auto; max-height: 68vh;
  display: flex; flex-direction: column; gap: 22px;
}
.guide-body h3 { font-size: 15px; margin-bottom: 10px; }
.guide-intro { font-size: 13.5px; color: var(--ink-2); line-height: 1.6; margin-bottom: 10px; }
.guide-steps {
  margin: 0; padding: 0; list-style: none; counter-reset: step;
  display: flex; flex-direction: column; gap: 10px;
}
.guide-steps li {
  counter-increment: step; display: flex; gap: 10px; align-items: baseline;
  font-size: 13.5px; color: var(--ink-2); line-height: 1.6;
}
.guide-steps li::before {
  content: counter(step);
  flex: 0 0 22px; height: 22px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-weight: 800; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  transform: translateY(4px);
}
.guide-steps strong, .guide-list strong { color: var(--ink); }
.guide-list { margin: 0; padding: 0 0 0 2px; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.guide-list li { font-size: 13.5px; color: var(--ink-2); line-height: 1.6; }
.guide-body a { color: var(--accent); font-weight: 600; }
.guide-body code {
  font-family: var(--font-mono); font-size: 12px;
  background: var(--surface-2); padding: 2px 6px; border-radius: 6px;
}
