:root {
    color-scheme: light dark;

    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-hover: #f1f3f6;
    --surface-active: #e8ebf0;
    --border: #e4e7ec;
    --text: #1a1d23;
    --text-muted: #6b7280;
    --accent: #2f6feb;
    --accent-text: #ffffff;
    --accent-soft: rgba(47, 111, 235, 0.12);
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.18);
    --backdrop: rgba(16, 24, 40, 0.35);

    --c-folder: #e3a008;
    --c-image: #16a34a;
    --c-video: #9333ea;
    --c-audio: #db2777;
    --c-archive: #ea580c;
    --c-code: #0891b2;
    --c-pdf: #dc2626;
    --c-text: #64748b;
    --c-other: #94a3b8;
    --danger: #dc2626;

    --radius: 12px;
    --header-height: 60px;
    --page-padding: 12px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1115;
        --surface: #16181d;
        --surface-hover: #1d2027;
        --surface-active: #252932;
        --border: #262a33;
        --text: #e7e9ee;
        --text-muted: #9098a5;
        --accent: #5b8ff9;
        --accent-text: #0b1020;
        --accent-soft: rgba(91, 143, 249, 0.16);
        --shadow: none;
        --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
        --backdrop: rgba(0, 0, 0, 0.55);

        --c-folder: #f0b429;
        --c-image: #4ade80;
        --c-video: #c084fc;
        --c-audio: #f472b6;
        --c-archive: #fb923c;
        --c-code: #22d3ee;
        --c-pdf: #f87171;
        --c-text: #94a3b8;
        --c-other: #6b7280;
        --danger: #f87171;
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.45;
    -webkit-tap-highlight-color: transparent;
}

button,
input,
select {
    font: inherit;
    color: inherit;
}

button {
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 8px;
}

.hidden {
    display: none !important;
}

.icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: block;
}

[data-icon] {
    display: inline-flex;
}

/* ---------- header ---------- */

.header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
    padding-top: env(safe-area-inset-top);
}

.header-inner {
    max-width: 1100px;
    height: var(--header-height);
    margin: 0 auto;
    padding: 0 var(--page-padding);
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 40%;
    flex-shrink: 0;
}

.search {
    flex: 1;
    min-width: 0;
    height: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    cursor: text;
}

.search:focus-within {
    background: var(--surface);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-icon {
    color: var(--text-muted);
}

.search-input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px; /* prevents zoom on focus in iOS Safari */
}

.search-input::-webkit-search-cancel-button {
    cursor: pointer;
}

.search-hint {
    display: none;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0 6px;
}

/* ---------- toolbar ---------- */

.main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 8px var(--page-padding) calc(32px + env(safe-area-inset-bottom));
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
}

.breadcrumbs {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    overflow-x: auto;
    scrollbar-width: none;
    white-space: nowrap;
    mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
    padding: 0 8px;
    margin: 0 -8px;
}

.breadcrumbs::-webkit-scrollbar {
    display: none;
}

.crumb {
    padding: 6px 8px;
    border-radius: 8px;
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
}

.crumb:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.crumb.current {
    color: var(--text);
    font-weight: 600;
}

.crumb-separator {
    color: var(--text-muted);
    opacity: 0.6;
}

.crumb-separator .icon {
    width: 16px;
    height: 16px;
}

.toolbar-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.icon-button {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
}

.icon-button:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.icon-button:active {
    background: var(--surface-active);
}

/* ---------- list ---------- */

.browser {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.list-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 8px 8px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
}

.sort-select {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
    height: 32px;
    border-radius: 8px;
    color: var(--text-muted);
}

.sort-select:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.sort-select .icon {
    width: 16px;
    height: 16px;
}

.sort-select select {
    appearance: none;
    border: none;
    background: transparent;
    font-size: 13px;
    cursor: pointer;
    outline: none;
}

.list-header {
    display: none;
}

.row {
    position: relative;
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 44px;
    align-items: center;
    column-gap: 12px;
    min-height: 60px;
    padding: 8px 4px 8px 12px;
    border-bottom: 1px solid var(--border);
    transition: background 0.12s;
}

.row:last-child {
    border-bottom: none;
}

.row:hover {
    background: var(--surface-hover);
}

.row:active {
    background: var(--surface-active);
}

.row.muted .row-name {
    opacity: 0.6;
}

.row-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--type-color, var(--c-other));
    background: color-mix(in srgb, var(--type-color, var(--c-other)) 14%, transparent);
}

.row-icon .icon {
    width: 22px;
    height: 22px;
}

.row-main {
    min-width: 0;
}

.row-link {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-weight: 500;
    overflow: hidden;
    overflow-wrap: anywhere;
}

/* the whole row is clickable, action buttons stay above the stretched link */
.row-link::after {
    content: "";
    position: absolute;
    inset: 0;
}

.row-sub {
    font-size: 13px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.row-modified,
.row-size {
    display: none;
    color: var(--text-muted);
    font-size: 14px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.row-actions {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: flex-end;
}

.row-actions .icon-button[data-row-action="download"],
.row-actions .icon-button[data-row-action="share"] {
    display: none;
}

.list-more {
    padding: 12px 16px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    border-top: 1px solid var(--border);
}

/* ---------- viewer ---------- */

.viewer {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.viewer-head {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.viewer-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--type-color, var(--c-other));
    background: color-mix(in srgb, var(--type-color, var(--c-other)) 14%, transparent);
}

.viewer-icon .icon {
    width: 26px;
    height: 26px;
}

.viewer-title {
    min-width: 0;
}

.viewer-name {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.viewer-meta {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 2px;
}

.viewer-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
}

.button {
    height: 44px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, filter 0.15s;
}

.button:hover {
    background: var(--surface-hover);
}

.button.icon-only {
    width: 44px;
    padding: 0;
}

.button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-text);
}

.button.primary:hover {
    filter: brightness(1.08);
}

.viewer-body {
    display: flex;
    justify-content: center;
    background: var(--bg);
}

.viewer-body img,
.viewer-body video {
    display: block;
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
}

.viewer-body video {
    width: 100%;
    background: #000;
}

.viewer-body audio {
    width: 100%;
    max-width: 560px;
    margin: 32px 16px;
}

.viewer-body iframe {
    width: 100%;
    height: 80vh;
    border: none;
    background: #fff;
}

.viewer-body pre {
    width: 100%;
    margin: 0;
    padding: 16px;
    overflow: auto;
    max-height: 75vh;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    tab-size: 4;
    background: var(--surface);
}

.viewer-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 48px 16px;
    color: var(--text-muted);
    text-align: center;
}

/* ---------- readme & markdown ---------- */

.readme {
    margin-top: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.readme-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.readme-head .icon {
    width: 16px;
    height: 16px;
}

.readme-body,
.viewer-markdown {
    padding: 4px 16px 16px;
}

.viewer-markdown {
    width: 100%;
    background: var(--surface);
}

.markdown {
    overflow-wrap: anywhere;
    line-height: 1.6;
}

.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4 {
    margin: 20px 0 8px;
    line-height: 1.3;
}

.markdown h1 {
    font-size: 22px;
}

.markdown h2 {
    font-size: 19px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.markdown h3 {
    font-size: 16px;
}

.markdown p,
.markdown ul,
.markdown ol,
.markdown blockquote,
.markdown pre,
.markdown table {
    margin: 0 0 12px;
}

.markdown ul,
.markdown ol {
    padding-left: 24px;
}

.markdown li + li {
    margin-top: 4px;
}

.markdown a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.markdown code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    padding: 2px 5px;
    border-radius: 6px;
    background: var(--surface-hover);
}

.markdown pre {
    padding: 12px 14px;
    overflow-x: auto;
    border-radius: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
}

.markdown pre code {
    padding: 0;
    background: none;
    font-size: 13px;
}

.markdown blockquote {
    padding: 2px 14px;
    border-left: 3px solid var(--border);
    color: var(--text-muted);
}

.markdown img {
    max-width: 100%;
    border-radius: 8px;
}

.markdown hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

.markdown table {
    display: block;
    overflow-x: auto;
    border-collapse: collapse;
}

.markdown th,
.markdown td {
    padding: 6px 12px;
    border: 1px solid var(--border);
    text-align: left;
}

.markdown th {
    background: var(--surface-hover);
    font-weight: 600;
}

/* ---------- states ---------- */

.state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 64px 16px;
    color: var(--text-muted);
}

.state-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-hover);
    margin-bottom: 12px;
}

.state-icon .icon {
    width: 28px;
    height: 28px;
}

.state-title {
    color: var(--text);
    font-weight: 600;
    font-size: 16px;
}

.state-text {
    font-size: 14px;
    margin-top: 4px;
}

.browser .state {
    padding: 48px 16px;
}

.loading .list,
.loading .viewer-body {
    opacity: 0.5;
    transition: opacity 0.2s 0.15s;
}

/* ---------- bottom sheet ---------- */

.sheet {
    margin: auto auto 0;
    width: 100%;
    max-width: 480px;
    border: none;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    border-radius: 16px 16px 0 0;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-lg);
}

.sheet[open] {
    animation: sheet-in 0.2s ease-out;
}

.sheet::backdrop {
    background: var(--backdrop);
}

@keyframes sheet-in {
    from {
        transform: translateY(100%);
    }
}

.sheet-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 12px 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.sheet-icon {
    color: var(--type-color, var(--c-other));
}

.sheet-title {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.sheet-actions button,
.sheet-cancel {
    width: 100%;
    min-height: 52px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 16px;
    text-align: left;
}

.sheet-actions button:active,
.sheet-cancel:active {
    background: var(--surface-active);
}

.sheet-cancel {
    justify-content: center;
    margin-top: 4px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ---------- toast ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom));
    transform: translate(-50%, 16px);
    max-width: calc(100% - 32px);
    padding: 10px 16px;
    border-radius: 10px;
    background: var(--text);
    color: var(--surface);
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 50;
}

.toast.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ---------- admin ---------- */

body:not(.is-admin) .admin-only {
    display: none !important;
}

.account-button {
    flex-shrink: 0;
    width: auto;
    min-width: 40px;
    gap: 6px;
    padding: 0 8px;
}

.account-button .account-label {
    display: none;
    font-size: 14px;
    font-weight: 500;
}

.account-button.active {
    color: var(--accent);
    background: var(--accent-soft);
}

.upload-button {
    display: none;
    height: 36px;
    padding: 0 14px;
    margin-right: 4px;
}

.private-badge {
    display: inline-flex;
    vertical-align: -2px;
    margin-left: 6px;
    color: var(--text-muted);
}

.private-badge .icon {
    width: 14px;
    height: 14px;
}

.sheet-admin {
    border-top: 1px solid var(--border);
    margin-top: 4px;
    padding-top: 4px;
}

.sheet-actions button.danger {
    color: var(--danger);
}

.fab {
    position: fixed;
    right: 16px;
    bottom: calc(20px + env(safe-area-inset-bottom));
    z-index: 30;
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: var(--accent-text);
    box-shadow: var(--shadow-lg);
}

/* keeps the last rows reachable under the floating upload button */
.is-admin .main {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

.fab .icon {
    width: 24px;
    height: 24px;
}

/* ---------- modal ---------- */

.modal {
    width: calc(100% - 24px);
    max-width: 440px;
    max-height: calc(100vh - 48px);
    padding: 0;
    border: none;
    border-radius: 16px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-lg);
}

.modal::backdrop {
    background: var(--backdrop);
}

.modal-form {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 48px);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 8px 4px 20px;
}

.modal-title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
}

.modal-body {
    padding: 8px 20px;
    overflow-y: auto;
}

.modal-text {
    margin: 0 0 8px;
    color: var(--text-muted);
    overflow-wrap: anywhere;
}

.modal-error {
    margin: 4px 20px 0;
    padding: 8px 12px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    color: var(--danger);
    font-size: 14px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px 16px;
}

.modal-actions .button {
    height: 40px;
}

.button.danger,
.button.primary.danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.field-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.field input {
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    font-size: 16px;
    outline: none;
}

.field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.menu-button {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 8px;
    border-radius: 10px;
    font-size: 15px;
}

.menu-button:hover {
    background: var(--surface-hover);
}

/* ---------- trash ---------- */

.trash-row {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.trash-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trash-actions {
    display: flex;
    gap: 2px;
}

.armed-button.armed {
    color: var(--danger);
    font-size: 13px;
    font-weight: 500;
}

.icon-button.armed-button.armed {
    width: auto;
    padding: 0 10px;
    gap: 6px;
    background: color-mix(in srgb, var(--danger) 12%, transparent);
}

.trash-empty {
    width: 100%;
    height: 44px;
    margin-top: 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    color: var(--danger);
    font-weight: 500;
}

.trash-list .state {
    padding: 24px 0;
}

/* ---------- uploads ---------- */

.uploads {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(88px + env(safe-area-inset-bottom));
    z-index: 40;
    max-height: 45vh;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.uploads-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 4px 4px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 14px;
}

.uploads-list {
    overflow-y: auto;
}

.upload-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px 8px 16px;
    border-bottom: 1px solid var(--border);
}

.upload-item:last-child {
    border-bottom: none;
}

.upload-text {
    flex: 1;
    min-width: 0;
}

.upload-name {
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.upload-item[data-status="failed"] .upload-status {
    color: var(--danger);
}

.progress {
    height: 4px;
    margin-top: 6px;
    border-radius: 2px;
    background: var(--surface-active);
    overflow: hidden;
}

.progress-bar {
    width: 0;
    height: 100%;
    background: var(--accent);
    transition: width 0.2s;
}

.upload-item[data-status="done"] .progress-bar {
    background: var(--c-image);
}

.upload-item[data-status="failed"] .progress-bar,
.upload-item[data-status="cancelled"] .progress-bar,
.upload-item[data-status="skipped"] .progress-bar {
    background: var(--text-muted);
}

.drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    backdrop-filter: blur(2px);
    pointer-events: none;
}

.drop-overlay-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px 40px;
    border: 2px dashed var(--accent);
    border-radius: 20px;
    background: var(--surface);
    color: var(--accent);
    font-weight: 600;
    text-align: center;
}

.drop-overlay-inner .icon {
    width: 36px;
    height: 36px;
}

/* ---------- desktop ---------- */

@media (min-width: 720px) {
    :root {
        --page-padding: 24px;
        --header-height: 64px;
    }

    .main {
        padding-top: 12px;
    }

    .search {
        max-width: 420px;
        margin-left: auto;
    }

    .search-hint {
        display: inline;
    }

    .account-button .account-label {
        display: inline;
    }

    .account-button:not(.active) .account-label {
        display: none;
    }

    .upload-button {
        display: inline-flex;
    }

    .fab {
        display: none;
    }

    .is-admin .main {
        padding-bottom: calc(32px + env(safe-area-inset-bottom));
    }

    .uploads {
        left: auto;
        right: 24px;
        bottom: 24px;
        width: 380px;
    }

    .search:focus-within .search-hint {
        display: none;
    }

    .sort-select {
        display: none;
    }

    .list-header,
    .row {
        grid-template-columns: 36px minmax(0, 1fr) 150px 100px 120px;
    }

    .list-header {
        display: grid;
        align-items: center;
        column-gap: 12px;
        padding: 0 12px;
        height: 40px;
        border-bottom: 1px solid var(--border);
        font-size: 13px;
        color: var(--text-muted);
    }

    .list-header button {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        justify-self: start;
        padding: 4px 6px;
        margin-left: -6px;
        border-radius: 6px;
        font-weight: 500;
    }

    .list-header button:hover {
        background: var(--surface-hover);
        color: var(--text);
    }

    .list-header button.active {
        color: var(--text);
    }

    .list-header button .icon {
        width: 14px;
        height: 14px;
    }

    .row {
        min-height: 52px;
        padding: 6px 12px;
    }

    .row-icon {
        width: 36px;
        height: 36px;
    }

    .row-icon .icon {
        width: 20px;
        height: 20px;
    }

    .row-modified,
    .row-size {
        display: block;
    }

    .row-link {
        -webkit-line-clamp: 1;
    }

    .row-sub.row-meta {
        display: none;
    }

    .row-actions {
        gap: 4px;
        opacity: 0;
        transition: opacity 0.12s;
    }

    .row:hover .row-actions,
    .row:focus-within .row-actions {
        opacity: 1;
    }

    .row-actions .icon-button {
        width: 36px;
        height: 36px;
    }

    .row-actions .icon-button[data-row-action="download"],
    .row-actions .icon-button[data-row-action="share"] {
        display: inline-flex;
    }


    .viewer-head {
        grid-template-columns: 56px minmax(0, 1fr) auto;
        padding: 20px;
    }

    .viewer-icon {
        width: 56px;
        height: 56px;
    }

    .viewer-name {
        font-size: 20px;
    }

    .viewer-actions {
        grid-column: auto;
        display: flex;
    }

    .sheet {
        margin: auto;
        border-radius: 16px;
    }
}

/* touch devices have no hover: keep row actions visible */
@media (min-width: 720px) and (hover: none) {
    .row-actions {
        opacity: 1;
    }
}
