/* ============================================================
   Notes — stylesheet
   Theming via CSS custom properties; dark mode by [data-theme].
   ============================================================ */
:root {
  --bg:         #f4f5f7;
  --surface:    #ffffff;
  --surface-2:  #fafbfc;
  --sidebar:    #1f2933;
  --sidebar-fg: #cbd4df;
  --sidebar-fg-dim: #8a97a6;
  --sidebar-active: #2f3b47;
  --border:     #e3e6ea;
  --border-strong: #d2d7dd;
  --text:       #1f2933;
  --text-dim:   #697586;
  --text-faint: #9aa5b1;
  --accent:     #2f9e68;
  --accent-fg:  #ffffff;
  --accent-soft:#e6f4ec;
  --danger:     #d64545;
  --danger-soft:#fbeaea;
  --shadow:     0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-lg:  0 10px 30px rgba(16, 24, 40, .14);
  --radius:     9px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
[data-theme="dark"] {
  --bg:         #15191e;
  --surface:    #1b2026;
  --surface-2:  #20262d;
  --sidebar:    #11151a;
  --sidebar-fg: #c2cbd6;
  --sidebar-fg-dim: #74808d;
  --sidebar-active: #232b33;
  --border:     #2a313a;
  --border-strong: #353d47;
  --text:       #e4e8ec;
  --text-dim:   #9aa5b1;
  --text-faint: #6b7682;
  --accent:     #3ab87a;
  --accent-fg:  #07120c;
  --accent-soft:#17301f;
  --danger:     #e26a6a;
  --danger-soft:#331b1b;
  --shadow:     0 1px 3px rgba(0,0,0,.4);
  --shadow-lg:  0 12px 34px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
a { color: var(--accent); }

/* ---- Splash ---- */
#app.loading { display: grid; place-items: center; height: 100vh; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =================== AUTH =================== */
.auth {
  display: grid; place-items: center; min-height: 100vh; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), var(--bg) 60%);
}
.auth-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 32px 28px;
}
.auth-badge { display: flex; justify-content: center; margin-bottom: 14px; }
.auth-badge .logo-img { width: 84px; height: 84px; display: block; filter: drop-shadow(0 4px 12px rgba(16, 24, 40, .22)); }
.auth-logo {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  font-size: 23px; font-weight: 800; margin-bottom: 4px;
}
.auth-logo svg { width: 28px; height: 28px; }
.auth-logo .logo-img { width: 34px; height: 34px; display: block; }
.auth-sub { text-align: center; color: var(--text-dim); margin: 0 0 24px; font-size: 14px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-dim); }
.field input {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius); background: var(--surface-2); color: var(--text); font-size: 15px;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius);
  padding: 11px 16px; font-size: 15px; font-weight: 600; background: var(--surface-2);
  color: var(--text); transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover { background: var(--border); }
.btn.primary { background: var(--accent); color: var(--accent-fg); width: 100%; }
.btn.primary:hover { filter: brightness(1.05); background: var(--accent); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 14px; color: var(--text-dim); }
.auth-switch button { background: none; border: none; color: var(--accent); font-weight: 600; font-size: 14px; padding: 0; }
.form-error {
  background: var(--danger-soft); color: var(--danger); border-radius: var(--radius);
  padding: 10px 12px; font-size: 13.5px; margin-bottom: 14px;
}

/* =================== APP LAYOUT =================== */
.app-shell { display: grid; grid-template-columns: 240px 320px 1fr; height: 100vh; overflow: hidden; }

/* ---- Sidebar ---- */
.sidebar {
  background: var(--sidebar); color: var(--sidebar-fg);
  display: flex; flex-direction: column; min-height: 0;
}
.sidebar-head { display: flex; align-items: center; gap: 9px; padding: 16px 16px 12px; font-weight: 700; font-size: 17px; }
.sidebar-head svg { width: 22px; height: 22px; }
.sidebar-head .logo-img { width: 26px; height: 26px; display: block; }
.sidebar-scroll { overflow-y: auto; flex: 1; padding: 4px 8px 12px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: none; background: none; color: var(--sidebar-fg);
  border-radius: 7px; font-size: 14px; text-align: left; margin-bottom: 1px;
}
.nav-item:hover { background: var(--sidebar-active); color: #fff; }
.nav-item.active { background: var(--accent); color: var(--accent-fg); }
.nav-item .icon { width: 17px; height: 17px; flex: none; opacity: .9; }
.nav-item .count { margin-left: auto; font-size: 12px; color: var(--sidebar-fg-dim); }
.nav-item.active .count { color: rgba(255,255,255,.85); }
.nav-section {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 12px 6px; font-size: 11px; letter-spacing: .07em;
  text-transform: uppercase; color: var(--sidebar-fg-dim); font-weight: 700;
}
.nav-section button { background: none; border: none; color: var(--sidebar-fg-dim); font-size: 16px; line-height: 1; padding: 0 4px; border-radius: 5px; }
.nav-section button:hover { color: #fff; background: var(--sidebar-active); }
.nav-item .mini-x { margin-left: 6px; opacity: 0; color: var(--sidebar-fg-dim); border: none; background: none; font-size: 15px; padding: 0 2px; }
.nav-item:hover .mini-x { opacity: 1; }
.nav-item .mini-x:hover { color: var(--danger); }
.tag-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.08); padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.sidebar-foot .who { min-width: 0; }
.sidebar-foot .who .nm { font-size: 13px; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot .who .em { font-size: 11.5px; color: var(--sidebar-fg-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { background: none; border: none; color: var(--sidebar-fg-dim); width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; }
.icon-btn:hover { background: var(--sidebar-active); color: #fff; }
.icon-btn svg { width: 17px; height: 17px; }

/* ---- Note list column ---- */
.list-col { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.list-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--border); }
.list-title-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.list-title { font-size: 16px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* list view switcher */
.view-switch { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 2px; flex: none; }
.view-btn { width: 26px; height: 24px; border: none; background: none; color: var(--text-faint); border-radius: 6px; display: grid; place-items: center; cursor: pointer; }
.view-btn svg { width: 15px; height: 15px; }
.view-btn:hover { color: var(--text-dim); }
.view-btn.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }

/* compact view — titles only */
.note-items.view-compact .note-item { padding: 8px 16px; }
.note-items.view-compact .ni-snip, .note-items.view-compact .ni-meta { display: none; }
.note-items.view-compact .ni-title { margin: 0; font-size: 13.5px; font-weight: 500; }

/* cards / tiles view */
.note-items.view-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; padding: 12px; }
.note-items.view-grid .note-item { border: 1px solid var(--border); border-radius: 10px; padding: 10px 11px; background: var(--surface-2); }
.note-items.view-grid .note-item:hover { background: var(--border); }
.note-items.view-grid .note-item.active { background: var(--accent-soft); border-color: var(--accent); }
.note-items.view-grid .note-item::before { display: none; }
.note-items.view-grid .ni-title { font-size: 13.5px; }
.note-items.view-grid .ni-snip { max-height: 4.4em; }
.note-items.view-grid .ni-meta { margin-top: 6px; }
.note-items.view-grid .ni-meta .chip { display: none; }

/* Cards view fills the width as a gallery on wide screens, until a note is opened. */
@media (min-width: 1041px) {
  .app-shell[data-listview="grid"]:not(.has-note) { grid-template-columns: 240px 1fr; }
  .app-shell[data-listview="grid"]:not(.has-note) .editor-col { display: none; }
}
.new-btn { background: var(--accent); color: var(--accent-fg); border: none; border-radius: 7px; width: 30px; height: 30px; font-size: 20px; line-height: 1; display: grid; place-items: center; }
.new-btn:hover { filter: brightness(1.05); }
.search { position: relative; }
.search input {
  width: 100%; padding: 9px 12px 9px 34px; border: 1px solid var(--border-strong);
  border-radius: 8px; background: var(--surface-2); color: var(--text); font-size: 14px;
}
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-faint); }
.list-scroll { overflow-y: auto; flex: 1; }
.note-item { padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; position: relative; }
.note-item:hover { background: var(--surface-2); }
.note-item.active { background: var(--accent-soft); }
.note-item.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.note-item .ni-title { font-weight: 600; font-size: 14.5px; margin-bottom: 3px; display: flex; align-items: center; gap: 6px; }
.note-item .ni-title .pin { color: var(--accent); font-size: 12px; }
.note-item .ni-snip { color: var(--text-dim); font-size: 13px; line-height: 1.45; max-height: 2.9em; overflow: hidden; }
.note-item .ni-meta { display: flex; align-items: center; gap: 8px; margin-top: 7px; font-size: 11.5px; color: var(--text-faint); flex-wrap: wrap; }
.chip { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim); border-radius: 20px; padding: 1px 8px; font-size: 11px; }
.empty-state { padding: 48px 24px; text-align: center; color: var(--text-faint); }
.empty-state svg { width: 46px; height: 46px; opacity: .4; margin-bottom: 10px; }

/* ---- Editor column ---- */
.editor-col { background: var(--surface-2); display: flex; flex-direction: column; min-height: 0; }
.editor-empty { flex: 1; display: grid; place-items: center; color: var(--text-faint); text-align: center; padding: 24px; }
.editor-empty svg { width: 60px; height: 60px; opacity: .35; }
.editor-topbar { display: flex; align-items: center; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; }
.editor-topbar .spacer { flex: 1; }
.nb-select { border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); border-radius: 7px; padding: 6px 8px; font-size: 13px; max-width: 180px; }
.tool { width: 32px; height: 32px; border: none; background: none; color: var(--text-dim); border-radius: 6px; display: grid; place-items: center; }
.tool:hover { background: var(--border); color: var(--text); }
.tool.active { background: var(--accent-soft); color: var(--accent); }
.tool svg { width: 18px; height: 18px; }
.tool.danger:hover { background: var(--danger-soft); color: var(--danger); }
.divider { width: 1px; height: 20px; background: var(--border); margin: 0 3px; }
.save-state { font-size: 12px; color: var(--text-faint); padding: 0 6px; white-space: nowrap; }

.editor-scroll { overflow-y: auto; flex: 1; }
.editor-inner { max-width: 820px; margin: 0 auto; padding: 26px 40px 120px; }
.title-input {
  width: 100%; border: none; background: none; color: var(--text);
  font-size: 28px; font-weight: 700; padding: 0; margin-bottom: 6px; line-height: 1.25;
}
.title-input:focus { outline: none; }
.title-input::placeholder { color: var(--text-faint); }

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 18px; }
.tag-pill { display: inline-flex; align-items: center; gap: 5px; background: var(--accent-soft); color: var(--accent); border-radius: 20px; padding: 3px 6px 3px 10px; font-size: 12.5px; font-weight: 600; }
.tag-pill button { border: none; background: none; color: var(--accent); font-size: 14px; line-height: 1; padding: 0 2px; opacity: .7; }
.tag-pill button:hover { opacity: 1; }
.tag-add { border: none; background: none; color: var(--text-dim); font-size: 13px; min-width: 90px; padding: 3px 4px; }
.tag-add:focus { outline: none; }

.editor {
  min-height: 300px; font-size: 16px; line-height: 1.7; color: var(--text); outline: none;
}
.editor:empty::before { content: attr(data-placeholder); color: var(--text-faint); }
.editor h1 { font-size: 1.6em; margin: .7em 0 .3em; }
.editor h2 { font-size: 1.3em; margin: .7em 0 .3em; }
.editor h3 { font-size: 1.12em; margin: .7em 0 .3em; }
.editor p { margin: 0 0 .7em; }
.editor ul, .editor ol { margin: 0 0 .7em; padding-left: 1.5em; }
.editor blockquote { margin: 0 0 .7em; padding: 4px 0 4px 16px; border-left: 3px solid var(--accent); color: var(--text-dim); }
.editor pre { background: var(--sidebar); color: #e6edf3; padding: 14px 16px; border-radius: 8px; overflow-x: auto; font-family: var(--mono); font-size: 14px; }
.editor code { background: var(--border); border-radius: 4px; padding: 1px 5px; font-family: var(--mono); font-size: .9em; }
.editor pre code { background: none; padding: 0; }
.editor a { text-decoration: underline; }
.editor img { max-width: 100%; height: auto; border-radius: 6px; cursor: pointer; vertical-align: bottom; }
.editor img.img-selected { outline: 2px solid var(--accent); outline-offset: 1px; }
.editor ul.task-list { list-style: none; padding-left: 4px; }
.editor ul.task-list li { position: relative; padding-left: 28px; cursor: pointer; }
.editor ul.task-list li::before {
  content: ""; position: absolute; left: 0; top: .28em; width: 17px; height: 17px;
  border: 2px solid var(--border-strong); border-radius: 5px; background: var(--surface);
}
.editor ul.task-list li.checked { color: var(--text-faint); text-decoration: line-through; }
.editor ul.task-list li.checked::before {
  background: var(--accent); border-color: var(--accent);
  content: "\2713"; color: var(--accent-fg); font-size: 12px; text-align: center; line-height: 15px; text-decoration: none;
}

/* =================== Menus / modal / toast =================== */
.menu { position: fixed; z-index: 60; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 180px; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: none; background: none; color: var(--text); padding: 8px 10px; border-radius: 6px; font-size: 14px; text-align: left; }
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--danger); }
.menu button svg { width: 16px; height: 16px; }
.menu .sep { height: 1px; background: var(--border); margin: 5px 2px; }
.scrim { position: fixed; inset: 0; z-index: 55; }

.modal-scrim { position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 70; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 400px; padding: 22px; }
.modal h3 { margin: 0 0 6px; font-size: 17px; }
.modal p { margin: 0 0 16px; color: var(--text-dim); font-size: 14px; }
.modal input { width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2); color: var(--text); font-size: 15px; margin-bottom: 16px; }
.modal input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--sidebar); color: #fff; padding: 11px 18px; border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 90; font-size: 14px; display: flex; align-items: center; gap: 14px; }
.toast button { background: none; border: none; color: var(--accent); font-weight: 700; font-size: 13px; }
.toast.err { background: var(--danger); }

/* ---- Attachments ---- */
.attach-box { margin-top: 26px; }
.attach-box.empty { display: none; }
.attach-title, .settings-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); font-weight: 700; margin-bottom: 10px; }
.attach-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.attach-card { position: relative; width: 142px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); cursor: pointer; transition: border-color .12s; }
.attach-card:hover { border-color: var(--border-strong); }
.attach-thumb { width: 100%; height: 92px; object-fit: cover; background: var(--surface-2); display: block; }
.attach-thumb.file { display: grid; place-items: center; color: var(--text-faint); }
.attach-thumb.file svg { width: 32px; height: 32px; }
.ft-inner { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.attach-ext { font-size: 9px; font-weight: 800; letter-spacing: .05em; color: #fff; background: var(--af, #8a95a1); padding: 1px 6px; border-radius: 4px; line-height: 1.4; }
.ft-pdf     { --af: #d64545; color: #d64545; }
.ft-sheet   { --af: #2f9e68; color: #2f9e68; }
.ft-doc     { --af: #3b6fd6; color: #3b6fd6; }
.ft-text    { --af: #6b7682; color: #6b7682; }
.ft-zip     { --af: #c08a1e; color: #c08a1e; }
.ft-media   { --af: #8a5cf6; color: #8a5cf6; }
.ft-generic { --af: #8a95a1; color: #8a95a1; }
.attach-meta { padding: 7px 9px; }
.attach-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-size { font-size: 11px; color: var(--text-faint); margin-top: 1px; }
.attach-del { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 6px; border: none; background: rgba(10,15,20,.6); color: #fff; font-size: 13px; line-height: 1; cursor: pointer; display: none; place-items: center; }
.attach-card:hover .attach-del { display: grid; }
.attach-del:hover { background: var(--danger); }

/* ---- Image lightbox + inline-image toolbar ---- */
.lightbox { position: fixed; inset: 0; background: rgba(10,12,16,.84); z-index: 95; display: grid; place-items: center; padding: 30px; }
.lightbox-inner { max-width: 94vw; display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.lightbox-stage {
  min-width: 220px; min-height: 150px; max-width: 94vw; max-height: 80vh;
  display: grid; place-items: center; padding: 12px; border-radius: 10px;
  background-color: #8a949e;
  background-image: linear-gradient(45deg, #79828c 25%, transparent 25%), linear-gradient(-45deg, #79828c 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #79828c 75%), linear-gradient(-45deg, transparent 75%, #79828c 75%);
  background-size: 18px 18px; background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}
.lightbox-stage img { max-width: calc(94vw - 24px); max-height: calc(80vh - 24px); border-radius: 4px; display: block; image-rendering: auto; box-shadow: 0 2px 12px rgba(0,0,0,.4); }
.lightbox-inner.pdf { width: 92vw; height: 90vh; }
.lightbox-pdf { flex: 1; min-height: 0; width: 100%; border: none; border-radius: 8px; background: #fff; }
.lightbox-inner.text { width: 80vw; max-width: 880px; height: 82vh; }
.lightbox-textwrap { flex: 1; min-height: 0; width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: auto; }
.lightbox-text { margin: 0; padding: 18px 20px; font-family: var(--mono); font-size: 13px; line-height: 1.6; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.lightbox-bar { display: flex; align-items: center; gap: 10px; }
.lightbox-name { font-size: 13px; color: rgba(255,255,255,.85); margin-right: auto; max-width: 50vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.img-bar { position: fixed; z-index: 100; display: flex; align-items: center; gap: 2px; background: var(--sidebar); color: #fff; padding: 5px 7px; border-radius: 9px; box-shadow: var(--shadow-lg); }
.img-bar-label { font-size: 10.5px; color: var(--sidebar-fg-dim); margin-right: 4px; text-transform: uppercase; letter-spacing: .05em; }
.img-bar-btn { background: none; border: none; color: var(--sidebar-fg); font-size: 12px; padding: 4px 7px; border-radius: 6px; cursor: pointer; display: grid; place-items: center; }
.img-bar-btn:hover { background: var(--sidebar-active); color: #fff; }
.img-bar-btn.danger { color: var(--danger); }
.img-bar-btn svg { width: 15px; height: 15px; }
.img-bar-sep { width: 1px; height: 16px; background: rgba(255,255,255,.15); margin: 0 3px; }

/* ---- Tooltips (instant, styled) ---- */
.tip { position: relative; }
.tip::after {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 7px); left: 50%; transform: translateX(-50%) translateY(2px);
  background: var(--sidebar); color: #fff; padding: 4px 8px; border-radius: 6px;
  font-size: 12px; font-weight: 500; line-height: 1.3; white-space: nowrap;
  pointer-events: none; opacity: 0; z-index: 100;
  box-shadow: var(--shadow); transition: opacity .1s ease, transform .1s ease;
}
.tip::before {
  content: ""; position: absolute; top: calc(100% + 2px); left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-bottom-color: var(--sidebar);
  pointer-events: none; opacity: 0; z-index: 100; transition: opacity .1s ease;
}
.tip:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); transition-delay: .25s; }
.tip:hover::before { opacity: 1; transition-delay: .25s; }
/* Keep edge tooltips on-screen. */
.tip.tip-end::after { left: auto; right: 0; transform: translateY(2px); }
.tip.tip-end:hover::after { transform: translateY(0); }
.tip.tip-end::before, .tip.tip-end:hover::before { display: none; }

/* ---- Mobile back button (hidden on desktop) ---- */
.back-btn { display: none; background: none; border: none; color: var(--text-dim); align-items: center; gap: 4px; font-size: 14px; padding: 4px 6px; }

/* =================== Responsive =================== */
@media (max-width: 1040px) {
  .app-shell { grid-template-columns: 210px 1fr; }
  .app-shell[data-pane="editor"] .list-col { display: none; }
  .app-shell[data-pane="list"] .editor-col { display: none; }
  .back-btn { display: inline-flex; }
}
@media (max-width: 720px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-shell .sidebar { position: fixed; z-index: 80; width: 260px; height: 100vh; transform: translateX(-100%); transition: transform .2s; }
  .app-shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .app-shell[data-pane="editor"] .list-col { display: none; }
  .app-shell[data-pane="list"] .editor-col { display: none; }
  .editor-inner { padding: 20px 18px 120px; }
  .menu-toggle { display: inline-flex !important; }
}
.menu-toggle { display: none; }
