/* ============================================================
   prosemirror_editor.css  —  Folio v5.0
   Replaces canvas_editor.css block styles (.eb-*).
   Add this file to index.html AFTER canvas_editor.css.
   ============================================================ */

/* ── PM container ─────────────────────────────────────────── */

#note-canvas .ProseMirror {
    white-space: pre-wrap; /* Required by prosemirror-view */
    outline: none;
    min-height: 100%;
    padding: 24px 32px 120px;
    caret-color: var(--accent, #C96A3A);
    font-family: inherit;
    font-size: inherit;
    color: var(--text, #1A1714);
    line-height: 1.7;
}

/* Remove default PM focus outline */
.ProseMirror:focus {
    outline: none;
}

/* ── Placeholder (shown on empty first paragraph) ─────────── */

.ProseMirror > p.pm-p:first-child:empty::before,
.ProseMirror > p.pm-p:only-child:empty::before {
    content: "Type '/' for commands…";
    color: var(--text-muted, #aaa);
    pointer-events: none;
    position: absolute;
}

.ProseMirror > p.pm-p:first-child:empty {
    position: relative;
}

/* ── Block styles ─────────────────────────────────────────── */

.ProseMirror p.pm-p {
    margin: 0 0 2px;
    min-height: 1.7em;
}

.ProseMirror h1.pm-h1,
.ProseMirror h2.pm-h2,
.ProseMirror h3.pm-h3,
.ProseMirror h4.pm-h4 {
    font-weight: 700;
    line-height: 1.3;
    margin: 20px 0 6px;
    color: var(--text, #1A1714);
}

.ProseMirror h1.pm-h1 { font-size: 1.9em; }
.ProseMirror h2.pm-h2 { font-size: 1.5em; }
.ProseMirror h3.pm-h3 { font-size: 1.2em; }
.ProseMirror h4.pm-h4 { font-size: 1.05em; }

.ProseMirror blockquote.pm-quote {
    border-left: 3px solid var(--accent, #C96A3A);
    margin: 8px 0;
    padding: 6px 16px;
    color: var(--text-muted, #666);
    font-style: italic;
    background: var(--surface-alt, rgba(0,0,0,0.03));
    border-radius: 0 6px 6px 0;
}

.ProseMirror pre.pm-code {
    background: var(--code-bg, #1e1e2e);
    color: var(--code-text, #cdd6f4);
    border-radius: 8px;
    padding: 14px 18px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.87em;
    overflow-x: auto;
    margin: 8px 0;
    white-space: pre;
    tab-size: 4;
}

.ProseMirror pre.pm-code code {
    background: none;
    color: inherit;
    font-size: inherit;
    padding: 0;
}

.ProseMirror div.pm-divider {
    border: none;
    border-top: 2px solid var(--border, #e0dbd5);
    margin: 16px 0;
    height: 0;
}

/* ── Lists ────────────────────────────────────────────────── */

.ProseMirror ul,
.ProseMirror ol {
    padding-left: 24px;
    margin: 4px 0;
}

.ProseMirror li {
    margin: 2px 0;
    line-height: 1.65;
}

.ProseMirror .pm-table-wrap {
    overflow-x: auto;
    margin: 8px 0;
}

.ProseMirror table.pm-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.92em;
}

.ProseMirror table.pm-table th,
.ProseMirror table.pm-table td {
    border: 1px solid var(--border, #e0dbd5);
    padding: 7px 12px;
    text-align: left;
    min-width: 60px;
}

.ProseMirror table.pm-table th {
    background: var(--surface-alt, rgba(0,0,0,0.04));
    font-weight: 600;
}

/* ── Inline marks ─────────────────────────────────────────── */

.ProseMirror code.pm-inline-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.87em;
    background: var(--code-bg-inline, rgba(0,0,0,0.07));
    padding: 1px 5px;
    border-radius: 4px;
    color: var(--accent, #C96A3A);
}

.ProseMirror a {
    color: var(--accent, #C96A3A);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ── Selection ────────────────────────────────────────────── */

.ProseMirror ::selection {
    background: var(--accent-alpha, rgba(201, 106, 58, 0.18));
}

/* ── Selected node ring (images, dividers, etc.) ──────────── */

.ProseMirror .ProseMirror-selectednode {
    outline: 2px solid var(--accent, #C96A3A);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Todo list — NodeView renders <li> <input> <span> ────── */

.ProseMirror ul.pm-todo {
    list-style: none;
    padding-left: 0;
    margin: 4px 0;
}

.ProseMirror li.pm-todo-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 3px 0;
    line-height: 1.5;
    position: relative;
}

.ProseMirror li.pm-todo-item .pm-todo-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    min-width: 16px;
    border: 2px solid var(--accent, #C96A3A);
    border-radius: 4px;
    cursor: pointer;
    margin-top: 3px;
    background: transparent;
    transition: background 0.15s, border-color 0.15s;
    flex-shrink: 0;
    position: relative;
}

.ProseMirror li.pm-todo-item .pm-todo-checkbox:checked {
    background: var(--accent, #C96A3A);
    border-color: var(--accent, #C96A3A);
}

/* input[type=checkbox] doesn't support ::after — use background-image for checkmark */
.ProseMirror li.pm-todo-item .pm-todo-checkbox:checked {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M2 6l3 3 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 10px;
}

.ProseMirror li.pm-todo-item .pm-todo-text {
    flex: 1;
    min-width: 0;
}

.ProseMirror li.pm-todo-item[data-checked="true"] .pm-todo-text {
    text-decoration: line-through;
    opacity: 0.55;
}

/* ── Image NodeView ───────────────────────────────────────── */

.ProseMirror figure.pm-figure {
    display: block;
    margin: 12px auto;
    max-width: 100%;
    position: relative;  /* anchor for controls overlay */
}

.ProseMirror figure.pm-figure[data-align="center"] {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.ProseMirror figure.pm-figure[data-align="left"] {
    margin-left: 0;
    float: left;
    margin-right: 16px;
}

.ProseMirror figure.pm-figure[data-align="right"] {
    float: right;
    margin-left: 16px;
    margin-right: 0;
}

.ProseMirror figure.pm-figure .pm-figure-img {
    display: block;
    max-width: 100%;
    border-radius: 6px;
    width: 100%;
}

/* Controls — hidden by default, revealed on hover ─────────── */

.pm-figure-controls {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0,0,0,0.55);
    border-radius: 8px;
    padding: 4px 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
    z-index: 10;
}

.ProseMirror figure.pm-figure:hover .pm-figure-controls {
    opacity: 1;
    pointer-events: all;
}

.pm-fig-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    padding: 3px 5px;
    border-radius: 5px;
    line-height: 1;
    transition: background 0.12s;
}

.pm-fig-btn:hover {
    background: rgba(255,255,255,0.25);
}

.pm-fig-align[data-align="left"]   { opacity: 0.6; }
.pm-fig-align[data-align="center"] { opacity: 0.6; }
.pm-fig-align[data-align="right"]  { opacity: 0.6; }

/* Active align state — CanvasWorker updates data-align on figure */
.pm-figure[data-align="left"]   .pm-fig-align[data-align="left"],
.pm-figure[data-align="center"] .pm-fig-align[data-align="center"],
.pm-figure[data-align="right"]  .pm-fig-align[data-align="right"] {
    opacity: 1;
    background: rgba(255,255,255,0.25);
}

.pm-fig-delete { color: #ff8080; }

.pm-fig-slider {
    width: 64px;
    height: 4px;
    accent-color: #fff;
    cursor: pointer;
}

.pm-figcaption {
    font-size: 0.82em;
    color: var(--text-muted, #888);
    text-align: center;
    padding: 4px 0 0;
    font-style: italic;
}

/* ── Code block NodeView ──────────────────────────────────── */

.pm-code-wrap {
    margin: 8px 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border, rgba(0,0,0,0.08));
    background: var(--code-bg, rgba(0,0,0,0.06));
}

.pm-code-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 12px;
    background: rgba(0,0,0,0.08);
    border-bottom: 1px solid var(--border, rgba(0,0,0,0.08));
    user-select: none;
}

.pm-code-lang {
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted, #888);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pm-code-copy {
    background: none;
    border: 1px solid var(--border, rgba(0,0,0,0.15));
    color: var(--text-muted, #888);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    font-family: inherit;
}

.pm-code-copy:hover {
    background: var(--accent, #C96A3A);
    color: #fff;
    border-color: transparent;
}

.ProseMirror pre.pm-code {
    margin: 0;
    padding: 14px 16px;
    background: none;
    border-radius: 0;
    border: none;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.88em;
    line-height: 1.6;
    white-space: pre;
}

.ProseMirror pre.pm-code code.pm-code-content {
    background: none;
    padding: 0;
    font-size: inherit;
    color: inherit;
    white-space: pre;
    display: block;
}

/* ── Welcome bulk-select bar ──────────────────────────────── */

.welcome-bulk-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--surface-alt, rgba(0,0,0,0.04));
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    flex-wrap: wrap;
}

.welcome-bulk-bar.hidden { display: none; }

.bulk-select-all {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.bulk-count {
    color: var(--text-muted, #888);
    flex: 1;
}

.bulk-delete-btn {
    background: #e05252;
    color: #fff;
    border: none;
    padding: 5px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s;
}

.bulk-delete-btn:hover { background: #c84040; }

.bulk-cancel-btn {
    background: none;
    border: 1px solid var(--border, #ddd);
    color: var(--text, #333);
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.note-select-cb {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 18px;
    height: 18px;
    z-index: 5;
    cursor: pointer;
    accent-color: var(--accent, #C96A3A);
}

/* Note card ribbon colors reflected in welcome grid */
[data-note-id].ribbon-red    { border-top: 3px solid var(--ribbon-red, #e05252); }
[data-note-id].ribbon-amber  { border-top: 3px solid var(--ribbon-amber, #e09a3a); }
[data-note-id].ribbon-green  { border-top: 3px solid var(--ribbon-green, #52a878); }
[data-note-id].ribbon-blue   { border-top: 3px solid var(--ribbon-blue, #4a8ec4); }
[data-note-id].ribbon-purple { border-top: 3px solid var(--ribbon-purple, #8a6cc4); }
[data-note-id].ribbon-teal   { border-top: 3px solid var(--ribbon-teal, #3aa8a0); }

/* ── ProseMirror gapcursor ────────────────────────────────── */

.ProseMirror-gapcursor {
    display: none;
    pointer-events: none;
    position: absolute;
}

.ProseMirror-gapcursor:after {
    content: "";
    display: block;
    position: absolute;
    top: -2px;
    width: 20px;
    border-top: 1px solid var(--accent, #C96A3A);
    animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
}

@keyframes ProseMirror-cursor-blink {
    to { visibility: hidden; }
}

.ProseMirror-focused .ProseMirror-gapcursor {
    display: block;
}

/* ── ProseMirror dropcursor ───────────────────────────────── */

.ProseMirror-dropcursor {
    border-top: 2px solid var(--accent, #C96A3A);
    position: absolute;
    pointer-events: none;
    border-radius: 1px;
}

/* ── Code block — syntax-style coloring ──────────────────── */

/* Make code text visible with proper contrast */
.ProseMirror pre.pm-code {
    color: var(--code-text, #e8e0d5);
}

/* Dark background for the pre block itself */
.pm-code-wrap {
    --code-surface: #1e1c1a;
    --code-bar-bg: #161412;
}

[data-theme="light"] .pm-code-wrap,
:root:not([data-theme="dark"]) .pm-code-wrap {
    --code-surface: #1a1917;
    --code-bar-bg: #111010;
}

.pm-code-wrap {
    background: var(--code-surface);
}

.pm-code-bar {
    background: var(--code-bar-bg);
    border-bottom-color: rgba(255,255,255,0.06);
}

.pm-code-lang {
    color: var(--accent, #C96A3A);
}

.pm-code-copy {
    color: rgba(255,255,255,0.5);
    border-color: rgba(255,255,255,0.15);
}

.pm-code-copy:hover {
    background: var(--accent, #C96A3A);
    color: #fff;
}

.ProseMirror pre.pm-code {
    color: #e0d8cc;       /* warm off-white — readable on dark background */
}

/* ── Table NodeView control bar ───────────────────────────── */

.pm-table-wrap {
    position: relative;
}

.pm-table-bar {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    background: var(--surface-alt, rgba(0,0,0,0.04));
    border-bottom: 1px solid var(--border, #e0dbd5);
    border-radius: 6px 6px 0 0;
}

.pm-table-wrap:hover .pm-table-bar {
    display: flex;
}

.pm-tbl-btn {
    background: none;
    border: 1px solid var(--border, #e0dbd5);
    color: var(--text, #333);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.12s;
    font-family: inherit;
}

.pm-tbl-btn:hover {
    background: var(--accent, #C96A3A);
    color: #fff;
    border-color: transparent;
}

.pm-tbl-danger:hover {
    background: #e05252;
}

/* ── Shared context menu (table right-click etc.) ─────────── */

.pm-ctx-menu {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e0dbd5);
    border-radius: 8px;
    padding: 4px 0;
    min-width: 170px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    font-size: 13px;
    user-select: none;
}

.pm-ctx-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    cursor: pointer;
    color: var(--text, #333);
    transition: background 0.1s;
}

.pm-ctx-item:hover {
    background: var(--surface-alt, rgba(0,0,0,0.05));
}

.pm-ctx-item.pm-ctx-danger { color: #e05252; }
.pm-ctx-item.pm-ctx-danger:hover { background: rgba(224,82,82,0.08); }

.pm-ctx-icon {
    font-size: 14px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.pm-ctx-sep {
    height: 1px;
    background: var(--border, #e0dbd5);
    margin: 3px 0;
}

/* ── Note ribbon bar ──────────────────────────────────────── */

.note-ribbon-bar {
    height: 4px;
    width: 100%;
    flex-shrink: 0;
    transition: background 0.2s;
}

.note-ribbon-bar.ribbon-none   { background: transparent; }
.note-ribbon-bar.ribbon-red    { background: var(--ribbon-red,    #e05252); }
.note-ribbon-bar.ribbon-amber  { background: var(--ribbon-amber,  #e09a3a); }
.note-ribbon-bar.ribbon-green  { background: var(--ribbon-green,  #52a878); }
.note-ribbon-bar.ribbon-blue   { background: var(--ribbon-blue,   #4a8ec4); }
.note-ribbon-bar.ribbon-purple { background: var(--ribbon-purple, #8a6cc4); }
.note-ribbon-bar.ribbon-teal   { background: var(--ribbon-teal,   #3aa8a0); }
.note-ribbon-bar.ribbon-pink   { background: var(--ribbon-pink,   #c46a8a); }

/* ── Toolbar active states ────────────────────────────────── */

.toolbar-btn.active {
    background: var(--accent-alpha, rgba(201,106,58,0.15));
    color: var(--accent, #C96A3A);
}

.td-item.active {
    background: var(--accent-alpha, rgba(201,106,58,0.10));
    color: var(--accent, #C96A3A);
    font-weight: 600;
}

/* ── Link insert dialog ───────────────────────────────────── */

.link-dialog {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.35);
    z-index: 1000;
    border-radius: inherit;
}

.link-dialog.hidden { display: none; }

.link-dialog-inner {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e0dbd5);
    border-radius: 12px;
    padding: 20px 24px 16px;
    width: 340px;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.link-dialog-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 14px;
    color: var(--text, #1a1714);
}

.link-dialog-field {
    margin-bottom: 10px;
}

.link-dialog-field label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #888);
    margin-bottom: 4px;
}

.link-dialog-field input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border, #e0dbd5);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: var(--surface-alt, #faf8f5);
    color: var(--text, #1a1714);
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s;
}

.link-dialog-field input:focus {
    border-color: var(--accent, #C96A3A);
}

.link-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

/* ══════════════════════════════════════════════════════════════
   WELCOME SCREEN — bulk bar, context menu, completed badge
   ══════════════════════════════════════════════════════════════ */

#welcome-bulk-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 14px;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e0dbd5);
    border-radius: 10px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    flex-wrap: wrap;
}
#welcome-bulk-bar.hidden { display: none; }

.bulk-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.bulk-select-all {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--text, #333);
}

.bulk-count {
    font-size: 12px;
    color: var(--text-muted, #888);
    white-space: nowrap;
}

.bulk-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}

.bulk-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    border: 1px solid var(--border, #e0dbd5);
    transition: background 0.12s, color 0.12s;
}

.bulk-btn--danger { background: #fee; border-color: #fca5a5; color: #c84040; }
.bulk-btn--danger:hover { background: #e05252; color: #fff; border-color: transparent; }

.bulk-btn--primary { background: rgba(201,106,58,0.1); border-color: var(--accent, #C96A3A); color: var(--accent, #C96A3A); }
.bulk-btn--primary:hover { background: var(--accent, #C96A3A); color: #fff; border-color: transparent; }

.bulk-btn--disabled { background: rgba(0,0,0,0.03); color: #bbb; cursor: not-allowed; opacity: 0.65; }

.bulk-export-group { display: flex; align-items: center; gap: 3px; }
.bulk-export-label { cursor: default !important; padding-right: 4px !important; }

.bulk-cancel-btn {
    background: none;
    border: 1px solid var(--border, #ddd);
    color: var(--text-muted, #888);
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    flex-shrink: 0;
}
.bulk-cancel-btn:hover { background: rgba(0,0,0,0.04); }

/* ── Completed badge + card style ─────────────────────────── */

.note-complete-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: #52a878;
    color: #fff;
    border-radius: 50%;
    font-size: 9px;
    font-weight: 700;
    vertical-align: middle;
    margin-right: 2px;
    flex-shrink: 0;
}

.note-card--completed .note-card-title,
.note-card--completed .note-list-title { text-decoration: line-through; opacity: 0.6; }
.note-card--completed { opacity: 0.75; }

.card-select-cb {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent, #C96A3A);
    flex-shrink: 0;
}

.note-tags-row { display: flex; flex-wrap: wrap; gap: 3px; flex: 1; }

/* ── Card context menu ────────────────────────────────────── */

.card-ctx-menu {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e0dbd5);
    border-radius: 10px;
    padding: 6px 0 4px;
    min-width: 210px;
    max-width: 270px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.15);
    font-size: 13px;
    user-select: none;
    overflow: hidden;
}

.ctx-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted, #aaa);
    padding: 4px 12px 2px;
}

.ctx-ribbon-row { display: flex; align-items: center; gap: 5px; padding: 4px 12px 6px; }

.ctx-ribbon-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.1s, border-color 0.1s;
    flex-shrink: 0;
}
.ctx-ribbon-swatch:hover { transform: scale(1.18); }
.ctx-ribbon-active { border-color: var(--text, #333) !important; transform: scale(1.12); }
.ctx-swatch-outline { border: 1.5px solid var(--border, #ddd) !important; }

.ctx-divider { height: 1px; background: var(--border, #e8e3de); margin: 3px 0; }

.ctx-tags-wrap { padding: 4px 10px 6px; }
.ctx-tags-list { display: flex; flex-wrap: wrap; gap: 4px; min-height: 20px; margin-bottom: 6px; }

.ctx-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: rgba(201,106,58,0.1);
    color: var(--accent, #C96A3A);
    border-radius: 10px;
    padding: 2px 6px 2px 8px;
    font-size: 11px;
    font-weight: 500;
}

.ctx-tag-del { background: none; border: none; color: inherit; cursor: pointer; font-size: 13px; line-height: 1; padding: 0 1px; opacity: 0.7; }
.ctx-tag-del:hover { opacity: 1; }

.ctx-tag-input-row { display: flex; gap: 4px; margin-top: 2px; }

.ctx-tag-input {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid var(--border, #ddd);
    border-radius: 5px;
    font-size: 12px;
    font-family: inherit;
    background: var(--surface-alt, #faf8f5);
    color: var(--text, #333);
    outline: none;
    min-width: 0;
}
.ctx-tag-input:focus { border-color: var(--accent, #C96A3A); }

.ctx-tag-add-btn {
    background: var(--accent, #C96A3A);
    border: none;
    color: #fff;
    border-radius: 5px;
    width: 26px;
    cursor: pointer;
    font-size: 15px;
    flex-shrink: 0;
}
.ctx-tag-add-btn:hover { opacity: 0.85; }

.ctx-action {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    cursor: pointer;
    color: var(--text, #333);
    transition: background 0.1s;
    gap: 3px;
}
.ctx-action:hover { background: rgba(0,0,0,0.04); }
.ctx-complete-on { color: #52a878; font-weight: 600; }
.ctx-danger { color: #e05252; }
.ctx-danger:hover { background: rgba(224,82,82,0.07); }
/* ── Link click — pointer cursor on hyperlinks in editor ──────── */
.pm-editor a[href] {
    cursor: pointer;
    text-decoration: underline;
    color: var(--accent, #4a8ec4);
}
.pm-editor a[href]:hover {
    opacity: 0.8;
}

/* ═══════════════════════════════════════════════════════════════════
   TOP-RIGHT NON-DISTURBING NOTIFICATION TOASTS
   Used by SettingsWorker and SoundWorker for change confirmations.
   Multiple toasts stack vertically; each auto-dismisses after 2.8 s.
   ═══════════════════════════════════════════════════════════════════ */

#folio-notif-stack {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 99998;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 280px;
}

.folio-notif {
    display: flex;
    align-items: center;
    gap: 9px;
    background: var(--bg-secondary, #f8f6f3);
    color: var(--text, #2a2320);
    border: 1px solid var(--border, #e0dbd5);
    border-left: 3px solid var(--accent, #C96A3A);
    border-radius: 8px;
    padding: 9px 13px;
    font-size: 12px;
    font-family: 'Nunito', sans-serif;
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    pointer-events: auto;
    cursor: default;
    animation: folio-notif-in 0.18s cubic-bezier(0.22,1,0.36,1) both;
    max-width: 280px;
    line-height: 1.4;
}

.folio-notif.leaving {
    animation: folio-notif-out 0.22s ease forwards;
}

.folio-notif-icon {
    font-size: 15px;
    flex-shrink: 0;
    line-height: 1;
}

.folio-notif-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.folio-notif-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-muted, #999);
    cursor: pointer;
    font-size: 13px;
    padding: 0 0 0 4px;
    line-height: 1;
    opacity: 0.6;
}
.folio-notif-close:hover { opacity: 1; }

@keyframes folio-notif-in {
    from { opacity: 0; transform: translateX(24px) scale(0.96); }
    to   { opacity: 1; transform: translateX(0)    scale(1);    }
}
@keyframes folio-notif-out {
    from { opacity: 1; transform: translateX(0)    scale(1);    max-height: 60px; margin: 0; }
    to   { opacity: 0; transform: translateX(24px) scale(0.95); max-height: 0;    margin: 0; }
}
