/* 青禾笔记 —— 浅色主题，青禾绿点缀 */
:root {
  --primary: #10786B;
  --primary-dark: #0C6459;
  --primary-bright: #168C7D;
  --primary-light: #D7F2EE;
  --accent: #E9AD54;
  --accent-light: #FBF1E2;
  --accent-border: #EAD7B0;
  --text: #1A1A1A;
  --text-2: #6B7280;
  --bg: #F5F8F7;
  --card: #FFFFFF;
  --line: #E5E7EB;
  --danger: #C0392B;
  --radius: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
.hidden { display: none !important; }
.flex1 { flex: 1; }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 8px; padding: 6px 12px; font-size: 13px; cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { color: var(--primary); }
.btn-danger { border-color: #F2C4BD; color: var(--danger); background: #FDF6F5; }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-block { display: block; width: 100%; }
.icon-btn {
  border: none; background: transparent; font-size: 18px; cursor: pointer;
  color: var(--text-2); line-height: 1; padding: 2px 6px; border-radius: 6px;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }

/* ---------- 密码门 ---------- */
.gate {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0C6459 0%, #10786B 55%, #168C7D 100%);
}
.gate-card {
  width: 340px; background: var(--card); border-radius: 16px;
  padding: 36px 30px; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.gate-logo { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.gate-tip { color: var(--text-2); margin-bottom: 20px; font-size: 13px; }
#gate-pwd {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 15px; text-align: center; outline: none; margin-bottom: 12px;
}
#gate-pwd:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.gate-err { color: var(--danger); font-size: 12px; min-height: 18px; margin-bottom: 8px; }

/* ---------- 整体布局 ---------- */
.app { display: flex; height: 100vh; overflow: hidden; }
.side {
  width: 220px; flex-shrink: 0; background: var(--card);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  padding: 14px 12px;
}
.side-head { font-size: 16px; font-weight: 700; margin-bottom: 14px; padding-left: 4px; }
.side-foot { margin-top: auto; }
.doc-list { flex: 1; overflow-y: auto; margin-top: 10px; }
.doc-item {
  padding: 8px 10px; border-radius: 8px; cursor: pointer; margin-bottom: 2px;
  display: flex; align-items: center; gap: 8px;
}
.doc-item:hover { background: var(--bg); }
.doc-item.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.doc-item .doc-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-item .doc-del { visibility: hidden; }
.doc-item:hover .doc-del { visibility: visible; }
.doc-item .doc-time { font-size: 11px; color: var(--text-2); }

/* ---------- 主区 ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.doc-title {
  flex: 1; min-width: 160px; border: 1px solid transparent; background: transparent;
  font-size: 17px; font-weight: 700; padding: 6px 8px; border-radius: 8px; outline: none;
}
.doc-title:hover { background: var(--bg); }
.doc-title:focus { border-color: var(--primary); background: var(--card); box-shadow: 0 0 0 3px var(--primary-light); }
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search {
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
  font-size: 13px; width: 150px; outline: none;
}
.search:focus { border-color: var(--primary); }
.main-body { flex: 1; display: flex; min-height: 0; }

/* ---------- 大纲编辑区 ---------- */
.editor { flex: 1; overflow-y: auto; padding: 20px 24px 120px; min-width: 0; }
.row {
  display: flex; align-items: flex-start; gap: 6px;
  padding: 3px 8px; border-radius: 8px; border-left: 3px solid transparent;
}
.row:hover { background: var(--card); }
.row.selected { background: var(--primary-light); border-left-color: var(--primary); }
.bullet {
  width: 18px; height: 26px; flex-shrink: 0; cursor: pointer; position: relative;
}
.bullet::after {
  content: ""; position: absolute; left: 6px; top: 11px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--primary-bright);
}
.bullet.has-kids::after { background: var(--primary); box-shadow: 0 0 0 1px var(--primary-dark); }
.bullet.collapsed::after {
  background: var(--card); border: 2px solid var(--primary); width: 5px; height: 5px; left: 5px;
}
.txt {
  flex: 1; outline: none; min-height: 26px; line-height: 26px;
  padding: 0 4px; border-radius: 6px; word-break: break-word; white-space: pre-wrap;
}
.txt.empty::before { content: "输入内容，回车换行，Tab 分级"; color: #C0C7CF; }
.badge {
  font-size: 11px; padding: 2px 8px; border-radius: 10px; margin-top: 5px;
  flex-shrink: 0; font-weight: 600;
}
.badge.ty-认知引导 { background: var(--primary-light); color: var(--primary-dark); }
.badge.ty-行动引导 { background: var(--accent-light); color: #B47A2E; border: 1px solid var(--accent-border); }
.badge.ty-other { background: #EEF1F4; color: var(--text-2); }
.attr-flag { color: var(--accent); font-size: 11px; margin-top: 7px; flex-shrink: 0; }
.search-hl { background: #FFF3C4; border-radius: 3px; }

/* ---------- 详情面板 ---------- */
.detail {
  width: 300px; flex-shrink: 0; background: var(--card);
  border-left: 1px solid var(--line); padding: 14px 16px; overflow-y: auto;
}
.detail-head {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 700; margin-bottom: 8px;
}
.detail-path { font-size: 12px; color: var(--text-2); margin-bottom: 14px; line-height: 1.6; word-break: break-all; }
.f-label { display: block; font-size: 12px; color: var(--text-2); margin: 12px 0 4px; }
.f-area, .f-input {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  font-size: 13px; font-family: inherit; outline: none; resize: vertical;
}
.f-area { min-height: 64px; }
.f-area:focus, .f-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.detail-del { margin-top: 20px; width: 100%; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 90; background: rgba(15, 40, 36, .45);
  display: flex; align-items: center; justify-content: center;
}
.modal {
  width: 720px; max-width: 94vw; max-height: 88vh; overflow-y: auto;
  background: var(--card); border-radius: 14px; padding: 18px 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.modal-tip { font-size: 12px; color: var(--text-2); line-height: 1.7; margin-bottom: 10px; }
.import-text {
  width: 100%; height: 180px; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px; font-size: 12px; font-family: Consolas, monospace; outline: none; resize: vertical;
}
.import-text:focus { border-color: var(--primary); }
.import-cols {
  margin-top: 10px; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; font-size: 12px; max-height: 170px; overflow-y: auto;
}
.import-cols .col-head { margin-bottom: 4px; }
.import-cols .col-row { display: flex; align-items: center; gap: 14px; padding: 3px 0; border-bottom: 1px dashed #F0F2F4; }
.import-cols .col-row:last-child { border-bottom: none; }
.import-cols .col-name { font-weight: 600; min-width: 100px; }
.import-cols .col-hint { color: var(--text-2); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-cols .chk { flex-shrink: 0; }
.import-preview {
  margin-top: 10px; font-size: 12px; background: var(--bg); border-radius: 8px;
  padding: 10px 12px; line-height: 1.8; max-height: 160px; overflow-y: auto; white-space: pre-wrap;
}
.modal-foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.chk { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 4px; }

/* ---------- 提示条 ---------- */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 200;
  background: #2B3A37; color: #fff; padding: 9px 18px; border-radius: 10px;
  font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.toast.err { background: var(--danger); }

/* 窄屏 */
@media (max-width: 900px) {
  .side { width: 170px; }
  .detail { width: 240px; }
}
