:root {
  --bg: #f7f8f7;
  --panel: #ffffff;
  --border: #e8eae8;
  --text: #2c2f2c;
  --text-dim: #9aa09b;
  --accent: #3dbf6e;
  --accent-deep: #2fa95c;
  --accent-soft: #e8f7ee;
  --danger: #d95555;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.7 "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

.nb-app { display: flex; flex-direction: column; height: 100vh; }

/* ── top bar ─────────────────────────── */
.nb-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.nb-vault { display: flex; align-items: center; gap: 8px; }
.nb-vault { position: relative; }
.nb-vault-name {
  font-size: 17px;
  font-weight: 700;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font-family: inherit;
  cursor: default;
}
.nb-vault-name.nb-vault-switch { cursor: pointer; }
.nb-vault-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  min-width: 140px;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  z-index: 20;
}
.nb-vault-menu button {
  display: block;
  width: 100%;
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  background: none;
  color: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.nb-vault-menu button:hover { background: var(--accent-soft); }
.nb-vault-menu button.nb-vault-current { font-weight: 700; }
/* Profile (connection) group header in the vault dropdown. */
.nb-vault-group {
  padding: 6px 10px 2px;
  font-size: 11px;
  color: var(--text-dim);
  user-select: none;
}

.nb-dot { width: 8px; height: 8px; border-radius: 50%; }
.nb-dot-on { background: var(--accent); }
.nb-dot-off { background: var(--danger); }

.nb-topbar-right { display: flex; align-items: center; gap: 10px; }

.nb-search-box input {
  width: 300px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.nb-search-box input:focus { border-color: var(--accent); background: var(--panel); }

.nb-top-icon {
  background: none; border: none; color: var(--text-dim);
  font-size: 16px; cursor: pointer; padding: 6px 8px; border-radius: 8px;
}
.nb-top-icon:hover { color: var(--text); background: var(--bg); }

/* ── layout ─────────────────────────── */
.nb-body { flex: 1; display: flex; min-height: 0; }

.nb-app.nb-sidebar-collapsed .nb-sidebar { display: none; }

.nb-sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow-y: auto;
}

/* ── stats ─────────────────────────── */
.nb-stats { display: flex; gap: 8px; }
.nb-stat { flex: 1; text-align: center; }
.nb-stat-num { font-size: 26px; font-weight: 300; color: var(--text); line-height: 1.2; }
.nb-stat-label { font-size: 12px; color: var(--text-dim); }

/* ── calendar ─────────────────────────── */
.nb-cal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.nb-cal-title { font-size: 13px; font-weight: 600; }
.nb-cal-nav {
  background: none; border: none; color: var(--text-dim);
  font-size: 16px; cursor: pointer; padding: 2px 10px; border-radius: 8px;
}
.nb-cal-nav:hover { color: var(--text); background: var(--bg); }

.nb-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.nb-cal-week { margin-bottom: 3px; }
.nb-cal-week span {
  text-align: center; font-size: 11px; color: var(--text-dim);
}

.nb-cal-day {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  border: none; border-radius: 8px;
  background: none;
  color: var(--text);
  cursor: pointer;
  position: relative;
  transition: background 0.12s;
}
.nb-cal-day:hover { background: var(--bg); }
.nb-cal-day:disabled { color: #c9cec9; cursor: default; background: none; }
.nb-cal-day.nb-cal-has-note { font-weight: 600; }
.nb-cal-day.nb-cal-has-note::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
}
.nb-cal-day.nb-cal-today { box-shadow: inset 0 0 0 1px var(--accent); }
.nb-cal-day.nb-cal-selected { background: var(--accent); color: #fff; }
.nb-cal-day.nb-cal-selected::after { background: #fff; }
.nb-cal-day.nb-cal-selected:hover { background: var(--accent); }

/* ── nav ─────────────────────────── */
.nb-nav { display: flex; flex-direction: column; gap: 4px; }
.nb-nav-item {
  display: flex; align-items: center; gap: 10px;
  background: none; border: none; border-radius: 10px;
  padding: 9px 12px; font-size: 14px; color: var(--text);
  cursor: pointer; text-align: left;
}
.nb-nav-item[hidden] { display: none; }
.nb-nav-item:hover { background: var(--bg); }
.nb-nav-item.nb-nav-active { background: var(--accent); color: #fff; }
.nb-nav-icon { font-size: 15px; }

/* ── tags ─────────────────────────── */
.nb-tags-title { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.nb-tag-list { list-style: none; margin: 0; padding: 0; }
.nb-tag-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.nb-tag-list li:hover { background: var(--bg); }
.nb-tag-list li.nb-tag-active { background: var(--accent-soft); color: var(--accent-deep); }
.nb-tag-hash { color: var(--accent); font-weight: 600; }
.nb-tag-count { margin-left: auto; font-size: 11px; color: var(--text-dim); }

/* ── main ─────────────────────────── */
.nb-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 24px 28px 60px;
}
.nb-url-frame {
  width: 100%;
  height: calc(100vh - 96px);
  min-height: 620px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.nb-composer {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  transition: border-color 0.15s;
}
.nb-composer.nb-composer-focus { border-color: var(--accent); }
.nb-composer-editor {
  min-height: 72px;
  padding: 12px 18px 4px;
  font: inherit;
  color: var(--text);
}
.nb-composer-editor .milkdown {
  border: none;
  box-shadow: none;
  background: transparent;
}
.nb-composer-editor .milkdown .ProseMirror {
  padding: 0;
  min-height: 48px;
  outline: none;
  font-size: 14px;
  line-height: 24px;
}
.nb-composer-editor .milkdown .ProseMirror p {
  font-size: 14px;
  line-height: 24px;
  padding: 0;
  margin: 0;
}
.nb-composer-editor .milkdown .ProseMirror-focused { outline: none; }
.nb-composer-editor { position: relative; }
.nb-composer-editor[data-empty='true']::before {
  content: attr(data-placeholder);
  position: absolute;
  top: 12px; left: 18px;
  color: var(--text-dim);
  pointer-events: none;
}
.nb-composer-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px 12px;
}
.nb-composer-hint { flex: 1; font-size: 12px; color: var(--text-dim); }
.nb-composer-count { font-size: 12px; color: var(--text-dim); }
.nb-send-btn {
  width: 38px; height: 30px;
  border: none; border-radius: 8px;
  background: var(--accent); color: #fff;
  font-size: 15px; cursor: pointer;
  transition: background 0.15s;
}
.nb-send-btn:hover { background: var(--accent-deep); }

.nb-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(0, 0, 0, 0.78);
  cursor: zoom-out;
}
.nb-lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 12px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}
/* ── feed cards ─────────────────────────── */
.nb-feed { display: flex; flex-direction: column; gap: 16px; }

.nb-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 22px;
  cursor: default;
  transition: box-shadow 0.15s;
}
.nb-card:hover { box-shadow: 0 3px 12px rgba(0, 0, 0, 0.07); }
.nb-card.nb-card-flash { border-color: var(--accent); transition: border-color 0.3s; }

.nb-card-head {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px;
}
.nb-card-date { font-size: 12px; color: var(--text-dim); }
.nb-card-title { font-size: 12px; color: var(--text-dim); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-card-menu {
  background: none; border: none; color: var(--text-dim);
  font-size: 15px; cursor: pointer; padding: 0 4px; border-radius: 6px;
  visibility: hidden;
}
.nb-card:hover .nb-card-menu { visibility: visible; }
.nb-card-menu:hover { color: var(--text); background: var(--bg); }

.nb-card-menu-pop {
  position: absolute;
  top: 42px; right: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
  z-index: 20;
  overflow: hidden;
  min-width: 110px;
}
.nb-card-menu-pop button {
  display: block; width: 100%;
  background: none; border: none;
  padding: 9px 16px; font-size: 13px; color: var(--text);
  cursor: pointer; text-align: left;
}
.nb-card-menu-pop button:hover { background: var(--bg); }
.nb-card-menu-pop button.nb-danger { color: var(--danger); }

.nb-card-body { font-size: 14px; }
.nb-card-body h1, .nb-card-body h2, .nb-card-body h3 { line-height: 1.35; margin: 0.7em 0 0.4em; }
.nb-card-body h1 { font-size: 19px; }
.nb-card-body h2 { font-size: 17px; }
.nb-card-body h3 { font-size: 15px; }
.nb-card-body p { margin: 0.5em 0; }
.nb-card-body ul, .nb-card-body ol { margin: 0.4em 0; padding-left: 1em; }
.nb-card-body code {
  background: #f0f2f0;
  padding: 2px 6px; border-radius: 5px;
  font-family: SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
}
.nb-card-body pre {
  background: #f0f2f0;
  padding: 12px 16px; border-radius: 10px; overflow-x: auto;
}
.nb-card-body pre code { background: none; padding: 0; }
.nb-card-body a { color: var(--accent-deep); text-decoration: none; }
.nb-card-body a:hover { text-decoration: underline; }
.nb-card-body blockquote {
  margin: 0.6em 0; padding: 4px 14px;
  border-left: 3px solid var(--accent);
  color: var(--text-dim);
}
.nb-card-body img { max-width: 100%; border-radius: 10px; }
.nb-card-body img.nb-img-loading { min-height: 40px; background: #f0f2f0; }
.nb-card-body img.nb-img-broken { outline: 1px dashed var(--danger); }
.nb-card-body input[type="checkbox"] { margin-right: 6px; accent-color: var(--accent); }
.nb-card-body hr { border: none; border-top: 1px solid var(--border); margin: 1em 0; }
.nb-card-body table { border-collapse: collapse; }
.nb-card-body th, .nb-card-body td { border: 1px solid var(--border); padding: 5px 12px; }

.nb-card-body .nb-tag {
  color: var(--accent-deep);
  background: var(--accent-soft);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 13px;
}

.nb-card-body .nb-wikilink {
  color: var(--accent-deep);
  background: var(--accent-soft);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}
.nb-card-body .nb-wikilink:hover { text-decoration: underline; }
.nb-card-body .nb-wikilink-missing {
  color: var(--text-dim);
  background: #f0f2f0;
  cursor: default;
}

.nb-card-edit {
  width: 100%;
  border: 1px solid var(--accent);
  border-radius: 10px;
  outline: none;
  resize: vertical;
  min-height: 140px;
  padding: 12px 14px;
  font: 13.5px/1.7 SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  color: var(--text);
}

.nb-card-edit-bar {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px;
}
.nb-card-edit-hint { flex: 1; font-size: 12px; color: var(--text-dim); }
.nb-edit-btn {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 8px;
  padding: 5px 16px; font-size: 13px; cursor: pointer; color: var(--text);
}
.nb-edit-btn:hover { border-color: var(--accent); }
.nb-edit-btn.nb-edit-save { background: var(--accent); border-color: var(--accent); color: #fff; }
.nb-edit-btn.nb-edit-save:hover { background: var(--accent-deep); }

/* ── Milkdown core fit — shared by read-only card view & editor ── */
.nb-card-view .milkdown,
.nb-card-editor .milkdown {
  background: transparent;
  color: var(--text);
  font: 14px/1.7 "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.nb-card-view .milkdown .ProseMirror { padding: 2px 0; outline: none; }

/* Read-only cards must not show any cursor affordance; editable cards keep
   a native caret with enough contrast against the panel background. */
.nb-card-view .milkdown .ProseMirror .prosemirror-virtual-cursor { display: none !important; }
.nb-card-view .milkdown img { max-width: 100%; border-radius: 8px; }

.nb-card-editor {
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
}

.nb-card-editor .milkdown {
  background: transparent;
  color: var(--text);
  font: 14px/1.7 "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.nb-card-editor .milkdown .ProseMirror {
  padding: 12px 16px;
  min-height: 140px;
  outline: none;
}

/* The cursor plugin can draw a virtual caret; native caret color is pinned
   separately for browsers that use caret-color instead. */
.nb-card-editor .milkdown .ProseMirror {
  --prosemirror-virtual-cursor-color: var(--text);
}

/* Tighten card typography to our 14px/1.7 body rhythm. */
.nb-card-view .milkdown .ProseMirror p,
.nb-card-editor .milkdown .ProseMirror p,
.nb-composer-editor .milkdown .ProseMirror p {
  font-size: 14px;
  line-height: 24px;
  padding: 0;
  margin: 0;
}

/* Task-list labels should match the tightened 24px text row. */
.nb-card-view .milkdown .list-item .label-wrapper,
.nb-card-view .milkdown .list-item .label-wrapper .label,
.nb-card-editor .milkdown .list-item .label-wrapper,
.nb-card-editor .milkdown .list-item .label-wrapper .label,
.nb-composer-editor .milkdown .list-item .label-wrapper,
.nb-composer-editor .milkdown .list-item .label-wrapper .label {
  height: 24px;
}

.nb-card-editor .milkdown .ProseMirror-focused { outline: none; }

.nb-card-editor .milkdown img { max-width: 100%; border-radius: 8px; }

.nb-feed-loading { text-align: center; color: var(--text-dim); padding: 20px; font-size: 13px; }

.nb-feed-more {
  text-align: center;
  color: var(--text-dim);
  padding: 16px;
  font-size: 13px;
}
.nb-feed-more.nb-feed-more-btn {
  cursor: pointer;
  color: var(--accent-deep);
}
.nb-feed-more.nb-feed-more-btn:hover { text-decoration: underline; }

.nb-load-more {
  display: block;
  width: 100%;
  padding: 11px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.nb-load-more:hover { border-color: var(--accent); color: var(--accent-deep); }

/* 行关键词视图的同组关键词切换器（linekeyword menu 配置逗号分隔多个标签时出现） */
#line-group-bar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: -6px;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.nb-line-group-label { color: var(--text-dim); font-size: 13px; }
.nb-line-group-select {
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
}
.nb-line-group-select:focus { outline: none; border-color: var(--accent); }

/* 顶栏的全局关键词组下拉：任意视图可跳到行关键词视图并按关键词过滤 */
.nb-line-group-global {
  font-size: 13px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  max-width: 140px;
}
.nb-line-group-global:focus { outline: none; border-color: var(--accent); }

/* 行关键词视图：组内 tag chip 点击换类型（外观与普通 tag 一致） */
.nb-tag-swappable { cursor: pointer; }
.nb-line-tag-menu {
  position: absolute;
  z-index: 60;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 96px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
.nb-line-tag-menu button {
  text-align: left;
  padding: 6px 10px;
  font-size: 13px;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
}
.nb-line-tag-menu button:hover { background: var(--accent-soft); }
.nb-line-tag-menu button.nb-line-tag-current { color: var(--accent-deep); font-weight: 600; }

/* 日记视图的常用关键词 chips（闪念式过滤，来自行关键词菜单配置） */
#journal-kw-bar {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: -6px;
}
.nb-journal-kw {
  padding: 4px 12px;
  font-size: 13px;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.nb-journal-kw:hover { border-color: var(--accent); color: var(--accent-deep); }
.nb-journal-kw-active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.nb-journal-kw-active:hover { color: #fff; }

/* ── reminders ─────────────────────────── */
.nb-rem {
  display: flex; flex-direction: column; gap: 10px;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.nb-rem-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 2px;
}

.nb-habit-wrap { width: 100%; max-width: 960px; }
.nb-habit-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.nb-habit-bar-title { font-size: 20px; font-weight: 700; }
.nb-habit-count { color: var(--text-dim); font-size: 13px; flex: 1; }
.nb-habit-add { border: 1px solid var(--accent); border-radius: 8px; padding: 5px 10px; background: var(--accent); color: #fff; cursor: pointer; }
.nb-habit-add:hover { background: var(--accent-deep); }
.nb-habit-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.nb-habit-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) 28px; align-content: start; align-items: center; gap: 10px; min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.nb-habit-check { grid-column: 3; grid-row: 1; width: 28px; height: 28px; border: 2px solid var(--border); border-radius: 50%; background: transparent; color: transparent; cursor: pointer; }
.nb-habit-check:hover { border-color: var(--accent); }
.nb-habit-check.nb-habit-checked { background: var(--habit-color, var(--accent)); border-color: var(--habit-color, var(--accent)); color: #fff; }
.nb-habit-icon { grid-column: 1; grid-row: 1; width: 28px; text-align: center; font-size: 20px; }
.nb-habit-main { grid-column: 1 / -1; min-width: 0; }
.nb-habit-name { font-weight: 600; overflow-wrap: anywhere; }
.nb-habit-goal { display: block; margin-top: 2px; color: var(--text-dim); font-size: 12px; font-weight: 400; }
.nb-habit-meta { margin-top: 6px; color: var(--text-dim); font-size: 12px; overflow-wrap: anywhere; }
.nb-habit-actions { grid-column: 2; grid-row: 1; justify-self: end; display: flex; gap: 4px; }
.nb-habit-actions button { border: none; background: none; color: var(--text-dim); cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.nb-habit-actions button:hover { background: var(--bg); color: var(--text); }
.nb-habit-actions .nb-danger:hover { color: var(--danger); }
.nb-habit-empty { grid-column: 1 / -1; padding: 32px; text-align: center; color: var(--text-dim); border: 1px dashed var(--border); border-radius: var(--radius); }
.nb-rem-bar-title { font-size: 20px; font-weight: 700; }
.nb-rem-count {
  min-width: 22px; height: 22px; padding: 0 7px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-deep);
  border-radius: 11px; font-size: 12px; font-weight: 600;
}
.nb-rem-list {
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  padding: 5px 8px;
  font-size: 13px;
  color: var(--text);
  outline: none;
}
.nb-rem-list:focus { border-color: var(--accent); }

.nb-rem-add {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 14px;
  transition: border-color 0.15s;
}
.nb-rem-add:focus-within { border-color: var(--accent); }
.nb-rem-add { position: relative; }
.nb-rem-add .nb-rem-icon-btn { width: auto; padding: 0 8px; white-space: nowrap; font-size: 12px; }

/* Quick-add date popover: replaces the native datetime picker, which Chrome
 * mis-anchors to the page corner on extension pages. */
.nb-rem-due-pop {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  z-index: 30;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 12px;
  min-width: 220px;
}
.nb-rem-due-chips { display: flex; gap: 6px; }
.nb-rem-due-chip {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  padding: 5px 0;
  cursor: pointer;
}
.nb-rem-due-chip:hover { border-color: var(--accent); color: var(--accent-deep); background: var(--accent-soft); }
.nb-rem-due-date, .nb-rem-due-time {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  padding: 6px 8px;
  outline: none;
}
.nb-rem-due-date:focus, .nb-rem-due-time:focus { border-color: var(--accent); }
.nb-rem-due-clear {
  border: none; background: none;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 0;
  border-radius: 6px;
}
.nb-rem-due-clear:hover { color: var(--danger); background: #fbecec; }
.nb-rem-add-input {
  flex: 1; min-width: 0;
  border: none; background: none;
  font-size: 14px; color: var(--text);
  outline: none;
}
.nb-rem-add-btn {
  width: 28px; height: 28px; flex-shrink: 0;
  border: none; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 16px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.nb-rem-add-btn:hover { background: var(--accent-deep); }
.nb-rem-add-btn:disabled { opacity: 0.5; cursor: default; }

.nb-rem-icon-btn {
  width: 28px; height: 28px; flex-shrink: 0;
  border: none; border-radius: 8px; background: none;
  color: var(--text-dim); font-size: 14px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.nb-rem-icon-btn:hover { color: var(--text); background: var(--bg); }
.nb-rem-icon-btn.nb-rem-icon-on { color: var(--accent-deep); background: var(--accent-soft); }
.nb-rem-icon-btn.nb-danger:hover { color: var(--danger); background: #fbecec; }
.nb-rem-due-input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
  color: var(--text);
  background: var(--panel);
  outline: none;
}
.nb-rem-due-input:focus { border-color: var(--accent); }

.nb-rem-group {
  margin-top: 8px;
  padding: 0 4px;
  font-size: 12px; font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

.nb-rem-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  transition: border-color 0.15s, opacity 0.2s;
}
.nb-rem-row:hover { border-color: #dcdedd; }
.nb-rem-row-overdue { border-left: 3px solid var(--danger); }
.nb-rem-done { opacity: 0.45; }
.nb-rem-done .nb-rem-title { text-decoration: line-through; }

.nb-rem-check {
  width: 20px; height: 20px; flex-shrink: 0;
  border: 1.5px solid var(--text-dim);
  border-radius: 50%;
  background: none; cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}
.nb-rem-check:hover { border-color: var(--accent); }
.nb-rem-check::after {
  content: '✓';
  font-size: 12px; color: #fff; line-height: 1;
  opacity: 0;
}
.nb-rem-done .nb-rem-check { background: var(--accent); border-color: var(--accent); }
.nb-rem-done .nb-rem-check::after { opacity: 1; }

.nb-rem-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.nb-rem-title { font-size: 14px; overflow-wrap: anywhere; }
.nb-rem-due { font-size: 12px; color: var(--text-dim); }
.nb-rem-due.nb-rem-overdue { color: var(--danger); font-weight: 600; }

.nb-rem-actions {
  display: flex; gap: 2px; flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.nb-rem-row:hover .nb-rem-actions,
.nb-rem-row:focus-within .nb-rem-actions { opacity: 1; }

.nb-rem-empty {
  padding: 48px 0 32px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.nb-rem-empty-art {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-deep);
  font-size: 24px;
  display: flex; align-items: center; justify-content: center;
}
.nb-rem-empty-text { font-size: 13px; color: var(--text-dim); }

.nb-rem-row.nb-rem-editing { border-color: var(--accent); }
.nb-rem-row .nb-rem-title-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
  color: var(--text);
  outline: none;
}
.nb-rem-row .nb-rem-title-input:focus { border-color: var(--accent); }
.nb-rem-row .nb-edit-btn { flex-shrink: 0; }

.nb-toast-undo {
  margin-left: 12px;
  border: none; background: none;
  color: var(--accent);
  font-size: 13px; font-weight: 600;
  cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.nb-toast-undo:hover { background: rgba(61, 191, 110, 0.15); }
.nb-toast-undo:disabled { opacity: 0.5; cursor: default; }

/* ── toast ─────────────────────────── */
.nb-toast {
  position: fixed;
  bottom: 30px; left: 50%;
  transform: translateX(-50%);
  background: #2c2f2c;
  color: #fff;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 13px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  z-index: 100;
}
.nb-toast.nb-error { background: var(--danger); }
.nb-toast.nb-ok { background: var(--accent-deep); }

@media (max-width: 820px) {
  .nb-sidebar { display: none; }
  .nb-search-box input { width: 160px; }
}

/* Milkdown table/component popovers ship with data-show="false" until
   triggered; without this rule they render naked at the bottom of cards. */
.milkdown [data-show='false'] { display: none !important; }

/* Custom sidebar menus: stretch to full sidebar width like the fixed nav items. */
.nb-custom-nav { display: flex; flex-direction: column; gap: 4px; align-self: stretch; }
.nb-custom-nav .nb-nav-item { width: 100%; }

/* ── whiteboards (sidebar list + canvas) ───────────────── */
.nb-wb-block { align-self: stretch; }
.nb-wb-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; }
.nb-wb-title { font-size: 12px; color: var(--text-dim); letter-spacing: 0.5px; }
.nb-wb-new {
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 6px;
  cursor: pointer;
}
.nb-wb-new:hover { color: var(--accent-deep); background: var(--bg); }
.nb-wb-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nb-wb-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: none;
  border-radius: 8px;
  background: none;
  font-size: 13px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  width: 100%;
}
.nb-wb-item:hover { background: var(--bg); }
.nb-wb-item.nb-nav-active { background: var(--accent); color: #fff; }
.nb-wb-item .nb-nav-icon { font-size: 14px; }
.nb-wb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-wb-del {
  border: none;
  background: none;
  color: inherit;
  opacity: 0;
  font-size: 13px;
  padding: 0 3px;
  border-radius: 5px;
  cursor: pointer;
}
.nb-wb-item:hover .nb-wb-del { opacity: 0.75; }
.nb-wb-del:hover { opacity: 1 !important; color: var(--danger); }

/* The feed is an auto-height flex column, so height:100% collapses; instead
 * the board fills .nb-main (which becomes its positioning context). */
.nb-main:has(.nb-wb) { position: relative; }
.nb-wb { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); z-index: 1; }
.nb-wb-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.nb-wb-toolbar .nb-wb-title-input {
  border: 1px solid transparent;
  background: none;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  padding: 3px 8px;
  border-radius: 7px;
  max-width: 260px;
}
.nb-wb-toolbar .nb-wb-title-input:hover { border-color: var(--border); }
.nb-wb-toolbar .nb-wb-title-input:focus { outline: none; border-color: var(--accent); }
.nb-wb-tool {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  padding: 4px 11px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.nb-wb-tool:hover { background: var(--accent-soft); border-color: var(--accent); }
.nb-wb-spacer { flex: 1; }
.nb-wb-zoom-label { font-size: 12px; color: var(--text-dim); min-width: 40px; text-align: center; }
.nb-wb-picker { position: relative; }
.nb-wb-picker-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  width: 260px;
  max-height: 300px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}
.nb-wb-picker-pop input {
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  outline: none;
}
.nb-wb-picker-list { overflow-y: auto; }
.nb-wb-picker-list button {
  display: block;
  width: 100%;
  border: none;
  background: none;
  text-align: left;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nb-wb-picker-list button:hover { background: var(--accent-soft); }
.nb-wb-picker-empty { padding: 10px 12px; font-size: 12px; color: var(--text-dim); }
.nb-wb-batch-pop { padding-bottom: 8px; }
.nb-wb-batch-modes { display: flex; gap: 4px; padding: 8px 10px 0; }
.nb-wb-batch-mode {
  border: 1px solid var(--border);
  background: none;
  color: var(--text-dim);
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.nb-wb-batch-mode-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-deep); }
.nb-wb-batch-pop input { border-bottom: none; }
.nb-wb-batch-go { margin: 4px 10px 0; }

.nb-wb-viewport {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: var(--bg);
  background-image: radial-gradient(circle, #d8dcd8 1px, transparent 1px);
  background-size: 28px 28px;
}
.nb-wb-viewport.nb-wb-pan { cursor: grab; }
.nb-wb-viewport.nb-wb-panning { cursor: grabbing; }
/* Camera moving (pan/zoom/card drag): cards skip hit-testing entirely —
 * Logseq's tldraw does the same (pointerEvents:none while isMoving). */
.nb-wb-viewport.nb-wb-moving .nb-wb-card { pointer-events: none; }
.nb-wb-canvas { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; }
.nb-wb-card {
  position: absolute;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.nb-wb-card.nb-wb-dragging { box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14); z-index: 5; }
.nb-wb-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
  background: var(--panel);
  border-radius: var(--radius) var(--radius) 0 0;
}
.nb-wb-card-head:active { cursor: grabbing; }
.nb-wb-card-title {
  flex: 1;
  font-size: 12px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nb-wb-card-btn {
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 13px;
  padding: 1px 5px;
  border-radius: 5px;
  cursor: pointer;
  visibility: hidden;
}
.nb-wb-card:hover .nb-wb-card-btn { visibility: visible; }
.nb-wb-card-btn:hover { background: var(--bg); color: var(--text); }
.nb-wb-card-btn.nb-danger:hover { color: var(--danger); }
.nb-wb-card-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 12px 8px;
  font-size: 14px;
}
.nb-wb-card.nb-editing { border-color: var(--accent); }
.nb-wb-card-body .nb-card-editor { min-height: 40px; }
.nb-wb-card-body .nb-card-editor .milkdown { border: none; box-shadow: none; background: transparent; }
/* In-card edit bar must be sticky: long notes push it out of the scrollport
 * and the card looks "stuck" with no way to save. */
.nb-wb-card-body > .nb-card-edit-bar {
  position: sticky;
  bottom: 0;
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding: 6px 0 2px;
  margin-top: 6px;
}
.nb-wb-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 22px;
  height: 22px;
  cursor: nwse-resize;
}

/* Sub-keyword tree under a keyword sidebar menu (recursive). */
.nb-sub-tree { display: flex; flex-direction: column; }
.nb-sub-tree[hidden] { display: none; }
.nb-sub-item {
  display: block;
  background: none;
  border: none;
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  text-align: left;
}
.nb-sub-item:hover { background: var(--bg); color: var(--text); }
.nb-sub-item.nb-sub-active { background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; }

/* Milkdown core component layout. */
.nb-card-view .milkdown .milkdown-list-item-block > .list-item,
.nb-card-editor .milkdown .milkdown-list-item-block > .list-item,
.nb-composer-editor .milkdown .milkdown-list-item-block > .list-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nb-card-view .milkdown .milkdown-list-item-block > .list-item::marker,
.nb-card-editor .milkdown .milkdown-list-item-block > .list-item::marker,
.nb-composer-editor .milkdown .milkdown-list-item-block > .list-item::marker {
  content: '';
}
.nb-card-view .milkdown .milkdown-list-item-block .label-wrapper,
.nb-card-editor .milkdown .milkdown-list-item-block .label-wrapper,
.nb-composer-editor .milkdown .milkdown-list-item-block .label-wrapper {
  align-items: center;
  display: inline-flex;
  flex: 0 0 20px;
  height: 24px;
  justify-content: center;
}
.nb-card-view .milkdown .milkdown-list-item-block .label,
.nb-card-editor .milkdown .milkdown-list-item-block .label,
.nb-composer-editor .milkdown .milkdown-list-item-block .label {
  align-items: center;
  color: var(--text-dim);
  display: inline-flex;
  height: 24px;
  justify-content: center;
  width: 20px;
}
.nb-card-view .milkdown .milkdown-list-item-block .children,
.nb-card-editor .milkdown .milkdown-list-item-block .children,
.nb-composer-editor .milkdown .milkdown-list-item-block .children {
  flex: 1 1 auto;
  min-width: 0;
}

/* One nesting level should read as one tab (4 half-width chars ≈ 28px), like
   MarkText's tabSize 4. Milkdown's default adds 14px ul padding on top of the
   24px marker column; zero it and let the marker column alone be the indent. */
.nb-card-view .milkdown .ProseMirror ul,
.nb-card-view .milkdown .ProseMirror ol,
.nb-card-editor .milkdown .ProseMirror ul,
.nb-card-editor .milkdown .ProseMirror ol,
.nb-composer-editor .milkdown .ProseMirror ul,
.nb-composer-editor .milkdown .ProseMirror ol {
  padding-left: 0;
}
.nb-card-editor .milkdown .ProseMirror,
.nb-composer-editor .milkdown .ProseMirror {
  caret-color: var(--text);
}

/* ── calendar tab (macOS Calendar, Apple-style day view) ──
   Ported from lite-calendar's styles: hour grid with 30-minute rows,
   absolutely positioned event blocks, red now-line, inspector card. */
.nb-caltab {
  display: flex; flex-direction: column;
  height: 100%;
  min-height: 0;
  width: 100%;
}

.nb-caltab-topbar {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: start;
  gap: 18px;
  padding: 8px 4px 14px;
  border-bottom: 1px solid var(--border);
}
.nb-caltab-add {
  width: 40px; height: 40px;
  border: none; border-radius: 50%;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 20px; font-weight: 300;
  cursor: pointer;
  transition: background 0.14s, transform 0.1s;
}
.nb-caltab-add:hover { background: var(--accent-soft); color: var(--accent-deep); }
.nb-caltab-add:active { transform: scale(0.96); }
.nb-caltab-bigtitle { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.15; }
.nb-caltab-subtitle { font-size: 14px; color: var(--text-dim); margin-top: 2px; }
.nb-caltab-nav { display: inline-flex; align-items: center; gap: 8px; }
.nb-caltab-nav-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 32px; min-width: 32px; padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: border-color 0.14s, color 0.14s, background 0.14s, transform 0.1s;
}
.nb-caltab-nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
  background: var(--accent-soft);
}
.nb-caltab-nav-btn:active { transform: scale(0.97); }
.nb-caltab-today-btn {
  padding: 0 16px;
  color: var(--accent-deep);
}
.nb-caltab-refresh svg { display: block; }
.nb-caltab-spin svg { animation: nb-caltab-spin 0.6s ease; }
@keyframes nb-caltab-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.nb-caltab-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.nb-caltab-body.nb-caltab-editing { grid-template-columns: minmax(0, 1fr) 340px; }
@media (max-width: 1100px) {
  .nb-caltab-body.nb-caltab-editing { grid-template-columns: minmax(0, 1fr) 300px; }
}

.nb-caltab-gridwrap {
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.nb-caltab-grid {
  position: relative;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}
.nb-caltab-row {
  position: relative;
  display: flex;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
.nb-caltab-hour {
  width: 58px;
  flex-shrink: 0;
  padding-top: 4px;
  padding-right: 10px;
  border-right: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.nb-caltab-track { position: relative; flex: 1; cursor: crosshair; transition: background 0.12s; }
.nb-caltab-track-hour { background: rgba(0, 0, 0, 0.012); }
.nb-caltab-track:hover { background: rgba(61, 191, 110, 0.06); }
.nb-caltab-track-selected { background: rgba(61, 191, 110, 0.16); }

.nb-caltab-event {
  position: absolute;
  z-index: 4;
  box-sizing: border-box;
  overflow: hidden;
  padding: 8px 10px;
  border-radius: 6px;
  box-shadow: inset 4px 0 rgba(255, 255, 255, 0.55), 0 1px 0 rgba(255, 255, 255, 0.18);
  cursor: pointer;
  font-size: 12px;
  line-height: 1.25;
  transition: filter 0.14s, transform 0.14s;
}
.nb-caltab-event:hover { filter: saturate(1.05) brightness(1.02); transform: translateY(-1px); }
.nb-caltab-event-compact { padding: 3px 10px; }
.nb-caltab-event-editing { outline: 3px solid rgba(61, 191, 110, 0.4); outline-offset: 1px; }
.nb-caltab-event-title {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nb-caltab-event-time { margin-top: 2px; opacity: 0.86; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }

.nb-caltab-now {
  position: absolute;
  left: 58px; right: 0;
  z-index: 6;
  height: 2px;
  background: #ff2d55;
  pointer-events: none;
}
.nb-caltab-now::before {
  content: '';
  position: absolute;
  left: -5px; top: -4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #ff2d55;
}
.nb-caltab-now-label {
  position: absolute;
  left: -48px; top: -10px;
  padding: 2px 7px;
  border-radius: 16px;
  background: #ff2d55;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Editor card (lite-calendar inspector equivalent) */
.nb-caltab-editor {
  margin-left: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}
.nb-caltab-editor-head { display: flex; align-items: center; justify-content: space-between; }
.nb-caltab-editor-mode { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.nb-caltab-editor-title {
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 6px 2px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  outline: none;
  background: none;
}
.nb-caltab-editor-title:focus { border-bottom-color: var(--accent); }
.nb-caltab-editor-title::placeholder {
  color: var(--text-dim);
  opacity: 0.55;
  font-weight: 400;
}
.nb-caltab-editor-calrow { display: flex; align-items: center; gap: 8px; }
.nb-caltab-editor-calrow .nb-rem-list { margin-left: 0; flex: 1; }
.nb-caltab-editor-caldot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.nb-caltab-editor-foot { display: flex; justify-content: flex-end; gap: 6px; }
.nb-caltab-editor-foot .nb-caltab-editor-delete { margin-right: auto; color: var(--danger); }
.nb-caltab-editor-delete:hover { border-color: var(--danger) !important; }

/* Mini month navigator inside the editor card (Sunday-first, Apple style) */
.nb-caltab-mini { display: flex; flex-direction: column; gap: 4px; }
.nb-caltab-mini-head { display: flex; align-items: center; gap: 6px; }
.nb-caltab-mini-title { flex: 1; font-size: 14px; font-weight: 700; }
.nb-caltab-mini-nav { height: 26px; min-width: 26px; }
.nb-caltab-mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.nb-caltab-mini-weekday { text-align: center; font-size: 10px; color: var(--text-dim); }
.nb-caltab-mini-day {
  aspect-ratio: 1;
  border: none; border-radius: 50%;
  background: none;
  font-size: 11px;
  color: var(--text);
  cursor: pointer;
}
.nb-caltab-mini-day:hover { background: var(--bg); }
.nb-caltab-mini-day.nb-caltab-mini-out { color: #c9cec9; }
.nb-caltab-mini-day.nb-caltab-mini-today { box-shadow: inset 0 0 0 1px var(--accent); }
.nb-caltab-mini-day.nb-caltab-mini-selected { background: var(--accent); color: #fff; }

/* Time inputs reuse the reminder edit-row styles */
.nb-calev-times { display: flex; gap: 6px; }
.nb-calev-dt {
  flex: 1; min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 12px;
  color: var(--text);
  outline: none;
}
.nb-calev-dt:focus { border-color: var(--accent); }

/* ── Cornell reading layout (🌽 康奈尔 menus) ─────────────────
   Exactly three cards: all cues on the left, all bodies on the right, the last
   `##` section as a full-width summary below. The Milkdown hosts keep the
   .nb-card-view class so every typography rule above still applies; the
   .nb-cornell-* classes are layout/skin only. Cues are plain text — no
   Milkdown instance (see 内存规范.md). */
.nb-cornell {
  --nb-cornell-cue-width: 180px;
  --nb-cornell-gap: 10px;
  display: flex;
  flex-direction: column;
  gap: var(--nb-cornell-gap);
}

.nb-cornell-cols {
  display: grid;
  grid-template-columns: var(--nb-cornell-cue-width) minmax(0, 1fr);
  gap: var(--nb-cornell-gap);
  /* Cue and body cards are equal height: whichever is taller sets the page. */
  align-items: stretch;
}

.nb-cornell-cols.nb-cornell-no-cue {
  grid-template-columns: minmax(0, 1fr);
}

/* Below this width the cue card stacks above the body card instead of
   squeezing both into unreadable columns. */
@media (max-width: 720px) {
  .nb-cornell-cols {
    grid-template-columns: minmax(0, 1fr);
  }
}

.nb-cornell-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.nb-cornell-cue-card {
  padding: 10px 8px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--bg);
}

.nb-cornell-cue-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nb-cornell-cue {
  display: flex;
  align-items: baseline;
  gap: 6px;
  width: 100%;
  padding: 5px 6px;
  border: none;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.14s ease;
}

.nb-cornell-cue:hover {
  background: var(--accent-soft);
}

.nb-cornell-cue-num {
  flex: none;
  min-width: 1.25em;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}

.nb-cornell-cue:hover .nb-cornell-cue-num {
  color: var(--accent-deep);
}

.nb-cornell-cue-text {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.nb-cornell-note-card {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}

.nb-cornell-summary-card {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--accent-soft);
}

/* Hovering a cue on the left highlights its `##` on the right. Negative inline
   margins let the tint bleed past the text without shifting it. */
.nb-cornell-note-card .milkdown .ProseMirror h2.nb-cornell-linked {
  margin-inline: -6px;
  padding-inline: 6px;
  border-radius: 6px;
  background: var(--accent-soft);
}

/* Section titles inside the body card: small section headers, dashed rule
   between sections so the aggregated bodies stay distinguishable. */
.nb-cornell-note-card .milkdown .ProseMirror h2 {
  margin: 14px 0 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.5;
}

.nb-cornell-note-card .milkdown .ProseMirror h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
