/* File Browser: card/gallery/list views, folder mosaics, and file-type presentation. */
.file-collection {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.file-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.file-card:hover {
    border-color: #d7d9e4;
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.file-card.selected {
    border-color: rgba(101, 119, 255, .72);
    box-shadow: 0 18px 42px rgba(101, 119, 255, .18);
}

.item-select-control {
    position: absolute;
    z-index: 8;
    top: 10px;
    left: 10px;
    display: none;
    width: 34px;
    height: 34px;
    place-items: center;
    cursor: pointer;
}

body.selection-mode .item-select-control {
    display: grid;
}

.item-select-control input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
}

.item-select-control span {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    color: transparent;
    border: 1px solid rgba(255, 255, 255, .9);
    border-radius: 10px;
    background: rgba(20, 23, 35, .52);
    box-shadow: 0 10px 25px rgba(16, 19, 34, .2);
    backdrop-filter: blur(10px);
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.item-select-control svg {
    width: 15px;
    height: 15px;
}

.item-select-control input:checked + span {
    color: #fff;
    background: #6577ff;
    transform: scale(1.04);
}

body.selection-mode .file-card[data-selectable="1"] .file-open {
    cursor: pointer;
}

body.selection-mode .file-actions {
    opacity: 0;
    pointer-events: none;
}

.file-card.trashing {
    opacity: .55;
    pointer-events: none;
}

.file-card.trashed {
    opacity: .5;
    pointer-events: none;
    filter: grayscale(.65);
    box-shadow: none;
}

.file-card.trashed::after {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 7px;
    content: attr(data-trash-label);
    color: #fff;
    border-radius: 7px;
    background: rgba(39, 43, 56, .84);
    font-size: 8px;
    font-weight: 800;
}

.file-card.trashed .file-visual {
    color: #9a7180;
    background: #f2edef;
}

.file-open {
    position: relative;
    display: block;
    min-width: 0;
    padding: 7px 7px 13px;
}

.file-visual {
    position: relative;
    display: grid;
    height: 132px;
    place-items: center;
    overflow: hidden;
    color: #8e96ae;
    border-radius: 13px;
    background: #f3f4f8;
}

.file-visual > img[data-file-thumbnail] {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    transition: transform .35s ease, opacity .18s ease;
}

.file-visual > .file-video-thumbnail {
    position: absolute;
    z-index: 1;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity .24s ease, transform .35s ease;
}

.file-visual > .file-video-thumbnail > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

.file-visual > .file-video-thumbnail.is-ready {
    opacity: 1;
}

.file-card:hover .file-visual > .file-video-thumbnail {
    transform: scale(1.035);
}

.file-visual img.thumbnail-recovering,
.file-visual img.thumbnail-unavailable {
    opacity: 0;
}

.file-card:hover .file-visual > img[data-file-thumbnail] {
    transform: scale(1.035);
}

.file-visual svg {
    width: 46px;
    height: 46px;
    stroke-width: 1.35;
}

.file-visual.folder {
    color: #8b96ff;
    background: #f0f1ff;
}

/* Shared hidden notices are deliberately content-free projections, not file links. */
.shared-hidden-notice-card {
    border-color: rgba(239, 63, 95, .28);
    background: color-mix(in srgb, #ef3f5f 3%, var(--surface));
}

.shared-hidden-notice-card:hover {
    border-color: rgba(239, 63, 95, .55);
    box-shadow: 0 18px 42px rgba(166, 34, 61, .14);
}

.shared-hidden-notice-open {
    width: 100%;
    color: inherit;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.shared-hidden-notice-open:focus-visible {
    outline: 3px solid color-mix(in srgb, #ef3f5f 42%, transparent);
    outline-offset: -3px;
}

.file-visual.shared-hidden-notice-visual {
    color: #ef3f5f;
    background:
        radial-gradient(circle at 72% 20%, rgba(255, 255, 255, .82), transparent 27%),
        linear-gradient(145deg, #fff0f3, #ffdce4);
}

.shared-hidden-notice-kind {
    width: 58px !important;
    height: 58px !important;
    stroke-width: 1.55 !important;
}

.shared-hidden-notice-eye {
    position: absolute;
    right: calc(50% - 39px);
    bottom: 30px;
    display: grid;
    width: 31px;
    height: 31px;
    place-items: center;
    color: #fff;
    border: 3px solid #ffe6eb;
    border-radius: 50%;
    background: #d92d50;
    box-shadow: 0 7px 16px rgba(145, 26, 50, .28);
}

.shared-hidden-notice-eye svg {
    width: 15px;
    height: 15px;
    stroke-width: 2.2;
}

.shared-hidden-notice-new {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 7px;
    color: #fff;
    border-radius: 999px;
    background: #d92d50;
    font-size: 8px;
    font-weight: 850;
    letter-spacing: .08em;
    line-height: 1;
    text-transform: uppercase;
}

.shared-hidden-notice-status {
    color: #b6324d !important;
    font-weight: 750;
}

.shared-hidden-notice-status i {
    padding: 0 2px;
    font-style: normal;
}

.file-visual.folder.customized-folder {
    color: var(--folder-accent);
    background: color-mix(in srgb, var(--folder-accent) 13%, #fff);
}

.file-visual.preview-folder {
    color: var(--folder-accent, #8b96ff);
    padding: 11px;
    place-items: stretch;
    border-radius: 11px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .42), rgba(225, 232, 246, .78)),
        linear-gradient(155deg, color-mix(in srgb, var(--folder-accent, #8b96ff) 20%, #f7f9ff), #edf2fb 72%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .55),
        inset 0 0 0 1px rgba(154, 165, 196, .2);
}

.folder-preview-stage {
    display: grid;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border-radius: 0;
    overflow: hidden;
    background: transparent;
    box-shadow: none;
}

.folder-preview-grid {
    display: grid;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
    gap: 6px;
    border-radius: 8px;
    overflow: hidden;
    align-items: stretch;
    align-content: stretch;
}

.folder-preview-grid img,
.folder-preview-grid > span {
    display: block;
    width: 100%;
    min-width: 0;
    height: 100%;
    min-height: 0;
    align-self: stretch;
    justify-self: stretch;
    overflow: hidden;
    object-fit: cover;
    object-position: center;
    border-radius: 3px;
    background: rgba(255, 255, 255, .22);
}

.folder-preview-grid img {
    transition: opacity .18s ease;
}

.folder-preview-grid > .folder-preview-file {
    display: grid;
    place-items: center;
    color: #8e96ae;
    background: rgba(255, 255, 255, .58);
}

.folder-preview-file.document {
    color: #7182e4;
}

.folder-preview-file.video {
    color: #d87489;
}

.folder-preview-file.audio {
    color: #9a70ce;
}

.folder-preview-file.archive {
    color: #ca9260;
}

.folder-preview-file.image {
    color: #5e9cb9;
}

.folder-preview-file svg {
    width: 54%;
    height: 54%;
    stroke-width: 1.65;
}

.file-card:hover .folder-preview-grid img {
    transform: none;
}

.folder-card-with-preview .file-meta {
    padding-top: 14px;
}

.folder-pin-mark {
    position: absolute;
    top: 8px;
    right: 8px;
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    color: var(--folder-accent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--folder-accent) 17%, #fff);
}

.file-visual .folder-pin-mark svg,
body[data-view="list"] .file-visual .folder-pin-mark svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 1.8;
}

body[data-view="list"] .folder-pin-mark {
    top: 2px;
    right: 2px;
    width: 15px;
    height: 15px;
    border-radius: 5px;
}

body[data-view="list"] .file-visual .folder-pin-mark svg {
    width: 8px;
    height: 8px;
}

.file-visual.document {
    color: #7182e4;
    background: #eff2ff;
}

.file-visual.video {
    color: #d87489;
    background: #fff0f3;
}

.file-visual.audio {
    color: #9a70ce;
    background: #f6efff;
}

.file-visual.archive {
    color: #ca9260;
    background: #fff5eb;
}

.file-visual small {
    position: absolute;
    right: 9px;
    bottom: 8px;
    padding: 3px 5px;
    color: currentColor;
    border-radius: 5px;
    background: rgba(255, 255, 255, .72);
    font-size: 7px;
    font-weight: 800;
    letter-spacing: .08em;
}

.file-meta {
    display: grid;
    min-width: 0;
    padding: 11px 4px 0;
    gap: 4px;
}

.file-meta strong {
    overflow: hidden;
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-meta span {
    overflow: hidden;
    color: #9095a5;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-access-badge {
    display: inline-flex;
    margin-left: 6px;
    padding: 2px 5px;
    color: #3f62d8;
    border-radius: 999px;
    background: #eef3ff;
    font-size: 7px;
    font-style: normal;
    font-weight: 800;
    line-height: 1.2;
    vertical-align: middle;
}

.file-access-badge.public {
    color: #1f7a58;
    background: #e5f7ed;
}

.file-access-badge.shared {
    color: #8a5a00;
    background: #fff0c2;
}

.file-access-badge.hidden {
    color: #8a4a0d;
    background: #fff1df;
}

body[data-view="list"] .list-type .file-access-badge {
    margin-left: 5px;
}

.file-actions {
    position: absolute;
    top: 14px;
    right: 14px;
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity .2s ease;
}

.file-action-menu {
    display: contents;
}

.file-action-menu > .file-action-menu-toggle {
    display: none;
}

.file-action-menu-panel {
    display: flex;
    gap: 5px;
}

.file-action-label {
    display: none;
}

.folder-actions .folder-action-menu {
    position: relative;
    display: block;
    flex: 0 0 auto;
}

.folder-actions .folder-action-menu.open {
    z-index: 24;
}

.folder-actions .folder-action-menu > .folder-action-menu-toggle {
    width: 41px;
    padding: 0;
}

.folder-actions .folder-action-menu > .folder-action-menu-toggle svg {
    width: 18px;
    height: 18px;
    stroke-width: 3.2;
}

.folder-actions .folder-action-menu.open > .folder-action-menu-toggle {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.file-compact-folder-actions {
    display: none;
}

.folder-actions .folder-action-menu:not(.open) > .folder-action-menu-panel {
    display: none;
}

.folder-actions .folder-action-menu > .folder-action-menu-panel,
.current-folder-action-menu-panel {
    position: absolute;
    z-index: 130;
    top: calc(100% + 8px);
    right: 0;
    bottom: auto;
    display: grid;
    min-width: 196px;
    max-width: calc(100vw - 32px);
    max-height: min(70vh, 420px);
    padding: 6px;
    gap: 2px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 18px 46px rgba(15, 18, 31, .24);
}

.folder-actions .folder-action-menu > .folder-action-menu-panel > button,
.folder-actions .folder-action-menu > .folder-action-menu-panel > form > button,
.current-folder-action-menu-panel > button,
.current-folder-action-menu-panel > form > button {
    display: flex;
    width: 100%;
    min-height: 42px;
    padding: 0 10px;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    color: var(--ink);
    border: 0;
    border-radius: 9px;
    background: transparent;
    box-shadow: none;
    font-family: inherit;
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
    cursor: pointer;
}

.folder-actions .folder-action-menu > .folder-action-menu-panel > form,
.current-folder-action-menu-panel > form {
    margin: 0;
}

.folder-actions .folder-action-menu > .file-action-menu-panel > button:hover,
.folder-actions .folder-action-menu > .file-action-menu-panel > button:active,
.folder-actions .folder-action-menu > .file-action-menu-panel > button:focus-visible,
.folder-actions .folder-action-menu > .file-action-menu-panel > form > button:hover,
.folder-actions .folder-action-menu > .file-action-menu-panel > form > button:active,
.folder-actions .folder-action-menu > .file-action-menu-panel > form > button:focus-visible,
.current-folder-action-menu-panel > button:hover,
.current-folder-action-menu-panel > button:active,
.current-folder-action-menu-panel > button:focus-visible,
.current-folder-action-menu-panel > form > button:hover,
.current-folder-action-menu-panel > form > button:active,
.current-folder-action-menu-panel > form > button:focus-visible {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.folder-actions .folder-action-menu > .folder-action-menu-panel > button:focus-visible,
.folder-actions .folder-action-menu > .folder-action-menu-panel > form > button:focus-visible,
.current-folder-action-menu-panel > button:focus-visible,
.current-folder-action-menu-panel > form > button:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
    outline-offset: -2px;
}

.folder-actions .folder-action-menu > .folder-action-menu-panel > button:not(:focus-visible),
.folder-actions .folder-action-menu > .folder-action-menu-panel > form > button:not(:focus-visible),
.current-folder-action-menu-panel > button:not(:focus-visible),
.current-folder-action-menu-panel > form > button:not(:focus-visible) {
    outline: 0;
}

.folder-actions .folder-action-menu > .folder-action-menu-panel > button svg,
.folder-actions .folder-action-menu > .folder-action-menu-panel > form > button svg,
.current-folder-action-menu-panel > button svg,
.current-folder-action-menu-panel > form > button svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.folder-actions .folder-action-menu > .folder-action-menu-panel button:disabled,
.current-folder-action-menu-panel button:disabled {
    color: var(--muted);
    opacity: .5;
    cursor: not-allowed;
}

.folder-actions .folder-action-menu > .folder-action-menu-panel .folder-action-danger,
.current-folder-action-menu-panel .folder-action-danger {
    color: #c2415b;
}

.current-folder-action-menu-panel[hidden] {
    display: none;
}

.current-folder-action-menu-panel.viewport-positioned {
    position: fixed;
    inset: auto;
    overscroll-behavior: contain;
    animation: dropdown-in .14s ease-out;
    backdrop-filter: blur(18px);
}

.folder-action-menu-divider {
    height: 1px;
    margin: 4px 6px;
    background: var(--line);
}

.file-sort-menu {
    position: relative;
    flex: 0 0 auto;
}

.file-sort-menu .sort-dropdown .file-sort-menu-toggle {
    display: grid;
    width: 36px;
    min-width: 36px;
    height: 36px;
    padding: 0;
    place-items: center;
    place-content: center;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
}

.file-sort-menu .file-sort-menu-toggle svg {
    width: 18px;
    height: 18px;
    transition: none;
}

.file-sort-menu .ui-dropdown.open .file-sort-menu-toggle {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.file-sort-menu .ui-dropdown.open .file-sort-menu-toggle svg {
    transform: none;
}

.file-sort-menu-panel {
    width: 238px;
}

.file-browser-content .ui-dropdown-menu.viewport-positioned {
    z-index: 130;
}

.file-sort-menu-panel > button {
    padding: 7px 10px;
    grid-template-columns: minmax(0, 1fr) 16px;
    align-items: center;
    gap: 10px;
}

.file-sort-menu-panel > button > span {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.file-sort-menu-panel > button > span > strong,
.file-sort-menu-panel > button > span > small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-sort-menu-panel > button > svg {
    width: 16px;
    height: 16px;
    color: var(--accent);
    opacity: 0;
}

.file-sort-menu-panel > button[aria-selected="true"] > svg {
    opacity: 1;
}

.file-sort-menu-panel > button[aria-selected="true"]::after {
    content: none;
}

.file-filter-menu {
    position: relative;
    flex: 0 0 auto;
}

.file-filter-menu.open {
    z-index: 24;
}

.file-filter-menu-toggle {
    position: relative;
    display: grid;
    width: 36px;
    height: 36px;
    padding: 0;
    place-items: center;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    cursor: pointer;
}

.file-filter-menu-toggle svg {
    width: 17px;
    height: 17px;
}

.file-filter-menu.open > .file-filter-menu-toggle,
.file-filter-menu.has-active-filter > .file-filter-menu-toggle {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.file-filter-menu.has-active-filter > .file-filter-menu-toggle::after {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 5px;
    height: 5px;
    border: 1px solid var(--surface);
    border-radius: 999px;
    background: var(--accent);
    content: "";
}

.file-filter-menu:not(.open) > .file-filter-menu-panel {
    display: none;
}

.file-filter-menu-panel {
    position: absolute;
    z-index: 32;
    top: calc(100% + 8px);
    right: 0;
    display: grid;
    width: 224px;
    max-width: calc(100vw - 32px);
    max-height: min(70vh, 420px);
    padding: 6px;
    gap: 2px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 18px 46px rgba(15, 18, 31, .24);
}

.file-filter-menu-panel > button {
    display: grid;
    min-height: 44px;
    padding: 0 10px;
    grid-template-columns: 18px minmax(0, 1fr) 16px;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    border: 0;
    border-radius: 9px;
    background: transparent;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.file-filter-menu-panel > button:hover,
.file-filter-menu-panel > button:active,
.file-filter-menu-panel > button:focus-visible,
.file-filter-menu-panel > button.active {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.file-filter-menu-panel > button:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
    outline-offset: -2px;
}

.file-filter-kind,
.file-filter-check {
    width: 16px;
    height: 16px;
}

.file-filter-kind {
    color: var(--muted);
}

.file-filter-check {
    color: var(--accent);
    opacity: 0;
}

.file-filter-menu-panel > button.active .file-filter-check {
    opacity: 1;
}

.file-filter-copy {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.file-filter-copy strong {
    overflow: hidden;
    font-size: 12px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-filter-copy small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}

.file-card:hover .file-actions,
.file-actions:focus-within {
    opacity: 1;
}

.file-actions a,
.file-actions button,
.file-actions summary {
    display: grid;
    width: 30px;
    height: 30px;
    padding: 0;
    place-items: center;
    color: var(--ink);
    border: 1px solid rgba(225, 227, 235, .9);
    border-radius: 9px;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 5px 15px rgba(28, 31, 48, .1);
    cursor: pointer;
    list-style: none;
}

.file-actions summary::-webkit-details-marker {
    display: none;
}

html[data-theme="dark"] .file-actions summary {
    color: var(--ink);
    border-color: var(--line);
    background: rgba(29, 32, 42, .94);
}

.file-actions form {
    margin: 0;
}

.file-visibility-picker {
    position: relative;
}

.file-card:has(.file-visibility-picker[open]) {
    z-index: 8;
    overflow: visible;
}

.file-visibility-menu {
    position: absolute;
    z-index: 12;
    top: 36px;
    right: 0;
    display: grid;
    min-width: 150px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 14px 34px rgba(15, 18, 31, .2);
}

.file-actions .file-visibility-menu button {
    display: flex;
    width: 100%;
    height: 36px;
    padding: 0 10px;
    justify-content: flex-start;
    gap: 8px;
    color: var(--ink);
    border: 0;
    background: transparent;
    box-shadow: none;
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
}

.file-actions .file-visibility-menu button:hover,
.file-actions .file-visibility-menu button.active {
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.file-actions .file-visibility-menu button:disabled {
    opacity: 1;
    cursor: default;
}

.file-actions button {
    color: #a7475a;
}

.file-actions button[data-copy-file-url] {
    color: var(--ink);
}

.file-actions button[data-folder-rename] {
    color: var(--ink);
}

.file-actions .file-action-danger {
    color: #a7475a;
}

.file-actions button:disabled,
.file-actions a.is-loading,
.preview-download:disabled,
.preview-download.is-loading {
    opacity: .58;
    cursor: wait;
}

.file-actions button.copy-confirmed,
.preview-download.copy-confirmed {
    color: #fff;
    border-color: rgba(31, 122, 88, .45);
    background: #1f7a58;
    box-shadow: 0 8px 24px rgba(31, 122, 88, .28);
}

.file-actions button.copy-blocked {
    color: #fff;
    border-color: rgba(168, 64, 85, .45);
    background: #a84055;
}

.file-actions svg {
    width: 14px;
    height: 14px;
}

/* Gallery keeps every item reachable while presenting the existing grid thumbnails as dense square tiles. */
body[data-view="gallery"] .file-collection {
    --gallery-tile-radius: 6px;
    --gallery-folder-preview-padding: 7px;
    --gallery-folder-preview-gap: 3px;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 4px;
}

body[data-view="gallery"] .file-card {
    border: 0;
    border-radius: var(--gallery-tile-radius);
    box-shadow: none;
}

body[data-view="gallery"] .file-card:hover {
    border-color: transparent;
    box-shadow: none;
    transform: none;
}

html body[data-view="gallery"] .file-card.selected {
    outline: 3px solid var(--accent);
    outline-offset: -3px;
    box-shadow: none;
}

body[data-view="gallery"] .file-open {
    height: 100%;
    padding: 0;
}

body[data-view="gallery"] .shared-hidden-notice-open {
    display: block;
}

body[data-view="gallery"] .file-visual {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    border-radius: var(--gallery-tile-radius);
}

body[data-view="gallery"] .file-visual.preview-folder {
    padding: var(--gallery-folder-preview-padding);
    border-radius: var(--gallery-tile-radius);
}

body[data-view="gallery"] .folder-preview-grid {
    gap: var(--gallery-folder-preview-gap);
    border-radius: max(0px, calc(var(--gallery-tile-radius) - 2px));
}

body[data-view="gallery"] .folder-preview-grid img,
body[data-view="gallery"] .folder-preview-grid > span {
    border-radius: max(0px, calc(var(--gallery-tile-radius) - 3px));
}

body[data-view="gallery"] .file-visual small,
body[data-view="gallery"] .folder-pin-mark {
    display: none;
}

body[data-view="gallery"] .file-meta {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Gallery tiles are intentionally open-only; switch to Grid or List for item actions. */
body[data-view="gallery"] .file-actions {
    display: none;
}

body[data-view="gallery"] .file-card:has(.file-action-menu.open) {
    z-index: 18;
    overflow: visible;
}

body[data-view="gallery"] .file-action-menu {
    position: relative;
    display: block;
}

body[data-view="gallery"] .file-action-menu > .file-action-menu-toggle {
    display: grid;
    width: 36px;
    height: 36px;
    color: var(--ink);
    border-color: color-mix(in srgb, var(--line) 76%, transparent);
    border-radius: 11px;
    background: color-mix(in srgb, var(--surface) 91%, transparent);
    box-shadow: 0 8px 22px rgba(20, 24, 39, .14);
    backdrop-filter: blur(12px);
}

body[data-view="gallery"] .file-action-menu > .file-action-menu-toggle svg {
    width: 18px;
    height: 18px;
    stroke-width: 3.2;
}

body[data-view="gallery"] .file-action-menu.open > .file-action-menu-toggle {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

body[data-view="gallery"] .file-action-menu:not(.open) > .file-action-menu-panel {
    display: none;
}

body[data-view="gallery"] .file-actions .file-action-menu-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    display: grid;
    box-sizing: border-box;
    min-width: 174px;
    max-width: calc(100vw - 32px);
    max-height: var(--file-menu-max-height, calc(100dvh - 16px));
    padding: 6px;
    gap: 2px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 18px 46px rgba(15, 18, 31, .24);
    scrollbar-width: thin;
}

body[data-view="gallery"] .file-actions .file-action-menu-panel.opens-below {
    top: calc(100% + 8px);
    bottom: auto;
}

body[data-view="gallery"] .file-actions .file-action-menu-panel > a,
body[data-view="gallery"] .file-actions .file-action-menu-panel > button,
body[data-view="gallery"] .file-actions .file-action-menu-panel > form > button,
body[data-view="gallery"] .file-actions .file-action-menu-panel > .file-visibility-picker > summary {
    display: flex;
    width: 100%;
    height: 42px;
    padding: 0 10px;
    justify-content: flex-start;
    gap: 10px;
    color: var(--ink);
    border: 0;
    border-radius: 9px;
    background: transparent;
    box-shadow: none;
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
}

body[data-view="gallery"] .file-actions .file-action-menu-panel > a:hover,
body[data-view="gallery"] .file-actions .file-action-menu-panel > button:hover,
body[data-view="gallery"] .file-actions .file-action-menu-panel > form > button:hover,
body[data-view="gallery"] .file-actions .file-action-menu-panel > .file-visibility-picker > summary:hover,
body[data-view="gallery"] .file-actions .file-action-menu-panel > a:focus-visible,
body[data-view="gallery"] .file-actions .file-action-menu-panel > button:focus-visible,
body[data-view="gallery"] .file-actions .file-action-menu-panel > form > button:focus-visible,
body[data-view="gallery"] .file-actions .file-action-menu-panel > .file-visibility-picker > summary:focus-visible {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
}

body[data-view="gallery"] .file-actions .file-action-menu-panel > form,
body[data-view="gallery"] .file-actions .file-action-menu-panel > .file-visibility-picker {
    width: 100%;
}

body[data-view="gallery"] .file-actions .file-action-menu-panel > form > .file-action-danger {
    color: #a7475a;
}

body[data-view="gallery"] .file-action-label {
    display: inline;
}

body[data-view="gallery"] .file-action-menu-panel .file-visibility-menu {
    position: static;
    min-width: 0;
    margin: 2px 4px 4px;
    padding: 4px 0 0;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
}

.list-head,
.list-type,
.list-size,
.list-date,
.mobile-file-date {
    display: none;
}

/* Files: list */
body[data-view="list"] .file-table-shell {
    max-height: max(360px, calc(100vh - 345px));
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    scrollbar-color: #c7cad5 transparent;
    scrollbar-width: thin;
}

body[data-view="list"] .list-head {
    position: sticky;
    z-index: 3;
    top: 0;
    display: grid;
    min-width: 720px;
    padding: 11px 14px;
    grid-template-columns: minmax(220px, 1fr) 120px 100px 125px 72px;
    gap: 14px;
    color: #989dab;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(12px);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}

body[data-view="list"] .file-collection {
    display: grid;
    min-width: 720px;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
}

body[data-view="list"] .file-card {
    display: grid;
    min-height: 54px;
    padding: 4px 14px;
    align-items: center;
    grid-template-columns: minmax(220px, 1fr) 120px 100px 125px 72px;
    gap: 14px;
    overflow: visible;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: var(--surface);
    box-shadow: none;
}

body[data-view="list"].selection-mode .list-head,
body[data-view="list"].selection-mode .file-card {
    grid-template-columns: 38px minmax(220px, 1fr) 120px 100px 125px 72px;
}

body[data-view="list"].selection-mode .list-head::before {
    content: "";
}

body[data-view="list"] .item-select-control {
    position: static;
    align-self: center;
    justify-self: start;
}

body[data-view="list"] .file-card:hover {
    background: #f7f7fb;
    box-shadow: none;
    transform: none;
}

body[data-view="list"] .file-card.trashed::after {
    position: static;
    align-self: center;
    justify-self: end;
    white-space: nowrap;
}

body[data-view="list"] .file-open {
    display: flex;
    min-width: 0;
    padding: 0;
    align-items: center;
    gap: 11px;
}

body[data-view="list"] .file-visual {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border-radius: 8px;
}

body[data-view="list"] .folder-preview-grid {
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 2px;
    border-radius: 4px;
}

body[data-view="list"] .folder-preview-grid > :nth-child(n+7) {
    display: none;
}

body[data-view="list"] .folder-preview-grid img,
body[data-view="list"] .folder-preview-grid > span {
    border-radius: 1px;
}

body[data-view="list"] .shared-hidden-notice-open {
    min-height: 44px;
}

body[data-view="list"] .shared-hidden-notice-new {
    top: 2px;
    left: 2px;
    padding: 2px 4px;
    font-size: 6px;
}

body[data-view="list"] .shared-hidden-notice-eye {
    right: -3px;
    bottom: -2px;
    width: 19px;
    height: 19px;
    border-width: 2px;
}

body[data-view="list"] .shared-hidden-notice-eye svg {
    width: 10px;
    height: 10px;
}

body[data-view="list"] .shared-hidden-notice-kind {
    width: 25px !important;
    height: 25px !important;
}

body[data-view="list"] .folder-preview-file svg {
    width: 72%;
    height: 72%;
}

body[data-view="list"] .file-visual.preview-folder {
    padding: 3px;
}

body[data-view="list"] .folder-preview-stage {
    padding: 0;
    border-radius: 0;
}

body[data-view="list"] .file-visual svg {
    width: 21px;
    height: 21px;
}

body[data-view="list"] .file-visual small {
    display: none;
}

body[data-view="list"] .file-meta {
    padding: 0;
}

body[data-view="list"] .file-meta span {
    display: none;
}

body[data-view="list"] .list-type,
body[data-view="list"] .list-size,
body[data-view="list"] .list-date {
    display: block;
    overflow: hidden;
    color: #777c8e;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body[data-view="list"] .file-actions {
    position: static;
    opacity: 1;
}

body[data-view="list"] .file-actions a,
body[data-view="list"] .file-actions button,
body[data-view="list"] .file-actions summary {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}

body[data-view="list"] .file-card:last-child {
    border-bottom: 0;
}

.file-card[hidden] {
    display: none !important;
}

.empty-state {
    display: none;
    padding: 80px 20px;
    color: var(--muted);
    text-align: center;
}

.empty-state.visible {
    display: block;
}

.empty-state > span {
    display: grid;
    width: 62px;
    height: 62px;
    margin: 0 auto 15px;
    place-items: center;
    color: #8c96f7;
    border-radius: 20px;
    background: #eceeff;
}

.empty-state h2 {
    margin: 0;
    color: var(--ink);
    font-family: "Manrope", sans-serif;
    font-size: 18px;
}

.empty-state p {
    margin: 7px 0 0;
    font-size: 12px;
}
