/* ============================================================
   JOURNAL — Calendar Markdown Notes
   Aesthetic: Editorial / Refined Ink-on-Paper
   ============================================================ */

/* ---------- Design Tokens ---------- */
:root {
  /* Light theme */
  --bg-page:        #f5f0e8;
  --bg-sidebar:     #ede8df;
  --bg-card:        #faf7f2;
  --bg-editor:      #fdfcf9;
  --bg-hover:       #e6e1d8;
  --bg-active:      #d8cfc3;

  --text-primary:   #1c1a17;
  --text-secondary: #5a5348;
  --text-muted:     #9b9189;
  --text-inverse:   #faf7f2;

  --accent:         #b5440e;
  --accent-light:   #f0d8cc;
  --accent-dim:     #d4825a;

  --border:         #d4cec5;
  --border-strong:  #b8b2a8;
  --shadow-sm:      0 1px 3px rgba(28,26,23,.08);
  --shadow-md:      0 4px 16px rgba(28,26,23,.12);

  --cal-today-bg:   #b5440e;
  --cal-today-text: #faf7f2;
  --cal-dot:        #b5440e;
  --cal-selected:   #1c1a17;
  --cal-selected-text: #faf7f2;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Source Serif 4', Georgia, serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

  /* Editor font — overridden by font settings */
  --editor-font:      'JetBrains Mono', 'Fira Code', monospace;
  --editor-font-size: 13.5px;
  --preview-font:     'Source Serif 4', Georgia, serif;
  --preview-font-size: 15px;

  --sidebar-w: 280px;
  --topbar-h:  52px;
  --status-h:  28px;
  --transition: .18s ease;
}

[data-theme="dark"] {
  --bg-page:        #151412;
  --bg-sidebar:     #1e1c19;
  --bg-card:        #242220;
  --bg-editor:      #1a1917;
  --bg-hover:       #2a2824;
  --bg-active:      #34302b;

  --text-primary:   #f0ece4;
  --text-secondary: #b0a99e;
  --text-muted:     #6e685f;
  --text-inverse:   #1c1a17;

  --accent:         #e07040;
  --accent-light:   #3a2218;
  --accent-dim:     #c05a30;

  --border:         #2e2c28;
  --border-strong:  #3e3c38;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.3);
  --shadow-md:      0 4px 16px rgba(0,0,0,.4);

  --cal-today-bg:   #e07040;
  --cal-today-text: #1c1a17;
  --cal-dot:        #e07040;
  --cal-selected:   #f0ece4;
  --cal-selected-text: #1c1a17;
}

/* ---------- Reset + Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; height: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg-page);
  color: var(--text-primary);
  height: 100%;
  display: flex;
  overflow: hidden;
  transition: background var(--transition), color var(--transition);
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform var(--transition), background var(--transition);
  z-index: 200;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-mark {
  width: 30px;
  height: 30px;
  background: var(--text-primary);
  color: var(--bg-page);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  letter-spacing: -.5px;
  flex-shrink: 0;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.3px;
  color: var(--text-primary);
}

/* ---------- Icon Buttons ---------- */
.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
  line-height: 1;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.icon-btn:active { background: var(--bg-active); }
.icon-btn svg { width: 18px; height: 18px; }

.danger-btn:hover { background: #fee; color: #c0392b; }
[data-theme="dark"] .danger-btn:hover { background: #2d1515; color: #e57373; }

/* ---------- Calendar ---------- */
.calendar-widget {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.cal-month-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: .2px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-dow {
  text-align: center;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .8px;
  color: var(--text-muted);
  padding: 4px 0 6px;
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.cal-days-inner {
  display: contents;
}

.cal-day {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-family: var(--font-mono);
  cursor: pointer;
  border-radius: 50%;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
  user-select: none;
}

.cal-day:hover:not(.cal-empty) { background: var(--bg-hover); color: var(--text-primary); }
.cal-day.cal-empty { cursor: default; pointer-events: none; }
.cal-day.cal-other-month { color: var(--text-muted); opacity: .5; }

.cal-day.cal-today {
  background: var(--cal-today-bg);
  color: var(--cal-today-text);
  font-weight: 700;
}
.cal-day.cal-today:hover { opacity: .9; }

.cal-day.cal-selected:not(.cal-today) {
  background: var(--cal-selected);
  color: var(--cal-selected-text);
}

/* Dot for days with notes */
.cal-day.has-note::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--cal-dot);
}
.cal-day.cal-today.has-note::after { background: var(--cal-today-text); }
.cal-day.cal-selected.has-note::after { background: var(--cal-selected-text); }

/* ---------- Notes List ---------- */
.notes-list-section {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.notes-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
  flex-shrink: 0;
}

.notes-list-title {
  font-size: 10px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
}

.new-note-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  letter-spacing: .3px;
  transition: opacity var(--transition), transform var(--transition);
}
.new-note-btn svg { width: 13px; height: 13px; }
.new-note-btn:hover { opacity: .88; transform: translateY(-1px); }
.new-note-btn:active { transform: translateY(0); }

.notes-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px 16px;
}

.note-item {
  padding: 9px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
  border: 1px solid transparent;
  margin-bottom: 3px;
}
.note-item:hover { background: var(--bg-hover); }
.note-item.active {
  background: var(--bg-active);
  border-color: var(--border);
}

.note-item-date {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: .5px;
  margin-bottom: 3px;
}

.note-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-display);
}

.note-item-preview {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  font-family: var(--font-body);
}

.notes-empty-msg {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-body);
  font-style: italic;
}

/* ---------- Sidebar Overlay (mobile) ---------- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 199;
  backdrop-filter: blur(2px);
}

/* ---------- Main Area ---------- */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-page);
  min-width: 0;
}

/* ---------- Topbar ---------- */
.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-page);
  gap: 10px;
  flex-shrink: 0;
  transition: background var(--transition);
}

.topbar-menu-btn { display: none; }

.topbar-date {
  flex: 1;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -.2px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ---------- Editor Area ---------- */
.editor-area {
  flex: 1;
  overflow: hidden;
  display: flex;
  position: relative;
}

/* ---------- Empty State ---------- */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 24px;
  color: var(--text-muted);
  user-select: none;
}

.empty-illustration { opacity: .6; }

.empty-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 4px;
}

.empty-sub {
  font-size: 13.5px;
  text-align: center;
  max-width: 280px;
  line-height: 1.6;
  color: var(--text-muted);
}

kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text-secondary);
}

/* ---------- Split Container ---------- */
.split-container {
  flex: 1;
  display: flex;
  overflow: hidden;
  width: 100%;
  height: 100%;
}

.editor-pane,
.preview-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  flex: 1;
}

.pane-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.4px;
  color: var(--text-muted);
  padding: 7px 16px 6px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-card);
  user-select: none;
}

.preview-pane .pane-label {
  border-left: 1px solid var(--border);
}

/* ---------- Split Handle ---------- */
.split-handle {
  width: 4px;
  background: var(--border);
  cursor: col-resize;
  flex-shrink: 0;
  position: relative;
  transition: background var(--transition);
}
.split-handle:hover,
.split-handle.dragging {
  background: var(--accent);
}
.split-handle::before {
  content: '';
  position: absolute;
  inset: 0 -4px;
}

/* ---------- Markdown Editor ---------- */
.md-editor {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  padding: 22px 24px;
  background: var(--bg-editor);
  color: var(--text-primary);
  font-family: var(--editor-font);
  font-size: var(--editor-font-size);
  line-height: 1.75;
  overflow-y: auto;
  transition: background var(--transition);
  caret-color: var(--accent);
  tab-size: 2;
  white-space: pre-wrap;
  word-break: break-word;
}
.md-editor::placeholder { color: var(--text-muted); font-style: italic; }
.md-editor:focus { background: var(--bg-editor); }

/* ---------- Markdown Preview / Prose ---------- */
.md-preview {
  flex: 1;
  overflow-y: auto;
  padding: 22px 28px;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  transition: background var(--transition);
}

/* Prose styles */
.prose { font-family: var(--preview-font); font-size: var(--preview-font-size); line-height: 1.8; color: var(--text-primary); }
.prose h1 { font-family: var(--font-display); font-size: 2em; font-weight: 700; margin: 0 0 .6em; color: var(--text-primary); letter-spacing: -.5px; border-bottom: 2px solid var(--border); padding-bottom: .3em; }
.prose h2 { font-family: var(--font-display); font-size: 1.45em; font-weight: 600; margin: 1.4em 0 .5em; color: var(--text-primary); }
.prose h3 { font-family: var(--font-display); font-size: 1.15em; font-weight: 600; margin: 1.2em 0 .4em; }
.prose h4, .prose h5, .prose h6 { font-family: var(--font-display); font-weight: 600; margin: 1em 0 .35em; }
.prose p { margin: 0 0 .9em; }
.prose ul, .prose ol { margin: 0 0 .9em 1.3em; padding: 0; }
.prose li { margin-bottom: .25em; }
.prose li > ul, .prose li > ol { margin-top: .25em; }
.prose blockquote { margin: 1em 0; padding: .6em 1em; border-left: 3px solid var(--accent); background: var(--accent-light); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-secondary); font-style: italic; }
.prose code { font-family: var(--font-mono); font-size: .85em; background: var(--bg-hover); padding: .15em .4em; border-radius: 3px; color: var(--accent); }
.prose pre { background: var(--bg-active); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1em 1.2em; overflow-x: auto; margin: .9em 0; }
.prose pre code { background: none; padding: 0; color: var(--text-primary); font-size: .82em; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-dim); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--accent); }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 1.5em 0; }
.prose table { width: 100%; border-collapse: collapse; margin: .9em 0; font-size: .9em; }
.prose th { background: var(--bg-hover); font-weight: 600; text-align: left; padding: .5em .8em; border: 1px solid var(--border); font-family: var(--font-mono); font-size: .85em; letter-spacing: .3px; }
.prose td { padding: .45em .8em; border: 1px solid var(--border); vertical-align: top; }
.prose tr:nth-child(even) td { background: var(--bg-page); }
.prose img { max-width: 100%; border-radius: var(--radius-md); margin: .5em 0; }
.prose strong { font-weight: 600; color: var(--text-primary); }
.prose em { font-style: italic; color: var(--text-secondary); }
.prose del { text-decoration: line-through; color: var(--text-muted); }

/* Task list checkboxes */
.prose input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  margin-right: 6px;
  cursor: pointer;
  vertical-align: middle;
}
.prose li.task-item { list-style: none; margin-left: -1.3em; }

/* ---------- Status Bar ---------- */
.status-bar {
  height: var(--status-h);
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-sidebar);
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  letter-spacing: .3px;
}

.status-saved {
  margin-left: auto;
  color: var(--accent);
  opacity: 0;
  transition: opacity .3s;
}
.status-saved.visible { opacity: 1; }

/* ---------- Toast Notification ---------- */
.toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--text-primary);
  color: var(--bg-page);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 18px;
  border-radius: 99px;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  z-index: 9999;
  letter-spacing: .3px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Confirm Dialog ---------- */
.confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 9000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}
.confirm-overlay.show { display: flex; }

.confirm-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 28px 22px;
  max-width: 340px;
  width: 90%;
  box-shadow: var(--shadow-md);
  animation: popIn .2s ease;
}

@keyframes popIn {
  from { transform: scale(.94); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.confirm-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-primary);
}
.confirm-msg {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 22px;
}
.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.btn {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  font-weight: 500;
}
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); }
.btn-danger { background: #c0392b; color: white; border-color: transparent; }
.btn-danger:hover { background: #a93226; }
[data-theme="dark"] .btn-danger { background: #e74c3c; }
[data-theme="dark"] .btn-danger:hover { background: #c0392b; }

/* ---------- No-preview (editor only) mode ---------- */
.split-container.no-preview .split-handle,
.split-container.no-preview .preview-pane { display: none; }
.split-container.no-preview .editor-pane { flex: 1; }

/* Editor-only on narrow split */
@media (max-width: 600px) {
  .split-container { flex-direction: column; }
  .split-handle { width: 100%; height: 4px; cursor: row-resize; }
  .split-handle::before { inset: -4px 0; }
}

/* ---------- Responsive / Mobile ---------- */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-md);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay { display: block; }
  .sidebar-overlay.visible { pointer-events: auto; }
  .sidebar-overlay:not(.visible) { pointer-events: none; opacity: 0; }
  .sidebar-overlay { transition: opacity var(--transition); opacity: 0; }
  .sidebar-overlay.visible { opacity: 1; }

  .topbar-menu-btn { display: flex; }
  .topbar-date { font-size: 14px; }
}

/* ---------- Smooth transitions ---------- */
.sidebar, .topbar, .main-area, .editor-area,
.md-editor, .md-preview, .status-bar, .notes-list-section,
.cal-grid, .note-item {
  transition-property: background, color, border-color;
  transition-duration: var(--transition);
  transition-timing-function: ease;
}

/* ---------- Markdown Toolbar ---------- */

.md-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  padding: 5px 8px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  user-select: none;
  min-height: 38px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 1px;
}

.toolbar-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 5px;
  flex-shrink: 0;
}

/* Toolbar button base */
.toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 5px 7px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  height: 28px;
}
.toolbar-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.toolbar-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.toolbar-btn:active { background: var(--bg-active); }
.toolbar-btn.active { background: var(--accent-light); color: var(--accent); }
[data-theme="dark"] .toolbar-btn.active { background: var(--accent-light); color: var(--accent); }

/* Heading dropdown trigger */
.toolbar-dropdown { position: relative; }

.toolbar-dropdown-trigger {
  gap: 4px;
  padding: 5px 8px;
}
.toolbar-dropdown-trigger .toolbar-label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
}
.chevron {
  transition: transform var(--transition);
  opacity: .6;
}
.toolbar-dropdown-trigger[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

/* Dropdown menu */
.toolbar-dropdown-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 500;
  min-width: 150px;
  padding: 4px;
  display: none;
  animation: dropIn .12s ease;
}
.toolbar-dropdown-menu.open { display: block; }

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  transition: background var(--transition);
  text-align: left;
}
.dropdown-item:hover { background: var(--bg-hover); }

.di-label {
  font-family: var(--font-display);
  font-weight: 700;
  min-width: 28px;
  color: var(--text-primary);
}
.dropdown-item:nth-child(1) .di-label { font-size: 16px; }
.dropdown-item:nth-child(2) .di-label { font-size: 13px; }
.dropdown-item:nth-child(3) .di-label { font-size: 11.5px; }
.dropdown-item:nth-child(4) .di-label { font-size: 10.5px; }

.di-desc {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  letter-spacing: .2px;
}

/* Compact toolbar on narrow panes / mobile */
@media (max-width: 520px) {
  .toolbar-divider { margin: 0 3px; }
  .toolbar-btn { padding: 4px 5px; }
  .toolbar-dropdown-trigger .toolbar-label { display: none; }
}

/* ---------- Search Modal ---------- */

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 16px 0;
  animation: fadeIn .15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.search-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0,0,0,.28), 0 4px 16px rgba(0,0,0,.14);
  width: 100%;
  max-width: 620px;
  overflow: hidden;
  animation: slideDown .18s cubic-bezier(.22,.68,0,1.2);
  display: flex;
  flex-direction: column;
  max-height: 72vh;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Search input row */
.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.search-icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--text-primary);
  caret-color: var(--accent);
  min-width: 0;
}
.search-input::placeholder { color: var(--text-muted); }

.search-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: .3px;
}

.search-close {
  flex-shrink: 0;
  opacity: .6;
}
.search-close:hover { opacity: 1; }

/* Filter chips */
.search-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  flex-shrink: 0;
  background: var(--bg-page);
}

.filter-chip {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .4px;
  padding: 4px 11px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.filter-chip:hover { background: var(--bg-hover); color: var(--text-primary); }
.filter-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.search-sort {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sort-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  letter-spacing: .4px;
}

.sort-select {
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 22px 3px 8px;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239b9189' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 5px center;
  background-size: 12px;
}
.sort-select:focus { border-color: var(--accent); }

/* Results list */
.search-results {
  overflow-y: auto;
  flex: 1;
  padding: 8px;
}

.search-empty {
  text-align: center;
  padding: 36px 24px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 14px;
  font-style: italic;
}

.search-empty-icon {
  display: block;
  margin: 0 auto 12px;
  opacity: .35;
}

.search-result-item {
  padding: 11px 13px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
  border: 1px solid transparent;
  margin-bottom: 3px;
}
.search-result-item:hover,
.search-result-item.focused {
  background: var(--bg-hover);
  border-color: var(--border);
}
.search-result-item.focused {
  background: var(--accent-light);
  border-color: var(--accent-dim);
  outline: none;
}
[data-theme="dark"] .search-result-item.focused {
  background: var(--accent-light);
  border-color: var(--accent-dim);
}

.sri-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 5px;
}

.sri-date {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: .5px;
  flex-shrink: 0;
}

.sri-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sri-matches {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sri-match {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-body);
}

/* Highlighted search term */
mark.search-hl {
  background: #fde68a;
  color: #92400e;
  border-radius: 2px;
  padding: 0 1px;
  font-style: normal;
  font-weight: 600;
}
[data-theme="dark"] mark.search-hl {
  background: #78350f;
  color: #fde68a;
}

/* Count badge */
.sri-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 2px 7px;
  border-radius: 99px;
  flex-shrink: 0;
  letter-spacing: .3px;
}

/* Footer hints */
.search-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 9px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-page);
  flex-shrink: 0;
}

.search-hint {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: .3px;
}

.search-hint kbd {
  font-size: 10px;
  padding: 1px 5px;
  background: var(--bg-active);
  border-color: var(--border-strong);
}

/* No results */
.no-query-state {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 13px;
}

.no-query-state .nq-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: block;
}

.recent-note-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 3px;
  padding: 5px 12px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.recent-note-chip:hover { background: var(--bg-active); color: var(--text-primary); }
.recent-note-chip .rn-date { color: var(--accent); }

/* ============================================================
   VSCode Theme Support
   ============================================================ */

/* -- Theme variable overrides -- */

/* One Dark Pro */
[data-vscode-theme="one-dark-pro"] {
  --bg-page:        #282c34;
  --bg-sidebar:     #21252b;
  --bg-card:        #2c313c;
  --bg-editor:      #282c34;
  --bg-hover:       #2c313a;
  --bg-active:      #3a3f4b;
  --text-primary:   #abb2bf;
  --text-secondary: #9da5b4;
  --text-muted:     #5c6370;
  --text-inverse:   #282c34;
  --accent:         #61afef;
  --accent-light:   #1e2a3a;
  --accent-dim:     #4d8ec4;
  --border:         #3a3f4b;
  --border-strong:  #4b5263;
  --shadow-sm:      0 1px 4px rgba(0,0,0,.4);
  --shadow-md:      0 6px 24px rgba(0,0,0,.5);
  --cal-today-bg:   #61afef;
  --cal-today-text: #282c34;
  --cal-dot:        #98c379;
  --cal-selected:   #abb2bf;
  --cal-selected-text: #282c34;
}

/* Dracula */
[data-vscode-theme="dracula"] {
  --bg-page:        #282a36;
  --bg-sidebar:     #21222c;
  --bg-card:        #2d2f3f;
  --bg-editor:      #282a36;
  --bg-hover:       #343746;
  --bg-active:      #44475a;
  --text-primary:   #f8f8f2;
  --text-secondary: #cdd6f4;
  --text-muted:     #6272a4;
  --text-inverse:   #282a36;
  --accent:         #bd93f9;
  --accent-light:   #3a2e55;
  --accent-dim:     #9a72d4;
  --border:         #44475a;
  --border-strong:  #6272a4;
  --shadow-sm:      0 1px 4px rgba(0,0,0,.4);
  --shadow-md:      0 6px 24px rgba(0,0,0,.5);
  --cal-today-bg:   #bd93f9;
  --cal-today-text: #282a36;
  --cal-dot:        #50fa7b;
  --cal-selected:   #f8f8f2;
  --cal-selected-text: #282a36;
}

/* Tokyo Night */
[data-vscode-theme="tokyo-night"] {
  --bg-page:        #1a1b26;
  --bg-sidebar:     #16161e;
  --bg-card:        #1f2335;
  --bg-editor:      #1a1b26;
  --bg-hover:       #252535;
  --bg-active:      #2f3145;
  --text-primary:   #c0caf5;
  --text-secondary: #9aa5ce;
  --text-muted:     #565f89;
  --text-inverse:   #1a1b26;
  --accent:         #7aa2f7;
  --accent-light:   #1e2547;
  --accent-dim:     #5d82cc;
  --border:         #292e42;
  --border-strong:  #3b4261;
  --shadow-sm:      0 1px 4px rgba(0,0,0,.5);
  --shadow-md:      0 6px 24px rgba(0,0,0,.6);
  --cal-today-bg:   #7aa2f7;
  --cal-today-text: #1a1b26;
  --cal-dot:        #9ece6a;
  --cal-selected:   #c0caf5;
  --cal-selected-text: #1a1b26;
}

/* Monokai Pro */
[data-vscode-theme="monokai-pro"] {
  --bg-page:        #2d2a2e;
  --bg-sidebar:     #221f22;
  --bg-card:        #332f34;
  --bg-editor:      #2d2a2e;
  --bg-hover:       #3a3640;
  --bg-active:      #48434f;
  --text-primary:   #fcfcfa;
  --text-secondary: #c9c5d0;
  --text-muted:     #727072;
  --text-inverse:   #2d2a2e;
  --accent:         #a9dc76;
  --accent-light:   #2a3620;
  --accent-dim:     #87b558;
  --border:         #403c42;
  --border-strong:  #58545a;
  --shadow-sm:      0 1px 4px rgba(0,0,0,.4);
  --shadow-md:      0 6px 24px rgba(0,0,0,.5);
  --cal-today-bg:   #a9dc76;
  --cal-today-text: #2d2a2e;
  --cal-dot:        #ff6188;
  --cal-selected:   #fcfcfa;
  --cal-selected-text: #2d2a2e;
}

/* GitHub Dark */
[data-vscode-theme="github-dark"] {
  --bg-page:        #0d1117;
  --bg-sidebar:     #010409;
  --bg-card:        #161b22;
  --bg-editor:      #0d1117;
  --bg-hover:       #1c2128;
  --bg-active:      #262c36;
  --text-primary:   #e6edf3;
  --text-secondary: #8d96a0;
  --text-muted:     #484f58;
  --text-inverse:   #0d1117;
  --accent:         #58a6ff;
  --accent-light:   #0c2340;
  --accent-dim:     #3d87db;
  --border:         #21262d;
  --border-strong:  #30363d;
  --shadow-sm:      0 1px 4px rgba(0,0,0,.6);
  --shadow-md:      0 6px 24px rgba(0,0,0,.7);
  --cal-today-bg:   #58a6ff;
  --cal-today-text: #0d1117;
  --cal-dot:        #3fb950;
  --cal-selected:   #e6edf3;
  --cal-selected-text: #0d1117;
}

/* Solarized Dark */
[data-vscode-theme="solarized-dark"] {
  --bg-page:        #002b36;
  --bg-sidebar:     #00212b;
  --bg-card:        #073642;
  --bg-editor:      #002b36;
  --bg-hover:       #0d3d4a;
  --bg-active:      #18505e;
  --text-primary:   #839496;
  --text-secondary: #657b83;
  --text-muted:     #586e75;
  --text-inverse:   #002b36;
  --accent:         #268bd2;
  --accent-light:   #052030;
  --accent-dim:     #1a6fa8;
  --border:         #073642;
  --border-strong:  #586e75;
  --shadow-sm:      0 1px 4px rgba(0,0,0,.4);
  --shadow-md:      0 6px 24px rgba(0,0,0,.5);
  --cal-today-bg:   #268bd2;
  --cal-today-text: #fdf6e3;
  --cal-dot:        #859900;
  --cal-selected:   #839496;
  --cal-selected-text: #002b36;
}

/* GitHub Light */
[data-vscode-theme="github-light"] {
  --bg-page:        #ffffff;
  --bg-sidebar:     #f6f8fa;
  --bg-card:        #ffffff;
  --bg-editor:      #ffffff;
  --bg-hover:       #f3f4f6;
  --bg-active:      #e8ecef;
  --text-primary:   #1f2328;
  --text-secondary: #656d76;
  --text-muted:     #9198a1;
  --text-inverse:   #ffffff;
  --accent:         #0969da;
  --accent-light:   #ddf4ff;
  --accent-dim:     #218bff;
  --border:         #d0d7de;
  --border-strong:  #adb5bd;
  --shadow-sm:      0 1px 3px rgba(31,35,40,.08);
  --shadow-md:      0 4px 16px rgba(31,35,40,.12);
  --cal-today-bg:   #0969da;
  --cal-today-text: #ffffff;
  --cal-dot:        #1a7f37;
  --cal-selected:   #1f2328;
  --cal-selected-text: #ffffff;
}

/* Solarized Light */
[data-vscode-theme="solarized-light"] {
  --bg-page:        #fdf6e3;
  --bg-sidebar:     #eee8d5;
  --bg-card:        #fdf6e3;
  --bg-editor:      #fdf6e3;
  --bg-hover:       #e8e2cf;
  --bg-active:      #ddd8c4;
  --text-primary:   #657b83;
  --text-secondary: #586e75;
  --text-muted:     #93a1a1;
  --text-inverse:   #fdf6e3;
  --accent:         #268bd2;
  --accent-light:   #d4e8f5;
  --accent-dim:     #1a6fa8;
  --border:         #cfc9b7;
  --border-strong:  #b3ad9a;
  --shadow-sm:      0 1px 3px rgba(0,43,54,.08);
  --shadow-md:      0 4px 16px rgba(0,43,54,.12);
  --cal-today-bg:   #268bd2;
  --cal-today-text: #fdf6e3;
  --cal-dot:        #859900;
  --cal-selected:   #657b83;
  --cal-selected-text: #fdf6e3;
}

/* -- Theme Picker UI -- */

.theme-picker-panel {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn .15s ease;
}

.theme-picker-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 22px 24px 18px;
  animation: slideDown .18s cubic-bezier(.22,.68,0,1.2);
}

.theme-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.theme-picker-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.2px;
}

.theme-section-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
}

/* Theme card */
.theme-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .12s;
  background: var(--bg-page);
  user-select: none;
}
.theme-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.theme-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* Mini preview swatch */
.theme-swatch {
  width: 48px;
  height: 36px;
  border-radius: 5px;
  overflow: hidden;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 40% 60%;
  border: 1px solid rgba(0,0,0,.15);
}
.swatch-sidebar { height: 100%; }
.swatch-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px;
  justify-content: center;
}
.swatch-line {
  border-radius: 2px;
  height: 3px;
}

.theme-info { flex: 1; min-width: 0; }
.theme-name {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.theme-variant {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-muted);
  letter-spacing: .4px;
  margin-top: 1px;
}

.theme-check {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.theme-check svg { width: 10px; height: 10px; color: white; }
.theme-card.active .theme-check { display: flex; }

.theme-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.theme-current-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
}
.theme-current-label strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ---------- Note Tabs Bar ---------- */

.note-tabs-bar {
  display: flex;
  align-items: stretch;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
  min-height: 36px;
}
.note-tabs-bar::-webkit-scrollbar { display: none; }

.note-tabs {
  display: flex;
  align-items: stretch;
  flex: 1;
  min-width: 0;
}

.note-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  min-width: 80px;
  max-width: 180px;
  border: none;
  border-right: 1px solid var(--border);
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
  position: relative;
}
.note-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.note-tab.active {
  background: var(--bg-editor);
  color: var(--text-primary);
  font-weight: 600;
}
.note-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

.note-tab-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.note-tab-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 3px;
  padding: 0;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition), color var(--transition);
}
.note-tab:hover .note-tab-close,
.note-tab.active .note-tab-close { opacity: .5; }
.note-tab-close:hover { opacity: 1 !important; background: var(--bg-active); color: var(--accent); }
.note-tab-close svg { width: 11px; height: 11px; }

/* Add-note button on the tab bar */
.add-note-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  min-width: 36px;
  background: none;
  border: none;
  border-left: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.add-note-tab:hover { background: var(--bg-hover); color: var(--accent); }
.add-note-tab svg { width: 15px; height: 15px; }

/* ---------- Calendar day count badge ---------- */

.cal-day { position: relative; }

.cal-note-count {
  position: absolute;
  top: 0px;
  right: 0px;
  font-size: 7px;
  font-family: var(--font-mono);
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  border-radius: 99px;
  min-width: 12px;
  height: 12px;
  line-height: 12px;
  text-align: center;
  padding: 0 2.5px;
  pointer-events: none;
}
.cal-day.cal-today .cal-note-count {
  background: #fff;
  color: var(--cal-today-bg);
}
.cal-day.cal-selected:not(.cal-today) .cal-note-count {
  background: var(--bg-page);
  color: var(--cal-selected);
}

/* ---------- Sidebar note list enhancements ---------- */

.note-item-count {
  display: inline-block;
  font-size: 9.5px;
  font-family: var(--font-mono);
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 99px;
  padding: 1px 7px;
  margin-left: 6px;
  font-weight: 500;
  vertical-align: middle;
  letter-spacing: .2px;
}

/* ---------- Sidebar Header Menu ---------- */

.sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.sidebar-menu-wrap {
  position: relative;
}

.sidebar-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 600;
  min-width: 180px;
  padding: 4px;
  animation: dropIn .12s ease;
}
.sidebar-menu.open { display: block; }

.sidebar-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-primary);
  text-align: left;
  transition: background var(--transition);
}
.sidebar-menu-item:hover { background: var(--bg-hover); }
.sidebar-menu-item svg {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.sidebar-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ---------- About Modal ---------- */

.about-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn .15s ease;
}

.about-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 400px;
  padding: 32px 28px 26px;
  text-align: center;
  position: relative;
  animation: slideDown .18s cubic-bezier(.22,.68,0,1.2);
}

.about-close {
  position: absolute;
  top: 14px;
  right: 14px;
  opacity: .5;
}
.about-close:hover { opacity: 1; }

.about-logo-block {
  width: 52px;
  height: 52px;
  background: var(--text-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}

.about-logo-mark {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  color: var(--bg-page);
  line-height: 1;
}

.about-app-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -.3px;
}

.about-tagline {
  font-size: 13.5px;
  color: var(--text-muted);
  font-style: italic;
  font-family: var(--font-body);
  margin-bottom: 18px;
}

.about-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.about-features {
  list-style: none;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.about-features li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.af-icon {
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  font-size: 13px;
}

.about-stats {
  display: flex;
  justify-content: center;
  gap: 28px;
  padding: 4px 0 6px;
  flex-wrap: wrap;
}

.about-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.about-stat-value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.5px;
}

.about-stat-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .8px;
}

.about-footer {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 16px;
  letter-spacing: .2px;
}

/* Danger variant for sidebar menu items */
.sidebar-menu-item--danger { color: #c0392b; }
.sidebar-menu-item--danger svg { color: #c0392b; }
.sidebar-menu-item--danger:hover { background: #fef2f2; color: #a93226; }
[data-theme="dark"] .sidebar-menu-item--danger { color: #e57373; }
[data-theme="dark"] .sidebar-menu-item--danger svg { color: #e57373; }
[data-theme="dark"] .sidebar-menu-item--danger:hover { background: #2d1515; color: #ef9a9a; }

/* ---------- Action Toast ---------- */

.toast--action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px 9px 18px;
  pointer-events: auto;
}

.toast-msg {
  flex: 1;
}

.toast-action-btn {
  background: none;
  border: 1px solid rgba(255,255,255,.35);
  color: inherit;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .5px;
  padding: 4px 12px;
  border-radius: 99px;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.toast-action-btn:hover { background: rgba(255,255,255,.15); }

/* ============================================================
   Font Settings
   ============================================================ */

/* -- Font face overrides (applied to <html>) -- */

[data-font="serif"] {
  --editor-font:       'Lora', Georgia, serif;
  --preview-font:      'Lora', Georgia, serif;
}
[data-font="sans"] {
  --editor-font:       'Inter', system-ui, sans-serif;
  --preview-font:      'Inter', system-ui, sans-serif;
}
[data-font="mono"] {
  --editor-font:       'Fira Code', 'JetBrains Mono', monospace;
  --preview-font:      'Fira Code', 'JetBrains Mono', monospace;
}
[data-font="handwriting"] {
  --editor-font:       'Caveat', cursive;
  --preview-font:      'Caveat', cursive;
}
[data-font="slab"] {
  --editor-font:       'Merriweather', Georgia, serif;
  --preview-font:      'Merriweather', Georgia, serif;
}

/* -- Font size — applied directly via CSS variable on <html> -- */
/* (set inline by JS: html.style.setProperty('--editor-font-size', ...) ) */

/* -- Font Settings Modal -- */

.font-settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn .15s ease;
}

.font-settings-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 22px 24px 20px;
  animation: slideDown .18s cubic-bezier(.22,.68,0,1.2);
}

.font-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.font-settings-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.2px;
}

.font-section-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* Font face cards */
.font-face-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.font-face-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 10px 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  background: var(--bg-page);
  transition: border-color .15s, box-shadow .15s, transform .12s;
  user-select: none;
}
.font-face-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.font-face-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.font-face-sample {
  font-size: 22px;
  line-height: 1.2;
  color: var(--text-primary);
}

.font-face-name {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: .4px;
  text-transform: uppercase;
}

/* Font size select */
.font-size-select-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.font-size-select {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-page);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 32px 7px 12px;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239b9189' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
  min-width: 90px;
  transition: border-color .15s;
}
.font-size-select:focus { border-color: var(--accent); }

.font-size-unit {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: .4px;
}

/* Live preview box */
.font-preview-box {
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-editor);
}

.font-preview-editor {
  padding: 14px 16px;
  font-family: var(--editor-font);
  font-size: var(--editor-font-size);
  color: var(--text-primary);
  line-height: 1.75;
}

.font-preview-divider {
  height: 1px;
  background: var(--border);
}

.font-preview-prose {
  padding: 14px 16px;
  font-family: var(--preview-font);
  font-size: var(--preview-font-size);
  color: var(--text-primary);
  line-height: 1.7;
  background: var(--bg-card);
}

/* ---------- About Modal — version meta & GitHub button ---------- */

.about-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
  margin-bottom: 2px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  letter-spacing: .3px;
}

.about-meta-sep { opacity: .4; }

.about-github-row {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.about-github-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 99px;
  border: 1px solid var(--border-strong);
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  letter-spacing: .3px;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.about-github-btn:hover {
  background: var(--text-primary);
  color: var(--bg-page);
  border-color: var(--text-primary);
}

.about-github-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
