* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light Theme - Warm & Literary */
    --bg-primary: #faf9f7;
    --bg-secondary: #f0ede8;
    --bg-tertiary: #e8e4dd;
    --text-primary: #2c2c2c;
    --text-secondary: #6b6b6b;
    --text-muted: #8a8a8a;
    --accent: #c45d3e;
    --accent-hover: #a84d32;
    --accent-secondary: #2d5a4a;
    --border-color: #e4e0db;
    --border-subtle: #ebe8e3;
    --code-bg: #f5f2ed;
    --toolbar-bg: rgba(250, 249, 247, 0.92);
    --shadow-sm: 0 1px 2px rgba(44, 44, 44, 0.04);
    --shadow-md: 0 4px 12px rgba(44, 44, 44, 0.08);
    --shadow-lg: 0 12px 32px rgba(44, 44, 44, 0.12);

    /* Sizing */
    --header-height: 56px;
    --toolbar-height: 48px;
    --status-bar-height: 40px;
    --touch-target-min: 44px;

    /* Typography */
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Source Serif 4', Georgia, serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
    --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Animation */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;
}

[data-theme="dark"] {
    --bg-primary: #1c1b19;
    --bg-secondary: #282623;
    --bg-tertiary: #333028;
    --text-primary: #e8e4de;
    --text-secondary: #9a958c;
    --text-muted: #6e6a62;
    --accent: #e07a5f;
    --accent-hover: #eb8d74;
    --accent-secondary: #5fa386;
    --border-color: #3a3632;
    --border-subtle: #302d29;
    --code-bg: #252320;
    --toolbar-bg: rgba(28, 27, 25, 0.92);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4);
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    transition: background var(--duration-normal) var(--ease-out),
                color var(--duration-normal) var(--ease-out);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    overscroll-behavior: none;
}

/* Selection */
::selection {
    background: var(--accent);
    color: white;
}

/* Focus States */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--toolbar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 20px;
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    z-index: 100;
    transition: transform var(--duration-normal) var(--ease-out),
                opacity var(--duration-normal) var(--ease-out);
}

.header.hidden {
    transform: translateY(-100%);
    opacity: 0;
}

.header-content {
    max-width: 1100px;
    height: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-menu {
    height: 36px;
    padding: 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all var(--duration-fast) var(--ease-out);
}

.btn-menu:hover {
    background: var(--bg-secondary);
    color: var(--accent);
}

.btn-menu svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.brand-link {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: -0.02em;
    cursor: pointer;
    transition: color var(--duration-fast) var(--ease-out);
}

.brand-link:hover {
    color: var(--accent-hover);
}

/* About Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(44, 44, 44, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration-normal) var(--ease-out),
                visibility var(--duration-normal) var(--ease-out);
}

[data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, 0.5);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 32px;
    max-width: 480px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-lg);
    transform: translateY(16px) scale(0.98);
    transition: transform var(--duration-normal) var(--ease-out);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--duration-fast) var(--ease-out);
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-title {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--accent);
}

.modal-subtitle {
    color: var(--text-secondary);
    margin: 0 0 24px;
    font-size: 15px;
}

.modal-content {
    color: var(--text-primary);
    line-height: 1.7;
}

.modal-content p {
    margin: 0 0 16px;
    font-size: 15px;
}

.modal-content h3 {
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 28px 0 12px;
}

.modal-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.modal-content li {
    font-family: var(--font-ui);
    font-size: 14px;
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-content li:last-child {
    border-bottom: none;
}

.modal-content li::before {
    content: "";
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

.modal-content kbd {
    font-family: var(--font-mono);
    font-size: 11px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 3px 8px;
    margin-right: 8px;
    min-width: 90px;
    display: inline-block;
}

.modal-footer {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
    text-align: center;
}

.modal-footer p {
    margin: 0;
    font-family: var(--font-ui);
    color: var(--text-muted);
    font-size: 13px;
}

.modal-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.modal-footer a:hover {
    text-decoration: underline;
}

.version {
    margin-top: 8px !important;
    font-size: 12px !important;
    opacity: 0.7;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

button {
    font-family: var(--font-ui);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--duration-fast) var(--ease-out);
    white-space: nowrap;
}

button:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

button.active,
button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

button.active:hover,
button.primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.toolbar {
    position: fixed;
    top: calc(var(--header-height) + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--toolbar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 6px 8px;
    display: flex;
    gap: 2px;
    z-index: 99;
    box-shadow: var(--shadow-md);
    transition: opacity var(--duration-normal) var(--ease-out);
}

.toolbar.faded {
    opacity: 0.2;
}

.toolbar:hover {
    opacity: 1 !important;
}

.toolbar button {
    padding: 6px 10px;
    font-size: 13px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: 5px;
    transition: background 0.15s ease, color 0.15s ease;
}

.toolbar button:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: none;
}

.toolbar button.active {
    background: var(--accent);
    color: white;
}

.toolbar .separator {
    width: 1px;
    background: var(--border-color);
    margin: 4px 6px;
    opacity: 0.6;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 136px 24px 80px;
    min-height: 100vh;
}

.editor-wrapper {
    background: var(--bg-primary);
}

.tiptap {
    outline: none;
    min-height: 500px;
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.8;
    color: var(--text-primary);
}

.tiptap h1 {
    font-family: var(--font-display);
    font-size: 2.4em;
    font-weight: 700;
    margin: 0.8em 0 0.4em;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.tiptap h1:first-child {
    margin-top: 0;
}

.tiptap h2 {
    font-family: var(--font-display);
    font-size: 1.8em;
    font-weight: 600;
    margin: 1.2em 0 0.4em;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.tiptap h3 {
    font-family: var(--font-display);
    font-size: 1.4em;
    font-weight: 600;
    margin: 1em 0 0.4em;
    line-height: 1.3;
}

.tiptap h4,
.tiptap h5,
.tiptap h6 {
    font-family: var(--font-display);
    font-size: 1.2em;
    font-weight: 600;
    margin: 1em 0 0.4em;
}

.tiptap p {
    margin: 0 0 1.2em;
}

.tiptap ul,
.tiptap ol {
    padding-left: 1.5em;
    margin: 0 0 1.2em;
}

.tiptap li {
    margin: 0.4em 0;
}

.tiptap blockquote {
    margin: 1.5em 0;
    padding: 0.5em 0 0.5em 1.5em;
    border-left: 3px solid var(--accent);
    color: var(--text-secondary);
    font-style: italic;
}

.tiptap pre {
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.2em;
    margin: 1.5em 0;
    overflow-x: auto;
}

.tiptap code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--code-bg);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    color: var(--accent-secondary);
}

[data-theme="dark"] .tiptap code {
    color: var(--accent-secondary);
}

.tiptap pre code {
    background: transparent;
    padding: 0;
    color: var(--text-primary);
}

.tiptap a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color var(--duration-fast) var(--ease-out);
}

.tiptap a:hover {
    border-bottom-color: var(--accent);
}

.tiptap hr {
    border: none;
    height: 1px;
    background: var(--border-color);
    margin: 2.5em 0;
}

.tiptap img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5em 0;
}

.code-view {
    display: none;
    width: 100%;
    min-height: 500px;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.6;
    background: var(--code-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    resize: vertical;
    outline: none;
}

.code-view.active {
    display: block;
}

.status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--status-bar-height);
    background: var(--toolbar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-subtle);
    padding: 0 24px;
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--text-muted);
    z-index: 50;
}

.status-bar .status-left {
    display: flex;
    gap: 16px;
    align-items: center;
}

.status-bar .status-left span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-bar .status-right {
    display: flex;
    gap: 10px;
    align-items: center;
    color: var(--text-muted);
}

.export-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px;
    box-shadow: var(--shadow-md);
    display: none;
    min-width: 180px;
    z-index: 120;
}

.export-menu.active {
    display: block;
}

.export-menu button {
    width: 100%;
    text-align: left;
    margin-bottom: 4px;
    background: transparent;
    border: none;
    padding: 10px 12px;
    border-radius: 6px;
    color: var(--text-primary);
    transition: background var(--duration-fast) var(--ease-out),
                color var(--duration-fast) var(--ease-out);
}

.export-menu button:last-child {
    margin-bottom: 0;
}

.export-menu button:hover {
    background: var(--accent);
    color: white;
}

.toast {
    position: fixed;
    bottom: calc(var(--status-bar-height) + 16px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-normal) var(--ease-out);
    pointer-events: none;
    z-index: 150;
}

.toast.show {
    opacity: 1;
    visibility: visible;
}

/* ===== MOBILE MENU STYLES ===== */
.mobile-menu-toggle {
    display: none;
    padding: 8px;
    background: transparent;
    border: 1px solid transparent;
    min-width: var(--touch-target-min);
    min-height: var(--touch-target-min);
    align-items: center;
    justify-content: center;
}

.hamburger-icon {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    position: relative;
    transition: background var(--duration-fast) var(--ease-out);
}

.hamburger-icon::before,
.hamburger-icon::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    left: 0;
    transition: all var(--duration-fast) var(--ease-out);
}

.hamburger-icon::before { top: -7px; }
.hamburger-icon::after { top: 7px; }

.mobile-menu-toggle:hover .hamburger-icon,
.mobile-menu-toggle:hover .hamburger-icon::before,
.mobile-menu-toggle:hover .hamburger-icon::after {
    background: var(--accent);
}

.header-actions-menu {
    display: contents;
}

.header-actions-menu.active {
    display: flex;
}

/* ===== TABLET BREAKPOINT (max-width: 768px) ===== */
@media (max-width: 768px) {
    .header-content {
        padding: 0 16px;
    }

    .container {
        padding: 128px 16px 60px;
    }

    .toolbar {
        top: calc(var(--header-height) + 8px);
        left: 0;
        right: 0;
        transform: none;
        border-radius: 0;
        border-left: none;
        border-right: none;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 6px 10px;
    }

    .toolbar::-webkit-scrollbar {
        display: none;
    }

    .toolbar button {
        flex-shrink: 0;
        min-width: 40px;
        min-height: 40px;
        padding: 8px 12px;
    }

    .toolbar .separator {
        flex-shrink: 0;
    }

    .header {
        padding: 0 16px;
    }

    .header-actions {
        position: relative;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .header-actions-menu {
        position: absolute;
        top: 100%;
        right: 0;
        background: var(--bg-primary);
        border: 1px solid var(--border-color);
        border-radius: 10px;
        padding: 8px;
        box-shadow: var(--shadow-md);
        display: none;
        flex-direction: column;
        gap: 4px;
        min-width: 160px;
        margin-top: 8px;
        z-index: 110;
    }

    .header-actions-menu.active {
        display: flex;
    }

    .header-actions-menu button {
        width: 100%;
        text-align: left;
        min-height: var(--touch-target-min);
    }

    .header-actions-menu > div {
        width: 100%;
    }

    .header-actions-menu > div button {
        width: 100%;
    }

    .tiptap {
        font-size: 17px;
    }

    .tiptap h1 { font-size: 2em; }
    .tiptap h2 { font-size: 1.5em; }
    .tiptap h3 { font-size: 1.3em; }

    .ql-editor { font-size: 17px; }
    .ql-editor h1 { font-size: 2em; }
    .ql-editor h2 { font-size: 1.5em; }
    .ql-editor h3 { font-size: 1.3em; }

    .modal {
        padding: 24px;
        width: 95%;
        border-radius: 10px;
    }

    .modal-title { font-size: 24px; }
    .modal-close {
        width: var(--touch-target-min);
        height: var(--touch-target-min);
    }

    .status-bar {
        padding: 8px 12px;
        font-size: 12px;
    }

    .status-bar .status-left {
        gap: 12px;
    }

    /* Sidebar overlay on mobile */
    .document-sidebar {
        width: 100%;
        max-width: 320px;
    }

    body.sidebar-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 104;
    }

    body.sidebar-open .header,
    body.sidebar-open .container,
    body.sidebar-open .toolbar,
    body.sidebar-open .status-bar {
        margin-left: 0;
    }
}

/* ===== SMALL PHONE BREAKPOINT (max-width: 480px) ===== */
@media (max-width: 480px) {
    :root {
        --header-height: 48px;
        --toolbar-height: 44px;
        --status-bar-height: 32px;
    }

    .container {
        padding: calc(var(--header-height) + var(--toolbar-height) + 12px) 10px calc(var(--status-bar-height) + 12px);
    }

    .header {
        padding: 8px 10px;
    }

    .brand {
        font-size: 16px;
    }

    .btn-menu {
        min-width: var(--touch-target-min);
        min-height: var(--touch-target-min);
        margin-right: 8px;
    }

    .toolbar {
        padding: 4px 8px;
        gap: 2px;
    }

    .toolbar button {
        min-width: 36px;
        min-height: 36px;
        padding: 6px 8px;
        font-size: 12px;
    }

    .tiptap {
        font-size: 15px;
        line-height: 1.6;
    }

    .tiptap h1 { font-size: 1.75em; }
    .tiptap h2 { font-size: 1.4em; }
    .tiptap h3 { font-size: 1.2em; }

    .tiptap blockquote {
        padding-left: 0.75em;
        border-left-width: 3px;
    }

    .tiptap pre {
        padding: 0.75em;
        font-size: 13px;
    }

    .ql-editor {
        font-size: 15px;
    }

    .ql-editor h1 { font-size: 1.75em; }
    .ql-editor h2 { font-size: 1.4em; }
    .ql-editor h3 { font-size: 1.2em; }

    .modal {
        padding: 16px;
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    .modal-title { font-size: 20px; }

    .modal-content kbd {
        min-width: 80px;
        font-size: 11px;
    }

    .status-bar {
        padding: 6px 10px;
        font-size: 11px;
    }

    .status-bar .status-left {
        gap: 8px;
    }

    /* Hide character count on very small screens */
    .status-bar #charCount {
        display: none;
    }

    .document-sidebar {
        max-width: 100%;
    }

    .sidebar-header {
        padding: 12px;
    }

    .sidebar-actions {
        padding: 10px;
    }

    .btn-new-doc {
        padding: 12px;
        min-height: var(--touch-target-min);
    }

    .doc-search {
        min-height: var(--touch-target-min);
        padding: 10px 14px;
    }

    .document-item {
        padding: 14px 12px;
    }
}

/* ===== TOUCH DEVICE IMPROVEMENTS ===== */
@media (hover: none) and (pointer: coarse) {
    button {
        min-height: var(--touch-target-min);
    }

    .btn-icon {
        min-width: var(--touch-target-min);
        min-height: var(--touch-target-min);
    }

    .btn-menu {
        min-width: 48px;
        min-height: 48px;
        padding: 8px;
    }

    .doc-action-btn {
        min-width: 36px;
        min-height: 36px;
        padding: 8px;
    }

    .export-menu button {
        min-height: var(--touch-target-min);
        padding: 12px 14px;
    }

    /* Always show doc actions on touch */
    .document-item .doc-actions {
        display: flex;
    }
}

/* Focus mode styles */
body.focus-mode .header,
body.focus-mode .toolbar,
body.focus-mode .status-bar {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Focus mode trigger zone at top */
.focus-trigger {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    z-index: 99;
    pointer-events: none;
}

body.focus-mode .focus-trigger {
    pointer-events: all;
}

/* When hovering trigger, disable it so clicks go through to UI */
body.focus-mode .focus-trigger:hover {
    pointer-events: none;
}

/* Reveal ALL UI elements together when hovering trigger zone or header */
body.focus-mode:has(.focus-trigger:hover) .header,
body.focus-mode:has(.focus-trigger:hover) .toolbar,
body.focus-mode:has(.focus-trigger:hover) .status-bar,
body.focus-mode .header:hover,
body.focus-mode:has(.header:hover) .toolbar,
body.focus-mode:has(.header:hover) .status-bar,
body.focus-mode .toolbar:hover,
body.focus-mode .status-bar:hover {
    opacity: 1;
    pointer-events: all;
}

/* Focus Mode button active state */
#focusToggle.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Typing indicator */
body.typing .toolbar:not(:hover) {
    opacity: 0.2;
}

/* Print styles */
@media print {

    .header,
    .toolbar,
    .status-bar,
    .document-sidebar {
        display: none;
    }

    .container {
        padding: 0;
        max-width: 100%;
    }

    .tiptap {
        font-size: 12pt;
    }
}

/* Document Sidebar Styles */
.document-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 105;
    display: flex;
    flex-direction: column;
}

body.sidebar-open .document-sidebar {
    transform: translateX(0);
}

body.sidebar-open .header,
body.sidebar-open .container,
body.sidebar-open .toolbar,
body.sidebar-open .status-bar {
    margin-left: 280px;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: var(--bg-primary);
}

.btn-menu {
    background: transparent;
    border: 1px solid transparent;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px 8px;
    margin-right: 12px;
    border-radius: 4px;
    transition: color 0.2s, border-color 0.2s;
}

.btn-menu:hover {
    background: transparent;
    color: var(--text-primary);
    border-color: rgba(0, 0, 0, 0.15);
    transform: none;
}

[data-theme="dark"] .btn-menu:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.sidebar-actions {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.btn-new-doc {
    width: 100%;
    padding: 10px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.btn-new-doc:hover {
    background: #1a1a1a;
    transform: none;
}

[data-theme="dark"] .btn-new-doc:hover {
    background: #ffffff;
    color: #1a1a1a;
}

.doc-search {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
}

.doc-search:focus {
    border-color: var(--accent);
}

.document-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.document-item {
    padding: 12px;
    background: var(--accent);
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    color: white;
}

.document-item:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

.document-item.active {
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--accent);
}

.document-item .doc-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.document-item .doc-meta {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
}

.document-item.active .doc-meta {
    color: rgba(255, 255, 255, 0.9);
}

.doc-actions {
    display: none;
    gap: 4px;
}

.document-item:hover .doc-actions {
    display: flex;
}

.doc-action-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    border-radius: 3px;
}

.doc-action-btn:hover {
    background: var(--bg-secondary);
}

.document-item.active .doc-action-btn {
    color: rgba(255, 255, 255, 0.8);
}

.document-item.active .doc-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Hide sidebar in focus mode */
body.focus-mode .document-sidebar {
    transform: translateX(-100%);
}

body.focus-mode.sidebar-open .header,
body.focus-mode.sidebar-open .container,
body.focus-mode.sidebar-open .toolbar,
body.focus-mode.sidebar-open .status-bar {
    margin-left: 0;
}

/* Quill Editor Styling */
.ql-container {
    border: none !important;
    font-family: inherit;
    font-size: 18px;
    line-height: 1.7;
}

.ql-editor {
    min-height: 500px;
    padding: 0;
    color: var(--text-primary);
}

.ql-editor h1 {
    font-size: 2.5em;
    font-weight: 700;
    margin: 1em 0 0.5em;
    line-height: 1.2;
}

.ql-editor h2 {
    font-size: 2em;
    font-weight: 600;
    margin: 1em 0 0.5em;
    line-height: 1.3;
}

.ql-editor h3 {
    font-size: 1.5em;
    font-weight: 600;
    margin: 1em 0 0.5em;
}

.ql-editor p {
    margin: 0 0 1em;
}

.ql-editor blockquote {
    border-left: 4px solid var(--accent);
    padding-left: 1em;
    margin: 1em 0;
    color: var(--text-secondary);
    font-style: italic;
}

.ql-editor pre {
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1em;
    margin: 1em 0;
}

.ql-editor code {
    background: var(--code-bg);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
}

.ql-snow .ql-editor pre.ql-syntax {
    background: var(--code-bg);
    color: var(--text-primary);
}

/* Hide Quill toolbar since we use our own */
.ql-toolbar {
    display: none !important;
}