/* ApyNotes — jetons de design et coque applicative (issus des maquettes). */
:root {
  --bg: #F5F6F8; --surface: #FFFFFF; --surface-2: #F0F2F5; --border: #E2E5EA;
  --text: #15171C; --muted: #586070;
  --accent: #2F5BEA; --accent-ink: #FFFFFF; --accent-weak: #E8EEFD;
  --ai: #6A3FD6; --ai-weak: #F1ECFC;
  --ok: #1F7A4D; --ok-weak: #E3F4EA; --warn: #9A5800; --warn-weak: #FDF1DC; --bad: #B42318; --bad-weak: #FDECEA;
  --code: #F3F4F7;
  --radius: 12px;
  --font: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Space Grotesk", Inter, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", Consolas, ui-monospace, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0E1014; --surface: #161920; --surface-2: #1D2129; --border: #2B303A;
  --text: #E7E9ED; --muted: #A3AAB7;
  --accent: #7393F7; --accent-ink: #0E1014; --accent-weak: #1C2541;
  --ai: #A98BF5; --ai-weak: #241B3B;
  --ok: #5FCB94; --ok-weak: #14291E; --warn: #F0B35A; --warn-weak: #2E2310; --bad: #F2877C; --bad-weak: #341714;
  --code: #11141A;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Coque */
.an-shell { min-height: 100vh; display: flex; flex-direction: column; }
.an-topbar { display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.an-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.an-logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font: 700 16px var(--font-display); }
.an-brand-name { font: 700 17px var(--font-display); }
.an-search { flex: 1 1 260px; max-width: 520px; display: flex; align-items: center; gap: 8px; padding: 0 12px; min-height: 38px; border-radius: 9px; background: var(--surface-2); color: var(--muted); }
.an-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; outline: none; }
.an-topbar-end { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.an-body { flex: 1; display: flex; min-height: 0; }
.an-sidebar { flex: 0 0 232px; padding: 16px 12px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.an-main { flex: 1; min-width: 0; padding: 28px 32px; }
@media (max-width: 760px) {
  .an-body { flex-direction: column; }
  .an-sidebar { flex: none; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 8px; }
  .an-main { padding: 20px 16px; }
}

/* Composants */
.an-nav { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 500; white-space: nowrap; }
.an-nav:hover { background: var(--surface-2); }
.an-nav.active { background: var(--accent-weak); color: var(--accent); }
.an-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 500 13px var(--font); cursor: pointer; text-decoration: none; }
.an-btn:hover { background: var(--surface-2); }
.an-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.an-icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.an-icon-btn:hover { background: var(--surface-2); color: var(--text); }
.an-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--surface-2); }
.an-seg button { border: 0; background: transparent; color: var(--muted); font: 500 13px var(--font); padding: 0 10px; min-height: 30px; border-radius: 7px; cursor: pointer; }
.an-seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.14); }
.an-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; }
.an-chip.ok { background: var(--ok-weak); color: var(--ok); }
.an-chip.warn { background: var(--warn-weak); color: var(--warn); }
.an-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.an-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.an-muted { color: var(--muted); }
.an-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.an-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.an-list li { display: flex; justify-content: space-between; gap: 12px; }
svg.an-i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Rail de navigation principal */
.an-sidebar { flex: 0 0 84px; padding: 12px 6px; align-items: stretch; gap: 4px; }
.an-rail { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 500; text-align: center; }
.an-rail:hover { background: var(--surface-2); color: var(--text); }
.an-rail.active { background: var(--accent-weak); color: var(--accent); }
.an-main:has(.an-notes) { padding: 0; }
@media (max-width: 760px) {
  .an-sidebar { flex: none; flex-direction: row; justify-content: space-around; }
  .an-rail { flex: 1; }
}

/* Utilitaires */
.an-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.an-full { width: 100%; }
.an-pad { padding: 12px 16px; }
.an-muted.sm, .sm.an-muted { font-size: 12.5px; }
.an-count { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 500; }
.an-error { color: var(--bad); font-size: 13px; margin: 6px 0; }
.an-btn.sm { min-height: 30px; padding: 0 10px; font-size: 12.5px; }
.an-btn.danger { border-color: var(--bad); color: var(--bad); background: var(--surface); }
.an-btn:disabled, .an-icon-btn:disabled { opacity: .5; cursor: not-allowed; }
.an-icon-btn.sm { width: 28px; height: 28px; }
.an-icon-btn.sm svg.an-i { width: 15px; height: 15px; }
.an-icon-btn.on { color: var(--warn); }
.an-nav.sm { min-height: 34px; font-size: 13.5px; }
.an-input, .an-select { min-height: 36px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 400 13.5px var(--font); }
.an-input.sm { min-height: 30px; padding: 4px 8px; flex: 1; min-width: 0; }
.an-chip.xs { font-size: 11px; padding: 1px 7px; }
.an-chip.active { background: var(--accent-weak); color: var(--accent); }
a.an-chip { text-decoration: none; }
.an-chip-remove { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0 0 0 2px; font-size: 14px; line-height: 1; }
.an-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 20px; background: var(--surface-2); font-size: 13px; }
.an-banner.warn { background: var(--warn-weak); color: var(--warn); }
.an-banner.bad { background: var(--bad-weak); color: var(--bad); }
.an-confirm { margin: 4px 0 8px; padding: 10px; border-radius: 8px; background: var(--bad-weak); color: var(--bad); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.an-confirm p { margin: 0 0 4px; flex-basis: 100%; }
.an-search.sm { min-height: 34px; flex: 1 1 auto; max-width: none; }

/* Écran Notes : navigation | liste | éditeur */
.an-notes { display: flex; min-height: calc(100vh - 59px); }
.an-notes-nav { flex: 0 0 240px; padding: 16px 12px; border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 18px; overflow-y: auto; }
.an-views { display: flex; flex-direction: column; gap: 2px; }
.an-notes-list { flex: 0 0 310px; border-right: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; }
.an-list-head { padding: 16px 14px 10px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--border); }
.an-list-head h1 { font-size: 18px; }
.an-note-list { list-style: none; margin: 0; padding: 8px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.an-note-item { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; border: 1px solid transparent; }
.an-note-item:hover { background: var(--surface-2); }
.an-note-item.active { background: var(--surface); border-color: var(--border); box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.an-note-title { display: flex; gap: 6px; font-weight: 600; font-size: 13.5px; min-width: 0; }
.an-star { color: var(--warn); }
.an-note-excerpt { color: var(--muted); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.an-note-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--muted); font-size: 11.5px; }
.an-notes-editor { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--surface); }
.an-editor-empty { margin: auto; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px; }
.an-editor-empty svg.an-i { width: 40px; height: 40px; }
.an-only-narrow { display: none; }

.an-tree-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 4px 10px; }
.an-tree-list { list-style: none; margin: 0; padding: 0; }
.an-tree-row { display: flex; align-items: center; }
.an-tree-row .an-nav { flex: 1; min-width: 0; }
.an-tree-actions { display: none; }
.an-tree-row:hover .an-tree-actions, .an-tree-row:focus-within .an-tree-actions { display: inline-flex; }
.an-tree-edit { display: flex; align-items: center; gap: 4px; padding: 4px 0; }
.an-tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 6px; }

/* Éditeur */
.an-editor { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.an-editor-head { padding: 14px 20px 10px; display: flex; flex-direction: column; gap: 8px; }
.an-editor-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.an-editor-actions { margin-left: auto; display: flex; gap: 2px; }
.an-save-status { font-size: 12px; color: var(--muted); }
.an-save-status.ok { color: var(--ok); }
.an-save-status.bad { color: var(--bad); }
.an-title-input { border: 0; background: transparent; color: var(--text); font: 600 26px var(--font-display); padding: 2px 0; outline: none; width: 100%; }
.an-title-input:focus-visible { box-shadow: inset 0 -2px 0 var(--accent); }
.an-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.an-tag-input { border: 1px dashed var(--border); border-radius: 999px; background: transparent; color: var(--text); font: 500 12px var(--font); padding: 3px 10px; min-width: 150px; }
.an-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px 16px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.an-toolbar .an-seg { margin-left: auto; }
.an-toolbar .an-icon-btn { color: var(--text); font: 600 13px var(--font); }
.an-sep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; }
.an-panes { flex: 1; display: grid; min-height: 420px; }
.an-panes.mode-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.an-source { resize: none; border: 0; border-right: 1px solid var(--border); padding: 18px 22px; background: var(--bg); color: var(--text); font: 400 13.5px/1.7 var(--font-mono); outline: none; min-height: 420px; }
.an-source:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.an-preview { padding: 18px 26px; overflow-y: auto; }

/* Polices de note (polices système : aucune police tierce n'est chargée) */
.an-font-sans .an-preview, .an-font-sans .an-title-input { font-family: var(--font); }
.an-font-serif .an-preview, .an-font-serif .an-title-input { font-family: Georgia, Cambria, "Times New Roman", serif; }
.an-font-mono .an-preview, .an-font-mono .an-title-input { font-family: var(--font-mono); }
.an-font-readable .an-preview, .an-font-readable .an-title-input { font-family: Verdana, Tahoma, sans-serif; letter-spacing: .01em; }

/* Rendu Markdown */
.an-md { font-size: 15px; line-height: 1.65; overflow-wrap: anywhere; }
.an-md h1 { font-size: 26px; margin: 0 0 10px; }
.an-md h2 { font-size: 19px; margin: 22px 0 8px; }
.an-md h3 { font-size: 16px; margin: 18px 0 6px; }
.an-md p, .an-md ul, .an-md ol, .an-md blockquote, .an-md table, .an-md pre { margin: 0 0 12px; }
.an-md ul, .an-md ol { padding-left: 22px; }
.an-md li.task-list-item { list-style: none; margin-left: -20px; }
.an-md blockquote { border-left: 3px solid var(--border); padding: 2px 14px; color: var(--muted); }
.an-md code { font-family: var(--font-mono); font-size: .9em; background: var(--code); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }
.an-md pre { background: var(--code); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; overflow-x: auto; }
.an-md pre code { border: 0; padding: 0; background: transparent; font-size: 13px; }
.an-md table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; }
.an-md th, .an-md td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.an-md th { background: var(--surface-2); }
.an-md hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.an-md img { max-width: 100%; }

/* Sections requises encore vides (note issue d'un template) */
.an-required { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 20px; background: var(--warn-weak); color: var(--warn); font-size: 12.5px; }
.an-chip.mono { font-family: var(--font-mono); cursor: pointer; border: 1px solid var(--border); }
.an-chip.mono:disabled { opacity: .5; cursor: not-allowed; }

/* Templates */
.an-notes-list.wide { flex-basis: 320px; }
.an-template-editor { display: flex; flex-direction: column; gap: 14px; padding: 16px 20px 24px; overflow-y: auto; }
.an-form-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px 16px; }
.an-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }
.an-field.wide { grid-column: 1 / -1; }
.an-field textarea.an-input { resize: vertical; font-family: var(--font); }
.an-template-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.an-template-source { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.an-template-head { display: flex; align-items: center; justify-content: space-between; }
.an-source.bordered, .an-preview.bordered { border: 1px solid var(--border); border-radius: 10px; min-height: 460px; }
.an-template-side { display: flex; flex-direction: column; gap: 12px; }
.an-card.sm { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.an-card.sm h2 { font-size: 14px; }
.an-card.sm p { margin: 0; }
@media (max-width: 1100px) {
  .an-template-body, .an-form-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Choix du point de départ d'une note */
.an-pick-list { list-style: none; margin: 0; padding: 10px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.an-pick { width: 100%; display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text); font: 400 13.5px var(--font); text-align: left; cursor: pointer; }
.an-pick:hover, .an-pick:focus-visible { background: var(--surface-2); border-color: var(--border); }
.an-pick > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.an-pick-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--accent-weak); color: var(--accent); display: grid; place-items: center; flex: none; }
.an-dialog-foot { padding: 10px 18px; border-top: 1px solid var(--border); font-size: 13px; }

/* Assistant IA */
.an-btn.ai { background: var(--ai-weak); border-color: transparent; color: var(--ai); }
.an-btn.ai:hover { filter: brightness(.97); background: var(--ai-weak); }
.an-chip.bad { background: var(--bad-weak); color: var(--bad); }
a.an-chip.warn, a.an-chip.bad { text-decoration: none; }
.an-icon-btn.on-ai { background: var(--ai-weak); color: var(--ai); }
.an-editor-wrap { display: flex; flex: 1; min-height: 0; }
.an-editor-wrap > .an-editor { flex: 1; min-width: 0; }
.an-ai-panel { flex: 0 0 320px; border-left: 1px solid var(--border); background: var(--bg); padding: 14px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.an-ai-head { display: flex; align-items: center; gap: 8px; }
.an-ai-head h2 { font-size: 15px; flex: 1; }
.an-pick-icon.ai { width: 28px; height: 28px; background: var(--ai-weak); color: var(--ai); }
.an-ai-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.an-ai-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.an-ai-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.an-ai-list li { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.an-ai-list a { font-size: 12px; overflow-wrap: anywhere; }
.an-ai-privacy { display: flex; gap: 6px; align-items: flex-start; margin-top: auto; }
.an-card h3 { font-size: 13.5px; margin: 0; }
.an-md.sm { font-size: 13px; }
.an-chip.ai-suggest { border: 1px dashed var(--ai); color: var(--ai); background: transparent; cursor: pointer; font-family: var(--font); }
.an-check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.an-check input { margin-top: 3px; }
.an-input.mono { font-family: var(--font-mono); font-size: 13px; }
.an-quick { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.an-quick-input, .an-quick-result { min-height: 420px; }
.an-quick-options { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.an-quick-result h2 { font-size: 15px; }
@media (max-width: 1100px) {
  .an-editor-wrap { flex-direction: column; }
  .an-ai-panel { flex: none; border-left: 0; border-top: 1px solid var(--border); }
  .an-quick { grid-template-columns: minmax(0, 1fr); }
}

/* Tâches */
.an-task-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.an-inline-field { display: inline-flex; align-items: center; gap: 6px; }
.an-select.sm { min-height: 30px; padding: 2px 8px; font-size: 12.5px; }
.an-code-hint { font-family: var(--font-mono); font-size: 12px; background: var(--code); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; }
.an-table-wrap { padding: 0; overflow-x: auto; }
.an-table { width: 100%; min-width: 820px; border-collapse: collapse; font-size: 13.5px; }
.an-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.an-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.an-table tr.done .an-task-text { text-decoration: line-through; color: var(--muted); }
.an-table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.an-task-text { font-weight: 500; }
.an-task-sources { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.an-task-sources .an-chip { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.an-chip.me { background: var(--accent-weak); color: var(--accent); }
.an-chip svg.an-i { width: 13px; height: 13px; }
.an-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.an-board-col { background: var(--surface-2); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.an-board-col h2 { font-size: 14px; display: flex; gap: 8px; align-items: center; }
.an-board-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.an-board-meta { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 900px) { .an-board { grid-template-columns: minmax(0, 1fr); } }

/* Fenêtres */
.an-overlay { position: fixed; inset: 0; background: rgba(10, 12, 16, .5); display: grid; place-items: center; padding: 16px; z-index: 50; }
.an-dialog { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; width: 100%; max-width: 560px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0,0,0,.28); }
.an-dialog.wide { max-width: 1000px; }
.an-dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.an-dialog-head h2 { font-size: 18px; }
.an-history { display: flex; min-height: 0; flex: 1; }
.an-history-list { list-style: none; margin: 0; padding: 8px; flex: 0 0 260px; overflow-y: auto; border-right: 1px solid var(--border); }
.an-history-item { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: 400 13px var(--font); cursor: pointer; text-align: left; }
.an-history-item:hover { background: var(--surface-2); }
.an-history-item[aria-pressed="true"] { background: var(--accent-weak); }
.an-history-preview { flex: 1; overflow-y: auto; padding: 16px 20px; min-width: 0; }
.an-history-actions { display: flex; justify-content: flex-end; margin-bottom: 12px; }

@media (max-width: 1100px) {
  .an-notes-nav { flex-basis: 200px; }
  .an-notes-list { flex-basis: 260px; }
  .an-panes.mode-split { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; }
  .an-source { border-right: 0; border-bottom: 1px solid var(--border); }
}
@media (max-width: 860px) {
  .an-notes { flex-direction: column; }
  .an-notes-nav { flex: none; border-right: 0; border-bottom: 1px solid var(--border); }
  .an-notes-list { flex: none; border-right: 0; }
  .an-notes.has-note .an-notes-nav, .an-notes.has-note .an-notes-list { display: none; }
  .an-notes.no-note .an-notes-editor { display: none; }
  .an-only-narrow { display: inline-grid; }
  .an-history { flex-direction: column; }
  .an-history-list { flex: none; max-height: 200px; border-right: 0; border-bottom: 1px solid var(--border); }
}

/* Pages de compte (connexion, inscription, MFA) */
.an-account { min-height: 100vh; display: flex; flex-direction: column; }
.an-account-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.an-account-lang { display: flex; gap: 12px; font-weight: 600; }
.an-account-lang a { color: var(--muted); text-decoration: none; }
.an-account-lang a[aria-current="true"] { color: var(--accent); }
.an-account-main { width: 100%; max-width: 1040px; margin: 0 auto; padding: 32px 24px; }
/* Bootstrap (pages Identity) aligné sur les couleurs ApyNotes */
.an-account { --bs-body-bg: var(--bg); --bs-body-color: var(--text); --bs-border-color: var(--border); --bs-link-color-rgb: 47, 91, 234; }
.an-account h1 { font-size: 28px; margin-bottom: 6px; }
.an-account h2 { font-size: 15px; font-weight: 500; color: var(--muted); }
.an-account .btn-primary { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-color: var(--accent-ink); --bs-btn-hover-bg: var(--accent); --bs-btn-hover-border-color: var(--accent); --bs-btn-hover-color: var(--accent-ink); --bs-btn-active-bg: var(--accent); --bs-btn-active-border-color: var(--accent); }
.an-account .form-control { background: var(--surface); color: var(--text); border-color: var(--border); }
.an-account a { color: var(--accent); }
.an-account kbd { font-size: 15px; letter-spacing: .05em; }

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; padding: 10px 20px; background: var(--warn-weak); color: var(--warn); z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; float: right; }

/* ---- Lot 5 : espaces, partage, commentaires, diffusion ---- */
.an-page-narrow { display: flex; flex-direction: column; gap: 18px; max-width: 860px; }
.an-page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.an-page-head h1 { font-size: 26px; }
.an-stack { display: flex; flex-direction: column; gap: 12px; }
.an-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.an-grow { flex: 1 1 200px; min-width: 0; }
.an-h2 { font-size: 18px; display: flex; gap: 8px; align-items: center; margin: 0; }
.an-break { overflow-wrap: anywhere; font-family: var(--font-mono); font-size: 12px; }
.an-seg.an-wrap { flex-wrap: wrap; }
.an-dialog-body { padding: 16px 18px; overflow-y: auto; }
.an-fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin: 0; min-width: 0; }
.an-fieldset:disabled { opacity: .7; }
.an-card > .an-fieldset[disabled] { border-style: dashed; }
.an-side-panel { flex: 0 0 320px; border-left: 1px solid var(--border); background: var(--bg); padding: 14px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.an-side-head { display: flex; align-items: center; justify-content: space-between; }
.an-comments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.an-comment { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.an-comment-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.an-comment-head .an-icon-btn { margin-left: auto; }
.an-comment-text { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.an-ws-switch { display: inline-flex; align-items: center; gap: 6px; }
.an-ws-switch .an-select { max-width: 180px; }
@media (max-width: 900px) {
  .an-side-panel { flex: none; border-left: 0; border-top: 1px solid var(--border); }
  .an-ws-switch .an-select { max-width: 120px; }
}

/* ---- Lot 6 : écran de connexion du desktop ---- */
.an-signin { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.an-signin-card { width: 100%; max-width: 460px; }
/* Titre ciblé par FocusOnNavigate (accessibilité) : pas de cadre au focus programmatique. */
h1[tabindex="-1"]:focus { outline: none; }
