@import '../src/styles/tokens.css';

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body, 'DM Sans', sans-serif);
  background: #0a0a0f;
  color: #f0eee8;
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════════════
   APP SHELL
══════════════════════════════════════════════ */
.notes-app {
  display: flex;
  height: calc(100vh - 68px);
  position: relative;
}

/* ══════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════ */
.sidebar {
  width: 300px;
  min-width: 300px;
  background: #0d0d16;
  border-right: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}

/* Header */
.sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.sidebar__title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #f0eee8;
  letter-spacing: -0.01em;
}

.sidebar__title svg { opacity: 0.7; }

.btn-new-note {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(201,168,76,0.3);
  background: rgba(201,168,76,0.08);
  color: #c9a84c;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.18s;
  flex-shrink: 0;
}
.btn-new-note:hover {
  background: rgba(201,168,76,0.18);
  border-color: rgba(201,168,76,0.5);
  transform: scale(1.06);
}

/* Search */
.sidebar__search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 12px 0;
  padding: 9px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  flex-shrink: 0;
  transition: border-color 0.18s;
}
.sidebar__search:focus-within {
  border-color: rgba(201,168,76,0.3);
  background: rgba(255,255,255,0.06);
}
.sidebar__search svg { opacity: 0.35; flex-shrink: 0; }
.sidebar__search input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #f0eee8;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  min-width: 0;
}
.sidebar__search input::placeholder { color: rgba(240,238,232,0.3); }

.search-clear {
  background: none; border: none; padding: 0; cursor: pointer;
  color: rgba(240,238,232,0.35);
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  transition: color 0.15s;
  flex-shrink: 0;
}
.search-clear:hover { color: rgba(240,238,232,0.7); }

/* Filter tabs */
.sidebar__filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 6px;
  flex-shrink: 0;
}

.filter-tabs {
  display: flex;
  gap: 3px;
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: rgba(240,238,232,0.4);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.filter-tab:hover { background: rgba(255,255,255,0.05); color: rgba(240,238,232,0.7); }
.filter-tab.active {
  background: rgba(201,168,76,0.12);
  color: #c9a84c;
  font-weight: 600;
}

.sort-select {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 7px;
  color: rgba(240,238,232,0.5);
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  padding: 4px 8px;
  outline: none;
  cursor: pointer;
  transition: all 0.15s;
}
.sort-select:focus { border-color: rgba(201,168,76,0.3); color: #f0eee8; }

/* Tag filter bar */
.tag-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 12px 8px;
  flex-shrink: 0;
  min-height: 0;
}

.tag-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: rgba(240,238,232,0.45);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.02em;
}
.tag-filter-chip:hover { border-color: rgba(201,168,76,0.35); color: #c9a84c; }
.tag-filter-chip.active {
  background: rgba(201,168,76,0.12);
  border-color: rgba(201,168,76,0.4);
  color: #c9a84c;
}

/* Note List */
.note-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
}
.note-list::-webkit-scrollbar { width: 4px; }
.note-list::-webkit-scrollbar-track { background: transparent; }
.note-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.note-list__loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 20px;
  color: rgba(240,238,232,0.3);
  font-size: 13px;
}

.spinner {
  width: 22px; height: 22px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: #c9a84c;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.note-list__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 16px;
  text-align: center;
  color: rgba(240,238,232,0.25);
  font-size: 13px;
}
.note-list__empty svg { opacity: 0.2; margin-bottom: 4px; }

/* Note Card */
.note-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 12px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  margin-bottom: 3px;
}
.note-card:hover {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.07);
}
.note-card.active {
  background: rgba(201,168,76,0.08);
  border-color: rgba(201,168,76,0.22);
}

.note-card__top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.note-card__color-strip {
  width: 3px;
  min-height: 14px;
  border-radius: 2px;
  flex-shrink: 0;
  margin-top: 3px;
  align-self: stretch;
}

.note-card__meta {
  flex: 1;
  min-width: 0;
}

.note-card__title {
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #f0eee8;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.note-card__title.untitled { color: rgba(240,238,232,0.3); font-style: italic; font-weight: 400; }

.note-card__preview {
  font-size: 12px;
  color: rgba(240,238,232,0.35);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 3px;
}

.note-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 2px;
}

.note-card__date {
  font-size: 10.5px;
  color: rgba(240,238,232,0.22);
  flex-shrink: 0;
}

.note-card__badges {
  display: flex;
  align-items: center;
  gap: 4px;
}

.badge-pin, .badge-archive {
  display: inline-flex;
  align-items: center;
  opacity: 0.5;
}

.note-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.mini-tag {
  padding: 1.5px 6px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: rgba(255,255,255,0.06);
  color: rgba(240,238,232,0.35);
  border: 1px solid rgba(255,255,255,0.08);
}

/* Sidebar stats */
.sidebar__stats {
  padding: 10px 16px;
  border-top: 1px solid rgba(255,255,255,0.05);
  font-size: 11px;
  color: rgba(240,238,232,0.22);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

/* ══════════════════════════════════════════════
   SIDEBAR TOGGLE (mobile)
══════════════════════════════════════════════ */
.sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 500;
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: #0d0d16;
  color: rgba(240,238,232,0.7);
  cursor: pointer;
  align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  transition: all 0.18s;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.06); }

/* ══════════════════════════════════════════════
   EDITOR AREA
══════════════════════════════════════════════ */
.editor-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: #0a0a0f;
}

/* Empty state */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  animation: fadeIn 0.4s both;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.empty-state__icon {
  margin-bottom: 8px;
  animation: float 4s ease-in-out infinite;
}
@keyframes float {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

.empty-state__title {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: rgba(240,238,232,0.6);
  margin: 0;
  letter-spacing: -0.02em;
}

.empty-state__desc {
  font-size: 14px;
  color: rgba(240,238,232,0.3);
  margin: 0;
  text-align: center;
  max-width: 320px;
  line-height: 1.6;
}

.btn-create-first {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 11px 22px;
  border-radius: 12px;
  border: 1px solid rgba(201,168,76,0.35);
  background: rgba(201,168,76,0.1);
  color: #c9a84c;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
  letter-spacing: -0.01em;
}
.btn-create-first:hover {
  background: rgba(201,168,76,0.2);
  border-color: rgba(201,168,76,0.55);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(201,168,76,0.15);
}

/* Editor Panel */
.editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn 0.3s both;
}

/* Editor Header */
.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.editor-header__left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

/* Color picker */
.color-picker-wrap { position: relative; flex-shrink: 0; }

.note-color-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  transition: background 0.15s;
}
.note-color-btn:hover { background: rgba(255,255,255,0.07); }

.color-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.12);
  display: block;
  transition: all 0.15s;
}

.color-picker-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: #0d0d14;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.65);
  z-index: 200;
  animation: popIn 0.15s cubic-bezier(0.4,0,0.2,1) both;
}
@keyframes popIn {
  from { opacity:0; transform:scale(0.95) translateY(-4px); }
  to   { opacity:1; transform:scale(1) translateY(0); }
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(4, 22px);
  gap: 6px;
}

.color-opt {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.12);
  cursor: pointer;
  transition: all 0.15s;
  background: rgba(255,255,255,0.1);
}
.color-opt[data-color="default"] {
  background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
}
.color-opt:hover { transform: scale(1.2); border-color: rgba(255,255,255,0.4); }
.color-opt.selected { border-color: white; transform: scale(1.15); }

/* Title input */
.note-title-input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: #f0eee8;
  letter-spacing: -0.02em;
  caret-color: #c9a84c;
}
.note-title-input::placeholder { color: rgba(240,238,232,0.2); }

/* Header actions */
.editor-header__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-action-btn {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.07);
  background: transparent;
  color: rgba(240,238,232,0.4);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.header-action-btn:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(240,238,232,0.85);
  border-color: rgba(255,255,255,0.14);
}
.header-action-btn.active {
  background: rgba(201,168,76,0.12);
  border-color: rgba(201,168,76,0.35);
  color: #c9a84c;
}
.header-action-btn--danger:hover {
  background: rgba(240,112,104,0.1);
  border-color: rgba(240,112,104,0.3);
  color: #f07068;
}

.word-count {
  font-size: 12px;
  color: rgba(240,238,232,0.25);
  padding: 0 4px;
  white-space: nowrap;
}

.save-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: rgba(240,238,232,0.3);
  white-space: nowrap;
}
.save-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #4fd69c;
  flex-shrink: 0;
  transition: background 0.3s;
}
.save-status.saving .save-dot { background: #c9a84c; animation: blink 1s infinite; }
.save-status.error .save-dot { background: #f07068; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* Tags row */
.tags-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
  min-height: 44px;
}

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  font-size: 11px;
  font-weight: 600;
  color: rgba(240,238,232,0.65);
  letter-spacing: 0.03em;
}
.tag-pill button {
  background: none; border: none; padding: 0; cursor: pointer;
  color: rgba(240,238,232,0.35);
  display: flex; align-items: center;
  transition: color 0.15s;
  line-height: 1;
}
.tag-pill button:hover { color: #f07068; }

.btn-add-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px dashed rgba(255,255,255,0.15);
  background: transparent;
  color: rgba(240,238,232,0.3);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-add-tag:hover {
  border-color: rgba(201,168,76,0.4);
  color: #c9a84c;
  background: rgba(201,168,76,0.06);
}

.tag-input {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(201,168,76,0.35);
  background: rgba(201,168,76,0.06);
  color: #f0eee8;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  outline: none;
  width: 120px;
  caret-color: #c9a84c;
}
.tag-input::placeholder { color: rgba(240,238,232,0.3); }

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  padding: 8px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background: rgba(255,255,255,0.015);
  flex-shrink: 0;
}

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

.toolbar-sep {
  width: 1px;
  height: 18px;
  background: rgba(255,255,255,0.08);
  margin: 0 4px;
  flex-shrink: 0;
}

.tool-btn {
  min-width: 28px; height: 28px;
  padding: 0 6px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: rgba(240,238,232,0.5);
  font-family: 'DM Sans', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.12s;
  white-space: nowrap;
}
.tool-btn:hover {
  background: rgba(255,255,255,0.08);
  color: #f0eee8;
}
.tool-btn.active {
  background: rgba(201,168,76,0.14);
  color: #c9a84c;
}

/* Note Content (editor) */
.note-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px 32px;
  outline: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  line-height: 1.8;
  color: rgba(240,238,232,0.88);
  caret-color: #c9a84c;
}
.note-content::-webkit-scrollbar { width: 5px; }
.note-content::-webkit-scrollbar-track { background: transparent; }
.note-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

.note-content:empty::before {
  content: attr(data-placeholder);
  color: rgba(240,238,232,0.18);
  pointer-events: none;
}

/* Rich content styles */
.note-content h1 {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #f0eee8;
  margin: 0.5em 0 0.3em;
  line-height: 1.15;
  border-bottom: 1px solid rgba(201,168,76,0.2);
  padding-bottom: 0.3em;
}
.note-content h2 {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #f0eee8;
  margin: 0.6em 0 0.3em;
}
.note-content h3 {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: rgba(240,238,232,0.85);
  margin: 0.7em 0 0.3em;
}
.note-content p { margin: 0 0 0.6em; }
.note-content ul, .note-content ol {
  padding-left: 1.6em;
  margin: 0.4em 0 0.8em;
}
.note-content li { margin-bottom: 0.3em; }
.note-content strong { color: #f0eee8; }
.note-content em { color: rgba(240,238,232,0.8); }
.note-content u { text-decoration-color: rgba(201,168,76,0.5); }
.note-content a {
  color: #60c8f0;
  text-decoration: underline;
  text-decoration-color: rgba(96,200,240,0.35);
}
.note-content a:hover { color: #a0d8f0; }
.note-content hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin: 1.2em 0;
}
.note-content pre, .note-content code {
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 13px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 2px 6px;
  color: #a064ff;
}
.note-content pre {
  padding: 14px 16px;
  margin: 0.8em 0;
  overflow-x: auto;
  line-height: 1.6;
}
.note-content pre code {
  background: none;
  border: none;
  padding: 0;
}
.note-content blockquote {
  border-left: 3px solid rgba(201,168,76,0.5);
  padding-left: 1em;
  margin: 0.8em 0;
  color: rgba(240,238,232,0.55);
  font-style: italic;
}

/* Checkbox list */
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 4px 0;
  list-style: none;
}
.check-item input[type="checkbox"] {
  margin-top: 4px;
  accent-color: #c9a84c;
  flex-shrink: 0;
}
.check-item.done { text-decoration: line-through; color: rgba(240,238,232,0.3); }

/* Editor footer */
.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  border-top: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
  background: rgba(255,255,255,0.012);
}

.editor-footer__left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: rgba(240,238,232,0.22);
}
.footer-sep { opacity: 0.4; }

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

.btn-export, .btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: rgba(240,238,232,0.45);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-export:hover, .btn-copy:hover {
  background: rgba(255,255,255,0.08);
  color: #f0eee8;
  border-color: rgba(255,255,255,0.15);
}

/* ══════════════════════════════════════════════
   MODALS
══════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s both;
}

.modal {
  background: #0d0d14;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 18px;
  padding: 28px 32px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 32px 80px rgba(0,0,0,0.7);
  animation: popIn 0.2s cubic-bezier(0.4,0,0.2,1) both;
  text-align: center;
}
.modal--sm { max-width: 320px; text-align: left; }

.modal__icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: rgba(240,112,104,0.1);
  border: 1px solid rgba(240,112,104,0.2);
  display: flex; align-items: center; justify-content: center;
  color: #f07068;
  margin: 0 auto 16px;
}

.modal__title {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: #f0eee8;
  margin: 0 0 8px;
}

.modal__desc {
  font-size: 13.5px;
  color: rgba(240,238,232,0.45);
  line-height: 1.65;
  margin: 0 0 20px;
}

.modal__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}
.modal--sm .modal__actions { justify-content: flex-end; }

.btn-modal-cancel {
  padding: 9px 20px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: rgba(240,238,232,0.6);
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-modal-cancel:hover { background: rgba(255,255,255,0.09); color: #f0eee8; }

.btn-modal-confirm {
  padding: 9px 20px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #f07068, #e55a52);
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 4px 14px rgba(240,112,104,0.3);
}
.btn-modal-confirm:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(240,112,104,0.4); }

.modal-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: #f0eee8;
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s;
  caret-color: #c9a84c;
  margin-top: 12px;
}
.modal-input:focus { border-color: rgba(96,200,240,0.4); }
.modal-input::placeholder { color: rgba(240,238,232,0.25); }

/* ══════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  background: #161620;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  font-size: 13.5px;
  color: rgba(240,238,232,0.85);
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
  animation: toastIn 0.25s cubic-bezier(0.4,0,0.2,1) both;
  pointer-events: all;
  max-width: 360px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
}
.toast.out { animation: toastOut 0.25s cubic-bezier(0.4,0,0.2,1) both; }
.toast--success { border-color: rgba(79,214,156,0.2); }
.toast--success .toast-icon { color: #4fd69c; }
.toast--error { border-color: rgba(240,112,104,0.2); }
.toast--error .toast-icon { color: #f07068; }
.toast--info { border-color: rgba(96,200,240,0.2); }
.toast--info .toast-icon { color: #60c8f0; }

@keyframes toastIn {
  from { opacity:0; transform: translateY(12px) scale(0.95); }
  to   { opacity:1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  to { opacity:0; transform: translateY(8px) scale(0.95); }
}

/* ══════════════════════════════════════════════
   AUTH GATE
══════════════════════════════════════════════ */
.auth-gate {
  position: fixed;
  inset: 0;
  background: rgba(10,10,15,0.95);
  backdrop-filter: blur(12px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-gate__box {
  text-align: center;
  max-width: 340px;
}
.auth-gate__icon { font-size: 48px; margin-bottom: 16px; }
.auth-gate__box h2 {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: #f0eee8;
  margin: 0 0 10px;
}
.auth-gate__box p { color: rgba(240,238,232,0.45); font-size: 14px; margin: 0 0 24px; }

.btn-login-gate {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 12px;
  background: linear-gradient(135deg, #c9a84c, #e8c97a);
  color: #0a0a0f;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(201,168,76,0.3);
}
.btn-login-gate:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(201,168,76,0.4); }

/* ══════════════════════════════════════════════
   UTILS
══════════════════════════════════════════════ */
.hidden { display: none !important; }

/* ══════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .notes-app { height: calc(100vh - 62px); }

  .sidebar {
    position: fixed;
    left: 0; top: 62px;
    height: calc(100vh - 62px);
    z-index: 400;
    transform: translateX(-100%);
    box-shadow: 8px 0 32px rgba(0,0,0,0.5);
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-toggle { display: flex; }

  .editor-area { width: 100%; }

  .note-content { padding: 16px 18px 24px; font-size: 14.5px; }

  .editor-header { padding: 12px 16px 10px; gap: 8px; }
  .note-title-input { font-size: 17px; }

  .toolbar { padding: 6px 12px; gap: 1px; }
  .tool-btn { min-width: 26px; height: 26px; font-size: 11.5px; }

  .tags-row { padding: 8px 16px; }

  .editor-footer { padding: 8px 16px; }
  .btn-export span, .btn-copy span { display: none; }

  .word-count { display: none; }

  .toast-container { bottom: 16px; right: 16px; left: 16px; }
  .toast { max-width: 100%; }
}

@media (max-width: 480px) {
  .editor-header__right .save-status .save-label { display: none; }
  .toolbar-sep { display: none; }
}
/* ── READ OVERLAY ── */
.read-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: #0a0a0f;
  display: flex;
  flex-direction: column;
  animation: readFadeIn 0.25s cubic-bezier(0.4,0,0.2,1) both;
  overflow: hidden;
}
@keyframes readFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to   { opacity: 1; transform: scale(1); }
}
 
/* Top bar */
.read-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
  gap: 16px;
}
 
.read-topbar__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
 
.read-color-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 1.5px solid rgba(255,255,255,0.15);
  flex-shrink: 0;
}
 
.read-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
 
.read-tag {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(240,238,232,0.35);
  font-family: 'DM Sans', sans-serif;
}
 
.read-topbar__right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
 
.read-date {
  font-size: 11.5px;
  color: rgba(240,238,232,0.2);
  font-family: 'DM Sans', sans-serif;
  white-space: nowrap;
}
 
.read-close-btn {
  width: 32px; height: 32px;
  border-radius: 9px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  color: rgba(240,238,232,0.45);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.read-close-btn:hover {
  background: rgba(255,255,255,0.08);
  color: #f0eee8;
  border-color: rgba(255,255,255,0.16);
}
 
/* Body */
.read-body {
  flex: 1;
  overflow-y: auto;
  padding: 56px 40px 80px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}
.read-body::-webkit-scrollbar { width: 4px; }
.read-body::-webkit-scrollbar-track { background: transparent; }
.read-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.07); border-radius: 2px; }
 
.read-title {
  font-family: 'Syne', sans-serif;
  font-size: clamp(26px, 4vw, 42px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #f0eee8;
  margin: 0 0 32px;
  line-height: 1.12;
}
.read-title:empty { display: none; }
 
.read-content {
  font-family: 'DM Sans', sans-serif;
  font-size: 16.5px;
  line-height: 1.85;
  color: rgba(240,238,232,0.82);
}
 
/* Inherit note content styles */
.read-content h1 { font-family:'Syne',sans-serif; font-size:26px; font-weight:800; letter-spacing:-0.025em; color:#f0eee8; margin:.5em 0 .3em; border-bottom:1px solid rgba(201,168,76,0.18); padding-bottom:.3em; }
.read-content h2 { font-family:'Syne',sans-serif; font-size:20px; font-weight:700; color:#f0eee8; margin:.6em 0 .3em; }
.read-content h3 { font-family:'Syne',sans-serif; font-size:16px; font-weight:700; color:rgba(240,238,232,0.85); margin:.7em 0 .3em; }
.read-content p { margin:0 0 .8em; }
.read-content ul,.read-content ol { padding-left:1.6em; margin:.4em 0 .8em; }
.read-content li { margin-bottom:.35em; }
.read-content strong { color:#f0eee8; }
.read-content em { color:rgba(240,238,232,0.75); }
.read-content a { color:#60c8f0; text-decoration-color:rgba(96,200,240,0.3); }
.read-content hr { border:none; border-top:1px solid rgba(255,255,255,0.07); margin:1.4em 0; }
.read-content code { font-family:'Fira Code','Courier New',monospace; font-size:13.5px; background:rgba(255,255,255,0.05); border:1px solid rgba(255,255,255,0.08); border-radius:6px; padding:2px 7px; color:#a064ff; }
.read-content pre { background:rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.07); border-radius:10px; padding:18px 20px; margin:.8em 0; overflow-x:auto; }
.read-content pre code { background:none; border:none; padding:0; }
.read-content blockquote { border-left:3px solid rgba(201,168,76,0.45); padding-left:1.1em; margin:.8em 0; color:rgba(240,238,232,0.5); font-style:italic; }
 
@media (max-width: 640px) {
  .read-topbar { padding: 12px 18px; }
  .read-body { padding: 32px 20px 60px; }
  .read-date { display: none; }
}
