/* ===========================================================
   content-center · 全局设计系统 (beautifului.dev 风格)
   低饱和中性底色 + 蓝色强调 + 圆角 + 柔和阴影 + 统一间距
   =========================================================== */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f3f4f6;
  --border: #e8eaed;
  --border-strong: #d7dbe0;
  --text: #1f2937;
  --text-strong: #0f172a;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --accent-border: #bfdbfe;
  --green: #059669;
  --green-soft: #d1fae5;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --shadow-md: 0 4px 12px rgba(16,24,40,.06), 0 2px 4px rgba(16,24,40,.04);
  --shadow-lg: 0 16px 40px rgba(16,24,40,.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}

/* ---------- 顶栏导航 ---------- */
.nav {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 56px; position: sticky; top: 0; z-index: 50;
}
.nav .brand {
  font-weight: 800; font-size: 15.5px; color: var(--accent); margin-right: 22px;
  display: flex; align-items: center; gap: 9px; letter-spacing: .2px;
}
.nav .brand .logo {
  width: 28px; height: 28px; border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 900;
  box-shadow: 0 2px 6px rgba(37,99,235,.35);
}
.nav a {
  color: var(--text-muted); text-decoration: none; padding: 8px 13px;
  border-radius: 9px; font-weight: 500; font-size: 13.5px; transition: .15s;
}
.nav a:hover { background: var(--accent-soft); color: var(--accent); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.nav .spacer { flex: 1; }
.nav .user { color: var(--text-faint); font-size: 13px; }

/* ---------- 右上角账户菜单（头像下拉） ---------- */
.nav-account { position: relative; margin-left: 6px; flex-shrink: 0; }
.nav-avatar {
  width: 34px; height: 34px; border-radius: 10px; border: none; cursor: pointer;
  background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; font-weight: 800; font-size: 14px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(37,99,235,.3);
  transition: filter .15s; font-family: inherit;
}
.nav-avatar:hover { filter: brightness(1.08); }
.nav-menu {
  position: absolute; right: 0; top: 44px; width: 210px; background: #fff;
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 6px; z-index: 100;
}
.nav-menu.hidden { display: none; }
.nav-menu-head { padding: 11px 12px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.nav-menu-name { font-weight: 700; color: var(--text-strong); font-size: 14px; display: flex; align-items: center; gap: 6px; }
.nav-menu-role { font-size: 11px; background: var(--accent-soft); color: var(--accent); padding: 1px 8px; border-radius: 8px; font-weight: 700; }
.nav-menu-sub { font-size: 11px; color: var(--text-faint); margin-top: 3px; }
.nav-menu-item { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: 9px; color: var(--text); text-decoration: none; font-size: 13.5px; cursor: pointer; }
.nav-menu-item:hover { background: var(--accent-soft); color: var(--accent); }
.nav-menu-item.danger { color: var(--red); }
.nav-menu-item.danger:hover { background: var(--red-soft); }

/* ---------- 容器 / 卡片 ---------- */
.container { max-width: 1080px; margin: 28px auto; padding: 0 24px; }
.card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 22px; margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.card h2 {
  font-size: 16px; margin-bottom: 16px; color: var(--text-strong);
  display: flex; align-items: center; gap: 8px; font-weight: 700;
}
.card h2::before {
  content: ''; width: 4px; height: 16px; border-radius: 3px;
  background: linear-gradient(180deg, #2563eb, #60a5fa); display: inline-block;
}
.card h3 { font-size: 14.5px; color: var(--text-strong); margin: 18px 0 10px; font-weight: 700; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px;
  border-radius: var(--radius-sm); border: none; cursor: pointer;
  font-size: 13.5px; font-weight: 600; text-decoration: none; transition: .15s;
  font-family: inherit;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(37,99,235,.25); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: #fff; color: var(--accent); border: 1px solid var(--accent-border); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 表单 ---------- */
.input, .textarea, .select {
  width: 100%; padding: 10px 13px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font-size: 14px; font-family: inherit;
  background: #fff; color: var(--text); transition: .15s;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { resize: vertical; min-height: 88px; line-height: 1.6; }
.label { display: block; font-size: 13px; color: var(--text-muted); margin: 14px 0 7px; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- 文章列表 ---------- */
.article-list .item {
  display: flex; align-items: center; gap: 12px; padding: 13px 6px;
  border-bottom: 1px solid var(--border); transition: .15s; border-radius: 8px;
}
.article-list .item:last-child { border-bottom: none; }
.article-list .item:hover { background: var(--surface-2); }
.article-list .title { flex: 1; font-weight: 600; color: var(--text-strong); }
.article-list .meta { color: var(--text-faint); font-size: 12px; }

/* ---------- 标签 ---------- */
.tag { display: inline-block; font-size: 11px; padding: 2px 9px; border-radius: 10px; font-weight: 600; }
.tag-draft { background: var(--surface-3); color: var(--text-muted); }
.tag-pushed { background: var(--green-soft); color: var(--green); }

.tip { font-size: 12px; color: var(--text-faint); margin-top: 8px; line-height: 1.6; }
.hidden { display: none !important; }

/* 统一 SVG 图标容器 */
.icon { display: inline-flex; align-items: center; justify-content: center; vertical-align: -2px; }
.icon svg { display: block; }
.icon + span { margin-left: 5px; }


/* ---------- Toast ---------- */
#toast {
  position: fixed; top: 66px; left: 50%; transform: translateX(-50%) translateY(-8px);
  background: var(--text-strong); color: #fff; padding: 10px 20px; border-radius: 11px;
  font-size: 13px; z-index: 999; opacity: 0; transition: opacity .2s, transform .2s;
  pointer-events: none; box-shadow: var(--shadow-md);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 登录 ---------- */
#login-wrap { max-width: 380px; margin: 80px auto; }
.login-title { font-size: 20px; font-weight: 800; text-align: center; margin-bottom: 24px; color: var(--text-strong); }
.login-title span { color: var(--accent); }

/* ===========================================================
   AI 写作页：文章卡片（对话流内）
   =========================================================== */
.article-card { padding: 16px 18px !important; max-width: 720px; width: 100%; }
.card-label { font-size: 12px; color: var(--text-muted); margin-bottom: 7px; font-weight: 600; }
.card-title { font-size: 17px; font-weight: 800; color: var(--text-strong); margin-bottom: 11px; line-height: 1.5; }
.card-cover { width: 100%; max-height: 220px; object-fit: cover; border-radius: 10px; display: block; margin-bottom: 11px; background: var(--surface-3); }
.card-cover-empty { height: 84px; display: flex; align-items: center; justify-content: center; color: var(--text-faint); font-size: 13px; background: var(--surface-2); }
.card-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 13px; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 进度 spinner */
.spin {
  display: inline-block; width: 14px; height: 14px; border: 2px solid var(--accent);
  border-top-color: transparent; border-radius: 50%; animation: sp .8s linear infinite;
  vertical-align: -2px; margin-right: 8px;
}
@keyframes sp { to { transform: rotate(360deg); } }
.prog-text { font-size: 13px; color: var(--text-muted); }

/* 顶部持久化状态指示 */
.save-status { font-size: 11px; color: #10b981; margin-left: 12px; opacity: .7; transition: opacity .3s; }
.save-status.flash { opacity: 1; color: var(--green); font-weight: 700; }

/* 容器总宽（chat 页略窄一点） */
.chat-wrap { max-width: 800px; margin: 0 auto; }
