        :root,
        [data-theme="dark"] {
            color-scheme: dark;
            --bg: #090b10;
            --surface: #10141f;
            --surface-raised: #161c2c;
            --text: #f1f3f6;
            --muted: #94a3b8;
            --accent: #3b82f6;
            --accent-dim: rgba(59, 130, 246, 0.16);
            --danger: #ef4444;
            --border: rgba(255, 255, 255, 0.08);
            --border-strong: rgba(255, 255, 255, 0.16);
            --input-bg: #0b0e16;
            --input-border: #1e293b;
            --row-hover: rgba(59, 130, 246, 0.06);
            --row-selected: rgba(59, 130, 246, 0.14);
            --thumb-bg: #0d111a;
            --media-bg: #06080d;
            --alert-bg: rgba(245, 158, 11, 0.1);
            --alert-border: rgba(245, 158, 11, 0.3);
            --login-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
            --login-error: #fca5a5;
            --modal-overlay: rgba(5, 7, 12, 0.8);
            --upload-panel-bg-top: #10141f;
            --upload-panel-bg-bottom: #090b10;
            --upload-shadow: 0 20px 25px -5px rgba(0,0,0,0.5);
            --upload-active-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
            --upload-track-bg: #05070a;
            --upload-track-border: rgba(255, 255, 255, 0.08);
            --upload-pct: #60a5fa;
            --upload-pct-done: #10b981;
            --upload-current: #94a3b8;
            --dropzone-bg: #0c0f17;
            --dropzone-drag-bg: rgba(59, 130, 246, 0.1);
            --dropzone-drag-text: #93c5fd;
            --icon-folder: #eab308;
            --icon-image: #38bdf8;
            --icon-video: #a855f7;
            --icon-audio: #10b981;
            --icon-text: #94a3b8;
            --icon-pdf: #f43f5e;
            --icon-office: #3b82f6;
            --icon-file: #64748b;
            --header-h: 46px;
            --radius: 8px;
            --radius-lg: 12px;
        }

        [data-theme="light"] {
            color-scheme: light;
            --bg: #f3f4f6;
            --surface: #ffffff;
            --surface-raised: #f9fafb;
            --text: #1f2937;
            --muted: #6b7280;
            --accent: #2563eb;
            --accent-dim: rgba(37, 99, 235, 0.08);
            --danger: #dc2626;
            --border: rgba(0, 0, 0, 0.08);
            --border-strong: rgba(0, 0, 0, 0.16);
            --input-bg: #ffffff;
            --input-border: #d1d5db;
            --row-hover: rgba(37, 99, 235, 0.04);
            --row-selected: rgba(37, 99, 235, 0.1);
            --thumb-bg: #f3f4f6;
            --media-bg: #e5e7eb;
            --alert-bg: #fffbeb;
            --alert-border: #fef08a;
            --login-gradient: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
            --login-error: #dc2626;
            --modal-overlay: rgba(15, 23, 42, 0.4);
            --upload-panel-bg-top: #ffffff;
            --upload-panel-bg-bottom: #f9fafb;
            --upload-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
            --upload-active-shadow: 0 0 10px rgba(37, 99, 235, 0.2);
            --upload-track-bg: #e5e7eb;
            --upload-track-border: rgba(0, 0, 0, 0.08);
            --upload-pct: #2563eb;
            --upload-pct-done: #16a34a;
            --upload-current: #4b5563;
            --dropzone-bg: #f9fafb;
            --dropzone-drag-bg: rgba(37, 99, 235, 0.06);
            --dropzone-drag-text: #1d4ed8;
            --icon-folder: #ca8a04;
            --icon-image: #2563eb;
            --icon-video: #7c3aed;
            --icon-audio: #16a34a;
            --icon-text: #4b5563;
            --icon-pdf: #dc2626;
            --icon-office: #1d4ed8;
            --icon-file: #4b5563;
        }

        * { box-sizing: border-box; }
        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
            font-size: 13px;
            line-height: 1.5;
            margin: 0;
            background: var(--bg);
            color: var(--text);
            min-height: 100vh;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }

        /* —— Shell —— */
        .app-header {
            display: flex;
            align-items: center;
            gap: 0;
            height: var(--header-h);
            min-height: var(--header-h);
            max-height: var(--header-h);
            background: var(--surface-raised);
            border-bottom: 1px solid var(--border-strong);
            flex-wrap: nowrap;
            overflow: hidden;
        }
        .app-brand {
            display: flex;
            align-items: center;
            padding: 0 10px;
            font-size: 11px;
            font-weight: 600;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            color: var(--muted);
            border-right: 1px solid var(--border);
            white-space: nowrap;
            align-self: stretch;
        }
        .app-brand strong { color: var(--text); font-weight: 600; }
        .app-toolbar {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 0 8px;
            flex: 1;
            min-width: 0;
            border-right: 1px solid var(--border);
            align-self: stretch;
        }
        .app-toolbar-end {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 0 8px;
            margin-left: auto;
            align-self: stretch;
        }
        .app-header button {
            padding: 2px 8px;
            font-size: 12px;
            line-height: 1.2;
            height: 26px;
        }
        .app-header .theme-switch--compact {
            font-size: 10px;
            display: flex;
            align-items: center;
        }
        .search-field {
            display: flex;
            align-items: stretch;
            flex: 1;
            min-width: 140px;
            max-width: 360px;
            height: 26px;
            border: 1px solid var(--input-border);
            background: var(--input-bg);
        }
        .search-field input {
            flex: 1;
            border: none;
            background: transparent;
            padding: 0 8px;
            min-width: 0;
            font-size: 12px;
            line-height: 26px;
            height: 100%;
        }
        .search-field input:focus { outline: none; }
        .search-field button {
            border: none;
            border-left: 1px solid var(--input-border);
            border-radius: 0;
            padding: 0 10px;
            font-size: 11px;
            height: 100%;
        }

        main { padding: 0; max-width: none; margin: 0; }

        /* —— Drive-ähnliche Shell —— */
        .app-body {
            display: flex;
            align-items: stretch;
            min-height: calc(100vh - var(--header-h));
        }
        .app-sidebar {
            width: 220px;
            flex-shrink: 0;
            display: flex;
            flex-direction: column;
            background: var(--surface);
            border-right: 1px solid var(--border);
            padding: 12px 8px;
        }
        .app-sidebar-nav {
            display: flex;
            flex-direction: column;
            gap: 2px;
            flex: 1;
            min-height: 0;
        }
        .app-sidebar-footer {
            margin-top: auto;
            padding-top: 12px;
            border-top: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            gap: 2px;
        }
        .app-nav-item {
            display: flex;
            align-items: center;
            width: 100%;
            text-align: left;
            padding: 10px 14px;
            border: none;
            border-radius: 0;
            background: transparent;
            color: var(--text);
            font-size: 13px;
            font-weight: 500;
            cursor: pointer;
        }
        .app-nav-item:hover {
            background: var(--row-hover);
            filter: none;
        }
        .app-nav-item.active {
            background: var(--accent-dim);
            color: var(--text);
            box-shadow: inset 3px 0 0 var(--accent);
        }
        .app-nav-label { min-width: 0; }
        .app-content {
            flex: 1;
            min-width: 0;
            display: flex;
            flex-direction: column;
        }
        #alerts {
            flex: 0 0 auto;
            padding: 0 14px;
        }
        .app-content > .tab-panel:not(.hidden):not(#alerts) {
            flex: 1 1 auto;
            min-height: 0;
            overflow: auto;
        }
        .search-field--wide {
            max-width: 420px;
            flex: 1 1 200px;
            height: 26px;
        }
        .app-new-group {
            display: flex;
            align-items: center;
            gap: 4px;
            flex-shrink: 0;
        }
        .app-user-label {
            font-size: 11px;
            white-space: nowrap;
            max-width: 160px;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .settings-layout {
            display: flex;
            flex-direction: column;
            gap: 0;
            min-height: 0;
        }
        .settings-subnav {
            display: flex;
            flex-wrap: wrap;
            gap: 0;
            margin: 0 0 12px;
            padding: 0;
            border-bottom: 1px solid var(--border);
            background: var(--surface);
        }
        .settings-subnav-item {
            padding: 10px 14px;
            border: none;
            border-bottom: 2px solid transparent;
            margin-bottom: -1px;
            background: transparent;
            color: var(--muted);
            font-size: 12px;
            font-weight: 500;
            cursor: pointer;
            border-radius: 0;
        }
        .settings-subnav-item:hover {
            color: var(--text);
            background: var(--row-hover);
            filter: none;
        }
        .settings-subnav-item.active {
            color: var(--text);
            border-bottom-color: var(--accent);
            background: transparent;
        }
        .settings-panes { min-width: 0; }
        .settings-pane:not(.hidden) { display: block; }

        input, button, select, textarea {
            font: inherit;
            background: var(--input-bg);
            color: var(--text);
            border: 1px solid var(--input-border);
            border-radius: var(--radius);
            padding: 5px 10px;
        }
        button {
            cursor: pointer;
            background: var(--accent);
            border-color: var(--accent);
            color: #fff;
        }
        button:hover { filter: brightness(1.06); }
        button.secondary {
            background: var(--surface-raised);
            color: var(--text);
            border-color: var(--input-border);
        }
        button.secondary:hover { background: var(--row-hover); filter: none; }
        button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
        button:focus-visible, input:focus-visible, select:focus-visible {
            outline: 2px solid var(--accent);
            outline-offset: -2px;
        }
        .hidden { display: none !important; }

        /* —— Tabs (legacy / nested access tabs) —— */
        .tabs {
            display: flex;
            gap: 0;
            margin: 0;
            padding: 0 12px;
            background: var(--surface);
            border-bottom: 1px solid var(--border);
            flex-wrap: wrap;
        }
        .tab {
            padding: 10px 14px;
            cursor: pointer;
            background: transparent;
            border: none;
            border-bottom: 2px solid transparent;
            color: var(--muted);
            font-size: 12px;
            font-weight: 500;
            margin-bottom: -1px;
        }
        .tab:hover { color: var(--text); background: var(--row-hover); }
        .tab.active {
            color: var(--text);
            border-bottom-color: var(--accent);
            background: transparent;
        }

        .tab-panel { padding: 12px 14px 20px; }
        .tab-panel:not(.hidden) { display: block; }

        /* —— Explorer —— */
        .explorer-bar {
            display: flex;
            align-items: stretch;
            flex-wrap: wrap;
            min-height: 36px;
            min-width: 0;
            background: var(--surface-raised);
            border: 1px solid var(--border);
            border-bottom: none;
            margin-bottom: 0;
        }
        .path-up-btn {
            border: none;
            border-right: 1px solid var(--border);
            background: transparent;
            color: var(--muted);
            padding: 0 12px;
            font-size: 14px;
            line-height: 1;
            flex-shrink: 0;
            cursor: pointer;
        }
        .path-up-btn:hover:not(:disabled) { background: var(--row-hover); color: var(--text); }
        .path-up-btn:disabled { opacity: 0.35; cursor: default; }
        .path-bar {
            display: flex;
            align-items: center;
            flex: 1 1 8rem;
            min-width: 0;
            max-width: 100%;
            padding: 0 4px;
            overflow-x: auto;
            overflow-y: hidden;
            white-space: nowrap;
            font-size: 12px;
        }
        .path-bar a {
            color: var(--text);
            cursor: pointer;
            text-decoration: none;
            padding: 6px 8px;
            border: 1px solid transparent;
            display: inline-block;
            max-width: min(14rem, 28vw);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            vertical-align: middle;
        }
        .path-bar a:hover { background: var(--row-hover); border-color: var(--border); }
        .path-bar .path-sep { color: var(--muted); padding: 0 2px; user-select: none; }
        .view-toggle {
            display: flex;
            border-left: 1px solid var(--border);
            flex-shrink: 0;
        }
        .view-toggle button {
            border: none;
            border-radius: 0;
            background: transparent;
            color: var(--muted);
            padding: 0 14px;
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 0.03em;
            height: 100%;
        }
        .view-toggle button + button { border-left: 1px solid var(--border); }
        .view-toggle button.active {
            background: var(--row-selected);
            color: var(--text);
            box-shadow: inset 0 -2px 0 var(--accent);
        }
        .view-toggle button:hover:not(.active) { background: var(--row-hover); color: var(--text); }

        .folder-stats {
            padding: 0 12px;
            font-size: 11px;
            color: var(--muted);
            border-left: 1px solid var(--border);
            display: flex;
            align-items: center;
            white-space: nowrap;
            font-variant-numeric: tabular-nums;
            flex-shrink: 0;
        }

        .explorer-content {
            position: relative;
            border: 1px solid var(--border);
            background: var(--surface-raised);
            min-height: 320px;
            min-width: 0;
            overflow-x: auto;
        }
        .explorer-content.is-loading > #view-list,
        .explorer-content.is-loading > #view-grid {
            opacity: 0.45;
            transition: opacity 0.15s ease;
        }
        .folder-loading {
            position: absolute;
            inset: 0;
            z-index: 6;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 12px;
            background: color-mix(in srgb, var(--surface-raised) 68%, transparent);
            pointer-events: none;
        }
        .folder-loading.hidden {
            display: none;
        }
        .folder-loading-spinner {
            width: 36px;
            height: 36px;
            border: 3px solid var(--border);
            border-top-color: var(--accent);
            border-radius: 50%;
            animation: folder-loading-spin 0.75s linear infinite;
        }
        .folder-loading-text {
            font-size: 13px;
            color: var(--muted);
            letter-spacing: 0.01em;
        }
        @keyframes folder-loading-spin {
            to { transform: rotate(360deg); }
        }
        @media (prefers-reduced-motion: reduce) {
            .folder-loading-spinner {
                animation: none;
                opacity: 0.85;
            }
            .explorer-content.is-loading > #view-list,
            .explorer-content.is-loading > #view-grid {
                transition: none;
            }
        }

        #view-list {
            min-width: 0;
        }

        .file-table {
            width: 100%;
            border-collapse: collapse;
            background: var(--surface-raised);
            table-layout: fixed;
        }
        .file-table thead {
            position: sticky;
            top: 0;
            z-index: 1;
            background: var(--surface);
        }
        .file-table th {
            padding: 6px 12px;
            text-align: left;
            font-size: 11px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: var(--muted);
            border-bottom: 1px solid var(--border-strong);
            white-space: nowrap;
        }
        .file-table th.sortable {
            cursor: pointer;
            user-select: none;
        }
        .file-table th.sortable:hover { color: var(--text); }
        .file-table th.sortable.active { color: var(--text); }
        .file-table th .sort-indicator {
            display: inline-block;
            width: 0.85em;
            margin-left: 4px;
            opacity: 0.35;
        }
        .file-table th.sortable.active .sort-indicator { opacity: 1; color: var(--accent); }
        .sort-control {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 0 10px;
            font-size: 11px;
            color: var(--muted);
            white-space: nowrap;
            border-left: 1px solid var(--border);
            flex-shrink: 0;
        }
        .sort-control select {
            padding: 4px 8px;
            font-size: 11px;
            min-width: 0;
        }
        .tile-size-control {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 0 10px;
            font-size: 11px;
            color: var(--muted);
            white-space: nowrap;
            border-left: 1px solid var(--border);
            flex-shrink: 0;
        }
        .tile-size-control select {
            padding: 4px 8px;
            font-size: 11px;
            min-width: 0;
        }
        .tile-size-control.hidden { display: none !important; }
        .file-table td {
            padding: 4px 12px;
            height: auto;
            min-height: 40px;
            border-bottom: 1px solid var(--border);
            vertical-align: middle;
        }
        .file-table tbody tr:hover { background: var(--row-hover); }
        .file-table tbody tr:last-child td { border-bottom: none; }
        .file-table .col-name { width: auto; max-width: 0; overflow: hidden; }
        .file-table td.col-name { overflow: hidden; max-width: 0; }
        .file-table .col-type { width: 5.5rem; color: var(--muted); font-size: 12px; }
        .file-table .col-size { width: 5.5rem; font-variant-numeric: tabular-nums; color: var(--muted); }
        .file-table .col-date { width: 9.5rem; color: var(--muted); font-size: 12px; }
        .file-table .col-actions { width: 2.75rem; min-width: 2.75rem; white-space: nowrap; text-align: right; }
        .file-table .col-actions button:not(.item-more-btn) {
            padding: 2px 8px;
            font-size: 11px;
            margin-left: 4px;
        }

        .item-more-btn {
            width: 28px;
            height: 28px;
            padding: 0;
            margin: 0;
            border: none;
            border-radius: 0;
            background: transparent;
            color: var(--muted);
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }
        .item-more-btn:hover,
        .item-more-btn:focus-visible {
            background: var(--row-hover);
            color: var(--text);
            outline: none;
        }
        .item-more-icon {
            display: block;
            width: 3px;
            height: 3px;
            border-radius: 50%;
            background: currentColor;
            box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
        }

        .tile {
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: var(--tile-pad) 8px 10px;
            cursor: pointer;
            border: 1px solid transparent;
            border-radius: var(--radius);
            text-align: center;
            min-height: var(--tile-cell);
            min-width: 0;
            max-width: 100%;
            position: relative;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .list-name {
            display: flex;
            align-items: center;
            gap: 10px;
            cursor: pointer;
            min-width: 0;
            overflow: hidden;
        }
        .list-name-text,
        .list-name .file-name-label,
        .list-name span:last-child:not(.duplicate-badge):not(.explorer-select-wrap) {
            overflow: hidden;
            white-space: nowrap;
            min-width: 0;
            flex: 1;
        }
        .tile-name .file-name-label {
            flex: none;
        }
        .file-name-label.is-truncated {
            position: relative;
            display: block;
            overflow: hidden;
            cursor: inherit;
        }
        .file-name-label.is-truncated .file-name-static {
            display: block;
            overflow: hidden;
        }
        .file-name-label.is-truncated .file-name-marquee {
            display: none;
            position: absolute;
            left: 0;
            top: 0;
            right: 0;
            bottom: 0;
            overflow: hidden;
            pointer-events: none;
        }
        .file-name-marquee-inner {
            display: inline-block;
            white-space: nowrap;
            will-change: transform;
        }
        @media (hover: hover) {
            .file-name-label.is-truncated:hover .file-name-static {
                visibility: hidden;
            }
            .file-name-label.is-truncated:hover .file-name-marquee {
                display: block;
            }
            .file-name-label.is-truncated:hover .file-name-marquee-inner[data-marquee-ready="1"] {
                animation: file-name-marquee-scroll var(--marquee-duration, 6s) ease-in-out infinite alternate;
            }
        }
        @keyframes file-name-marquee-scroll {
            0%, 10% { transform: translateX(0); }
            90%, 100% { transform: translateX(var(--marquee-shift, 0)); }
        }
        .list-name .duplicate-badge {
            flex-shrink: 0;
        }
        .list-thumb {
            width: 32px;
            height: 32px;
            overflow: hidden;
            background: var(--thumb-bg);
            border: 1px solid var(--border);
            color: var(--icon-file);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            box-sizing: border-box;
        }
        .list-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

        .file-icon-wrap {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 100%;
            height: 100%;
            max-width: 100%;
            max-height: 100%;
            line-height: 0;
        }

        .tile-grid {
            --tile-cell: 108px;
            --tile-icon: 48px;
            --tile-pad: 12px;
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(var(--tile-cell), 1fr));
            gap: 8px;
            padding: 8px;
        }
        .tile:hover {
            background: var(--surface-raised);
            border-color: var(--border-strong);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        }
        .tile:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
        .tile-actions {
            position: absolute;
            top: 4px;
            right: 4px;
            z-index: 2;
            opacity: 0;
            pointer-events: none;
        }
        .tile:hover .tile-actions,
        .tile:focus-within .tile-actions,
        .tile.is-selected .tile-actions,
        .tile-actions:focus-within {
            opacity: 1;
            pointer-events: auto;
        }
        .tile-actions .item-more-btn {
            background: color-mix(in srgb, var(--surface-raised) 88%, transparent);
            border: 1px solid var(--border);
        }
        .tile-icon {
            width: var(--tile-icon);
            height: var(--tile-icon);
            max-width: 100%;
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 8px;
            border: 1px solid var(--border);
            background: var(--thumb-bg);
            overflow: hidden;
            box-sizing: border-box;
        }
        .tile-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
        .tile-icon.video-thumb-hover,
        .list-thumb.video-thumb-hover {
            position: relative;
        }
        .video-thumb-scrub {
            position: absolute;
            inset: 0;
            width: 100%;
            height: 100%;
            display: block;
            pointer-events: none;
        }
        .video-thumb-scrub[hidden] { display: none !important; }
        .video-thumb-scrub-bar {
            position: absolute;
            left: 0;
            right: auto;
            bottom: 0;
            height: 3px;
            max-width: 100%;
            background: var(--accent, #3b82f6);
            pointer-events: none;
            z-index: 1;
        }
        .video-thumb-scrub-bar[hidden] { display: none !important; }
        .video-thumb-hover.is-scrubbing {
            border-color: color-mix(in srgb, var(--accent, #3b82f6) 55%, var(--border));
        }
        .explorer-content[data-tile-size="hq"] .tile-icon img,
        .explorer-content[data-tile-size="hq"] .list-thumb img {
            object-fit: contain;
        }
        .explorer-content[data-tile-size="hq"] .list-thumb {
            width: 64px;
            height: 64px;
        }
        .list-thumb .file-icon { width: 18px; height: 18px; }
        .tile-icon .file-icon-wrap--lg .file-icon,
        .tile-icon .file-icon.file-icon--lg { width: min(28px, 70%); height: min(28px, 70%); }
        .tile-name {
            font-size: 12px;
            line-height: 1.3;
            max-width: 100%;
            min-width: 0;
            overflow: hidden;
            width: 100%;
        }
        .tile-name .file-name-label {
            text-align: center;
        }
        .tile-meta {
            margin-top: 4px;
            color: var(--muted);
            font-size: 11px;
            font-variant-numeric: tabular-nums;
        }

        @media (max-width: 960px) {
            .file-table .col-date,
            .file-table th.col-date { display: none; }
            .folder-stats { display: none; }
        }

        @media (max-width: 720px) {
            .file-table .col-size,
            .file-table th.col-size { display: none; }
        }

        .file-icon {
            display: block;
            width: 16px;
            height: 16px;
            max-width: 100%;
            max-height: 100%;
            flex-shrink: 0;
        }
        .file-icon-wrap--lg .file-icon { width: 28px; height: 28px; max-width: 100%; max-height: 100%; }
        .file-icon-wrap--folder { color: var(--icon-folder); }
        .file-icon-wrap--file { color: var(--icon-file); }
        .file-icon-wrap--image { color: var(--icon-image); }
        .file-icon-wrap--video { color: var(--icon-video); }
        .file-icon-wrap--audio { color: var(--icon-audio); }
        .file-icon-wrap--text { color: var(--icon-text); }
        .file-icon-wrap--pdf { color: var(--icon-pdf); }
        .file-icon-wrap--office { color: var(--icon-office); }

        .list-thumb.text-thumb, .tile-icon.text-thumb {
            font-family: Consolas, "Courier New", monospace;
            font-size: 8px;
            line-height: 1.2;
            padding: 3px;
            text-align: left;
            align-items: flex-start;
            justify-content: flex-start;
            overflow: hidden;
            color: var(--muted);
        }

        .upload-panel {
            margin: 0 0 10px;
            padding: 10px 12px;
            border: 1px solid var(--border);
            background: var(--surface);
        }
        .upload-panel.is-active { border-color: var(--accent); }
        .upload-panel.is-done { border-color: var(--upload-pct-done); }
        .upload-panel.is-failed { border-color: var(--danger); }
        .upload-panel.is-failed .upload-panel-pct { color: var(--danger); }
        .upload-panel.is-hiding { opacity: 0; }
        .upload-panel-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.75rem;
            margin-bottom: 6px;
        }
        .upload-panel-title { font-weight: 600; font-size: 12px; }
        .upload-panel-pct {
            font-variant-numeric: tabular-nums;
            font-weight: 600;
            color: var(--upload-pct);
            min-width: 3rem;
            text-align: right;
        }
        .upload-panel.is-done .upload-panel-pct { color: var(--upload-pct-done); }
        .upload-track {
            height: 4px;
            overflow: hidden;
            background: var(--upload-track-bg);
            border: 1px solid var(--upload-track-border);
        }
        .upload-fill {
            height: 100%;
            width: 0;
            background: var(--accent);
            transition: width .2s linear;
        }
        .upload-panel.is-done .upload-fill { background: var(--upload-pct-done); }
        .upload-panel.is-active .upload-fill {
            position: relative;
            overflow: hidden;
            background: linear-gradient(
                90deg,
                var(--accent) 0%,
                color-mix(in srgb, var(--accent) 72%, #fff) 50%,
                var(--accent) 100%
            );
            background-size: 200% 100%;
            animation: upload-fill-shimmer 1.8s ease-in-out infinite;
        }
        .upload-panel.is-active .upload-fill::after {
            display: block;
            content: '';
            position: absolute;
            inset: 0;
            background: linear-gradient(
                90deg,
                transparent 0%,
                rgba(255, 255, 255, 0.28) 50%,
                transparent 100%
            );
            animation: upload-fill-glow 1.4s ease-in-out infinite;
        }
        .upload-panel.is-active .upload-panel-pct {
            animation: upload-pct-pulse 2.4s ease-in-out infinite;
        }
        @keyframes upload-fill-shimmer {
            0%, 100% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
        }
        @keyframes upload-fill-glow {
            0% { transform: translateX(-120%); }
            100% { transform: translateX(220%); }
        }
        @keyframes upload-pct-pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.72; }
        }
        .upload-meta {
            display: flex;
            flex-wrap: wrap;
            gap: 0.45rem 0.85rem;
            margin-top: 6px;
            color: var(--muted);
            font-size: 11px;
        }
        .upload-eta {
            color: var(--upload-pct);
            font-variant-numeric: tabular-nums;
            font-weight: 500;
            transition: opacity 0.25s ease;
        }
        .upload-eta.is-empty { display: none; }
        .upload-panel.is-done .upload-eta { color: var(--upload-pct-done); }
        .upload-current {
            margin-top: 4px;
            color: var(--upload-current);
            font-size: 11px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .upload-current.is-empty { display: none; }

        .upload-resume-banner {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 8px;
            padding: 10px 12px;
            margin: 0 0 8px;
            background: var(--surface-raised);
            border: 1px solid var(--accent-dim);
            font-size: 12px;
        }
        .upload-resume-banner button { min-height: 36px; }

        #upload-conflict-modal .modal-box { max-width: 480px; }
        #upload-conflict-modal .conflict-actions {
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin-top: 12px;
        }
        #upload-conflict-modal .conflict-actions button { min-height: 44px; }
        #upload-conflict-modal .conflict-meta {
            font-size: 12px;
            color: var(--muted);
            margin: 8px 0 0;
        }

        .dropzone {
            margin: 0 0 10px;
            padding: 14px;
            border: 1px dashed var(--border-strong);
            border-radius: var(--radius);
            background: var(--dropzone-bg);
            color: var(--muted);
            text-align: center;
            font-size: 12px;
            transition: all 0.2s ease;
        }
        .dropzone strong { color: var(--text); font-weight: 600; }
        .dropzone.drag-active {
            border-color: var(--accent);
            background: rgba(9, 11, 16, 0.85);
            color: var(--dropzone-drag-text);
            position: fixed;
            inset: 0;
            z-index: 1000;
            margin: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            backdrop-filter: blur(12px);
            border: 3px dashed var(--accent);
            font-size: 18px;
            font-weight: 600;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
        }
        [data-theme="light"] .dropzone.drag-active {
            background: rgba(255, 255, 255, 0.85);
            text-shadow: none;
        }

        .alert-banner {
            background: var(--alert-bg);
            border: 1px solid var(--alert-border);
            padding: 8px 12px;
            margin-bottom: 10px;
            font-size: 12px;
        }

        #login-screen {
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 1.2rem;
            background: var(--bg);
            position: relative;
        }
        #login-screen { position: relative; }
        #login {
            width: 100%;
            max-width: 380px;
            margin: 0;
            background: var(--surface-raised);
            padding: 24px;
            border: 1px solid var(--border-strong);
        }
        #login h2 { margin: 0 0 4px; font-size: 18px; font-weight: 600; }
        #login p { margin: 0 0 16px; color: var(--muted); font-size: 12px; }
        #login label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
        #login input { width: 100%; margin-bottom: 12px; }
        #login button[type="submit"] { width: 100%; }
        .login-error { min-height: 1.2rem; margin: 4px 0 12px; color: var(--login-error); font-size: 12px; }
        .login-hint { margin: -8px 0 12px; color: var(--muted); font-size: 11px; }
        .login-hint code { font-size: 11px; font-family: Consolas, monospace; }

        .modal {
            position: fixed;
            inset: 0;
            background: var(--modal-overlay);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 100;
            padding: 16px;
        }
        .modal-box {
            background: var(--surface-raised);
            padding: 24px 28px;
            max-width: 720px;
            width: 100%;
            max-height: 85vh;
            overflow: auto;
            border: 1px solid var(--border-strong);
            border-radius: var(--radius-lg, 12px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
        }
        .bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 160px; margin-top: 1rem; }
        .bar { flex: 1; background: var(--accent); min-width: 8px; position: relative; }
        .bar span { position: absolute; bottom: -1.4rem; left: 50%; transform: translateX(-50%) rotate(-45deg); font-size: 0.65rem; color: var(--muted); white-space: nowrap; }

        .context-menu {
            position: fixed;
            z-index: 200;
            min-width: 200px;
            background: var(--surface-raised);
            border: 1px solid var(--border-strong);
            border-radius: var(--radius);
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
            padding: 6px 0;
        }
        .context-menu button {
            display: block;
            width: 100%;
            text-align: left;
            background: transparent;
            border: none;
            border-radius: 0;
            color: var(--text);
            padding: 8px 16px;
            font-size: 12px;
            cursor: pointer;
            transition: background 0.15s ease;
        }
        .context-menu button:hover { background: var(--row-hover); }
        .context-menu button.danger { color: var(--danger); }
        .context-menu hr { border: none; border-top: 1px solid var(--border); margin: 2px 0; }
        .new-item-menu { min-width: 180px; z-index: 1200; }

        .access-tabs { display: flex; gap: 0; margin: 12px 0; border-bottom: 1px solid var(--border); }
        .access-tabs button { background: transparent; color: var(--muted); border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
        .access-tabs button.active { background: transparent; color: var(--text); border-bottom-color: var(--accent); }
        .file-modal-pane { margin-top: 8px; }
        .file-activity-toolbar {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
            margin-bottom: 10px;
            font-size: 12px;
        }
        .file-activity-toolbar label { color: var(--muted); }
        .file-activity-toolbar select { min-width: 120px; font-size: 12px; }
        .file-activity-empty { padding: 12px 0; color: var(--muted); font-size: 12px; }
        .file-access-intro { margin: 0 0 0.75rem; font-size: 12px; }
        .file-access-table { width: 100%; }
        .file-access-empty { padding: 12px 0; color: var(--muted); font-size: 12px; }
        .file-access-links { margin-top: 1rem; }
        .file-access-links-title { margin: 0 0 0.4rem; font-size: 13px; font-weight: 600; }
        .file-access-links ul { margin: 0; padding-left: 1.1rem; font-size: 12px; color: var(--muted); }

        .activity-toolbar {
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin-bottom: 12px;
            padding: 12px;
            background: var(--surface);
            border: 1px solid var(--border);
            font-size: 12px;
        }
        .activity-toolbar-row {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
        }
        .activity-toolbar label { color: var(--muted); white-space: nowrap; }
        .activity-toolbar select,
        .activity-toolbar input[type="date"],
        .activity-toolbar input[type="search"] {
            font-size: 12px;
            min-height: 28px;
        }
        .activity-toolbar input[type="search"] {
            min-width: 160px;
            flex: 1 1 160px;
            max-width: 280px;
        }
        .activity-toolbar-actions { justify-content: space-between; align-items: center; }
        .activity-toolbar-checks {
            display: flex;
            flex-wrap: wrap;
            gap: 12px 16px;
        }
        .activity-summary { margin: 0 0 10px; font-size: 12px; }
        .activity-table-wrap { overflow-x: auto; }
        .activity-table { width: 100%; }
        .activity-table td:nth-child(4) {
            max-width: 220px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .activity-empty { padding: 16px 0; color: var(--muted); font-size: 13px; }
        .activity-pagination {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 12px;
            margin-top: 12px;
            font-size: 12px;
        }
        .file-modal-pane table { width: 100%; }
        .access-add-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 12px; }
        .access-add-form label.chk { margin: 0; }
        .perm-flags { display: inline-flex; gap: 6px; flex-wrap: wrap; font-size: 12px; }
        .perm-flags label { display: inline-flex; gap: 4px; align-items: center; margin: 0; }
        .shared-badge { font-size: 10px; color: var(--accent); margin-left: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
        .duplicate-badge {
            font-size: 10px;
            color: #c9a227;
            margin-left: 6px;
            letter-spacing: 0.02em;
            white-space: nowrap;
        }
        .file-duplicates-intro { margin: 0 0 0.5rem; font-size: 0.85rem; }
        .file-duplicates-hash { margin: 0 0 0.75rem; font-size: 0.8rem; font-family: var(--mono, monospace); }
        .file-duplicates-empty { padding: 0.75rem 0; color: var(--muted); font-size: 0.9rem; }

        .duplicates-toolbar { margin-bottom: 0.75rem; }
        .duplicates-intro { margin: 0 0 0.5rem; font-size: 0.9rem; }
        .duplicates-toolbar-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
        .duplicates-bulk-row {
            display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
            margin-top: 0.65rem; padding-top: 0.65rem; border-top: 1px solid var(--border, rgba(255,255,255,0.08));
        }
        .duplicates-keep-label { font-size: 0.85rem; display: inline-flex; align-items: center; gap: 0.35rem; }
        .duplicates-keep-label select { font-size: 0.85rem; }
        .duplicate-group-select { margin-right: 0.35rem; flex-shrink: 0; }
        .duplicate-group-title-wrap { flex: 1; min-width: 12rem; }
        .duplicates-ignore-hint { margin: 0.5rem 0 0; font-size: 0.82rem; }
        .duplicates-summary { margin: 0 0 0.75rem; font-size: 0.88rem; }
        .duplicates-list { display: flex; flex-direction: column; gap: 0.75rem; }
        .duplicate-group-card {
            border: 1px solid var(--border, rgba(255,255,255,0.08));
            border-radius: 8px;
            padding: 0.75rem;
            background: var(--surface-2, rgba(255,255,255,0.02));
        }
        .duplicate-group-header {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem 1rem;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 0.5rem;
        }
        .duplicate-group-title { font-family: var(--mono, monospace); font-size: 0.9rem; }
        .duplicate-group-meta { font-size: 0.82rem; margin-top: 0.15rem; }
        .duplicate-group-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
        .duplicate-ignored-badge {
            font-size: 0.72rem;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: var(--muted);
        }
        .duplicate-group-table-wrap { overflow-x: auto; }
        .duplicate-group-table { width: 100%; font-size: 0.88rem; }
        .duplicate-group-table td:first-child { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .duplicate-row-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; white-space: nowrap; }
        .duplicate-copies-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
            gap: 0.75rem;
        }
        .duplicate-copy-card {
            display: flex;
            flex-direction: column;
            gap: 0.45rem;
            min-width: 0;
        }
        .duplicate-copy-thumb {
            display: block;
            width: 100%;
            padding: 0;
            border: 1px solid var(--border, rgba(255,255,255,0.1));
            border-radius: 8px;
            background: var(--surface, rgba(0,0,0,0.15));
            cursor: pointer;
            overflow: hidden;
            aspect-ratio: 1;
        }
        .duplicate-copy-thumb:hover { border-color: var(--accent, #6ea8fe); }
        .duplicate-copy-thumb-inner.tile-icon {
            width: 100%;
            height: 100%;
            max-width: none;
            margin-bottom: 0;
            border: none;
            border-radius: 0;
        }
        .duplicate-copy-thumb-inner img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }
        .duplicate-copy-meta { min-width: 0; font-size: 0.82rem; }
        .duplicate-copy-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .duplicate-copy-path,
        .duplicate-copy-date { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.78rem; }
        .duplicate-copy-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
        .duplicate-copy-actions button { font-size: 0.78rem; padding: 0.2rem 0.45rem; }
        .duplicates-empty { padding: 1rem 0; color: var(--muted); }
        .duplicates-pagination {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            margin-top: 0.75rem;
            flex-wrap: wrap;
        }

        .trash-toolbar { margin-bottom: 0.75rem; }
        .trash-intro { margin: 0 0 0.5rem; font-size: 0.9rem; }
        #tab-trash .upload-panel { margin-bottom: 0.75rem; }
        .trash-toolbar-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
        .trash-migration-hint { margin: 0.5rem 0 0; font-size: 0.82rem; }
        .trash-summary { margin: 0 0 0.75rem; font-size: 0.88rem; }
        .trash-list { display: flex; flex-direction: column; gap: 0.5rem; }
        .trash-row {
            display: flex;
            flex-wrap: wrap;
            gap: 0.75rem;
            align-items: flex-start;
            justify-content: space-between;
            padding: 0.65rem 0.75rem;
            border: 1px solid var(--border);
            border-radius: 8px;
            background: var(--surface, var(--bg));
        }
        .trash-row-main { min-width: 0; flex: 1 1 12rem; }
        .trash-row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .trash-row-path { font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .trash-row-meta { font-size: 0.78rem; margin-top: 0.2rem; }
        .trash-row-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
        .trash-empty { padding: 1rem 0; color: var(--muted); }
        .trash-pagination {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            margin-top: 0.75rem;
            flex-wrap: wrap;
        }

        /* Collaborative editor — Google Docs–style (always light document chrome) */
        .collab-modal {
            padding: 0;
            align-items: stretch;
            justify-content: stretch;
            background: rgba(60, 64, 67, 0.45);
        }
        .collab-shell {
            --collab-bg: #ffffff;
            --collab-canvas: #f9fbfd;
            --collab-toolbar-bg: #edf2fc;
            --collab-text: #202124;
            --collab-muted: #5f6368;
            --collab-border: #dadce0;
            --collab-accent: #1a73e8;
            --collab-accent-hover: #1765cc;
            --collab-tool-hover: #d3e3fd;
            --collab-tool-active: #c2e7ff;
            --collab-page-shadow: 0 1px 3px 1px rgba(60, 64, 67, 0.15);
            width: 100%;
            height: 100%;
            display: flex;
            flex-direction: column;
            background: var(--collab-bg);
            color: var(--collab-text);
            overflow: hidden;
        }
        .collab-titlebar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 16px;
            flex-shrink: 0;
            padding: 4px 8px 4px 4px;
            border-bottom: 1px solid var(--collab-border);
            background: var(--collab-bg);
            min-height: 56px;
        }
        .collab-titlebar-start {
            display: flex;
            align-items: center;
            gap: 8px;
            min-width: 0;
            flex: 1;
        }
        .collab-doc-icon {
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 40px;
            height: 40px;
        }
        .collab-titleblock { min-width: 0; }
        .collab-titleblock h3 {
            margin: 0;
            font-family: "Google Sans", "Segoe UI", Roboto, Arial, sans-serif;
            font-size: 18px;
            font-weight: 400;
            line-height: 1.3;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            color: var(--collab-text);
        }
        .collab-path {
            margin: 0;
            font-size: 12px;
            color: var(--collab-muted);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .collab-titlebar-end {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-shrink: 0;
        }
        .collab-status {
            font-size: 12px;
            color: var(--collab-muted);
            white-space: nowrap;
        }
        .collab-status[data-kind="dirty"] { color: #e37400; }
        .collab-status[data-kind="error"] { color: #d93025; }
        .collab-status[data-kind="saved"] { color: #188038; }
        .collab-btn-primary {
            height: 36px;
            padding: 0 24px;
            border: none;
            border-radius: 18px;
            background: var(--collab-accent);
            color: #fff;
            font-family: "Google Sans", "Segoe UI", Roboto, Arial, sans-serif;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
        }
        .collab-btn-primary:hover { background: var(--collab-accent-hover); }
        .collab-btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
        .collab-btn-icon {
            width: 36px;
            height: 36px;
            padding: 0;
            border: none;
            border-radius: 50%;
            background: transparent;
            color: var(--collab-muted);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .collab-btn-icon:hover {
            background: rgba(60, 64, 67, 0.08);
            color: var(--collab-text);
        }
        .collab-presence {
            display: flex;
            align-items: center;
            gap: 4px;
        }
        .collab-presence-avatar {
            width: 28px;
            height: 28px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 11px;
            font-weight: 500;
            color: #fff;
            border: 2px solid var(--collab-bg);
            margin-left: -6px;
            position: relative;
            cursor: default;
        }
        .collab-presence-avatar:first-child { margin-left: 0; }
        .collab-presence-avatar[data-self="1"] {
            box-shadow: 0 0 0 2px var(--collab-accent);
        }
        .collab-banner {
            margin: 0;
            padding: 8px 16px;
            font-size: 13px;
            color: #7c4a03;
            background: #fef7e0;
            border-bottom: 1px solid #f9e6a7;
            flex-shrink: 0;
        }
        .collab-toolbar {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 2px;
            padding: 4px 12px;
            border-bottom: 1px solid var(--collab-border);
            background: var(--collab-toolbar-bg);
            flex-shrink: 0;
            min-height: 40px;
        }
        .collab-toolbar-group {
            display: flex;
            flex-wrap: wrap;
            gap: 1px;
            align-items: center;
        }
        .collab-toolbar-sep {
            width: 1px;
            height: 20px;
            background: var(--collab-border);
            margin: 0 6px;
        }
        .collab-tool-btn {
            min-width: 28px;
            height: 28px;
            padding: 0 6px;
            font-size: 13px;
            border: none;
            border-radius: 4px;
            background: transparent;
            color: var(--collab-text);
            cursor: pointer;
            line-height: 1;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-family: "Google Sans", "Segoe UI", Roboto, Arial, sans-serif;
        }
        .collab-tool-btn:hover { background: var(--collab-tool-hover); }
        .collab-tool-btn.active {
            background: var(--collab-tool-active);
            color: var(--collab-accent);
        }
        .collab-tool-btn:disabled { opacity: 0.4; cursor: not-allowed; }
        .collab-tool-btn--text strong { font-weight: 700; font-size: 14px; }
        .collab-tool-btn--text em { font-style: italic; font-size: 14px; }
        .collab-tool-btn--text { font-size: 13px; min-width: 28px; }
        .collab-icon { display: block; flex-shrink: 0; }
        .collab-view-tabs .collab-tool-btn {
            padding: 0 12px;
            font-size: 13px;
            border-radius: 4px;
        }
        .collab-canvas {
            flex: 1;
            min-height: 0;
            overflow: auto;
            background: var(--collab-canvas);
            padding: 24px 16px 48px;
        }
        .collab-body {
            max-width: 100%;
            margin: 0 auto;
        }
        .collab-pages {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 24px;
        }
        .collab-body.collab-view-split .collab-pages {
            flex-direction: row;
            align-items: flex-start;
            justify-content: center;
            flex-wrap: wrap;
        }
        .collab-page {
            width: min(100%, 816px);
            min-height: min(1056px, calc(100vh - 180px));
            background: #fff;
            box-shadow: var(--collab-page-shadow);
            border: 1px solid var(--collab-border);
            display: flex;
            flex-direction: column;
        }
        .collab-body.collab-view-split .collab-page {
            width: min(calc(50% - 12px), 816px);
            flex: 1 1 360px;
            max-width: 816px;
        }
        .collab-body.collab-view-preview .collab-page:first-child { display: none; }
        .collab-body.collab-view-preview .collab-preview-page { display: flex; }
        .collab-body.collab-view-edit .collab-preview-page { display: none; }
        .collab-body.collab-view-split .collab-preview-page { display: flex; }
        .collab-preview-page { flex: 1; }
        .collab-textarea {
            flex: 1;
            min-height: min(1056px, calc(100vh - 180px));
            width: 100%;
            resize: none;
            border: none;
            border-radius: 0;
            padding: 72px 96px;
            font-family: Arial, "Segoe UI", Roboto, sans-serif;
            font-size: 11pt;
            line-height: 1.5;
            background: #fff;
            color: var(--collab-text);
            box-sizing: border-box;
        }
        .collab-textarea:focus { outline: none; }
        .collab-textarea:read-only {
            color: var(--collab-muted);
            background: #fafafa;
        }
        .collab-preview {
            flex: 1;
            min-height: min(1056px, calc(100vh - 180px));
            overflow: auto;
            padding: 72px 96px;
            background: #fff;
            font-family: Arial, "Segoe UI", Roboto, sans-serif;
            font-size: 11pt;
            line-height: 1.5;
            color: var(--collab-text);
            box-sizing: border-box;
        }
        .collab-preview h1, .collab-preview h2, .collab-preview h3 {
            margin: 1em 0 0.5em;
            line-height: 1.25;
            font-weight: 400;
        }
        .collab-preview h1 { font-size: 20pt; }
        .collab-preview h2 { font-size: 16pt; }
        .collab-preview h3 { font-size: 14pt; }
        .collab-preview p { margin: 0 0 0.75em; }
        .collab-preview ul, .collab-preview ol { margin: 0.5em 0; padding-left: 1.5em; }
        .collab-preview pre {
            margin: 0.75em 0;
            padding: 12px 16px;
            border-radius: 4px;
            background: #f1f3f4;
            overflow-x: auto;
            font-family: "Roboto Mono", Consolas, monospace;
            font-size: 10pt;
        }
        .collab-preview code {
            font-family: "Roboto Mono", Consolas, monospace;
            font-size: 10pt;
            background: #f1f3f4;
            padding: 1px 4px;
            border-radius: 2px;
        }
        .collab-preview pre code { background: none; padding: 0; }
        .collab-preview img, .collab-preview video {
            max-width: 100%;
            height: auto;
            margin: 0.75em 0;
            display: block;
        }
        .collab-preview video { background: #000; }
        .collab-preview a { color: var(--collab-accent); text-decoration: underline; }
        .collab-preview .collab-media-placeholder {
            display: inline-block;
            padding: 8px 12px;
            margin: 0.5em 0;
            border-radius: 4px;
            background: #f1f3f4;
            font-size: 12px;
            color: var(--collab-muted);
        }
        .collab-media-box {
            width: min(96vw, 720px);
            max-height: min(85vh, 640px);
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        .collab-media-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin-bottom: 8px;
        }
        .collab-media-head h3 { margin: 0; font-size: 15px; }
        .collab-media-hint { margin: 0 0 10px; font-size: 12px; }
        .collab-media-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
            gap: 10px;
            overflow: auto;
            flex: 1;
            min-height: 120px;
            max-height: 420px;
            padding: 2px;
        }
        .collab-media-item {
            display: flex;
            flex-direction: column;
            gap: 6px;
            padding: 8px;
            border: 1px solid var(--border);
            border-radius: 8px;
            background: var(--bg);
            cursor: pointer;
            text-align: left;
            min-width: 0;
        }
        .collab-media-item:hover {
            border-color: color-mix(in srgb, var(--accent, #1a73e8) 50%, var(--border));
            background: var(--row-hover);
        }
        .collab-media-thumb {
            aspect-ratio: 4 / 3;
            border-radius: 4px;
            background: color-mix(in srgb, var(--border) 35%, var(--bg));
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            font-size: 22px;
        }
        .collab-media-thumb img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        .collab-media-name {
            font-size: 11px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        @media (max-width: 900px) {
            .collab-textarea,
            .collab-preview {
                padding: 48px 32px;
            }
            .collab-body.collab-view-split .collab-pages {
                flex-direction: column;
                align-items: center;
            }
            .collab-body.collab-view-split .collab-page {
                width: min(100%, 816px);
            }
            .collab-toolbar-sep { display: none; }
        }
        @media (max-width: 600px) {
            .collab-textarea,
            .collab-preview {
                padding: 32px 20px;
            }
            .collab-titleblock h3 { font-size: 16px; }
            .collab-status { display: none; }
        }

        .viewer-box {
            width: min(96vw, 1200px);
            height: min(90vh, 900px);
            max-height: 90vh;
            padding: 0;
            overflow: hidden;
            display: flex;
            flex-direction: column;
        }
        .viewer-head {
            display: grid;
            grid-template-columns: auto minmax(0, 1fr) auto 7.5rem auto;
            align-items: center;
            gap: 8px;
            flex-shrink: 0;
            padding: 10px 14px;
            border-bottom: 1px solid var(--border);
        }
        .viewer-head-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
        .viewer-head h3 { margin: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .viewer-counter { font-size: 11px; line-height: 1.2; }
        .viewer-nav-btn { min-width: 36px; padding: 5px 10px; }
        .viewer-nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }
        .viewer-body {
            flex: 1;
            min-height: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            background: var(--media-bg);
            padding: 12px;
            overflow: auto;
            touch-action: pan-y pinch-zoom;
            position: relative;
        }
        .viewer-body.viewer-body--swipe { touch-action: none; overflow: hidden; }
        .viewer-body.viewer-body--media-loading::before {
            content: '';
            position: absolute;
            width: 40px;
            height: 40px;
            border: 3px solid rgba(255, 255, 255, 0.15);
            border-top-color: var(--accent);
            border-radius: 50%;
            animation: viewer-media-spin 0.75s linear infinite;
            z-index: 3;
            pointer-events: none;
        }
        @keyframes viewer-media-spin { to { transform: rotate(360deg); } }
        .viewer-body video.viewer-media-loading { opacity: 0.35; }
        .viewer-body.viewer-body--swipe img,
        .viewer-body.viewer-body--swipe video {
            touch-action: none;
            -webkit-user-drag: none;
            user-select: none;
        }
        .viewer-body .viewer-image-wrap img,
        .viewer-body img, .viewer-body video {
            max-width: 100%;
            max-height: 100%;
            width: auto;
            height: auto;
            object-fit: contain;
        }
        .viewer-body .viewer-pdf {
            width: 100%;
            height: 100%;
            min-height: 0;
            max-height: 100%;
            border: none;
            background: var(--media-bg);
        }
        .viewer-body video { background: #000; }
        .viewer-video-shell {
            display: flex;
            flex-direction: column;
            align-items: stretch;
            justify-content: center;
            gap: 0;
            max-width: 100%;
            max-height: 100%;
            min-width: 0;
            min-height: 0;
            position: relative;
            background: #000;
            border-radius: 10px;
            overflow: hidden;
            box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
        }
        .viewer-video-shell:has(> video.hidden) { display: none; }
        .viewer-video-shell > video {
            flex: 1 1 auto;
            min-height: 0;
            width: auto;
            max-width: 100%;
            max-height: 100%;
            display: block;
            cursor: pointer;
        }
        .viewer-video-shell.has-custom-player > video {
            max-height: 100%;
        }

        .video-player {
            position: absolute;
            inset: 0;
            display: flex;
            flex-direction: column;
            justify-content: flex-end;
            pointer-events: none;
            z-index: 4;
        }
        .video-player[hidden] { display: none !important; }
        .video-player-bigplay,
        .video-player-chrome,
        .video-player-btn,
        .video-scrub,
        .video-player-vol {
            pointer-events: auto;
        }

        .video-player-bigplay {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%) scale(1);
            width: 72px;
            height: 72px;
            border: 0;
            border-radius: 50%;
            display: grid;
            place-items: center;
            color: #fff;
            background: color-mix(in srgb, var(--accent) 78%, #000);
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
            cursor: pointer;
            transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
            z-index: 5;
        }
        .video-player-bigplay svg { width: 28px; height: 28px; margin-left: 3px; }
        .video-player-bigplay:hover { transform: translate(-50%, -50%) scale(1.06); }
        .video-player-bigplay.is-hidden {
            opacity: 0;
            pointer-events: none;
            transform: translate(-50%, -50%) scale(0.92);
        }
        .viewer-video-shell.is-playing .video-player-bigplay.is-hidden { display: grid; }

        .video-player-chrome {
            padding: 48px 14px 12px;
            background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.55) 42%, rgba(0, 0, 0, 0.82) 100%);
            transition: opacity 200ms ease, transform 200ms ease;
        }
        .viewer-video-shell.chrome-hidden .video-player-chrome {
            opacity: 0;
            transform: translateY(8px);
            pointer-events: none;
        }
        .viewer-video-shell.chrome-hidden .video-player-bigplay.is-hidden {
            opacity: 0;
        }
        .viewer-video-shell.is-paused .video-player-chrome,
        .viewer-video-shell.chrome-visible .video-player-chrome {
            opacity: 1;
            transform: none;
            pointer-events: auto;
        }

        .video-player-bar {
            display: flex;
            align-items: center;
            gap: 4px;
            margin-top: 8px;
            min-width: 0;
        }
        .video-player-btn {
            flex: 0 0 auto;
            width: 36px;
            height: 36px;
            border: 0;
            border-radius: 8px;
            background: transparent;
            color: rgba(255, 255, 255, 0.92);
            display: grid;
            place-items: center;
            cursor: pointer;
            transition: background 140ms ease, color 140ms ease;
        }
        .video-player-btn:hover,
        .video-player-btn:focus-visible {
            background: rgba(255, 255, 255, 0.12);
            color: #fff;
            outline: none;
        }
        .video-player-btn svg { width: 20px; height: 20px; }
        .video-player-spacer { flex: 1 1 auto; min-width: 8px; }

        .video-player-volume {
            display: flex;
            align-items: center;
            gap: 2px;
            max-width: 140px;
        }
        .video-player-vol {
            width: 0;
            opacity: 0;
            transition: width 160ms ease, opacity 160ms ease;
            accent-color: var(--accent, #3b82f6);
            height: 4px;
            cursor: pointer;
        }
        .video-player-volume:hover .video-player-vol,
        .video-player-volume:focus-within .video-player-vol {
            width: 72px;
            opacity: 1;
        }

        .video-player-speed { position: relative; }
        .video-player-speed-btn {
            width: auto;
            min-width: 40px;
            padding: 0 8px;
            font-size: 12px;
            font-weight: 600;
            font-variant-numeric: tabular-nums;
        }
        .video-player-speed-menu {
            position: absolute;
            right: 0;
            bottom: calc(100% + 8px);
            min-width: 88px;
            padding: 6px;
            border-radius: 10px;
            background: rgba(16, 20, 31, 0.96);
            border: 1px solid rgba(255, 255, 255, 0.12);
            box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
            display: flex;
            flex-direction: column;
            gap: 2px;
            z-index: 8;
        }
        .video-player-speed-menu[hidden] { display: none !important; }
        .video-player-speed-menu button {
            border: 0;
            background: transparent;
            color: rgba(255, 255, 255, 0.88);
            text-align: left;
            padding: 8px 10px;
            border-radius: 6px;
            cursor: pointer;
            font: inherit;
            font-size: 12px;
            font-variant-numeric: tabular-nums;
        }
        .video-player-speed-menu button:hover,
        .video-player-speed-menu button.is-active {
            background: var(--accent-dim, rgba(59, 130, 246, 0.2));
            color: #fff;
        }

        .video-scrub {
            flex: 0 0 auto;
            position: relative;
            width: 100%;
            margin: 0;
            padding: 8px 0 2px;
            touch-action: none;
            cursor: pointer;
            outline: none;
        }
        .video-scrub-times {
            display: flex;
            align-items: baseline;
            gap: 4px;
            margin: 0 4px 0 6px;
            font-size: 12px;
            font-variant-numeric: tabular-nums;
            color: rgba(255, 255, 255, 0.78);
            line-height: 1.2;
            user-select: none;
            white-space: nowrap;
        }
        .video-scrub-sep { opacity: 0.5; }
        .video-scrub:focus-visible .video-scrub-rail {
            box-shadow: 0 0 0 2px var(--accent, #3b82f6);
        }
        .video-scrub-rail {
            position: relative;
            height: 5px;
            border-radius: 999px;
            background: rgba(255, 255, 255, 0.22);
            overflow: visible;
            transition: height 120ms ease;
        }
        .video-scrub:hover .video-scrub-rail,
        .video-scrub:focus-visible .video-scrub-rail {
            height: 7px;
        }
        .video-scrub-buffered,
        .video-scrub-played {
            position: absolute;
            inset: 0 auto 0 0;
            border-radius: inherit;
            pointer-events: none;
        }
        .video-scrub-buffered { background: rgba(255, 255, 255, 0.28); }
        .video-scrub-played {
            background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent, #3b82f6));
        }
        .video-scrub-knob {
            position: absolute;
            top: 50%;
            width: 14px;
            height: 14px;
            margin-top: -7px;
            margin-left: -7px;
            border-radius: 50%;
            background: #fff;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
            pointer-events: none;
            z-index: 3;
            opacity: 0;
            transform: scale(0.7);
            transition: opacity 120ms ease, transform 120ms ease;
        }
        .video-scrub:hover .video-scrub-knob,
        .video-scrub:focus-visible .video-scrub-knob,
        .viewer-video-shell.is-paused .video-scrub-knob {
            opacity: 1;
            transform: scale(1);
        }
        .video-scrub-hover {
            position: absolute;
            top: 50%;
            width: 2px;
            height: 12px;
            margin-top: -6px;
            margin-left: -1px;
            background: #fff;
            border-radius: 1px;
            pointer-events: none;
            z-index: 2;
        }
        .video-scrub-tip {
            position: absolute;
            bottom: calc(100% + 12px);
            transform: translateX(-50%);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
            pointer-events: none;
            z-index: 5;
            filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.45));
        }
        .video-scrub-tip[hidden] { display: none !important; }
        .video-scrub-tip canvas {
            width: 160px;
            height: 90px;
            border-radius: 6px;
            background: #111;
            border: 1px solid rgba(255, 255, 255, 0.2);
        }
        .video-scrub-time {
            font-size: 11px;
            font-variant-numeric: tabular-nums;
            color: #fff;
            background: rgba(0, 0, 0, 0.72);
            padding: 2px 6px;
            border-radius: 4px;
            line-height: 1.2;
        }
        .video-scrub-seeker {
            position: fixed;
            left: -9999px;
            top: 0;
            width: 160px;
            height: 90px;
            opacity: 0;
            pointer-events: none;
        }
        .viewer-body pre.viewer-text {
            width: 100%;
            height: 100%;
            max-height: 100%;
            overflow: auto;
            margin: 0;
            padding: 12px;
            background: var(--input-bg);
            border: 1px solid var(--border);
            font-family: Consolas, "Courier New", monospace;
            font-size: 12px;
            line-height: 1.5;
            white-space: pre-wrap;
            word-break: break-word;
        }

        .share-add-form { display: grid; gap: 10px; margin-bottom: 0; }
        .sharing-hint { font-size: 12px; margin: 0 0 12px; line-height: 1.45; color: var(--muted); }
        .sharing-summary { margin: 0 0 8px; min-height: 1.2em; font-size: 12px; }

        .share-modal-box { max-width: 720px; max-height: min(92vh, 900px); overflow: auto; }
        .share-modal-head {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 12px;
            margin-bottom: 4px;
        }
        .share-modal-head-text { min-width: 0; flex: 1; }
        .share-modal-head h3 { margin: 6px 0 4px; font-size: 1.15rem; word-break: break-word; }
        .share-modal-path { font-size: 12px; margin: 0; word-break: break-all; font-family: Consolas, monospace; }
        .share-modal-close-btn {
            flex-shrink: 0;
            width: 36px;
            height: 36px;
            padding: 0;
            font-size: 1.35rem;
            line-height: 1;
        }
        .share-type-badge {
            display: inline-block;
            font-size: 10px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            padding: 2px 8px;
            border-radius: 999px;
            background: color-mix(in srgb, var(--accent) 16%, transparent);
            color: var(--accent);
        }
        .share-type-badge--folder {
            background: color-mix(in srgb, #22c55e 16%, transparent);
            color: #22c55e;
        }
        [data-theme="light"] .share-type-badge--folder { color: #15803d; }

        .share-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
        .share-section-title { margin: 0 0 10px; font-size: 13px; font-weight: 600; }
        .share-form-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 10px;
        }
        .share-form-grid label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
        .share-form-grid input { width: 100%; font-size: 12px; }
        .share-expiry-presets {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 6px;
            font-size: 11px;
        }
        .share-expiry-presets .share-preset { font-size: 11px; padding: 4px 10px; min-height: 28px; }
        .share-create-btn { justify-self: start; margin-top: 2px; }

        .share-new-banner {
            margin-top: 10px;
            padding: 10px 12px;
            border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
            border-radius: 8px;
            background: color-mix(in srgb, var(--accent) 8%, var(--surface));
            font-size: 12px;
        }
        .share-new-banner strong { display: block; margin-bottom: 8px; }
        .share-copy-row { display: flex; gap: 8px; }
        .share-copy-row input {
            flex: 1;
            min-width: 0;
            font-family: Consolas, monospace;
            font-size: 11px;
        }

        .share-links-list { display: flex; flex-direction: column; gap: 8px; }
        .share-link-card {
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 10px 12px;
            background: var(--surface);
            font-size: 12px;
        }
        .share-link-card-head {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 8px;
            margin-bottom: 6px;
        }
        .share-link-card-title { font-weight: 600; word-break: break-word; }
        .share-link-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
        .share-tag {
            font-size: 10px;
            padding: 2px 7px;
            border-radius: 999px;
            background: color-mix(in srgb, var(--muted) 12%, transparent);
            color: var(--muted);
        }
        .share-link-url {
            font-family: Consolas, monospace;
            font-size: 11px;
            word-break: break-all;
            color: var(--muted);
            margin-bottom: 8px;
        }
        .share-link-actions { display: flex; flex-wrap: wrap; gap: 6px; }
        .share-link-actions button { font-size: 11px; padding: 4px 10px; min-height: 28px; }

        .share-badge {
            flex-shrink: 0;
            font-size: 10px;
            font-weight: 600;
            padding: 2px 8px;
            border-radius: 999px;
            white-space: nowrap;
        }
        .share-badge--active { background: color-mix(in srgb, #22c55e 18%, transparent); color: #22c55e; }
        .share-badge--inactive { background: color-mix(in srgb, var(--muted) 15%, transparent); color: var(--muted); }
        .share-badge--warn { background: color-mix(in srgb, #f59e0b 18%, transparent); color: #f59e0b; }
        .share-badge--danger { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
        [data-theme="light"] .share-badge--active { color: #15803d; }

        .share-empty {
            padding: 20px 12px;
            text-align: center;
            color: var(--muted);
            font-size: 13px;
            border: 1px dashed var(--border);
            border-radius: 8px;
            background: color-mix(in srgb, var(--muted) 4%, transparent);
        }
        .share-empty strong { display: block; color: var(--text); margin-bottom: 6px; font-size: 14px; }
        .share-empty p { margin: 0; font-size: 12px; line-height: 1.45; }

        .sharing-toolbar {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-bottom: 12px;
            padding: 10px 12px;
            background: var(--surface);
            border: 1px solid var(--border);
            font-size: 12px;
        }
        .sharing-toolbar input[type="search"] {
            flex: 1;
            min-width: 160px;
            font-size: 12px;
            min-height: 32px;
        }
        .sharing-toolbar select { font-size: 12px; min-height: 32px; }

        .sharing-stats {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 8px;
            margin-bottom: 12px;
        }
        .sharing-stat {
            padding: 10px 12px;
            border: 1px solid var(--border);
            border-radius: 8px;
            background: var(--surface);
            font-size: 11px;
            color: var(--muted);
        }
        .sharing-stat strong {
            display: block;
            font-size: 1.35rem;
            color: var(--text);
            font-weight: 600;
            line-height: 1.2;
            margin-bottom: 2px;
        }

        .share-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
        .share-table { width: 100%; border-collapse: collapse; font-size: 12px; }
        .share-table th,
        .share-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; text-align: left; }
        .share-table thead th {
            font-size: 10px;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: var(--muted);
            background: color-mix(in srgb, var(--muted) 6%, var(--surface));
        }
        .share-table tbody tr:last-child td { border-bottom: none; }
        .share-table tbody tr:hover { background: var(--row-hover); }
        .share-table .share-cell-title { font-weight: 600; word-break: break-word; }
        .share-table .share-cell-sub { font-size: 11px; color: var(--muted); margin-top: 2px; word-break: break-all; }
        .share-table .share-link-actions { justify-content: flex-end; }

        .sharing-perm-form {
            display: grid;
            gap: 10px;
            margin-bottom: 14px;
            padding: 12px;
            border: 1px solid var(--border);
            border-radius: 8px;
            background: var(--surface);
            max-width: 520px;
            font-size: 12px;
        }
        .sharing-perm-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 10px;
        }
        .sharing-perm-grid label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
        .sharing-perm-grid input { width: 100%; }
        .sharing-perm-checks { display: flex; flex-wrap: wrap; gap: 10px; }

        @media (max-width: 640px) {
            .share-form-grid,
            .sharing-perm-grid,
            .sharing-stats { grid-template-columns: 1fr; }
            .share-copy-row { flex-direction: column; }
        }

        .tab-panel table:not(.file-table) {
            width: 100%;
            border-collapse: collapse;
            border: 1px solid var(--border);
            background: var(--surface-raised);
        }
        .tab-panel table:not(.file-table) th,
        .tab-panel table:not(.file-table) td {
            padding: 6px 12px;
            text-align: left;
            border-bottom: 1px solid var(--border);
        }
        .tab-panel table:not(.file-table) thead th {
            background: var(--surface);
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: var(--muted);
        }

        .owner-only.member-hidden { display: none !important; }
        label.chk { display: flex; gap: 6px; align-items: center; margin: 4px 0; }
        .muted { color: var(--muted); }

        .faces-toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
        .faces-toolbar-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
        .faces-toolbar-row input { min-width: 260px; }
        .faces-toolbar-row select { min-width: 170px; }
        .faces-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
        .faces-stat-chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 4px 10px; font-size: 12px; color: var(--muted); }
        .faces-stat-chip strong { color: var(--text); margin-left: 4px; }
        .faces-clusters { display: grid; gap: 10px; }
        .face-cluster-card {
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 12px;
            background: linear-gradient(180deg, color-mix(in srgb, var(--surface-raised) 88%, transparent), var(--bg-elev));
            container-type: inline-size;
        }
        .face-cluster-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
        .face-cluster-title { font-weight: 700; }
        .face-cluster-meta { color: var(--muted); font-size: 12px; }
        .face-cluster-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
        .face-cluster-actions input { min-width: 200px; }
        .face-cluster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
        .face-cluster-item { border: 1px solid var(--border); border-radius: 8px; padding: 6px; background: var(--input-bg); cursor: pointer; transition: border-color .14s ease, transform .14s ease; }
        .face-cluster-item:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); transform: translateY(-1px); }
        .face-cluster-item .list-thumb { display: block; width: 100%; aspect-ratio: 1 / 1; border-radius: 6px; margin-bottom: 6px; overflow: hidden; }
        .face-cluster-item .name { font-size: 12px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .face-cluster-more { margin-top: 8px; }
        .face-cluster-id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--muted); }

        @container (max-width: 560px) {
            .face-cluster-head { align-items: flex-start; }
            .face-cluster-actions { width: 100%; }
            .face-cluster-actions input { min-width: 0; flex: 1 1 auto; }
        }

        @media (prefers-reduced-motion: reduce) {
            .upload-fill { transition: none; }
            .upload-panel { transition: none; }
            .upload-panel.is-active .upload-fill {
                animation: none;
                background: var(--accent);
            }
            .upload-panel.is-active .upload-fill::after { display: none; }
            .upload-panel.is-active .upload-panel-pct { animation: none; }
        }

        /* Tags, Favoriten, Kommentare, Share-Upload */
        .tag-filter-control {
            display: flex;
            align-items: center;
            gap: 6px;
            flex-wrap: wrap;
        }
        .tag-filter-control input {
            width: 9rem;
            min-width: 0;
        }
        .item-tags {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin: 8px 0;
        }
        .item-tags--compact {
            margin: 4px 0 0;
            gap: 4px;
        }
        .tag-chip {
            display: inline-flex;
            align-items: center;
            border: 1px solid var(--border);
            background: color-mix(in srgb, var(--muted) 10%, var(--surface));
            color: var(--text);
            border-radius: 999px;
            padding: 2px 8px;
            font-size: 11px;
            line-height: 1.4;
            cursor: pointer;
        }
        .tag-chip--more { opacity: 0.7; cursor: default; }
        button.tag-chip { font: inherit; }
        .file-tags-form,
        .file-comments-form {
            display: flex;
            gap: 8px;
            align-items: flex-start;
            margin-top: 8px;
        }
        .file-tags-form input,
        .file-comments-form textarea {
            flex: 1;
            min-width: 0;
        }
        .file-comments { display: flex; flex-direction: column; gap: 10px; max-height: 280px; overflow: auto; }
        .file-comment {
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 8px 10px;
            background: var(--surface);
            position: relative;
        }
        .file-comment-head { font-size: 12px; margin-bottom: 4px; }
        .file-comment-body { white-space: pre-wrap; word-break: break-word; }
        .file-comment-del { position: absolute; top: 6px; right: 6px; font-size: 11px; padding: 2px 8px; }
        .favorites-toolbar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
            margin-bottom: 12px;
            flex-wrap: wrap;
        }
        .favorites-list { display: flex; flex-direction: column; gap: 8px; }
        .favorites-row {
            display: flex;
            gap: 8px;
            align-items: stretch;
            border: 1px solid var(--border);
            border-radius: 8px;
            background: var(--surface);
            overflow: hidden;
        }
        .favorites-row-main {
            flex: 1;
            text-align: left;
            border: 0;
            background: transparent;
            color: inherit;
            padding: 10px 12px;
            cursor: pointer;
            font: inherit;
        }
        .favorites-row-main:hover { background: var(--row-hover); }
        .favorites-row-title { font-weight: 600; word-break: break-word; }
        .favorites-row-meta { font-size: 12px; margin-top: 2px; }
        .favorites-row-actions {
            display: flex;
            align-items: center;
            padding: 0 8px;
            border-left: 1px solid var(--border);
        }
        .share-upload-panel {
            display: flex;
            align-items: center;
            gap: 12px;
            flex-wrap: wrap;
            padding: 10px 12px;
            margin: 8px 0;
            border: 1px dashed var(--border);
            border-radius: 8px;
            background: color-mix(in srgb, var(--muted) 6%, var(--surface));
        }
