:root {
    /* Obsidian/Zed inspired Dark Palette */
    --bg-main: #1e1e1e;
    --bg-sidebar: #252525;
    --bg-active-line: #161616;
    --bg-elevated: #2a2a2a;
    --bg-input: #1a1a1a;
    --bg-overlay: rgba(0, 0, 0, 0.7);
    --bg-panel-highlight: rgba(0, 0, 0, 0.1);
    --bg-panel-strong: rgba(0, 0, 0, 0.2);
    --bg-hover-soft: rgba(255, 255, 255, 0.05);
    --bg-hover-line: rgba(255, 255, 255, 0.02);
    --bg-code-inline: rgba(255, 255, 255, 0.1);
    --bg-code-block: rgba(0, 0, 0, 0.3);
    --bg-accent-soft: rgba(255, 116, 0, 0.1);
    --border-accent-soft: rgba(255, 116, 0, 0.3);

    --text-main: #dcddde;
    --text-muted: #909090;
    --text-strong: #ffffff;
    --text-subtle: #666666;
    --border-color: #333333;

    --accent: #ff7400; /* Orange */
    --accent-hover: #d96200;
    --bg-selected: #1a0c00;
    --danger: #ff4d4d;
    --danger-soft: rgba(255, 77, 77, 0.1);
    --danger-strong: #ff6b6b;

    --icon-size: 13px;
    --sidebar-width: 280px;
    --context-sidebar-width: 320px;
    --sidebar-effective-width: var(--sidebar-width);
    --context-sidebar-effective-width: var(--context-sidebar-width);
    --editor-max-width: 850px;
    --modal-width: 400px;
    --search-modal-width: 550px;
    --mobile-header-height: 58px;

    --space-1: 4px;
    --space-2: 5px;
    --space-3: 6px;
    --space-4: 8px;
    --space-5: 10px;
    --space-6: 12px;
    --space-7: 15px;
    --space-8: 18px;
    --space-9: 20px;
    --space-10: 25px;
    --space-11: 30px;
    --space-12: 40px;
    --space-13: 60px;

    --radius-sm: 0.25vw;
    --radius-md: 0.25vw;
    --radius-lg: 0.25vw;
    --radius-xl: 0.25vw;
    --shadow-modal: 0 10px 30px rgba(0, 0, 0, 0.5);
    --transition-fast: 0.2s;
    --transition-page: 0.25s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
        sans-serif;
}

body {
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
    max-width: 100vw;
    overflow-x: clip;
    background: var(--bg-main);
    color: var(--text-main);
    color-scheme: dark;
}

body[data-meta-pane="collapsed"] {
    --context-sidebar-width: 58px;
    --context-sidebar-effective-width: 58px;
}

body[data-sidebar-pane="collapsed"] {
    --sidebar-effective-width: 58px;
}

.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: 100%;
    max-width: 100vw;
    overflow-x: clip;
}

.app-layout {
    display: block;
    position: relative;
    flex: 1;
    min-height: 0;
    height: 100%;
    max-width: 100vw;
    overflow-x: clip;
}

.app-page {
    min-height: 0;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 4;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: hidden;
    transition: width 0.25s ease, border-color var(--transition-fast);
}

body[data-sidebar-pane="collapsed"] .sidebar {
    width: 58px;
}

.context-sidebar {
    width: var(--context-sidebar-width);
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 4;
    min-width: 0;
    overflow: hidden;
    transition: width 0.25s ease, border-color var(--transition-fast);
}

body[data-meta-pane="collapsed"] .context-sidebar {
    width: var(--context-sidebar-width);
}

.context-sidebar-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    height: 100%;
}

.context-sidebar-header {
    padding: var(--space-6) var(--space-5);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-panel-highlight);
    min-width: 0;
}

.context-sidebar-content {
    padding: var(--space-6) var(--space-5) var(--space-8);
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
}

.context-sidebar-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
}

.context-sidebar-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-strong);
}

.context-sidebar-copy {
    margin-top: var(--space-2);
    font-size: 12px;
    color: var(--text-muted);
}

.context-sidebar-toggle {
    flex: 0 0 auto;
}

body[data-meta-pane="collapsed"] .context-sidebar-header {
    padding: var(--space-5) var(--space-3);
}

body[data-meta-pane="collapsed"] .context-sidebar-content {
    display: none;
}

body[data-meta-pane="collapsed"] .context-sidebar-title,
body[data-meta-pane="collapsed"] .context-sidebar-copy {
    display: none;
}

body[data-meta-pane="collapsed"] .context-sidebar-title-row {
    justify-content: center;
}

.sidebar-resizer {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--sidebar-width);
    width: 8px;
    cursor: col-resize;
    background: transparent;
    z-index: 5;
}

body[data-sidebar-pane="collapsed"] .sidebar-resizer {
    display: none;
}

.sidebar-resizer-right {
    left: auto;
    right: var(--context-sidebar-width);
}

body[data-meta-pane="collapsed"] .sidebar-resizer-right {
    display: none;
}

.sidebar-resizer::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    transform: translateX(-50%);
    background: var(--border-color);
    opacity: 0.55;
    transition: background var(--transition-fast), opacity var(--transition-fast);
}

.sidebar-resizer:hover::before,
body[data-sidebar-resizing="true"] .sidebar-resizer::before {
    background: var(--accent);
    opacity: 1;
}

.sidebar-header {
    padding: var(--space-6) var(--space-5);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-panel-highlight);
    min-width: 0;
    overflow-x: hidden;
}

.sidebar-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
}

.sidebar-collapse-toggle {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-main);
}

.sidebar-collapse-toggle-brand {
    width: 100%;
    height: auto;
    padding: 0;
    border: 0;
    background: transparent;
}

body[data-sidebar-pane="collapsed"] .sidebar-header {
    padding: var(--space-6) var(--space-3);
}

body[data-sidebar-pane="collapsed"] .sidebar-tools,
body[data-sidebar-pane="collapsed"] #sidebar-notes,
body[data-sidebar-pane="collapsed"] #sidebar-tags,
body[data-sidebar-pane="collapsed"] .sidebar-footer {
    display: none;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}

.app-brand-button {
    width: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.app-brand-logo {
    width: 42px;
    height: 42px;
    display: block;
    border-radius: 12px;
    flex-shrink: 0;
}

.app-brand-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.app-brand-name {
    color: var(--text-strong);
    font-size: 19px;
    line-height: 1.05;
    letter-spacing: 0.01em;
}

.app-brand-tagline {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar-search-btn {
    width: 100%;
    margin-top: var(--space-5);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-6);
    display: flex;
    align-items: center;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 13px;
    transition: all var(--transition-fast);
}
.sidebar-search-btn:hover {
    border-color: var(--accent);
    color: var(--text-main);
}

.search-icon {
    margin-right: var(--space-4);
    display: inline-flex;
    align-items: center;
}

.app-icon {
    --icon-size: 18px;
    --icon-mask: none;
    display: inline-block;
    width: var(--icon-size);
    height: var(--icon-size);
    flex: 0 0 var(--icon-size);
    background-color: currentColor;
    -webkit-mask-image: var(--icon-mask);
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    mask-image: var(--icon-mask);
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
    vertical-align: middle;
}

.app-icon-sm {
    --icon-size: 14px;
}

.app-icon-lg {
    --icon-size: 20px;
}

.shortcut-hint {
    margin-left: auto;
}

.mobile-brand-logo {
    width: 26px;
    height: 26px;
    display: block;
    border-radius: 8px;
}

.mobile-brand-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-strong);
    letter-spacing: 0.01em;
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-panel-strong);
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}
.tab {
    flex: 1;
    padding: var(--space-6);
    text-align: center;
    cursor: pointer;
    background: transparent;
    border: none;
    font-weight: bold;
    color: var(--text-muted);
    outline: none;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.tab.active {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
    background: var(--bg-selected);
}

.sidebar-tools {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-panel-highlight);
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
    transition: opacity 0.2s ease, max-height 0.25s ease, padding 0.25s ease, border-color 0.25s ease;
    max-height: 72px;
}

.sidebar-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.sidebar-tool-btn .app-icon {
    --icon-size: 18px;
}

.sidebar-tool-btn:hover,
.sidebar-tool-btn:focus-visible {
    color: var(--text-main);
    border-color: var(--border-color);
    background: var(--bg-hover-soft);
    outline: none;
}

.sidebar-tool-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
    padding: var(--space-5);
    min-height: 0;
    min-width: 0;
    transition: opacity 0.2s ease, max-height 0.25s ease, padding 0.25s ease;
    max-height: 9999px;
}

.sidebar-notes-sticky {
    position: sticky;
    top: 0;
    z-index: 4;
    background: var(--bg-sidebar);
    padding-bottom: var(--space-4);
    margin: calc(var(--space-5) * -1);
    margin-bottom: var(--space-4);
    padding-top: var(--space-5);
    padding-left: var(--space-5);
    padding-right: var(--space-5);
    box-shadow: 0 1px 0 var(--border-color);
}

.sidebar-notes-sticky::before {
    content: "";
    position: absolute;
    top: calc(var(--space-5) * -1);
    left: 0;
    right: 0;
    height: var(--space-5);
    background: var(--bg-sidebar);
}

.sidebar-footer {
    padding: var(--space-5);
    padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border-color);
    background: var(--bg-panel-highlight);
    position: sticky;
    bottom: 0;
    z-index: 20;
    min-width: 0;
    overflow: visible;
    transition: opacity 0.2s ease, max-height 0.25s ease, padding 0.25s ease, border-color 0.25s ease;
    max-height: 120px;
}

body[data-sidebar-pane="collapsed"] .sidebar-tools,
body[data-sidebar-pane="collapsed"] #sidebar-notes,
body[data-sidebar-pane="collapsed"] #sidebar-tags,
body[data-sidebar-pane="collapsed"] .sidebar-footer {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    border-color: transparent;
}

.sidebar-logout-btn {
    width: 100%;
    justify-content: center;
}

.sidebar-footer-menu {
    position: relative;
    z-index: 21;
}

.sidebar-footer-trigger {
    width: 100%;
}

.sidebar-footer-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + var(--space-4));
    z-index: 30;
    display: grid;
    gap: var(--space-2);
    padding: var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-modal);
}

.sidebar-footer-dropdown[hidden] {
    display: none !important;
}

.sidebar-footer-logout-form {
    margin: 0;
}

.sidebar-footer-item {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-main);
    text-align: left;
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    font-size: 13px;
}

.sidebar-footer-item:hover {
    background: var(--bg-selected);
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-7);
    font-size: 12px;
    flex-wrap: wrap;
    min-width: 0;
    max-width: 100%;
}

.filter-bar select,
.filter-bar button,
.notes-toggle {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-main);
    outline: none;
    min-height: 38px;
}

.filter-bar select,
.filter-bar button {
    padding: 0 var(--space-4);
    cursor: pointer;
}

.filter-bar select {
    flex: 1 1 150px;
    appearance: none;
}

.filter-bar select:focus,
.filter-bar button:focus,
.notes-toggle:focus-within {
    border-color: var(--accent);
}

.filter-bar button {
    flex: 0 0 44px;
    justify-content: center;
    padding: 0;
}

.filter-bar button:hover {
    background: var(--bg-selected);
}

.type-filter-meta {
    margin-top: calc(var(--space-7) * -0.5);
    margin-bottom: var(--space-7);
    font-size: 12px;
    color: var(--text-muted);
}

.notes-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    flex: 0 1 auto;
    white-space: nowrap;
    position: relative;
}

.notes-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    inset: 0;
}

.notes-toggle span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 var(--space-4);
}

.notes-toggle:hover {
    color: var(--text-main);
    background: var(--bg-selected);
}

.notes-toggle:has(input:checked) {
    color: var(--text-strong);
    border-color: var(--accent);
    background: var(--bg-selected);
}

/* Lists */
.list-item {
    padding: var(--space-5) var(--space-6);
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-bottom: 3px;
    display: flex;
    flex-direction: column;
    transition: background 0.1s;
}
.list-item:hover {
    background: var(--bg-elevated);
}
.list-item.active {
    background: var(--bg-selected);
    color: var(--text-strong);
}
.list-item.active .list-item-title {
    color: var(--accent);
}
.list-item-title {
    flex: 1;
    min-width: 0;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-main);
    white-space: normal;
    overflow-wrap: anywhere;
    max-inline-size: 40ch;
    line-height: 1.35;
}

.list-item-title-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    justify-content: space-between;
    min-width: 0;
}

.notes-list-section,
.pinned-notes-list {
    display: grid;
    gap: 3px;
    min-width: 0;
    max-width: 100%;
}

.pinned-notes-section {
    display: grid;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.pinned-notes-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
}

.pinned-notes-toggle:hover {
    color: var(--text-main);
}

.pinned-notes-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.note-list-menu {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.note-list-menu-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.note-list-menu-trigger:hover,
.note-list-menu.open .note-list-menu-trigger {
    border-color: var(--border-color);
    background: var(--bg-hover-soft);
    color: var(--text-main);
}

.note-list-menu-trigger .app-icon {
    --icon-size: 16px;
}

.note-list-menu-dropdown {
    position: absolute;
    top: calc(100% + var(--space-2));
    right: 0;
    min-width: 150px;
    display: grid;
    gap: var(--space-2);
    padding: var(--space-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-modal);
    z-index: 5;
}

.note-list-menu-dropdown[hidden] {
    display: none !important;
}

.note-list-menu-item {
    width: 100%;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-main);
    text-align: left;
    padding: var(--space-3) var(--space-4);
    font-size: 13px;
    cursor: pointer;
}

.note-list-menu-item:hover {
    background: var(--bg-selected);
}

.note-type-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: 3px var(--space-4);
    border-radius: 999px;
    border: 1px solid var(--border-accent-soft);
    background: var(--bg-accent-soft);
    color: var(--accent);
    font-size: 11px;
    line-height: 1.2;
}
.list-item-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 5px;
}

.tag-item {
    display: inline-block;
    padding: var(--space-1) var(--space-5);
    background: var(--bg-hover-soft);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin: 0 6px 6px 0;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}
.tag-item:hover {
    background: var(--accent);
    color: var(--text-strong);
    border-color: var(--accent);
}

.active-filter {
    padding: var(--space-5);
    background: var(--bg-accent-soft);
    border: 1px solid var(--border-accent-soft);
    font-size: 12px;
    margin-bottom: var(--space-7);
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--accent);
}
.clear-filter {
    cursor: pointer;
    font-weight: bold;
    color: var(--text-muted);
    font-size: 16px;
    margin-left: var(--space-5);
}
.clear-filter:hover {
    color: var(--danger-strong);
}

.clear-filter .app-icon {
    --icon-size: 14px;
}

/* Editor */
.editor-container {
    width: 100%;
    height: 100%;
    min-width: 0;
    padding: 0;
    overflow-y: auto;
    scrollbar-gutter: stable;
    display: flex;
    flex-direction: column;
    align-items: center;
    scroll-behavior: smooth;
    transition: background-color 0.2s;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.editor-container::-webkit-scrollbar {
    width: 0;
    height: 0;
}

/* Drag & Drop Overlay Style */
.editor-container.drag-over {
    background-color: rgba(255, 116, 0, 0.05);
    box-shadow: inset 0 0 0 2px dashed var(--accent);
}

.editor-content {
    width: 100%;
    max-width: var(--editor-max-width);
    min-width: 0;
    padding: var(--space-13) var(--space-12) 200px var(--space-12);
    min-height: 100%;
    display: grid;
    align-content: start;
    grid-auto-rows: min-content;
    row-gap: var(--space-7);
    transition: width 0.25s ease, max-width 0.25s ease;
}

body[data-editor-section="graph"] .editor-content {
    min-height: 100%;
    height: 100%;
    width: 100%;
    max-width: none;
    padding: var(--space-9) var(--space-12) var(--space-8);
    grid-template-rows: auto auto auto minmax(0, 1fr);
    row-gap: var(--space-6);
    transform: none;
}

body[data-editor-section="graph"] .editor-container {
    align-items: stretch;
}

body[data-editor-section="graph"] .editor-header,
body[data-editor-section="graph"] .editor-tabs,
body[data-editor-section="graph"] .note-tabs,
body[data-editor-section="graph"] .editor-loading-state {
    width: min(100%, var(--editor-max-width));
    justify-self: center;
    transition: width 0.25s ease;
}

@media (min-width: 901px) and ((orientation: landscape) or (min-width: 1181px)) {
    body[data-editor-width="wide"] .editor-content {
        width: 75%;
        max-width: none;
    }
}

.editor-content::after {
    content: "";
    display: block;
    height: 40vh; /* Sorgt dafür, dass man weit über den Text hinaus scrollen kann */
}

body[data-editor-section="graph"] .editor-content::after {
    display: none;
}

/* Editor Header (Rename / Delete) */
.editor-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--space-7);
    gap: var(--space-7);
    min-height: 58px;
}
.editor-title-wrap {
    min-width: 0;
    display: grid;
    gap: 6px;
}
.editor-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-main);
    flex: 1;
    min-width: 0;
    word-break: break-word;
    line-height: 1.25;
}
.editor-save-status {
    font-size: 12px;
    color: var(--text-dim);
}
.editor-save-status[data-state="success"] {
    color: var(--accent-color);
}
.editor-save-status[data-state="error"] {
    color: var(--danger-color);
}
.editor-actions {
    display: flex;
    gap: var(--space-5);
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: center;
    min-height: 36px;
}

.share-note-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
}

#share-preview-capture-root {
    position: fixed;
    left: -200vw;
    top: 0;
    width: 1200px;
    height: 630px;
    pointer-events: none;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.share-preview-capture-frame {
    width: 1200px;
    height: 630px;
    background: #1e1e1e;
    color: #dcddde;
    padding: 40px 48px 44px;
    display: grid;
    align-content: start;
    gap: 22px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.share-preview-capture-topbar {
    display: flex;
    align-items: center;
    gap: 16px;
}

.share-preview-capture-logo {
    width: 52px;
    height: 52px;
    flex: 0 0 auto;
    object-fit: contain;
}

.share-preview-capture-brand {
    display: grid;
    gap: 2px;
}

.share-preview-capture-brand strong {
    font-size: 24px;
    line-height: 1.05;
    color: #f3f3f3;
}

.share-preview-capture-brand span {
    font-size: 14px;
    color: #8f8f8f;
}

.share-preview-capture-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.share-preview-capture-pill {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid #333;
    background: #252525;
    color: #b8b8b8;
    font-size: 13px;
}

.share-preview-capture-pill-date {
    min-width: 240px;
}

.share-preview-capture-card {
    display: grid;
    gap: 36px;
    min-height: 0;
}

.share-preview-capture-title {
    margin: 24px 0 44px;
    font-size: 64px;
    line-height: 1.02;
    letter-spacing: -0.04em;
    font-weight: 800;
    color: #f1f1f1;
}

.share-preview-capture-body {
    min-height: 0;
    overflow: hidden;
    font-size: 24px;
    line-height: 1.58;
    color: #dbdbdb;
}

.share-preview-capture-body h1,
.share-preview-capture-body h2,
.share-preview-capture-body h3 {
    margin: 0 0 12px;
    color: #f1f1f1;
    line-height: 1.14;
}

.share-preview-capture-body p {
    margin: 0 0 56px;
}

.share-preview-capture-body ul,
.share-preview-capture-body ol {
    margin: 0 0 32px 1.35em;
    padding: 0;
}

.share-preview-capture-body li + li {
    margin-top: 8px;
}

.share-preview-capture-body blockquote {
    margin: 18px 0 18px 40px;
    padding: 1rem;
    border-left: 3px solid #ff7400;
    color: #c2c2c2;
}

.share-preview-capture-body a {
    color: #ff7400;
}

.share-preview-capture-body code,
.share-preview-capture-body pre,
.share-preview-capture-body table,
.share-preview-capture-body .pdf-viewer,
.share-preview-capture-body iframe {
    display: none !important;
}

.share-preview-capture-body img {
    max-width: 100%;
    height: auto;
    border-radius: 14px;
    display: block;
    margin: 0 0 28px;
}

.share-preview-capture-body .embedded-note,
.share-preview-capture-body .embedded-attachment {
    margin: 36px 0 52px 40px;
    padding: 1rem;
    border-left: 3px solid #ff7400;
}

.share-preview-capture-body .embedded-note-header {
    display: block;
    margin: 0;
    color: #f1f1f1;
    font-size: 30px;
    line-height: 1.14;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.share-preview-capture-body .embedded-note-body {
    padding-top: 20px;
}

.share-preview-capture-body .embedded-attachment-preview {
    display: none;
}

.share-preview-capture-body .embedded-attachment-meta {
    display: grid;
    gap: 4px;
}

.share-preview-capture-body .embedded-attachment-meta strong {
    color: #f1f1f1;
}

.share-preview-capture-body .embedded-attachment-meta span,
.share-preview-capture-body .embed-missing,
.share-preview-capture-body .embedded-note-error {
    color: #b6b6b6;
}

.note-tabs {
    display: flex;
    gap: var(--space-3);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-gutter: stable;
    padding-bottom: var(--space-2);
    scrollbar-width: thin;
    min-height: 44px;
    align-items: center;
}

.note-tab {
    display: inline-flex;
    align-items: center;
    gap: var(--space-4);
    min-width: 0;
    max-width: 240px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-panel-highlight);
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-3) var(--space-4);
    flex-shrink: 0;
}

.note-tab.active {
    background: var(--bg-selected);
    border-color: var(--accent);
    color: var(--text-strong);
}

.note-tab-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.note-tab-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.note-tab:hover .note-tab-close,
.note-tab.active .note-tab-close {
    color: var(--text-main);
    background: var(--bg-hover-soft);
}

.note-tab-close .app-icon {
    --icon-size: 12px;
}

.editor-tabs {
    display: flex;
    gap: var(--space-3);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    min-height: 44px;
    align-items: center;
}

.editor-tab {
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-6);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.editor-tab:hover {
    color: var(--text-main);
    border-color: var(--accent);
}

.editor-tab.active {
    color: var(--text-strong);
    background: var(--bg-selected);
    border-color: var(--accent);
}

.editor-tab-panel {
    min-height: 0;
    min-height: min(72vh, 900px);
    min-width: 0;
    padding-top: var(--space-2);
    display: grid;
    align-content: start;
}

body[data-editor-section="graph"] .editor-tab-panel {
    min-height: 0;
    height: 100%;
}

.codemirror-note-panel {
    display: grid;
    gap: var(--space-5);
    min-height: inherit;
    min-width: 0;
    align-content: start;
    padding: 0 0 var(--space-5);
}

.note-reading-panel {
    min-height: inherit;
    min-width: 0;
    width: 100%;
    padding: 0 var(--space-4) var(--space-5);
}

.codemirror-note-hint {
    font-size: 12px;
    color: var(--text-muted);
    padding: 0 8px;
    min-height: 18px;
}

.codemirror-fallback-textarea {
    width: 100%;
    min-height: 360px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--text-main);
    font-size: 16px;
    line-height: 1.7;
    padding: 2px 8px;
    resize: vertical;
    outline: none;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.codemirror-fallback-textarea:focus {
    border-color: var(--accent);
}

.CodeMirror {
    display: block;
    height: auto;
    min-height: inherit;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--text-main);
    font-size: 16px;
    line-height: 1.7;
    font-family: inherit;
    font-weight: 400;
    letter-spacing: normal;
    padding: 0;
}

.CodeMirror,
.CodeMirror pre,
.CodeMirror span,
.CodeMirror-line,
.CodeMirror-line span,
.CodeMirror pre.CodeMirror-line {
    font-family: inherit !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    letter-spacing: normal !important;
    line-height: 1.7 !important;
}

.CodeMirror-focused {
    box-shadow: none;
}

.CodeMirror-gutters {
    background: transparent;
    border-right: none;
}

.CodeMirror-cursor {
    border-left-color: var(--text-strong);
}

.CodeMirror-scroll,
.CodeMirror-sizer,
.CodeMirror-lines,
.CodeMirror-line,
.CodeMirror pre.CodeMirror-line {
    color: var(--text-main);
    line-height: 1.7;
    font-family: inherit;
    font-size: 16px;
    font-weight: 400;
    letter-spacing: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.CodeMirror-scroll {
    overflow-y: hidden !important;
    overflow-x: auto !important;
    scrollbar-gutter: stable both-edges;
}

.CodeMirror-lines {
    padding: 2px 8px;
}

.CodeMirror pre {
    line-height: 1.7;
    font-family: inherit;
    font-size: 16px;
    font-weight: 400;
    letter-spacing: normal;
}

.CodeMirror-line span {
    color: var(--text-main);
}

.CodeMirror .cm-header,
.CodeMirror .cm-strong,
.CodeMirror .cm-em,
.CodeMirror .cm-link,
.CodeMirror .cm-url,
.CodeMirror .cm-string,
.CodeMirror .cm-comment,
.CodeMirror .cm-quote,
.CodeMirror .cm-tag,
.CodeMirror .cm-atom,
.CodeMirror .cm-number,
.CodeMirror .cm-variable,
.CodeMirror .cm-variable-2,
.CodeMirror .cm-variable-3,
.CodeMirror .cm-keyword,
.CodeMirror .cm-def,
.CodeMirror .cm-operator,
.CodeMirror .cm-property,
.CodeMirror .cm-qualifier,
.CodeMirror .cm-meta,
.CodeMirror .cm-builtin,
.CodeMirror .cm-bracket {
    color: var(--text-main);
}

.CodeMirror .cm-formatting,
.CodeMirror .cm-formatting-list,
.CodeMirror .cm-formatting-link,
.CodeMirror .cm-formatting-header,
.CodeMirror .cm-formatting-quote {
    color: var(--text-muted);
}

.CodeMirror-selected,
span.CodeMirror-selectedtext {
    background: rgba(255, 116, 0, 0.22) !important;
}

.related-notes {
    margin-top: var(--space-10);
    margin-bottom: var(--space-10);
    padding: var(--space-7);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    background: var(--bg-panel-highlight);
}

.related-notes-tab {
    margin-top: 0;
}

.relations-panel {
    display: grid;
    gap: var(--space-8);
}

.metadata-panel {
    display: grid;
    gap: var(--space-8);
}

.metadata-panel-compact {
    gap: var(--space-4);
}

.metadata-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-5);
    flex-wrap: wrap;
}

.metadata-header h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-strong);
}

.metadata-header span {
    font-size: 12px;
    color: var(--text-muted);
}

.metadata-group {
    display: grid;
    gap: var(--space-4);
    padding: var(--space-5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-input);
}

.metadata-label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.metadata-type-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.metadata-custom-type {
    display: flex;
    gap: var(--space-4);
    align-items: center;
    flex-wrap: wrap;
}

.metadata-custom-type input {
    flex: 1;
    min-width: 200px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-5);
    background: var(--bg-input);
    color: var(--text-main);
    outline: none;
}

.metadata-custom-type input:focus {
    border-color: var(--accent);
}

.metadata-custom-type .btn {
    flex-shrink: 0;
}

.metadata-type-select-wrap {
    display: block;
}

.metadata-type-select {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-5);
    background: var(--bg-input);
    color: var(--text-main);
    outline: none;
}

.metadata-type-select:focus {
    border-color: var(--accent);
}

.metadata-template-actions {
    display: flex;
    gap: var(--space-4);
    align-items: center;
    flex-wrap: wrap;
}

.metadata-template-actions span {
    font-size: 12px;
    color: var(--text-muted);
}

.metadata-attachment-toolbar {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.attachment-card {
    display: grid;
    gap: var(--space-4);
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    padding: var(--space-6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-input);
    max-width: var(--editor-max-width);
    width: min(100%, var(--editor-max-width));
    margin-inline: auto;
}

.attachment-card-compact {
    max-width: 700px;
}

.attachment-card-pdf {
    gap: var(--space-3);
}

.attachment-card-preview {
    min-width: 0;
}

.attachment-preview-image,
.attachment-preview-pdf {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 120px;
    max-height: 280px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-main);
}

.attachment-preview-pdf {
    height: 220px;
}

.pdf-viewer {
    display: grid;
    gap: 0.65rem;
    min-height: 220px;
}

.pdf-viewer-compact {
    min-height: 180px;
}

.pdf-viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    width: 100%;
}

.pdf-viewer-toolbar-main {
    display: grid;
    grid-template-columns: 40px minmax(4.5rem, max-content) 40px;
    align-items: center;
    column-gap: 0.75rem;
    flex: 0 0 auto;
}

.pdf-viewer-toolbar-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    flex-wrap: nowrap;
}

.pdf-viewer-btn,
.pdf-viewer-open {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    min-width: 40px;
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-main);
    text-decoration: none;
    font: inherit;
}

.pdf-viewer-btn:hover,
.pdf-viewer-open:hover {
    border-color: var(--accent);
    color: var(--text-strong);
}

.pdf-viewer-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.pdf-viewer-page {
    min-width: 4.5rem;
    color: var(--text-muted);
    font-size: 0.92rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

.pdf-viewer-page-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.pdf-viewer-stage {
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    min-height: 220px;
}

.pdf-viewer-stage-page {
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdf-viewer-stage-continuous {
    display: block;
}

.pdf-viewer-canvas {
    display: block;
    width: 100%;
    height: auto;
}

.pdf-viewer-canvas-continuous + .pdf-viewer-canvas-continuous {
    margin-top: var(--space-5);
}

.pdf-viewer-fullscreen {
    min-height: 100%;
}

.pdf-viewer-fullscreen .pdf-viewer-stage {
    min-height: calc(100vh - 11rem);
    height: calc(100vh - 11rem);
    border: none;
    border-radius: 0;
    background: transparent;
}

.pdf-viewer-fullscreen .pdf-viewer-stage-page .pdf-viewer-canvas {
    width: auto;
    max-width: 100%;
    max-height: 100%;
}

.pdf-viewer-fullscreen .pdf-viewer-stage-continuous .pdf-viewer-canvas {
    width: 100%;
    max-width: 100%;
}

.pdf-viewer-error .pdf-viewer-stage {
    display: none;
}

.attachment-preview-file {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    padding: var(--space-6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-main);
    color: var(--text-muted);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.embedded-note,
.embedded-attachment {
    padding: 1rem 1rem 1rem 40px;
    border-left: 3px solid var(--accent);
    margin: 1em 0;
}

.embedded-note-header {
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-strong);
    text-align: left;
    font-size: 1.45rem;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.02em;
    cursor: pointer;
    display: block;
}

.embedded-note-header:hover {
    color: var(--accent);
}

.embedded-note-body {
    padding: 1rem 0 0;
}

.embedded-note-error,
.embed-missing {
    display: block;
    padding: var(--space-3) var(--space-4);
    color: var(--text-muted);
    font-size: 0.95rem;
}

.embedded-attachment-preview {
    padding: 0 0 var(--space-3);
}

.embedded-attachment-meta {
    display: grid;
    gap: var(--space-1);
    padding: 0;
}

.embedded-attachment-meta span {
    color: var(--text-muted);
    font-size: 0.92rem;
}

.attachment-card-header {
    display: grid;
    justify-items: center;
    gap: var(--space-1);
    text-align: center;
}

.attachment-card-header-copy {
    display: grid;
    gap: var(--space-1);
    min-width: 0;
    justify-items: center;
}

.attachment-card-header-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.35;
    flex-wrap: wrap;
}

.attachment-card-meta-type,
.attachment-card-meta-size {
    overflow-wrap: anywhere;
}

.attachment-card-meta-separator {
    flex: 0 0 auto;
}

.attachment-card-icon-actions {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: nowrap;
}

.attachment-card-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-main);
    color: var(--text-main);
    text-decoration: none;
}

.attachment-card-icon-btn:hover {
    border-color: var(--accent);
    color: var(--text-strong);
}

.attachment-card-icon-btn svg {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
}

.attachment-card-icon-btn .app-icon {
    --icon-size: 17px;
}

.attachment-card-title {
    color: var(--text-strong);
    font-weight: 600;
    font-size: 0.98rem;
    line-height: 1.15;
    overflow-wrap: anywhere;
    max-width: 100%;
}

.attachment-card-meta {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.attachment-feedback {
    font-size: 12px;
    color: var(--text-muted);
}

.attachment-feedback-success {
    color: #8fd18f;
}

.attachment-feedback-error {
    color: #ff8c8c;
}

@media (max-width: 900px), (max-width: 1180px) and (orientation: portrait) {
    .attachment-card,
    .attachment-card-compact {
        max-width: none;
    }
}

.metadata-type-chip {
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-main);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-5);
    font-size: 13px;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.metadata-type-chip:hover {
    border-color: var(--accent);
    color: var(--text-strong);
}

.metadata-type-chip.active {
    border-color: var(--accent);
    background: var(--bg-selected);
    color: var(--text-strong);
}

.metadata-summary {
    display: grid;
    gap: var(--space-3);
}

.metadata-summary-item {
    display: flex;
    justify-content: space-between;
    gap: var(--space-6);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
}

.metadata-summary-label {
    font-size: 12px;
    color: var(--text-muted);
}

.metadata-summary-value {
    font-size: 12px;
    font-weight: 600;
}

.metadata-backlinks-list {
    display: grid;
    gap: var(--space-3);
}

.metadata-backlink-item {
    display: grid;
    gap: var(--space-1);
    width: 100%;
    text-align: left;
    padding: var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-main);
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.metadata-backlink-item strong {
    color: var(--text-strong);
    word-break: break-word;
}

.metadata-backlink-item span {
    font-size: 12px;
    color: var(--text-muted);
}

.metadata-backlink-item:hover {
    border-color: var(--accent);
    background: var(--bg-selected);
}

.metadata-backlink-item-suggestion {
    border-style: dashed;
}

.metadata-backlink-item-suggestion strong::after {
    content: " ↗";
    color: var(--accent);
    font-weight: 600;
}

.compare-panel {
    display: grid;
    gap: var(--space-8);
}

.compare-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-5);
    flex-wrap: wrap;
}

.compare-header h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-strong);
}

.compare-header span {
    font-size: 12px;
    color: var(--text-muted);
}

.compare-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-5);
    flex-wrap: wrap;
    padding: var(--space-6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    background: var(--bg-panel-highlight);
}

.compare-note-current {
    display: grid;
    gap: var(--space-2);
}

.compare-note-current span {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.compare-note-picker {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.compare-search-box {
    display: grid;
    gap: var(--space-4);
}

.compare-search-box input {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-5);
    background: var(--bg-input);
    color: var(--text-main);
    outline: none;
}

.compare-search-box input:focus {
    border-color: var(--accent);
}

.compare-search-results {
    display: grid;
    gap: var(--space-3);
}

.compare-search-result {
    display: grid;
    gap: 2px;
    width: 100%;
    text-align: left;
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-main);
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.compare-search-result strong {
    color: var(--text-strong);
    word-break: break-word;
}

.compare-search-result span {
    font-size: 12px;
    color: var(--text-muted);
    word-break: break-word;
}

.compare-search-result:hover,
.compare-search-result.active {
    border-color: var(--accent);
    background: var(--bg-selected);
}

.compare-note-picker-inline {
    padding-top: var(--space-2);
}

.compare-note-chip {
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-main);
    border-radius: 999px;
    padding: var(--space-3) var(--space-5);
    font-size: 13px;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.compare-note-chip:hover {
    border-color: var(--accent);
}

.compare-note-chip.active {
    border-color: var(--accent);
    background: var(--bg-selected);
    color: var(--text-strong);
}

.compare-empty-state {
    display: grid;
    gap: var(--space-5);
    padding: var(--space-7);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-xl);
    background: var(--bg-panel-highlight);
    color: var(--text-muted);
}

.compare-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-6);
    align-items: start;
}

.compare-column {
    display: grid;
    gap: var(--space-5);
    padding: var(--space-7);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    background: var(--bg-panel-highlight);
    min-width: 0;
}

.compare-column-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-5);
}

.compare-column-header h4 {
    font-size: 18px;
    color: var(--text-strong);
}

.compare-column-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
    margin-top: var(--space-3);
    font-size: 12px;
    color: var(--text-muted);
}

.compare-open-btn {
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-main);
    border-radius: 999px;
    padding: var(--space-3) var(--space-5);
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.compare-open-btn:hover {
    border-color: var(--accent);
    color: var(--text-strong);
}

.compare-column-content {
    display: grid;
    gap: var(--space-5);
    line-height: 1.7;
    padding: var(--space-2) var(--space-5) var(--space-4);
}

.compare-column-content > * {
    min-width: 0;
}

.compare-column-content pre {
    overflow-x: auto;
}

.graph-panel {
    display: grid;
    gap: var(--space-8);
    height: 100%;
    min-height: calc(100vh - 260px);
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: 100%;
    max-width: none;
    justify-self: stretch;
    margin-left: 0;
}

.graph-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-5);
    flex-wrap: wrap;
    width: min(100%, var(--editor-max-width));
    justify-self: center;
}

.graph-header h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-strong);
}

.graph-header span {
    font-size: 12px;
    color: var(--text-muted);
}

.graph-spacing-control {
    display: inline-flex;
    align-items: center;
    gap: var(--space-4);
    color: var(--text-muted);
    font-size: 12px;
}

.graph-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-5);
    width: 100%;
}

.graph-spacing-control input[type="range"] {
    width: 120px;
}

.graph-spacing-control select {
    min-width: 110px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-main);
    padding: 0.35rem 0.55rem;
}

.graph-spacing-control strong {
    width: 7ch;
    color: var(--text-strong);
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    flex: 0 0 7ch;
}

.graph-journey-hint {
    width: 100%;
    margin-top: calc(var(--space-2) * -1);
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
}

.graph-stage {
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    min-width: 0;
    min-height: 0;
}

.graph-canvas {
    width: 100%;
    height: 100%;
    min-height: calc(100vh - 360px);
    border-radius: 0;
    background: transparent;
    cursor: grab;
}

.graph-canvas:active {
    cursor: grabbing;
}

.graph-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-6);
    color: var(--text-muted);
    font-size: 12px;
    width: min(100%, var(--editor-max-width));
    justify-self: center;
}

.graph-legend span {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
}

.graph-legend-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    display: inline-block;
}

.graph-legend-dot-active {
    background: var(--accent);
}

.graph-legend-dot-direct {
    background: #5a5a5a;
}

.graph-legend-line {
    width: 18px;
    height: 0;
    border-top: 1px solid currentColor;
    display: inline-block;
}

.graph-legend-line-relation {
    color: var(--accent);
}

.graph-legend-line-wikilink {
    color: #6b7280;
    border-top-style: dashed;
}

.graph-fullscreen-btn {
    min-height: 34px;
}

body.fullscreen-open {
    overflow: hidden;
}

.fullscreen-stage {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    background: #141414;
}

.fullscreen-stage[hidden] {
    display: none;
}

.fullscreen-hover-zone {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 110px;
    z-index: 1;
    pointer-events: none;
}

.fullscreen-toolbar {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    width: min(calc(100vw - 2rem), 1080px);
    display: grid;
    grid-template-columns: minmax(0, 220px) minmax(0, 1fr) minmax(0, 420px);
    align-items: center;
    gap: var(--space-5);
    padding: 0.9rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    background: rgba(24, 24, 24, 0.84);
    backdrop-filter: blur(12px);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
    transition: opacity 180ms ease, transform 180ms ease;
    z-index: 2;
}

.fullscreen-toolbar-hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-0.6rem);
    pointer-events: none;
}

.fullscreen-toolbar-copy {
    display: grid;
    gap: 0.15rem;
    min-width: 0;
    text-align: center;
    justify-self: center;
}

.fullscreen-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    color: var(--text-strong);
    text-decoration: none;
}

.fullscreen-brand-copy {
    display: grid;
    gap: 0.08rem;
    min-width: 0;
}

.fullscreen-brand-logo {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
}

.fullscreen-brand-name {
    font-size: 0.94rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.fullscreen-brand-tagline {
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.1;
}

.fullscreen-toolbar-copy strong {
    color: var(--text-strong);
    font-size: 0.98rem;
}

.fullscreen-toolbar-copy span {
    color: var(--text-muted);
    font-size: 0.84rem;
}

.fullscreen-toolbar-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    min-width: 0;
}

.fullscreen-toolbar-btn,
.fullscreen-toolbar-link,
.fullscreen-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0.45rem 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    text-decoration: none;
    font: inherit;
}

.fullscreen-toolbar-link-icon {
    width: 38px;
    padding: 0;
}

.fullscreen-toolbar-link-icon .app-icon {
    --icon-size: 17px;
}

.fullscreen-toolbar-btn:hover,
.fullscreen-toolbar-link:hover,
.fullscreen-close:hover {
    border-color: rgba(255, 116, 0, 0.55);
    color: var(--text-strong);
}

.fullscreen-close .app-icon {
    --icon-size: 16px;
}

.fullscreen-toolbar-page {
    min-width: 4.5rem;
    color: var(--text-muted);
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

.fullscreen-toolbar .graph-spacing-control {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-muted);
    font-size: 12px;
}

.fullscreen-toolbar .graph-spacing-control input[type="range"] {
    width: 112px;
}

.fullscreen-close {
    width: 38px;
    padding: 0;
    font-size: 1.15rem;
}

.fullscreen-body {
    min-height: 100vh;
    padding: 5.6rem 1.5rem 1.5rem;
    position: relative;
    z-index: 0;
}

.fullscreen-body-pdf,
.fullscreen-body-graph {
    padding: 5.6rem 0 0;
}

.fullscreen-body-graph {
    padding: 0;
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
}

.fullscreen-body-pdf .pdf-viewer,
.fullscreen-body-graph .graph-canvas {
    height: 100%;
}

.graph-canvas-fullscreen {
    min-height: 100vh;
    height: 100vh;
}

.relations-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-5);
    flex-wrap: wrap;
}

.relations-header h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-strong);
}

.relations-header span {
    font-size: 12px;
    color: var(--text-muted);
}

.relations-hint {
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    background: var(--bg-panel-highlight);
    display: grid;
    gap: var(--space-4);
    color: var(--text-muted);
}

.relations-hint code {
    display: block;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-5);
    color: var(--text-main);
    overflow-x: auto;
}

.relation-group {
    display: grid;
    gap: var(--space-5);
}

.relation-group h4 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.relation-list {
    display: grid;
    gap: var(--space-4);
}

.relation-item {
    width: 100%;
    text-align: left;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-panel-highlight);
    color: var(--text-main);
    padding: var(--space-5) var(--space-6);
    cursor: pointer;
    display: grid;
    gap: var(--space-2);
    transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}

.relation-item:hover {
    border-color: var(--accent);
    background: var(--bg-selected);
    transform: translateY(-1px);
}

.relation-main {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
    line-height: 1.5;
}

.relation-note-current,
.relation-note-linked {
    color: var(--text-strong);
    font-weight: 600;
}

.relation-arrow {
    color: var(--accent);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.relation-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.related-notes-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-5);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}

.related-notes-header h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-strong);
}

.related-notes-header span {
    font-size: 12px;
    color: var(--text-muted);
}

.related-notes-list {
    display: grid;
    gap: var(--space-4);
}

.related-note-item {
    width: 100%;
    display: grid;
    gap: var(--space-2);
    text-align: left;
    padding: var(--space-5) var(--space-6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-input);
    color: var(--text-main);
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}

.related-note-item:hover {
    border-color: var(--accent);
    background: var(--bg-selected);
    transform: translateY(-1px);
}

.related-note-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-strong);
}

.related-note-meta {
    font-size: 12px;
    color: var(--accent);
}

.related-note-terms {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.editor-actions .app-icon {
    --icon-size: 18px;
}
.btn-icon {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
}

.btn-icon-only {
    justify-content: center;
    padding: var(--space-3);
    min-width: 36px;
    min-height: 36px;
}

.btn-icon-only svg {
    width: 18px;
    height: 18px;
}
.btn-icon:hover {
    color: var(--text-main);
    background: var(--bg-code-inline);
}
.btn-icon.active,
.desktop-width-toggle.active {
    color: var(--text-strong);
    border-color: var(--accent);
    background: var(--bg-selected);
}
.btn-icon.danger:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: var(--danger-soft);
}

/* Line styling */
.line-wrapper {
    margin-bottom: 0;
    min-height: 1.7em;
    min-width: 0;
    position: relative;
    transition: background 0.1s;
    border-radius: var(--radius-sm);
}

.note-block {
    margin-bottom: var(--space-2);
}

/* Rendered HTML Styling (Obsidian-like) */
.rendered-line {
    cursor: text;
    width: 100%;
    max-width: 100%;
    padding: 2px var(--space-5);
    line-height: 1.7;
    color: var(--text-main);
    font-size: 16px;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.rendered-line:hover {
    background: var(--bg-hover-line);
    border-radius: var(--radius-sm);
}

.rendered-line h1,
.rendered-line h2,
.rendered-line h3,
.rendered-line h4 {
    color: #ffffff;
    color: var(--text-strong);
    margin-top: 0.5em;
    margin-bottom: 0.3em;
    font-weight: 600;
}
.rendered-line h1 {
    font-size: 2em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.3em;
}
.rendered-line h2 {
    font-size: 1.5em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.3em;
}
.rendered-line h3 {
    font-size: 1.25em;
}
.rendered-line h4 {
    font-size: 1.1em;
}
.rendered-line p {
    margin-bottom: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.rendered-line a {
    color: var(--accent);
    text-decoration: none;
}
.rendered-line a:hover {
    text-decoration: underline;
}
.rendered-line img {
    max-width: 100%;
    border-radius: var(--radius-md);
    margin: 10px 0;
}
.rendered-line code {
    background: var(--bg-code-inline);
    padding: 2px 5px;
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 0.9em;
}
.rendered-line pre {
    background: var(--bg-code-block);
    padding: var(--space-7);
    border-radius: var(--radius-lg);
    margin: var(--space-5) 0;
    overflow-x: auto;
}
.rendered-line pre code {
    background: transparent;
    padding: 0;
}
.rendered-line ul,
.rendered-line ol {
    padding-left: 20px;
    margin-top: 0;
    margin-bottom: 0;
}
.rendered-line li {
    margin-bottom: 0;
}
.rendered-line li p {
    margin: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.rendered-line strong {
    color: #ffffff;
    color: var(--text-strong);
}

/* Active Edit Line - Textarea */
.active-line-wrapper {
    background: rgba(255, 255, 255, 0.03);
    box-shadow: inset 2px 0 0 var(--accent);
}

.active-block-wrapper {
    margin-bottom: var(--space-4);
    border-radius: var(--radius-md);
}

.block-toolbar {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.block-toolbar-group {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding-right: var(--space-2);
    margin-right: var(--space-2);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.block-toolbar-group:last-child {
    padding-right: 0;
    margin-right: 0;
    border-right: none;
}

.block-toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.block-toolbar-btn:hover,
.block-toolbar-btn:active {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-color);
    color: var(--text-strong);
}

.block-toolbar-btn.danger:hover,
.block-toolbar-btn.danger:active {
    color: #ff8c8c;
}

.block-toolbar-btn .app-icon {
    --icon-size: 1rem;
}

.active-textarea {
    width: 100%;
    max-width: 100%;
    border: none;
    outline: none;
    font-size: 16px;
    /* font-family: "Fira Code", "Consolas", "Monaco", monospace; */
    line-height: 1.7;
    padding: 2px var(--space-5);
    background: transparent;
    color: #ffffff;
    resize: none;
    overflow: hidden;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
    display: block;
}

.active-block-textarea {
    min-height: 1.7em;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    margin-top: 150px;
}
.empty-state strong {
    color: var(--accent);
}

.empty-state-meta {
    font-size: 13px;
    margin-top: var(--space-5);
    color: var(--text-subtle);
}

.editor-loading-state {
    display: grid;
    gap: var(--space-6);
    margin-top: var(--space-11);
    width: min(100%, var(--editor-max-width));
    justify-self: center;
}

.editor-loading-bar {
    width: 160px;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(255, 116, 0, 0.12) 0%, rgba(255, 116, 0, 0.7) 50%, rgba(255, 116, 0, 0.12) 100%);
    background-size: 200% 100%;
    animation: editor-loading-shift 1.2s linear infinite;
}

.editor-loading-skeleton {
    height: 16px;
    border-radius: var(--radius-lg);
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.04) 100%);
    background-size: 200% 100%;
    animation: editor-loading-shift 1.4s ease-in-out infinite;
}

.editor-loading-skeleton-title {
    width: min(320px, 70%);
    height: 28px;
}

.editor-loading-skeleton-short {
    width: min(460px, 82%);
}

@keyframes editor-loading-shift {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}
.modal {
    background: var(--bg-elevated);
    padding: var(--space-11);
    border-radius: var(--radius-xl);
    width: min(calc(100vw - 2rem), var(--modal-width));
    box-shadow: var(--shadow-modal);
    border: 1px solid var(--border-color);
}

.modal-search {
    width: min(calc(100vw - 2rem), var(--search-modal-width));
}

#settings-modal .modal {
    width: min(calc(100vw - 2rem), 64ch);
    min-height: min(76vh, 760px);
    max-height: calc(100vh - 2rem);
    display: grid;
    align-content: start;
    row-gap: var(--space-8);
    overflow-y: auto;
    scrollbar-gutter: stable;
}

#user-admin-modal .modal {
    width: min(calc(100vw - 2rem), 72ch);
    min-height: min(76vh, 760px);
    max-height: calc(100vh - 2rem);
    display: grid;
    align-content: start;
    row-gap: var(--space-8);
    overflow-y: auto;
    scrollbar-gutter: stable;
}

#profile-modal .modal {
    width: min(calc(100vw - 2rem), 56ch);
    min-height: min(72vh, 640px);
    max-height: calc(100vh - 2rem);
    display: grid;
    align-content: start;
    row-gap: var(--space-8);
    overflow-y: auto;
    scrollbar-gutter: stable;
}

#share-note-modal .modal {
    width: min(calc(100vw - 2rem), 56ch);
    min-height: min(56vh, 420px);
    max-height: calc(100vh - 2rem);
    display: grid;
    align-content: start;
    row-gap: var(--space-8);
    overflow-y: auto;
    scrollbar-gutter: stable;
}

#settings-modal .modal h2,
#settings-modal .modal-actions {
    margin: 0;
}

#user-admin-modal .modal h2,
#user-admin-modal .modal-actions {
    margin: 0;
}

#profile-modal .modal h2,
#profile-modal .modal-actions {
    margin: 0;
}

#share-note-modal .modal h2,
#share-note-modal .modal-actions {
    margin: 0;
}

#settings-modal .modal h2 {
    margin-bottom: var(--space-8);
}

#user-admin-modal .modal h2 {
    margin-bottom: var(--space-8);
}

#profile-modal .modal h2 {
    margin-bottom: var(--space-8);
}

#share-note-modal .modal h2 {
    margin-bottom: var(--space-8);
}

.settings-body {
    position: relative;
    min-height: 100%;
}

.modal h2 {
    margin-bottom: var(--space-9);
    font-size: 20px;
    color: var(--text-strong);
}
.modal input[type="text"],
.modal input[type="password"],
.modal textarea {
    width: 100%;
    padding: var(--space-6);
    margin-bottom: var(--space-8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-main);
    font-size: 15px;
    outline: none;
}
.modal input[type="text"]:focus,
.modal input[type="password"]:focus,
.modal textarea:focus {
    border-color: var(--accent);
}
.modal select {
    width: 100%;
    padding: var(--space-6);
    min-height: 47px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-main);
    font-size: 15px;
    outline: none;
}
.modal select:focus {
    border-color: var(--accent);
}
.modal label {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    font-size: 14px;
    margin-bottom: var(--space-10);
    cursor: pointer;
    color: var(--text-muted);
}
.modal label:hover {
    color: var(--text-main);
}
.modal input[type="checkbox"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
}

.modal-field {
    display: grid;
    gap: var(--space-3);
    margin-bottom: var(--space-8);
    color: var(--text-muted);
}

.modal label.modal-field {
    display: grid;
    align-items: stretch;
    gap: var(--space-3);
    margin-bottom: var(--space-8);
    cursor: default;
}

.modal label.modal-field:hover {
    color: var(--text-muted);
}

.modal-field span {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.modal-field input[type="text"],
.modal-field input[type="password"],
.modal-field textarea {
    margin-bottom: 0;
    width: 100%;
}

#share-note-url {
    resize: none;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    overflow-x: hidden;
    line-height: 1.5;
}

.modal-field select {
    margin-bottom: 0;
    width: 100%;
    display: block;
}

.settings-section {
    display: grid;
    gap: var(--space-6);
    margin-bottom: var(--space-8);
    padding: var(--space-7);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-panel-highlight);
}

.settings-section .modal-field {
    margin-bottom: 0;
}

.settings-section h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-strong);
}

.settings-copy {
    margin-bottom: 0;
}

.settings-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    color: var(--text-muted);
    margin-bottom: 0;
}

.settings-feedback {
    margin-bottom: var(--space-7);
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-panel-highlight);
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}

.settings-form-content {
    display: grid;
    gap: var(--space-8);
    align-content: start;
    min-height: 100%;
}

.settings-form-content[hidden] {
    display: block !important;
    visibility: hidden;
    pointer-events: none;
}

.settings-loading-state {
    display: grid;
    gap: var(--space-6);
    padding: var(--space-7);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-panel-highlight);
    align-content: start;
    min-height: 100%;
    position: absolute;
    inset: 0;
}

.settings-loading-state[hidden] {
    display: none !important;
}

.settings-loading-bar {
    height: 4px;
}

.settings-loading-skeleton {
    margin: 0;
}

.settings-loading-skeleton-title {
    width: min(240px, 72%);
}

.settings-feedback[data-state="success"] {
    border-color: var(--border-accent-soft);
    color: var(--text-main);
    background: var(--bg-accent-soft);
}

.settings-feedback[data-state="error"] {
    border-color: rgba(255, 77, 77, 0.35);
    color: var(--danger-strong);
    background: var(--danger-soft);
}

.user-admin-list {
    display: grid;
    gap: var(--space-6);
}

.user-admin-card {
    display: grid;
    gap: var(--space-5);
    padding: var(--space-6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-panel);
}

.user-admin-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-5);
}

.user-admin-meta {
    margin-top: var(--space-2);
    font-size: 12px;
    color: var(--text-muted);
}

.user-admin-status {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 var(--space-4);
    border-radius: 999px;
    border: 1px solid var(--border-color);
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}

.user-admin-status.is-active {
    border-color: rgba(255, 116, 0, 0.4);
    color: var(--accent);
    background: rgba(255, 116, 0, 0.12);
}

.user-admin-status.is-inactive {
    background: var(--bg-panel-highlight);
}

.user-admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.user-admin-actions .btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

.audit-log-list {
    display: grid;
    gap: var(--space-5);
}

.audit-log-entry {
    display: grid;
    gap: var(--space-3);
    padding: var(--space-5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-panel);
}

.audit-log-entry-header {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    align-items: baseline;
}

.audit-log-entry-time {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.audit-log-entry-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.audit-log-entry-context {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.audit-log-pill {
    display: inline-flex;
    gap: var(--space-2);
    align-items: center;
    min-height: 28px;
    padding: 0 var(--space-4);
    border-radius: 999px;
    background: var(--bg-panel-highlight);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 12px;
}

.profile-summary {
    display: grid;
    gap: var(--space-4);
}

.profile-summary-row {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    align-items: center;
    min-height: 40px;
    padding: 0 var(--space-5);
    border-radius: var(--radius-md);
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.profile-summary-row strong {
    color: var(--text-strong);
}

.capture-token-card {
    display: grid;
    gap: var(--space-4);
}

.capture-token-row {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    align-items: center;
    min-height: 44px;
    padding: 0 var(--space-5);
    border-radius: var(--radius-md);
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.capture-token-row strong,
.capture-token-row code {
    color: var(--text-strong);
}

.capture-token-row code,
.capture-token-example code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.capture-token-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.capture-token-example {
    display: grid;
    gap: var(--space-3);
    padding: var(--space-5);
    border-radius: var(--radius-md);
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.capture-token-example span {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.capture-bookmarklets {
    display: grid;
    gap: var(--space-4);
}

.capture-bookmarklet-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.capture-bookmarklet-row .btn {
    min-height: 38px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-6);
    flex-wrap: wrap;
}

.modal-actions-spaced {
    margin-top: var(--space-7);
}

.modal-empty-state {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    margin-top: var(--space-9);
}

.modal-copy {
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: var(--space-10);
}

.editor-context-menu {
    position: fixed;
    z-index: 90;
    min-width: 220px;
    padding: var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-panel-highlight);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

.editor-context-menu-item {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-main);
    text-align: left;
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13px;
}

.editor-context-menu-item:hover {
    background: var(--bg-selected);
    color: var(--text-strong);
}

.selection-toolbar {
    position: fixed;
    z-index: 95;
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-panel-highlight);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

.selection-toolbar[hidden] {
    display: none !important;
}

.selection-toolbar-btn {
    border: none;
    background: var(--bg-selected);
    color: var(--text-strong);
    border-radius: 999px;
    padding: var(--space-3) var(--space-5);
    cursor: pointer;
    font-size: 13px;
}

.selection-toolbar-btn:hover {
    background: var(--accent);
}

.selection-toolbar-btn-compact {
    min-width: 2.25rem;
    padding: var(--space-3) var(--space-4);
}

.panel-empty-state {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    margin-top: var(--space-9);
}

.panel-empty-state-left {
    text-align: left;
    padding: var(--space-5);
    margin-top: 0;
}

.btn {
    padding: var(--space-5) var(--space-9);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background var(--transition-fast);
}
.btn-cancel {
    background: #3a3a3a;
    color: var(--text-main);
}
.btn-cancel:hover {
    background: #4a4a4a;
}
.btn-primary {
    background: var(--accent);
    color: white;
}
.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    text-decoration: none;
}

.btn-ghost:hover {
    color: var(--text-main);
    background: var(--bg-hover-soft);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Tags & Wikilinks im Render-Modus */
.inline-tag {
    color: var(--accent);
    cursor: pointer;
    text-decoration: none;
    font-weight: 400;
    transition: opacity 0.2s;
}
.inline-tag:hover {
    text-decoration: underline;
    opacity: 0.8;
}
.wikilink {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: rgba(217, 98, 0, 0.4);
    cursor: pointer;
    transition: all 0.2s;
}
.wikilink:hover {
    background: rgba(217, 98, 0, 0.15);
    border-radius: var(--radius-sm);
}

/* Dropdowns für Slash-Commands & Wikilinks */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    max-height: 200px;
    overflow-y: auto;
    scrollbar-gutter: stable;
    min-width: 250px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
    display: none;
    list-style: none;
    padding: 5px 0;
    margin-top: 5px;
}
.autocomplete-item {
    padding: 8px 15px;
    cursor: pointer;
    color: var(--text-main);
    font-size: 14px;
    display: grid;
    gap: 2px;
}
.autocomplete-item:hover,
.autocomplete-item.selected {
    background: var(--accent);
    color: white;
}

.autocomplete-main,
.autocomplete-token {
    display: block;
}

.autocomplete-meta {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
}

.autocomplete-item:hover .autocomplete-meta,
.autocomplete-item.selected .autocomplete-meta {
    color: rgba(255, 255, 255, 0.82);
}

.rendered-line blockquote {
    padding: 1rem;
    border-left: 3px solid var(--border-color);
}

.rendered-line hr {
    border-bottom: 0.5px solid var(--border-color);
}

/* Tables */
.table-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    margin: 15px 0;
    scrollbar-gutter: stable both-edges;
}

.table-scroll > table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.table-scroll th,
.table-scroll td {
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    text-align: left;
    max-width: 40ch;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    vertical-align: top;
}

.table-scroll th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: var(--text-main);
}

.table-scroll tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

/* Search Results */
.search-results {
    max-height: 350px;
    overflow-y: auto;
    scrollbar-gutter: stable;
    margin-top: var(--space-7);
    border-top: 1px solid var(--border-color);
    padding-top: var(--space-5);
}

.search-batch-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 220px) auto;
    gap: var(--space-4);
    align-items: center;
}

.search-batch-selection {
    font-size: 12px;
    color: var(--text-muted);
}

.search-batch-actions input[type="text"] {
    margin-bottom: 0;
}

.search-feedback {
    margin-top: var(--space-4);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-accent-soft);
    background: var(--bg-accent-soft);
    color: var(--accent);
    font-size: 12px;
    line-height: 1.5;
}

.search-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
    padding: var(--space-5);
    padding-right: var(--space-6);
    border-bottom: 1px solid var(--bg-hover-soft);
}

.search-group-select {
    display: inline-flex;
    align-items: center;
    gap: var(--space-4);
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
}

.search-group-select.compact {
    gap: 0;
}

.search-group-select.reverse {
    flex-direction: row-reverse;
}

.search-group-select input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.search-results-bulk-header {
    display: flex;
    justify-content: flex-end;
    padding: 0 var(--space-6) var(--space-5) 0;
}

.command-palette-modal {
    max-height: min(78vh, 680px);
}

.zotero-modal {
    max-height: min(82vh, 760px);
}

.zotero-modal-copy {
    margin-bottom: var(--space-8);
}

.zotero-status-inline {
    display: inline-flex;
    align-items: center;
    gap: var(--space-4);
}

.zotero-loading-spinner {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-top-color: var(--accent);
    animation: zotero-spin 0.9s linear infinite;
}

.zotero-loading-text {
    letter-spacing: 0.02em;
    color: var(--text-muted);
}

.zotero-results {
    max-height: 420px;
    overflow-y: auto;
    scrollbar-gutter: stable;
    margin-top: var(--space-7);
    border-top: 1px solid var(--border-color);
    padding-top: var(--space-5);
}

.zotero-result-card {
    display: grid;
    gap: var(--space-4);
    padding: var(--space-6);
    margin-bottom: var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-panel-highlight);
}

.zotero-result-card.selected {
    border-color: var(--accent);
    background: var(--bg-selected);
}

.zotero-result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-5);
}

.zotero-result-select {
    display: inline-flex;
    align-items: center;
    gap: var(--space-4);
    color: var(--text-main);
    cursor: pointer;
    user-select: none;
    font-size: 13px;
}

.zotero-result-select input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.zotero-result-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-strong);
    line-height: 1.4;
}

.zotero-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    font-size: 12px;
    color: var(--text-muted);
}

.zotero-result-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 3px var(--space-4);
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
}

.zotero-result-citation {
    font-size: 13px;
    color: var(--text-main);
    line-height: 1.6;
}

.zotero-result-citation i,
.zotero-result-citation em {
    color: var(--text-strong);
}

.zotero-result-summary {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}

.zotero-result-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-4);
    flex-wrap: wrap;
}

@keyframes zotero-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.zotero-settings-hint {
    display: grid;
    gap: var(--space-4);
    padding: var(--space-6);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-panel-highlight);
    color: var(--text-muted);
    line-height: 1.6;
}

.command-palette-results {
    max-height: 350px;
    overflow-y: auto;
    scrollbar-gutter: stable;
    margin-top: var(--space-7);
    border-top: 1px solid var(--border-color);
    padding-top: var(--space-5);
}

.command-palette-item {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-panel-highlight);
    color: var(--text-main);
    text-align: left;
    padding: var(--space-5);
    margin-bottom: var(--space-4);
    cursor: pointer;
    display: grid;
    gap: var(--space-1);
}

.command-palette-item:hover,
.command-palette-item.active {
    border-color: var(--accent);
    background: var(--bg-selected);
}

.command-palette-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-strong);
}

.command-palette-meta {
    font-size: 12px;
    color: var(--text-muted);
}
.search-result-group {
    margin-bottom: var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-panel-highlight);
}
.search-result-item {
    padding: var(--space-5);
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid var(--bg-hover-soft);
}
.search-result-item:last-child {
    border-bottom: none;
}
.search-result-item:hover {
    background: var(--bg-hover-soft);
}
.search-result-title {
    font-weight: bold;
    color: var(--accent);
    font-size: 13px;
    margin-bottom: 4px;
    cursor: pointer;
}
.search-result-snippet {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-all;
}

.search-result-snippet-titlematch {
    font-style: italic;
}

.search-hidden-results {
    display: none;
}

.search-more-toggle {
    padding: var(--space-4) var(--space-5);
    color: var(--accent);
    cursor: pointer;
    font-size: 13px;
    border-top: 1px solid var(--bg-hover-soft);
    background: var(--bg-panel-highlight);
}

.search-more-toggle:hover {
    background: var(--bg-hover-soft);
}
.search-highlight {
    background: rgba(217, 98, 0, 0.4);
    color: var(--text-strong);
}

.mobile-topbar {
    display: none;
}

.mobile-topbar-dropdown {
    display: none;
}

.mobile-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mobile-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-md);
}

.mobile-btn-icon .app-icon {
    --icon-size: 18px;
}

@media (max-width: 900px), (max-width: 1180px) and (orientation: portrait) {
    body {
        overscroll-behavior: none;
    }

    html,
    body,
    .app-shell,
    .app-layout {
        width: 100%;
        max-width: 100%;
        overflow-x: clip;
    }

    .mobile-topbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto auto auto auto;
        gap: var(--space-5);
        align-items: center;
        height: var(--mobile-header-height);
        padding: 0 var(--space-6);
        background: var(--bg-sidebar);
        border-bottom: 1px solid var(--border-color);
        position: relative;
        z-index: 20;
        justify-content: start;
        width: 100%;
        max-width: 100%;
    }

    .mobile-topbar-dropdown {
        position: fixed;
        top: calc(var(--mobile-header-height) + env(safe-area-inset-top, 0px) + var(--space-4));
        right: var(--space-4);
        left: var(--space-4);
        display: grid;
        gap: var(--space-2);
        padding: var(--space-3);
        border: 1px solid var(--border-color);
        border-radius: 16px;
        background: var(--bg-elevated);
        box-shadow: var(--shadow-modal);
        z-index: 30;
        max-height: calc(100vh - var(--mobile-header-height) - env(safe-area-inset-top, 0px) - (var(--space-4) * 2));
        overflow-y: auto;
        overflow-x: hidden;
        max-width: calc(100% - (var(--space-4) * 2));
    }

    .mobile-topbar-dropdown[hidden] {
        display: none !important;
    }

    .mobile-topbar-btn-compact .mobile-btn-icon,
    .mobile-topbar-btn-compact .mobile-btn-icon .app-icon {
        width: 16px;
        height: 16px;
    }

    .mobile-topbar-btn,
    .mobile-topbar-title {
        border: 1px solid transparent;
        background: transparent;
        color: var(--text-main);
        border-radius: var(--radius-md);
        min-height: 38px;
        min-width: 38px;
        padding: 0 var(--space-5);
        font-size: 13px;
        cursor: pointer;
        transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
    }

    .mobile-topbar-btn:hover,
    .mobile-topbar-title:hover,
    .mobile-topbar-btn:active,
    .mobile-topbar-title:active {
        border-color: var(--border-color);
        background: var(--bg-input);
    }

    .mobile-topbar-title {
        display: inline-flex;
        align-items: center;
        gap: var(--space-4);
        font-weight: 700;
        justify-content: flex-start;
        padding-left: 0;
        min-width: 0;
    }

    .mobile-topbar-title:hover,
    .mobile-topbar-title:active {
        border-color: transparent;
        background: transparent;
    }

    .mobile-topbar-btn:disabled,
    .mobile-topbar-title:disabled {
        opacity: 0.45;
        cursor: not-allowed;
    }

    .app-brand {
        display: none;
    }

    .app-layout {
        position: relative;
        overflow: hidden;
        width: 100%;
        max-width: 100%;
    }

    .sidebar-resizer {
        display: none;
    }

    .sidebar,
    .editor-container {
        position: absolute;
        inset: 0;
        width: auto;
        max-width: 100vw;
        min-width: 0;
        height: 100%;
        border-right: none;
        transition: transform var(--transition-page), opacity var(--transition-page);
        background: var(--bg-main);
        border-radius: 0;
        overflow: hidden;
    }

    .sidebar {
        background: var(--bg-sidebar);
        z-index: 5;
        transform: translateX(-100%);
        opacity: 0;
        width: 100%;
        max-width: 100%;
    }

    .editor-container {
        z-index: 1;
        transform: translateX(0);
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    body[data-mobile-view="sidebar"] .sidebar {
        transform: translateX(0);
        opacity: 1;
    }

    body[data-mobile-view="sidebar"] .editor-container {
        transform: translateX(100%);
    }

    body[data-mobile-view="editor"] .sidebar {
        transform: translateX(-100%);
        opacity: 0;
    }

    .sidebar-content {
        padding-bottom: calc(var(--space-13) + env(safe-area-inset-bottom, 0px));
        min-width: 0;
        max-width: 100%;
        overflow-x: hidden;
    }

    .sidebar-header,
    .sidebar-tools,
    .sidebar-footer,
    .filter-bar,
    #sidebar-notes,
    #sidebar-tags,
    #notes-list,
    .notes-list-section,
    .pinned-notes-section,
    .pinned-notes-list,
    .list-item,
    .list-item-title-row,
    .tabs,
    .type-filter-meta,
    #filter-indicator {
        min-width: 0;
        max-width: 100%;
        overflow-x: hidden;
    }

    .editor-content {
        max-width: none;
        padding: var(--space-9) var(--space-6) 140px var(--space-6);
    }

    body[data-editor-section="graph"] .editor-content {
        padding: var(--space-8) var(--space-6) var(--space-6);
        grid-template-rows: auto auto auto minmax(420px, 1fr);
    }

    .graph-panel {
        min-height: 420px;
        width: 100%;
        margin-left: 0;
    }

    .graph-controls {
        justify-content: flex-start;
    }

    .graph-canvas {
        min-height: 360px;
    }

    .CodeMirror {
        height: calc(100vh - 320px);
        min-height: 320px;
    }

    .editor-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .context-sidebar {
        display: none;
    }

    .list-item-title-row,
    .metadata-summary-item,
    .metadata-custom-type,
    .metadata-template-actions,
    .search-batch-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .compare-toolbar,
    .compare-column-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .compare-grid {
        grid-template-columns: 1fr;
    }

    .search-batch-actions {
        grid-template-columns: 1fr;
    }

    .metadata-type-grid {
        gap: var(--space-3);
    }

    .note-tabs {
        margin-bottom: var(--space-6);
    }

    .note-tab {
        max-width: 190px;
    }

    .note-list-menu {
        display: none;
    }

    .editor-tabs {
        margin-bottom: var(--space-7);
    }

    .editor-actions {
        width: 100%;
        justify-content: stretch;
    }

    .editor-actions .btn-icon {
        flex: 1;
        justify-content: center;
    }

    .desktop-width-toggle {
        display: none;
    }

    .related-notes {
        padding: var(--space-6);
    }

    .empty-state {
        margin-top: 90px;
    }

    .modal-overlay {
        padding: 0;
        align-items: stretch;
        justify-content: stretch;
    }

    .modal,
    .modal-search {
        width: 100vw;
        max-width: 100vw;
        min-width: 0;
        min-height: 100%;
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: var(--space-9) var(--space-6) calc(var(--space-9) + env(safe-area-inset-bottom, 0px));
        box-shadow: none;
        display: flex;
        flex-direction: column;
        overflow-x: hidden;
    }

    #settings-modal .modal {
        width: 100%;
        min-height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .search-results {
        flex: 1;
        max-height: none;
        min-height: 0;
    }

    .modal-actions {
        justify-content: stretch;
    }

    .modal-actions .btn {
        width: 100%;
    }

    .settings-body,
    .settings-form-content,
    .settings-section,
    .modal-field,
    .modal label.modal-field,
    .modal input[type="text"],
    .modal input[type="password"],
    .modal textarea,
    .modal select,
    #share-note-modal .modal,
    #share-note-url,
    #share-note-slug {
        min-width: 0;
        max-width: 100%;
    }

    .settings-body,
    .settings-form-content,
    .settings-section,
    #share-note-modal .modal {
        overflow-x: hidden;
    }
}
