/* ============================================================
   NOTES — the notes page (notes/index) and its editor (notes/edit, notes/new)
   Two columns: the list of notes, and the open note. Folders are a menu under the list's
   heading. Built on the app's own surfaces and text colours, where it used to carry a
   palette of its own (and a separate stylesheet partial to hold it).
   ============================================================ */
.an-layout { display: flex; height: 100vh; overflow: hidden; background: var(--bg); }

/* ---- The list ---- */
.an-notes-list {
  display: flex;
  flex-direction: column;
  width: 320px;
  min-width: 320px;
  overflow: hidden;
  background: var(--surface-card);
  border-right: 1px solid var(--border-panel);
}
.an-list-header { position: relative; flex-shrink: 0; padding: 14px 14px 10px; border-bottom: 1px solid var(--border-panel); }
.an-list-titlebar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.an-folder-switch {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 9px;
  min-width: 0;
  margin-left: -6px;
  padding: 4px 6px;
  border: none;
  border-radius: var(--radius-md);
  background: none;
  color: var(--text-1);
  font: inherit;
  cursor: pointer;
  transition: background-color var(--dur-fast) ease;
}
.an-folder-switch:hover, .an-folder-switch[aria-expanded="true"] { background: var(--surface-2); }
.an-folder-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.an-folder-switch-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--folder, var(--accent)) 16%, transparent);
  color: var(--folder, var(--accent));
  font-size: var(--fs-13);
}
.an-list-heading { overflow: hidden; font-size: var(--fs-20); font-weight: 700; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.an-folder-switch-chevron { flex-shrink: 0; color: var(--text-3); font-size: var(--fs-10); transition: transform var(--dur-fast) ease; }
.an-folder-switch[aria-expanded="true"] .an-folder-switch-chevron { transform: rotate(180deg); }
.an-list-count { flex-shrink: 0; color: var(--text-3); font-size: var(--fs-11); font-variant-numeric: tabular-nums; }
.an-new-btn {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--accent-bright);
  font-size: var(--fs-14);
  text-decoration: none;
  transition: background-color var(--dur-fast) ease;
}
.an-new-btn:hover { background: var(--accent-soft); }

.an-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  transition: border-color var(--dur-fast) ease;
}
.an-search-wrap:focus-within { border-color: var(--border-strong); }
.an-search-icon { flex-shrink: 0; color: var(--text-3); font-size: var(--fs-12); }
.an-search-input { flex: 1; min-width: 0; padding: 7px 0; border: none; outline: none; background: none; color: var(--text-1); font: inherit; font-size: var(--fs-13); }
.an-search-input::placeholder { color: var(--text-3); }

/* The folder menu, dropped from the heading over the list. */
.an-folder-menu {
  position: absolute;
  top: 54px;
  left: 8px;
  right: 8px;
  z-index: 60;
  max-height: min(70vh, 520px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-pop);
  box-shadow: var(--shadow-card);
}
.an-folder-menu[hidden] { display: none; }
.an-folder-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: var(--fs-13);
  cursor: pointer;
  user-select: none;
  transition: background-color var(--dur-fast) ease;
}
@media (hover: hover) { .an-folder-item:hover { background: var(--surface-3); } }
.an-folder-item.active { background: rgba(255, 255, 255, 0.06); box-shadow: inset 2px 0 0 var(--accent); }
.an-folder-item.drag-over { background: var(--accent-soft); outline: 1px solid var(--accent); }
.an-folder-item.drag-reorder-above { box-shadow: inset 0 2px 0 var(--gold); }
.an-folder-item.drag-reorder-below { box-shadow: inset 0 -2px 0 var(--gold); }
.an-folder-icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--folder, #f59e0b) 16%, transparent);
  color: var(--folder, #f59e0b);
  font-size: var(--fs-12);
}
.an-folder-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-folder-count { flex-shrink: 0; color: var(--text-3); font-size: var(--fs-12); font-variant-numeric: tabular-nums; }
.an-folder-more-btn {
  display: none;
  flex-shrink: 0;
  align-items: center;
  padding: 2px 5px;
  border: none;
  border-radius: 4px;
  background: none;
  color: var(--text-2);
  font-size: var(--fs-13);
  line-height: 1;
  cursor: pointer;
}
.an-folder-more-btn:hover { background: var(--surface-2); color: var(--text-1); }
.an-folder-item:hover .an-folder-count { display: none; }
.an-folder-item:hover .an-folder-more-btn { display: flex; }
@media (hover: none) { .an-folder-more-btn { display: flex; } .an-folder-item .an-folder-count { display: none; } }
.an-folder-divider { height: 1px; margin: 5px 6px; background: var(--border-panel); }
.an-folder-divider.is-group-break { margin: 10px 6px 8px; background: var(--border-strong); }
.an-folder-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 3px;
  color: var(--text-3);
  font-size: var(--fs-10);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.an-folder-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-xs);
  color: var(--text-2);
  font-size: var(--fs-11);
  text-decoration: none;
}
.an-folder-add:hover { background: var(--surface-3); color: var(--accent-bright); }
/* The Smart folders "?" is a button, where Folders' "+" is a link: without this it wore the
   browser's own border and fill, an outlined square unlike anything else in the menu. */
button.an-folder-add { padding: 0; border: none; background: none; font: inherit; font-size: var(--fs-11); cursor: pointer; }
.an-folder-none { margin: 4px 8px 6px; color: var(--text-3); font-size: var(--fs-12); }
.an-folder-tooltip {
  position: fixed;
  z-index: 9998;
  max-width: 220px;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text-1);
  font-size: var(--fs-12);
  line-height: 1.5;
  white-space: pre-wrap;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

/* The notes themselves. */
.an-notes-scroll { flex: 1; overflow-y: auto; }
.an-section-label {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 14px 5px;
  background: var(--surface-card);
  color: var(--text-3);
  font-size: var(--fs-10);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  user-select: none;
}
.an-section-label i { font-size: var(--fs-9); }
.an-note-item {
  display: block;
  margin: 0 6px 2px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur-fast) ease;
}
@media (hover: hover) { .an-note-item:hover { background: var(--surface-1); } }
.an-note-item.active { background: rgba(34, 197, 94, 0.1); box-shadow: inset 3px 0 0 var(--accent); }
/* On a phone the list is the whole screen until a note is opened, so no row is "open":
   the newest note's highlight (it opens beside the list on desktop) said otherwise. */
@media (max-width: 760px) {
  .an-layout:not(.is-note-open) .an-note-item.active { background: none; box-shadow: none; }
}
.an-note-item.dragging { opacity: 0.4; }
.an-note-item.selected-delete { background: var(--danger-soft); box-shadow: inset 0 0 0 1px var(--danger); }
.an-note-title {
  overflow: hidden;
  margin-bottom: 3px;
  color: var(--text-1);
  font-size: var(--fs-14);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.an-note-title.is-deleted { color: var(--text-2); }
.an-note-icon { margin-right: 4px; font-size: var(--fs-11); opacity: 0.7; }
.an-note-sub { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; color: var(--text-3); font-size: var(--fs-11); }
/* The folder a note is filed in, in that folder's colour. */
.an-note-folder { display: inline-flex; align-items: center; gap: 5px; color: color-mix(in srgb, var(--folder, #f59e0b) 80%, #fff); white-space: nowrap; }
.an-note-folder::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--folder, #f59e0b); }
/* A note's #tags on its sub line, the blue #tags are everywhere else (.entry-hashtag). */
.an-note-tag { color: #93c5fd; white-space: nowrap; }
.an-note-expiry { color: var(--danger-bright); }
.an-note-preview { overflow: hidden; color: var(--text-3); font-size: var(--fs-12); text-overflow: ellipsis; white-space: nowrap; }
.an-empty-state { padding: 2rem; color: var(--text-3); font-size: var(--fs-13); text-align: center; }

/* ---- The open note ---- */
.an-panel-col { display: flex; flex: 1; flex-direction: column; min-width: 0; overflow: hidden; background: var(--bg); }
turbo-frame#note-panel { display: flex; flex: 1; flex-direction: column; height: 100%; min-height: 0; overflow: hidden; }

/* Nothing open: a way to start a note, and the last few to go back to. */
.an-placeholder { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; }
.an-placeholder-icon { margin-bottom: 4px; color: var(--text-3); font-size: 44px; opacity: 0.5; }
.an-placeholder-title { margin: 0; color: var(--text-2); font-size: var(--fs-16); font-weight: 600; }
.an-placeholder-new {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 16px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #04140a;
  font: inherit;
  font-size: var(--fs-13);
  font-weight: 600;
  cursor: pointer;
}
.an-placeholder-new:hover { background: var(--accent-bright); }
.an-placeholder-hint { margin: 0; color: var(--text-3); font-size: var(--fs-11); }
.an-placeholder-hint kbd {
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-2);
  font-family: inherit;
  font-size: var(--fs-10);
}
.an-placeholder-recent { display: flex; flex-direction: column; gap: 2px; width: min(280px, 100%); margin-top: 16px; }
.an-placeholder-label { margin: 0 0 4px 10px; color: var(--text-3); font-size: var(--fs-10); font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; }
.an-placeholder-note {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: var(--fs-13);
  text-align: left;
  cursor: pointer;
}
.an-placeholder-note:hover { background: var(--surface-2); color: var(--text-1); }
/* A new account's welcome (notes/_placeholder), and the prompt it — or an empty panel
   with nothing pinned — offers to start from. */
.an-placeholder-text { max-width: 300px; margin: -4px 0 4px; color: var(--text-3); font-size: var(--fs-13); line-height: 1.5; text-align: center; }
.an-placeholder.is-first-run .an-placeholder-title { color: var(--text-1); font-size: var(--fs-18); }
.an-placeholder-spark { display: flex; flex-direction: column; align-items: stretch; gap: 6px; width: min(320px, 100%); margin-top: 18px; }
.an-placeholder-spark-link {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid var(--border-panel);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  text-decoration: none;
  transition: border-color var(--dur-fast), background-color var(--dur-fast);
}
.an-placeholder-spark-link:hover { border-color: var(--border-strong); background: var(--surface-2); }
.an-placeholder-spark-head { color: var(--text-1); font-size: var(--fs-13); font-weight: 600; }
.an-placeholder-spark-q { color: var(--text-3); font-size: var(--fs-12); line-height: 1.45; }
.an-placeholder-more { align-self: center; margin-top: 2px; color: var(--accent-bright); font-size: var(--fs-12); text-decoration: none; }
.an-placeholder-more:hover { text-decoration: underline; }
/* On a wide screen the panel's welcome is the one message; the list's own is for a phone. */
@media (min-width: 761px) { .an-empty-state.is-first-run { display: none; } }
.an-placeholder-note i { color: var(--text-3); }
.an-placeholder-note span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The editor's toolbar: formatting in groups, then folder, pin and delete. */
.ane-toolbar {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-panel);
  background: var(--surface-card);
  scrollbar-width: none;
}
/* Safari ignores scrollbar-width and draws the global 8px ::-webkit-scrollbar, which
   opened a gap under the toolbar whenever it overflowed. */
.ane-toolbar::-webkit-scrollbar { display: none; }
.ane-toolbar-spacer { flex: 1; }
.ane-toolbar-title { color: var(--text-2); font-size: var(--fs-13); font-weight: 600; }
.ane-back { display: none; align-items: center; gap: 4px; flex-shrink: 0; color: var(--accent-bright); font-size: var(--fs-13); font-weight: 600; text-decoration: none; }

.ane-format-bar.is-inline { margin-bottom: 12px; }
/* No box round each group: a row of framed groups over the note read as a form. Groups
   are told apart by the space between them. */
.ane-fmt-group { display: flex; gap: 1px; padding: 2px; border: none; border-radius: var(--radius-sm); background: none; }
.ane-fmt-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 26px;
  padding: 0 6px;
  border: none;
  border-radius: 4px;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: var(--fs-12);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.ane-format-bar .ane-fmt-btn:not(.is-active) { color: var(--text-3); }
.ane-fmt-btn:hover, .ane-format-bar .ane-fmt-btn:not(.is-active):hover { background: var(--surface-3); color: var(--text-1); }
.ane-fmt-btn.is-active { background: var(--accent-soft); color: var(--accent-bright); }
.ane-fmt-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.ane-fmt-i { font-style: italic; }
.ane-save-status { white-space: nowrap; }
.ane-save-status.is-saved { color: var(--accent-bright); }
.ane-save-status.is-error { color: var(--danger-bright); }
/* The folder picker: a pill wearing the folder's colour over a plain select. */
.ane-folder-pick {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 24px 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-1);
  color: var(--text-2);
  font-size: var(--fs-12);
  cursor: pointer;
}
.ane-folder-pick:hover { border-color: var(--border-strong); color: var(--text-1); }
.ane-folder-pick:focus-within { border-color: var(--text-3); }
.ane-folder-pick > .fa-folder { color: var(--folder, var(--text-3)); font-size: var(--fs-11); }
.ane-folder-pick select {
  max-width: 140px;
  padding: 0;
  border: none;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background: none;
  color: inherit;
  font: inherit;
  text-overflow: ellipsis;
  cursor: pointer;
}
.ane-folder-pick option { background: var(--surface-pop); color: var(--text-1); }
.ane-folder-pick-chevron { position: absolute; right: 9px; color: var(--text-3); font-size: var(--fs-8); pointer-events: none; }
/* Filed in a folder: the picker wears the folder's colour the way its row in the list does
   (.an-note-folder) — the name in it, a faint wash behind. Read off the picked option, so
   it follows a change at once; "No folder" stays plain. */
.ane-folder-pick:not(:has(option[value=""]:checked)) {
  border-color: color-mix(in srgb, var(--folder) 35%, transparent);
  background: color-mix(in srgb, var(--folder) 10%, transparent);
}
.ane-folder-pick:not(:has(option[value=""]:checked)) select { color: color-mix(in srgb, var(--folder) 80%, #fff); }
.ane-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-2);
  font-size: var(--fs-13);
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}
.ane-icon-btn:hover { background: var(--surface-2); color: var(--text-1); }
.ane-icon-btn.is-pinned { color: var(--gold-bright); }
.ane-icon-btn.is-delete:hover { background: var(--danger-soft); color: var(--danger-bright); }

.ane-deleted-banner {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--danger-line);
  background: var(--danger-soft);
}
.ane-deleted-banner-text { display: inline-flex; align-items: center; gap: 6px; color: var(--danger-bright); font-size: var(--fs-12); }
.ane-deleted-actions { display: flex; gap: 8px; }
.ane-restore-btn, .ane-perm-delete-btn {
  padding: 4px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-1);
  font: inherit;
  font-size: var(--fs-12);
  cursor: pointer;
}
.ane-restore-btn:hover { background: var(--surface-2); }
.ane-perm-delete-btn { border-color: var(--danger-line); color: var(--danger-bright); }
.ane-perm-delete-btn:hover { background: var(--danger-soft); }

/* The document: a comfortable reading column, centred in the panel. The column is the
   editable element's own padding, so its scrollbar stays at the panel's edge. */
.ane-main-form { display: flex; flex: 1; flex-direction: column; min-height: 0; overflow: hidden; }
.ane-doc { display: flex; flex: 1; flex-direction: column; min-height: 0; overflow: hidden; padding: 26px 36px 0; }
.ane-meta-row {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  /* The same 580px column as the text under it (.ane-content-ta), so they share an edge. */
  padding: 0 max(0px, calc((100% - 580px) / 2));
  color: var(--text-3);
  font-size: var(--fs-11);
}
.ane-word-count:not(:empty)::before,
.ane-save-status:not(:empty)::before { content: '·'; margin-right: 10px; color: var(--text-3); }
.ane-folder-sel {
  padding: 0;
  border: none;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background: none;
  color: var(--text-3);
  font: inherit;
  cursor: pointer;
}
.ane-folder-sel:hover { color: var(--text-1); }
.ane-form-errors { flex-shrink: 0; padding: 8px 36px; color: var(--danger-bright); font-size: var(--fs-12); }
.ane-new-footer {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  border-top: 1px solid var(--border-panel);
  background: var(--surface-card);
}
.ane-new-status { color: var(--text-3); font-size: var(--fs-11); }

.ane-content-ta {
  position: relative;
  display: block;
  flex: 1;
  min-height: 0;
  box-sizing: border-box;
  /* A 580px column, about 70 characters of 15px Inter a line: at 680px it was about 95,
     long enough to lose your place going back to the start of the next. */
  padding: 0 max(0px, calc((100% - 580px) / 2)) 96px;
  overflow-x: hidden;
  overflow-y: auto;
  border: none;
  outline: none;
  background: none;
  font-family: inherit;
  overflow-wrap: break-word;
}
.ane-content-ta.is-empty::before { content: 'Start writing…'; position: absolute; color: var(--text-3); opacity: 0.6; pointer-events: none; }
/* Pasted content arrives with its own look baked in (13px spans, <font size="2">, 20px
   paragraphs, its source's text colour), which made freshly built lines look out of place
   next to it — a new line after Enter carried the editor's colour while the line above kept
   the pasted one. One size and one colour for the whole document; headings keep theirs,
   and so does anything inside them. */
.ane-content-ta, .ane-content-ta *:not(h1, h2, h1 *, h2 *) {
  font-size: 15px !important;
  line-height: 1.65 !important;
  color: #d4d4d8 !important;
}
.ane-content-ta h1 { margin: 0 0 8px; font-size: 26px !important; font-weight: 700; line-height: 1.25; color: var(--text-1) !important; letter-spacing: -0.01em; }
.ane-content-ta h2 { margin: 20px 0 6px; font-size: 19px !important; font-weight: 600; line-height: 1.3; color: var(--text-1) !important; }
/* And inside a heading, the heading wins. Pasted headings carry their old look inline —
   `<span style="font-size: 22px">`, `<font face>` — which drew some H1s smaller than
   others in the same note. Their contents now take the heading's own size, face, weight
   and colour, whatever they arrived with. (Links, below, still read as links.) */
.ane-content-ta h1 *, .ane-content-ta h2 * {
  font-family: inherit !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  line-height: inherit !important;
  color: inherit !important;
}
.ane-content-ta strong, .ane-content-ta b { color: var(--text-1) !important; font-weight: 700; }
.ane-content-ta em { font-style: italic; }
/* Placed after the blanket colour rule above, which would otherwise paint links the same
   grey as body text. */
.ane-content-ta a, .ane-content-ta a * { color: #60a5fa !important; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.ane-content-ta a:hover, .ane-content-ta a:hover * { color: #93c5fd !important; }
/* Bullets get the same marker column the checklist draws for itself: a 1.3em box at the
   line's left edge. The UA's own disc placement can't be pinned down that precisely, so a
   dot and a circle would never share a centre — and their text would never share a left
   edge. */
.ane-content-ta ul:not(.ane-checklist) { padding-left: 0; list-style: none; }
.ane-content-ta ul:not(.ane-checklist) > li { position: relative; padding-left: 2em; }
.ane-content-ta ul:not(.ane-checklist) > li::before { content: '\2022'; position: absolute; left: 0; top: 0; width: 1.3em; text-align: center; }
/* Numbers get the same treatment: drawn by us, in the same 1.3em column, in the editor's
   own font at the body size — the UA marker takes its font from wherever the list came
   from. Tabular figures so a right-aligned '1.' and '2.' start in the same place. The
   marker is pinned by its right edge and never wraps: a fixed-width box split '10.' into
   '1' over '0.', where pinning the right edge lets two digits hang slightly left and keeps
   every period in one column. */
.ane-content-ta ol { padding-left: 0; list-style: none; counter-reset: ane-num; }
.ane-content-ta ol > li { position: relative; padding-left: 2em; counter-increment: ane-num; }
.ane-content-ta ol > li::before {
  content: counter(ane-num) '.';
  position: absolute;
  right: calc(100% - 1.3em + 1px);
  top: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.ane-content-ta .ane-checklist { padding-left: 0 !important; }
.ane-content-ta .ane-checklist > li { padding-left: 2em !important; }
.ane-content-ta p { min-height: 1.65em; }
/* Every line carries the same leading, whatever tag it happens to be: pasted notes mix
   <p>, <div> and <li> for lines that look identical. Only the vertical margins are
   forced — Tab indents a non-list line by setting margin-left on it. */
.ane-content-ta p, .ane-content-ta div, .ane-content-ta ul, .ane-content-ta ol, .ane-content-ta li,
.ane-content-ta .ane-checklist > li { margin-top: 0 !important; margin-bottom: 0 !important; }

/* ---- Folder menus and the Edit Folder dialog ---- */
.an-ctx-menu {
  position: fixed;
  z-index: 9999;
  display: none;
  min-width: 150px;
  padding: 4px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-pop);
  box-shadow: var(--shadow-card);
}
.an-ctx-menu.open { display: block; }
.an-ctx-item { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 5px; color: var(--text-1); font-size: var(--fs-13); cursor: pointer; user-select: none; }
.an-ctx-item:hover { background: var(--surface-3); }
.an-ctx-item.danger { color: var(--danger-bright); }
.an-ctx-item.danger:hover { background: var(--danger-soft); }
.an-ctx-item i { width: 14px; font-size: var(--fs-12); text-align: center; }

.an-modal { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px; overflow-y: auto; background: rgba(0, 0, 0, 0.6); }
.an-modal[hidden] { display: none; }
.an-modal-card { width: 320px; max-width: 100%; padding: 20px; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-pop); box-shadow: var(--shadow-card); }
.an-modal-title { margin: 0 0 16px; color: var(--text-1); font-size: 15px; font-weight: 600; }
.an-modal-label { display: block; margin: 12px 0 5px; color: var(--text-3); font-size: var(--fs-10); font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; }
.an-modal-input {
  box-sizing: border-box;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--surface-2);
  color: var(--text-1);
  font: inherit;
  font-size: var(--fs-13);
}
.an-modal-input:focus { border-color: var(--border-strong); }
.an-modal-textarea { min-height: 72px; line-height: 1.5; resize: vertical; }
.an-icon-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.an-icon-preset {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
}
.an-icon-preset:hover { border-color: var(--border-strong); color: var(--text-1); }
.an-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.an-btn {
  height: 32px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-1);
  font: inherit;
  font-size: var(--fs-13);
  font-weight: 500;
  cursor: pointer;
}
.an-btn:hover { border-color: var(--border-strong); background: var(--surface-3); }
.an-btn.is-primary { border-color: transparent; background: var(--accent); color: #04140a; font-weight: 600; }
.an-btn.is-primary:hover { background: var(--accent-bright); }

/* ---- Sharing a note (NoteMembership) ---- */
.an-inline-form { display: inline; margin: 0; }
.an-btn.is-small { height: 26px; padding: 0 11px; font-size: var(--fs-12); }

/* Invites waiting on an answer, above the list. */
.an-invites { flex-shrink: 0; padding: 10px 12px; border-bottom: 1px solid var(--border-panel); background: rgba(147, 197, 253, 0.05); }
.an-invites-title { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; color: #93c5fd; font-size: var(--fs-10); font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; }
.an-invite { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.an-invite + .an-invite { border-top: 1px solid var(--hairline); }
.an-invite-body { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.an-invite-title { overflow: hidden; color: var(--text-1); font-size: var(--fs-13); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.an-invite-from { color: var(--text-3); font-size: var(--fs-11); }
.an-invite-actions { display: flex; flex-shrink: 0; gap: 6px; }

/* On a list row: whose it is (shared with you), or who has it (yours, shared). */
.an-note-shared { display: inline-flex; align-items: center; gap: 5px; color: #93c5fd; white-space: nowrap; }
.an-note-shared .soc-avatar { font-size: 8px !important; }
.an-note-shared .soc-stack .soc-avatar { box-shadow: 0 0 0 1.5px var(--surface-card); }

/* In the editor's toolbar: whose it is, for the person it's shared with. */
.ane-shared-by { display: inline-flex; flex-shrink: 0; align-items: center; gap: 7px; color: var(--text-2); font-size: var(--fs-12); white-space: nowrap; }
.ane-shared-by .soc-avatar { font-size: 9px !important; }

/* The owner's Share button and its panel. */
.ane-share { position: relative; flex-shrink: 0; }
.ane-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-1);
  color: var(--text-1);
  font-size: var(--fs-12);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
.ane-share-btn::-webkit-details-marker { display: none; }
.ane-share-btn:hover, .ane-share[open] .ane-share-btn { border-color: var(--accent); color: var(--accent-bright); }
.ane-share-count { min-width: 16px; padding: 0 4px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-bright); font-size: var(--fs-10); text-align: center; }
.ane-share-panel {
  position: fixed;
  z-index: 70;
  width: 300px;
  margin-top: 6px;
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-pop);
  box-shadow: var(--shadow-card);
  transform: translateX(-60%);
}
.ane-share-title { margin: 0 0 8px; color: var(--text-3); font-size: var(--fs-10); font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; }
.ane-share-people { display: flex; flex-direction: column; gap: 2px; margin: 0 0 10px; padding: 0; list-style: none; }
.ane-share-person { display: flex; align-items: center; gap: 9px; padding: 4px 2px; }
.ane-share-name { flex: 1; min-width: 0; overflow: hidden; color: var(--text-1); font-size: var(--fs-13); text-overflow: ellipsis; white-space: nowrap; }
.ane-share-state { color: var(--accent-bright); font-size: var(--fs-11); }
.ane-share-state.is-pending { color: var(--text-3); }
.ane-share-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: var(--radius-xs);
  background: none;
  color: var(--text-3);
  cursor: pointer;
}
.ane-share-remove:hover { background: var(--danger-soft); color: var(--danger-bright); }
.ane-share-empty { margin: 0 0 10px; color: var(--text-3); font-size: var(--fs-12); }
.ane-share-form { display: flex; gap: 6px; }
.ane-share-form select { flex: 1; min-width: 0; padding: 5px 8px; }
.ane-share-hint { margin: 8px 0 0; color: var(--text-3); font-size: var(--fs-11); line-height: 1.5; }

/* ---- Richer notes: blocks, marks, attachments (notes/_blocks, notes/_attachments) ---- */
/* Written with :is(… .ane-file …) so they outrank the blanket "one size, one colour" rule
   above, which would otherwise size code and captions like body text. */
.ane-content-ta mark { padding: 0 2px; border-radius: 3px; background: rgba(251, 191, 36, 0.28); }
.ane-content-ta :is(s, strike, del, .ane-file *) { text-decoration-thickness: 1px; }
.ane-content-ta blockquote { margin: 6px 0 !important; padding: 2px 0 2px 16px; border-left: 3px solid var(--border-strong); }
.ane-content-ta :is(blockquote, blockquote *, .ane-transcript, .ane-transcript *):not(a) { color: var(--text-2) !important; }
.ane-content-ta pre {
  margin: 8px 0 !important;
  padding: 12px 14px;
  overflow-x: auto;
  border: 1px solid var(--border-panel);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  white-space: pre-wrap;
}
.ane-content-ta :is(pre, pre *, code, .ane-file:not(*)) {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace !important;
  font-size: 13px !important;
  line-height: 1.6 !important;
}
.ane-content-ta code { padding: 1px 5px; border-radius: 4px; background: var(--surface-2); }
.ane-content-ta pre code { padding: 0; background: none; }
.ane-content-ta hr { margin: 16px 0; border: none; border-top: 1px solid var(--border); }
.ane-content-ta table { width: 100%; margin: 10px 0; border-collapse: collapse; table-layout: fixed; }
.ane-content-ta :is(th, td) { padding: 6px 10px; border: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
.ane-content-ta th { background: var(--surface-1); font-weight: 600; }
.ane-content-ta :is(th, th *, .ane-file:not(*)) { color: var(--text-1) !important; }
/* A file: a chip that opens it. */
.ane-content-ta .ane-file {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  margin: 2px 0;
  padding: 3px 10px 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-1);
  text-decoration: none !important;
  vertical-align: middle;
  cursor: pointer;
}
.ane-content-ta .ane-file:hover { border-color: var(--border-strong); background: var(--surface-2); }
.ane-content-ta :is(.ane-file, .ane-file *) { color: var(--text-1) !important; font-size: 13px !important; text-decoration: none !important; }
.ane-content-ta .ane-file i { color: #93c5fd !important; }
.ane-content-ta .ane-file::after { content: attr(data-size); color: var(--text-3); font-size: 11px; }
/* A voice memo: its player and length, then what was said. */
.ane-content-ta .ane-audio { margin: 8px 0; padding: 10px 12px; border: 1px solid var(--border-panel); border-radius: var(--radius-md); background: var(--surface-1); }
.ane-content-ta .ane-audio audio { display: block; width: 100%; height: 36px; color-scheme: dark; }
.ane-content-ta :is(figcaption, .ane-audio figcaption) { margin-top: 4px; color: var(--text-3) !important; font-size: 11px !important; }
.ane-content-ta .ane-transcript { font-style: italic; }

/* The editor's Insert and More menus. */
.ane-menu { position: relative; flex-shrink: 0; }
.ane-menu > summary { list-style: none; }
.ane-menu > summary::-webkit-details-marker { display: none; }
.ane-menu-btn { gap: 5px; padding: 0 8px; }
/* A column, so the panel (position: fixed with no offsets, to escape the toolbar's
   overflow) takes its place under the button, left-aligned with it; in a row it fell in
   beside the button and over Share. */
.ane-insert { display: flex; flex-direction: column; align-items: stretch; padding: 2px; border: 1px solid var(--border-panel); border-radius: var(--radius-sm); background: var(--surface-1); }
.ane-menu-panel {
  position: fixed;
  z-index: 70;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  margin-top: 6px;
  padding: 4px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-pop);
  box-shadow: var(--shadow-card);
}
.ane-menu-panel.is-right { transform: translateX(calc(-100% + 30px)); }
.ane-menu-item {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border: none;
  border-radius: 5px;
  background: none;
  color: var(--text-1);
  font: inherit;
  font-size: var(--fs-13);
  font-weight: 400;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.ane-menu-item:hover { background: var(--surface-3); }
/* Insert's items are also .ane-fmt-btn (for the formatting script), whose grey made them
   read as disabled beside the More menu's white. */
.ane-format-bar .ane-menu-item.ane-fmt-btn:not(.is-active) { color: var(--text-1); }
.ane-menu-item i { width: 16px; color: var(--text-2); text-align: center; }
.ane-menu-item.is-active { background: var(--accent-soft); color: var(--accent-bright); }

/* The "/" menu, at the caret. */
.ane-slash-menu {
  position: fixed;
  z-index: 80;
  display: flex;
  flex-direction: column;
  width: 220px;
  max-height: 300px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-pop);
  box-shadow: var(--shadow-card);
}
.ane-slash-menu[hidden] { display: none; }
.ane-slash-item { display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 0 10px; border: none; border-radius: 5px; background: none; color: var(--text-1); font: inherit; font-size: var(--fs-13); text-align: left; cursor: pointer; }
.ane-slash-item i { width: 16px; color: var(--text-3); text-align: center; }
.ane-slash-item:hover, .ane-slash-item.is-active { background: var(--surface-3); }
.ane-slash-item.is-active i { color: var(--accent-bright); }

/* Over a table the caret is in: rows and columns in and out. */
.ane-table-bar { position: fixed; z-index: 75; display: flex; gap: 2px; padding: 3px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-pop); box-shadow: var(--shadow-card); }
.ane-table-bar[hidden] { display: none; }
.ane-table-bar button { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border: none; border-radius: 4px; background: none; color: var(--text-2); font: inherit; font-size: var(--fs-11); cursor: pointer; }
.ane-table-bar button:hover { background: var(--surface-3); color: var(--text-1); }
.ane-table-bar button.is-danger:hover { background: var(--danger-soft); color: var(--danger-bright); }

/* Recording a voice memo. */
.ane-recorder {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(560px, calc(100vw - 24px));
  padding: 10px 12px 10px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-pop);
  box-shadow: var(--shadow-card);
  transform: translateX(-50%);
}
.ane-recorder-dot { width: 10px; height: 10px; flex-shrink: 0; border-radius: 50%; background: var(--danger); animation: ane-pulse 1.2s ease-in-out infinite; }
@keyframes ane-pulse { 50% { opacity: 0.35; } }
.ane-recorder-time { flex-shrink: 0; color: var(--text-1); font-size: var(--fs-13); font-variant-numeric: tabular-nums; font-weight: 600; }
.ane-recorder-words { flex: 1; min-width: 0; overflow: hidden; color: var(--text-3); font-size: var(--fs-12); text-overflow: ellipsis; white-space: nowrap; }
.ane-recorder-cancel, .ane-recorder-stop { flex-shrink: 0; height: 30px; padding: 0 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text-1); font: inherit; font-size: var(--fs-12); cursor: pointer; }
.ane-recorder-stop { border-color: transparent; background: var(--danger); color: #fff; font-weight: 600; }

/* Someone else changed the note while it was open with changes here. */
.ane-conflict { display: flex; flex-shrink: 0; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 18px; border-bottom: 1px solid rgba(251, 191, 36, 0.35); background: rgba(251, 191, 36, 0.08); }
.ane-conflict[hidden] { display: none; }
.ane-conflict-text { display: inline-flex; flex: 1; align-items: center; gap: 8px; color: var(--gold-bright); font-size: var(--fs-12); }
.ane-save-status.is-updated { color: #93c5fd; }

/* Search: the save-as-smart-folder button, matches marked in list previews and in the
   open note (CSS Custom Highlight API). */
.an-save-search { flex-shrink: 0; padding: 4px; border: none; background: none; color: var(--text-3); cursor: pointer; }
.an-save-search:hover { color: #a78bfa; }
.an-save-search[hidden] { display: none; }
.an-note-preview mark { padding: 0 1px; border-radius: 2px; background: rgba(251, 191, 36, 0.28); color: var(--text-1); }
::highlight(an-search) { background-color: rgba(251, 191, 36, 0.35); color: inherit; }
.an-smart-actions { display: none; flex-shrink: 0; gap: 2px; }
.an-smart-item:hover .an-smart-actions { display: flex; }
.an-smart-item .an-folder-more-btn { display: flex; font-size: var(--fs-11); }
@media (hover: none) { .an-smart-actions { display: flex; } }

/* Version history, in #modal. */
.an-history-card { width: 100%; }
.an-history-body { padding: 14px 16px 16px; }
.an-history-now { margin: 0 0 10px; color: var(--text-3); font-size: var(--fs-12); }
.an-history-list { display: flex; flex-direction: column; gap: 4px; max-height: 60vh; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.an-history-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 10px; border: 1px solid var(--border-panel); border-radius: var(--radius-sm); color: inherit; text-decoration: none; }
@media (hover: hover) { .an-history-item:hover { border-color: var(--border-strong); background: var(--surface-2); } }
.an-history-when { color: var(--text-1); font-size: var(--fs-13); font-weight: 600; }
.an-history-who { color: var(--text-3); font-size: var(--fs-12); }
.an-history-preview { grid-column: 1 / -1; overflow: hidden; color: var(--text-2); font-size: var(--fs-12); text-overflow: ellipsis; white-space: nowrap; }
.an-history-empty, .an-history-hint { margin: 8px 0 0; color: var(--text-3); font-size: var(--fs-12); line-height: 1.5; }
.an-history-content { max-height: 55vh; padding: 12px 14px 24px !important; overflow-y: auto; border: 1px solid var(--border-panel); border-radius: var(--radius-md); background: var(--bg); }
.an-history-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
/* The note editor's content styles zero its padding; the preview box keeps its own. */
.an-history-body .an-history-content.ane-content-ta { width: auto; margin: 0; padding: 14px 16px 24px !important; }
.an-history-back { margin-right: 4px; }

/* The Share panel's public link. */
.ane-share-public { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border-panel); }
.ane-share-link { display: flex; gap: 6px; }
.ane-share-link input { flex: 1; min-width: 0; padding: 5px 8px; font-size: var(--fs-12); }
.ane-share-off { margin-top: 8px; padding: 0; border: none; background: none; color: var(--danger-bright); font: inherit; font-size: var(--fs-12); cursor: pointer; }

/* ---- A phone: the list, or the note — one at a time ---- */
@media (max-width: 760px) {
  .an-notes-list { width: 100%; min-width: 0; border-right: none; }
  .an-panel-col { display: none; }
  .an-layout.is-note-open .an-notes-list { display: none; }
  .an-layout.is-note-open .an-panel-col { display: flex; }
  /* The toolbar scrolls sideways; its right edge fades while there's more of it (the
     editor's script drops .has-more once it's scrolled to the end). */
  .ane-toolbar.has-more { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
  .ane-back { display: inline-flex; }
  .ane-toolbar { gap: 6px; padding: 8px 10px; }
  .ane-doc { padding: 18px 16px 0; }
  .ane-form-errors { padding: 8px 16px; }
  .an-note-item { margin: 0 4px 2px; }
}

/* A tooltip that shows at once on hover or keyboard focus (data-tip="…"), for icon-only
   buttons — first used by the rule and value forms' footer: Delete, Someday, Archive. The
   browser's own title waited a second and a half, and never showed on touch. */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 30;
  padding: 5px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface-pop, #26262c);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  color: var(--text-1);
  font-size: var(--fs-11);
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 3px);
  pointer-events: none;
  transition: opacity var(--dur-fast) ease, transform var(--dur-fast) ease;
}
[data-tip]:hover::after,
[data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }

/* ---- Notes on a phone: the heading arrow in view, formatting on the keyboard ---- */
@media (max-width: 760px) {
  /* The text column pulls 26px left to make room for a heading's fold arrow; the phone's
     16px margin wasn't room enough, and the arrow sat off the screen's edge. */
  .ane-doc { padding-left: 28px; }

  /* Formatting only while typing (edit.html.erb's script sets .is-typing), docked on the
     keyboard — or on the tab bar where none is up. The top bar keeps Notes, Share and the
     folder, which used to scroll out of reach past the formatting. */
  #note-panel:not(.is-typing) #ane-fmt-bar { display: none; }
  #note-panel.is-typing #ane-fmt-bar {
    position: fixed; left: 0; right: 0; z-index: 1003;
    bottom: max(var(--ane-kb, 0px), calc(56px + env(safe-area-inset-bottom)));
    display: flex; gap: 6px; padding: 6px 8px; overflow-x: auto;
    background: var(--surface-pop); border-top: 1px solid var(--border-strong);
    box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.4);
  }
  /* Insert's menu opens upward, off the docked bar. */
  #note-panel.is-typing #ane-fmt-bar .ane-menu-panel { top: auto; bottom: calc(100% + 6px); }
  /* Room under the text so the docked bar never covers the line being written. */
  #note-panel.is-typing .ane-content-ta { padding-bottom: 160px; }
}


/* ---- Version history: what to expect, and "Compare with now" ---- */
.an-history-hint .fa-circle-info { margin-right: 4px; color: var(--text-3); }
.an-history-tabs { display: inline-flex; gap: 2px; margin: 0 0 12px; padding: 3px; border: 1px solid var(--border); border-radius: 999px; }
.an-history-tab { padding: 4px 12px; border-radius: 999px; color: var(--text-3); font-size: var(--fs-12); font-weight: 600; text-decoration: none; }
.an-history-tab:hover { color: var(--text-1); text-decoration: none; }
.an-history-tab.is-current { background: var(--surface-3); color: var(--text-1); }
.an-history-diff { max-height: 55vh; overflow-y: auto; padding: 6px 0; border: 1px solid var(--border-panel); border-radius: var(--radius-sm); }
.an-diff-line { display: grid; grid-template-columns: 22px 1fr; margin: 0; padding: 3px 12px 3px 4px; color: var(--text-2); font-size: var(--fs-13); line-height: 1.5; }
.an-diff-mark { color: var(--text-3); font-weight: 700; text-align: center; }
.an-diff-line.is-removed { background: rgba(239, 68, 68, 0.09); color: #fca5a5; text-decoration: line-through; text-decoration-color: rgba(252, 165, 165, 0.5); }
.an-diff-line.is-removed .an-diff-mark { color: #f87171; text-decoration: none; }
.an-diff-line.is-added { background: rgba(34, 197, 94, 0.09); color: #86efac; }
.an-diff-line.is-added .an-diff-mark { color: #4ade80; }
.an-diff-key { font-weight: 700; }
.an-diff-key.is-removed { color: #f87171; }
.an-diff-key.is-added { color: #4ade80; }

/* ---- The formatting bar: bigger targets, its groups told apart by a hairline ----
   On a wide screen it rests faded while you're reading and comes up while you're writing
   in the note (or pointing at the bar). A phone docks it on the keyboard as before. */
/* Taller targets and a size up in the glyphs, kept to the bar's width: wider buttons pushed
   the pin and delete off its end, under the page's filter button. */
.ane-format-bar .ane-fmt-btn { min-width: 26px; height: 30px; padding: 0 5px; font-size: var(--fs-13); }
.ane-format-bar .ane-fmt-btn i { font-size: var(--fs-13); }
.ane-fmt-group + .ane-fmt-group, .ane-fmt-group + .ane-insert { margin-left: 1px; padding-left: 4px; border-left: 1px solid var(--border); border-radius: 0; }
/* A new note's bar sits over its text (notes/new), on the same 580px column as the date
   line and the words, rather than at the panel's edge. */
.ane-doc > .ane-format-bar.is-inline { padding: 0 max(0px, calc((100% - 580px) / 2)); }
@media (min-width: 761px) {
  #ane-fmt-bar { transition: opacity var(--dur-base) ease; }
  #note-panel:not(:focus-within) #ane-fmt-bar:not(:hover):not(:focus-within) { opacity: 0.4; }
}

/* ---- The note's pin when on: white, not gold (gold is a favourite's on Inspirations) ---- */
.ane-icon-btn.is-pinned { color: #fff; background: rgba(255, 255, 255, 0.08); }

/* ---- The folder picker: a quiet text button, its colour only in the folder icon ----
   It wore a pill tinted in the folder's colour, the brightest thing over the note. */
.ane-folder-pick, .ane-folder-pick:not(:has(option[value=""]:checked)) { border-color: transparent; background: none; }
.ane-folder-pick:hover { border-color: var(--border); background: rgba(255, 255, 255, 0.04); }
.ane-folder-pick:not(:has(option[value=""]:checked)) select { color: var(--text-2); }
.ane-folder-pick:hover select { color: var(--text-1) !important; }

/* ---- The list's tags in grey, so each note's title and preview lead ---- */
.an-note-tag { color: var(--text-3); }

/* The page's filter button sits over the toolbar's right end on a wide screen, where it
   covered the note's delete button: the bar keeps clear of it. 54px is all a 1440px
   window has to spare — any more and the toolbar overflows and scrolls. */
@media (min-width: 761px) {
  #note-panel .ane-toolbar { gap: 6px; padding-right: 54px; }
}

/* A brand-new account on a phone: the list is all there is, so it carries the welcome the
   wide screen's editor pane shows (_placeholder). */
.an-empty-state.is-first-run { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 24px; }
.an-empty-icon { color: var(--text-3); font-size: 40px; opacity: 0.5; }
.an-empty-title { margin: 0; color: var(--text-1); font-size: var(--fs-18); font-weight: 600; }
.an-empty-text { max-width: 300px; margin: -4px 0 4px; color: var(--text-3); font-size: var(--fs-13); line-height: 1.5; }
@media (min-width: 761px) { .an-empty-state.is-first-run { display: none; } }

/* ---- Tablet widths: the formatting folds behind "Aa" (notes/edit) ----
   Wide and on a phone the fold's wrappers vanish (display: contents) and "Aa" is hidden,
   so the groups sit in the bar as before. Between, "Aa" opens them in a panel under it —
   position: fixed with no offsets, like Insert's, to escape the toolbar's overflow — and
   Insert shows its icon only, so Share, the folder, "…", pin, and delete all fit clear of
   the filter button. */
.ane-fmt-fold, .ane-fmt-fold-panel { display: contents; }
.ane-fmt-fold-btn { display: none; }
/* The rule before Insert (.ane-fmt-group + .ane-insert) now follows the fold's wrapper. */
.ane-fmt-fold + .ane-insert { margin-left: 1px; padding-left: 4px; border-left: 1px solid var(--border); border-radius: 0; }
@media (min-width: 761px) and (max-width: 1439px) {
  #note-panel .ane-fmt-fold { position: relative; display: flex; flex-direction: column; align-items: stretch; flex-shrink: 0; }
  #note-panel .ane-fmt-fold-btn { display: inline-flex; font-weight: 600; letter-spacing: -0.01em; }
  #note-panel .ane-fmt-fold.is-open .ane-fmt-fold-btn { background: var(--surface-3); color: var(--text-1); }
  #note-panel .ane-fmt-fold-panel {
    position: fixed; z-index: 70;
    display: none; align-items: center; gap: 2px;
    margin-top: 6px; padding: 4px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-md);
    background: var(--surface-pop); box-shadow: var(--shadow-card);
  }
  #note-panel .ane-fmt-fold.is-open .ane-fmt-fold-panel { display: flex; }
  #note-panel .ane-fmt-fold + .ane-insert { margin-left: 2px; padding-left: 2px; border-left: 0; }
  #note-panel .ane-insert .ane-menu-btn > span { display: none; }
}
