/* Compact workspace: reserve the viewport for the note, not decorative chrome. */
.workspace { grid-template-columns: 205px minmax(0, 1fr); height: 100dvh; min-height: 0; }
.sidebar { height: 100dvh; padding: 16px 12px 0; }
.sidebar .brand { font-size: 20px; padding-left: 5px; margin-bottom: 16px; }
.sidebar .brand-icon { width: 28px; height: 29px; font-size: 25px; border-radius: 7px; }
.sidebar-caption, .workspace-note, .app-footer, .editor-footer { display: none; }
.new-note { padding: 8px 10px; font-size: 13px; }
.main-nav { margin: 12px 0; }
.nav-item { padding: 7px 9px; margin: 1px 0; font-size: 13px; }
.topic-row > .nav-item { padding: 6px 4px; font-size: 12px; flex: 1; min-width: 0; width: auto; }
.topic-row .nav-item > span:nth-child(2) { overflow-wrap: anywhere; }
.topic-group { padding-left: 7px; margin-left: 12px; }
.topics-heading { padding-left: 8px; }
.sidebar-bottom { padding-top: 12px; }
.profile { padding: 10px 0; }
.main-content {
 display: grid;
 grid-template-columns: minmax(150px, 1fr) minmax(220px, 1.5fr);
 grid-template-rows: 34px auto minmax(0, 1fr);
 gap: 0 16px;
 padding: 0 16px 12px;
 min-height: 0;
}
.topbar { grid-column: 1 / -1; height: 34px; font-size: 10px; }
.collection-header { padding: 8px 0; gap: 8px; min-width: 0; }
.collection-header > div { min-width: 0; }
.collection-header .eyebrow, .heading-dot, .search-hint { display: none; }
.collection-header h1 { font-family: inherit; font-size: 18px; font-weight: 600; letter-spacing: -.3px; margin: 0; overflow-wrap: anywhere; }
.collection-header p { font-size: 10px; line-height: 1.3; margin-top: 3px; }
#edit-topic { font-size: 11px; padding: 5px 8px; flex-shrink: 0; }
.search-row { margin: 0; padding: 8px 0; min-width: 0; align-self: start; }
.search-field { padding: 6px 10px; max-width: none; min-width: 0; gap: 8px; border-radius: 6px; }
.search-field > span { font-size: 21px; }
.search-field input { min-width: 0; }
.notes-workspace { grid-column: 1 / -1; grid-template-columns: minmax(220px, 27%) minmax(0, 1fr); min-height: 0; height: auto; border-radius: 7px; }
.list-heading { padding: 6px 10px; }
.note-list { padding: 0 6px 6px; }
.note-card { padding: 10px; }
.note-card h3 { font-size: 12px; margin-bottom: 4px; }
.note-card .card-topic { margin-bottom: 4px; }
.note-card .snippet { font-size: 11px; line-height: 1.5; margin-bottom: 5px; }
.note-card.active:before { left: -7px; top: 10px; bottom: 10px; }
.editor-actions { padding: 5px 14px; min-height: 40px; }
.editor-actions > div { gap: 5px; }
.editor-actions .icon-button { font-size: 18px; padding: 3px 6px; }
.editor-actions .btn { padding: 5px 10px; }
.editor-body {
 display: grid;
 grid-template-columns: minmax(0, 1fr) minmax(80px, 30%);
 grid-template-rows: auto auto auto minmax(180px, 1fr);
 align-content: start;
 column-gap: 12px;
 padding: 12px 18px 18px;
}
.note-title { grid-column: 1; grid-row: 1; font-family: inherit; font-size: 20px; font-weight: 600; letter-spacing: -.3px; line-height: 1.4; min-width: 0; }
.topic-select { grid-column: 2; grid-row: 1; margin: 0; width: 100%; align-self: center; padding: 4px 6px; font-size: 11px; }
.note-meta { grid-column: 1 / -1; grid-row: 2; margin: 4px 0 8px; font-size: 10px; }
.format-toolbar { grid-column: 1 / -1; grid-row: 3; gap: 2px; padding: 2px 4px; margin-bottom: 12px; border-radius: 4px; }
.format-toolbar button { padding: 3px 7px; min-width: 28px; min-height: 28px; color: #607254; }
.toolbar-divider { margin: 0 3px; }
#note-content { grid-column: 1 / -1; grid-row: 4; min-height: 180px; font-size: var(--note-font-size, 14px); line-height: 1.65; color: #42563d; }
#note-content h2 { font-family: inherit; font-size: 1.286em; margin: 14px 0 8px; }
#note-content h3 { font-size: 1.143em; margin: 12px 0 6px; }
.account-controls { display: flex; align-items: center; gap: 6px; border-top: 1px solid #dde5d8; }
.account-controls .profile { min-width: 0; border-top: 0; flex: 1; }
.account-controls #user-name { overflow: hidden; text-overflow: ellipsis; }
.account-controls > .icon-button { flex-shrink: 0; }
.font-preview { padding: 16px; border: 1px solid var(--line); border-radius: 6px; line-height: 1.65; overflow-wrap: anywhere; }
/* One shared preference for navigation and the note overview. */
.workspace .nav-item, .workspace .topic-row > .nav-item,
.workspace .new-note, .workspace .profile, .note-card h3,
.workspace .search-field input, .workspace .format-toolbar button {
 font-size: var(--ui-font-size, 13px);
}
.note-card .snippet, .workspace .list-heading, .workspace .list-heading .form-select,
.workspace .editor-actions, .workspace .editor-actions .btn, .workspace .topic-select,
.workspace .topics-heading, .workspace #edit-topic, .workspace .pagination-row,
.workspace .pagination-row .btn, .workspace .topbar {
 font-size: calc(var(--ui-font-size, 13px) - 1px);
}
.note-card .card-topic, .note-card .card-date, .note-card .drag-hint,
.workspace .count, .workspace .private-label, .workspace .collection-header p,
.workspace .search-field kbd, .workspace .new-note kbd {
 font-size: calc(var(--ui-font-size, 13px) - 2px);
}
.workspace .collection-header h1 { font-size: calc(var(--ui-font-size, 13px) + 4px); }
.workspace .list-heading { flex-wrap: wrap; }
.workspace .list-heading .form-select { width: auto; max-width: 100%; }
.workspace .editor-actions { flex-wrap: wrap; }
.workspace .editor-actions > div { margin-left: auto; }
.workspace .collection-header { flex-wrap: wrap; }
.workspace .breadcrumb-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#settings-dialog { max-height: calc(100dvh - 32px); overflow: auto; }
.trash-target { color: #8a5148; }
.trash-target:hover { background: #f5e6e1; }
.accepting-note [data-trash] { outline: 1px dashed #bd8275; outline-offset: -2px; }
.accepting-note [data-trash].drop-target { background: #f4d6cf!important; color: #8c3025; outline-color: #b34f3f; }
.accepting-note [data-trash].drop-target:after { content: '×'; }
.accepting-document [data-doc-folder], .accepting-document #unfiled-documents { outline: 1px dashed #9db398; outline-offset: -2px; }
.accepting-document .drop-target { background: #d3e5cb!important; outline: 2px solid #477b3f; outline-offset: -2px; color: #234a24; }
.accepting-document [data-trash] { outline: 1px dashed #bd8275; outline-offset: -2px; }
.accepting-document [data-trash].drop-target { background: #f4d6cf!important; color: #8c3025; outline-color: #b34f3f; }
.documents-heading { margin-top: 18px; }
.section-button { border: 0; padding: 6px 0; background: transparent; color: inherit; font: inherit; letter-spacing: inherit; text-align: left; }
.document-mode { grid-template-rows: 34px minmax(0,1fr); }
.document-mode > .collection-header, .document-mode > .search-row, .document-mode > .notes-workspace { display: none; }
#documents-panel { grid-column: 1 / -1; min-height: 0; display: flex; flex-direction: column; padding-top: 10px; }
.documents-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.documents-toolbar h1 { font-size: calc(var(--ui-font-size,13px) + 4px); margin: 0 0 4px; }
.documents-toolbar p { font-size: calc(var(--ui-font-size,13px) - 2px); color: #75816e; margin: 0; }
.document-buttons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.document-buttons .btn { font-size: var(--ui-font-size,13px); }
.document-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.document-actions .btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 6px; }
.document-actions svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.documents-search { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.documents-search input { flex: 1; min-width: 180px; font-size: var(--ui-font-size,13px); }
#document-message:empty { display: none; }
.documents-columns { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(220px,27%) minmax(0,1fr); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: white; }
.documents-list-panel { overflow: auto; min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); padding: 6px; }
.document-detail { overflow: auto; min-width: 0; padding: 16px; }
.document-title-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
#document-title { margin: 0; font-family: inherit; font-size: calc(var(--ui-font-size,13px) + 5px); overflow-wrap: anywhere; min-width: 0; }
#rename-document { flex: 0 0 auto; font-size: 18px; }
#document-title-input { flex: 1; min-width: 0; font-size: calc(var(--ui-font-size,13px) + 5px); }
#confirm-document-title, #cancel-document-title { flex: 0 0 auto; }
#document-note { font-size: var(--note-font-size,14px); line-height: 1.5; min-height: 80px; height: 100px; resize: vertical; }
.document-preview { position: relative; height: 600px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #f3f5f1; }
.document-preview-content { height: 100%; min-height: 0; overflow: auto; }
.document-preview-content img { display: block; width: 100%; height: 100%; object-fit: contain; }
.document-preview-content iframe { display: block; width: 100%; height: 100%; border: 0; background: white; }
.document-preview-content pre { padding: 16px; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.preview-unavailable { display: grid; place-content: center; padding: 24px; text-align: center; color: #66715f; }
.document-preview-open { position: absolute; inset: 0; border: 0; background: transparent; cursor: zoom-in; display: flex; justify-content: center; align-items: end; padding: 16px; }
.document-preview-open span { background: #245e50; color: white; padding: 7px 14px; border-radius: 5px; box-shadow: 0 2px 8px #0003; }
.document-preview-open:focus-visible { outline: 3px solid #245e50; outline-offset: -3px; }
#document-preview-dialog { width: 92vw; max-width: 1600px; height: 90vh; height: 90dvh; max-height: 90dvh; padding: 16px; overflow: hidden; }
#document-preview-dialog[open] { display: flex; flex-direction: column; }
#document-preview-dialog .dialog-heading { flex: 0 0 auto; gap: 12px; margin-bottom: 12px; }
#document-preview-title { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#document-preview-large { flex: 1; background: #f3f5f1; }
.document-detail .form-label, .document-detail .form-select { font-size: var(--ui-font-size,13px); }
@media(max-width:700px) {
 .documents-columns { display: block; overflow: auto; }
 .documents-list-panel { max-height: 32vh; border-right: 0; border-bottom: 1px solid var(--line); }
 .document-detail { overflow: visible; }
 .document-mode { grid-template-rows: 32px minmax(0,1fr); }
}
#note-content p { margin-bottom: 10px; }
.editor-empty { padding: 24px; }
.editor-empty h2 { font-size: 22px; }
@media (max-width: 900px) {
 .workspace { grid-template-columns: 180px minmax(0, 1fr); }
 .main-content { grid-template-columns: 1fr; grid-template-rows: 32px auto auto minmax(0, 1fr); gap: 0; padding: 0 10px 10px; }
 .topbar { height: 32px; }
 .collection-header { padding: 6px 0 0; }
 .collection-header h1 { font-size: 16px; }
 .search-row { padding: 6px 0; }
 .notes-workspace { grid-template-columns: 1fr; min-height: 0; height: auto; }
}
@media (max-width: 600px) {
 .workspace { display: block; }
 .main-content { height: 100dvh; padding: 0 8px 8px; }
 .sidebar { width: 230px; }
 .editor-body { padding: 10px 12px 14px; column-gap: 8px; }
 .note-title { font-size: 18px; }
 .editor-actions { padding: 4px 8px; }
 .format-toolbar { gap: 1px; }
 .format-toolbar button { min-height: 32px; }
}

#note-content [data-sealed] { display: inline-block; white-space: pre-wrap; border: 1px solid #a7bdae; border-radius: 6px; padding: 3px 7px; background: #edf4ef; cursor: pointer; max-width: 100%; overflow-wrap: anywhere; }
#vault-dialog { max-height: calc(100dvh - 32px); overflow: auto; width: min(560px, calc(100vw - 30px)); }
#toggle-protected { margin-left: 0; white-space: normal; }
.workspace .topbar { height: auto; min-height: 38px; padding-top: 4px; padding-bottom: 4px; gap: 8px; }
.main-content { grid-template-rows: minmax(42px, auto) auto minmax(0, 1fr); }
@media (max-width: 900px) { .main-content { grid-template-rows: minmax(48px, auto) auto auto minmax(0, 1fr); } }
.main-content.document-mode { grid-template-rows: minmax(48px, auto) minmax(0, 1fr); }
@media (max-width: 600px) { #toggle-protected { font-size: 11px; padding: 4px 8px; max-width: 180px; } }
.header-controls { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
.font-presets { display: inline-flex; align-items: center; border: 1px solid #d4ded5; border-radius: 7px; overflow: hidden; flex-shrink: 0; }
.font-presets button { width: 34px; height: 36px; padding: 0; border: 0; border-radius: 0; background: transparent; color: #5c7063; font-weight: 600; line-height: 1; }
.font-presets button + button { border-left: 1px solid #d4ded5; }
.font-presets button:nth-child(1) { font-size: 12px; }
.font-presets button:nth-child(2) { font-size: 16px; }
.font-presets button:nth-child(3) { font-size: 20px; }
.font-presets button[aria-pressed="true"] { color: #194b3f; background: #e2ece3; box-shadow: inset 0 -2px #245e50; }
.font-presets button:hover { background: #edf3ed; }
.font-presets button:focus-visible { outline-offset: -3px; }
.font-presets button:disabled { opacity: .5; }
@media (max-width: 1100px) { .topbar .private-label { display: none; } }
@media (max-width: 600px) {
 .topbar .breadcrumb-label { display: none; }
 .header-controls { gap: 6px; min-width: 0; flex: 1; justify-content: flex-end; }
 .font-presets button { width: 34px; height: 40px; }
 #toggle-protected { min-height: 40px; flex: 0 1 170px; min-width: 0; line-height: 1.25; }
 .workspace .topbar { gap: 6px; }
 .topbar #toggle-sidebar { flex-shrink: 0; }
}
