:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --panel: #f7f7f9;
  --border: #e2e2e8;
  --text: #1c1d21;
  --muted: #6b6f7b;
  --accent: #2f6df6;
  --accent-text: #ffffff;
  --danger: #c9403a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181c;
    --panel: #1f2026;
    --border: #2e3038;
    --text: #eceef3;
    --muted: #9aa0ad;
    --accent: #6b9bff;
    --accent-text: #0d1220;
    --danger: #ff8178;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 17px; margin: 0; }
.actions { display: flex; gap: 8px; }
button {
  font: inherit; min-height: 38px; padding: 6px 14px; border-radius: 9px;
  border: 1px solid transparent; background: var(--accent); color: var(--accent-text);
  cursor: pointer;
}
button.ghost { background: transparent; color: var(--text); border-color: var(--border); }
button.danger { background: transparent; color: var(--danger); border-color: var(--border); }
button:disabled { opacity: .55; cursor: default; }
.status { margin: 12px 16px; color: var(--muted); }
.status.small { margin: 4px 0; font-size: 13px; }
.status.error { color: var(--danger); }
.layout { display: grid; grid-template-columns: minmax(180px, 34%) 1fr; gap: 0; border-top: 0; }
.list-pane { border-right: 1px solid var(--border); min-height: 60vh; max-height: 78vh; overflow: auto; }
.notes { list-style: none; margin: 0; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.notes li button {
  width: 100%; text-align: left; background: transparent; color: var(--text);
  border: 1px solid transparent; border-radius: 10px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px; min-height: 0;
}
.notes li button.active { background: var(--panel); border-color: var(--border); }
.notes .note-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notes .note-meta { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--muted); padding: 12px 16px; }
.editor { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; min-height: 60vh; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field.grow { flex: 1; }
input[type="text"], textarea, select {
  font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; width: 100%;
}
textarea { resize: vertical; min-height: 180px; flex: 1; line-height: 1.65; }
.editor-actions { display: flex; align-items: center; gap: 10px; }
.hint { color: var(--muted); font-size: 13px; }
.source { margin: 0; color: var(--muted); font-size: 13px; }
.import { border: 1px solid var(--border); border-radius: 14px; padding: 0; width: min(560px, 94vw); background: var(--bg); color: var(--text); }
.import::backdrop { background: rgb(0 0 0 / .35); }
.import-body { display: flex; flex-direction: column; gap: 10px; padding: 16px; margin: 0; }
.import-body header { display: flex; align-items: center; justify-content: space-between; }
.import-body h2 { font-size: 16px; margin: 0; }
.messages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow: auto; }
.messages li { border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: var(--panel); }
.messages .meta { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.messages .text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.messages button { margin-top: 8px; min-height: 32px; }
@media (max-width: 680px) {
  .layout { grid-template-columns: 1fr; }
  .list-pane { border-right: 0; border-bottom: 1px solid var(--border); max-height: 34vh; min-height: 0; }
  .editor { min-height: 46vh; padding: 12px; }
}
