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

:root {
  --bg:          #f0f2f5;
  --sidebar-bg:  #ffffff;
  --card-bg:     #ffffff;
  --border:      #e2e8f0;
  --accent:      #3b82f6;
  --accent-dark: #2563eb;
  --green:       #22c55e;
  --green-bg:    #dcfce7;
  --text:        #1e293b;
  --text-muted:  #64748b;
  --tag-bg:      #eff6ff;
  --tag-color:   #2563eb;
  --danger:      #ef4444;
  --radius:      10px;
  --shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg:   0 4px 16px rgba(0,0,0,.12);
  --toolbar-h:   56px;
  --sidebar-w:   280px;
  --transition:  .2s ease;
}

html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 15px; color: var(--text); background: var(--bg); }

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font: inherit; }
ul { list-style: none; }

/* ── Login ──────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-card {
  background: #fff; border-radius: 20px; padding: 48px 40px;
  text-align: center; max-width: 400px; width: 90%;
  box-shadow: var(--shadow-lg);
}
.login-logo { font-size: 48px; margin-bottom: 16px; }
.login-card h1 { font-size: 1.75rem; margin-bottom: 8px; }
.login-card p  { color: var(--text-muted); margin-bottom: 32px; }
.btn-google {
  display: inline-flex; align-items: center; gap: 10px;
  background: #fff; border: 1.5px solid var(--border);
  border-radius: 8px; padding: 12px 24px;
  font-size: .95rem; font-weight: 500;
  transition: box-shadow var(--transition), border-color var(--transition);
}
.btn-google:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(59,130,246,.2); }

/* ── Toolbar ────────────────────────────────────────────── */
.toolbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--toolbar-h);
  background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  box-shadow: var(--shadow);
}
.toolbar-brand { font-size: 1.1rem; font-weight: 700; letter-spacing: -.3px; }
.toolbar-user  { display: flex; align-items: center; gap: 10px; }
.user-avatar   { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.user-name     { font-size: .9rem; font-weight: 500; color: var(--text-muted); }
/* ── User menu dropdown ─────────────────────────────────────── */
.user-menu-wrap { position: relative; }

.user-menu-btn {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none; padding: 4px 6px;
  border-radius: 8px; cursor: pointer;
  transition: background var(--transition);
}
.user-menu-btn:hover { background: var(--bg); }

.user-menu-caret {
  font-size: .7rem; color: var(--text-muted);
  line-height: 1; margin-left: 2px;
}

.user-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 160px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 200;
  animation: fadeIn .15s ease;
}

.user-dropdown-item {
  display: block; width: 100%;
  text-align: left; background: none; border: none;
  padding: 8px 12px; border-radius: 7px;
  font-size: .9rem; color: var(--text); cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
}
.user-dropdown-item:hover { background: var(--bg); }
.user-dropdown-item--danger { color: var(--danger); }
.user-dropdown-item--danger:hover { background: #fef2f2; }

/* ── Settings modal ─────────────────────────────────────────── */
/*
  IMPORTANT: do NOT put `display: flex` here — it would override the
  browser's built-in `[hidden] { display:none }` rule (author stylesheet
  beats UA stylesheet regardless of specificity), keeping the overlay
  permanently visible and blocking the whole page.
  Instead, `display: flex` is set only when [hidden] is absent.
*/
.settings-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(15, 23, 42, .45);
  align-items: center; justify-content: center;
}
.settings-overlay:not([hidden]) {
  display: flex;
  animation: fadeIn .15s ease;
}

.settings-modal {
  background: #fff; border-radius: 14px;
  width: 480px; max-width: calc(100vw - 32px);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.settings-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.settings-modal-title { font-size: 1.05rem; font-weight: 700; }

.settings-close-btn {
  background: none; border: none;
  font-size: 1.4rem; line-height: 1;
  color: var(--text-muted); padding: 2px 6px;
  border-radius: 6px; cursor: pointer;
  transition: all var(--transition);
}
.settings-close-btn:hover { background: var(--bg); color: var(--text); }

.settings-modal-body { padding: 20px; }

.settings-section-title {
  font-size: .8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-muted);
  margin-bottom: 14px;
}

.settings-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.settings-row:last-child { border-bottom: none; }
.settings-row--action { flex-direction: column; align-items: stretch; gap: 6px; padding-top: 14px; border-bottom: none; }

.settings-label { font-size: .85rem; color: var(--text-muted); min-width: 130px; flex-shrink: 0; }
.settings-value { font-size: .88rem; color: var(--text); }
.settings-value--mono { font-family: monospace; font-size: .85rem; word-break: break-all; }

.settings-badge {
  display: inline-block;
  font-size: .78rem; font-weight: 600;
  padding: 2px 9px; border-radius: 20px;
  background: var(--border); color: var(--text-muted);
}
.settings-badge--ok  { background: var(--green-bg); color: #15803d; }
.settings-badge--warn { background: #fef3c7; color: #92400e; }
.settings-badge--off { background: #fee2e2; color: #b91c1c; }

.settings-input-row { 
  display: flex; 
  gap: 8px; 
  flex-wrap: wrap;
}
.settings-input {
  flex: 1; border: 1.5px solid var(--border); border-radius: 7px;
  padding: 7px 10px; font: inherit; font-size: .9rem;
  color: var(--text); outline: none;
  transition: border-color var(--transition);
}
.settings-input:focus { border-color: var(--accent); }

.settings-save-btn {
  background: var(--accent); color: #fff;
  border: none; border-radius: 7px;
  padding: 7px 16px; font: inherit; font-size: .9rem; font-weight: 600;
  transition: background var(--transition);
  white-space: nowrap;
}
.settings-save-btn:hover:not(:disabled) { background: var(--accent-dark); }
.settings-save-btn:disabled { opacity: .6; cursor: default; }

.settings-hint { font-size: .8rem; min-height: 1.2em; color: var(--text-muted); }
.settings-hint--ok  { color: #15803d; }
.settings-hint--err { color: var(--danger); }

.settings-note {
  margin-top: 12px; padding: 10px 12px;
  background: #fef3c7; border-radius: 8px;
  font-size: .82rem; color: #78350f; line-height: 1.5;
}
.settings-note code { background: #fde68a; border-radius: 3px; padding: 1px 4px; font-size: .85em; }

/* ── Folder picker ──────────────────────────────────────────── */
.settings-action-bar {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 6px;
}

.settings-browse-btn {
  font: inherit; font-size: .82rem; font-weight: 600;
  color: var(--accent); background: var(--tag-bg);
  border: 1.5px solid #bfdbfe; border-radius: 7px;
  padding: 5px 12px; cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.settings-browse-btn:hover:not(:disabled) { background: #dbeafe; border-color: var(--accent); }
.settings-browse-btn:disabled { opacity: .45; cursor: default; }

.settings-test-btn {
  font: inherit; font-size: .82rem; font-weight: 600;
  color: #0369a1; background: #e0f2fe;
  border: 1.5px solid #bae6fd; border-radius: 7px;
  padding: 5px 12px; cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.settings-test-btn:hover:not(:disabled) { background: #bae6fd; border-color: #0ea5e9; }
.settings-test-btn:disabled { opacity: .45; cursor: default; }

.dbx-browser {
  border: 1.5px solid var(--border);
  border-radius: 9px; overflow: hidden;
  margin-bottom: 8px;
  animation: fadeIn .15s ease;
}

.dbx-browser-topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: var(--bg); border-bottom: 1px solid var(--border);
}

.dbx-breadcrumb {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 2px; flex: 1; min-width: 0;
}

.dbx-crumb {
  background: none; border: none; padding: 2px 5px;
  font: inherit; font-size: .82rem; color: var(--accent);
  border-radius: 4px; cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
}
.dbx-crumb:hover:not(:disabled) { background: #dbeafe; }
.dbx-crumb--active { color: var(--text); font-weight: 600; cursor: default; }

.dbx-crumb-sep {
  font-size: .75rem; color: var(--text-muted);
  padding: 0 1px; user-select: none;
}

.dbx-select-btn {
  flex-shrink: 0;
  font: inherit; font-size: .8rem; font-weight: 600;
  background: var(--accent); color: #fff;
  border: none; border-radius: 6px;
  padding: 5px 12px; cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
}
.dbx-select-btn:hover:not(:disabled) { background: var(--accent-dark); }
.dbx-select-btn:disabled { opacity: .5; cursor: default; }

.dbx-folder-list {
  list-style: none;
  max-height: 220px; overflow-y: auto;
  margin: 0; padding: 4px;
}

.dbx-folder-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 7px; cursor: pointer;
  transition: background var(--transition);
  user-select: none;
}
.dbx-folder-item:hover { background: var(--bg); }

.dbx-folder-icon { font-size: 1rem; flex-shrink: 0; }
.dbx-folder-name { flex: 1; font-size: .88rem; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbx-folder-arrow { font-size: 1.1rem; color: var(--text-muted); flex-shrink: 0; }

.dbx-state {
  padding: 14px 12px; font-size: .85rem;
  color: var(--text-muted); text-align: center;
}
.dbx-state--muted { font-style: italic; }
.dbx-state--err   { color: var(--danger); }

/* ── App Layout ─────────────────────────────────────────── */
.app-layout {
  display: flex;
  margin-top: var(--toolbar-h);
  height: calc(100vh - var(--toolbar-h));
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  transition: transform var(--transition);
  position: relative;
}
.sidebar-toggle {
  display: none;
  position: absolute; top: 8px; right: -40px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 0 8px 8px 0;
  padding: 6px 10px; font-size: 1.1rem;
  box-shadow: 2px 0 6px rgba(0,0,0,.07);
  z-index: 50;
}
.sidebar-section-title {
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted);
  padding: 16px 16px 8px;
}

/* ── Calendar ───────────────────────────────────────────── */
.calendar-widget { padding: 16px; border-bottom: 1px solid var(--border); }
.cal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.cal-title { font-weight: 600; font-size: .95rem; }
.cal-nav {
  background: none; border: 1px solid var(--border);
  border-radius: 6px; width: 28px; height: 28px;
  font-size: 1.1rem; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.cal-nav:hover { background: var(--bg); color: var(--accent); }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px; text-align: center;
}
.cal-day-name {
  font-size: .7rem; font-weight: 600;
  color: var(--text-muted); padding: 4px 0;
}
.cal-day {
  font-size: .82rem; padding: 5px 2px;
  border-radius: 6px; cursor: pointer;
  transition: all var(--transition);
  line-height: 1;
}
.cal-day:hover { background: var(--bg); }
.cal-day.has-notes {
  background: var(--green-bg);
  color: #15803d;
  font-weight: 700;
}
.cal-day.today {
  background: var(--green);
  color: #fff;
  font-weight: 700;
}
.cal-day.today.has-notes { background: var(--green); }
.cal-day.selected {
  background: var(--accent);
  color: #fff;
}
.cal-day.other-month { color: #cbd5e1; cursor: default; }
.cal-day.empty { cursor: default; }

/* ── Tag List ───────────────────────────────────────────── */
.tag-list-widget { padding: 0 0 16px; flex: 1; }
.tag-list { padding: 0 8px; }
.tag-list-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; border-radius: 8px; cursor: pointer;
  transition: background var(--transition);
  user-select: none;
}
.tag-list-item:hover   { background: var(--bg); }
.tag-list-item.active  { background: var(--tag-bg); color: var(--tag-color); font-weight: 600; }
.tag-name-wrap { display: flex; align-items: center; gap: 6px; }
.tag-hash { color: var(--accent); font-weight: 700; }
.tag-count {
  font-size: .75rem; background: var(--border);
  border-radius: 10px; padding: 1px 7px;
  color: var(--text-muted);
}
.tag-list-item.active .tag-count { background: #bfdbfe; color: var(--accent-dark); }
.tag-list-empty { color: var(--text-muted); font-size: .88rem; padding: 8px 10px; }

/* ── Main Content ───────────────────────────────────────── */
.main-content {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column;
  min-width: 0;
}

/* ── Search Bar ─────────────────────────────────────────── */
.search-bar-wrap {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  position: sticky; top: 0; z-index: 10;
}
.search-input-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 8px; padding: 7px 12px;
  transition: border-color var(--transition);
}
.search-input-wrap:focus-within { border-color: var(--accent); }
.search-icon { color: var(--text-muted); flex-shrink: 0; }
.search-input {
  flex: 1; background: none; border: none; outline: none;
  font: inherit; font-size: .93rem; color: var(--text);
}
.active-filters {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px;
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--tag-bg); color: var(--tag-color);
  border-radius: 20px; padding: 3px 10px 3px 10px;
  font-size: .82rem; font-weight: 500;
}
.filter-chip-date { background: #fef3c7; color: #92400e; }
.filter-chip-remove {
  background: none; border: none; color: inherit;
  font-size: 1rem; line-height: 1; padding: 0 0 0 2px;
  opacity: .7; transition: opacity var(--transition);
}
.filter-chip-remove:hover { opacity: 1; }

/* ── Notes Area ─────────────────────────────────────────── */
.notes-area { padding: 20px; flex: 1; }
.notes-header {
  display: flex; align-items: center;
  margin-bottom: 16px;
}
.btn-new-note {
  background: var(--accent); color: #fff;
  border: none; border-radius: 8px;
  padding: 8px 16px; font-size: .9rem; font-weight: 600;
  transition: background var(--transition);
}
.btn-new-note:hover { background: var(--accent-dark); }
.notes-list { display: flex; flex-direction: column; gap: 12px; }
.notes-empty { color: var(--text-muted); padding: 40px 0; text-align: center; }

/* ── Note Card ──────────────────────────────────────────── */
.note-card {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow var(--transition), border-color var(--transition);
}
.note-card:hover { box-shadow: var(--shadow-lg); }
.note-card.editing { border-color: var(--accent); }

.note-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 6px;
  cursor: pointer;
}
.note-date { font-size: .8rem; color: var(--text-muted); }
.note-modified { font-size: .75rem; color: #94a3b8; margin-left: 8px; }
.note-actions { display: flex; gap: 4px; }
.note-action-btn {
  background: none; border: 1px solid transparent;
  border-radius: 6px; padding: 4px 8px;
  font-size: .78rem; color: var(--text-muted);
  transition: all var(--transition);
}
.note-action-btn:hover { border-color: var(--border); background: var(--bg); }
.note-action-btn.danger:hover { color: var(--danger); border-color: var(--danger); }

.note-body { padding: 4px 14px 12px; cursor: pointer; }
.note-preview { color: var(--text); line-height: 1.6; }
.note-preview p:not(:last-child) { margin-bottom: .4em; }

.note-editor-wrap { padding: 4px 14px 12px; display: none; }
.note-editor-wrap.active { display: block; }

.note-tags { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 14px 12px; }
.note-tag {
  background: var(--tag-bg); color: var(--tag-color);
  border-radius: 12px; padding: 2px 9px;
  font-size: .78rem; font-weight: 500;
}

/* ── TipTap Editor ──────────────────────────────────────── */
.tiptap-editor {
  border: 1.5px solid var(--border);
  border-radius: 8px; overflow: hidden;
}
.tiptap-toolbar {
  display: flex; flex-wrap: wrap; gap: 2px; align-items: center;
  padding: 6px 8px; background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.tt-btn {
  background: none; border: 1px solid transparent;
  border-radius: 5px; padding: 4px 8px;
  font-size: .82rem; color: var(--text-muted);
  transition: all var(--transition);
  min-width: 28px;
}
.tt-btn:hover   { background: #fff; border-color: var(--border); color: var(--text); }
.tt-btn.active  { background: var(--accent); color: #fff; border-color: transparent; }
.tt-divider { width: 1px; background: var(--border); margin: 2px 4px; }

.tiptap-content {
  padding: 12px; min-height: 80px;
  outline: none; line-height: 1.7;
}
.tiptap-content p { margin-bottom: .3em; }
.tiptap-content h1 { font-size: 1.4em; font-weight: 700; margin: .4em 0; }
.tiptap-content h2 { font-size: 1.2em; font-weight: 700; margin: .4em 0; }
.tiptap-content h3 { font-size: 1.05em; font-weight: 700; margin: .4em 0; }
.tiptap-content ul, .tiptap-content ol { padding-left: 1.4em; margin: .4em 0; }
.tiptap-content blockquote {
  border-left: 3px solid var(--accent); padding-left: 12px;
  color: var(--text-muted); font-style: italic; margin: .4em 0;
}
.tiptap-content code {
  background: #f1f5f9; border-radius: 4px;
  padding: 1px 5px; font-size: .88em; font-family: monospace;
}
.tiptap-content pre {
  background: #1e293b; color: #e2e8f0;
  border-radius: 8px; padding: 12px; overflow-x: auto;
  margin: .6em 0;
}
.tiptap-content pre code { background: none; color: inherit; padding: 0; }
.tiptap-content img { max-width: 100%; border-radius: 6px; margin: .4em 0; }
.tiptap-content a { color: var(--accent); text-decoration: underline; }

/* ── Resizable image NodeView ───────────────────────────── */
.img-selected img {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
/* Show resize handle when image wrapper is selected */
.img-selected > div { opacity: 1 !important; }
/* Preview images keep width attribute */
.note-preview img { max-width: 100%; border-radius: 6px; height: auto; }

/* Mention (tag) chip inside editor */
.mention {
  background: var(--tag-bg); color: var(--tag-color);
  border-radius: 12px; padding: 1px 7px;
  font-size: .88em; font-weight: 600;
  white-space: nowrap;
}

/* ── Tag Suggestion Popup ───────────────────────────────── */
.tag-suggestion-popup {
  position: fixed; z-index: 1000;
  background: #fff; border: 1.5px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-lg);
  min-width: 180px; max-width: 260px;
  max-height: 220px; overflow-y: auto;
  padding: 4px;
}
.tag-suggestion-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; border-radius: 7px;
  cursor: pointer; font-size: .9rem;
  transition: background var(--transition);
}
.tag-suggestion-item:hover,
.tag-suggestion-item.selected { background: var(--tag-bg); color: var(--tag-color); }
.tag-suggestion-create { color: var(--accent); font-style: italic; }
.tag-suggestion-empty { padding: 8px 10px; color: var(--text-muted); font-size: .88rem; }

/* ── Mobile Controls ────────────────────────────────────────── */
.mobile-controls {
  display: none;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  gap: 8px;
}
.mobile-collapse-btn {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  font-size: .85rem;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  gap: 6px;
  cursor: pointer;
}
.mobile-collapse-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Linked Notes ───────────────────────────────────────────── */
.linked-notes-title {
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  color: var(--text-muted); padding: 12px 14px 4px;
}
.linked-notes-list {
  padding: 0 14px 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.linked-note-card {
  border-left: 3px solid var(--accent);
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: 0 8px 8px 0;
  font-size: .9rem;
  cursor: pointer;
}
.linked-note-card:hover { background: #f1f5f9; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    display: none;
    flex-direction: column;
  }
  .sidebar.open { display: flex; }
  .mobile-controls { display: flex; }
  .sidebar-toggle { display: none; }
  .app-layout { flex-direction: column; }
  .main-content { height: auto; flex: 1; }
  .notes-area { padding: 12px; }
  .toolbar { padding: 0 12px; }
  .user-name { display: none; }
  .collapsible-section { display: none; }
  .collapsible-section.open { display: block; }
}
@media (max-width: 480px) {
  .note-card-header { flex-wrap: wrap; gap: 6px; }
  .cal-day { font-size: .75rem; padding: 4px 1px; }
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Animations ─────────────────────────────────────────── */
@keyframes fadeIn { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:translateY(0); } }
.note-card { animation: fadeIn .2s ease; }

/* ── Save Status ─────────────────────────────────────────── */
.note-save-status {
  margin-left: auto;
  font-size: .78rem; font-weight: 500;
  padding: 2px 8px; border-radius: 20px;
  transition: opacity .4s ease;
  pointer-events: none;
  white-space: nowrap;
}
.note-save-status.saving {
  color: var(--text-muted);
  background: var(--border);
}
.note-save-status.saved {
  color: #166534;
  background: var(--green-bg);
}
.note-save-status.fade { opacity: 0; }

/* ── Upload Toast ────────────────────────────────────────── */
.upload-toast {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex; align-items: center; gap: 8px;
  background: #1e293b; color: #f8fafc;
  border-radius: 10px; padding: 11px 18px;
  font-size: .88rem; font-weight: 500;
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
  opacity: 0; transform: translateY(10px);
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: none;
}
.upload-toast.visible  { opacity: 1; transform: translateY(0); }
.upload-toast.success  { background: #16a34a; }
.upload-toast.error    { background: #dc2626; }

/* ── Admin Styles ────────────────────────────────────────── */
.admin-table th, .admin-table td {
  border-bottom: 1px solid var(--border);
}
.admin-table tbody tr:hover {
  background: #f8fafc;
}
@media (max-width: 600px) {
  .admin-table thead { display: none; }
  .admin-table tr { display: block; margin-bottom: 1rem; border: 1px solid var(--border); border-radius: 8px; }
  .admin-table td { display: flex; justify-content: space-between; padding: 10px 15px; border-bottom: 1px solid #f1f5f9; }
  .admin-table td:last-child { border-bottom: none; }
  .admin-table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--text-muted);
  }
}
