/* ==========================================================================
   Notes widget. Everything is scoped under .nt-root so it cannot leak into the
   rest of the app. Colour comes from palette KEYS (nt-c-teal and so on) that set
   --c; nothing here hard-codes a hex outside the palette block, and the palette
   has a light and a dark set. Surfaces reuse the app's --ap-* tokens.
   ========================================================================== */

.nt-root {
    --nt-slate: #64748b; --nt-sage: #6f9a7e; --nt-teal: #2f9aa0; --nt-sky: #4f8fd8; --nt-indigo: #6366c8;
    --nt-plum: #9a5fb0; --nt-rose: #d36a85; --nt-amber: #d9a03a; --nt-clay: #c47a58; --nt-stone: #8d867c;
    --nt-red: #d64545; --nt-coral: #e8715a; --nt-orange: #e48a2a; --nt-yellow: #c9ae22;
    --nt-lime: #86b035; --nt-green: #4f9d58; --nt-mint: #3fb596; --nt-cyan: #2aa9c9;
    --nt-blue: #2f6bd0; --nt-violet: #7a5fd0; --nt-lilac: #a97fcc; --nt-pink: #e0629f;
    --nt-brown: #9b6b4a; --nt-graphite: #4b5563;
    --nt-tint: 12%;
    --nt-radius: 12px;
    --nt-shadow: 0 1px 2px rgba(20, 24, 50, .06), 0 6px 18px rgba(20, 24, 50, .06);
    --nt-surface: var(--ap-card-bg);
    --nt-surface-2: color-mix(in srgb, var(--ap-text) 3%, var(--ap-card-bg));
    --c: var(--nt-slate);

    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--ap-topbar-height, 56px));
    min-height: 420px;
    color: var(--ap-text);
    color-scheme: light;
}

/* The dashboard's Notes tile uses the same palette keys for the dot beside each note. */
.db-notes-card {
    --nt-slate: #64748b; --nt-sage: #6f9a7e; --nt-teal: #2f9aa0; --nt-sky: #4f8fd8; --nt-indigo: #6366c8;
    --nt-plum: #9a5fb0; --nt-rose: #d36a85; --nt-amber: #d9a03a; --nt-clay: #c47a58; --nt-stone: #8d867c;
    --nt-red: #d64545; --nt-coral: #e8715a; --nt-orange: #e48a2a; --nt-yellow: #c9ae22;
    --nt-lime: #86b035; --nt-green: #4f9d58; --nt-mint: #3fb596; --nt-cyan: #2aa9c9;
    --nt-blue: #2f6bd0; --nt-violet: #7a5fd0; --nt-lilac: #a97fcc; --nt-pink: #e0629f;
    --nt-brown: #9b6b4a; --nt-graphite: #4b5563;
}
.ap-shell--dark .db-notes-card {
    --nt-slate: #94a3b8; --nt-sage: #8fbf9f; --nt-teal: #55bcc2; --nt-sky: #7db0ee; --nt-indigo: #8d90e6;
    --nt-plum: #c08ad2; --nt-rose: #ee8fa8; --nt-amber: #ecbf62; --nt-clay: #e0a085; --nt-stone: #b3ada3;
    --nt-red: #ee7a7a; --nt-coral: #f29a88; --nt-orange: #f0ae5e; --nt-yellow: #e6d062;
    --nt-lime: #b0d56a; --nt-green: #7cc486; --nt-mint: #6fd3b8; --nt-cyan: #5fcfe8;
    --nt-blue: #5c92ec; --nt-violet: #a08aea; --nt-lilac: #c9aee6; --nt-pink: #f08cbb;
    --nt-brown: #c19273; --nt-graphite: #9aa3af;
}
.db-note-dot { display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 3px; background: var(--c, var(--nt-slate)); }

.ap-shell--dark .nt-root {
    color-scheme: dark;
    --nt-slate: #94a3b8; --nt-sage: #8fbf9f; --nt-teal: #55bcc2; --nt-sky: #7db0ee; --nt-indigo: #8d90e6;
    --nt-plum: #c08ad2; --nt-rose: #ee8fa8; --nt-amber: #ecbf62; --nt-clay: #e0a085; --nt-stone: #b3ada3;
    --nt-red: #ee7a7a; --nt-coral: #f29a88; --nt-orange: #f0ae5e; --nt-yellow: #e6d062;
    --nt-lime: #b0d56a; --nt-green: #7cc486; --nt-mint: #6fd3b8; --nt-cyan: #5fcfe8;
    --nt-blue: #5c92ec; --nt-violet: #a08aea; --nt-lilac: #c9aee6; --nt-pink: #f08cbb;
    --nt-brown: #c19273; --nt-graphite: #9aa3af;
    --nt-tint: 20%;
    --nt-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 22px rgba(0, 0, 0, .35);
}

/* Colour keys: each sets --c for itself and everything inside it. */
.nt-c-slate { --c: var(--nt-slate); }
.nt-c-sage { --c: var(--nt-sage); }
.nt-c-teal { --c: var(--nt-teal); }
.nt-c-sky { --c: var(--nt-sky); }
.nt-c-indigo { --c: var(--nt-indigo); }
.nt-c-plum { --c: var(--nt-plum); }
.nt-c-rose { --c: var(--nt-rose); }
.nt-c-amber { --c: var(--nt-amber); }
.nt-c-clay { --c: var(--nt-clay); }
.nt-c-stone { --c: var(--nt-stone); }
.nt-c-red { --c: var(--nt-red); }
.nt-c-coral { --c: var(--nt-coral); }
.nt-c-orange { --c: var(--nt-orange); }
.nt-c-yellow { --c: var(--nt-yellow); }
.nt-c-lime { --c: var(--nt-lime); }
.nt-c-green { --c: var(--nt-green); }
.nt-c-mint { --c: var(--nt-mint); }
.nt-c-cyan { --c: var(--nt-cyan); }
.nt-c-blue { --c: var(--nt-blue); }
.nt-c-violet { --c: var(--nt-violet); }
.nt-c-lilac { --c: var(--nt-lilac); }
.nt-c-pink { --c: var(--nt-pink); }
.nt-c-brown { --c: var(--nt-brown); }
.nt-c-graphite { --c: var(--nt-graphite); }

/* ---- top bar ---------------------------------------------------------- */
.nt-top {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--ap-border);
    background: var(--nt-surface);
}

.nt-title { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: .2px; }

.nt-search {
    position: relative;
    flex: 1;
    max-width: 440px;
}

.nt-search .rzi {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: var(--ap-text-muted);
    pointer-events: none;
}

.nt-search input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--ap-border);
    border-radius: 10px;
    background: var(--nt-surface-2);
    color: var(--ap-text);
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}

.nt-search input:focus {
    outline: none;
    border-color: var(--c, var(--ap-accent));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ap-accent) 22%, transparent);
}

/* ---- buttons / chips -------------------------------------------------- */
.nt-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border: 1px solid var(--ap-border);
    border-radius: 9px;
    background: var(--nt-surface);
    color: var(--ap-text);
    font: inherit;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .1s;
}

.nt-btn:hover:not(:disabled) { background: color-mix(in srgb, var(--ap-accent) 10%, var(--nt-surface)); }
.nt-btn:active:not(:disabled) { transform: translateY(1px); }
.nt-btn:disabled { opacity: .5; cursor: default; }
.nt-btn--primary { background: var(--ap-accent); border-color: transparent; color: var(--ap-active-text); }
.nt-btn--primary:hover:not(:disabled) { background: color-mix(in srgb, var(--ap-accent) 88%, var(--ap-text)); }
.nt-btn--ghost { border-color: transparent; background: transparent; padding: 4px 6px; color: var(--ap-text-muted); }
.nt-btn .rzi { font-size: 18px; }

.nt-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 9px;
    border-radius: 99px;
    border: 1px solid color-mix(in srgb, var(--c) 38%, transparent);
    background: color-mix(in srgb, var(--c) var(--nt-tint), var(--nt-surface));
    color: var(--ap-text);
    font-size: 12px;
    line-height: 1.6;
}

/* ---- three-pane grid -------------------------------------------------- */
.nt-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 250px 320px minmax(0, 1fr);
    background: var(--ap-bg);
}

.nt-rail, .nt-list, .nt-pane { min-height: 0; overflow-y: auto; }

/* ---- rail ------------------------------------------------------------- */
.nt-rail {
    padding: 12px 8px 20px;
    background: var(--nt-surface);
    border-right: 1px solid var(--ap-border);
}

.nt-rail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 8px 8px;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ap-text-muted);
}

.nt-nb-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 9px;
    cursor: pointer;
    user-select: none;
}

.nt-nb-row:hover { background: var(--nt-surface-2); }

.nt-spine {
    flex: none;
    width: 12px;
    height: 17px;
    border-radius: 3px 6px 6px 3px;
    background: var(--c);
    box-shadow: inset -2px 0 0 rgba(0, 0, 0, .12);
}

.nt-nb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.nt-count { font-size: 12px; color: var(--ap-text-muted); }
.nt-chevron { font-size: 18px; color: var(--ap-text-muted); transition: transform .15s; }
.nt-chevron--open { transform: rotate(90deg); }

.nt-sec {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 1px 0 1px 20px;
    padding: 5px 10px;
    border-left: 3px solid transparent;
    border-radius: 0 8px 8px 0;
    color: var(--ap-text-muted);
    cursor: pointer;
    transition: background .12s;
}

.nt-sec:hover { background: var(--nt-surface-2); color: var(--ap-text); }

.nt-sec--on {
    border-left-color: var(--c);
    background: color-mix(in srgb, var(--c) var(--nt-tint), var(--nt-surface));
    color: var(--ap-text);
    font-weight: 600;
}

.nt-sec-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nt-add-link {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 2px 0 6px 20px;
    padding: 4px 10px;
    border: 0;
    background: none;
    color: var(--ap-text-muted);
    font: inherit;
    font-size: 12.5px;
    cursor: pointer;
    border-radius: 7px;
}

.nt-add-link:hover { color: var(--ap-text); background: var(--nt-surface-2); }
.nt-add-link .rzi { font-size: 16px; }

.nt-inline-form {
    margin: 4px 4px 8px;
    padding: 10px;
    border: 1px solid var(--ap-border);
    border-radius: var(--nt-radius);
    background: var(--nt-surface-2);
}

.nt-inline-form input[type="text"] {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--ap-border);
    border-radius: 8px;
    background: var(--nt-surface);
    color: var(--ap-text);
    font: inherit;
}

.nt-inline-form input[type="text"]:focus { outline: none; border-color: var(--c); }
.nt-swatches { display: flex; flex-wrap: wrap; gap: 6px; margin: 9px 0; }

.nt-swatch {
    width: 20px;
    height: 20px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 50%;
    background: var(--c);
    cursor: pointer;
    transition: transform .12s;
}

.nt-swatch:hover { transform: scale(1.15); }
.nt-swatch--inherit { display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 2px dashed var(--ap-text-muted); color: var(--ap-text-muted); }
.nt-swatch--inherit .rzi { font-size: 13px; color: inherit; }
.nt-colour-pill { gap: 6px; }
.nt-colour-dot { display: inline-block; width: 11px; height: 11px; border-radius: 4px; background: var(--c); }
.nt-menu--colour { padding: 10px; width: 232px; }
.nt-menu--colour .nt-swatches { margin: 0 0 8px; }
.nt-swatch[aria-pressed="true"] { border-color: var(--ap-text); box-shadow: 0 0 0 2px var(--nt-surface); }
.nt-form-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---- page list -------------------------------------------------------- */
.nt-list {
    padding: 14px 12px 20px;
    background: var(--nt-surface-2);
    border-right: 1px solid var(--ap-border);
}

.nt-list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 2px 12px; }
.nt-list-title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; font-weight: 650; min-width: 0; }
.nt-list-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nt-card {
    display: block;
    width: 100%;
    margin-bottom: 9px;
    padding: 11px 13px;
    border: 1px solid var(--ap-border);
    border-left: 4px solid var(--c);
    border-radius: var(--nt-radius);
    background: var(--nt-surface);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: box-shadow .15s, transform .15s, border-color .15s;
}

.nt-card:hover { box-shadow: var(--nt-shadow); transform: translateY(-1px); }
.nt-card--on { border-color: color-mix(in srgb, var(--c) 60%, var(--ap-border)); border-left-color: var(--c); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 28%, transparent); }
.nt-card-title { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.nt-card-title .rzi { font-size: 16px; color: var(--c); }
.nt-card-snippet { margin: 3px 0 8px; font-size: 12.5px; color: var(--ap-text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* Child notes: indented under their parent, with a chevron to expand or collapse (as in Tasks). */
.nt-card--d1 { margin-left: 18px; width: calc(100% - 18px); }
.nt-card--d2 { margin-left: 36px; width: calc(100% - 36px); }
.nt-card--d3 { margin-left: 54px; width: calc(100% - 54px); }
.nt-card--d4 { margin-left: 72px; width: calc(100% - 72px); }
.nt-card--d5 { margin-left: 90px; width: calc(100% - 90px); }
.nt-chev { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 20px; cursor: pointer; color: var(--ap-text-muted); transition: transform 0.2s, color 0.15s; }
.nt-chev .rzi { font-size: 18px; color: inherit; }
.nt-chev--leaf { visibility: hidden; pointer-events: none; }
.nt-chev--open { transform: rotate(90deg); color: var(--ap-accent); }
.nt-chip--parent { display: inline-flex; align-items: center; gap: 3px; }
.nt-chip--parent .rzi { font-size: 14px; }
.nt-card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--ap-text-muted); }

/* ---- editor pane ------------------------------------------------------ */
/* The open page tints its header area with its colour (own, or inherited from its parent). */
.nt-pane { background: linear-gradient(to bottom, color-mix(in srgb, var(--c) var(--nt-tint), var(--nt-surface)) 0, var(--nt-surface) 230px) var(--nt-surface); }
.nt-pane-inner { max-width: 780px; margin: 0 auto; padding: 22px 36px 60px; }
.nt-crumb { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; font-size: 12.5px; color: var(--ap-text-muted); }
.nt-crumb i { width: 9px; height: 9px; border-radius: 3px; background: var(--c); }
.nt-page-title { margin: 4px 0 10px; font-size: 30px; font-weight: 650; letter-spacing: -.3px; }
.nt-props { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 20px; font-size: 12.5px; color: var(--ap-text-muted); }
.nt-body-text { white-space: pre-wrap; line-height: 1.65; }
.nt-note { margin-top: 24px; padding: 12px 14px; border: 1px dashed var(--ap-border); border-radius: var(--nt-radius); color: var(--ap-text-muted); font-size: 13px; }

/* ---- empty states ----------------------------------------------------- */
.nt-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 100%;
    padding: 30px;
    text-align: center;
    color: var(--ap-text-muted);
}

.nt-empty .rzi { font-size: 44px; color: color-mix(in srgb, var(--c) 70%, var(--ap-text-muted)); }
.nt-empty h3 { margin: 0; color: var(--ap-text); font-size: 17px; }
.nt-empty p { margin: 0; max-width: 320px; font-size: 13.5px; }

/* ---- narrow windows: rail and list stack above the pane ---------------- */
@media (max-width: 1100px) {
    .nt-body { grid-template-columns: 220px minmax(0, 1fr); }
    .nt-pane { grid-column: 1 / -1; border-top: 1px solid var(--ap-border); min-height: 360px; }
}

@media (max-width: 720px) {
    .nt-body { grid-template-columns: minmax(0, 1fr); grid-auto-rows: max-content; overflow-y: auto; }
    .nt-rail, .nt-list, .nt-pane { overflow: visible; min-height: auto; border-right: 0; }
    .nt-top { flex-wrap: wrap; }
    .nt-pane-inner { padding: 18px 16px 40px; }
}

@media (prefers-reduced-motion: reduce) {
    .nt-root * { transition: none !important; }
}

/* ==========================================================================
   Editor (Tiptap). Classes prefixed nte- are created by notes-editor.bundle.js.
   ========================================================================== */
.nt-title-input {
    display: block;
    width: 100%;
    margin: 2px 0 6px;
    padding: 2px 0;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--ap-text);
    font: inherit;
    font-size: 30px;
    font-weight: 650;
    letter-spacing: -.3px;
    transition: border-color .15s;
}

.nt-title-input:focus { outline: none; border-bottom-color: color-mix(in srgb, var(--c) 55%, transparent); }
.nt-title-input::placeholder { color: var(--ap-text-muted); opacity: .6; }
.nt-props--chips { margin-bottom: 6px; }

.nte { display: flex; flex-direction: column; }

.nte-toolbar {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 10px;
    margin: 0 -6px 14px;
    padding: 6px;
    border: 1px solid var(--ap-border);
    border-radius: var(--nt-radius);
    background: var(--nt-surface-2);
    box-shadow: var(--nt-shadow);
}

.nte-group { display: flex; align-items: center; gap: 1px; }
.nte-group + .nte-group { padding-left: 10px; border-left: 1px solid var(--ap-border); }
.nte-group[hidden], .nte-linkbar[hidden] { display: none; }

.nte-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 6px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ap-text-muted);
    cursor: pointer;
    transition: background .12s, color .12s;
}

.nte-btn .material-icons-outlined { font-size: 19px; }
.nte-btn--text { font: inherit; font-size: 12.5px; font-weight: 650; }
.nte-btn:hover:not(:disabled) { background: color-mix(in srgb, var(--ap-accent) 12%, transparent); color: var(--ap-text); }
.nte-btn.is-active { background: color-mix(in srgb, var(--c) 22%, transparent); color: var(--ap-text); }
.nte-btn:disabled { opacity: .35; cursor: default; }

.nte-linkbar { display: flex; gap: 8px; margin: -6px 0 12px; }

.nte-linkbar input {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid var(--ap-border);
    border-radius: 8px;
    background: var(--nt-surface);
    color: var(--ap-text);
    font: inherit;
}

.nte-linkbar input:focus { outline: none; border-color: var(--c); }
.nte-link-btn { padding: 6px 12px; border: 1px solid var(--ap-border); border-radius: 8px; background: var(--nt-surface); color: var(--ap-text); font: inherit; cursor: pointer; }

.nte-surface { min-height: 340px; }

.nte-content { min-height: 340px; outline: none; line-height: 1.7; font-size: 15.5px; word-wrap: break-word; }
.nte-content > * + * { margin-top: .65em; }
.nte-content p { margin: 0; }
.nte-content h1 { font-size: 1.7em; line-height: 1.25; margin-top: 1.1em; }
.nte-content h2 { font-size: 1.35em; line-height: 1.3; margin-top: 1em; }
.nte-content h3 { font-size: 1.12em; line-height: 1.35; margin-top: .9em; }
.nte-content h1, .nte-content h2, .nte-content h3 { font-weight: 650; }
.nte-content ul, .nte-content ol { padding-left: 1.5em; margin: 0; }
.nte-content li > p { margin: 0; }
.nte-content a { color: var(--ap-accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.nte-content mark { background: color-mix(in srgb, var(--nt-amber) 38%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
.nte-content code { padding: 1px 5px; border-radius: 5px; background: var(--nt-surface-2); border: 1px solid var(--ap-border); font-size: .9em; }
.nte-content pre { padding: 12px 14px; border-radius: var(--nt-radius); background: var(--nt-surface-2); border: 1px solid var(--ap-border); overflow-x: auto; }
.nte-content pre code { padding: 0; border: 0; background: none; }
.nte-content blockquote { margin-left: 0; padding: 2px 0 2px 14px; border-left: 3px solid var(--c); color: var(--ap-text-muted); }
.nte-content hr { border: 0; border-top: 1px solid var(--ap-border); margin: 1.2em 0; }

.nte-content ul[data-type="taskList"] { list-style: none; padding-left: 2px; }
.nte-content ul[data-type="taskList"] li { display: flex; align-items: flex-start; gap: 9px; }
.nte-content ul[data-type="taskList"] li > label { flex: none; margin-top: .32em; user-select: none; }
.nte-content ul[data-type="taskList"] li > label input { width: 16px; height: 16px; accent-color: var(--c); cursor: pointer; }
.nte-content ul[data-type="taskList"] li > div { flex: 1; min-width: 0; }
.nte-content ul[data-type="taskList"] li[data-checked="true"] > div { color: var(--ap-text-muted); text-decoration: line-through; }

.nte-content table { width: 100%; border-collapse: collapse; table-layout: fixed; margin: .8em 0; }
.nte-content th, .nte-content td { min-width: 60px; padding: 7px 10px; border: 1px solid var(--ap-border); vertical-align: top; text-align: left; }
.nte-content th { background: var(--nt-surface-2); font-weight: 650; }
.nte-content .selectedCell { background: color-mix(in srgb, var(--c) 18%, transparent); }

.nte-content p.is-editor-empty:first-child::before {
    content: attr(data-placeholder);
    float: left;
    height: 0;
    color: var(--ap-text-muted);
    opacity: .7;
    pointer-events: none;
}

.nte-footer { display: flex; justify-content: space-between; margin-top: 18px; padding-top: 8px; border-top: 1px solid var(--ap-border); font-size: 12px; color: var(--ap-text-muted); }

/* Slash menu: appended to <body>, so it re-declares what it needs rather than inheriting from .nt-root. */
.nte-slash {
    position: fixed;
    z-index: 10000;
    width: 260px;
    padding: 6px;
    border: 1px solid var(--ap-border);
    border-radius: 12px;
    background: var(--ap-card-bg);
    color: var(--ap-text);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
    font-size: 13.5px;
}

.nte-slash[hidden] { display: none; }

.nte-slash-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 9px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.nte-slash-item .material-icons-outlined { font-size: 18px; color: var(--ap-text-muted); }
.nte-slash-item.is-on, .nte-slash-item:hover { background: color-mix(in srgb, var(--ap-accent) 14%, transparent); }
.nte-slash-title { flex: 1; }
.nte-slash-item small { color: var(--ap-text-muted); }

/* ==========================================================================
   View toggle, board, overlay, undo bar and drag-and-drop feedback
   ========================================================================== */
.nt-seg { display: inline-flex; margin-left: auto; border: 1px solid var(--ap-border); border-radius: 10px; overflow: hidden; }
.nt-seg button { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border: 0; background: var(--nt-surface); color: var(--ap-text-muted); font: inherit; cursor: pointer; transition: background .12s, color .12s; }
.nt-seg button .rzi { font-size: 18px; }
.nt-seg button:hover { color: var(--ap-text); }
.nt-seg .nt-seg-on { background: color-mix(in srgb, var(--ap-accent) 16%, var(--nt-surface)); color: var(--ap-text); font-weight: 600; }

.nt-body--board { grid-template-columns: 250px minmax(0, 1fr); }

.nt-board-wrap { min-height: 0; overflow-y: auto; padding: 14px 20px 24px; background: var(--ap-bg); }
.nt-board { columns: 4 230px; column-gap: 14px; }

.nt-bcard {
    display: block;
    break-inside: avoid;
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid color-mix(in srgb, var(--c) 32%, transparent);
    border-radius: 14px;
    background: color-mix(in srgb, var(--c) var(--nt-tint), var(--nt-surface));
    box-shadow: var(--nt-shadow);
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
}

.nt-bcard:hover { transform: translateY(-3px); }
.nt-bcard-title { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.nt-bcard-title .rzi { font-size: 16px; color: var(--c); }
.nt-bcard-snippet { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 8px; font-size: 13px; color: var(--ap-text-muted); }

/* Above the app's top bar (z-index 100), so a dialog's own header and close button are never hidden under it. */
.nt-overlay { position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(10, 14, 30, .55); }
.nt-overlay-card { position: relative; display: flex; width: min(900px, 100%); max-height: calc(100vh - 48px); border-radius: 18px; overflow: hidden; background: var(--nt-surface); box-shadow: 0 24px 70px rgba(0, 0, 0, .45); }
.nt-overlay-card .nt-pane { flex: 1; }
.nt-overlay-close { position: absolute; top: 10px; right: 10px; z-index: 5; }

.nt-undo { position: fixed; left: 50%; bottom: 26px; z-index: 160; display: flex; align-items: center; gap: 14px; transform: translateX(-50%); padding: 9px 12px 9px 18px; border-radius: 12px; background: var(--ap-text); color: var(--ap-bg); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); font-size: 13.5px; }
.nt-undo .nt-btn { padding: 4px 12px; }

/* Drag feedback (classes are toggled by notesDnd.js). */
.nt-dragging { opacity: .45; }
.nt-is-dragging [data-drag-kind] { cursor: grabbing; }
.nt-drop-before, .nt-drop-after { position: relative; }
.nt-drop-before::before, .nt-drop-after::after { content: ""; position: absolute; left: 4px; right: 4px; height: 3px; border-radius: 2px; background: var(--ap-accent); pointer-events: none; z-index: 2; }
.nt-drop-before::before { top: -5px; }
.nt-drop-after::after { bottom: -5px; }
.nt-sec.nt-drop-into, .nt-nb-row.nt-drop-into, .nt-bin-link.nt-drop-into { background: color-mix(in srgb, var(--ap-accent) 20%, transparent); outline: 2px dashed var(--ap-accent); outline-offset: -2px; }
.nt-list.nt-drop-into, .nt-board-wrap.nt-drop-into { box-shadow: inset 0 -4px 0 var(--ap-accent); }
/* Dropping onto a page card makes the dragged page its child (same cue as the Tasks page). */
.nt-card.nt-drop-into, .nt-bcard.nt-drop-into { box-shadow: inset 0 0 0 2px var(--ap-accent); background: color-mix(in srgb, var(--ap-accent) 10%, transparent); }

@media (max-width: 720px) {
    .nt-body--board { grid-template-columns: minmax(0, 1fr); }
    .nt-seg { margin-left: 0; }
}

/* ==========================================================================
   Filter row and the status / project / tag pickers
   ========================================================================== */
.nt-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 20px; border-bottom: 1px solid var(--ap-border); background: var(--nt-surface); }
.nt-filters-label { display: inline-flex; align-items: center; gap: 4px; margin-right: 2px; font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--ap-text-muted); }
.nt-filters-label .rzi { font-size: 16px; }

.nt-select {
    padding: 5px 28px 5px 10px;
    border: 1px solid var(--ap-border);
    border-radius: 9px;
    background-color: var(--nt-surface-2);
    color: var(--ap-text);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.nt-select:focus { outline: none; border-color: var(--ap-accent); }
.nt-select:has(option:checked:not([value=""])) { border-color: color-mix(in srgb, var(--ap-accent) 60%, var(--ap-border)); background-color: color-mix(in srgb, var(--ap-accent) 12%, var(--nt-surface-2)); }

.nt-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 2px 0 14px; }
.nt-pick { position: relative; }

.nt-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
    border-radius: 99px;
    background: color-mix(in srgb, var(--c) var(--nt-tint), var(--nt-surface));
    color: var(--ap-text);
    font: inherit;
    font-size: 12.5px;
    cursor: pointer;
    transition: background .12s, border-color .12s;
}

.nt-pill .rzi { font-size: 15px; }
.nt-pill:hover { border-color: color-mix(in srgb, var(--c) 70%, transparent); }
.nt-pill--empty { --c: var(--nt-slate); border-style: dashed; background: transparent; color: var(--ap-text-muted); }
.nt-pill--empty:hover { color: var(--ap-text); }

.nt-chip--tag { padding-right: 3px; }
.nt-chip-x { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; opacity: .6; cursor: pointer; }
.nt-chip-x .rzi { font-size: 13px; }
.nt-chip-x:hover { opacity: 1; background: color-mix(in srgb, var(--c) 30%, transparent); }

.nt-backdrop { position: fixed; inset: 0; z-index: 20; }

.nt-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 21;
    min-width: 200px;
    max-width: 280px;
    padding: 5px;
    border: 1px solid var(--ap-border);
    border-radius: 12px;
    background: var(--nt-surface);
    box-shadow: var(--nt-shadow), 0 12px 30px rgba(0, 0, 0, .18);
}

.nt-menu--scroll { max-height: 280px; overflow-y: auto; }

.nt-menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 7px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ap-text);
    font: inherit;
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
}

.nt-menu-item:hover { background: color-mix(in srgb, var(--ap-accent) 12%, transparent); }
.nt-menu-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-menu-item .rzi { font-size: 17px; color: var(--ap-text-muted); }
.nt-menu-item--muted { color: var(--ap-text-muted); }
.nt-menu-item--create { color: var(--ap-accent); }
.nt-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.nt-menu-note { padding: 8px 10px; font-size: 12.5px; color: var(--ap-text-muted); }
.nt-menu-input { width: 100%; margin-bottom: 4px; padding: 7px 10px; border: 1px solid var(--ap-border); border-radius: 8px; background: var(--nt-surface-2); color: var(--ap-text); font: inherit; font-size: 13.5px; }
.nt-menu-input:focus { outline: none; border-color: var(--ap-accent); }

/* ==========================================================================
   Row options (rename / delete), page options, danger items
   ========================================================================== */
.nt-row-wrap { position: relative; }

.nt-more {
    position: absolute;
    top: 50%;
    right: 4px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--ap-text-muted);
    cursor: pointer;
    opacity: 0;
    transform: translateY(-50%);
    transition: opacity .12s, background .12s;
}

.nt-more .rzi { font-size: 19px; }
.nt-row-wrap:hover .nt-more, .nt-more:focus-visible, .nt-more[aria-expanded="true"] { opacity: 1; }
.nt-more:hover { background: color-mix(in srgb, var(--ap-accent) 14%, transparent); color: var(--ap-text); }
.nt-row-wrap:hover .nt-count { visibility: hidden; }

@media (hover: none) {
    .nt-more { opacity: 1; }
    .nt-row-wrap .nt-count { visibility: visible; }
}

.nt-menu--right { left: auto; right: 4px; }
.nt-row-wrap .nt-menu { top: calc(100% - 2px); }
.nt-menu-item--danger, .nt-menu-item--danger .rzi { color: var(--nt-rose); }
.nt-menu-item--danger:hover { background: color-mix(in srgb, var(--nt-rose) 16%, transparent); }

.nt-pick--end { margin-left: auto; }
.nt-pill--icon { padding: 3px 6px; }

/* ==========================================================================
   Template gallery, fill-in step, details form
   ========================================================================== */
.nt-btn-pair { display: inline-flex; }
.nt-btn-pair .nt-btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.nt-btn--attached { padding: 7px 8px; border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 1px solid color-mix(in srgb, var(--ap-active-text) 30%, transparent); }

.nt-overlay-card--wide { width: min(1040px, 100%); height: min(660px, calc(100vh - 48px)); }
.nt-overlay-card--narrow { width: min(520px, 100%); }

.nt-gal { display: grid; grid-template-columns: 210px minmax(0, 1fr); width: 100%; min-height: 0; }
.nt-gal-side { padding: 16px 10px; overflow-y: auto; background: var(--nt-surface-2); border-right: 1px solid var(--ap-border); }
.nt-gal-head { margin: 14px 10px 6px; font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--ap-text-muted); }

.nt-gal-cat { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--ap-text-muted); font: inherit; text-align: left; cursor: pointer; }
.nt-gal-cat:hover { background: color-mix(in srgb, var(--ap-accent) 10%, transparent); color: var(--ap-text); }
.nt-gal-cat--on { background: color-mix(in srgb, var(--ap-accent) 16%, transparent); color: var(--ap-text); font-weight: 600; }
.nt-gal-cat span:not(.nt-gal-dot) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-gal-cat small { color: var(--ap-text-muted); }
.nt-gal-cat .rzi { font-size: 18px; }
.nt-gal-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ap-text-muted); opacity: .5; }

.nt-gal-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 16px 22px 0; }
.nt-gal-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.nt-gal-search { flex: 1; max-width: none; }
.nt-gal-title { flex: 1; margin: 0; font-size: 18px; font-weight: 650; }
.nt-gal-close { margin-left: auto; }
.nt-gal-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 4px 24px; }
.nt-gal-group { margin: 18px 0 10px; font-size: 12px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--ap-text-muted); }
.nt-gal-group:first-child { margin-top: 4px; }
.nt-gal-lead { margin: 0 0 14px; color: var(--ap-text-muted); font-size: 13.5px; }
.nt-gal-lead code { padding: 0 3px; border-radius: 4px; background: var(--nt-surface-2); font-size: .92em; }
.nt-gal-note { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--ap-accent) 10%, transparent); font-size: 13px; }
.nt-gal-note .rzi { font-size: 18px; color: var(--ap-accent); }
.nt-gal-note span { flex: 1; }
.nt-gal-fill { max-width: 520px; }

.nt-tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 16px; margin-bottom: 4px; }

.nt-tpl { position: relative; cursor: pointer; }
.nt-tpl b { display: block; margin-top: 8px; font-size: 13.5px; }
.nt-tpl small { display: block; color: var(--ap-text-muted); font-size: 12px; line-height: 1.35; }

.nt-tpl-pv {
    position: relative;
    height: 168px;
    padding: 12px 12px 0 16px;
    overflow: hidden;
    border: 1px solid var(--ap-border);
    border-radius: 12px;
    background: var(--nt-surface);
    font-size: 6.5px;
    line-height: 1.5;
    color: var(--ap-text);
    transition: transform .15s, box-shadow .15s, border-color .15s;
    user-select: none;
}

.nt-tpl-pv::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c); }
.nt-tpl-pv::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 46px; background: linear-gradient(to bottom, transparent, var(--nt-surface)); pointer-events: none; }
.nt-tpl:hover .nt-tpl-pv, .nt-tpl:focus-visible .nt-tpl-pv { transform: translateY(-3px); box-shadow: var(--nt-shadow); border-color: color-mix(in srgb, var(--c) 55%, var(--ap-border)); }
.nt-tpl-pv h2 { margin: .7em 0 .3em; font-size: 9px; color: color-mix(in srgb, var(--c) 80%, var(--ap-text)); }
.nt-tpl-pv p { margin: 0 0 .3em; }
.nt-tpl-pv ul, .nt-tpl-pv ol { margin: 0 0 .3em; padding-left: 1.4em; }
.nt-tpl-pv ul[data-type="taskList"] { list-style: none; padding-left: 0; }
.nt-tpl-pv ul[data-type="taskList"] li { display: flex; gap: 4px; }
.nt-tpl-pv ul[data-type="taskList"] input { width: 6px; height: 6px; margin: 2px 0 0; }
.nt-tpl-pv table { width: 100%; border-collapse: collapse; }
.nt-tpl-pv th, .nt-tpl-pv td { padding: 2px 3px; border: 1px solid var(--ap-border); }
.nt-tpl-pv--blank { display: flex; align-items: center; justify-content: center; font-size: inherit; }
.nt-tpl-pv--blank .rzi { font-size: 40px; color: var(--ap-text-muted); }
.nt-tpl-pv--blank::after { display: none; }
.nt-tpl-badge { position: absolute; top: 8px; right: 8px; z-index: 2; padding: 1px 7px; border-radius: 99px; background: var(--ap-accent); color: var(--ap-active-text); font-size: 10px; font-weight: 600; }

.nt-tpl-more { position: absolute; top: 6px; left: 8px; z-index: 3; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 7px; background: color-mix(in srgb, var(--nt-surface) 85%, transparent); color: var(--ap-text-muted); cursor: pointer; opacity: 0; transition: opacity .12s; }
.nt-tpl-more .rzi { font-size: 18px; }
.nt-tpl:hover .nt-tpl-more, .nt-tpl-more:focus-visible { opacity: 1; }
.nt-tpl .nt-menu { top: 32px; left: 8px; right: auto; }

.nt-field { display: block; margin-bottom: 12px; }
.nt-field > span { display: block; margin-bottom: 4px; font-size: 12.5px; font-weight: 600; color: var(--ap-text-muted); }
.nt-field small { font-weight: 400; }
.nt-field input[type="text"] { width: 100%; padding: 8px 11px; border: 1px solid var(--ap-border); border-radius: 9px; background: var(--nt-surface-2); color: var(--ap-text); font: inherit; }
.nt-field input[type="text"]:focus { outline: none; border-color: var(--c, var(--ap-accent)); }
.nt-check { display: flex; align-items: center; gap: 8px; margin: 4px 0 14px; font-size: 13px; cursor: pointer; }
.nt-check input { accent-color: var(--ap-accent); }
.nt-tform { max-width: 480px; }
.nt-save-tpl { width: 100%; padding: 22px 26px; overflow-y: auto; }

@media (max-width: 760px) {
    .nt-gal { grid-template-columns: minmax(0, 1fr); }
    .nt-gal-side { display: flex; gap: 4px; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--ap-border); }
    .nt-gal-side .nt-gal-head { display: none; }
    .nt-gal-cat { width: auto; flex: none; }
}

/* ==========================================================================
   Recycle bin
   ========================================================================== */
.nt-bin-link { display: flex; align-items: center; gap: 6px; width: calc(100% - 16px); margin: 14px 8px 0; padding: 8px 10px; border: 0; border-top: 1px solid var(--ap-border); border-radius: 0 0 9px 9px; background: none; color: var(--ap-text-muted); font: inherit; font-size: 13px; cursor: pointer; }
.nt-bin-link:hover { color: var(--ap-text); background: var(--nt-surface-2); }
.nt-bin-link .rzi { font-size: 18px; }

.nt-overlay-card--bin { width: min(680px, 100%); height: min(560px, calc(100vh - 48px)); }
.nt-bin { display: flex; flex-direction: column; width: 100%; min-height: 0; padding: 20px 24px 8px; }
.nt-bin-top { display: flex; align-items: center; gap: 10px; }
.nt-bin-top .nt-gal-title { display: flex; align-items: center; gap: 8px; }
.nt-bin-scroll { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 16px; }

.nt-bin-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; padding: 10px 12px; border: 1px solid var(--ap-border); border-radius: var(--nt-radius); background: var(--nt-surface-2); }
.nt-bin-bar { flex: none; align-self: stretch; width: 4px; border-radius: 2px; background: var(--c); }
.nt-bin-info { flex: 1; min-width: 0; }
.nt-bin-info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-bin-info small { display: block; color: var(--ap-text-muted); font-size: 12px; }
.nt-bin-snippet { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; font-size: 12.5px; color: var(--ap-text-muted); }

/* ==========================================================================
   Attachments and inline images
   ========================================================================== */
.nte-content img { display: block; max-width: 100%; height: auto; margin: .6em 0; border-radius: 10px; border: 1px solid var(--ap-border); }
.nte-content img.ProseMirror-selectednode { outline: 2px solid var(--ap-accent); outline-offset: 2px; }

.nt-att { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--ap-border); }
.nt-att-title { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; font-size: 13px; font-weight: 650; letter-spacing: .02em; color: var(--ap-text-muted); }
.nt-att-title .rzi { font-size: 18px; }

.nt-att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; margin-bottom: 14px; }

.nt-att-card { position: relative; overflow: hidden; border: 1px solid var(--ap-border); border-radius: 12px; background: var(--nt-surface-2); transition: box-shadow .15s, transform .15s; }
.nt-att-card:hover { box-shadow: var(--nt-shadow); transform: translateY(-2px); }
.nt-att-preview { display: block; height: 92px; background: var(--nt-surface); }
.nt-att-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.nt-att-meta { padding: 7px 9px 8px; }
.nt-att-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ap-text); font-size: 12.5px; text-decoration: none; }
.nt-att-name:hover { text-decoration: underline; }
.nt-att-size { display: block; font-size: 11.5px; color: var(--ap-text-muted); }

.nt-att-remove { position: absolute; top: 5px; right: 5px; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--nt-surface) 88%, transparent); color: var(--ap-text-muted); cursor: pointer; opacity: 0; transition: opacity .12s; }
.nt-att-remove .rzi { font-size: 15px; }
.nt-att-card:hover .nt-att-remove, .nt-att-remove:focus-visible { opacity: 1; }
.nt-att-remove:hover { color: var(--nt-rose); }

.nt-att-actions { display: flex; align-items: stretch; gap: 10px; }
.nt-att-drop { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 14px; border: 2px dashed var(--ap-border); border-radius: var(--nt-radius); color: var(--ap-text-muted); font-size: 13px; cursor: pointer; transition: border-color .12s, background .12s; }
.nt-att-drop:hover, .nt-att-drop--on { border-color: var(--ap-accent); background: color-mix(in srgb, var(--ap-accent) 8%, transparent); color: var(--ap-text); }
.nt-att-hint { display: inline-flex; align-items: center; gap: 7px; }
.nt-att-hint .rzi { font-size: 19px; }
.nt-att-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

/* ==========================================================================
   Tag manager
   ========================================================================== */
.nt-tagman { padding-bottom: 0; }
.nt-tagman .nt-tform, .nt-tagman .nt-inline-form { margin: 0 0 12px; }
.nt-tagman-add { margin-bottom: 12px; }
.nt-tagman .nt-bin-row .nt-chip { flex: none; font-size: 13px; padding: 2px 11px; }
.nt-btn--danger { color: var(--nt-rose); }
.nt-btn--danger:hover:not(:disabled) { background: color-mix(in srgb, var(--nt-rose) 16%, var(--nt-surface)); }
.nt-filters-end { margin-left: auto; }

/* ==========================================================================
   Version history
   ========================================================================== */
.nt-overlay-card--history { width: min(980px, 100%); height: min(640px, calc(100vh - 48px)); }
.nt-ver { display: flex; flex-direction: column; width: 100%; min-height: 0; padding: 20px 24px 0; }
.nt-ver-top { margin-bottom: 14px; }
.nt-ver-top .nt-gal-title { display: flex; align-items: center; gap: 8px; }
.nt-ver-body-wrap { flex: 1; min-height: 0; display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 18px; padding-bottom: 20px; }

.nt-ver-list { margin: 0; padding: 0 4px 0 0; list-style: none; overflow-y: auto; }
.nt-ver-item { display: block; width: 100%; margin-bottom: 8px; padding: 10px 12px; border: 1px solid var(--ap-border); border-radius: var(--nt-radius); background: var(--nt-surface-2); color: inherit; font: inherit; text-align: left; cursor: pointer; transition: border-color .12s, background .12s; }
.nt-ver-item:hover { border-color: color-mix(in srgb, var(--ap-accent) 50%, var(--ap-border)); }
.nt-ver-item--on { border-color: var(--ap-accent); background: color-mix(in srgb, var(--ap-accent) 12%, var(--nt-surface)); }
.nt-ver-item b { display: block; font-size: 13px; }
.nt-ver-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.nt-ver-snippet { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 2px 0 4px; font-size: 12.5px; color: var(--ap-text-muted); }
.nt-ver-item small { color: var(--ap-text-muted); font-size: 11.5px; }

.nt-ver-preview { min-width: 0; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--ap-border); border-radius: var(--nt-radius); background: var(--nt-surface); overflow: hidden; }
.nt-ver-preview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px 0; }
.nt-ver-preview-head h3 { margin: 0 0 2px; font-size: 17px; }
.nt-ver-preview-head small { color: var(--ap-text-muted); }
.nt-ver-note { margin: 8px 16px 10px; padding-bottom: 10px; border-bottom: 1px solid var(--ap-border); font-size: 12.5px; color: var(--ap-text-muted); }
.nt-ver-view { flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px 16px; font-size: 14.5px; }

@media (max-width: 760px) {
    .nt-ver-body-wrap { grid-template-columns: minmax(0, 1fr); grid-template-rows: 180px minmax(0, 1fr); }
}

/* ==========================================================================
   Due dates and reminders
   ========================================================================== */
.nt-chip--due .rzi { font-size: 14px; }
.nt-menu--dates { min-width: 260px; padding: 12px; display: grid; gap: 10px; }
.nt-menu--dates input { width: 100%; }

/* ==========================================================================
   Text colour: palette keys on spans, themed by the --nt-* tokens (light and dark)
   ========================================================================== */
.nte-colourbar { display: flex; align-items: center; gap: 8px; margin: -6px 0 12px; }
.nte-colourbar[hidden] { display: none; }
.nte-swatch { width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 2px solid var(--ap-border); background: var(--c); cursor: pointer; }
.nte-swatch:hover { border-color: var(--ap-text); }
.nte-content span[data-color="slate"] { color: var(--nt-slate); }
.nte-content span[data-color="sage"] { color: var(--nt-sage); }
.nte-content span[data-color="teal"] { color: var(--nt-teal); }
.nte-content span[data-color="sky"] { color: var(--nt-sky); }
.nte-content span[data-color="indigo"] { color: var(--nt-indigo); }
.nte-content span[data-color="plum"] { color: var(--nt-plum); }
.nte-content span[data-color="rose"] { color: var(--nt-rose); }
.nte-content span[data-color="amber"] { color: var(--nt-amber); }
.nte-content span[data-color="clay"] { color: var(--nt-clay); }
.nte-content span[data-color="stone"] { color: var(--nt-stone); }
.nte-content span[data-color="red"] { color: var(--nt-red); }
.nte-content span[data-color="coral"] { color: var(--nt-coral); }
.nte-content span[data-color="orange"] { color: var(--nt-orange); }
.nte-content span[data-color="yellow"] { color: var(--nt-yellow); }
.nte-content span[data-color="lime"] { color: var(--nt-lime); }
.nte-content span[data-color="green"] { color: var(--nt-green); }
.nte-content span[data-color="mint"] { color: var(--nt-mint); }
.nte-content span[data-color="cyan"] { color: var(--nt-cyan); }
.nte-content span[data-color="blue"] { color: var(--nt-blue); }
.nte-content span[data-color="violet"] { color: var(--nt-violet); }
.nte-content span[data-color="lilac"] { color: var(--nt-lilac); }
.nte-content span[data-color="pink"] { color: var(--nt-pink); }
.nte-content span[data-color="brown"] { color: var(--nt-brown); }
.nte-content span[data-color="graphite"] { color: var(--nt-graphite); }

/* Hidden frame used to print a page for "Save as PDF". */
.nt-print-frame { position: fixed; width: 0; height: 0; border: 0; }

/* Cards are sized to their column, so padding and border never push them past it. */
.nt-card, .nt-bcard { box-sizing: border-box; }

/* The Notes assistant bar sits between the header and the filters. */
.nt-ai { padding: 10px 20px 0; background: var(--nt-surface); }

/* ---- Keep-style view: a wall of full-colour cards, with a quick-add bar and a Pinned group ---- */
.nt-keep-wrap { padding: 14px 16px 28px; min-width: 0; overflow-y: auto; }
.nt-btn--on { background: color-mix(in srgb, var(--ap-accent) 16%, var(--nt-surface)); border-color: color-mix(in srgb, var(--ap-accent) 50%, var(--ap-border)); color: var(--ap-text); }
.nt-keep-add { max-width: 560px; margin: 0 auto 22px; border: 1px solid var(--ap-border); border-radius: 12px; background: var(--nt-surface); box-shadow: var(--nt-shadow); }
.nt-keep-add-bar { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 12px 16px; border: 0; background: transparent; color: var(--ap-text-muted); font: inherit; text-align: left; cursor: text; }
.nt-keep-add--open { padding: 10px 14px 8px; }
.nt-keep-add input.nt-keep-add-title, .nt-keep-add textarea.nt-keep-add-text { width: 100%; padding: 6px 2px; border: 0; background: transparent; color: var(--ap-text); font: inherit; resize: vertical; }
.nt-keep-add input.nt-keep-add-title { font-weight: 600; }
.nt-keep-add input:focus, .nt-keep-add textarea:focus { outline: none; }
.nt-keep-add-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.nt-keep-target { margin-left: auto; font-size: 12px; color: var(--ap-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-keep-group { margin: 6px 4px 8px; font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ap-text-muted); }
.nt-keep-grid { column-width: 250px; column-gap: 14px; margin-bottom: 18px; }
.nt-kcard { position: relative; display: inline-block; width: 100%; box-sizing: border-box; margin: 0 0 14px; padding: 12px 14px 10px; break-inside: avoid; border: 1px solid color-mix(in srgb, var(--c) 45%, var(--ap-border)); border-radius: 12px; background: color-mix(in srgb, var(--c) 22%, var(--nt-surface)); color: var(--ap-text); cursor: pointer; transition: box-shadow .15s, transform .15s; }
.nt-kcard:hover { box-shadow: var(--nt-shadow); transform: translateY(-1px); }
.nt-kcard.nt-dragging { opacity: .45; }
.nt-kpin { position: absolute; top: 6px; right: 6px; display: inline-flex; padding: 3px; border: 0; border-radius: 50%; background: transparent; color: var(--ap-text-muted); cursor: pointer; opacity: 0; transition: opacity .12s; }
.nt-kpin .rzi { font-size: 18px; color: inherit; }
.nt-kcard:hover .nt-kpin, .nt-kcard:focus-within .nt-kpin, .nt-kcard--pinned .nt-kpin { opacity: 1; }
.nt-kcard--pinned .nt-kpin { color: var(--c); }
.nt-kcard-title { display: block; margin: 0 22px 6px 0; font-size: 15px; overflow-wrap: anywhere; }
.nt-kline { margin: 2px 0; font-size: 13.5px; line-height: 1.4; overflow-wrap: anywhere; }
.nt-kline--heading { font-weight: 650; }
.nt-kline--bullet, .nt-kline--number { padding-left: 14px; position: relative; }
.nt-kline--bullet::before, .nt-kline--number::before { content: "\2022"; position: absolute; left: 3px; color: var(--ap-text-muted); }
.nt-kline--code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; opacity: .85; }
.nt-kcheck { display: flex; align-items: flex-start; gap: 8px; margin: 3px 0; font-size: 13.5px; line-height: 1.4; cursor: pointer; }
.nt-kcheck input { flex-shrink: 0; margin-top: 3px; accent-color: var(--c); cursor: pointer; }
.nt-kcheck span { overflow-wrap: anywhere; }
.nt-kcheck--done span { text-decoration: line-through; color: var(--ap-text-muted); }
.nt-kmore { color: var(--ap-text-muted); letter-spacing: .2em; line-height: 1; }
.nt-kdone { display: flex; align-items: center; gap: 4px; margin: 8px 0 2px; padding: 4px 0; width: 100%; border: 0; border-top: 1px solid color-mix(in srgb, var(--c) 35%, var(--ap-border)); background: transparent; color: var(--ap-text-muted); font: inherit; font-size: 12.5px; text-align: left; cursor: pointer; }
.nt-kdone .rzi { font-size: 18px; color: inherit; }
.nt-kmeta { margin-top: 8px; }
@media (max-width: 900px) { .nt-keep-wrap { padding: 12px 10px 24px; } }

/* ---- Save and Cancel on the page editor, and the colour palette on a Keep card ---- */
.nt-editor-actions { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.nt-editor-actions .nt-btn { padding: 5px 14px; }
.nt-unsaved { color: var(--nt-amber); font-size: 12px; font-weight: 600; }
.nt-kpalette { position: absolute; top: 6px; right: 34px; display: inline-flex; padding: 3px; border: 0; border-radius: 50%; background: transparent; color: var(--ap-text-muted); cursor: pointer; opacity: 0; transition: opacity .12s; }
.nt-kpalette .rzi { font-size: 18px; color: inherit; }
.nt-kcard:hover .nt-kpalette, .nt-kcard:focus-within .nt-kpalette, .nt-kcard--menu .nt-kpalette { opacity: 1; }
.nt-kcard--menu { z-index: 30; }
.nt-kcard .nt-menu--colour { position: absolute; top: 34px; right: 6px; z-index: 31; cursor: default; }

/* The Keep quick-add bar's checklist composer: a tick box, the text, and a remove button on each row. */
.nt-kq-items { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 4px; }
.nt-kq-row { display: flex; align-items: center; gap: 8px; }
.nt-kq-check { flex-shrink: 0; width: 16px; height: 16px; accent-color: var(--c, var(--ap-accent)); cursor: pointer; }
.nt-keep-add input.nt-kq-text { flex: 1; min-width: 0; padding: 5px 2px; border: 0; background: transparent; color: var(--ap-text); font: inherit; }
.nt-kq-row--done input.nt-kq-text { text-decoration: line-through; color: var(--ap-text-muted); }
.nt-kq-x { display: inline-flex; padding: 3px; border: 0; border-radius: 50%; background: transparent; color: var(--ap-text-muted); cursor: pointer; opacity: 0; transition: opacity .12s; }
.nt-kq-x .rzi { font-size: 16px; color: inherit; }
.nt-kq-row:hover .nt-kq-x, .nt-kq-row:focus-within .nt-kq-x { opacity: 1; }
.nt-kq-add { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; margin: 2px 0 0 24px; padding: 4px 6px; border: 0; background: transparent; color: var(--ap-text-muted); font: inherit; font-size: 13px; cursor: pointer; }
.nt-kq-add .rzi { font-size: 16px; color: inherit; }
.nt-kq-add:hover { color: var(--ap-text); }

/* The view tablets each have their own colour, always showing; the one you are on is filled in more strongly. */
.nt-seg button { --vc: var(--nt-slate); background: color-mix(in srgb, var(--vc) 26%, var(--nt-surface)); }
.nt-seg .nt-seg-pages { --vc: var(--nt-sky); }
.nt-seg .nt-seg-board { --vc: var(--nt-green); }
.nt-seg .nt-seg-keep { --vc: var(--nt-amber); }
.nt-seg button:hover { background: color-mix(in srgb, var(--vc) 36%, var(--nt-surface)); }
.nt-seg button .rzi { color: var(--vc); }
.nt-seg .nt-seg-on { background: color-mix(in srgb, var(--vc) 55%, var(--nt-surface)); box-shadow: inset 0 -3px 0 var(--vc); }

/* The Keep header: All notes beside the New page and Templates pair. */
.nt-keep-head-actions { display: inline-flex; align-items: center; gap: 10px; }

/* A notebook's own notes: the notebook row is selectable, and its chevron is a separate target. */
.nt-nb-row--on { background: color-mix(in srgb, var(--c) 18%, var(--nt-surface-2)); box-shadow: inset 3px 0 0 var(--c); }
.nt-chev-hit { display: inline-flex; align-items: center; justify-content: center; margin: -4px 0 -4px -4px; padding: 4px; border-radius: 6px; cursor: pointer; }
.nt-chev-hit:hover { background: color-mix(in srgb, var(--ap-text) 10%, transparent); }
