/* Alysum vault / scratch — Obsidian-inspired, site-aligned */

.nb-app {
    --nb-ink: #e2e8f0;
    --nb-muted: #94a3b8;
    --nb-line: rgba(255, 255, 255, 0.1);
    --nb-panel: rgba(15, 23, 42, 0.92);
    --nb-panel-2: rgba(30, 41, 59, 0.95);
    --nb-accent: #a78bfa;
    --nb-accent-2: #7c3aed;
    --nb-danger: #f87171;
    --nb-radius: 16px;
    --nb-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-family: var(--nb-font);
    color: var(--nb-ink);
}

.nb-app.nb-float {
    position: fixed;
    right: 14px;
    bottom: 14px;
    width: min(920px, calc(100vw - 20px));
    height: min(78vh, 720px);
    z-index: 12000;
    display: flex;
    flex-direction: column;
    border-radius: calc(var(--nb-radius) + 6px);
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.08),
        0 22px 50px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.06);
    overflow: hidden;
    background: var(--nb-float-bg, linear-gradient(145deg, #1e1b4b 0%, #0f172a 42%, #0b1220 100%));
    border: 1px solid rgba(167, 139, 250, 0.22);
}

.nb-app.nb-float.hidden {
    display: none !important;
}

.nb-top-hat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    background: var(--nb-top-gradient, linear-gradient(135deg, #5b21b6, #7c3aed 55%, #a855f7));
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}

.nb-workspace-title {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #faf5ff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.nb-hat-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nb-hat-btn {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(0, 0, 0, 0.18);
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.12s ease;
}

.nb-hat-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-1px);
}

.nb-hat-btn:active {
    transform: translateY(0);
}

.nb-frame {
    flex: 1;
    min-height: 0;
    min-width: 0;
    display: flex;
}

.nb-ribbon {
    width: 48px;
    flex-shrink: 0;
    background: rgba(2, 6, 23, 0.55);
    border-right: 1px solid var(--nb-line);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0;
    gap: 8px;
}

.nb-rib-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--nb-muted);
    font-size: 18px;
    cursor: pointer;
}

.nb-rib-btn.is-active {
    background: rgba(124, 58, 237, 0.35);
    color: var(--nb-ink);
}

.nb-work {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.nb-columns {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(200px, 34%) 1fr;
}

.nb-left {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: rgba(15, 23, 42, 0.65);
    border-right: 1px solid var(--nb-line);
}

.nb-quick-open {
    margin: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--nb-line);
    background: rgba(2, 6, 23, 0.45);
    color: var(--nb-ink);
    font-size: 13px;
    outline: none;
}

.nb-quick-open::placeholder {
    color: var(--nb-muted);
}

.nb-quick-open:focus {
    border-color: rgba(167, 139, 250, 0.55);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.25);
}

.nb-nav-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0 12px;
}

.nb-tree-root-drop {
    flex-shrink: 0;
    margin: 2px 10px 8px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--nb-muted);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    background: rgba(15, 23, 42, 0.35);
    transition:
        border-color 0.12s ease,
        background 0.12s ease,
        color 0.12s ease;
}

.nb-tree-root-drop.nb-drop-hover {
    color: var(--nb-ink);
    border-color: rgba(167, 139, 250, 0.55);
    background: rgba(124, 58, 237, 0.15);
}

.nb-tree-row {
    cursor: pointer;
    user-select: none;
}

.nb-tree-row[draggable="true"] .nb-tree-inner {
    cursor: grab;
}

.nb-tree-row.nb-dragging .nb-tree-inner {
    cursor: grabbing;
}

.nb-tree-row.nb-dragging {
    opacity: 0.55;
}

.nb-tree-row.nb-drop-hover > .nb-tree-inner {
    outline: 2px dashed rgba(167, 139, 250, 0.75);
    outline-offset: -2px;
    background: rgba(124, 58, 237, 0.12);
}

.nb-tree-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 8px 9px 10px;
    margin: 0 6px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
}

.nb-tree-del-prep {
    flex-shrink: 0;
    width: 30px;
    height: 28px;
    padding: 0;
    margin-left: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: #94a3b8;
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    opacity: 0.65;
    transition: opacity 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.nb-tree-row:hover .nb-tree-del-prep,
.nb-tree-del-prep:focus {
    opacity: 1;
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

.nb-tree-row.is-armed-delete .nb-tree-inner {
    border: 1px solid rgba(248, 113, 113, 0.45);
    box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.12);
}

.nb-arm-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 10px 10px;
    margin: 0 6px 6px;
    border-radius: 0 0 10px 10px;
    background: rgba(127, 29, 29, 0.35);
    border: 1px solid rgba(248, 113, 113, 0.35);
    border-top: none;
}

.nb-arm-text {
    flex: 1 1 140px;
    font-size: 11px;
    font-weight: 700;
    color: #fecaca;
    line-height: 1.35;
}

.nb-arm-cancel {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(15, 23, 42, 0.8);
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.nb-arm-confirm {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(248, 113, 113, 0.55);
    background: rgba(185, 28, 28, 0.55);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.nb-arm-confirm:hover {
    background: rgba(220, 38, 38, 0.75);
}

.nb-arm-cancel:hover {
    background: rgba(30, 41, 59, 0.95);
}

.nb-tree-row:hover .nb-tree-inner {
    background: rgba(255, 255, 255, 0.06);
}

.nb-tree-row.is-active .nb-tree-inner {
    background: var(--nb-tree-active-bg, linear-gradient(90deg, rgba(124, 58, 237, 0.45), rgba(236, 72, 153, 0.12)));
    color: #f8fafc;
    box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.35);
}

.nb-chev {
    width: 14px;
    font-size: 10px;
    color: var(--nb-muted);
    flex-shrink: 0;
    text-align: center;
}

.nb-chev-note {
    opacity: 0.35;
}

.nb-tree-icon {
    flex-shrink: 0;
    opacity: 0.92;
}

.nb-tree-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nb-tree-empty {
    padding: 20px 14px;
    color: var(--nb-muted);
    font-size: 13px;
    text-align: center;
}

.nb-main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: rgba(2, 6, 23, 0.35);
}

.nb-tab-strip {
    display: none;
}

.nb-inline-title {
    margin: 12px 14px 0;
    padding: 12px 14px;
    font-size: 20px;
    font-weight: 800;
    border-radius: 12px;
    border: 1px solid var(--nb-line);
    background: rgba(15, 23, 42, 0.75);
    color: #f1f5f9;
    outline: none;
}

.nb-inline-title:disabled {
    opacity: 0.45;
}

.nb-inline-title:focus {
    border-color: rgba(167, 139, 250, 0.55);
}

.nb-editor-host,
.nb-editor-textarea,
.nb-body-ce {
    flex: 1;
    margin: 10px 14px 0;
    min-height: 160px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--nb-line);
    background: rgba(15, 23, 42, 0.88);
    color: #e2e8f0;
    font-size: 14px;
    line-height: 1.55;
    resize: none;
    outline: none;
    font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
}

.nb-body-ce {
    white-space: pre-wrap;
    overflow-y: auto;
    word-break: break-word;
    resize: none;
}

.nb-body-ce .nb-wiki-link {
    color: #93c5fd;
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    cursor: pointer;
    font-weight: 700;
}

.nb-body-ce .nb-wiki-link:hover {
    color: #bfdbfe;
}

.nb-editor-textarea:disabled,
.nb-body-ce[contenteditable="false"] {
    opacity: 0.5;
}

.nb-editor-textarea:focus,
.nb-body-ce[contenteditable="true"]:focus {
    border-color: rgba(124, 58, 237, 0.45);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.nb-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 14px 12px;
    font-size: 12px;
    color: var(--nb-muted);
    font-weight: 600;
}

.nb-status-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.nb-miniact {
    border: 1px solid var(--nb-line);
    background: rgba(255, 255, 255, 0.04);
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 999px;
    cursor: pointer;
}

.nb-miniact:hover {
    background: rgba(255, 255, 255, 0.08);
}

.nb-miniact-accent {
    border-color: rgba(167, 139, 250, 0.45);
    color: #ede9fe;
}

@media (max-width: 720px) {
    .nb-columns {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(120px, 32%) 1fr;
    }

    .nb-left {
        border-right: none;
        border-bottom: 1px solid var(--nb-line);
    }

    .nb-app.nb-float {
        right: 8px;
        left: 8px;
        width: auto;
        height: min(82vh, 640px);
    }
}

/* ============ Full vault & scratch pages ============ */

.vault-page,
.scratch-page {
    --vp-bg: #020617;
    --vp-panel: rgba(15, 23, 42, 0.92);
    --vp-line: rgba(255, 255, 255, 0.1);
    margin: 0;
    min-height: 100vh;
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 20% 0%, var(--vp-r1, rgba(124, 58, 237, 0.2)) 0%, transparent 42%),
        radial-gradient(circle at 90% 10%, var(--vp-r2, rgba(236, 72, 153, 0.12)) 0%, transparent 38%),
        linear-gradient(180deg, #071427 0%, #020617 55%, #020617 100%);
    color: #e2e8f0;
}

.vault-shell,
.scratch-shell {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 16px 40px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.scratch-shell {
    max-width: 820px;
}

.vault-hero,
.scratch-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 22px 22px;
    border-radius: 22px;
    background: var(--vp-hero-bg, linear-gradient(135deg, rgba(91, 33, 182, 0.55), rgba(124, 58, 237, 0.35), rgba(15, 23, 42, 0.65)));
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.vault-hero h1,
.scratch-hero h1 {
    margin: 0 0 8px;
    font-size: clamp(22px, 4vw, 28px);
    font-weight: 900;
    letter-spacing: -0.02em;
    color: #faf5ff;
}

.vault-hero p,
.scratch-hero p {
    margin: 0;
    max-width: 520px;
    color: #e9d5ff;
    font-size: 14px;
    line-height: 1.5;
    opacity: 0.95;
}

.vault-hero-actions,
.scratch-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.vault-btn,
.scratch-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 18px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.12s ease, background 0.15s ease;
}

.vault-btn:hover,
.scratch-btn:hover {
    transform: translateY(-1px);
}

.vault-btn-primary,
.scratch-btn-primary {
    background: white;
    color: var(--vp-primary-fg, #5b21b6);
}

.vault-btn-ghost,
.scratch-btn-ghost {
    background: rgba(0, 0, 0, 0.22);
    color: #f8fafc;
}

.vault-btn-danger {
    background: rgba(248, 113, 113, 0.15);
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.35);
}

.vault-grid {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(240px, 300px) 1fr;
    gap: 14px;
    min-height: 480px;
}

.scratch-grid {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(200px, 260px) 1fr;
    gap: 12px;
    min-height: 420px;
}

.vault-panel,
.scratch-panel {
    border-radius: 20px;
    background: var(--vp-panel);
    border: 1px solid var(--vp-line);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.vault-side-head,
.scratch-side-head {
    padding: 12px 14px;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #94a3b8;
    border-bottom: 1px solid var(--vp-line);
    background: rgba(2, 6, 23, 0.35);
}

.vault-side-tools,
.scratch-side-tools {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-bottom: 1px solid var(--vp-line);
    flex-wrap: wrap;
}

.vault-tool-btn,
.scratch-tool-btn {
    flex: 1;
    min-width: 0;
    padding: 9px 10px;
    border-radius: 12px;
    border: 1px solid var(--vp-line);
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.vault-tool-btn:hover,
.scratch-tool-btn:hover {
    background: rgba(124, 58, 237, 0.25);
}

.vault-tree,
.scratch-tree {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0 14px;
}

.vault-editor-head,
.scratch-editor-head {
    padding: 12px 16px;
    border-bottom: 1px solid var(--vp-line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    background: rgba(2, 6, 23, 0.25);
}

.vault-title-input,
.scratch-title-input {
    flex: 1;
    min-width: 0;
    padding: 11px 14px;
    border-radius: 12px;
    border: 1px solid var(--vp-line);
    background: rgba(15, 23, 42, 0.9);
    color: #f8fafc;
    font-size: 18px;
    font-weight: 800;
    outline: none;
}

.vault-title-input:focus,
.scratch-title-input:focus {
    border-color: rgba(167, 139, 250, 0.55);
}

.vault-body,
.scratch-body {
    flex: 1;
    min-height: 0;
    padding: 16px;
    border: none;
    background: rgba(2, 6, 23, 0.45);
    color: #e2e8f0;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    outline: none;
    font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
}

.vault-status,
.scratch-status {
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    border-top: 1px solid var(--vp-line);
}

.vault-tree .nb-tree-inner,
.scratch-tree .nb-tree-inner {
    margin: 0 8px;
}

@media (max-width: 800px) {
    .vault-grid,
    .scratch-grid {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(200px, 38vh) 1fr;
    }
}

@media (max-width: 480px) {
    .vault-shell,
    .scratch-shell {
        padding: 12px 12px 28px;
    }

    .vault-hero,
    .scratch-hero {
        padding: 16px 16px;
        border-radius: 18px;
    }

    .vault-grid,
    .scratch-grid {
        gap: 10px;
        min-height: 360px;
    }
}
