:root {
    color-scheme: light;
    font-family: system-ui, sans-serif;
    color: #242424;
    background: #f5f5f3;
}

body { margin: 0; }
main { max-width: 800px; margin: 0 auto; padding: 40px 20px; }
.app-name { color: #595959; font-size: 0.9rem; }
h1 { font-size: 1.8rem; margin: 12px 0 28px; }
h2 { font-size: 1.15rem; }
.empty-state, article {
    background: #fff;
    border: 1px solid #deded8;
    border-radius: 12px;
    padding: 24px;
    overflow-wrap: anywhere;
}
article + article { margin-top: 16px; }
form { background: #fff; border: 1px solid #deded8; border-radius: 12px; padding: 24px; }
label { display: block; font-weight: 600; margin-bottom: 8px; }
input, textarea, select {
    box-sizing: border-box;
    width: 100%;
    padding: 12px;
    border: 1px solid #888;
    border-radius: 6px;
    font: inherit;
}
textarea { resize: vertical; }
button, .button {
    display: inline-block;
    border: 1px solid #242424;
    border-radius: 6px;
    background: #242424;
    color: #fff;
    padding: 10px 16px;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}
.actions { display: flex; align-items: center; gap: 20px; }
.errorlist { color: #a11919; }
.logout-form { padding: 0; border: 0; background: transparent; }
input[type="checkbox"] { width: auto; margin-right: 8px; }
[aria-current="page"] { font-weight: 700; }
.editor-shell { border: 1px solid #888; border-radius: 6px; overflow: hidden; }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; background: #f5f5f3; }
.editor-toolbar button { background: #fff; color: #242424; border-color: #bbb; padding: 6px 10px; font-size: .85rem; }
.tiptap { min-height: 280px; padding: 16px; outline-offset: -3px; overflow-wrap: anywhere; }
.tiptap, .richtext { white-space: pre-wrap; }
.tiptap p, .richtext p { margin: .6em 0; }
.tiptap pre, .richtext pre { background: #f2f2f2; padding: 16px; border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tiptap blockquote, .richtext blockquote { margin-left: 0; padding-left: 16px; border-left: 3px solid #aaa; }
.tiptap ul, .tiptap ol, .richtext ul, .richtext ol { white-space: normal; }
.attachments { margin-top: 24px; }
.attachments summary { cursor: pointer; padding: 12px 0; }
.attachment-thumbnail { display: block; max-width: 100%; max-height: 240px; }
.actions { flex-wrap: wrap; }
dialog { width: min(480px, 85vw); border: 1px solid #aaa; border-radius: 12px; }
dialog::backdrop { background: #0006; }
dialog form { border: 0; padding: 8px; }
dialog label { margin: 16px 0; }
dialog button + button { margin-left: 12px; }
.inline-attachment { margin: 16px 0; padding: 12px; border: 1px solid #ddd; border-radius: 8px; background: #fafafa; white-space: normal; }
.inline-attachment img { display: block; max-width: 100%; max-height: 560px; object-fit: contain; }
.inline-attachment iframe { display: block; width: 100%; height: 380px; border: 0; }
.inline-attachment figcaption { margin-top: 8px; overflow-wrap: anywhere; font-size: .85rem; color: #444; }
.inline-attachment button { font-size: .8rem; padding: 4px 8px; margin-top: 8px; background: white; color: #555; border-color: #aaa; }
.inline-attachment.ProseMirror-selectednode { outline: 2px solid #555; }

/* The main note workflow: folders, list, and document. */
.workspace-page { background: #fff; }
.workspace-header { height: 64px; box-sizing: border-box; padding: 12px 24px; display: flex; align-items: center; gap: 20px; border-bottom: 1px solid #ddd; }
.workspace-brand { color: #333; font-size: 1.15rem; font-weight: 700; text-decoration: none; margin-right: auto; }
.workspace-brand small { font-weight: 400; color: #666; }
.workspace-header .logout-form button { background: transparent; color: #555; border: 0; padding: 8px; }
.workspace-header .new-note { background: #f4d453; color: #242424; border-color: #e4c343; padding: 8px 12px; }
.workspace { max-width: none; margin: 0; padding: 0; display: grid; grid-template-columns: 225px 305px minmax(0, 1fr); height: calc(100dvh - 64px); }
.workspace-folders, .workspace-notes, .workspace-content { overflow-y: auto; min-width: 0; box-sizing: border-box; }
.workspace-folders { background: #f5f5f3; border-right: 1px solid #ddd; padding: 20px 12px; }
.workspace-folders h2 { color: #666; font-size: .8rem; margin: 4px 10px 16px; }
.area-links, .folder-links, .trash-links { display: grid; gap: 4px; }
.area-links { padding-bottom: 16px; border-bottom: 1px solid #ddd; margin-bottom: 16px; }
.workspace-folders a { color: #333; text-decoration: none; padding: 9px 10px; border-radius: 6px; display: block; }
.workspace-folders a:hover, .workspace-folders a[aria-current="page"] { background: #e9e8e1; }
.workspace-folders .muted { padding: 0 10px; font-size: .85rem; }
.folder-row { display: flex; gap: 2px; align-items: start; }
.folder-row > a { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.folder-row a span:first-child { overflow-wrap: anywhere; }
.folder-row small { display: block; color: #666; font-size: .7rem; font-weight: 400; }
.count { margin-left: auto; color: #777; font-size: .8rem; }
.folder-menu { flex: 0 0 20px; font-size: .8rem; padding-top: 6px; }
.folder-menu summary { cursor: pointer; list-style: none; font-size: 1.1rem; }
.folder-menu[open] { position: relative; }
.folder-menu a { padding: 6px 2px; min-width: 4em; }
.folder-add { margin: 16px 0; }
.trash-links { border-top: 1px solid #ddd; padding-top: 16px; font-size: .85rem; }
.workspace-notes { border-right: 1px solid #ddd; }
.list-heading { display: flex; align-items: center; justify-content: space-between; padding: 20px 18px 12px; }
.list-heading h1 { font-size: 1.1rem; margin: 0; }
.list-heading span { font-size: .8rem; color: #777; }
.workspace-search { border: 0; border-radius: 0; padding: 0 16px 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.workspace-search input[type="search"] { flex: 1; min-width: 100px; border-color: #ddd; background: #f7f7f5; padding: 8px; font-size: .85rem; }
.workspace-search button { padding: 6px 8px; font-size: .8rem; background: #fff; color: #444; border-color: #ccc; }
.workspace-search a { font-size: .8rem; }
.bulk-select { border: 0; border-radius: 0; padding: 8px 16px; display: flex; justify-content: space-between; align-items: center; background: #fafaf9; border-block: 1px solid #eee; }
.bulk-select label { display: flex; align-items: center; font-size: .75rem; font-weight: 400; margin: 0; }
.bulk-select button { font-size: .75rem; padding: 4px 8px; background: transparent; color: #555; border-color: #ccc; }
.note-row { display: flex; gap: 8px; padding: 14px 16px; border-bottom: 1px solid #eee; }
.note-row.selected { background: #fff4c6; }
.note-row > input { flex: 0 0 14px; margin: 6px 0 0; align-self: start; }
.note-row > a { display: block; flex: 1; min-width: 0; color: #333; text-decoration: none; font-weight: 400; }
.note-row strong { display: block; font-size: .9rem; overflow-wrap: anywhere; }
.note-row time { display: block; font-size: .7rem; color: #777; margin: 5px 0; }
.note-snippet { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: .8rem; color: #666; overflow-wrap: anywhere; }
.shared-badge { display: inline-block; color: #705a00; background: #f7e7a0; padding: 2px 6px; margin-top: 8px; border-radius: 4px; font-size: .65rem; }
.list-empty { padding: 20px; color: #777; font-size: .9rem; }
.pagination { padding: 14px; display: flex; gap: 16px; justify-content: center; font-size: .8rem; }
.workspace-content { padding: 24px 32px 60px; }
.workspace-content h1 { font-size: 1.6rem; margin: 16px 0 12px; overflow-wrap: anywhere; }
.content-nav { font-size: .8rem; }
.note-actions { gap: 14px; font-size: .8rem; }
.note-actions .button { padding: 7px 12px; }
.note-document { border: 0; padding: 12px 0; border-radius: 0; min-height: 160px; }
.workspace-content form[data-note-form] { border: 0; padding: 0; }
.muted { color: #777; font-size: .85rem; }
.content-empty { min-height: 60vh; display: flex; align-items: center; justify-content: center; flex-direction: column; color: #888; text-align: center; }
.content-empty p { font-size: .85rem; }
.mobile-panes { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (min-width: 861px) and (max-width: 1150px) {
    .workspace { grid-template-columns: 185px 245px minmax(0, 1fr); }
    .workspace-content { padding: 20px; }
}
@media (max-width: 860px) {
    .workspace-header { padding: 10px 12px; gap: 8px; }
    .workspace-brand { font-size: .9rem; }
    .workspace-brand small, .current-user { display: none; }
    .workspace-header .new-note, .workspace-header .logout-form button { font-size: .75rem; padding: 7px; }
    .mobile-panes { display: flex; padding: 6px 12px; gap: 6px; border-bottom: 1px solid #ddd; }
    .mobile-panes button { flex: 1; font-size: .8rem; padding: 6px; background: #fff; color: #444; border-color: #ddd; }
    .mobile-panes button[aria-pressed="true"] { background: #fff4c6; border-color: #dfc869; }
    .workspace { display: block; height: calc(100dvh - 111px); }
    .workspace-folders, .workspace-notes, .workspace-content { display: none; height: 100%; border: 0; }
    [data-active-pane="folders"] .workspace-folders, [data-active-pane="notes"] .workspace-notes, [data-active-pane="content"] .workspace-content { display: block; }
    .workspace-content { padding: 20px 16px 60px; }
    .inline-attachment iframe { height: 280px; }
}
