/* 纸鸢内容工作台 - 浅色主题 */
:root {
  --blue: #1A4FD6;
  --blue-dark: #143CA8;
  --blue-light: #EAF0FE;
  --ink: #1A1D24;
  --ink-2: #4A5060;
  --ink-3: #8A90A0;
  --line: #E5E8EF;
  --bg: #F5F7FB;
  --card: #FFFFFF;
  --green: #16A34A;
  --amber: #D97706;
  --red: #DC2626;
  --shadow: 0 2px 12px rgba(26, 40, 80, .06);
  --radius: 12px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

.app { display: flex; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--line);
}
.brand img { width: 46px; height: 46px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; gap: 2px; }
.brand-text strong { font-size: 15px; letter-spacing: .5px; }
.brand-text span { font-size: 9px; color: var(--ink-3); letter-spacing: 1px; }

.nav { padding: 16px 12px; flex: 1; overflow-y: auto; }
.nav-label {
  font-size: 11px;
  color: var(--ink-3);
  padding: 8px 10px 6px;
  letter-spacing: 1px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 8px;
  color: var(--ink-2);
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 2px;
  transition: all .15s;
  position: relative;
}
.nav-item svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}
.nav-item:hover { background: var(--bg); color: var(--ink); }
.nav-item.active { background: var(--blue-light); color: var(--blue); font-weight: 600; }
.badge {
  margin-left: auto;
  background: var(--red);
  color: white;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
}

.sidebar-foot { padding: 14px 20px; border-top: 1px solid var(--line); }
.site-link { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 12px; }
.site-link svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.site-link a { color: var(--ink-3); text-decoration: none; }
.site-link a:hover { color: var(--blue); }

/* ---------- 主内容 ---------- */
.main { flex: 1; min-width: 0; }
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar h1 { font-size: 20px; font-weight: 700; }
.topbar p { color: var(--ink-3); font-size: 13px; margin-top: 4px; }
.status-dot {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--green);
  background: #ECFDF3; padding: 6px 12px; border-radius: 20px;
}
.status-dot i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.status-dot.error { color: var(--red); background: #FEF2F2; }
.status-dot.error i { background: var(--red); }

.content { padding: 26px 32px; max-width: 1600px; }
.view { display: none; }
.view.active { display: block; }

/* ---------- 面板 ---------- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 20px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 16px; margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 16px; font-weight: 700; }
.hint { font-size: 12px; color: var(--ink-3); }
.head-actions { display: flex; gap: 10px; }

.create-grid { display: grid; grid-template-columns: 400px 1fr; gap: 20px; align-items: start; }
.result-panel { min-height: 640px; }
.result-body { min-height: 520px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 20px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 9px; color: var(--ink-2); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.input, .select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .15s;
}
.input:focus, .select:focus { border-color: var(--blue); }
.textarea { resize: vertical; line-height: 1.6; }
.field-note { font-size: 11px; color: var(--ink-3); margin-top: 7px; line-height: 1.5; }

.topic-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.topic-btn {
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink-2);
  font-family: inherit;
  transition: all .15s;
}
.topic-btn:hover { border-color: var(--blue); color: var(--blue); }
.topic-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }

.platform-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.platform-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
}
.platform-chip:has(input:checked) { border-color: var(--blue); background: var(--blue-light); color: var(--blue); }
.platform-chip input { accent-color: var(--blue); }
.chip-icon {
  width: 18px; height: 18px; border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
}
.chip-icon.xhs { background: #FF2442; }
.chip-icon.dy { background: #111; }
.chip-icon.x { background: #000; }
.chip-icon.fb { background: #1877F2; }
.chip-icon.ig { background: linear-gradient(135deg,#F58529,#DD2A7B,#8134AF); }

.radio-row { display: flex; flex-direction: column; gap: 9px; }
.radio-row label { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 0; cursor: pointer; }
.radio-row input { accent-color: var(--blue); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px;
  border: none; border-radius: 8px;
  font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: all .15s;
}
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.primary:disabled { background: #A8BCEC; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--ink-2); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn.small { padding: 7px 12px; font-size: 12px; }
.btn-block { width: 100%; }

.tip-box {
  background: var(--blue-light);
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 20px;
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.6;
}
.tip-box strong { color: var(--blue); display: block; margin-bottom: 4px; }
.tip-box p { margin: 0; }

/* ---------- 空状态 ---------- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; min-height: 400px;
  color: var(--ink-3); text-align: center;
}
.empty-state svg { width: 40px; height: 40px; stroke: #C8CDD8; fill: none; stroke-width: 1.2; margin-bottom: 14px; }
.empty-state p { font-size: 14px; color: var(--ink-2); margin-bottom: 6px; }
.empty-state span { font-size: 12px; }

/* ---------- 生成结果卡片 ---------- */
.result-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 14px;
  overflow: hidden;
}
.result-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: #FAFBFD;
  border-bottom: 1px solid var(--line);
}
.result-card-head .platform-name { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.result-card-body { padding: 16px; }
.result-text {
  white-space: pre-wrap;
  line-height: 1.75;
  font-size: 13px;
  color: var(--ink-2);
  background: #FAFBFD;
  border-radius: 8px;
  padding: 14px;
  max-height: 320px;
  overflow-y: auto;
}
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.image-row { display: flex; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.image-thumb {
  position: relative;
  width: 140px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.image-thumb img { width: 100%; height: 130px; object-fit: cover; display: block; }
.image-thumb .label {
  font-size: 11px; color: var(--ink-3);
  padding: 6px 8px;
  text-align: center;
  background: #FAFBFD;
}
.image-thumb a { text-decoration: none; }

.progress-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; font-size: 13px; color: var(--ink-2);
  border-bottom: 1px dashed var(--line);
}
.progress-item:last-child { border: none; }
.progress-item .spin {
  width: 14px; height: 14px;
  border: 2px solid var(--blue-light);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.progress-item.done .spin { border: none; width: 16px; height: 16px; animation: none; }
.progress-item.done .spin::after { content: '✓'; color: var(--green); font-weight: 700; }
.progress-item.error .spin { border: none; animation: none; color: var(--red); }
.progress-item.error .spin::after { content: '!'; color: var(--red); font-weight: 700; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 列表项 ---------- */
.item-list { display: flex; flex-direction: column; gap: 12px; }
.list-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  transition: border-color .15s;
}
.list-item:hover { border-color: #C9D5F5; }
.list-item-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.list-item-head .title { font-weight: 600; font-size: 14px; }
.list-item-meta { font-size: 11px; color: var(--ink-3); }
.list-item-text {
  font-size: 12px; color: var(--ink-2);
  line-height: 1.6;
  max-height: 66px; overflow: hidden;
  white-space: pre-wrap;
}
.list-item-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.tag.blue { background: var(--blue-light); color: var(--blue); }
.tag.green { background: #ECFDF3; color: var(--green); }
.tag.amber { background: #FFFBEB; color: var(--amber); }
.tag.gray { background: #F1F3F7; color: var(--ink-3); }
.tag.red { background: #FEF2F2; color: var(--red); }

.schedule-layout { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
.schedule-item {
  display: flex; align-items: flex-start; gap: 12px;
  border: 1px solid var(--line); border-radius: 9px;
  padding: 13px 15px;
}
.schedule-item.done { opacity: .55; }
.schedule-item input[type=checkbox] { margin-top: 3px; accent-color: var(--blue); width: 16px; height: 16px; }
.schedule-item .s-body { flex: 1; min-width: 0; }
.schedule-item .s-date { font-weight: 700; font-size: 14px; }
.schedule-item .s-note { font-size: 12px; color: var(--ink-2); margin-top: 5px; line-height: 1.5; }
.schedule-item.today { border-color: var(--amber); background: #FFFBF0; }

/* ---------- 统计 ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: #FAFBFD; border: 1px solid var(--line);
  border-radius: 10px; padding: 16px; text-align: center;
}
.stat-card .num { font-size: 26px; font-weight: 700; color: var(--blue); }
.stat-card .label { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.analytics-row {
  display: grid;
  grid-template-columns: 1fr 100px 100px 100px auto;
  gap: 10px; align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 12px 0; font-size: 13px;
}
.analytics-row.head { font-weight: 600; color: var(--ink-3); font-size: 12px; background: #FAFBFD; padding: 10px 12px; border-radius: 6px; border: none; }
.analytics-row input {
  width: 100%; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 6px;
  font-size: 12px; font-family: inherit;
}
.analytics-row .a-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.settings-panel { max-width: 680px; }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(16,24,40,.45); }
.modal-box {
  position: relative; background: #fff;
  border-radius: 14px; width: min(720px, 92vw);
  max-height: 86vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; }
.icon-btn { background: none; border: none; font-size: 24px; color: var(--ink-3); cursor: pointer; line-height: 1; }
.icon-btn:hover { color: var(--ink); }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; }
.modal-text { white-space: pre-wrap; line-height: 1.8; font-size: 13px; color: var(--ink-2); background: #FAFBFD; border-radius: 8px; padding: 16px; }
.modal-images { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.modal-images img { width: 200px; border-radius: 8px; border: 1px solid var(--line); }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #fff; border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: 8px; padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
  font-size: 13px; min-width: 220px;
  animation: slideIn .2s ease;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .create-grid, .schedule-layout { grid-template-columns: 1fr; }
  .sidebar { width: 190px; }
  .content { padding: 20px; }
  .topbar { padding: 16px 20px; }
}
@media (max-width: 700px) {
  .sidebar { width: 100%; height: auto; position: static; }
  .app { flex-direction: column; }
  .nav { display: flex; flex-wrap: wrap; }
  .nav-label, .sidebar-foot { display: none; }
  .nav-item { font-size: 12px; padding: 8px; }
  .analytics-row { grid-template-columns: 1fr 70px 70px 70px; }
}
