/* 个人速记知识库 · 浅色清爽单栏样式（无深色模式，KISS） */

:root {
  --bg: #f6f6f3;
  --card: #ffffff;
  --line: #e4e3de;
  --line-soft: #efeeea;
  --text: #21201d;
  --muted: #79786f;
  --accent: #2f6b4f;
  --accent-soft: #edf4f0;
  --accent-line: #cfe2d8;
  --warn-bg: #fdf7e6;
  --warn-line: #eadcae;
  --warn-text: #7a6320;
  --danger: #a63a3a;
  --danger-soft: #fbeeee;
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC",
    "Hiragino Sans GB", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; }

/* ---------- 顶部 ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { font-weight: 600; letter-spacing: .02em; }
.top nav { display: flex; gap: 14px; align-items: center; font-size: 14px; }
.top nav button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  font-family: inherit;
}
.top nav button:hover { color: var(--danger); text-decoration: underline; }

.wrap { max-width: 820px; margin: 0 auto; padding: 20px; }

/* ---------- 备份提醒条 ---------- */
.banner {
  max-width: 820px;
  margin: 14px auto -6px;
  padding: 10px 16px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn-text);
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.wrap .banner { margin: 0 0 14px; max-width: none; }

/* ---------- 门禁 ---------- */
.gate {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
  z-index: 100;
}
.gate[hidden] { display: none; }
.gate-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 26px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.gate-card h1 { font-size: 18px; margin: 0 0 6px; font-weight: 600; }
.gate-card p { margin: 0 0 18px; font-size: 14px; color: var(--muted); }
.gate-card input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  margin-bottom: 12px;
  background: var(--bg);
}
.gate-card input:focus { outline: 2px solid var(--accent-line); outline-offset: 0; border-color: var(--accent-line); }
.gate-card button {
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
}
.gate-card button:disabled { opacity: .6; cursor: default; }
.msg { margin: 12px 0 0 !important; font-size: 13px; color: var(--danger); }

/* ---------- 表单控件 ---------- */
textarea, input[type="text"], input[type="search"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
}
textarea:focus, input[type="text"]:focus, input[type="search"]:focus {
  outline: 2px solid var(--accent-line);
  border-color: var(--accent-line);
}
textarea#content { min-height: 260px; }

button {
  font-family: inherit;
  font-size: 14px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}
button:hover { border-color: var(--accent-line); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:disabled { opacity: .55; cursor: default; }
button.ghost { background: transparent; color: var(--muted); }
button.danger { color: var(--danger); border-color: #e8cccc; background: var(--danger-soft); }

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  margin: 8px 2px 0;
}
.meta-row .over { color: var(--danger); font-weight: 600; }

.actions { display: flex; gap: 10px; margin: 16px 0 6px; align-items: center; flex-wrap: wrap; }
.actions .spacer { flex: 1; }

/* ---------- 识别结果条 ---------- */
.analyze {
  margin-top: 14px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.analyze-line { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.analyze-line:last-child { margin-bottom: 0; }
.analyze-line .k { width: 34px; flex: none; font-size: 13px; color: var(--muted); }
.analyze-line input {
  padding: 7px 10px;
  font-size: 14px;
  background: var(--card);
}
.badge {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  font-size: 12.5px;
  white-space: nowrap;
}
.badge.alt { color: var(--muted); border-color: var(--line); }
.warnchip {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 20px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn-text);
  font-size: 12.5px;
}

/* ---------- 列表 ---------- */
.section-title {
  font-size: 14px;
  color: var(--muted);
  margin: 26px 0 10px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.list { list-style: none; margin: 0; padding: 0; }
.item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 15px;
  margin-bottom: 10px;
  cursor: pointer;
}
.item:hover { border-color: var(--accent-line); }
.item-title { font-weight: 600; margin-bottom: 5px; word-break: break-word; }
.item-meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.item-snip { font-size: 13.5px; color: #55534c; margin-top: 7px; word-break: break-word; }
mark { background: #fdf0b8; color: inherit; padding: 0 1px; border-radius: 2px; }
.chip {
  display: inline-block;
  font-size: 12.5px;
  padding: 1px 8px;
  border-radius: 20px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
}
.chip.tag { cursor: pointer; }
.chip.tag:hover { border-color: var(--accent-line); color: var(--accent); }
.empty { color: var(--muted); font-size: 14px; padding: 18px 2px; }

/* ---------- 标签云 ---------- */
.tagcloud { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.tagcloud .chip { cursor: pointer; }
.tagcloud .chip:hover { border-color: var(--accent-line); color: var(--accent); }

/* ---------- 分页 ---------- */
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin: 18px 0 30px; font-size: 14px; color: var(--muted); }

/* ---------- 详情弹层 ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(28, 28, 26, .45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  z-index: 60;
  overflow-y: auto;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 100%;
  max-width: 760px;
  padding: 20px 22px 22px;
  margin-bottom: 40px;
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.modal-head h2 { font-size: 17px; margin: 0; font-weight: 600; word-break: break-word; }
.modal-head .close { background: none; border: none; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.kv { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.kv span b { font-weight: 500; color: #4c4a44; }
.content-body {
  border: 1px solid var(--line-soft);
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  max-height: 52vh;
  overflow: auto;
}
.content-body .plain { white-space: pre-wrap; word-break: break-word; }
.content-body pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 13px;
  line-height: 1.6;
}
.content-body img { max-width: 100%; }
.content-body h1, .content-body h2, .content-body h3 { font-size: 16px; margin: 14px 0 6px; }
.content-body p { margin: 8px 0; }
.content-body table { border-collapse: collapse; font-size: 13px; }
.content-body th, .content-body td { border: 1px solid var(--line); padding: 4px 8px; }
.secret-mask {
  padding: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  border: 1px dashed var(--warn-line);
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
}
.edit-area { margin-top: 14px; }
.edit-area label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }

/* ---------- 导出进度 ---------- */
.progress {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  font-size: 13.5px;
}
.progress .bar { height: 6px; background: var(--line-soft); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.progress .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  background: #2b2b28;
  color: #f3f2ee;
  padding: 10px 18px;
  border-radius: 22px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  z-index: 200;
  max-width: 88vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #7d2b2b; }

/* ---------- 移动端 ---------- */
@media (max-width: 620px) {
  .wrap { padding: 14px; }
  .top { padding: 12px 14px; }
  .modal { padding: 10px 8px; }
  .modal-card { padding: 16px 15px 18px; }
  textarea#content { min-height: 200px; }
  .analyze-line .k { width: 30px; }
}
