:root {
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --primary-soft: #e0f2fe;
  --bg: #f0f9ff;
  --card: #ffffff;
  --text: #0c4a6e;
  --text-secondary: #475569;
  --muted: #64748b;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --danger: #ef4444;
  --ok: #0ea5e9;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(12, 74, 110, .06);
  --shadow-md: 0 4px 16px rgba(12, 74, 110, .09);
  --shadow-lg: 0 12px 40px rgba(12, 74, 110, .14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(160deg, #e0f2fe 0%, #f0f9ff 45%, #ecfeff 100%);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.hidden { display: none !important; }

button { font-family: inherit; cursor: pointer; }

/* ---------- 登录 ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #bae6fd 0%, #e0f2fe 50%, #ecfeff 100%);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: 18px;
  padding: 32px 28px;
  box-shadow: var(--shadow-lg);
}
.auth-card .brand { text-align: center; font-size: 20px; font-weight: 800; color: var(--primary); margin-bottom: 20px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 20px; }
.auth-logo { width: 40px; height: 40px; border-radius: 9px; }
.auth-brand-text { text-align: left; }
.auth-brand .brand { margin-bottom: 0; text-align: left; }
.auth-slogan { font-size: 12px; color: var(--muted); margin-top: 2px; }
.auth-tabs { display: flex; gap: 6px; background: var(--bg); border-radius: 10px; padding: 4px; margin-bottom: 22px; }
.auth-tab {
  flex: 1; border: none; background: transparent; padding: 9px;
  border-radius: 8px; font-size: 14px; color: var(--muted); font-weight: 600;
}
.auth-tab.active { background: #fff; color: var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

/* ---------- 登录身份选择 ---------- */
.role-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.role-options label.role-opt {
  display: flex; align-items: center; gap: 10px; border: 1px solid var(--border);
  border-radius: 9px; padding: 10px 12px; cursor: pointer; margin-bottom: 0;
}
.role-opt input[type="radio"] { width: auto; margin: 0; flex: 0 0 auto; }
.role-opt .ro-name { font-size: 14px; font-weight: 600; }
.role-opt .ro-desc { font-size: 12px; color: var(--muted); margin-left: auto; }

form label { display: block; margin-bottom: 14px; font-size: 13px; color: #334155; }
form input, form select, form textarea {
  width: 100%; margin-top: 6px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 9px; font-size: 14px;
  font-family: inherit; background: #fff; color: var(--text);
}
form input:focus, form select:focus, form textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}
form textarea { resize: vertical; min-height: 72px; line-height: 1.6; }
.pub-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
.publish-choice { display: flex; flex-direction: column; gap: 12px; }
.organize-box {
  background: #f0f9ff; border: 1px dashed #bae6fd; border-radius: 10px;
  padding: 12px; margin-bottom: 16px;
}
.organize-box textarea {
  width: 100%; min-height: 64px; border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; resize: vertical;
}
.organize-actions { display: flex; gap: 8px; margin-top: 8px; }
.organize-actions .primary { flex: 1; }

.primary {
  background: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 100%);
  color: #fff; border: none; border-radius: 10px;
  padding: 10px 18px; font-size: 14px; font-weight: 600;
  transition: box-shadow .15s ease, transform .12s ease, filter .15s ease;
}
.primary:hover { box-shadow: 0 6px 16px rgba(14, 165, 233, .4); filter: brightness(1.04); }
.primary:active { transform: translateY(1px); }
.primary.block { width: 100%; padding: 12px; margin-top: 4px; }
.primary.violet { background: linear-gradient(135deg, #22d3ee 0%, #06b6d4 100%); }
.primary.violet:hover { box-shadow: 0 6px 16px rgba(6, 182, 212, .4); }
.primary.orange { background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%); }
.primary.orange:hover { box-shadow: 0 6px 16px rgba(245, 158, 11, .4); }
.ghost {
  background: #fff; color: var(--text-secondary); border: 1px solid var(--border);
  border-radius: 10px; padding: 7px 12px; font-size: 13px;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.ghost:hover { color: var(--text); border-color: var(--border-strong); background: #f9fafb; }
.msg { min-height: 18px; margin: 12px 0 0; font-size: 13px; color: var(--danger); text-align: center; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; color: var(--primary); }
.topbar .brand span {
  background: linear-gradient(135deg, #0ea5e9, #06b6d4);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-logo { width: 30px; height: 30px; border-radius: 7px; flex: 0 0 auto; }
.top-right { display: flex; align-items: center; gap: 12px; }
.badge {
  font-size: 13px; color: #334155; background: var(--bg);
  padding: 5px 12px; border-radius: 999px;
}
.link { font-size: 13px; color: var(--primary); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ---------- 布局 ---------- */
.layout {
  display: grid; grid-template-columns: 1fr 280px; gap: 20px;
  max-width: 1200px; margin: 0 auto; padding: 20px 24px; align-items: start;
}
.content { min-width: 0; }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab {
  border: none; background: transparent; padding: 9px 20px; border-radius: 999px;
  font-size: 15px; font-weight: 600; color: var(--muted);
}
.tab.active { background: var(--primary); color: #fff; }

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; }
.toolbar input {
  flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: 9px;
  font-size: 14px; background: #fff;
}
.toolbar input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

/* ---------- 条状清单 ---------- */
.cards { display: flex; flex-direction: column; gap: 8px; }
.row-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 14px; cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.row-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.row-title {
  font-size: 14px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0; flex: 0 1 auto; max-width: 45%;
  display: flex; align-items: center; gap: 6px;
}
.row-sub { font-size: 12px; color: var(--muted); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip {
  font-size: 12px; padding: 4px 11px; border-radius: 999px; background: var(--primary-soft); color: var(--primary);
  font-weight: 500; letter-spacing: .2px;
}
.channel-chip.channel-shixue { background: #e0f2fe; color: #0284c7; }
.channel-chip.channel-xiejun { background: #ecfeff; color: #0891b2; }
.channel-filter { display: flex; gap: 8px; margin-bottom: 14px; }
.cf-chip {
  border: 1px solid var(--border); background: #fff; color: var(--muted);
  border-radius: 999px; padding: 6px 16px; font-size: 13px; font-weight: 600;
}
.cf-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.list-section { margin-bottom: 28px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title { margin: 0; font-size: 18px; font-weight: 800; color: #111827; }
.lists-row { display: flex; gap: 20px; align-items: flex-start; }
.lists-row .list-section { flex: 1; min-width: 0; margin-bottom: 0; }
@media (max-width: 860px) {
  .lists-row { flex-direction: column; }
  .lists-row .list-section { margin-bottom: 28px; }
}
.del-btn {
  background: transparent; border: 1px solid var(--border); color: var(--danger);
  border-radius: 7px; padding: 3px 10px; font-size: 12px;
}
.del-btn:hover { background: #fef2f2; border-color: #fecaca; }

.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 60px 0; font-size: 15px; }

/* ---------- 侧栏二维码 ---------- */
.sidebar { position: sticky; top: 80px; }
.qr-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; text-align: center;
}
.qr-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.qr-card img { width: 100%; max-width: 220px; border-radius: 8px; display: block; margin: 0 auto; }
.qr-fallback {
  width: 100%; max-width: 220px; aspect-ratio: 1; margin: 0 auto; border-radius: 8px;
  background: var(--bg); display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px;
}
.qr-note { font-size: 12px; color: var(--muted); margin: 12px 0 0; }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px;
  z-index: 100; overflow-y: auto;
}
.modal-box {
  background: #fff; border-radius: 16px; width: 100%; max-width: 560px;
  padding: 24px 26px; box-shadow: var(--shadow-lg);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-head button {
  border: none; background: transparent; font-size: 26px; line-height: 1; color: var(--muted);
}
.modal-head button:hover { color: var(--text); }

.detail-row { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid #f1f5f9; }
.detail-row .k { flex: 0 0 130px; color: var(--muted); font-size: 13px; }
.detail-row .v { flex: 1; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.form-actions .cancel { background: transparent; border: 1px solid var(--border); color: var(--muted); border-radius: 9px; padding: 10px 18px; font-size: 14px; }

/* ---------- 草稿箱 ---------- */
.drafts-list { display: flex; flex-direction: column; gap: 8px; }
.draft-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #f9fafb; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px;
}
.draft-main { min-width: 0; flex: 1; }
.draft-title { font-size: 14px; font-weight: 600; color: var(--text); }
.draft-tag { font-size: 11px; color: var(--primary); background: var(--primary-soft); border-radius: 999px; padding: 1px 8px; margin-left: 6px; }
.draft-meta { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.draft-actions { display: flex; gap: 8px; flex: 0 0 auto; }

/* ---------- toast ---------- */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 10px 20px; border-radius: 9px;
  font-size: 14px; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.25);
}

/* ---------- 个人中心 ---------- */
.profile-block { margin-bottom: 18px; }
.profile-block h4 { margin: 0 0 10px; font-size: 15px; }
.profile-status { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.profile-status.ok { color: var(--ok); }
.profile-block input[type="file"] { font-size: 13px; margin-bottom: 10px; }
.profile-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f1f5f9; }
.pi-title { font-size: 14px; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .qr-card img, .qr-fallback { max-width: 180px; }
}

@media (max-width: 600px) {
  .layout { padding: 12px; }
  .row-item { flex-wrap: wrap; align-items: center; gap: 4px 10px; }
  .row-title { max-width: none; flex: 1 1 auto; }
  .row-meta { flex: 1 1 100%; white-space: normal; overflow: visible; text-overflow: clip; font-size: 12px; color: #64748b; line-height: 1.5; }
  .section-head { flex-wrap: wrap; gap: 8px; }
  .toolbar { flex-wrap: wrap; }
}

/* ---------- 汇总海报（长图，html2canvas 截图） ---------- */
#posterRoot { position: fixed; left: -99999px; top: 0; z-index: -1; }
.poster {
  width: 250px; background: #f0f9ff;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #0f172a;
}
.poster-single { width: 480px; height: 720px; display: flex; flex-direction: column; }
.poster-single .poster-head { flex: 0 0 auto; padding: 12px 16px 14px; }
.poster-single .poster-logo { width: 24px; height: 24px; }
.poster-single .poster-brand { font-size: 14px; }
.poster-single .poster-slogan { font-size: 10px; }
.poster-single .poster-body { flex: 1 1 auto; overflow: hidden; display: flex; align-items: center; padding: 8px 16px; }
.poster-single .poster-foot { flex: 0 0 auto; margin: 0 16px 14px; padding: 10px; }
.poster-single .poster-qr { width: 64px; height: 64px; }
.poster-single .p-item { margin-bottom: 0; padding: 14px 16px; }
.poster-single .p-item-title { font-size: 22px; margin-bottom: 3px; }
.poster-single .p-item-company { font-size: 13px; margin-bottom: 6px; }
.poster-single .p-row { font-size: 14px; margin-top: 6px; }
.poster-head {
  background: linear-gradient(135deg, #7dd3fc, #0ea5e9);
  color: #fff; padding: 6px 8px 7px; text-align: center;
}
.poster-head-top { display: flex; align-items: center; justify-content: center; gap: 4px; }
.poster-logo { width: 12px; height: 12px; flex: 0 0 auto; object-fit: contain; border-radius: 3px; }
.poster-head-brand { text-align: left; }
.poster-brand { font-size: 8px; letter-spacing: 1px; font-weight: 700; opacity: .95; }
.poster-slogan { font-size: 6px; opacity: .8; margin-top: 1px; }
.poster-title { font-size: 11px; font-weight: 800; margin-top: 4px; }
.poster-date { font-size: 6px; opacity: .85; margin-top: 2px; }
.poster-body { padding: 7px 7px 2px; }
.p-item {
  background: #fff; border-radius: 6px; padding: 6px 6px; margin-bottom: 6px;
  box-shadow: 0 2px 5px rgba(14, 165, 233, .06);
}
.p-item-head { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; margin-bottom: 2px; }
.p-item-title { font-size: 10px; font-weight: 800; color: #ea580c; }
.p-item-company { font-size: 8px; color: #64748b; }
.p-channel { font-size: 7px; padding: 1px 5px; border-radius: 999px; font-weight: 600; margin-left: auto; }
.p-channel.shixue { background: #dbeafe; color: #2563eb; }
.p-channel.xiejun { background: #e0f2fe; color: #0284c7; }
.p-chips { display: flex; flex-wrap: wrap; gap: 3px; margin: 1px 0 3px; }
.p-chip {
  font-size: 7px; padding: 1px 5px; border-radius: 999px;
  background: #dbeafe; color: #2563eb; font-weight: 600;
}
.p-row { font-size: 8px; color: #334155; line-height: 1.5; margin-top: 2px; }
.p-row b { color: #2563eb; font-weight: 700; margin-right: 3px; }
.poster-foot {
  background: #fff; margin: 0 7px 7px; border-radius: 6px;
  padding: 6px; display: flex; align-items: center; gap: 6px;
  box-shadow: 0 2px 5px rgba(14, 165, 233, .06);
}
.poster-qr { width: 34px; height: 34px; border-radius: 4px; flex: 0 0 auto; object-fit: contain; }
.poster-foot-title { font-size: 8px; font-weight: 700; color: #111827; }
.poster-foot-sub { font-size: 6px; color: #64748b; margin-top: 1px; }
