/* ==========================================================================
   DateiHub – modernes UI (Drive-inspiriert)
   Alle Regeln sind auf body.ui-modern beschränkt. ?ui=classic bleibt unberührt.
   ========================================================================== */

body:not(.ui-modern) .modern-only {
    display: none !important;
}

/* --------------------------------------------------------------------------
   Design-Tokens
   -------------------------------------------------------------------------- */
body.ui-modern {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #f9fafb;
    --surface-3: #f1f3f5;
    --sidebar: #f8f9fb;
    --text: #1f2328;
    --text-soft: #4b5563;
    --muted: #6b7280;
    --border: #e5e7eb;
    --border-strong: #d1d5db;
    --primary: #2563eb;
    --primary-soft: #eef4ff;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-soft: #eef4ff;
    --accent-text: #1a56db;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --success: #059669;
    --success-soft: #ecfdf5;
    --focus: rgba(37, 99, 235, 0.24);
    --topbar-bg: var(--surface);
    --topbar-text: var(--text);
    --topbar-border: var(--border);
    --topbar-btn-bg: transparent;
    --topbar-btn-border: transparent;
    --topbar-btn-hover: var(--surface-3);
    --topbar-shadow: none;
    --table-border: var(--border);
    --th-color: var(--muted);
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.14);
    --modal-overlay: rgba(17, 24, 39, 0.35);
    background: var(--bg);
    color: var(--text);
}

html[data-theme="dark"] body.ui-modern {
    --bg: #0f1115;
    --surface: #171a1f;
    --surface-2: #1b1f25;
    --surface-3: #22272e;
    --sidebar: #12151a;
    --text: #e6edf3;
    --text-soft: #c4cbd4;
    --muted: #8b949e;
    --border: #2a2f36;
    --border-strong: #3a414b;
    --primary: #4d8dff;
    --primary-soft: #17233a;
    --accent: #4d8dff;
    --accent-hover: #6ba0ff;
    --accent-soft: #17233a;
    --accent-text: #8ab4ff;
    --danger: #f87171;
    --danger-soft: #2a1717;
    --success: #34d399;
    --success-soft: #10251d;
    --focus: rgba(77, 141, 255, 0.32);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
    --modal-overlay: rgba(0, 0, 0, 0.55);
}

/* --------------------------------------------------------------------------
   Grundgerüst
   -------------------------------------------------------------------------- */
body.ui-modern:not(.login-mode) {
    overflow: hidden;
}

body.ui-modern:not(.login-mode) .app-shell {
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr);
    grid-template-rows: 64px minmax(0, 1fr);
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
    background: var(--bg);
}

body.ui-modern .topbar {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 18px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: none;
    position: relative;
    z-index: 40;
}

body.ui-modern .topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-self: auto;
    flex: 0 0 auto;
}

body.ui-modern .topbar-center {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-start;
    justify-self: auto;
}

body.ui-modern .topbar-center > h1 {
    display: none;
}

body.ui-modern .topbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-self: auto;
    flex: 0 0 auto;
}

body.ui-modern #nav-menu-wrap {
    display: none;
}

body.ui-modern #top-user {
    display: none;
}

body.ui-modern #editor-close-btn {
    display: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 7px 11px;
    color: var(--text-soft);
    font-size: 12.5px;
    font-weight: 550;
}

body.ui-modern.editor-mode #editor-close-btn {
    display: inline-flex;
    align-items: center;
}

body.ui-modern #editor-close-btn:hover {
    background: var(--surface-3);
    color: var(--text);
}

body.ui-modern .main {
    grid-row: 2;
    display: flex;
    min-width: 0;
    min-height: 0;
    padding: 0;
    overflow: hidden;
}

body.ui-modern .content {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    padding: 0;
}

body.ui-modern #app-screen {
    min-height: 100%;
}

body.ui-modern .content-frame {
    min-height: 0;
}

/* --------------------------------------------------------------------------
   Topbar-Bausteine
   -------------------------------------------------------------------------- */
body.ui-modern .modern-menu-btn {
    display: none;
}

body.ui-modern .modern-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text);
    text-decoration: none;
    font-size: 16px;
    font-weight: 650;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

body.ui-modern .modern-brand-logo {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    object-fit: contain;
}

body.ui-modern .modern-search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    max-width: 660px;
    flex: 1 1 320px;
    padding: 0 10px 0 12px;
    background: var(--surface-3);
    border: 1px solid transparent;
    border-radius: 10px;
    transition:
        background 0.15s,
        border-color 0.15s,
        box-shadow 0.15s;
}

body.ui-modern .modern-search:focus-within {
    background: var(--surface);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--focus);
}

body.ui-modern .modern-search .modern-svg {
    color: var(--muted);
}

body.ui-modern .modern-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 13.5px;
    color: var(--text);
}

body.ui-modern .modern-search input::placeholder {
    color: var(--muted);
}

body.ui-modern .modern-search kbd {
    font-family: inherit;
    font-size: 11px;
    color: var(--muted);
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: 5px;
    padding: 1px 5px;
    background: var(--surface);
}

body.ui-modern .modern-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--text-soft);
    transition:
        background 0.15s,
        color 0.15s,
        border-color 0.15s;
}

body.ui-modern .modern-icon-btn:hover {
    background: var(--surface-3);
    color: var(--text);
}

body.ui-modern .modern-svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
}

body.ui-modern .modern-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-left: 4px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    font-size: 12.5px;
    font-weight: 650;
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--border);
    transition: box-shadow 0.15s;
}

body.ui-modern .modern-avatar:hover {
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
}

body.ui-modern #theme-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    border-radius: 9px !important;
    color: var(--text-soft) !important;
    font-size: 0 !important;
}

body.ui-modern #theme-toggle:hover {
    background: var(--surface-3) !important;
    color: var(--text) !important;
}

body.ui-modern #theme-toggle .modern-svg {
    width: 18px;
    height: 18px;
}

body.ui-modern .plugin-update-alert {
    height: 32px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 11.5px;
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */
body.ui-modern .modern-sidebar {
    grid-row: 2;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 14px 12px 12px;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 30;
}

body.ui-modern .modern-new-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    height: 42px;
    padding: 0 14px;
    margin: 2px 2px 16px;
    border: 0;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.24);
    transition:
        background 0.15s,
        box-shadow 0.15s;
}

body.ui-modern .modern-new-btn:hover {
    background: var(--accent-hover);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}

body.ui-modern .modern-new-btn .modern-svg {
    width: 19px;
    height: 19px;
}

body.ui-modern .modern-new-btn .modern-chev {
    margin-left: auto;
    opacity: 0.8;
}

body.ui-modern .modern-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

body.ui-modern .modern-nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    height: 38px;
    padding: 0 11px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-soft);
    font-size: 13.5px;
    font-weight: 500;
    text-align: left;
    transition:
        background 0.13s,
        color 0.13s;
}

body.ui-modern .modern-nav-item .modern-svg {
    color: var(--muted);
}

body.ui-modern .modern-nav-item:hover {
    background: var(--surface-3);
    color: var(--text);
}

body.ui-modern .modern-nav-item.active {
    background: var(--accent-soft);
    color: var(--accent-text);
    font-weight: 600;
}

body.ui-modern .modern-nav-item.active .modern-svg {
    color: var(--accent-text);
}

body.ui-modern .modern-nav-item:disabled {
    opacity: 0.62;
    cursor: default;
}

body.ui-modern .modern-nav-item:disabled:hover {
    background: transparent;
    color: var(--text-soft);
}

body.ui-modern .modern-badge {
    margin-left: auto;
    padding: 2px 6px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--muted);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

body.ui-modern .modern-sidebar-bottom {
    margin-top: auto;
    padding-top: 14px;
}

body.ui-modern .modern-storage-card {
    padding: 12px;
    margin: 0 2px 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

body.ui-modern .modern-storage-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 600;
}

body.ui-modern .modern-storage-head .modern-svg {
    width: 16px;
    height: 16px;
    color: var(--muted);
}

body.ui-modern .modern-storage-bar {
    height: 6px;
    border-radius: 999px;
    background: var(--surface-3);
    overflow: hidden;
}

body.ui-modern .modern-storage-bar span {
    display: block;
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 0.25s ease;
}

body.ui-modern .modern-storage-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 7px;
    color: var(--muted);
    font-size: 11px;
}

/* --------------------------------------------------------------------------
   Explorer-Ansicht
   -------------------------------------------------------------------------- */
body.ui-modern #explorer-view {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 18px 24px 110px;
    background: var(--surface);
    border: 0;
    box-shadow: none;
    border-radius: 0;
}

body.ui-modern #explorer-view > .explorer-header {
    display: none;
}

body.ui-modern .modern-page-head {
    order: 1;
}

body.ui-modern .modern-page-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 36px;
}

body.ui-modern .modern-page-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

body.ui-modern #modernPageTitle {
    margin: 0;
    font-size: 22px;
    line-height: 1.2;
    font-weight: 650;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.ui-modern .modern-count {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 550;
    white-space: nowrap;
}

body.ui-modern .modern-head-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-left: auto;
}

body.ui-modern .modern-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text-soft);
    font-size: 12.5px;
    font-weight: 550;
    white-space: nowrap;
    transition:
        background 0.13s,
        border-color 0.13s,
        color 0.13s;
}

body.ui-modern .modern-btn:hover {
    background: var(--surface-3);
    border-color: var(--border-strong);
    color: var(--text);
}

body.ui-modern .modern-btn .modern-svg {
    width: 16px;
    height: 16px;
    color: var(--muted);
}

body.ui-modern .modern-head-actions .modern-icon-btn {
    border: 1px solid var(--border);
}

/* Breadcrumbs */
body.ui-modern #path-breadcrumbs {
    margin: 0 0 6px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    gap: 2px;
    min-height: 24px;
    overflow: hidden;
    font-size: 12.5px;
}

body.ui-modern .breadcrumb-item {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 500;
    padding: 3px 7px;
    border-radius: 6px;
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.ui-modern .breadcrumb-item:hover {
    background: var(--surface-3);
    color: var(--text);
}

body.ui-modern .breadcrumb-item.current {
    background: transparent;
    box-shadow: none;
    color: var(--text);
    font-weight: 550;
}

body.ui-modern .breadcrumb-item.current:hover {
    background: transparent;
}

body.ui-modern .breadcrumb-sep {
    color: var(--border-strong);
    font-size: 12px;
    padding: 0 1px;
}

/* Toolbar */
body.ui-modern .toolbar-row {
    order: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 10px 0 12px;
    border-top: 0;
    border-bottom: 1px solid var(--border);
}

body.ui-modern .toolbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
}

body.ui-modern #batch-menu-wrap {
    display: none !important;
}

body.ui-modern #upload-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    margin-right: 2px;
    border: 0;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.24);
}

body.ui-modern #upload-dropdown-btn:hover {
    background: var(--accent-hover);
    filter: none;
    transform: none;
}

body.ui-modern .upload-dropdown-menu {
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    min-width: 220px;
}

body.ui-modern .upload-dropdown-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 9px;
    border-radius: 7px;
    font-size: 12.5px;
    color: var(--text-soft);
}

body.ui-modern .upload-dropdown-menu button:hover {
    background: var(--surface-3);
    color: var(--text);
}

body.ui-modern .upload-dropdown-menu button.danger {
    color: var(--danger);
}

body.ui-modern .upload-dropdown-menu button.danger:hover {
    background: var(--danger-soft);
}

body.ui-modern .upload-dropdown-divider {
    margin: 6px 8px;
    background: var(--border);
}

body.ui-modern .select-all-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 8px;
    margin: 0;
    border-radius: 7px;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

body.ui-modern .select-all-label:hover {
    background: var(--surface-3);
    color: var(--text);
}

body.ui-modern .tool-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

body.ui-modern .tool-toolbar-actions .btn {
    height: 32px;
    padding: 0 9px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--text-soft);
    box-shadow: none;
    font-size: 12.5px;
    font-weight: 500;
}

body.ui-modern .tool-toolbar-actions .btn:hover {
    background: var(--surface-3);
    color: var(--text);
    border-color: transparent;
    transform: none;
}

body.ui-modern #status-msg {
    display: none;
}

body.ui-modern .file-view-controls {
    display: none;
}

body.ui-modern .explorer-view-toggle {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: 32px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    overflow: hidden;
}

body.ui-modern .explorer-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 26px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-size: 14px;
    box-shadow: none;
}

body.ui-modern .explorer-view-btn:hover {
    color: var(--text);
    background: transparent;
}

body.ui-modern .explorer-view-btn.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

/* Alerts */
body.ui-modern #share-result,
body.ui-modern #action-error {
    order: 3;
    margin: 8px 0 0;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 12.5px;
}

/* --------------------------------------------------------------------------
   Tabelle
   -------------------------------------------------------------------------- */
body.ui-modern #file-card {
    order: 5;
    margin-top: 2px;
    padding: 0 !important;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

body.ui-modern #file-table-wrap {
    overflow: visible;
}

body.ui-modern #file-card table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

body.ui-modern #file-card thead {
    background: transparent;
}

body.ui-modern #file-card th {
    position: sticky;
    top: 0;
    z-index: 5;
    height: 34px;
    padding: 0 10px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 550;
    letter-spacing: 0;
    text-transform: none;
    text-align: left;
    white-space: nowrap;
}

body.ui-modern #file-card th:nth-child(1) {
    width: 42px;
    padding-left: 14px;
    padding-right: 0;
}

body.ui-modern #file-card th:nth-child(3) {
    width: 150px;
}

body.ui-modern #file-card th:nth-child(2),
body.ui-modern #file-card th:nth-child(3),
body.ui-modern #file-card th:nth-child(4) {
    cursor: pointer;
}

body.ui-modern #file-card th:nth-child(2):hover,
body.ui-modern #file-card th:nth-child(3):hover,
body.ui-modern #file-card th:nth-child(4):hover {
    color: var(--text);
}

body.ui-modern #file-card th:nth-child(4) {
    width: 116px;
}

body.ui-modern #file-card th:nth-child(5) {
    width: 76px;
    padding-right: 12px;
    text-align: right;
}

body.ui-modern #file-card td {
    height: 48px;
    padding: 0 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text-soft);
    font-size: 13px;
    vertical-align: middle;
}

body.ui-modern #file-card tbody tr:last-child td {
    border-bottom: 0;
}

body.ui-modern #file-card tbody tr:hover {
    background: var(--surface-2);
}

body.ui-modern #file-card tbody tr.selected {
    background: var(--accent-soft) !important;
}

body.ui-modern #file-card tbody tr.selected:hover {
    background: color-mix(in srgb, var(--accent-soft) 82%, var(--accent) 18%) !important;
}

body.ui-modern .name-cell {
    cursor: default;
    font-weight: 500;
}

body.ui-modern .name-cell:hover {
    color: var(--text);
}

body.ui-modern .name-cell .thumb-name {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

body.ui-modern .name-cell .thumb-name > span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
}

body.ui-modern .file-icon {
    display: none;
}

body.ui-modern .file-thumb {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    object-fit: cover;
}

body.ui-modern .modern-ft {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    border-radius: 8px;
    background: var(--surface-3);
    color: var(--muted);
    overflow: hidden;
}

body.ui-modern .modern-ft .modern-svg {
    width: 17px;
    height: 17px;
}

body.ui-modern .modern-ft.has-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

body.ui-modern .modern-ft.folder {
    background: #eef2ff;
    color: #4f6bed;
}

body.ui-modern .modern-ft.image {
    background: #ecfdf5;
    color: #059669;
}

body.ui-modern .modern-ft.pdf {
    background: #fef2f2;
    color: #dc2626;
}

body.ui-modern .modern-ft.doc {
    background: #eff6ff;
    color: #2563eb;
}

body.ui-modern .modern-ft.sheet {
    background: #ecfdf5;
    color: #047857;
}

body.ui-modern .modern-ft.audio {
    background: #f5f3ff;
    color: #7c3aed;
}

body.ui-modern .modern-ft.video {
    background: #fff7ed;
    color: #ea580c;
}

body.ui-modern .modern-ft.archive,
body.ui-modern .modern-ft.text {
    background: #f8fafc;
    color: #64748b;
}

html[data-theme="dark"] body.ui-modern .modern-ft.folder {
    background: #1b2440;
    color: #8ba3ff;
}

html[data-theme="dark"] body.ui-modern .modern-ft.image {
    background: #10251d;
    color: #34d399;
}

html[data-theme="dark"] body.ui-modern .modern-ft.pdf {
    background: #2a1717;
    color: #f87171;
}

html[data-theme="dark"] body.ui-modern .modern-ft.doc {
    background: #17233a;
    color: #8ab4ff;
}

html[data-theme="dark"] body.ui-modern .modern-ft.sheet {
    background: #10251d;
    color: #6ee7b7;
}

html[data-theme="dark"] body.ui-modern .modern-ft.audio {
    background: #231b3a;
    color: #c4b5fd;
}

html[data-theme="dark"] body.ui-modern .modern-ft.video {
    background: #2a1e12;
    color: #fdba74;
}

body.ui-modern .modern-name-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

body.ui-modern .modern-name-text .name {
    color: var(--text);
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.ui-modern .modern-name-text .sub {
    color: var(--muted);
    font-size: 11.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.ui-modern .type-badge {
    display: none;
}

body.ui-modern .item-cb {
    opacity: 0;
    transition: opacity 0.1s;
}

body.ui-modern #file-card tbody tr:hover .item-cb,
body.ui-modern #file-card tbody tr.selected .item-cb,
body.ui-modern #file-card tbody tr:focus-within .item-cb,
body.ui-modern .file-grid-item:hover .item-cb,
body.ui-modern .file-grid-item.selected .item-cb {
    opacity: 1;
}

body.ui-modern input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

body.ui-modern .burger-wrap {
    position: relative;
    display: flex;
    justify-content: flex-end;
}

body.ui-modern .burger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    font-size: 0;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.1s;
}

body.ui-modern #file-card tbody tr:hover .burger-btn,
body.ui-modern #file-card tbody tr.selected .burger-btn,
body.ui-modern .file-grid-item:hover .burger-btn,
body.ui-modern .file-grid-item.selected .burger-btn {
    opacity: 1;
}

body.ui-modern .burger-btn:hover {
    background: var(--surface-3);
    color: var(--text);
}

body.ui-modern .burger-btn .modern-svg {
    width: 16px;
    height: 16px;
}

body.ui-modern .burger-dropdown {
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    min-width: 210px;
}

body.ui-modern .burger-item {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 9px;
    border-radius: 7px;
    color: var(--text-soft);
    font-size: 12.5px;
}

body.ui-modern .burger-item:hover {
    background: var(--surface-3);
    color: var(--text);
}

body.ui-modern .burger-item .modern-svg {
    width: 16px;
    height: 16px;
    color: var(--muted);
}

body.ui-modern .burger-item:hover .modern-svg {
    color: var(--text);
}

body.ui-modern .burger-item.danger .modern-svg {
    color: var(--danger);
}

body.ui-modern .burger-item span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.ui-modern .burger-item.danger {
    color: var(--danger);
}

body.ui-modern .burger-item.danger:hover {
    background: var(--danger-soft);
}

body.ui-modern .empty-row td {
    text-align: center;
    padding: 40px 20px !important;
    color: var(--muted);
    font-size: 13px;
    border: 0;
}

/* --------------------------------------------------------------------------
   Raster
   -------------------------------------------------------------------------- */
body.ui-modern .explorer-file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
    gap: 14px;
    padding: 14px 0 0;
}

body.ui-modern .file-grid-item {
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    overflow: hidden;
    cursor: default;
    box-shadow: none;
    transition:
        border-color 0.13s,
        box-shadow 0.13s;
}

body.ui-modern .file-grid-item:hover {
    border-color: var(--border-strong);
    box-shadow: 0 4px 14px rgba(16, 24, 40, 0.08);
}

body.ui-modern .file-grid-item.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--focus);
}

body.ui-modern .file-grid-item .item-cb {
    position: absolute;
    top: 9px;
    left: 9px;
    z-index: 3;
    background: var(--surface);
    border-radius: 4px;
    box-shadow: 0 0 0 1px var(--border);
}

body.ui-modern .file-grid-preview {
    position: relative;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    overflow: hidden;
}

body.ui-modern .file-grid-preview.is-folder {
    background: var(--surface-2);
}

body.ui-modern .file-grid-preview.has-folder-cover::after {
    display: none;
}

body.ui-modern .file-grid-preview .file-grid-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

body.ui-modern .file-grid-icon-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: var(--surface-3);
    color: var(--muted);
    font-size: 0;
}

body.ui-modern .file-grid-icon-fallback .modern-svg {
    width: 24px;
    height: 24px;
}

body.ui-modern .file-grid-body {
    padding: 9px 11px 11px;
    min-width: 0;
}

body.ui-modern .file-grid-name {
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.ui-modern .file-grid-meta {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.ui-modern .file-grid-item .burger-wrap {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 3;
}

body.ui-modern .file-grid-item .burger-btn {
    width: 28px;
    height: 28px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    border: 0;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12);
    backdrop-filter: blur(4px);
    opacity: 0;
}

body.ui-modern .file-grid-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
    font-size: 13px;
}

/* --------------------------------------------------------------------------
   Details-Panel
   -------------------------------------------------------------------------- */
body.ui-modern .modern-details {
    width: 322px;
    flex: 0 0 322px;
    border-left: 1px solid var(--border);
    background: var(--surface);
    overflow-y: auto;
    padding: 16px;
    transition:
        width 0.18s ease,
        flex-basis 0.18s ease,
        opacity 0.15s;
}

body.ui-modern .modern-details.collapsed {
    width: 0;
    flex-basis: 0;
    padding: 0;
    border-left: 0;
    overflow: hidden;
    opacity: 0;
}

body.ui-modern .modern-details-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

body.ui-modern .modern-details-head h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

body.ui-modern .modern-details-head .modern-icon-btn {
    margin-left: auto;
    width: 30px;
    height: 30px;
}

body.ui-modern .modern-detail-preview {
    height: 180px;
    border-radius: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

body.ui-modern .modern-detail-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

body.ui-modern .modern-detail-preview .modern-ft {
    width: 64px;
    height: 64px;
    border-radius: 16px;
}

body.ui-modern .modern-detail-preview .modern-ft .modern-svg {
    width: 32px;
    height: 32px;
}

body.ui-modern .modern-detail-name {
    margin: 0 0 3px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    word-break: break-word;
}

body.ui-modern .modern-detail-sub {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 12px;
}

body.ui-modern .modern-detail-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin-bottom: 18px;
}

body.ui-modern .modern-detail-actions .modern-btn {
    width: 100%;
    height: 34px;
    font-size: 12px;
}

body.ui-modern .modern-detail-actions .modern-btn.wide {
    grid-column: 1 / -1;
}

body.ui-modern .modern-detail-actions .modern-btn.primary {
    border-color: transparent;
    background: var(--accent);
    color: #fff;
}

body.ui-modern .modern-detail-actions .modern-btn.primary:hover {
    background: var(--accent-hover);
}

body.ui-modern .modern-detail-actions .modern-btn.danger {
    color: var(--danger);
}

body.ui-modern .modern-detail-actions .modern-btn.danger:hover {
    background: var(--danger-soft);
    border-color: color-mix(in srgb, var(--danger) 35%, transparent);
}

body.ui-modern .modern-detail-section {
    padding-top: 14px;
    border-top: 1px solid var(--border);
    margin-top: 14px;
}

body.ui-modern .modern-detail-section h3 {
    margin: 0 0 9px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

body.ui-modern .modern-info-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    font-size: 12.5px;
}

body.ui-modern .modern-info-row .label {
    color: var(--muted);
    flex: 0 0 auto;
}

body.ui-modern .modern-info-row .value {
    color: var(--text-soft);
    text-align: right;
    word-break: break-word;
}

body.ui-modern .modern-share-box {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 12px;
}

body.ui-modern .modern-share-box .modern-svg {
    width: 16px;
    height: 16px;
}

body.ui-modern .modern-share-box button {
    margin-left: auto;
    border: 0;
    background: transparent;
    color: var(--accent-text);
    font-size: 12px;
    font-weight: 600;
}

body.ui-modern .modern-detail-note {
    font-size: 11.5px;
    color: var(--muted);
    line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Auswahl-Leiste
   -------------------------------------------------------------------------- */
body.ui-modern .modern-selection-bar {
    position: fixed;
    left: calc(252px + (100vw - 252px) / 2);
    bottom: 20px;
    z-index: 70;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 8px 7px 14px;
    border-radius: 12px;
    background: #111827;
    color: #e5e7eb;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
    transform: translate(-50%, 20px);
    opacity: 0;
    pointer-events: none;
    transition:
        transform 0.18s ease,
        opacity 0.18s ease;
}

body.ui-modern .modern-selection-bar.visible {
    transform: translate(-50%, 0);
    opacity: 1;
    pointer-events: auto;
}

body.ui-modern .modern-sel-count {
    margin-right: 6px;
    font-size: 12.5px;
    font-weight: 550;
    white-space: nowrap;
}

body.ui-modern .modern-sel-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 9px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #d1d5db;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

body.ui-modern .modern-sel-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

body.ui-modern .modern-sel-btn.danger:hover {
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
}

body.ui-modern .modern-sel-btn .modern-svg {
    width: 15px;
    height: 15px;
}

body.ui-modern .modern-sel-divider {
    width: 1px;
    height: 20px;
    margin: 0 3px;
    background: rgba(255, 255, 255, 0.14);
}

body.ui-modern .modern-sel-close {
    width: 30px;
    height: 30px;
    color: #9ca3af;
}

body.ui-modern .modern-sel-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* --------------------------------------------------------------------------
   Popover / Menüs
   -------------------------------------------------------------------------- */
body.ui-modern .modern-popover {
    position: fixed;
    z-index: 100;
    min-width: 220px;
    padding: 7px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    animation: modernPopIn 0.13s ease-out;
}

@keyframes modernPopIn {
    from {
        opacity: 0;
        transform: translateY(-4px) scale(0.99);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

body.ui-modern .modern-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 34px;
    padding: 0 9px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-soft);
    font-size: 12.5px;
    font-weight: 500;
    text-align: left;
}

body.ui-modern .modern-menu-item:hover {
    background: var(--surface-3);
    color: var(--text);
}

body.ui-modern .modern-menu-item .modern-svg {
    width: 16px;
    height: 16px;
    color: var(--muted);
}

body.ui-modern .modern-menu-item.danger {
    color: var(--danger);
}

body.ui-modern .modern-menu-item.danger .modern-svg {
    color: var(--danger);
}

body.ui-modern .modern-menu-item.danger:hover {
    background: var(--danger-soft);
}

body.ui-modern .modern-menu-sep {
    height: 1px;
    margin: 6px 8px;
    background: var(--border);
}

body.ui-modern .modern-menu-label {
    padding: 6px 9px 4px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}

/* App-Launcher */
body.ui-modern .modern-apps-popover {
    width: 374px;
    padding: 14px;
}

body.ui-modern .modern-apps-search {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 10px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
}

body.ui-modern .modern-apps-search .modern-svg {
    width: 15px;
    height: 15px;
    color: var(--muted);
}

body.ui-modern .modern-apps-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 12.5px;
    color: var(--text);
}

body.ui-modern .modern-apps-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
}

body.ui-modern .modern-app-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 13px 6px 11px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--text-soft);
    font-size: 11.5px;
    font-weight: 500;
    text-align: center;
}

body.ui-modern .modern-app-tile:hover {
    background: var(--surface-3);
    color: var(--text);
}

body.ui-modern .modern-app-tile.active {
    background: var(--accent-soft);
    color: var(--accent-text);
}

body.ui-modern .modern-app-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: var(--surface-3);
    color: var(--text-soft);
}

body.ui-modern .modern-app-tile.active .modern-app-icon {
    background: var(--surface);
    color: var(--accent);
    box-shadow: var(--shadow);
}

body.ui-modern .modern-app-icon .modern-svg {
    width: 21px;
    height: 21px;
}

body.ui-modern .modern-apps-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 11px;
}

body.ui-modern .modern-apps-footer button {
    border: 0;
    background: transparent;
    color: var(--accent-text);
    font-size: 11px;
    font-weight: 600;
}

/* Kontomenü */
body.ui-modern .modern-account-popover {
    width: 264px;
    padding: 0;
    overflow: hidden;
}

body.ui-modern .modern-account-head {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

body.ui-modern .modern-account-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 650;
}

body.ui-modern .modern-account-name {
    font-size: 13.5px;
    font-weight: 600;
}

body.ui-modern .modern-account-mail {
    color: var(--muted);
    font-size: 11.5px;
}

body.ui-modern .modern-account-menu {
    padding: 7px;
}

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */
body.ui-modern .modern-toasts {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 260;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
}

body.ui-modern .modern-toast {
    display: flex;
    align-items: center;
    gap: 9px;
    max-width: 380px;
    padding: 10px 13px;
    border-radius: 10px;
    background: #111827;
    color: #f3f4f6;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
    font-size: 12.5px;
    font-weight: 500;
    pointer-events: auto;
    animation: modernToastIn 0.18s ease-out;
}

body.ui-modern .modern-toast .modern-svg {
    width: 16px;
    height: 16px;
    color: #93c5fd;
}

body.ui-modern .modern-toast.success .modern-svg {
    color: #6ee7b7;
}

body.ui-modern .modern-toast.danger .modern-svg {
    color: #fca5a5;
}

@keyframes modernToastIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* --------------------------------------------------------------------------
   Backdrop
   -------------------------------------------------------------------------- */
body.ui-modern .modern-backdrop {
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(17, 24, 39, 0.35);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s;
}

body.ui-modern .modern-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

/* --------------------------------------------------------------------------
   Einstellungen / Tool / Editor
   -------------------------------------------------------------------------- */
body.ui-modern #settings-view {
    margin: 18px 24px;
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: none;
    min-height: calc(100vh - 118px);
}

body.ui-modern #settings-view > .explorer-header {
    padding: 18px 20px 0;
}

body.ui-modern #settings-view .explorer-title {
    font-size: 18px;
    font-weight: 650;
}

body.ui-modern #settings-view .settings-layout {
    border: 0;
    border-top: 1px solid var(--border);
    border-radius: 0 0 14px 14px;
}

body.ui-modern .settings-nav {
    background: var(--surface-2);
    border-right: 1px solid var(--border);
    padding: 10px;
}

body.ui-modern .settings-nav button {
    border-radius: 8px;
    color: var(--text-soft);
    font-size: 12.5px;
    padding: 8px 10px;
}

body.ui-modern .settings-nav button:hover {
    background: var(--surface-3);
    color: var(--text);
}

body.ui-modern .settings-nav button.active {
    background: var(--accent-soft);
    color: var(--accent-text);
    box-shadow: none;
}

body.ui-modern .settings-content {
    padding: 18px 20px;
}

body.ui-modern #tool-view {
    margin: 18px 24px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: none;
    min-height: calc(100vh - 118px);
}

body.ui-modern #tool-view .tool-view-topbar {
    margin-bottom: 14px;
}

body.ui-modern #tool-view .tool-view-topbar h2 {
    font-size: 18px;
    font-weight: 650;
}

body.ui-modern #editor-view {
    margin: 18px 24px;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}

body.ui-modern.tool-mode .app-shell,
body.ui-modern.editor-mode .app-shell {
    grid-template-columns: minmax(0, 1fr);
}

body.ui-modern.tool-mode .modern-sidebar,
body.ui-modern.editor-mode .modern-sidebar {
    display: none;
}

body.ui-modern.tool-mode .main,
body.ui-modern.editor-mode .main {
    grid-column: 1;
}

body.ui-modern.editor-mode .main {
    padding: 0;
}

body.ui-modern.editor-mode #app-screen,
body.ui-modern.tool-mode #app-screen {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

body.ui-modern.editor-mode .content,
body.ui-modern.tool-mode .content {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

body.ui-modern.editor-mode #editor-view,
body.ui-modern.tool-mode #tool-view {
    flex: 1;
    min-height: 0;
    margin: 0;
    border-radius: 0;
    border: 0;
}

/* --------------------------------------------------------------------------
   Login (modern, aber dezent)
   -------------------------------------------------------------------------- */
body.ui-modern.login-mode {
    background: var(--bg);
}

body.ui-modern.login-mode .app-shell {
    background: var(--bg);
    min-height: 100vh;
}

body.ui-modern.login-mode .modern-sidebar,
body.ui-modern.login-mode .modern-details,
body.ui-modern.login-mode .modern-selection-bar,
body.ui-modern.login-mode .modern-backdrop,
body.ui-modern.login-mode .modern-toasts {
    display: none !important;
}

body.ui-modern.login-mode .login-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(16, 24, 40, 0.1);
}

body.ui-modern.login-mode .login-panel h2 {
    font-weight: 650;
}

body.ui-modern.login-mode .input-row input {
    background: var(--surface-2);
    border-color: var(--border);
    border-radius: 9px;
    height: 42px;
}

body.ui-modern.login-mode .input-row input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--focus);
}

body.ui-modern.login-mode .btn {
    height: 42px;
    border-radius: 9px;
    background: var(--accent);
    box-shadow: none;
}

body.ui-modern.login-mode .btn:hover {
    background: var(--accent-hover);
    filter: none;
    transform: none;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1180px) {
    body.ui-modern:not(.login-mode) .app-shell {
        grid-template-columns: 234px minmax(0, 1fr);
    }
    body.ui-modern .modern-details {
        width: 300px;
        flex-basis: 300px;
    }
    body.ui-modern .modern-selection-bar {
        left: calc(234px + (100vw - 234px) / 2);
    }
}

@media (max-width: 1020px) {
    body.ui-modern:not(.login-mode) .app-shell {
        grid-template-columns: minmax(0, 1fr);
    }
    body.ui-modern .modern-menu-btn {
        display: inline-flex;
    }
    body.ui-modern .modern-sidebar {
        position: fixed;
        top: 64px;
        left: 0;
        bottom: 0;
        width: 270px;
        transform: translateX(-102%);
        transition: transform 0.2s ease;
        box-shadow: 18px 0 40px rgba(0, 0, 0, 0.12);
        z-index: 60;
    }
    body.ui-modern .modern-sidebar.open {
        transform: none;
    }
    body.ui-modern .modern-details {
        position: fixed;
        top: 64px;
        right: 0;
        bottom: 0;
        width: min(340px, 92vw);
        flex-basis: auto;
        z-index: 55;
        box-shadow: -18px 0 40px rgba(0, 0, 0, 0.12);
        transform: translateX(102%);
        transition: transform 0.2s ease;
    }
    body.ui-modern .modern-details.collapsed {
        width: min(340px, 92vw);
        flex-basis: auto;
        padding: 16px;
        opacity: 1;
        border-left: 1px solid var(--border);
        overflow-y: auto;
    }
    body.ui-modern .modern-details.open {
        transform: none;
    }
    body.ui-modern .modern-selection-bar {
        left: 50%;
    }
    body.ui-modern .modern-details.open + * {
        pointer-events: none;
    }
}

@media (max-width: 860px) {
    body.ui-modern #explorer-view {
        padding: 16px 16px 110px;
    }
    body.ui-modern #settings-view,
    body.ui-modern #tool-view {
        margin: 12px;
    }
    body.ui-modern .modern-head-actions .modern-btn span {
        display: none;
    }
    body.ui-modern .modern-head-actions .modern-btn {
        width: 36px;
        padding: 0;
    }
    body.ui-modern #file-card td:nth-child(4),
    body.ui-modern #file-card th:nth-child(4) {
        width: 92px;
    }
}

@media (max-width: 700px) {
    body.ui-modern .modern-search kbd {
        display: none;
    }
    body.ui-modern .modern-page-title-wrap {
        flex-wrap: wrap;
        gap: 2px 8px;
    }
    body.ui-modern #modernPageTitle {
        font-size: 19px;
    }
    body.ui-modern .tool-toolbar-actions .btn span {
        display: none;
    }
    body.ui-modern .explorer-file-grid {
        grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    }
}

@media (max-width: 620px) {
    body.ui-modern:not(.login-mode) .app-shell {
        grid-template-rows: 58px minmax(0, 1fr);
    }
    body.ui-modern .topbar {
        gap: 8px;
        padding: 0 10px;
    }
    body.ui-modern .modern-brand span {
        display: none;
    }
    body.ui-modern .modern-search {
        flex: 1 1 70px;
        min-width: 0;
        height: 36px;
        margin-left: 0;
    }
    body.ui-modern .modern-search kbd {
        display: none;
    }
    body.ui-modern .modern-sidebar {
        top: 58px;
    }
    body.ui-modern .modern-details {
        top: 58px;
    }
    body.ui-modern #theme-toggle {
        display: none !important;
    }
    body.ui-modern #file-card td:nth-child(4),
    body.ui-modern #file-card th:nth-child(4) {
        display: none;
    }
    body.ui-modern #file-card th:nth-child(1) {
        width: 34px;
        padding-left: 8px;
    }
    body.ui-modern #file-card td {
        padding: 0 6px;
    }
    body.ui-modern #file-card th:nth-child(5) {
        width: 40px;
        padding-right: 6px;
    }
    body.ui-modern .modern-count {
        display: none;
    }
    body.ui-modern .modern-selection-bar {
        left: 12px;
        right: 12px;
        bottom: 12px;
        transform: translateY(20px);
        justify-content: center;
        flex-wrap: wrap;
    }
    body.ui-modern .modern-selection-bar.visible {
        transform: none;
    }
    body.ui-modern .modern-sel-btn span {
        display: none;
    }
    body.ui-modern .modern-sel-btn {
        padding: 0 8px;
    }
    body.ui-modern #explorer-view {
        padding: 14px 10px 110px;
    }
    body.ui-modern .explorer-file-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    body.ui-modern .modern-toasts {
        left: 12px;
        right: 12px;
        bottom: 78px;
        align-items: stretch;
    }
    body.ui-modern .modern-toast {
        max-width: none;
    }
}

body.ui-modern .modern-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

body.ui-modern .modern-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 9px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-soft);
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
}

body.ui-modern .modern-tool-btn:hover {
    background: var(--surface-3);
    color: var(--text);
}

body.ui-modern .modern-tool-btn .modern-svg {
    width: 16px;
    height: 16px;
    color: var(--muted);
}

body.ui-modern .modern-menu-check {
    margin-left: auto;
    color: var(--accent);
}

body.ui-modern .modern-menu-check .modern-svg {
    width: 14px;
    height: 14px;
}

body.ui-modern .file-grid-icon-fallback.modern-ft {
    width: 56px;
    height: 56px;
    border-radius: 14px;
}

body.ui-modern .file-grid-icon-fallback.modern-ft .modern-svg {
    width: 28px;
    height: 28px;
}

body.ui-modern .modern-storage-bar span {
    min-width: 2px;
}

@media (max-width: 1020px) {
    body.ui-modern .item-cb,
    body.ui-modern .burger-btn {
        opacity: 1;
    }
}

@media (max-width: 700px) {
    body.ui-modern .modern-tool-btn span {
        display: none;
    }
    body.ui-modern .modern-tool-btn {
        padding: 0 7px;
    }
    body.ui-modern #file-card th:nth-child(3),
    body.ui-modern #file-card td:nth-child(3) {
        display: none;
    }
}

body.ui-modern:not(.login-mode) .content {
    background: var(--surface);
}

body.ui-modern #explorer-view .upload-dropdown {
    display: none;
}

body.ui-modern .modern-nav-count {
    margin-left: auto;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
}

body.ui-modern .modern-nav-item.active .modern-nav-count {
    color: var(--accent-text);
}

body.ui-modern .modern-result-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
}

body.ui-modern .modern-result-star {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    opacity: 0;
}

body.ui-modern .modern-result-row:hover .modern-result-star,
body.ui-modern .modern-result-star.active,
body.ui-modern .modern-result-row:focus-within .modern-result-star {
    opacity: 1;
}

body.ui-modern .modern-result-star:hover {
    background: var(--surface-3);
    color: var(--text);
}

body.ui-modern .modern-result-star.active {
    color: #f59e0b;
}

body.ui-modern .modern-result-star.active .modern-svg {
    fill: currentColor;
    stroke: currentColor;
}

body.ui-modern .modern-result-star .modern-svg {
    width: 15px;
    height: 15px;
}

body.ui-modern .modern-results-table.modern-shares-table th:nth-child(2) {
    width: 22%;
}

body.ui-modern .modern-results-table.modern-shares-table th:nth-child(3),
body.ui-modern .modern-results-table.modern-shares-table th:nth-child(4) {
    width: 118px;
}

body.ui-modern .modern-results-table.modern-shares-table th:nth-child(5) {
    width: 120px;
}

body.ui-modern .modern-shares-toolbar,
body.ui-modern .modern-bulk-toolbar {
    display: none;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 10px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
}

body.ui-modern .modern-shares-toolbar.visible,
body.ui-modern .modern-bulk-toolbar.visible {
    display: flex;
}

body.ui-modern .modern-shares-count,
body.ui-modern .modern-bulk-count {
    margin-right: auto;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 600;
}

body.ui-modern .modern-shares-toolbar .modern-btn,
body.ui-modern .modern-bulk-toolbar .modern-btn {
    height: 32px;
    padding: 0 11px;
    font-size: 12px;
}

body.ui-modern .modern-shares-toolbar .modern-btn.danger,
body.ui-modern .modern-bulk-toolbar .modern-btn.danger {
    border-color: var(--danger-soft);
    color: var(--danger);
}

body.ui-modern .modern-shares-toolbar .modern-btn.danger:hover,
body.ui-modern .modern-bulk-toolbar .modern-btn.danger:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

body.ui-modern .modern-shares-toolbar .modern-btn.danger .modern-svg,
body.ui-modern .modern-bulk-toolbar .modern-btn.danger .modern-svg {
    color: var(--danger);
}

body.ui-modern .modern-shares-toolbar .modern-icon-btn,
body.ui-modern .modern-bulk-toolbar .modern-icon-btn {
    width: 30px;
    height: 30px;
}

body.ui-modern .modern-th-name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

body.ui-modern .modern-shares-table input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
    flex: none;
}

body.ui-modern .modern-share-actions {
    text-align: right;
    white-space: nowrap;
}

body.ui-modern .modern-share-row {
    cursor: default;
}

body.ui-modern .modern-share-actions .modern-icon-btn {
    width: 28px;
    height: 28px;
    margin-left: 2px;
    border: 1px solid transparent;
}

body.ui-modern .modern-share-actions .modern-icon-btn:hover {
    border-color: var(--border);
}

body.ui-modern .modern-danger-icon {
    color: var(--danger);
}

body.ui-modern .modern-danger-icon:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

body.ui-modern .modern-share-missing {
    margin-left: 6px;
    color: var(--danger);
    font-size: 10.5px;
}

/* Teilen-Dialog */
body.ui-modern .modern-share-overlay {
    position: fixed;
    inset: 0;
    z-index: 250;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(3px);
    animation: modernFadeIn 0.15s ease-out;
}

@keyframes modernFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

body.ui-modern .modern-share-panel {
    width: min(520px, 100%);
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.32);
}

body.ui-modern .modern-share-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}

body.ui-modern .modern-share-head h2 {
    margin: 0 0 3px;
    font-size: 18px;
    font-weight: 650;
    letter-spacing: -0.01em;
}

body.ui-modern .modern-share-head p {
    margin: 0;
    color: var(--muted);
    font-size: 12.5px;
    word-break: break-word;
}

body.ui-modern .modern-share-head .modern-icon-btn {
    margin-left: auto;
    width: 32px;
    height: 32px;
}

body.ui-modern .modern-share-link {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

body.ui-modern .modern-share-link input {
    flex: 1;
    min-width: 0;
    height: 38px;
    padding: 0 11px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 12.5px;
}

body.ui-modern .modern-share-link .modern-btn {
    height: 38px;
}

body.ui-modern .modern-share-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

body.ui-modern .modern-share-option {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text-soft);
    font: inherit;
    font-size: 12.5px;
    font-weight: 550;
    text-align: left;
    text-decoration: none;
}

body.ui-modern .modern-share-option:hover {
    background: var(--surface-3);
    border-color: var(--border-strong);
    color: var(--text);
}

body.ui-modern .modern-share-option-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: var(--surface-3);
    color: var(--muted);
}

body.ui-modern .modern-share-option-icon .modern-svg {
    width: 16px;
    height: 16px;
}

body.ui-modern .modern-share-hint {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.5;
}

@media (max-width: 620px) {
    body.ui-modern .modern-share-options {
        grid-template-columns: 1fr;
    }
    body.ui-modern .modern-share-link {
        flex-direction: column;
    }
}

@media (max-width: 700px) {
    body.ui-modern .modern-shares-toolbar,
    body.ui-modern .modern-bulk-toolbar {
        gap: 6px;
    }
    body.ui-modern .modern-shares-count,
    body.ui-modern .modern-bulk-count {
        flex: 1 1 100%;
    }
    body.ui-modern .modern-shares-toolbar .modern-btn,
    body.ui-modern .modern-bulk-toolbar .modern-btn {
        flex: 1 1 0;
    }
    body.ui-modern .modern-shares-toolbar .modern-btn span,
    body.ui-modern .modern-bulk-toolbar .modern-btn span {
        display: inline;
    }
}

body.ui-modern .modern-nav-item[data-planned="true"] {
    opacity: 0.68;
}

@media (min-width: 1021px) {
    body.ui-modern .modern-menu-btn {
        display: none !important;
    }
    body.ui-modern.modern-details-open .modern-selection-bar {
        left: calc(252px + (100vw - 252px - 322px) / 2);
    }
}

@media (min-width: 1021px) and (max-width: 1180px) {
    body.ui-modern.modern-details-open .modern-selection-bar {
        left: calc(234px + (100vw - 234px - 300px) / 2);
    }
}

@media (max-width: 1020px) {
    body.ui-modern .modern-menu-btn {
        display: inline-flex !important;
    }
}

body.ui-modern .modern-nav-item[data-planned="true"]:hover {
    background: var(--surface-3);
}

body.ui-modern:not([data-modern-view="explorer"]) .modern-search {
    visibility: hidden;
    pointer-events: none;
}

body.ui-modern .file-grid-icon-fallback.modern-ft {
    width: 46px;
    height: 46px;
    border-radius: 12px;
}

body.ui-modern .file-grid-icon-fallback.modern-ft .modern-svg {
    width: 24px;
    height: 24px;
}

body.ui-modern .modern-detail-preview > .modern-svg {
    width: 32px;
    height: 32px;
    color: var(--muted);
}

/* --------------------------------------------------------------------------
   Globale Suche / Zuletzt
   -------------------------------------------------------------------------- */
body.ui-modern #modernResults {
    order: 5;
    margin-top: 2px;
    padding-bottom: 20px;
}

body.ui-modern #explorer-view.modern-results-mode .toolbar-row,
body.ui-modern #explorer-view.modern-results-mode .modern-head-actions {
    display: none;
}

body.ui-modern .modern-results-wrap {
    margin-top: 2px;
}

body.ui-modern .modern-results-table {
    width: 100%;
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

body.ui-modern .modern-results-table th {
    position: sticky;
    top: 0;
    z-index: 5;
    height: 34px;
    padding: 0 10px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 550;
    text-align: left;
    white-space: nowrap;
}

body.ui-modern .modern-results-table th:nth-child(2) {
    width: 27%;
}

body.ui-modern .modern-results-table th:nth-child(3) {
    width: 150px;
}

body.ui-modern .modern-results-table th:nth-child(4) {
    width: 100px;
}

body.ui-modern .modern-results-table th:nth-child(5) {
    width: 64px;
}

body.ui-modern .modern-results-table td {
    height: 50px;
    padding: 0 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text-soft);
    font-size: 13px;
    vertical-align: middle;
}

body.ui-modern .modern-results-table th:first-child,
body.ui-modern .modern-results-table td:first-child {
    width: auto;
    text-align: left;
}

body.ui-modern .modern-results-table .thumb-name {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

body.ui-modern .modern-result-row {
    cursor: pointer;
    outline: none;
}

body.ui-modern .modern-result-row:hover td,
body.ui-modern .modern-result-row:focus-visible td {
    background: var(--surface-2);
}

body.ui-modern .modern-result-path,
body.ui-modern .modern-result-date,
body.ui-modern .modern-result-size {
    color: var(--muted) !important;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.ui-modern .modern-result-chevron {
    text-align: right;
    color: var(--muted);
}

body.ui-modern .modern-result-chevron .modern-svg {
    width: 16px;
    height: 16px;
}

body.ui-modern .modern-result-row:hover .modern-result-path,
body.ui-modern .modern-result-row:hover .modern-result-date,
body.ui-modern .modern-result-row:hover .modern-result-size,
body.ui-modern .modern-result-row:hover .modern-result-chevron {
    color: var(--text-soft) !important;
}

body.ui-modern .modern-results-more {
    display: flex;
    justify-content: center;
    padding: 14px 0;
}

body.ui-modern .modern-results-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 300px;
    padding: 30px;
    color: var(--muted);
    font-size: 12.5px;
}

body.ui-modern .modern-results-empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 12px;
    border-radius: 14px;
    background: var(--surface-3);
    color: var(--muted);
}

body.ui-modern .modern-results-empty-icon .modern-svg {
    width: 26px;
    height: 26px;
}

body.ui-modern .modern-results-empty h3 {
    margin: 0 0 5px;
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
}

body.ui-modern .modern-results-empty p {
    max-width: 360px;
    margin: 0 0 14px;
    line-height: 1.5;
}

body.ui-modern .modern-results-spinner {
    width: 26px;
    height: 26px;
    margin-bottom: 10px;
    border: 3px solid var(--surface-3);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: modernResultsSpin .8s linear infinite;
}

@keyframes modernResultsSpin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 1020px) {
    body.ui-modern .modern-result-star {
        opacity: 1;
    }
}

@media (max-width: 700px) {
    body.ui-modern .modern-results-table th:nth-child(2),
    body.ui-modern .modern-results-table td:nth-child(2),
    body.ui-modern .modern-results-table th:nth-child(3),
    body.ui-modern .modern-results-table td:nth-child(3),
    body.ui-modern .modern-results-table th:nth-child(4),
    body.ui-modern .modern-results-table td:nth-child(4) {
        display: none;
    }
    body.ui-modern .modern-results-table th:nth-child(1) {
        width: auto;
    }
    body.ui-modern .modern-results-table th:nth-child(5) {
        width: 60px;
    }
    body.ui-modern .modern-results-empty {
        min-height: 260px;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.ui-modern *,
    body.ui-modern *::before,
    body.ui-modern *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* --------------------------------------------------------------------------
   Einstellungen – modernes Layout
   -------------------------------------------------------------------------- */
body.ui-modern #settings-view {
    margin: 18px 24px;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    min-height: calc(100vh - 118px);
}

body.ui-modern #settings-view > .settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 0;
    padding: 22px 26px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

body.ui-modern .settings-header-main {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

body.ui-modern .settings-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: var(--accent-soft);
    color: var(--accent-text);
}

body.ui-modern .settings-header-icon .modern-svg {
    width: 22px;
    height: 22px;
}

body.ui-modern .settings-header .explorer-title {
    margin: 0;
    font-size: 22px;
    font-weight: 680;
    letter-spacing: -0.02em;
}

body.ui-modern .settings-header .explorer-title-icon {
    display: none;
}

body.ui-modern .settings-header-sub {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.4;
}

body.ui-modern #settings-back-btn {
    flex: none;
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text-soft);
    font-size: 12.5px;
    font-weight: 600;
    box-shadow: none;
}

body.ui-modern #settings-back-btn:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text);
    transform: none;
    box-shadow: none;
}

body.ui-modern #settings-view .settings-layout {
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr);
    gap: 0;
    min-height: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
}

body.ui-modern .settings-nav {
    width: auto;
    padding: 16px 12px;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    border-radius: 0;
    background: var(--surface-2);
}

body.ui-modern .settings-nav-group + .settings-nav-group {
    margin-top: 16px;
}

body.ui-modern .settings-nav-label {
    margin: 0 0 6px;
    padding: 0 10px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

body.ui-modern .settings-nav button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 2px 0;
    padding: 7px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-soft);
    font-size: 12.8px;
    font-weight: 550;
    line-height: 1.3;
    text-align: left;
    transition: background 0.14s, color 0.14s;
}

body.ui-modern .settings-nav button:hover {
    background: var(--surface-3);
    color: var(--text);
}

body.ui-modern .settings-nav button.active {
    background: var(--accent-soft);
    color: var(--accent-text);
    font-weight: 650;
    box-shadow: none;
}

body.ui-modern .settings-nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 26px;
    height: 26px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    color: var(--muted);
}

body.ui-modern .settings-nav-icon .modern-svg {
    width: 14px;
    height: 14px;
}

body.ui-modern .settings-nav button.active .settings-nav-icon {
    border-color: transparent;
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

body.ui-modern .settings-content {
    padding: 26px 30px 40px;
    overflow-y: auto;
    background: var(--surface);
}

body.ui-modern .settings-content > * {
    max-width: 920px;
}

body.ui-modern .settings-section-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0 0 18px;
}

body.ui-modern .settings-section-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--accent-text);
}

body.ui-modern .settings-section-icon .modern-svg {
    width: 18px;
    height: 18px;
}

body.ui-modern .settings-section-title {
    margin: 0 0 3px;
    font-size: 19px;
    font-weight: 650;
    letter-spacing: -0.015em;
    color: var(--text);
}

body.ui-modern .settings-section-head .settings-section-desc {
    margin: 0;
}

body.ui-modern .settings-section-desc {
    font-size: 12.5px;
    line-height: 1.55;
}

body.ui-modern .settings-section-note {
    margin: -6px 0 16px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

body.ui-modern .settings-card {
    margin-bottom: 14px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

body.ui-modern .settings-card-muted {
    background: var(--surface-2);
    box-shadow: none;
}

body.ui-modern .settings-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

body.ui-modern .settings-card-title {
    margin: 0 0 4px;
    font-size: 14.5px;
    font-weight: 650;
    color: var(--text);
}

body.ui-modern .settings-card-desc {
    margin: 0 0 10px;
    font-size: 12px;
    line-height: 1.55;
}

body.ui-modern .settings-card-head .settings-card-desc {
    margin-bottom: 0;
}

body.ui-modern .settings-card .input-row:first-of-type {
    margin-top: 10px;
}

body.ui-modern .settings-content .input-row {
    margin: 12px 0;
}

body.ui-modern .settings-content .input-row label {
    margin-bottom: 5px;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 600;
}

body.ui-modern .settings-content .input-row input {
    height: 38px;
    padding: 0 11px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 13px;
}

body.ui-modern .settings-content .input-row input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

body.ui-modern .settings-content .btn {
    height: 36px;
    padding: 0 14px;
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 600;
    box-shadow: none;
}

body.ui-modern .settings-content .btn:not(.secondary) {
    background: var(--accent);
    color: #fff;
}

body.ui-modern .settings-content .btn:not(.secondary):hover {
    background: var(--accent-hover, var(--accent));
    transform: none;
    box-shadow: none;
}

body.ui-modern .settings-content .btn.secondary {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-soft);
    box-shadow: none;
}

body.ui-modern .settings-content .btn.secondary:hover {
    border-color: var(--border-strong);
    background: var(--surface-2);
    color: var(--text);
    transform: none;
    box-shadow: none;
}

body.ui-modern .settings-content .btn.secondary.danger {
    border-color: var(--danger-soft);
    color: var(--danger);
}

body.ui-modern .settings-content .btn.secondary.danger:hover {
    background: var(--danger-soft);
}

body.ui-modern .settings-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

body.ui-modern .settings-field-hint {
    margin-top: 5px;
    font-size: 11px;
    line-height: 1.5;
}

body.ui-modern .settings-note {
    padding: 1px 0;
    font-size: 12px;
    line-height: 1.55;
}

body.ui-modern .settings-note .modern-svg {
    width: 16px;
    height: 16px;
    margin-top: 1px;
    color: var(--accent-text);
}

body.ui-modern .settings-endpoint code {
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-soft);
    font-size: 11.5px;
}

body.ui-modern .settings-file-list {
    margin: 10px 0 4px;
    border: 1px solid var(--border);
    border-radius: 9px;
    overflow: hidden;
}

body.ui-modern .settings-file-item {
    padding: 9px 12px;
    background: var(--surface-2);
    font-size: 12px;
}

body.ui-modern .settings-file-item .modern-svg {
    width: 14px;
    height: 14px;
    color: var(--muted);
}

body.ui-modern .settings-upload-row {
    gap: 10px;
    margin: 14px 0 0;
}

body.ui-modern .settings-user-list {
    gap: 8px;
}

body.ui-modern .settings-list-meta {
    margin: 0 0 9px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

body.ui-modern .settings-user-row {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
}

body.ui-modern .settings-user-head {
    padding: 11px 12px;
}

body.ui-modern .settings-user-avatar {
    width: 34px;
    height: 34px;
    background: var(--accent-soft);
    color: var(--accent-text);
    font-size: 13px;
}

body.ui-modern .settings-user-name {
    font-size: 13px;
    font-weight: 650;
}

body.ui-modern .settings-user-meta {
    margin-top: 1px;
    font-size: 11px;
}

body.ui-modern .settings-user-actions .btn {
    height: 30px;
    padding: 0 10px;
    font-size: 11.5px;
}

body.ui-modern .settings-user-tokens {
    gap: 6px;
    padding: 8px 12px;
    background: var(--surface-2);
    font-size: 11px;
}

body.ui-modern .settings-token {
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--surface);
    font-size: 11px;
}

body.ui-modern .settings-token .btn-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    color: var(--muted);
    font-size: 10px;
}

body.ui-modern .settings-token .btn-icon:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

body.ui-modern .settings-btn-sm {
    height: 28px !important;
    padding: 0 10px !important;
    font-size: 11px !important;
}

body.ui-modern .settings-badge {
    padding: 1px 7px;
    background: var(--accent-soft);
    color: var(--accent-text);
    font-size: 10px;
    font-weight: 700;
}

body.ui-modern .settings-switch .toggle-slider {
    background: var(--border-strong);
}

body.ui-modern .settings-switch input:checked + .toggle-slider {
    background: var(--accent);
}

body.ui-modern .settings-inline-toggle {
    margin-bottom: 12px;
    padding: 10px 0 14px;
    border-bottom: 1px solid var(--border);
}

body.ui-modern .settings-inline-toggle strong {
    font-size: 12.5px;
    font-weight: 600;
}

body.ui-modern .settings-inline-toggle small {
    font-size: 11px;
}

body.ui-modern .settings-checkbox {
    margin: 14px 0 4px;
}

body.ui-modern .settings-checkbox strong {
    font-size: 12px;
}

body.ui-modern .settings-checkbox small {
    font-size: 11px;
    line-height: 1.5;
}

body.ui-modern .theme-options {
    gap: 10px;
    margin-top: 14px;
}

body.ui-modern .theme-option {
    padding: 10px;
    border-radius: 11px;
    background: var(--surface-2);
    transition: border-color 0.14s, box-shadow 0.14s, transform 0.14s;
}

body.ui-modern .theme-option:hover {
    border-color: var(--border-strong);
}

body.ui-modern .theme-option.active {
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

body.ui-modern .theme-preview {
    height: 66px;
    border-radius: 8px;
}

body.ui-modern .theme-option-title {
    font-size: 12.5px;
}

body.ui-modern .theme-option-hint {
    font-size: 11px;
}

body.ui-modern .theme-option-check {
    width: 20px;
    height: 20px;
    background: var(--accent);
}

body.ui-modern .settings-content .alert {
    margin: 10px 0 0;
}

@media (max-width: 1020px) {
    body.ui-modern #settings-view {
        margin: 12px;
        border-radius: 14px;
    }
    body.ui-modern #settings-view .settings-layout {
        grid-template-columns: 1fr;
    }
    body.ui-modern .settings-nav {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 14px;
        overflow-x: auto;
        overflow-y: hidden;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }
    body.ui-modern .settings-nav-group {
        display: contents;
    }
    body.ui-modern .settings-nav-label {
        display: none;
    }
    body.ui-modern .settings-nav button {
        width: auto;
        flex: none;
        margin: 0;
        padding: 6px 10px;
        border: 1px solid var(--border);
        background: var(--surface);
    }
    body.ui-modern .settings-nav-icon {
        width: 22px;
        height: 22px;
    }
    body.ui-modern .settings-nav-icon .modern-svg {
        width: 12px;
        height: 12px;
    }
    body.ui-modern .settings-content {
        padding: 20px 18px 32px;
    }
}

@media (max-width: 700px) {
    body.ui-modern #settings-view {
        margin: 8px;
    }
    body.ui-modern #settings-view > .settings-header {
        align-items: center;
        gap: 10px;
        padding: 16px;
    }
    body.ui-modern .settings-header-main {
        flex: 1 1 auto;
        gap: 10px;
    }
    body.ui-modern .settings-header-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }
    body.ui-modern .settings-header .explorer-title {
        font-size: 18px;
    }
    body.ui-modern .settings-header-sub {
        display: none;
    }
    body.ui-modern .settings-back-full {
        display: none;
    }
    body.ui-modern .settings-back-short {
        display: inline;
    }
    body.ui-modern #settings-back-btn {
        width: auto;
        height: 34px;
        padding: 0 10px;
        font-size: 11.5px;
        white-space: nowrap;
    }
    body.ui-modern .settings-content .input-row input {
        height: 42px;
        font-size: 14px;
    }
    body.ui-modern .settings-card {
        padding: 16px;
    }
    body.ui-modern .settings-user-actions {
        width: 100%;
    }
    body.ui-modern .settings-user-actions .btn {
        flex: 1 1 0;
    }
    body.ui-modern .settings-token {
        flex-wrap: wrap;
    }
}

/* Einstellungen – Kontaktübersicht */
body.ui-modern .settings-contact-summary-icon {
    width: 48px;
    height: 48px;
    border-radius: 13px;
    background: var(--accent-soft);
    color: var(--accent-text);
}

body.ui-modern .settings-contact-summary-icon .modern-svg {
    width: 22px;
    height: 22px;
}

body.ui-modern .settings-contact-total {
    font-size: 30px;
    font-weight: 680;
    line-height: 1.05;
    letter-spacing: -0.02em;
}

body.ui-modern .settings-contact-label {
    margin-top: 2px;
    font-size: 12px;
}

body.ui-modern .settings-addressbooks {
    gap: 6px;
    margin-top: 16px;
    padding-top: 12px;
}

body.ui-modern .settings-addressbook-row {
    padding: 8px 11px;
    border-radius: 9px;
    background: var(--surface-2);
    font-size: 12px;
}

body.ui-modern .settings-addressbook-count {
    font-size: 12px;
    font-weight: 600;
}

body.ui-modern .settings-contact-preview {
    gap: 2px;
    margin-top: 16px;
    padding-top: 12px;
}

body.ui-modern .settings-contact-row {
    padding: 7px 8px;
    border-radius: 8px;
}

body.ui-modern .settings-contact-row:hover {
    background: var(--surface-2);
}

body.ui-modern .settings-contact-avatar {
    width: 32px;
    height: 32px;
    background: var(--accent-soft);
    color: var(--accent-text);
    font-size: 11px;
}

body.ui-modern .settings-contact-name {
    font-size: 12.5px;
    font-weight: 600;
}

body.ui-modern .settings-contact-meta {
    font-size: 11px;
}

body.ui-modern .settings-contact-more {
    margin: 5px 8px 0;
    font-size: 11px;
}

/* --------------------------------------------------------------------------
   Papierkorb
   -------------------------------------------------------------------------- */
body.ui-modern .modern-trash-toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin: 2px 0 14px;
}

body.ui-modern .modern-trash-hint {
    flex: 1 1 320px;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

body.ui-modern .modern-trash-empty-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--danger-soft);
    border-radius: 8px;
    background: var(--surface);
    color: var(--danger);
    font-size: 12px;
    font-weight: 600;
    box-shadow: none;
}

body.ui-modern .modern-trash-empty-btn:hover {
    background: var(--danger-soft);
    border-color: var(--danger-soft);
    color: var(--danger);
}

body.ui-modern .modern-trash-empty-btn .modern-svg {
    width: 14px;
    height: 14px;
}

body.ui-modern .modern-trash-row {
    cursor: default;
}

body.ui-modern .modern-trash-row .modern-share-actions .modern-icon-btn[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
}

@media (max-width: 700px) {
    body.ui-modern .modern-trash-toolbar {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }
    body.ui-modern .modern-trash-hint {
        flex: none;
    }
    body.ui-modern .modern-trash-empty-btn {
        justify-content: center;
    }
}

/* Benutzerfreigabe-Dialog */
body.ui-modern .modern-btn.primary {
    border-color: transparent;
    background: var(--accent);
    color: #fff;
}

body.ui-modern .modern-btn.primary:hover {
    border-color: transparent;
    background: var(--accent);
    color: #fff;
    filter: brightness(1.05);
}

body.ui-modern .modern-user-share-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

body.ui-modern .modern-user-share-form label {
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 600;
}

body.ui-modern .modern-user-share-form input,
body.ui-modern .modern-user-share-form select {
    height: 40px;
    padding: 0 11px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 13px;
}

body.ui-modern .modern-user-share-form input:focus,
body.ui-modern .modern-user-share-form select:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

body.ui-modern .modern-user-share-form .modern-share-hint {
    margin: 0 0 4px;
}

body.ui-modern .modern-user-share-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}

/* Freigaben – Tabs und Benutzerfreigaben */
body.ui-modern .modern-shares-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    margin: 0 0 14px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
}

body.ui-modern .modern-shares-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: none;
    padding: 9px 11px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

body.ui-modern .modern-shares-tab:hover {
    color: var(--text);
}

body.ui-modern .modern-shares-tab.active {
    border-bottom-color: var(--accent);
    color: var(--accent-text);
}

body.ui-modern .modern-shares-tab-count {
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 10.5px;
    font-variant-numeric: tabular-nums;
}

body.ui-modern .modern-shares-tab.active .modern-shares-tab-count {
    background: var(--accent-soft);
    color: var(--accent-text);
}

body.ui-modern .modern-user-share-row {
    cursor: default;
}

body.ui-modern .modern-results-table.modern-user-shares-table th:nth-child(2) {
    width: 130px;
}

body.ui-modern .modern-results-table.modern-user-shares-table th:nth-child(3) {
    width: 22%;
}

body.ui-modern .modern-results-table.modern-user-shares-table th:nth-child(4) {
    width: 118px;
}

body.ui-modern .modern-results-table.modern-user-shares-table th:nth-child(5) {
    width: 90px;
}

body.ui-modern .modern-results-table.modern-user-shares-table th:nth-child(6) {
    width: 80px;
}

@media (max-width: 700px) {
    body.ui-modern .modern-results-table.modern-user-shares-table th:nth-child(2),
    body.ui-modern .modern-results-table.modern-user-shares-table td:nth-child(2),
    body.ui-modern .modern-results-table.modern-user-shares-table th:nth-child(3),
    body.ui-modern .modern-results-table.modern-user-shares-table td:nth-child(3),
    body.ui-modern .modern-results-table.modern-user-shares-table th:nth-child(4),
    body.ui-modern .modern-results-table.modern-user-shares-table td:nth-child(4),
    body.ui-modern .modern-results-table.modern-user-shares-table th:nth-child(5),
    body.ui-modern .modern-results-table.modern-user-shares-table td:nth-child(5) {
        display: none;
    }
    body.ui-modern .modern-results-table.modern-user-shares-table th:nth-child(6) {
        width: 74px;
    }
}

body.ui-modern .modern-user-share-row .modern-icon-btn[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
}
