/**
 * Main Application Stylesheet
 * Applied Skills: Impeccable + Taste Design (Editorial Workspace & Precision UI)
 * 3-Column Responsive Layout, Components, Modals, Status Indicators
 */

@import '/src/styles/tokens.css?v=0488ef6950775a37d8771ec4';

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

::selection {
  background-color: var(--primary-light);
  color: var(--primary);
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.55;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  caret-color: var(--primary);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

button:active:not(:disabled) {
  transform: translateY(0.5px) scale(0.99);
}

/* App Shell (3-Column Layout) */
#app {
  display: flex;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  position: relative;
  background: var(--bg-app);
}

/* ========================================================
   1. Left Column: Navigation Sidebar (Recessed Stone Rail)
   ======================================================== */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100%;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  user-select: none;
  transition: transform var(--transition-normal);
  z-index: 20;
}

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

.app-branding {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Machined Ink Monogram Badge (Replaces AI Purple Gradient) */
.app-logo {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--text-main);
  color: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13.5px;
  letter-spacing: -0.03em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), var(--shadow-xs);
}

.app-title {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-main);
}

.btn-new-note {
  margin: 12px 14px;
  padding: 9px 14px;
  background: var(--primary);
  color: #ffffff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), var(--shadow-xs);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.btn-new-note:hover {
  background: var(--primary-hover);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), var(--shadow-sm);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 14px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  padding: 16px 8px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-section-title .btn-icon-mini {
  color: var(--text-muted);
  font-size: 14px;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}
.nav-section-title .btn-icon-mini:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 6.5px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: left;
  margin-bottom: 2px;
  border: 1px solid transparent;
}

.nav-item[hidden] { display: none; }

.local-profile {
  padding: 10px 12px;
  border-top: 1px solid var(--border-subtle);
  display: grid;
  gap: 6px;
  background: rgba(0, 0, 0, 0.015);
}
.local-profile button { width: 100%; text-align: left; overflow-wrap: anywhere; }
.local-profile small { color: var(--text-dim); font-size: 11px; overflow-wrap: anywhere; }

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}
[data-theme='dark'] .nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: 600;
  border-color: var(--border-subtle);
  box-shadow: var(--shadow-xs);
}

.nav-item.active .app-icon {
  color: var(--primary);
}

.nav-item-content {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item .badge,
.badge {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 1px 6.5px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-muted);
}
[data-theme='dark'] .nav-item .badge,
[data-theme='dark'] .badge {
  background: rgba(255, 255, 255, 0.07);
}
.nav-item.active .badge {
  background: var(--primary-light);
  color: var(--primary);
}

.folder-item {
  position: relative;
}
.folder-item:hover .folder-actions {
  opacity: 1;
}
.folder-actions {
  opacity: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  transition: opacity var(--transition-fast);
}
.folder-actions button {
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-dim);
}
.folder-actions button:hover {
  background: var(--danger-light);
  color: var(--danger);
}

.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 4px 6px;
}
.tag-chip {
  font-size: 11.5px;
  font-weight: 500;
  padding: 2.5px 8.5px;
  border-radius: var(--radius-xs);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.tag-chip:hover, .tag-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  background: var(--bg-sidebar);
}

.sidebar-footer button {
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
}
.sidebar-footer button:hover {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: var(--shadow-xs);
}

/* ========================================================
   2. Middle Column: Note Index Panel
   ======================================================== */
.note-list-panel {
  width: var(--list-width);
  min-width: var(--list-width);
  height: 100%;
  background: var(--bg-list);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  transition: width var(--transition-normal), min-width var(--transition-normal);
  z-index: 10;
}

.note-list-panel.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  overflow: hidden !important;
  border-right: none;
}

.list-header {
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: var(--bg-list);
}

.list-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 26px;
}

.list-header-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-main);
}

.list-header-count {
  font-size: 11.5px;
  color: var(--text-dim);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--bg-sidebar);
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.search-box {
  position: relative;
  width: 100%;
}

.search-box input {
  width: 100%;
  padding: 7.5px 30px 7.5px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-main);
  box-shadow: var(--shadow-xs);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-box input::placeholder {
  color: var(--text-dim);
}

.search-box input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-icon-left {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 13px;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
}

.search-clear-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 12px;
  padding: 2px 5px;
  border-radius: 4px;
  display: none;
}

.search-clear-btn.visible {
  display: inline-flex;
}

.list-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-dim);
}

.list-sort-select {
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  padding: 2px 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}
.list-sort-select:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.created-date-filter-bar {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-sm) !important;
  padding: 5px 10px !important;
  margin-top: 2px !important;
  box-shadow: var(--shadow-xs);
  font-variant-numeric: tabular-nums;
}

/* Note Cards Scroll List */
.notes-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.note-card {
  padding: 12px 13px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
  position: relative;
}

.note-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.note-card.active {
  background: var(--bg-card-selected);
  border-color: var(--primary);
  box-shadow: inset 3px 0 0 var(--primary), var(--shadow-sm);
}

.note-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.note-card-title {
  min-width: 0;
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.35;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.note-card-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.note-card-pin,
.note-card-star {
  font-size: 13px;
  color: var(--text-dim);
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  min-height: 26px;
  border-radius: var(--radius-xs);
}
.note-card-pin.active,
.note-card-pin.active:hover { color: var(--danger); background: var(--danger-light); }
.note-card-pin.active .app-icon { fill: currentColor; }
.note-card-actions button:hover { background: var(--bg-hover); color: var(--text-main); }
.note-card-actions button:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }
.note-card-actions button:disabled { opacity: .45; }
.note-card-star.active {
  color: var(--accent-star);
}

.note-card-snippet {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.48;
  height: 2.96em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 9px;
}

.note-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}

.note-card-tags {
  display: flex;
  gap: 4px;
  overflow: hidden;
}

.note-card-tag {
  background: var(--bg-sidebar);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 500;
  white-space: nowrap;
}

.empty-list-notice {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.6;
}

#startWelcome.empty-list-notice {
  max-width: 460px;
  margin: 56px auto;
  padding: 36px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--border-inner-light), var(--shadow-sm);
}
#startWelcome h2 {
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.025em;
  color: var(--text-main);
  margin-bottom: 8px;
}
#startWelcome p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}
#startWelcome button {
  margin: 0 3px;
}

/* ========================================================
   3. Right Column: Editorial Writing Sanctuary
   ======================================================== */
.editor-panel {
  flex: 1;
  height: 100%;
  background: var(--bg-editor);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.editor-header {
  height: var(--header-height);
  padding: 0 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-editor);
  z-index: 10;
}

.editor-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-toggle-list {
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xs);
}
.btn-toggle-list:hover {
  color: var(--text-main);
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

/* Save Status Indicator Badge */
.save-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3.5px 10px;
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}

.save-status-badge.idle,
.save-status-badge.saved {
  background: var(--success-light);
  color: var(--success);
}
.save-status-badge.saved .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.save-status-badge.saving {
  background: var(--warning-light);
  color: var(--warning);
}
.save-status-badge.saving .spinner {
  width: 10px;
  height: 10px;
  border: 1.8px solid var(--warning);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.save-status-badge.error {
  background: var(--danger-light);
  color: var(--danger);
}
.save-status-badge.error .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--danger);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.editor-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.editor-action-btn {
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid transparent;
}
.editor-action-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--border-subtle);
}
.editor-action-btn.danger:hover {
  background: var(--danger-light);
  color: var(--danger);
  border-color: rgba(191, 54, 52, 0.2);
}

/* Editor Metadata Property Bar */
.editor-metadata-bar {
  padding: 8px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  background: var(--bg-list);
}

.meta-folder-select,
.meta-date-input {
  padding: 3.5px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 11.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  outline: none;
  box-shadow: var(--shadow-xs);
}
.meta-folder-select:focus,
.meta-date-input:focus {
  border-color: var(--border-focus);
}

.btn-template {
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-fast);
}
.btn-template:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.note-card-due {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 1.5px 6px;
  border-radius: 4px;
  background: var(--primary-light);
  color: var(--primary);
}
.note-card-due.overdue {
  background: var(--danger-light);
  color: var(--danger);
}
.note-card-todo-progress {
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  background: var(--bg-sidebar);
  padding: 1.5px 6px;
  border-radius: 4px;
}

.meta-tags-container {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  flex: 1;
}

.meta-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  padding: 1.5px 7px;
  border-radius: var(--radius-xs);
}
.meta-tag-pill .remove-tag-btn {
  font-size: 10.5px;
  color: var(--text-dim);
  cursor: pointer;
}
.meta-tag-pill .remove-tag-btn:hover {
  color: var(--danger);
}

.meta-tag-input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 11.5px;
  min-width: 95px;
  color: var(--text-main);
}
.meta-tag-input::placeholder {
  color: var(--text-dim);
}

.meta-updated-time {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

/* Formatting Toolbar Strip */
.format-toolbar {
  padding: 6px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--bg-editor);
  overflow-x: auto;
}

.format-btn {
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 550;
  border: 1px solid transparent;
}
.format-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}
.format-btn.active-mode {
  background: var(--primary-light);
  border-color: rgba(30, 63, 110, 0.16);
  color: var(--primary) !important;
}
.format-divider {
  width: 1px;
  height: 15px;
  background: var(--border-subtle);
  margin: 0 4px;
}

/* Editor Main Content Sanctuary (Centered 800px Measure) */
.editor-content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 36px max(32px, calc((100% - var(--editor-max-width)) / 2)) 48px;
  overflow-y: auto;
  background: var(--bg-editor);
}

.editor-title-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  outline: none;
  background: transparent;
  font-family: var(--font-display);
  font-size: 29px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.032em;
  padding-bottom: 14px;
  margin-bottom: 20px;
  line-height: 1.24;
}
.editor-title-input::placeholder {
  color: var(--text-dim);
  font-weight: 700;
}

.editor-body-textarea {
  width: 100%;
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  resize: none;
  font-size: 15.5px;
  line-height: 1.78;
  color: var(--text-main);
  font-family: var(--font-mono);
  min-height: 360px;
}
.editor-body-textarea::placeholder {
  color: var(--text-dim);
}

/* Word Counter Footer */
.editor-footer-status {
  padding: 7px 24px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-list);
}

/* Trash Notice Banner */
.trash-banner {
  background: var(--warning-light);
  border-bottom: 1px solid rgba(181, 104, 18, 0.25);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-main);
}
.trash-banner button {
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  font-weight: 600;
  font-size: 12px;
}
.trash-banner .btn-restore {
  background: var(--primary);
  color: white;
}
.trash-banner .btn-perm-delete {
  background: var(--danger);
  color: white;
}

/* ========================================================
   Modals & Dialogs (Machined Elevation)
   ======================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 21, 0.42);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 90%;
  max-width: 520px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--border-inner-light), var(--shadow-modal);
  overflow: hidden;
  transform: translateY(8px) scale(0.985);
  transition: transform var(--transition-fast);
}

.modal-overlay.active .modal-card {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-body {
  padding: 20px 22px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 12px 22px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--bg-list);
}

.btn-secondary {
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  font-size: 13px;
  font-weight: 550;
  color: var(--text-muted);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  color: var(--text-main);
}

.btn-primary {
  padding: 7px 15px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), var(--shadow-xs);
}
.btn-primary:hover {
  background: var(--primary-hover);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}

.toast {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--text-main);
  color: var(--text-inverse);
  font-size: 12.5px;
  font-weight: 550;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  transition: all var(--transition-fast);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* Mobile-Only Elements Utility */
.btn-mobile-only {
  display: none !important;
}

.sidebar-overlay {
  display: none;
}

/* Responsive Media Queries (Mobile & Tablet) */
@media (max-width: 768px) {
  .btn-mobile-only {
    display: inline-flex !important;
  }

  .btn-toggle-list {
    display: none !important;
  }

  /* 1. Sidebar Drawer */
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(12, 14, 18, 0.48);
    backdrop-filter: blur(3px);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
  }
  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    z-index: 100;
    transform: translateX(-100%);
    box-shadow: var(--shadow-modal);
    transition: transform var(--transition-normal);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  /* 2. One View at a Time (Mobile View Mode) */
  #app.mobile-view-list .note-list-panel {
    display: flex !important;
    width: 100vw !important;
    min-width: 100vw !important;
    border-right: none;
  }
  #app.mobile-view-list .editor-panel {
    display: none !important;
  }

  #app.mobile-view-editor .note-list-panel {
    display: none !important;
  }
  #app.mobile-view-editor .editor-panel {
    display: flex !important;
    width: 100vw !important;
    min-width: 100vw !important;
  }

  /* 3. Editor Fine-Tuning on Mobile */
  .editor-header {
    padding: 0 12px;
  }
  .editor-header-actions {
    gap: 4px;
  }
  .editor-action-btn {
    padding: 4px 8px;
    font-size: 12px;
  }
  .editor-metadata-bar {
    padding: 8px 12px;
    gap: 8px;
  }
  .editor-content-area {
    padding: 20px 16px 36px;
  }
  .editor-title-input {
    font-size: 23px;
    margin-bottom: 14px;
    padding-bottom: 10px;
  }
  .editor-body-textarea {
    font-size: 15px;
  }
  .format-toolbar {
    padding: 6px 12px;
  }
}

/* ========================================================
   Calendar View Panel & Interactive Scheduling Styles
   ======================================================== */

.calendar-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-surface);
}

.calendar-header {
  height: 56px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.calendar-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.calendar-month-title {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  min-width: 125px;
  font-variant-numeric: tabular-nums;
}

.calendar-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-weekdays-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  padding: 8px 16px;
  background: var(--bg-list);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
  flex-shrink: 0;
}

.cal-weekday.sun { color: var(--danger); }
.cal-weekday.sat { color: var(--primary); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(88px, 1fr);
  gap: 1px;
  background: var(--border-subtle);
  flex: 1;
  overflow-y: auto;
  border-bottom: 1px solid var(--border-subtle);
}

.cal-day-cell {
  background: var(--bg-card);
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: background-color var(--transition-fast);
  min-height: 88px;
  position: relative;
}

.cal-day-cell:hover {
  background: var(--bg-card-hover);
}

.cal-day-cell.other-month {
  background: var(--bg-list);
  opacity: 0.5;
}

.cal-day-cell.today {
  background: var(--primary-light);
}

.cal-day-cell.today .cal-day-num {
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cal-day-cell.selected {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  background: var(--bg-card-selected);
}

.cal-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.cal-day-num {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-main);
}

.cal-count-badge {
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  padding: 1px 5px;
  border-radius: 10px;
  background: var(--bg-sidebar);
  color: var(--text-dim);
  font-weight: 600;
}

.editor-rich-view a.note-web-link {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.editor-rich-view a.note-web-link::after {
  content: ' ↗';
  font-size: .8em;
  opacity: .75;
}
.note-link-dialog { width: min(480px, calc(100vw - 32px)); }
.note-link-address {
  padding: 12px;
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow-wrap: anywhere;
  font-size: 13px;
  font-family: var(--font-mono);
  line-height: 1.65;
  margin: 16px 0;
}
.note-link-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.note-link-actions > a, .note-link-actions > button { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; }

.cal-events-container {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.cal-event-chip {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: transform 0.12s ease;
}

.cal-event-chip:hover {
  transform: translateY(-1px);
}

.cal-event-chip.created {
  background: var(--primary-light);
  color: var(--primary);
  border-left: 2.5px solid var(--primary);
  font-weight: 550;
}

.cal-event-chip.due {
  background: var(--warning-light);
  color: var(--warning);
  border-left: 2.5px solid var(--warning);
  font-weight: 550;
}

.cal-more-chip {
  font-size: 10.5px;
  color: var(--text-dim);
  font-weight: 600;
  padding-left: 4px;
}

/* Calendar Day Drawer */
.calendar-day-drawer {
  background: var(--bg-list);
  border-top: 1px solid var(--border-subtle);
  padding: 14px 22px;
  max-height: 200px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.day-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.day-drawer-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
}

.day-drawer-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.day-drawer-notes-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.day-drawer-card {
  padding: 9px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-width: 200px;
  max-width: 300px;
  flex: 1;
}

.day-drawer-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.day-drawer-card-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-drawer-card-meta {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.note-card-created {
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  background: var(--bg-list);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}

/* ========================================================
   Interactive Checklist Widget & Strikethrough Styles
   ======================================================== */

.interactive-checklist-panel {
  background: var(--bg-list);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-xs);
}

.checklist-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.checklist-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.btn-add-todo {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
}

.btn-add-todo:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.checklist-items-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.checklist-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  padding: 3px 6px;
  border-radius: var(--radius-xs);
  transition: background-color 0.15s ease;
}

.checklist-item-row:hover {
  background: var(--bg-hover);
}

.checklist-item-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
}

.checklist-item-input {
  flex: 1;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-main);
  font-size: 14px;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  font-family: inherit;
  outline: none;
}

.checklist-item-input:hover {
  border-color: var(--border-subtle);
}

.checklist-item-input:focus {
  background: var(--bg-card);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.checklist-item-text {
  flex: 1;
  color: var(--text-main);
  line-height: 1.45;
  word-break: break-all;
}

.checklist-item-row.completed .checklist-item-input,
.checklist-item-row.completed .checklist-item-text {
  text-decoration: line-through;
  text-decoration-color: var(--text-dim);
  text-decoration-thickness: 1.5px;
  color: var(--text-dim);
  opacity: 0.65;
}

.btn-remove-todo {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0.4;
  line-height: 1;
}

.checklist-item-row:hover .btn-remove-todo {
  opacity: 1;
}

.btn-remove-todo:hover {
  color: var(--danger);
  background: var(--danger-light);
}

.note-card.all-completed .note-card-title {
  text-decoration: line-through;
  text-decoration-color: var(--text-dim);
  opacity: 0.72;
}

.note-card-todo-progress.all-done {
  background: var(--success-light);
  color: var(--success);
}

/* ========================================================
   Rich / Visual Interactive Editor Sanctuary Styles
   ======================================================== */
.editor-rich-view {
  min-height: 420px;
  padding: 4px 2px 64px;
  background: transparent;
  color: var(--text-main);
  border: none;
  border-radius: 0;
  font-size: 15.5px;
  line-height: 1.78;
  letter-spacing: -0.008em;
  outline: none;
  overflow-y: visible;
  word-break: break-word;
}

.editor-rich-view:focus {
  outline: none;
  box-shadow: none;
}

.editor-rich-view:empty:before {
  content: attr(placeholder);
  color: var(--text-dim);
  pointer-events: none;
  display: block;
}

/* Editorial Markdown Typography */
.editor-rich-view h1 {
  font-size: 1.65em;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 26px 0 10px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
  text-wrap: balance;
}
.editor-rich-view h2 {
  font-size: 1.35em;
  font-weight: 700;
  letter-spacing: -0.022em;
  margin: 22px 0 8px;
  color: var(--text-main);
  text-wrap: balance;
}
.editor-rich-view h3 {
  font-size: 1.14em;
  font-weight: 650;
  letter-spacing: -0.015em;
  margin: 18px 0 6px;
  color: var(--text-main);
  text-wrap: balance;
}
.editor-rich-view p { margin: 9px 0; }
.editor-rich-view ul, .editor-rich-view ol {
  margin: 9px 0;
  padding-inline-start: 1.85em;
  list-style-position: outside;
}
.editor-rich-view li { padding-inline-start: .25em; margin: 3px 0; }
.editor-rich-view li > ul, .editor-rich-view li > ol { margin: 4px 0; }

.editor-rich-view blockquote {
  border-left: 3px solid var(--primary);
  padding: 10px 16px;
  margin: 14px 0;
  background: var(--bg-list);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
}

.editor-rich-view pre {
  background: var(--bg-list);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 14px 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
}
.editor-rich-view code {
  font-family: var(--font-mono);
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  padding: 1.5px 5px;
  border-radius: 4px;
  font-size: 0.88em;
}
.editor-rich-view pre code {
  background: transparent;
  border: none;
  padding: 0;
}

/* Table Formatting */
.editor-rich-view table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.editor-rich-view th, .editor-rich-view td {
  border: 1px solid var(--border-subtle);
  padding: 9px 13px;
  text-align: left;
}
.editor-rich-view th {
  background: var(--bg-list);
  font-weight: 650;
}

/* Visual Task Item */
.rich-task-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 6px 0;
  user-select: text;
}
.rich-task-item input[type="checkbox"] {
  width: 16.5px;
  height: 16.5px;
  margin-top: 4px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
.rich-task-item.completed .rich-task-text {
  text-decoration: line-through;
  text-decoration-color: var(--text-dim);
  text-decoration-thickness: 1.5px;
  color: var(--text-dim);
  opacity: 0.68;
}
.rich-task-text {
  flex: 1;
}

/* Inline Image */
.note-inline-image {
  max-width: 100%;
  max-height: 480px;
  border-radius: var(--radius-md);
  margin: 12px 0;
  cursor: zoom-in;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.note-inline-image:hover {
  transform: scale(1.005);
  box-shadow: var(--shadow-md);
}

/* Attachments Strip */
.editor-attachments-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-list);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  box-shadow: var(--shadow-xs);
}
.attachment-chip .btn-del-attachment {
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 11px;
  padding: 2px;
  border-radius: 3px;
}
.attachment-chip .btn-del-attachment:hover {
  color: var(--danger);
}

/* Search Highlight */
.search-highlight {
  background: #fde68a;
  color: #78350f;
  padding: 1px 3px;
  border-radius: 3px;
  font-weight: 600;
}
[data-theme="dark"] .search-highlight {
  background: rgba(245, 166, 35, 0.35);
  color: #fef3c7;
}

/* Pinned Note Card */
.note-card.pinned {
  border-left: 3px solid var(--primary);
}
.note-card-pin-badge {
  font-size: 11px;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 700;
}

/* Version History Item */
.version-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-list);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.version-history-item:hover {
  background: var(--bg-hover);
}
.version-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.version-time {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-main);
}
.version-preview {
  font-size: 12px;
  color: var(--text-dim);
  max-width: 380px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-trash-row {
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
}
.nav-trash-row:has(.nav-item.active) {
  background: var(--bg-card);
  box-shadow: var(--shadow-xs);
}
.nav-trash-row .nav-item {
  flex: 1;
  min-width: 0;
  margin: 0;
}
.btn-empty-trash {
  flex: none;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--danger);
  border-radius: var(--radius-xs);
  margin-right: 4px;
}
.btn-empty-trash:hover:not(:disabled) {
  background: var(--danger-light);
}
.btn-empty-trash:disabled {
  opacity: .35;
  cursor: default;
}
.btn-empty-trash:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
