:root {
  --bg: #000000;
  --bg2: #0d1117;
  --surface: #16202c;
  --surface2: #1e2732;
  --border: #2f3336;
  --border-h: #3d4650;
  --text: #e7e9ea;
  --text2: #71767b;
  --text3: #536471;
  --blue: #1d9bf0;
  --blue-h: #1a8cd8;
  --blue-dim: #1d9bf015;
  --blue-glow: #1d9bf030;
  --green: #00ba7c;
  --red: #f4212e;
  --amber: #f5a623;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 5px;
  --sidebar-w: 260px;
}

html { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', -apple-system, sans-serif;
  height: 100vh;
  display: flex;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
}

/* ── SIDEBAR ── */
.sb {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  transition: transform 0.25s cubic-bezier(.4,0,.2,1), width 0.25s;
  z-index: 50;
}
.sb-inner {
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  gap: 4px;
  min-height: 100%;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 20px;
}
.brand-mark { width: 34px; height: 34px; flex-shrink: 0; }
.brand-mark svg { width: 100%; height: 100%; }
.brand-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
}

/* NAV */
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  color: var(--text2);
  font-weight: 500;
  font-size: 14px;
  position: relative;
}
.nav-item:hover { background: rgba(231,233,234,0.07); color: var(--text); }
.nav-item.active { background: var(--blue-dim); color: var(--blue); }
.nav-item.dim { color: var(--text3); }
.nav-icon { width: 20px; height: 20px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.nav-icon svg { width: 18px; height: 18px; }
.nav-badge {
  margin-left: auto;
  background: var(--surface2);
  color: var(--text3);
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
  display: none;
}
.nav-badge.visible { display: inline-block; }
.nav-divider { height: 1px; background: var(--border); margin: 8px 4px; }
.nav-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text3);
  letter-spacing: 0.08em;
  padding: 8px 12px 4px;
  text-transform: uppercase;
}

/* SIDEBAR FOOTER */
.sb-footer { margin-top: auto; padding-top: 16px; }
.storage-block { padding: 0 8px 16px; }
.storage-row {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text3);
  margin-bottom: 8px;
}
.storage-track {
  height: 3px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
}
.storage-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--blue), #60a5fa);
  border-radius: 99px;
  transition: width 0.5s ease;
}
.sb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.15s;
}
.sb-user:hover { background: rgba(231,233,234,0.07); }
.sb-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--blue); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.sb-user-info { flex: 1; min-width: 0; }
.sb-user-name { font-size: 13px; font-weight: 700; color: var(--text); }
.sb-user-sub { font-size: 11.5px; color: var(--text2); }
.sb-user-more { color: var(--text2); font-size: 18px; letter-spacing: 1px; }

/* ── MAIN / TOPBAR ── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  height: 53px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 40;
}
.hamburger {
  display: none;
  width: 36px; height: 36px;
  background: none; border: none; cursor: pointer;
  color: var(--text2); border-radius: 50%;
  align-items: center; justify-content: center;
  transition: background 0.15s;
}
.hamburger:hover { background: rgba(231,233,234,0.07); }
.hamburger svg { width: 20px; height: 20px; }

/* SEARCH */
.search-wrap {
  flex: 1;
  max-width: 560px;
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text3);
  display: flex;
  pointer-events: none;
}
.search-icon svg { width: 16px; height: 16px; }
.search-input {
  width: 100%;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 0 80px 0 38px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.search-input:focus { border-color: var(--blue); background: var(--surface2); }
.search-input::placeholder { color: var(--text3); }
.search-kbd {
  position: absolute; right: 10px;
  background: none; border: none; cursor: pointer;
  color: var(--text3);
}
.search-kbd kbd {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 11px;
  padding: 2px 6px;
  font-family: inherit;
  color: var(--text3);
}
.search-clear {
  position: absolute; right: 10px;
  background: none; border: none; cursor: pointer;
  color: var(--text3);
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  transition: all 0.15s;
}
.search-clear:hover { background: var(--surface2); color: var(--text); }
.search-clear svg { width: 14px; height: 14px; }
.search-drop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 64px rgba(0,0,0,0.6);
  overflow: hidden;
  display: none;
  z-index: 100;
  max-height: 460px;
  overflow-y: auto;
}
.search-drop.open { display: block; animation: dropIn 0.18s ease; }
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.sd-header {
  padding: 10px 16px 6px;
  font-size: 10.5px; font-weight: 700;
  color: var(--text3);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.sd-section + .sd-section { border-top: 1px solid var(--border); }
.sd-section-label {
  padding: 10px 16px 4px;
  font-size: 10.5px; font-weight: 700;
  color: var(--text3);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.sd-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; cursor: pointer;
  transition: background 0.1s;
}
.sd-item:hover, .sd-item.focused { background: rgba(29,155,240,0.06); }
.sd-thumb {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.sd-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.sd-thumb svg { width: 16px; height: 16px; }
.sd-ext { font-size: 9px; font-weight: 800; color: var(--text3); }
.sd-info { flex: 1; min-width: 0; }
.sd-name {
  font-size: 13.5px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sd-meta { font-size: 11.5px; color: var(--text2); margin-top: 2px; }
.sd-name mark {
  background: rgba(29,155,240,0.2);
  color: var(--blue);
  border-radius: 3px;
  padding: 0 2px;
  font-style: normal;
}
.sd-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text3);
  font-size: 13.5px;
}
.sd-shortcut { color: var(--text3); font-size: 11px; flex-shrink: 0; }

/* TOPBAR ACTIONS */
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.btn-primary {
  display: flex; align-items: center; gap: 6px;
  background: var(--blue);
  color: white;
  border: none; border-radius: 99px;
  font-family: inherit; font-size: 13.5px; font-weight: 700;
  padding: 0 16px; height: 34px; cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--blue-h); }
.btn-primary svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary.sm { height: 30px; padding: 0 14px; font-size: 13px; }
.ghost-btn {
  display: flex; align-items: center; gap: 6px;
  background: none;
  color: var(--text2);
  border: 1px solid var(--border); border-radius: 99px;
  font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 0 14px; height: 30px; cursor: pointer;
  transition: all 0.15s;
}
.ghost-btn:hover { border-color: var(--border-h); color: var(--text); }
.ghost-btn.danger:hover { border-color: rgba(244,33,46,0.5); color: var(--red); }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: none; border: none; cursor: pointer;
  color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  text-decoration: none;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: rgba(231,233,234,0.07); color: var(--text); }

/* ── CONTENT ── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
}
.view { display: none; }
.view.active { display: block; }
.view-header { margin-bottom: 28px; }
.view-title {
  font-size: 22px; font-weight: 800;
  letter-spacing: -0.4px; margin-bottom: 4px;
}
.view-meta { font-size: 13px; color: var(--text3); }
.section-block { margin-bottom: 32px; }
.section-head {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 12px; gap: 12px;
}
.section-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.count-pill {
  background: var(--surface2); color: var(--text3);
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 99px;
}
.section-actions { display: flex; align-items: center; gap: 8px; }

/* ── DROP ZONE ── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  position: relative;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 32px;
  cursor: pointer;
}
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--blue); background: var(--blue-dim); }
.drop-zone input[type="file"] { display: none; }
.dz-glow {
  position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(ellipse at 50% 0%, var(--blue-glow), transparent 70%);
  pointer-events: none; opacity: 0; transition: opacity 0.3s;
}
.drop-zone:hover .dz-glow, .drop-zone.drag-over .dz-glow { opacity: 1; }
.dz-content { position: relative; z-index: 1; }
.dz-icon-wrap {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.dz-icon-wrap svg { width: 26px; height: 26px; color: var(--blue); }
.dz-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.dz-sub { font-size: 13.5px; color: var(--text2); margin-bottom: 16px; }
.dz-link {
  background: none; border: none; cursor: pointer;
  color: var(--blue); font-family: inherit; font-size: inherit;
  font-weight: 600; padding: 0; text-decoration: underline;
}
.dz-formats { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.fmt {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 99px; font-size: 11.5px; color: var(--text3);
  padding: 3px 10px;
}

/* ── UPLOAD QUEUE ── */
.queue-list { display: flex; flex-direction: column; gap: 6px; }
.qi {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  animation: slideUp 0.2s ease;
  transition: border-color 0.15s;
}
.qi:hover { border-color: var(--border-h); }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.qi-thumb {
  width: 40px; height: 40px; border-radius: 8px;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.qi-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.qi-ext { font-size: 9px; font-weight: 800; color: var(--text3); }
.qi-body { flex: 1; min-width: 0; }
.qi-name { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; }
.qi-size { font-size: 11px; color: var(--text3); margin-bottom: 7px; }
.qi-track { height: 3px; background: var(--surface2); border-radius: 99px; overflow: hidden; }
.qi-bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--blue), #60a5fa);
  border-radius: 99px;
  transition: width 0.07s linear;
}
.qi-bar.done { background: var(--green); }
.qi-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.qi-pct { font-size: 11px; font-weight: 700; color: var(--text3); min-width: 30px; text-align: right; }
.qi-status-icon { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; }
.qi-del {
  width: 28px; height: 28px; border-radius: 50%;
  background: none; border: none; cursor: pointer;
  color: var(--text3);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.qi-del svg { width: 13px; height: 13px; }
.qi-del:hover { background: rgba(244,33,46,0.12); color: var(--red); }

/* VIEW TOGGLE */
.view-toggle { display: flex; gap: 2px; }
.vt-btn {
  width: 30px; height: 30px; border-radius: var(--radius-xs);
  background: none; border: none; cursor: pointer;
  color: var(--text3);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.vt-btn svg { width: 16px; height: 16px; }
.vt-btn:hover { background: var(--surface2); color: var(--text); }
.vt-btn.active { background: var(--blue-dim); color: var(--blue); }

/* ── FILES GRID / LIST ── */
.files-grid-view.grid-mode {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.files-grid-view.list-mode {
  display: flex; flex-direction: column; gap: 6px;
}

/* FILE CARD (grid) */
.file-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.15s;
  animation: slideUp 0.2s ease;
}
.file-card:hover { border-color: var(--border-h); transform: translateY(-2px); box-shadow: 0 8px 32px rgba(0,0,0,0.3); }
.fc-thumb {
  width: 100%; aspect-ratio: 4/3;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.fc-thumb.img-thumb { cursor: zoom-in; }
.fc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fc-thumb-icon svg { width: 32px; height: 32px; color: var(--text3); opacity: 0.4; }
.fc-ext-badge {
  position: absolute; bottom: 6px; right: 6px;
  background: rgba(0,0,0,0.7);
  color: var(--text2);
  font-size: 9px; font-weight: 800;
  padding: 2px 6px; border-radius: 4px;
  text-transform: uppercase;
}
.fc-body { padding: 12px; }
.fc-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.fc-meta { font-size: 11.5px; color: var(--text3); margin-bottom: 10px; }
.fc-actions { display: flex; gap: 6px; }
.fc-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;
  height: 28px; border-radius: var(--radius-xs);
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text2); font-family: inherit; font-size: 11.5px; font-weight: 600;
  cursor: pointer; transition: all 0.15s; text-decoration: none;
}
.fc-btn svg { width: 12px; height: 12px; }
.fc-btn:hover { border-color: var(--border-h); color: var(--text); }
.fc-btn.del:hover { border-color: rgba(244,33,46,0.4); color: var(--red); background: rgba(244,33,46,0.08); }

/* FILE ROW (list) */
.file-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  animation: slideUp 0.2s ease;
}
.file-row:hover { border-color: var(--border-h); background: var(--surface2); }
.fr-thumb {
  width: 38px; height: 38px; border-radius: 8px;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.fr-thumb.img-thumb { cursor: zoom-in; }
.fr-thumb.img-thumb:hover { opacity: 0.8; }
.fr-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.fr-thumb svg { width: 16px; height: 16px; color: var(--text3); opacity: 0.5; }
.fr-ext { font-size: 9px; font-weight: 800; color: var(--text3); }
.fr-info { flex: 1; min-width: 0; }
.fr-name { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fr-meta { font-size: 11.5px; color: var(--text3); margin-top: 1px; }
.fr-date { font-size: 12px; color: var(--text3); flex-shrink: 0; white-space: nowrap; }
.fr-acts { display: flex; gap: 3px; opacity: 0; transition: opacity 0.15s; }
.file-row:hover .fr-acts { opacity: 1; }
.fr-btn {
  width: 28px; height: 28px; border-radius: 50%;
  background: none; border: none; cursor: pointer;
  color: var(--text3);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.fr-btn svg { width: 13px; height: 13px; }
.fr-btn:hover { background: var(--surface2); color: var(--text); }
.fr-btn.del:hover { color: var(--red); background: rgba(244,33,46,0.1); }

/* EMPTY STATE */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 60px 20px; text-align: center;
}
.es-icon {
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.es-icon svg { width: 26px; height: 26px; color: var(--text3); }
.es-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.es-sub { font-size: 13.5px; color: var(--text3); }

/* ── NOTES VIEW ── */
.view#view-notes { height: calc(100vh - 53px); padding: 0; }
.notes-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100%;
  overflow: hidden;
}
.notes-sidebar {
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.notes-sidebar-head {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.notes-list-inner { flex: 1; overflow-y: auto; }
.note-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
}
.note-item:hover { background: rgba(231,233,234,0.04); }
.note-item.active { background: var(--blue-dim); }
.note-item.active::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--blue);
}
.ni-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; }
.ni-preview { font-size: 12px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 6px; }
.ni-date { font-size: 11px; color: var(--text3); }
.notes-empty-state {
  padding: 40px 20px; text-align: center;
  font-size: 13px; color: var(--text3); line-height: 1.6;
}

/* EDITOR PANEL */
.editor-panel {
  display: flex; flex-direction: column;
  overflow: hidden; background: var(--bg2);
}
.editor-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 40px;
}
.editor-active { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.editor-topbar {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.editor-topbar-actions { display: flex; gap: 8px; }
.save-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text3);
}
.save-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text3);
}
.save-status.unsaved .save-dot { background: var(--amber); }
.save-status.saving .save-dot { background: var(--blue); }
.save-status.saved .save-dot { background: var(--green); }

/* TOOLBAR */
.toolbar {
  display: flex; align-items: center;
  gap: 2px; flex-wrap: wrap;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}
.tb-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.tb-btn {
  width: 32px; height: 32px;
  background: none; border: none; cursor: pointer;
  border-radius: var(--radius-xs);
  color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  font-family: inherit; font-size: 13px; font-weight: 700;
  transition: all 0.12s;
}
.tb-btn svg { width: 15px; height: 15px; }
.tb-btn:hover { background: var(--surface2); color: var(--text); }
.tb-btn.active { background: var(--blue-dim); color: var(--blue); }
.tb-select {
  height: 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-family: inherit; font-size: 12.5px;
  padding: 0 8px; outline: none; cursor: pointer;
  transition: border-color 0.15s;
}
.tb-select:focus { border-color: var(--blue); }

/* NOTE TITLE + EDITOR */
.note-title-wrap { padding: 20px 28px 0; flex-shrink: 0; }
.note-title {
  width: 100%;
  background: none; border: none; outline: none;
  font-family: inherit; font-size: 26px; font-weight: 800;
  color: var(--text); letter-spacing: -0.5px; line-height: 1.3;
}
.note-title::placeholder { color: var(--text3); }
.editor-scroll { flex: 1; overflow-y: auto; padding: 12px 28px 40px; }
.editor-body {
  min-height: 300px; outline: none;
  font-size: 15px; line-height: 1.8; color: var(--text);
}
.editor-body:empty::before {
  content: attr(data-placeholder);
  color: var(--text3); pointer-events: none; display: block;
}
.editor-body h1 { font-size: 28px; font-weight: 800; margin: 20px 0 8px; letter-spacing: -.5px; }
.editor-body h2 { font-size: 22px; font-weight: 700; margin: 16px 0 6px; letter-spacing: -.3px; }
.editor-body h3 { font-size: 17px; font-weight: 700; margin: 14px 0 4px; }
.editor-body p { margin: 0 0 10px; }
.editor-body ul, .editor-body ol { margin: 0 0 10px; padding-left: 24px; }
.editor-body li { margin: 3px 0; }
.editor-body blockquote {
  border-left: 3px solid var(--blue);
  margin: 14px 0; padding: 6px 16px;
  color: var(--text2); font-style: italic;
}
.editor-body a { color: var(--blue); }
.editor-body img { max-width: 100%; border-radius: var(--radius-sm); margin: 12px 0; display: block; }
.editor-body code {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 6px;
  font-size: 13px; font-family: ui-monospace, monospace; color: #60a5fa;
}
.editor-body pre {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px; overflow-x: auto; margin: 12px 0;
}
.editor-body pre code { background: none; border: none; padding: 0; }
.editor-body strong { font-weight: 700; }
.editor-body mark { background: rgba(29,155,240,0.2); color: var(--blue); border-radius: 3px; padding: 0 2px; }

/* ── MODAL ── */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 200;
  display: none;
  align-items: center; justify-content: center;
  backdrop-filter: blur(6px);
}
.modal-bg.open { display: flex; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 90vw; max-height: 90vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 32px 96px rgba(0,0,0,0.7);
}
.modal-head {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-shrink: 0;
}
.modal-name { font-size: 14px; font-weight: 600; }
.modal-meta { font-size: 12px; color: var(--text3); margin-top: 2px; }
.modal-head-actions { display: flex; gap: 4px; }
.modal-body { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-body img { max-width: 100%; max-height: calc(90vh - 80px); border-radius: var(--radius-sm); display: block; }

/* ── TOAST ── */
.toast-dock {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex; flex-direction: column;
  align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13.5px; font-weight: 500;
  padding: 10px 20px;
  border-radius: 99px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: toastIn 0.25s cubic-bezier(.34,1.4,.64,1);
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap;
}
.toast.success::before { content: '✓'; color: var(--green); font-weight: 700; }
.toast.error { border-color: rgba(244,33,46,0.4); }
.toast.error::before { content: '✕'; color: var(--red); font-weight: 700; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.92); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── APP LOADING ── */
.app-loading {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px;
  transition: opacity 0.4s;
}
.app-loading.hidden { opacity: 0; pointer-events: none; }
.app-loading-logo svg { width: 48px; height: 48px; }
.app-loading-text { font-size: 14px; color: var(--text3); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .sb { position: fixed; left: 0; top: 0; transform: translateX(-100%); z-index: 60; }
  .sb.open { transform: translateX(0); box-shadow: 4px 0 40px rgba(0,0,0,0.6); }
  .hamburger { display: flex; }
  .content { padding: 20px; }
  .notes-layout { grid-template-columns: 1fr; }
  .notes-sidebar { display: none; }
  .files-grid-view.grid-mode { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
@media (max-width: 600px) {
  .search-wrap { max-width: 100%; }
  .topbar-actions .btn-primary span { display: none; }
  .content { padding: 16px; }
}
