:root {
  --bg: #ffffff;
  --bg-nav: #f4f4f6;
  --bg-list: #fafafb;
  --bg-hover: #ececf0;
  --bg-active: #e3e7fb;
  --bg-input: #ffffff;
  --text: #1d1e22;
  --muted: #6b6f7a;
  --border: #e3e4e8;
  --sep: #ebebee;
  --accent: #3d5afe;
  --accent-text: #ffffff;
  --accent-soft: #e8ecff;
  --danger: #d32f2f;
  --mark: #fff3a3;
  --shadow: 0 8px 28px rgba(15, 20, 40, .14), 0 1px 3px rgba(15, 20, 40, .08);
  --radius: 10px;
  --nav-w: 248px;
  --list-w: 330px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1c21;
    --bg-nav: #141519;
    --bg-list: #17181c;
    --bg-hover: #26282f;
    --bg-active: #2a3160;
    --bg-input: #22242a;
    --text: #e7e8ec;
    --muted: #979ba6;
    --border: #2d2f36;
    --sep: #24262c;
    --accent: #7b8cff;
    --accent-text: #0f1220;
    --accent-soft: #262c52;
    --danger: #ff6b6b;
    --mark: #5c5220;
    --shadow: 0 8px 28px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.error { color: var(--danger); min-height: 1.2em; margin: 0; }
.spacer { flex: 1; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

button.primary, .primary {
  background: var(--accent); color: var(--accent-text); border: 0; border-radius: 8px;
  padding: 9px 14px; font-weight: 600;
}
button.primary:hover { filter: brightness(1.06); }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px;
  border: 0; background: transparent; color: var(--muted); text-decoration: none; flex: none;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn.small { width: 26px; height: 26px; }
.icon-btn.small svg { width: 16px; height: 16px; }
input, select {
  background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; outline: none;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---- sign in ---- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: var(--bg-nav); }
.auth-card {
  width: min(380px, 100%); background: var(--bg); border: 1px solid var(--border); border-radius: 16px;
  padding: 28px 24px; display: grid; gap: 14px; box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0; font-size: 22px; }
.auth-card label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.auth-card input { font-size: 16px; color: var(--text); }
.auth-logo { width: 44px; height: 44px; }

/* ---- layout ---- */
.app {
  height: var(--app-h, 100%); display: grid;
  grid-template-columns: var(--nav-w) var(--list-w) 1fr;
  overflow: hidden;
}
.pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; }
.pane-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; min-height: 56px;
  padding-top: calc(10px + var(--safe-top));
  border-bottom: 1px solid var(--border);
}
.pane-head h2 { font-size: 17px; margin: 0 0 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back { display: none; }

/* ---- nav ---- */
.nav { background: var(--bg-nav); border-right: 1px solid var(--border); padding-top: var(--safe-top); user-select: none; }
.nav-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px 16px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.brand img { width: 24px; height: 24px; }
.new-note { margin: 4px 12px 10px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.new-note svg { width: 18px; height: 18px; }
.search { position: relative; margin: 0 12px 10px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.search input { width: 100%; padding-left: 32px; }
.nav-scroll { overflow-y: auto; flex: 1; padding: 0 8px calc(16px + var(--safe-bottom)); }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
  color: var(--text); text-decoration: none; position: relative;
  -webkit-touch-callout: none;
}
.nav-item svg { width: 18px; height: 18px; color: var(--muted); }
.nav-item .label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item .count { color: var(--muted); font-size: 12.5px; }
.nav-item:hover { background: var(--bg-hover); }
.nav-item.active { background: var(--bg-active); font-weight: 600; }
.nav-item.active svg { color: var(--accent); }
.nav-section {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 6px 4px 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600;
}
.trash-link { margin-top: 12px; }
.nav-item.drop-into { background: var(--accent-soft); outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---- note list ---- */
.list-pane { background: var(--bg-list); border-right: 1px solid var(--border); }
.list-pane select { padding: 5px 8px; font-size: 13px; max-width: 130px; }
.list { overflow-y: auto; flex: 1; padding: 6px 8px calc(90px + var(--safe-bottom)); user-select: none; }
.note-item {
  display: block; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none;
  border: 1px solid transparent; margin-bottom: 2px; position: relative; -webkit-touch-callout: none;
  /* A faint separator line under each note, inset from the edges. Hover and
     selection paint a background, which hides it on that note. */
  background-image: linear-gradient(var(--sep), var(--sep));
  background-repeat: no-repeat; background-size: calc(100% - 24px) 1px; background-position: 12px 100%;
}
.note-item:last-child { background-image: none; }
.note-item:hover { background: var(--bg-hover); }
.note-item.active { background: var(--bg); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.note-item .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-item .s {
  color: var(--muted); font-size: 13.5px; margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.note-item .d { color: var(--muted); font-size: 12px; margin-top: 4px; display: flex; gap: 8px; }
.note-item .d .nb { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: 48px 24px; }
.fab {
  position: absolute; right: 16px; bottom: calc(16px + var(--safe-bottom)); width: 54px; height: 54px; border-radius: 16px;
  display: none; place-items: center; padding: 0; box-shadow: var(--shadow);
}
.fab svg { width: 24px; height: 24px; stroke-width: 2.2; }

/* favorites */
.star-btn.on svg, svg.star-on, .note-item .fav svg { fill: #f5b301; stroke: #f5b301; }
.star-btn.on { color: #f5b301; }
.star-btn.on:hover svg { fill: none; } /* hovering a set star previews removing it */
.note-item .fav { position: absolute; top: 6px; right: 6px; padding: 4px; border-radius: 6px; line-height: 0; cursor: pointer; }
.note-item .fav svg { width: 14px; height: 14px; }
.note-item .fav:hover { background: var(--bg-hover); }
.note-item .fav:hover svg { fill: none; }
/* Remove-from-favorites star on sidebar favorites: on hover, or always on touch. */
.nav-item .unfav { display: none; padding: 3px; margin: -3px -4px -3px 0; border-radius: 6px; line-height: 0; cursor: pointer; }
.nav-item .unfav svg { width: 16px; height: 16px; fill: #f5b301; stroke: #f5b301; }
.nav-item:hover .unfav, .nav-item:focus-visible .unfav { display: inline-block; }
.nav-item .unfav:hover { background: var(--bg-hover); }
.nav-item .unfav:hover svg { fill: none; }
#fav-notebooks .nav-item:hover .count { display: none; }
@media (hover: none) { .nav-item .unfav { display: inline-block; } #fav-notebooks .nav-item .count { display: none; } }
.note-item.has-fav .t { padding-right: 18px; }

/* drag and drop */
.dragging-src { opacity: .35; }
.drag-ghost {
  position: fixed; z-index: 1000; pointer-events: none; margin: 0; box-shadow: var(--shadow);
  background: var(--bg) !important; border-radius: 10px; opacity: .95; transform: rotate(1.5deg);
}
.drop-before::before, .drop-after::after {
  content: ""; position: absolute; left: 6px; right: 6px; height: 3px; border-radius: 3px; background: var(--accent);
}
.drop-before::before { top: -2px; }
.drop-after::after { bottom: -2px; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none !important; }

/* ---- editor pane ---- */
.note-pane { background: var(--bg); }
.note-head { gap: 6px; }
.crumb {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--muted);
  padding: 6px 8px; border-radius: 8px; min-width: 0; font-size: 13.5px;
}
.crumb span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb:hover { background: var(--bg-hover); color: var(--text); }
.crumb svg { width: 16px; height: 16px; }
#save-state { white-space: nowrap; }
.toolbar {
  display: flex; align-items: center; gap: 2px; padding: 6px 10px; border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none; flex: none; user-select: none;
}
.toolbar::-webkit-scrollbar { display: none; }
.toolbar button {
  flex: none; height: 32px; min-width: 32px; display: inline-grid; place-items: center; border: 0; border-radius: 6px;
  background: transparent; color: var(--text); padding: 0 6px;
}
.toolbar button.txt { font-size: 14px; font-weight: 600; }
.toolbar button svg { width: 18px; height: 18px; }
.toolbar button:hover { background: var(--bg-hover); }
.toolbar button.active { background: var(--accent-soft); color: var(--accent); }
.toolbar button:disabled { opacity: .35; cursor: default; }
.toolbar .sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; flex: none; }
.table-tools { display: none !important; }
/* The Table button shows whenever the cursor is in a table, on any width. */
.toolbar .grp[data-group="table"]:not([hidden]) { display: inline-grid; position: relative; }
/* Wide note area: one row of every tool. Narrow: group buttons + popup. */
.note-pane { container-type: inline-size; container-name: notepane; }
.toolbar .flat { display: contents; }
.toolbar .grp { display: none; }
@container notepane (max-width: 820px) {
  .toolbar { justify-content: space-between; overflow: visible; }
  .toolbar .flat { display: none; }
  .toolbar .grp:not([hidden]) { display: inline-grid; position: relative; }
  .toolbar .grp::after { /* a small corner mark: this opens more */
    content: ""; position: absolute; right: 3px; top: 3px; border: 3px solid transparent;
    border-right-color: currentColor; border-top-color: currentColor; opacity: .45;
  }
  .toolbar .grp.open { background: var(--bg-hover); }
}
.bubble {
  position: fixed; z-index: 840; display: flex; align-items: center; gap: 2px; padding: 4px; max-width: calc(100vw - 16px);
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
}
.bubble button {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 0; border-radius: 7px;
  background: transparent; color: var(--text); font-size: 13.5px; white-space: nowrap;
}
.bubble button svg { width: 16px; height: 16px; }
.bubble button:hover { background: var(--bg-hover); }
.bubble button.danger { color: var(--danger); }
.bubble .bubble-url {
  max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 8px; font-size: 13px;
  border-right: 1px solid var(--border); margin-right: 2px;
}
@media (max-width: 700px) { .bubble button span { display: none; } .bubble button.danger span, .bubble button:only-child span { display: inline; } .bubble .bubble-url { max-width: 140px; } }
.tb-pop {
  position: fixed; z-index: 850; display: flex; gap: 4px; padding: 6px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
  animation: pop-up .16s ease-out; max-width: calc(100vw - 16px); flex-wrap: wrap; justify-content: center;
}
.tb-pop button {
  display: grid; justify-items: center; align-content: center; gap: 3px; min-width: 54px; height: 54px; padding: 4px 6px;
  border: 0; border-radius: 10px; background: transparent; color: var(--text); font-size: 15px; font-weight: 600;
}
.tb-pop button svg { width: 20px; height: 20px; }
.tb-pop button .word { font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.tb-pop button .cap { font-size: 10.5px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.tb-pop button:hover, .tb-pop button:focus-visible { background: var(--bg-hover); outline: none; }
.tb-pop button.active { background: var(--accent-soft); color: var(--accent); }
.tb-pop button.active .cap { color: var(--accent); }
.tb-pop button:disabled { opacity: .35; }
@keyframes pop-up { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
.note-scroll { flex: 1; overflow-y: auto; padding: 22px max(24px, calc((100% - 820px) / 2)) calc(120px + var(--safe-bottom)); }
.title {
  width: 100%; border: 0 !important; box-shadow: none !important; background: transparent; padding: 0;
  font-size: 28px; font-weight: 700; line-height: 1.25;
}
.note-meta { margin: 6px 0 14px; }
.no-note {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 4px; background: var(--bg);
}
.no-note svg { width: 48px; height: 48px; stroke-width: 1.2; }
.banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; font-size: 14px;
  background: var(--accent-soft); border-bottom: 1px solid var(--border);
}
.banner.warn { background: #fff4d6; color: #5c4400; }
@media (prefers-color-scheme: dark) { .banner.warn { background: #3d3214; color: #ffe2a0; } }
.banner button { border: 1px solid var(--border); background: var(--bg); border-radius: 7px; padding: 4px 10px; font-size: 13px; }
.banner button.primary { border: 0; background: var(--accent); }
.read-only .toolbar { opacity: .4; pointer-events: none; }

/* ---- document ---- */
.editor { font-size: 16px; line-height: 1.6; }
.editor-host { position: relative; }
/* grip for dragging list items, and where they will land */
.li-grip {
  position: absolute; z-index: 5; width: 22px; height: 24px; padding: 0; border: 0; border-radius: 5px;
  background: transparent; color: var(--muted); display: grid; place-items: center; cursor: grab; touch-action: none;
  opacity: .55;
}
.li-grip:hover { opacity: 1; background: var(--bg-hover); }
.li-grip svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.li-drop-line { position: absolute; z-index: 4; height: 3px; border-radius: 3px; background: var(--accent); pointer-events: none; }
.doc li.li-dragging { opacity: .35; }
/* table handles: row (left), column (above), whole table (corner) */
.tbl-grip {
  position: absolute; z-index: 6; width: 22px; height: 22px; padding: 0; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--muted); display: grid; place-items: center; cursor: grab; touch-action: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}
.tbl-grip:hover { color: var(--accent); border-color: var(--accent); }
.tbl-grip svg { width: 14px; height: 14px; fill: currentColor; stroke: none; }
.tbl-grip.whole svg { fill: none; stroke: currentColor; stroke-width: 2; }
.tbl-drop-line { position: absolute; z-index: 5; border-radius: 3px; background: var(--accent); pointer-events: none; }
@media (hover: none) { .tbl-grip { width: 28px; height: 28px; } }
@media (hover: none) { .li-grip { opacity: .8; width: 30px; height: 30px; } }
.doc { outline: none; min-height: 50vh; overflow-wrap: anywhere; }
.doc > * + * { margin-top: .45em; }
.doc p { margin: 0; min-height: 1em; }
.doc h1, .doc h2, .doc h3 { line-height: 1.3; margin: 1.1em 0 .3em; }
.doc h1 { font-size: 1.6em; }
.doc h2 { font-size: 1.32em; }
.doc h3 { font-size: 1.12em; }
.doc ul, .doc ol { padding-left: 1.6em; margin: .25em 0; }
.doc li { margin: .12em 0; }
.doc li > p { margin: 0; }
.doc li::marker { color: var(--muted); }
/* Numbered lists count 1 → a → i → 1 → a → i as they nest. */
.doc ol { list-style-type: decimal; }
.doc ol ol { list-style-type: lower-alpha; }
.doc ol ol ol { list-style-type: lower-roman; }
.doc ol ol ol ol { list-style-type: decimal; }
.doc ol ol ol ol ol { list-style-type: lower-alpha; }
.doc ol ol ol ol ol ol { list-style-type: lower-roman; }
.doc ul { list-style-type: disc; }
.doc ul ul { list-style-type: circle; }
.doc ul ul ul { list-style-type: square; }
.doc ul ul ul ul { list-style-type: disc; }
.doc ul[data-type="taskList"] { list-style: none; padding-left: .2em; }
.doc ul[data-type="taskList"] ul[data-type="taskList"] { padding-left: 1.4em; }
/* TipTap draws checklist items as li > label(input) + div. */
.doc ul[data-type="taskList"] > li { display: flex; gap: .55em; align-items: flex-start; margin: .15em 0; }
.doc ul[data-type="taskList"] > li > label { flex: none; margin-top: .2em; user-select: none; display: flex; }
.doc ul[data-type="taskList"] > li > label input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.doc ul[data-type="taskList"] > li > div { flex: 1; min-width: 0; }
.doc ul[data-type="taskList"] > li[data-checked="true"] > div > p { color: var(--muted); text-decoration: line-through; }
.doc blockquote { border-left: 3px solid var(--border); margin: .5em 0; padding-left: 1em; color: var(--muted); }
.doc pre {
  background: var(--bg-nav); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; overflow-x: auto;
  font: 13.5px/1.5 ui-monospace, "SF Mono", Consolas, monospace; white-space: pre;
}
.doc code { font: .9em ui-monospace, "SF Mono", Consolas, monospace; background: var(--bg-hover); padding: .1em .3em; border-radius: 4px; }
.doc pre code { background: none; padding: 0; font-size: inherit; }
/* A divider is drawn as a 1px line inside a taller box, so it is easy to
   click or tap to select. */
.doc hr {
  border: 0; height: 17px; margin: .6em 0; padding: 8px 0; box-sizing: border-box; cursor: pointer;
  background: var(--border); background-clip: content-box;
}
.doc hr.ProseMirror-selectednode { background-color: var(--accent); outline: 2px solid var(--accent-soft); border-radius: 4px; }
.doc img { max-width: 100%; height: auto; border-radius: 6px; display: block; }
.doc img.ProseMirror-selectednode { outline: 3px solid var(--accent); }
.doc a { text-decoration: underline; text-underline-offset: 2px; }
.doc table { border-collapse: collapse; width: 100%; margin: .6em 0; table-layout: fixed; overflow: hidden; }
.doc td, .doc th { border: 1px solid var(--border); padding: 6px 8px; vertical-align: top; position: relative; }
.doc th { background: var(--bg-nav); font-weight: 600; text-align: left; }
.doc td.selectedCell, .doc th.selectedCell { background: var(--accent-soft); }
.doc .selectedCell ::selection { background: transparent; }
.doc .tableWrapper { overflow-x: auto; }
.doc p.is-editor-empty:first-child::before {
  content: attr(data-placeholder); color: var(--muted); float: left; height: 0; pointer-events: none;
}
.doc ::selection { background: var(--accent-soft); }
/* Highlighted text stays readable on the dark theme. */
@media (prefers-color-scheme: dark) { .doc span[style*="background-color"] { color: #1d1e22; } }

/* ---- dialogs, menus, toasts ---- */
.dialog {
  border: 1px solid var(--border); border-radius: 14px; padding: 0; width: min(420px, calc(100% - 32px));
  background: var(--bg); color: var(--text); box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(10, 12, 20, .38); }
.dialog form { padding: 20px; display: grid; gap: 12px; }
.dialog h3 { margin: 0; font-size: 18px; }
.dialog p:empty { display: none; }
.dialog p { margin: 0; }
.dialog input { width: 100%; font-size: 16px; }
.dialog label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.dialog-actions button:not(.primary) { background: transparent; border: 1px solid var(--border); border-radius: 8px; padding: 9px 14px; }
.dialog .danger.primary { background: var(--danger); color: #fff; }
.pick { display: grid; gap: 2px; max-height: 50vh; overflow-y: auto; }
.pick button {
  text-align: left; border: 0; background: transparent; padding: 10px 12px; border-radius: 8px; display: flex; gap: 10px; align-items: center;
}
.pick button:hover, .pick button:focus-visible { background: var(--bg-hover); outline: none; }
.pick button.current { color: var(--accent); font-weight: 600; }
.pick svg { width: 18px; height: 18px; color: var(--muted); }
.menu {
  position: fixed; z-index: 900; min-width: 200px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: grid;
}
.menu button {
  text-align: left; border: 0; background: transparent; padding: 9px 12px; border-radius: 8px; font-size: 14.5px;
}
.menu button:hover, .menu button:focus-visible { background: var(--bg-hover); outline: none; }
.menu button.danger { color: var(--danger); }
.menu button:disabled { opacity: .4; cursor: default; background: transparent; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom)); transform: translateX(-50%); z-index: 950;
  background: #23252c; color: #f2f3f6; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow);
  display: flex; gap: 14px; align-items: center; font-size: 14px; max-width: calc(100% - 32px);
}
.toast button { background: transparent; border: 0; color: #9fb0ff; font-weight: 700; padding: 0; }
.offline {
  position: fixed; top: calc(8px + var(--safe-top)); left: 50%; transform: translateX(-50%); z-index: 960;
  background: #5c4400; color: #fff4d6; padding: 6px 12px; border-radius: 999px; font-size: 13px;
}

/* ---- tablet: notebooks slide over ---- */
@media (max-width: 1100px) {
  .app { grid-template-columns: var(--list-w) 1fr; }
  .nav {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 85vw); z-index: 800; transform: translateX(-105%);
    transition: transform .22s ease; box-shadow: var(--shadow);
  }
  .app.nav-open .nav { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(10, 12, 20, .3); z-index: 790; }
  .list-pane .back { display: inline-grid; }
}

/* ---- phone: one pane at a time ---- */
@media (max-width: 700px) {
  .app { grid-template-columns: 100%; }
  .nav { position: static; width: auto; transform: none; transition: none; box-shadow: none; border: 0; }
  .app.nav-open::after { display: none; }
  .pane { grid-area: 1 / 1; }
  .app .pane { visibility: hidden; }
  .app[data-pane="nav"] .nav, .app[data-pane="list"] .list-pane, .app[data-pane="note"] .note-pane { visibility: visible; }
  /* Page transitions; see setPane in app.js. The pane on top casts a shadow. */
  .pane.in-fwd { animation: pane-in-fwd .3s cubic-bezier(.2, .8, .2, 1); z-index: 2; box-shadow: -8px 0 24px rgba(0, 0, 0, .12); }
  .pane.out-fwd { visibility: visible !important; animation: pane-out-fwd .3s cubic-bezier(.2, .8, .2, 1) forwards; z-index: 1; }
  .pane.in-back { animation: pane-in-back .3s cubic-bezier(.2, .8, .2, 1); z-index: 1; }
  .pane.out-back { visibility: visible !important; animation: pane-out-back .3s cubic-bezier(.2, .8, .2, 1) forwards; z-index: 2; box-shadow: -8px 0 24px rgba(0, 0, 0, .12); pointer-events: none; }
  .back, .note-pane .back { display: inline-grid; }
  .fab { display: grid; }
  .note-scroll { padding: 16px 18px calc(120px + var(--safe-bottom)); }
  .title { font-size: 24px; }
  .toolbar { order: 10; border-top: 1px solid var(--border); border-bottom: 0; padding-bottom: calc(6px + var(--safe-bottom)); background: var(--bg); }
  .toolbar button { height: 38px; min-width: 38px; }
  .nav-item { padding: 10px 12px; font-size: 16px; }
  .note-item { padding: 12px; }
  .list-pane select { max-width: 110px; }
}
@keyframes pane-in-fwd { from { transform: translateX(100%); } to { transform: none; } }
@keyframes pane-out-fwd { from { transform: none; } to { transform: translateX(-30%); filter: brightness(.94); } }
@keyframes pane-in-back { from { transform: translateX(-30%); filter: brightness(.94); } to { transform: none; } }
@keyframes pane-out-back { from { transform: none; } to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
