:root {
    --bg: #f3f3f1;
    --panel: rgba(255, 255, 255, 0.92);
    --line: rgba(0, 0, 0, 0.08);
    --line-strong: rgba(0, 0, 0, 0.14);
    --muted: #6b7280;
    --ink: #0a0a0a;
    --paper: #ffffff;
}

* {
    box-sizing: border-box;
}

html {
    height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100%;
    font-family: Manrope, ui-sans-serif, system-ui, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(0, 0, 0, 0.06), transparent 28%),
        radial-gradient(circle at bottom right, rgba(0, 0, 0, 0.08), transparent 24%),
        linear-gradient(180deg, #f8f8f7 0%, #f1f1ef 100%);
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.28;
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.018) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(circle at center, black, transparent 90%);
}

.app-shell,
.login-body {
    position: relative;
}

.sidebar-panel,
.editor-frame {
    backdrop-filter: blur(20px);
}

.sidebar-panel::-webkit-scrollbar,
#recent-notes::-webkit-scrollbar,
#pinned-notes::-webkit-scrollbar,
.editor-frame ::-webkit-scrollbar,
.editor-content::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.sidebar-panel::-webkit-scrollbar-thumb,
.editor-frame ::-webkit-scrollbar-thumb,
.editor-content::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background-color: rgba(0, 0, 0, 0.14);
    background-clip: padding-box;
}

.toolbar-action {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #fafafa;
    padding: 0.8rem 1rem;
    font-size: 0.84rem;
    font-weight: 700;
    color: #202020;
    transition: all 180ms ease;
}

.toolbar-action:hover,
.toolbar-action:focus-visible {
    border-color: rgba(0, 0, 0, 0.35);
    background: #fff;
    outline: none;
}

.toolbar-action:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.toolbar-action-dark {
    background: #0a0a0a;
    color: #fff;
}

.toolbar-action-dark:hover,
.toolbar-action-dark:focus-visible {
    background: #1f1f1f;
    color: #fff;
}

.editor-tool {
    display: inline-flex;
    min-width: 2.75rem;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border-radius: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #fff;
    padding: 0.72rem 0.9rem;
    font-size: 0.8rem;
    font-weight: 800;
    color: #1f1f1f;
    transition: all 180ms ease;
}

.editor-tool:hover,
.editor-tool:focus-visible {
    border-color: rgba(0, 0, 0, 0.36);
    background: #fafafa;
    outline: none;
}

.note-card {
    position: relative;
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 1.5rem;
    background: rgba(255, 255, 255, 0.82);
    padding: 1rem;
    text-align: left;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.note-card:hover,
.note-card:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.06);
    outline: none;
}

.note-card.active {
    border-color: rgba(0, 0, 0, 0.88);
    background: #0a0a0a;
    color: #fff;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.note-card.active .note-card-subtle,
.note-card.active .note-card-preview,
.note-card.active .note-card-meta {
    color: rgba(255, 255, 255, 0.72);
}

.note-card-pin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.96);
    color: #111;
    transition: all 180ms ease;
}

.note-card-pin:hover,
.note-card-pin:focus-visible {
    border-color: rgba(0, 0, 0, 0.35);
    outline: none;
}

.note-card.active .note-card-pin {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.editor-content {
    max-width: 64rem;
    margin: 0 auto;
    width: 100%;
    font-size: 1rem;
    line-height: 1.95;
    color: #111827;
}

.editor-content:empty::before {
    content: attr(data-placeholder);
    color: #9ca3af;
}

.editor-content h1,
.editor-content h2,
.editor-content h3 {
    margin: 1.35rem 0 0.85rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.editor-content h1 {
    font-size: 2rem;
}

.editor-content h2 {
    font-size: 1.45rem;
}

.editor-content h3 {
    font-size: 1.15rem;
}

.editor-content p {
    margin: 0.95rem 0;
}

.line-clamp-2 {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.editor-content ul,
.editor-content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.editor-content blockquote {
    margin: 1.35rem 0;
    border-left: 3px solid rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0 0.2rem 1rem;
    color: #374151;
    font-style: italic;
}

.editor-content pre {
    overflow-x: auto;
    margin: 1.4rem 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 1.5rem;
    background: #0a0a0a;
    color: #f5f5f5;
    padding: 1rem 1.15rem;
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 0.92rem;
    line-height: 1.7;
}

.editor-content code {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(14px);
}

.modal-card {
    width: min(100%, 30rem);
    border-radius: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.98);
    padding: 2rem;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.22);
}

.modal-primary,
.modal-secondary {
    width: 100%;
    border-radius: 999px;
    padding: 0.95rem 1.15rem;
    font-size: 0.92rem;
    font-weight: 800;
    transition: all 180ms ease;
}

.modal-primary {
    background: #111;
    color: #fff;
}

.modal-primary:hover,
.modal-primary:focus-visible {
    background: #202020;
    outline: none;
}

.modal-secondary {
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #fafafa;
    color: #111;
}

.modal-secondary:hover,
.modal-secondary:focus-visible {
    border-color: rgba(0, 0, 0, 0.32);
    background: #fff;
    outline: none;
}

.toast-item {
    border-radius: 1.25rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.96);
    padding: 0.9rem 1rem;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.1);
    font-size: 0.88rem;
    font-weight: 700;
    color: #111;
}

.toast-item.is-error {
    border-color: rgba(185, 28, 28, 0.18);
    color: #b91c1c;
}

@media (max-width: 767px) {
    .editor-content {
        font-size: 0.98rem;
        line-height: 1.85;
    }

    .editor-content h1 {
        font-size: 1.7rem;
    }

    .editor-content h2 {
        font-size: 1.3rem;
    }
}
