/* ============================================================================
   Brainy — "Archival Mind" design system
   Warm editorial knowledge sanctuary: bone paper, espresso ink, clay accent.
   Display: Fraunces (serif).  Body/UI: Hanken Grotesk.
   ========================================================================== */

:root {
    --paper: #f3ede1;
    --paper-raised: #fcfaf4;
    --paper-sunk: #ece3d3;
    --ink: #211d17;
    --ink-soft: #6b6253;
    --ink-faint: #71695d;
    --line: #ded5c4;
    --line-strong: #cabea8;

    --clay: #c0561d;
    --clay-deep: #9c4416;
    --clay-soft: rgba(192, 86, 29, 0.10);
    --clay-ring: rgba(192, 86, 29, 0.28);

    --espresso: #1d1812;
    --espresso-2: #2a2017;
    --gold: #cd9a3a;
    --sage: #6f7a5a;

    --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
    --font-body: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --shadow-sm: 0 1px 2px rgba(33, 29, 23, 0.06), 0 2px 8px rgba(33, 29, 23, 0.05);
    --shadow-md: 0 4px 12px rgba(33, 29, 23, 0.08), 0 12px 32px rgba(33, 29, 23, 0.10);
    --shadow-lg: 0 18px 50px rgba(29, 24, 18, 0.28);

    --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.45'/%3E%3C/svg%3E");

    /* App bar (dark espresso bar in the Brainy theme) */
    --appbar-text: #f4ece0;
    --appbar-text-soft: rgba(244, 236, 224, 0.78);
    --appbar-text-faint: rgba(244, 236, 224, 0.45);
    --appbar-line: rgba(244, 236, 224, 0.16);
    --appbar-chip-bg: rgba(255, 255, 255, 0.07);
    --appbar-chip-bg-hover: rgba(255, 255, 255, 0.12);
    --appbar-overlay-bg: #201a14;
    --appbar-overlay-line: rgba(255, 255, 255, 0.08);
}

/* ============================================================================
   "Minimal" theme — Notion-inspired.
   Flat white workspace, warm graphite ink (#37352f), Notion blue accent
   (#2383e2), system UI font stack everywhere, hairline borders, no grain.
   ========================================================================== */
:root[data-theme="minimal"] {
    --paper: #ffffff;
    --paper-raised: #ffffff;
    --paper-sunk: #f7f7f5;
    --ink: #37352f;
    --ink-soft: #787774;
    --ink-faint: #706f6b;
    --line: #ededec;
    --line-strong: #e0e0de;

    /* Accent: Notion blue */
    --clay: #2383e2;
    --clay-deep: #1a73c7;
    --clay-soft: rgba(35, 131, 226, 0.10);
    --clay-ring: rgba(35, 131, 226, 0.28);

    /* Formerly-dark accents: keep them readable as ink in Minimal */
    --espresso: #37352f;
    --espresso-2: #57554f;
    --gold: #cb912f;   /* Notion's warm "brown/orange" callout tone */
    --sage: #448361;   /* Notion green */

    /* Notion's actual UI stack: system fonts, sans-serif everywhere */
    --font-display: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, 'Apple Color Emoji', Arial, sans-serif;
    --font-body: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, 'Apple Color Emoji', Arial, sans-serif;

    --shadow-sm: rgba(15, 15, 15, 0.03) 0 0 0 1px, rgba(15, 15, 15, 0.06) 0 2px 4px;
    --shadow-md: rgba(15, 15, 15, 0.04) 0 0 0 1px, rgba(15, 15, 15, 0.06) 0 3px 6px, rgba(15, 15, 15, 0.09) 0 9px 24px;
    --shadow-lg: rgba(15, 15, 15, 0.05) 0 0 0 1px, rgba(15, 15, 15, 0.08) 0 5px 10px, rgba(15, 15, 15, 0.12) 0 15px 40px;
    --grain: none;

    /* App bar is white in Minimal, so its text must flip to ink */
    --appbar-text: #37352f;
    --appbar-text-soft: rgba(55, 53, 47, 0.75);
    --appbar-text-faint: rgba(55, 53, 47, 0.45);
    --appbar-line: rgba(55, 53, 47, 0.14);
    --appbar-chip-bg: rgba(55, 53, 47, 0.045);
    --appbar-chip-bg-hover: rgba(55, 53, 47, 0.08);
    --appbar-overlay-bg: #ffffff;
    --appbar-overlay-line: rgba(55, 53, 47, 0.1);
}

/* Minimal: soften the drawer and typographic weight the Notion way */
:root[data-theme="minimal"] .brainy-drawer .mud-navmenu .mud-nav-link.active {
    background: rgba(55, 53, 47, 0.06);
    color: var(--ink);
}

:root[data-theme="minimal"] h1,
:root[data-theme="minimal"] h2,
:root[data-theme="minimal"] h3,
:root[data-theme="minimal"] .mud-typography-h1,
:root[data-theme="minimal"] .mud-typography-h2,
:root[data-theme="minimal"] .mud-typography-h3 {
    letter-spacing: -0.01em;
}

/* ============================================================================
   "Dracula" theme — based on the official Dracula theme for Visual Studio Code
   (https://draculatheme.com / https://github.com/dracula/visual-studio-code).
   Deep indigo background (#282a36), crisp foreground (#f8f8f2), and the
   signature purple/pink/cyan/green/orange accent set. Paired with
   MudThemeProvider's IsDarkMode and Theme.PaletteDark (see AppThemes.cs).
   ========================================================================== */
:root[data-theme="dracula"] {
    --paper: #282a36;
    --paper-raised: #343746;
    --paper-sunk: #21222c;
    --ink: #f8f8f2;
    --ink-soft: #a0a8c8;
    --ink-faint: rgba(98, 114, 164, 0.75);
    --line: #44475a;
    --line-strong: rgba(248, 248, 242, 0.18);

    /* Accent: Dracula purple. Pink/cyan/green/orange are also available via
       the MudBlazor palette (Secondary/Tertiary/Success/Warning). */
    --clay: #bd93f9;
    --clay-deep: #9d7ae6;
    --clay-soft: rgba(189, 147, 249, 0.14);
    --clay-ring: rgba(189, 147, 249, 0.38);

    --espresso: #191a21;
    --espresso-2: #21222c;
    --gold: #ffb86c;
    --sage: #50fa7b;

    --font-display: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, 'Apple Color Emoji', Arial, sans-serif;
    --font-body: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, 'Apple Color Emoji', Arial, sans-serif;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.40), 0 12px 32px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.55);
    --grain: none;

    /* App bar is near-black in Dracula, so text stays the Dracula foreground */
    --appbar-text: #f8f8f2;
    --appbar-text-soft: rgba(248, 248, 242, 0.75);
    --appbar-text-faint: rgba(248, 248, 242, 0.45);
    --appbar-line: rgba(248, 248, 242, 0.14);
    --appbar-chip-bg: rgba(248, 248, 242, 0.06);
    --appbar-chip-bg-hover: rgba(248, 248, 242, 0.11);
    --appbar-overlay-bg: #191a21;
    --appbar-overlay-line: rgba(248, 248, 242, 0.08);
}

/* Dracula: nav-link hover needs a light overlay since the drawer is dark */
:root[data-theme="dracula"] .brainy-drawer .mud-navmenu .mud-nav-link:hover:not(.active) {
    background: rgba(248, 248, 242, 0.06);
    color: var(--ink);
}

/* ============================================================================
   "Midnight Blush" theme — based on the community VS Code theme
   (https://github.com/MdUsmanAnsari/midnight-blush). Deep navy background
   (#1c1f2b), soft lavender-gray foreground (#d4d7e3), and a rose/purple
   accent set. Paired with MudThemeProvider's IsDarkMode and Theme.PaletteDark
   (see AppThemes.cs).
   ========================================================================== */
:root[data-theme="midnightblush"] {
    --paper: #1c1f2b;
    --paper-raised: #1e293b;
    --paper-sunk: #171a24;
    --ink: #d4d7e3;
    --ink-soft: #94a3b8;
    --ink-faint: rgba(105, 112, 152, 0.75);
    --line: #252837;
    --line-strong: rgba(212, 215, 227, 0.18);

    /* Accent: "blush" rose. Purple/teal/sage/gold are also available via
       the MudBlazor palette (Secondary/Tertiary/Success/Warning). */
    --clay: #db2777;
    --clay-deep: #ba2165;
    --clay-soft: rgba(219, 39, 119, 0.14);
    --clay-ring: rgba(219, 39, 119, 0.38);

    --espresso: #14151d;
    --espresso-2: #171a24;
    --gold: #ffeb95;
    --sage: #a9c77d;

    --font-display: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, 'Apple Color Emoji', Arial, sans-serif;
    --font-body: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, 'Apple Color Emoji', Arial, sans-serif;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.40), 0 12px 32px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.55);
    --grain: none;

    /* App bar is near-black in Midnight Blush, so text stays near-white */
    --appbar-text: #f9f9fb;
    --appbar-text-soft: rgba(249, 249, 251, 0.75);
    --appbar-text-faint: rgba(249, 249, 251, 0.45);
    --appbar-line: rgba(249, 249, 251, 0.14);
    --appbar-chip-bg: rgba(249, 249, 251, 0.06);
    --appbar-chip-bg-hover: rgba(249, 249, 251, 0.11);
    --appbar-overlay-bg: #14151d;
    --appbar-overlay-line: rgba(249, 249, 251, 0.08);
}

/* Midnight Blush: nav-link hover needs a light overlay since the drawer is dark */
:root[data-theme="midnightblush"] .brainy-drawer .mud-navmenu .mud-nav-link:hover:not(.active) {
    background: rgba(212, 215, 227, 0.06);
    color: var(--ink);
}

/* ─────────────────────────────────────────────────────────────────────────
   Auth experience: split-screen shell
   ───────────────────────────────────────────────────────────────────────── */

.auth-shell {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--paper);
    overflow: auto;
}

/* Brand / left panel ------------------------------------------------------ */
.auth-brand {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(2rem, 4vw, 4.25rem);
    color: #f4ece0;
    background:
        radial-gradient(120% 90% at 12% 8%, rgba(205, 154, 58, 0.20) 0%, transparent 46%),
        radial-gradient(140% 120% at 92% 100%, rgba(192, 86, 29, 0.30) 0%, transparent 50%),
        linear-gradient(155deg, #241d15 0%, var(--espresso) 48%, #161109 100%);
    isolation: isolate;
}

.auth-brand::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--grain);
    background-size: 160px 160px;
    opacity: 0.5;
    mix-blend-mode: overlay;
    pointer-events: none;
    z-index: 3;
}

/* faint constellation lines sit above gradient, below content */
.auth-brand__art {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.auth-brand__art line {
    stroke: rgba(244, 236, 224, 0.16);
    stroke-width: 1;
}

.auth-brand__art .node {
    fill: rgba(244, 236, 224, 0.55);
}

.auth-brand__art .node--accent {
    fill: var(--gold);
    filter: drop-shadow(0 0 6px rgba(205, 154, 58, 0.65));
    animation: nodePulse 4.2s ease-in-out infinite;
}

.auth-brand__art .node--clay {
    fill: var(--clay);
    filter: drop-shadow(0 0 7px rgba(192, 86, 29, 0.7));
    animation: nodePulse 5.6s ease-in-out infinite 1.1s;
}

@keyframes nodePulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}

.auth-brand > * {
    position: relative;
    z-index: 2;
}

.auth-wordmark {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.6rem;
    letter-spacing: -0.01em;
    color: #f7f0e6;
}

.auth-wordmark__logo {
    display: block;
    width: 2.4rem;
    height: 2.4rem;
    object-fit: contain;
}

.auth-hero {
    max-width: 30ch;
}

.auth-hero__eyebrow {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 1.25rem;
}

.auth-hero__title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(2.1rem, 3.4vw, 3.35rem);
    line-height: 1.04;
    letter-spacing: -0.02em;
    margin: 0 0 1.1rem;
    color: #faf4ea;
}

.auth-hero__title em {
    font-style: italic;
    color: var(--gold);
}

.auth-hero__lead {
    font-size: 1.02rem;
    line-height: 1.6;
    color: rgba(244, 236, 224, 0.74);
    margin: 0;
}

.auth-code {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.4rem;
    margin-top: 2rem;
    padding: 0;
    list-style: none;
}

.auth-code li {
    position: relative;
    padding-left: 1.1rem;
    font-size: 0.86rem;
    letter-spacing: 0.04em;
    color: rgba(244, 236, 224, 0.66);
}

.auth-code li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.5em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--clay);
}

.auth-brand__footer {
    font-size: 0.8rem;
    color: rgba(244, 236, 224, 0.45);
    letter-spacing: 0.02em;
}

/* Form / right panel ------------------------------------------------------ */
.auth-panel {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.5rem, 4vw, 3.5rem);
    background:
        radial-gradient(130% 80% at 100% 0%, rgba(192, 86, 29, 0.05) 0%, transparent 45%),
        var(--paper);
}

.auth-panel__inner {
    width: 100%;
    max-width: 25.5rem;
    animation: authRise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes authRise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--clay);
}

.auth-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.9rem, 3vw, 2.4rem);
    line-height: 1.08;
    letter-spacing: -0.02em;
    margin: 0.5rem 0 0.4rem;
    color: var(--ink);
}

.auth-subtitle {
    font-size: 0.96rem;
    color: var(--ink-soft);
    margin: 0 0 2rem;
}

/* mobile-only compact brand header (hidden on desktop) */
.auth-minibrand {
    display: none;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.75rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--ink);
}

.auth-minibrand .auth-wordmark__logo {
    width: 2rem;
    height: 2rem;
}

/* Form fields ------------------------------------------------------------- */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.brainy-field {
    display: flex;
    flex-direction: column;
}

.brainy-label {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    margin-bottom: 0.45rem;
    color: var(--ink);
}

.brainy-input {
    width: 100%;
    padding: 0.78rem 0.95rem;
    font-family: var(--font-body);
    font-size: 0.98rem;
    line-height: 1.4;
    color: var(--ink);
    background: var(--paper-raised);
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    box-shadow: inset 0 1px 2px rgba(33, 29, 23, 0.04);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.brainy-input::placeholder {
    color: var(--ink-faint);
}

.brainy-input:focus {
    outline: none;
    background: #fff;
    border-color: var(--clay);
    box-shadow: 0 0 0 4px var(--clay-ring), inset 0 1px 2px rgba(33, 29, 23, 0.04);
}

.brainy-input.invalid {
    border-color: #b3401b;
    box-shadow: 0 0 0 4px rgba(179, 64, 27, 0.16);
}

.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: -0.15rem;
}

.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    color: var(--ink-soft);
    cursor: pointer;
    user-select: none;
}

.auth-check input[type="checkbox"] {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--clay);
    cursor: pointer;
}

.validation-message {
    color: #a73a16;
    font-size: 0.8rem;
    margin-top: 0.35rem;
}

/* Buttons ----------------------------------------------------------------- */
.brainy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.85rem 1.25rem;
    margin-top: 0.35rem;
    font-family: var(--font-body);
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #fff;
    cursor: pointer;
    border: none;
    border-radius: 11px;
    background: linear-gradient(150deg, var(--clay) 0%, var(--clay-deep) 100%);
    box-shadow: 0 8px 20px rgba(156, 68, 22, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.22);
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.brainy-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.04);
    box-shadow: 0 12px 26px rgba(156, 68, 22, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.brainy-btn:active {
    transform: translateY(0);
    box-shadow: 0 6px 14px rgba(156, 68, 22, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.brainy-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--clay-ring), 0 8px 20px rgba(156, 68, 22, 0.30);
}

/* Divider + switch link --------------------------------------------------- */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.75rem 0 1.25rem;
    color: var(--ink-faint);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.auth-switch {
    text-align: center;
    font-size: 0.92rem;
    color: var(--ink-soft);
}

.auth-switch a {
    color: var(--clay);
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.16s ease;
}

.auth-switch a:hover {
    border-bottom-color: var(--clay);
}

/* Status alert ------------------------------------------------------------ */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.8rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.88rem;
    line-height: 1.45;
    border-radius: 11px;
    border: 1px solid;
}

.auth-alert--error {
    color: #7c2d10;
    background: rgba(192, 86, 29, 0.08);
    border-color: rgba(192, 86, 29, 0.30);
}

.auth-alert--success {
    color: #3f5230;
    background: rgba(111, 122, 90, 0.12);
    border-color: rgba(111, 122, 90, 0.34);
}

/* Responsive -------------------------------------------------------------- */
@media (max-width: 860px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-brand {
        display: none;
    }

    .auth-minibrand {
        display: inline-flex;
    }

    .auth-panel {
        align-items: flex-start;
        padding-top: clamp(2.5rem, 10vw, 4rem);
    }
}

/* ─────────────────────────────────────────────────────────────────────────
   Today / Home — editorial dashboard
   ───────────────────────────────────────────────────────────────────────── */

.today {
    font-family: var(--font-body);
    color: var(--ink);
}

.today__eyebrow {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--clay);
    margin-bottom: 0.5rem;
}

.today__title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(2rem, 4vw, 2.9rem);
    line-height: 1.06;
    letter-spacing: -0.02em;
    margin: 0 0 0.6rem;
    color: var(--ink);
}

.today__title em {
    font-style: italic;
    color: var(--clay);
}

.today__lead {
    font-size: 1.02rem;
    color: var(--ink-soft);
    max-width: 52ch;
    margin: 0 0 2.25rem;
}

.today-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.1rem;
}

.today-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1.5rem 1.35rem;
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.today-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(var(--clay), var(--clay-deep));
    opacity: 0;
    transition: opacity 0.2s ease;
}

.today-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--line-strong);
}

.today-card:hover::before {
    opacity: 1;
}

.today-card__icon {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    margin-bottom: 1.1rem;
    border-radius: 12px;
    background: var(--clay-soft);
    color: var(--clay);
}

.today-card__title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.2rem;
    letter-spacing: -0.01em;
    margin: 0 0 0.3rem;
}

.today-card__desc {
    font-size: 0.9rem;
    color: var(--ink-soft);
    line-height: 1.5;
    margin: 0 0 1.1rem;
}

.today-card__cta {
    margin-top: auto;
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--clay);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: gap 0.18s ease;
}

.today-card:hover .today-card__cta {
    gap: 0.7rem;
}

/* ─────────────────────────────────────────────────────────────────────────
   App shell — appbar, drawer, user menu
   ───────────────────────────────────────────────────────────────────────── */

body {
    background: var(--paper);
    overflow-x: hidden;
}

.brainy-appbar {
    border-bottom: 1px solid var(--appbar-line);
    backdrop-filter: saturate(120%);
}

.brainy-appbar__brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    margin-left: 0.35rem;
    text-decoration: none;
    color: var(--appbar-text);
}

.brainy-appbar__logo {
    display: block;
    width: 1.95rem;
    height: 1.95rem;
    object-fit: contain;
}

.brainy-appbar__name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.3rem;
    letter-spacing: -0.01em;
}

.brainy-user {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-right: 0.85rem;
}

.brainy-user__avatar {
    display: grid;
    place-items: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    background: rgba(205, 154, 58, 0.22);
    border: 1px solid rgba(205, 154, 58, 0.5);
    color: var(--gold);
    font-weight: 700;
    font-size: 0.92rem;
}

:root[data-theme="minimal"] .brainy-user__avatar {
    background: var(--clay-soft);
    border-color: var(--clay-ring);
    color: var(--clay);
}

:root[data-theme="dracula"] .brainy-user__avatar {
    background: var(--clay-soft);
    border-color: var(--clay-ring);
    color: var(--clay);
}

:root[data-theme="midnightblush"] .brainy-user__avatar {
    background: var(--clay-soft);
    border-color: var(--clay-ring);
    color: var(--clay);
}

.brainy-user__email {
    font-size: 0.88rem;
    color: var(--appbar-text-soft);
    max-width: 18ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brainy-logout-form {
    margin: 0;
}

.brainy-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    font-family: var(--font-body);
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--appbar-text-soft);
    background: var(--appbar-chip-bg);
    border: 1px solid var(--appbar-line);
    border-radius: 9px;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.brainy-logout-btn:hover {
    color: #fff;
    background: var(--clay);
    border-color: var(--clay);
}

.brainy-logout-btn svg {
    display: block;
}

.brainy-drawer {
    border-right: 1px solid var(--line);
}

/* Nav menu refinements (MudNavMenu lives inside the drawer) */
.brainy-drawer .mud-navmenu .mud-nav-link {
    font-family: var(--font-body);
    font-weight: 500;
    border-radius: 9px;
    margin: 0.1rem 0.5rem;
    color: var(--ink-soft);
}

.brainy-drawer .mud-navmenu .mud-nav-link.active {
    background: var(--clay-soft);
    color: var(--clay-deep);
    font-weight: 600;
}

.brainy-drawer .mud-navmenu .mud-nav-link:hover:not(.active) {
    background: rgba(33, 29, 23, 0.04);
    color: var(--ink);
}

/* ─────────────────────────────────────────────────────────────────────────
   Note Editor — focused writing environment
   ───────────────────────────────────────────────────────────────────────── */

.note-editor {
    display: flex;
    flex-direction: column;
    gap: 0;
    animation: authRise 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Header ------------------------------------------------------------------ */
.note-editor__header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 2px solid var(--line);
    margin-bottom: 1.75rem;
}

.note-editor__back-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    margin-top: 0.55rem;
    background: var(--paper-sunk);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink-soft);
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.note-editor__back-btn:hover {
    background: var(--paper-raised);
    border-color: var(--line-strong);
    color: var(--ink);
    transform: translateX(-2px);
}

.note-editor__header-content {
    flex: 1;
    min-width: 0;
}

.note-editor__eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--clay);
    margin: 0 0 0.35rem;
}

.note-editor__title-input {
    display: block;
    width: 100%;
    font-family: var(--font-display);
    font-size: clamp(1.65rem, 3vw, 2.4rem);
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--ink);
    background: transparent;
    border: none;
    outline: none;
    padding: 0.2rem 0 0.4rem;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s ease;
}

.note-editor__title-input::placeholder {
    color: var(--ink-faint);
    font-style: italic;
}

.note-editor__title-input:focus {
    border-bottom-color: var(--clay);
}

.note-editor__title-input.invalid {
    border-bottom-color: #b3401b;
}

.note-editor__title-error {
    display: block;
    font-size: 0.8rem;
    color: #a73a16;
    margin-top: 0.3rem;
}

.note-editor__header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    padding-top: 0.55rem;
}

.note-editor__unsaved-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gold);
    white-space: nowrap;
}

.note-editor__unsaved-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gold);
    flex-shrink: 0;
    animation: unsavedPulse 2s ease-in-out infinite;
}

@keyframes unsavedPulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

.note-editor__saved-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--sage);
    white-space: nowrap;
}

.note-editor__saved-badge::before {
    content: "✓";
    font-size: 0.85rem;
}

.note-editor__save-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(150deg, var(--clay) 0%, var(--clay-deep) 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(156, 68, 22, 0.28), inset 0 1px 0 rgba(255,255,255,0.22);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
    white-space: nowrap;
}

.note-editor__save-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(156, 68, 22, 0.36), inset 0 1px 0 rgba(255,255,255,0.22);
    filter: brightness(1.05);
}

.note-editor__save-btn:active:not(:disabled) {
    transform: translateY(0);
}

.note-editor__save-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.note-editor__save-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--clay-ring), 0 6px 16px rgba(156, 68, 22, 0.28);
}

/* Body layout ------------------------------------------------------------- */
.note-editor__body {
    display: grid;
    grid-template-columns: 1fr 272px;
    gap: 2rem;
    align-items: start;
}

.note-editor__main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Toolbar ----------------------------------------------------------------- */
.note-editor__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.55rem 0.85rem;
    background: var(--paper-sunk);
    border: 1px solid var(--line);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
}

.note-editor__tabs {
    display: flex;
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}

.note-editor__tab {
    padding: 0.28rem 0.85rem;
    font-family: var(--font-body);
    font-size: 0.83rem;
    font-weight: 500;
    color: var(--ink-soft);
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1.5;
}

.note-editor__tab.active {
    background: var(--paper-sunk);
    color: var(--ink);
    font-weight: 700;
    box-shadow: inset 0 1px 2px rgba(33,29,23,0.07);
}

.note-editor__format-tools {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
}

.note-editor__tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.4rem;
    font-family: var(--font-body);
    font-size: 0.82rem;
    color: var(--ink-soft);
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    line-height: 1;
}

.note-editor__tool:hover {
    background: var(--clay-soft);
    color: var(--clay-deep);
}

.note-editor__tool--mono {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    font-weight: 700;
}

.note-editor__tool-divider {
    display: inline-block;
    width: 1px;
    height: 1.2rem;
    background: var(--line-strong);
    margin: 0 0.2rem;
    flex-shrink: 0;
}

/* Textarea ----------------------------------------------------------------- */
.note-editor__textarea {
    display: block;
    width: 100%;
    min-height: 520px;
    padding: 1.5rem;
    font-family: 'Courier New', 'Menlo', 'Consolas', 'Monaco', monospace;
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--ink);
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: 0 0 12px 12px;
    resize: vertical;
    outline: none;
    box-shadow: inset 0 2px 6px rgba(33,29,23,0.04);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    tab-size: 2;
    caret-color: var(--clay);
}

.note-editor__textarea:focus {
    border-color: var(--clay);
    box-shadow: 0 0 0 3px var(--clay-ring), inset 0 2px 6px rgba(33,29,23,0.04);
}

.note-editor__textarea::placeholder {
    color: var(--ink-faint);
    font-style: italic;
}

/* Preview ----------------------------------------------------------------- */
.note-editor__preview {
    min-height: 520px;
    padding: 1.5rem;
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: 0 0 12px 12px;
    box-shadow: inset 0 2px 6px rgba(33,29,23,0.04);
}

.note-editor__preview-empty {
    color: var(--ink-faint);
    font-style: italic;
    font-size: 0.95rem;
    margin: 0;
}

/* Markdown body typesetting ----------------------------------------------- */
.markdown-body { color: var(--ink); }

.markdown-body h1, .markdown-body h2, .markdown-body h3,
.markdown-body h4, .markdown-body h5, .markdown-body h6 {
    font-family: var(--font-display);
    font-weight: 500;
    letter-spacing: -0.015em;
    color: var(--ink);
    line-height: 1.2;
    margin: 1.6rem 0 0.5rem;
}

.markdown-body h1:first-child,
.markdown-body h2:first-child,
.markdown-body h3:first-child { margin-top: 0; }

.markdown-body h1 { font-size: 1.85rem; }
.markdown-body h2 { font-size: 1.45rem; border-bottom: 1px solid var(--line); padding-bottom: 0.35rem; }
.markdown-body h3 { font-size: 1.18rem; }
.markdown-body p  { margin: 0 0 1rem; line-height: 1.72; }

.markdown-body strong { font-weight: 700; color: var(--ink); }
.markdown-body em     { font-style: italic; color: var(--ink-soft); }

.markdown-body img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    border: 1px solid var(--line);
    margin: 0.75rem 0;
    display: block;
}

.markdown-body blockquote {
    border-left: 3px solid var(--clay);
    margin: 1.1rem 0;
    padding: 0.55rem 1.1rem;
    background: var(--clay-soft);
    border-radius: 0 10px 10px 0;
    color: var(--ink-soft);
    font-style: italic;
}

.markdown-body blockquote p:last-child { margin-bottom: 0; }

.markdown-body code {
    font-family: 'Courier New', 'Menlo', monospace;
    font-size: 0.88em;
    padding: 0.15em 0.42em;
    background: var(--paper-sunk);
    border: 1px solid var(--line);
    border-radius: 5px;
    color: var(--clay-deep);
}

.markdown-body pre {
    background: var(--espresso);
    border-radius: 12px;
    padding: 1.1rem 1.4rem;
    overflow-x: auto;
    margin: 1.1rem 0;
    border: 1px solid rgba(244,236,224,0.06);
}

.markdown-body pre code {
    background: none;
    border: none;
    padding: 0;
    color: #f4ece0;
    font-size: 0.9rem;
    line-height: 1.65;
}

/* Minimal: code blocks are light Notion-style panels, so use ink text */
:root[data-theme="minimal"] .markdown-body pre {
    background: #f7f7f5;
    border-color: var(--line);
}

:root[data-theme="minimal"] .markdown-body pre code {
    color: var(--ink);
}

/* Dracula: crisp Dracula foreground for code text on the dark panel */
:root[data-theme="dracula"] .markdown-body pre code {
    color: #f8f8f2;
}

/* Midnight Blush: soft lavender-gray foreground for code text on the dark panel */
:root[data-theme="midnightblush"] .markdown-body pre code {
    color: #d4d7e3;
}

.markdown-body a {
    color: var(--clay);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: color 0.15s ease;
}

.markdown-body a:hover { color: var(--clay-deep); }

.markdown-body ul, .markdown-body ol {
    margin: 0 0 1rem 1.5rem;
    line-height: 1.7;
}

.markdown-body li { margin-bottom: 0.3rem; }

.markdown-body hr {
    border: none;
    border-top: 1px solid var(--line);
    margin: 1.75rem 0;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.93rem;
}

.markdown-body th {
    background: var(--paper-sunk);
    padding: 0.55rem 0.9rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid var(--line);
    color: var(--ink-soft);
}

.markdown-body td {
    padding: 0.55rem 0.9rem;
    border: 1px solid var(--line);
    vertical-align: top;
}

/* Sidebar ----------------------------------------------------------------- */
.note-editor__sidebar {
    display: flex;
    flex-direction: column;
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.note-editor__sidebar-section {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--line);
}

.note-editor__sidebar-section:last-child {
    border-bottom: none;
}

.note-editor__sidebar-heading {
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: 0 0 0.7rem;
}

.note-editor__sidebar-tip {
    font-size: 0.82rem;
    color: var(--ink-soft);
    line-height: 1.55;
    margin: 0;
}

.note-editor__sidebar-tip + .note-editor__sidebar-tip {
    margin-top: 0.6rem;
}

.note-editor__select-option {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.note-editor__select-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.note-editor__meta {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.note-editor__meta-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.note-editor__meta-label {
    color: var(--ink-faint);
    font-weight: 600;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.note-editor__meta-value {
    color: var(--ink-soft);
    text-align: right;
}

/* Linked notes sidebar section -------------------------------------------- */
.ned-links__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.7rem;
}

.ned-links__header .note-editor__sidebar-heading {
    margin-bottom: 0;
}

.ned-links__add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1.5px solid var(--line);
    border-radius: 6px;
    background: var(--paper-raised);
    cursor: pointer;
    color: var(--ink-soft);
    transition: border-color 0.14s ease, color 0.14s ease, background 0.14s ease;
    flex-shrink: 0;
}

.ned-links__add-btn:hover {
    border-color: var(--clay);
    color: var(--clay);
    background: var(--clay-soft);
}

.ned-links__add-icon {
    font-size: 0.95rem !important;
    width: 0.95rem !important;
    height: 0.95rem !important;
}

.ned-links__loading {
    display: flex;
    justify-content: center;
    padding: 0.5rem 0;
}

.ned-links__empty {
    font-size: 0.8rem;
    color: var(--ink-faint);
    margin: 0;
    font-style: italic;
}

.ned-links__list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.ned-links__item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.45rem;
}

.ned-links__type-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: rgba(192, 86, 29, 0.10);
    color: #c0561d;
    white-space: nowrap;
    flex-shrink: 0;
}

.ned-links__note-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--ink);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 2px;
    transition: color 0.12s ease, text-decoration-color 0.12s ease;
}

.ned-links__note-title:hover {
    color: var(--clay);
    text-decoration-color: var(--clay-ring);
}

.ned-links__remove {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ink-faint);
    padding: 2px;
    border-radius: 4px;
    transition: color 0.12s ease, background 0.12s ease;
    flex-shrink: 0;
}

.ned-links__remove:hover {
    color: #c0561d;
    background: rgba(192, 86, 29, 0.08);
}

.ned-links__remove-icon {
    font-size: 0.85rem !important;
    width: 0.85rem !important;
    height: 0.85rem !important;
}

/* Related notes sidebar section -------------------------------------------- */
.ned-related__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.7rem;
}

.ned-related__header .note-editor__sidebar-heading {
    margin-bottom: 0;
}

.ned-related__spinner {
    width: 14px !important;
    height: 14px !important;
}

.ned-related__list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.ned-related__item {
    display: grid;
    grid-template-columns: 8px 1fr auto;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    border-radius: 6px;
    padding: 0.35rem 0.4rem;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background 0.12s ease;
}

.ned-related__item:hover {
    background: var(--paper-sunk);
}

.ned-related__item-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ned-related__item-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ned-related__item:hover .ned-related__item-title {
    color: var(--clay);
}

.ned-related__item-score {
    font-size: 0.65rem;
    letter-spacing: -0.02em;
    color: var(--clay);
    opacity: 0.7;
    font-family: monospace;
    flex-shrink: 0;
}

/* ── Duplicate detection ---------------------------------------------------- */
.ned-dup__header {
    margin-bottom: 0.4rem;
}

.ned-dup__btn {
    width: 100%;
    justify-content: center !important;
}

.ned-dup__list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-top: 0.35rem;
}

.ned-dup__item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--paper-raised);
}

.ned-dup__title {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ned-dup__actions {
    display: flex;
    gap: 0.1rem;
    flex-wrap: wrap;
    margin-top: 0.05rem;
}

/* ── Highlights ------------------------------------------------------------- */
.ned-highlights__form {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.5rem;
}

.ned-highlights__layers {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.ned-highlights__layer-btn {
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--paper-raised);
    color: var(--ink);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.ned-highlights__layer-btn:hover,
.ned-highlights__layer-btn.active {
    background: var(--clay);
    border-color: var(--clay);
    color: #fff;
}

.ned-highlights__layer-btn--2:hover,
.ned-highlights__layer-btn--2.active {
    background: #d97706;
    border-color: #d97706;
    color: #fff;
}

.ned-highlights__layer-btn--3:hover,
.ned-highlights__layer-btn--3.active {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

.ned-highlights__list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.ned-highlights__item {
    align-items: flex-start !important;
    gap: 0.375rem !important;
}

.ned-highlights__layer-badge {
    flex-shrink: 0;
    padding: 0.1rem 0.375rem;
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: 3px;
    background: var(--line);
    color: var(--ink);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.ned-highlights__layer-badge--2 {
    background: #fef3c7;
    color: #92400e;
}

.ned-highlights__layer-badge--3 {
    background: #fee2e2;
    color: #991b1b;
}

.ned-highlights__content {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    flex: 1;
    min-width: 0;
}

.ned-highlights__text {
    font-size: 0.78rem;
    color: var(--ink);
    font-style: italic;
    line-height: 1.35;
    overflow-wrap: break-word;
}

.ned-highlights__annotation {
    font-size: 0.72rem;
    color: var(--clay);
    line-height: 1.3;
    overflow-wrap: break-word;
}

/* ── Images ----------------------------------------------------------------- */
.ned-images__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.ned-images__card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.ned-images__preview {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper-sunk);
    aspect-ratio: 16 / 10;
}

.ned-images__thumb {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ned-images__remove {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    background: rgba(255, 255, 255, 0.92);
}

.ned-images__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
}

.ned-images__name {
    font-size: 0.74rem;
    color: var(--ink-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ned-images__badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: var(--clay-soft);
    color: var(--clay);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* ── Summary Layers --------------------------------------------------------- */
.ned-summaries__form {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.5rem;
}

.ned-summaries__list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.ned-summaries__item {
    align-items: flex-start !important;
    gap: 0.375rem !important;
}

.ned-summaries__content {
    flex: 1;
    font-size: 0.78rem;
    color: var(--ink);
    line-height: 1.4;
    overflow-wrap: break-word;
    min-width: 0;
}

/* Loading / not-found states ---------------------------------------------- */
.note-editor-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5rem 2rem;
    gap: 1rem;
}

/* Responsive -------------------------------------------------------------- */
@media (max-width: 960px) {
    .note-editor__body {
        grid-template-columns: 1fr;
    }

    .note-editor__sidebar {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .note-editor__sidebar-section {
        flex: 1 1 220px;
        border-bottom: none;
        border-right: 1px solid var(--line);
    }

    .note-editor__sidebar-section:last-child {
        border-right: none;
    }
}

@media (max-width: 620px) {
    .note-editor__header { flex-wrap: wrap; }

    .note-editor__header-actions {
        width: 100%;
        justify-content: flex-end;
        padding-top: 0;
    }

    .note-editor__title-input { font-size: 1.5rem; }

    .note-editor__unsaved-badge { display: none; }

    .note-editor__sidebar-section {
        flex: 1 1 100%;
        border-right: none;
        border-bottom: 1px solid var(--line);
    }
}


/* ─────────────────────────────────────────────────────────────────────────
   Note Editor Dialog (ned) — editor inside a MudBlazor modal
   Reuses .note-editor__* classes; these rules handle dialog-specific layout.
   ───────────────────────────────────────────────────────────────────────── */

.ned {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ned__title-section {
    padding: 0.25rem 0 0;
}

/* Override the page-editor title input for the compact dialog header */
.ned .note-editor__title-input {
    font-size: clamp(1.35rem, 2.5vw, 1.9rem);
    padding-bottom: 0.3rem;
}

.ned__body {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 1.5rem;
    align-items: start;
}

.ned__main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Narrower textarea inside dialog */
.ned__textarea {
    min-height: 400px !important;
}

.ned__sidebar {
    flex-direction: column !important;    /* override the responsive row rule */
}

/* Inside dialog, sidebar sections always stack vertically */
.ned__sidebar .note-editor__sidebar-section {
    flex: unset !important;
    border-right: none !important;
    border-bottom: 1px solid var(--line) !important;
}

.ned__sidebar .note-editor__sidebar-section:last-child {
    border-bottom: none !important;
}

/* Dialog action area unsaved/saved badges align left */
.ned-actions-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: auto;
}

@media (max-width: 720px) {
    .ned__body {
        grid-template-columns: 1fr;
    }

    .ned__sidebar {
        flex-direction: row !important;
        flex-wrap: wrap;
    }

    .ned__sidebar .note-editor__sidebar-section {
        flex: 1 1 200px !important;
        border-bottom: none !important;
        border-right: 1px solid var(--line) !important;
    }

    .ned__sidebar .note-editor__sidebar-section:last-child {
        border-right: none !important;
    }
}


/* ─────────────────────────────────────────────────────────────────────────
   PARA Dashboard (.para-dash__)
   Four large Fraunces numerals anchored by category-color accent bars.
   ───────────────────────────────────────────────────────────────────────── */

.para-dash {
    padding: clamp(1.5rem, 3vw, 2.5rem) 0;
    font-family: var(--font-body);
}

.para-dash__header {
    margin-bottom: clamp(2rem, 4vw, 3rem);
    max-width: 600px;
}

.para-dash__eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--clay);
    margin: 0 0 0.5rem;
}

.para-dash__title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 0.75rem;
    line-height: 1.1;
}

.para-dash__lead {
    font-size: 1rem;
    color: var(--ink-soft);
    margin: 0;
    line-height: 1.6;
}

/* Grid */
.para-dash__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

/* Card */
.para-dash__card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 1.75rem 1.75rem 1.5rem 2rem;
    text-decoration: none;
    color: var(--ink);
    overflow: hidden;
    transition: box-shadow 0.22s ease, transform 0.22s ease, border-color 0.22s ease;
    animation: para-card-in 0.5s both;
}

.para-dash__card:nth-child(1) { animation-delay: 0.05s; }
.para-dash__card:nth-child(2) { animation-delay: 0.12s; }
.para-dash__card:nth-child(3) { animation-delay: 0.19s; }
.para-dash__card:nth-child(4) { animation-delay: 0.26s; }

@keyframes para-card-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.para-dash__card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

/* Left accent bar */
.para-dash__card-accent {
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
    transition: width 0.22s ease;
}

.para-dash__card:hover .para-dash__card-accent { width: 6px; }

.para-dash__card--project  .para-dash__card-accent { background: var(--clay); }
.para-dash__card--area     .para-dash__card-accent { background: var(--sage); }
.para-dash__card--resource .para-dash__card-accent { background: var(--gold); }
.para-dash__card--archive  .para-dash__card-accent { background: var(--espresso); }

/* Hover border colour per category */
.para-dash__card--project:hover  { border-color: var(--clay-ring); }
.para-dash__card--area:hover     { border-color: rgba(111, 122, 90, 0.38); }
.para-dash__card--resource:hover { border-color: rgba(205, 154, 58, 0.38); }
.para-dash__card--archive:hover  { border-color: rgba(29, 24, 18, 0.28); }

.para-dash__card-body {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

/* Large display numeral */
.para-dash__card-count {
    font-family: var(--font-display);
    font-size: clamp(3rem, 5vw, 4.5rem);
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}

.para-dash__card--project  .para-dash__card-count { color: var(--clay); }
.para-dash__card--area     .para-dash__card-count { color: var(--sage); }
.para-dash__card--resource .para-dash__card-count { color: var(--gold); }
.para-dash__card--archive  .para-dash__card-count { color: var(--espresso); }

.para-dash__card-info {
    flex: 1;
    padding-top: 0.4rem;
}

.para-dash__card-name {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink);
    margin: 0 0 0.4rem;
}

.para-dash__card-desc {
    font-size: 0.85rem;
    color: var(--ink-soft);
    margin: 0 0 0.35rem;
    line-height: 1.5;
}

.para-dash__card-archived {
    font-size: 0.75rem;
    color: var(--ink-faint);
    margin: 0;
}

/* CTA arrow */
.para-dash__card-cta {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--ink-soft);
    transition: color 0.18s ease, letter-spacing 0.18s ease;
    align-self: flex-end;
}

.para-dash__card:hover .para-dash__card-cta {
    color: var(--clay);
    letter-spacing: 0.07em;
}

@media (max-width: 600px) {
    .para-dash__grid { grid-template-columns: 1fr; }
}

.brainy-skip-link {
    position: fixed;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 2000;
    padding: 0.65rem 0.9rem;
    color: var(--paper-raised);
    background: var(--ink);
    border-radius: 6px;
    transform: translateY(-160%);
}

.brainy-skip-link:focus {
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
