/* 公众号创作台 · 样式
 *
 * 设计规范（见《gzh-studio 界面设计方案》）：
 *   · 大留白骨架 + 墨绿作唯一强调色
 *   · 主色只用于：主按钮 / 当前步骤 / 选中态 / 焦点描边
 *   · 不用阴影（浮层除外）
 *   · 间距一律 4 的倍数
 */

:root {
  --c-primary: #2F6F4E;
  --c-primary-hover: #27593E;
  --c-primary-soft: #EAF3DE;
  --c-primary-text: #27500A;

  --t-1: #1F2328;
  --t-2: #6B7280;
  --t-3: #9CA3AF;
  --t-4: #B4B2A9;

  --line: #E6E8EC;
  --line-input: #E4E7EC;
  --line-btn: #D3D1C7;

  --bg-page: #FAFAF9;
  --bg-card: #FFFFFF;
  --bg-soft: #F8F9FA;
  --bg-hover: #F1F0EE;
  --bg-chip: #F1EFE8;

  --c-ok: #3B6D11;
  --c-warn: #854F0B;
  --c-err: #A32D2D;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 13px/1.6 -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--t-1);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--t-2); font-size: 12px; }
.grow { flex: 1; min-width: 0; }

.boot { display: flex; align-items: center; justify-content: center; height: 100vh; color: var(--t-3); }
.fatal {
  margin: 40px auto; max-width: 640px; padding: 16px 20px;
  background: #FCEBEB; border: 1px solid #F7C1C1; border-radius: var(--r-md); color: var(--c-err);
}

/* ---------------- 按钮 ---------------- */
.btn {
  padding: 7px 14px; border-radius: var(--r-sm);
  border: 1px solid transparent; font: inherit; font-size: 13px;
  cursor: pointer; white-space: nowrap;
  background: #fff; color: var(--t-1);
  transition: background .12s ease, border-color .12s ease;
}
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--c-primary); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--c-primary-hover); }
.btn.ghost { border-color: var(--line-btn); color: #374151; }
.btn.ghost:hover:not(:disabled) { border-color: var(--t-4); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.xs { padding: 3px 9px; font-size: 11px; }
.btn.block { width: 100%; }

/* ---------------- 表单 ---------------- */
input[type="text"], input[type="password"], textarea, select {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--line-input); border-radius: var(--r-sm);
  font: inherit; font-size: 13px; color: var(--t-1); background: #fff;
  outline: none; margin: 0;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 2px rgba(47, 111, 78, .13);
}
input::placeholder, textarea::placeholder { color: var(--t-4); }
textarea { resize: vertical; line-height: 1.75; font-family: ui-monospace, Consolas, "Microsoft YaHei", monospace; font-size: 12.5px; }

label { display: block; margin: 10px 0; font-size: 12px; color: var(--t-2); }
label input { margin-top: 5px; }
label.inline { display: inline-block; margin: 0; white-space: nowrap; }

/* ---------------- 登录 ---------------- */
.login-card {
  max-width: 380px; margin: 12vh auto; padding: 28px;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--r-md);
}
.login-card h1 { margin: 0 0 6px; font-size: 17px; font-weight: 500; }
.login-card p { margin: 0 0 16px; }
.msg { min-height: 18px; margin: 12px 0 0; font-size: 12px; color: var(--c-err); }

/* ---------------- 两栏骨架 ---------------- */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  flex: 0 0 260px; width: 260px;
  display: flex; flex-direction: column;
  background: var(--bg-page); border-right: 1px solid var(--line);
}
.sb-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
}
.sb-title { font-size: 15px; font-weight: 500; }
.sb-search { padding: 0 16px 10px; }
.sb-search input { font-size: 12px; }
.sb-list { flex: 1; overflow-y: auto; padding: 0 10px 10px; }
.sb-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 16px; border-top: 1px solid var(--line);
}

.item {
  display: block; width: 100%; text-align: left;
  padding: 9px 11px; margin-bottom: 4px;
  border: 1px solid transparent; border-radius: 8px;
  background: transparent; cursor: pointer; font: inherit;
}
.item:hover { background: var(--bg-hover); }
.item.active { background: var(--c-primary-soft); border-color: var(--c-primary); }
.item-title {
  display: block; font-size: 13px; font-weight: 500; color: var(--t-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item.active .item-title { color: var(--c-primary-text); }
.item-meta {
  display: flex; align-items: center; gap: 8px;
  margin-top: 5px; font-size: 11px; color: var(--t-2);
}
.badge {
  margin-left: auto; padding: 1px 8px; border-radius: 8px;
  font-size: 11px; line-height: 1.6;
  background: var(--bg-chip); color: #5F5E5A;
}
.badge.formatted { background: var(--c-primary-soft); color: var(--c-ok); }
.badge.illustrated { background: var(--c-primary); color: #fff; }

/* ---------------- 工作区 ---------------- */
.workspace {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  background: var(--bg-card); overflow: hidden;
}
.empty-state {
  margin: auto; text-align: center; color: var(--t-3);
}
.empty-state .empty-title { font-size: 14px; color: var(--t-2); margin: 0 0 6px; }

.ws-body { display: flex; flex-direction: column; height: 100%; overflow: hidden; }

.ws-head {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; border-bottom: 1px solid var(--line);
}
.title-input {
  flex: 1; min-width: 0; padding: 6px 8px;
  border: 1px solid transparent; background: transparent;
  font-size: 15px; font-weight: 500;
}
.title-input:hover { border-color: var(--line); }
.title-input:focus { background: #fff; }

.save-state {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--t-2); white-space: nowrap;
}
.save-state .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #639922; transition: background .12s ease;
}
.save-state.dirty { color: var(--c-warn); }
.save-state.dirty .dot { background: transparent; border: 1.5px solid var(--t-4); }
.save-state.saving { color: var(--t-2); }
.save-state.saving .dot { background: #EF9F27; }

/* ---------------- 步骤条 ---------------- */
.steps {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 10px 20px; border-bottom: 1px solid var(--line);
}
.step {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 14px 5px 7px;
  border: 1px solid transparent; border-radius: 20px;
  background: transparent; cursor: pointer; font: inherit; font-size: 13px;
  color: var(--t-2);
}
.step:hover { background: var(--bg-soft); }
.step-dot {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg-chip); color: var(--t-2);
  font-size: 12px; font-style: normal; font-weight: 500;
  transition: background .12s ease, color .12s ease;
}
.step.done { color: var(--c-ok); }
.step.done .step-dot { background: var(--c-primary-soft); color: var(--c-primary-text); }
.step.current { background: var(--c-primary-soft); color: var(--c-primary-text); font-weight: 500; }
.step.current .step-dot { background: var(--c-primary); color: #fff; }

/* ---------------- 步骤内容 ---------------- */
.pane { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px 20px; }

.row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.row-tight { display: flex; align-items: center; gap: 6px; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.split-col {
  display: flex; flex-direction: column; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: #fff; overflow: hidden;
}
.split-col.soft { background: var(--bg-soft); }
.col-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 12px; border-bottom: 1px solid var(--line);
  font-size: 12px; color: var(--t-2);
}
.col-head .hint { font-size: 11px; color: var(--t-4); }
.split-col textarea {
  border: none; border-radius: 0; height: 380px; resize: none;
  background: transparent;
}
.split-col textarea:focus { box-shadow: none; }
.preview { width: 100%; height: 380px; border: none; background: #fff; }

/* ---------------- 结构预览（中性样式，非最终） ---------------- */
.md-preview {
  height: 380px; overflow-y: auto; padding: 14px 16px;
  font-size: 13.5px; line-height: 1.85; color: #374151;
}
.md-preview h1 { font-size: 19px; margin: 0 0 14px; color: #111827; font-weight: 500; }
.md-preview h2 { font-size: 15.5px; margin: 22px 0 10px; color: #111827; font-weight: 500; }
.md-preview h3 { font-size: 14px; margin: 18px 0 8px; color: #111827; font-weight: 500; }
.md-preview p { margin: 0 0 12px; }
.md-preview blockquote {
  margin: 12px 0; padding: 8px 12px;
  border-left: 3px solid var(--line-btn); background: #fff; color: #5F5E5A;
}
.md-preview ul, .md-preview ol { margin: 0 0 12px; padding-left: 22px; }
.md-preview li { margin: 3px 0; }
.md-preview hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.md-preview code {
  padding: 1px 5px; border-radius: 4px; background: var(--bg-chip);
  font-family: ui-monospace, Consolas, monospace; font-size: 12px;
}
.md-preview strong { font-weight: 500; color: #111827; }
.md-preview .ph { color: var(--t-4); font-size: 13px; }

/* ---------------- 提示条 ---------------- */
.banner {
  margin: 12px 20px 0; padding: 10px 14px;
  background: #FAEEDA; border: 1px solid #FAC775; border-radius: 8px;
  font-size: 12px; line-height: 1.7; color: var(--c-warn);
}
.banner b { color: #633806; }

.lint { font-size: 12px; margin: 0 0 10px; }
.lint .ok { color: var(--c-ok); }
.lint .bad { color: var(--c-err); }
.lint ul { margin: 6px 0 0; padding-left: 20px; }

details { margin: 0 0 10px; font-size: 12px; color: var(--t-2); }
details summary { cursor: pointer; padding: 4px 0; }
details pre {
  margin: 6px 0 0; max-height: 240px; overflow: auto; padding: 10px;
  background: var(--bg-soft); border-radius: var(--r-sm);
  font-size: 11px; white-space: pre-wrap; color: #444441;
}

.log-wrap { margin-top: 14px; }
.log {
  max-height: 200px; overflow: auto; padding: 10px;
  background: #24272E; color: #CFD4DE; border-radius: var(--r-sm);
  font-size: 11.5px; white-space: pre-wrap; margin: 0;
  font-family: ui-monospace, Consolas, monospace;
}

/* ---------------- 配图卡 ---------------- */
.illus-item {
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 12px 14px; margin: 10px 0; background: #fff;
}
.illus-item h3 { margin: 0 0 8px; font-size: 13px; font-weight: 500; }
.illus-item .kv { font-size: 12px; color: #4B5563; margin: 3px 0; }
.illus-item .kv b { color: var(--t-1); font-weight: 500; }
.illus-item textarea { font-size: 11.5px; margin: 8px 0; background: #fff; }
.illus-item img { max-width: 220px; border-radius: var(--r-sm); border: 1px solid var(--line); margin-top: 8px; }
.illus-item .thumb-path { font-size: 11px; color: var(--t-3); margin-top: 6px; }

/* ---------------- 浮层提示 ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  max-width: 80vw; padding: 10px 16px; border-radius: 8px;
  background: #24272E; color: #fff; font-size: 13px; z-index: 100;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .16);
}
.toast.bad { background: #8A2424; }

/* ---------------- 窄屏降级（非手机适配） ---------------- */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar {
    flex: 0 0 auto; width: auto; max-height: 38vh;
    border-right: none; border-bottom: 1px solid var(--line);
  }
  .split { grid-template-columns: 1fr; }
  .split-col textarea, .md-preview, .preview { height: 260px; }
  .ws-head, .steps, .pane { padding-left: 14px; padding-right: 14px; }
  .banner { margin-left: 14px; margin-right: 14px; }
}
