#sorter-mobile-viewer-toolbar, .sorter-mobile-only,
.tree-actions-button, .tree-select-checkbox, .pdfv-fit-width, .pdfv-zoom-step { display: none; }
.tree-selection-mode .tree-select-checkbox { display: inline-block; width: 24px; height: 24px; flex-shrink: 0; }
@media (pointer: coarse) {
    .tree-actions-button { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
}
@media (max-width: 859px) {
    :root { --sorter-header-height: var(--toolbar-height, 65px); --sorter-viewport-height: 100vh; --sorter-viewport-top: 0px; }
    @supports (height: 100dvh) { :root { --sorter-viewport-height: 100dvh; } }
    .main-toolbar { top: var(--sorter-viewport-top); gap: 8px; }
    .main-toolbar > .toolbar-section { flex: 0 0 auto; }
    .main-toolbar .toolbar-divider, .main-toolbar .sw-toolbar-middle-slot { display: none; }
    .main-toolbar .toolbar-right-section { position: static; margin: 0; min-width: 0; flex: 1; justify-content: center; }
    .main-toolbar .toolbar-static-info { min-width: 0; gap: 0; }
    .main-toolbar .toolbar-document-title { display: none; }
    .main-toolbar .valo-toolbox-link { position: static; flex: 0 0 auto; z-index: auto; }
    #app-container { position: fixed; top: calc(var(--sorter-viewport-top) + var(--sorter-header-height)); left: 0; right: 0; margin: 0; height: max(0px, calc(var(--sorter-viewport-height) - var(--sorter-header-height))); min-width: 0; }
    .sorter-mobile-only { display: inline-flex; align-items: center; justify-content: center; }
    #maps-tree .tree-item { min-height: 44px; gap: 4px; }
    #maps-tree .folder-name, #maps-tree .pdf-name { min-width: 0; overflow-wrap: anywhere; white-space: normal; font-size: 14px; }
    #maps-tree .toggle-arrow { flex-shrink: 0; width: 32px; height: 44px; }
    .tree-actions-button { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; color: var(--text-primary); border: 0; background: transparent; font-size: 24px; }
    .mobile-action-sheet { z-index: 3000; border-radius: 16px; background: var(--bg-sidebar); color: var(--text-primary); box-shadow: 0 -8px 40px #0006; padding: 12px; }
    .mobile-action-sheet-title { font-weight: 600; padding: 8px; }
    .mobile-action-sheet button { min-height: 44px; }
    .mobile-action-sheet-close { width: 100%; justify-content: center; }
    #sorter-mobile-viewer-toolbar { position: fixed; top: calc(var(--sorter-viewport-top) + var(--sorter-header-height)); left: 0; right: 0; z-index: 49; background: var(--bg-sidebar); }
    body.sorter-viewer-active #sorter-mobile-viewer-toolbar { display: block; }
    #sorter-mobile-viewer-toolbar .sw-pdf-toolbar-info { position: static; top: auto; left: auto; transform: none; z-index: auto; display: flex; flex-wrap: wrap; width: 100%; max-width: none; justify-content: flex-start; gap: 4px; padding: 4px 8px; }
    #sorter-mobile-viewer-toolbar .sw-pdf-toolbar-title { order: -2; flex: 1 1 calc(100% - 56px); max-width: none; min-height: 44px; text-align: left; font-size: 14px; display: block; line-height: 44px; }
    #sorter-mobile-viewer-toolbar #pdf-viewer-close { position: static; top: auto; left: auto; transform: none; order: -1; min-width: 44px; height: 44px; }
    #sorter-mobile-viewer-toolbar .pdfv-fit-width, #sorter-mobile-viewer-toolbar .pdfv-zoom-step { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 8px; background: transparent; }
    #sorter-mobile-viewer-toolbar .sw-pdf-zoom-input { height: 44px; font-size: 16px; }
    body.sorter-viewer-active #pdf-viewer-overlay { padding-top: var(--sorter-viewer-toolbar-height, 100px); }
    #pdf-viewer-pages-container { padding: 8px; overscroll-behavior: contain; }
    #pdf-viewer-page-indicator { bottom: max(12px, env(safe-area-inset-bottom)); left: 12px; }
    .modal, #settings-modal { padding: 8px; }
    .modal .modal-content { max-width: calc(100vw - 16px) !important; max-height: calc(var(--sorter-viewport-height) - 16px); overflow-y: auto; }
    .modal button { min-height: 44px; }
    .modal input, .modal textarea, #rules-rich-editor { font-size: 16px; }
    .rules-modal-content { width: calc(100vw - 16px) !important; height: calc(var(--sorter-viewport-height) - 16px); padding: 0; }
    .rules-split-layout { grid-template-columns: 1fr; grid-template-rows: minmax(100px, 25%) minmax(0, 1fr); }
    .rules-files-view { padding: 10px; background: var(--bg-sidebar); }
    .rules-editor-view { min-width: 0; padding: 8px; }
    .rules-toolbar { flex-wrap: wrap; }
    .rules-toolbar-btn { min-width: 44px; min-height: 44px; }
}
