/* =========================
   DESIGN TOKENS
   Edit these to rebrand quickly. They flow into everything below.
========================= */
:root {
    --bg-0:           #f5f7fb;
    --bg-1:           #eef2ff;
    --card-bg:        rgba(255, 255, 255, 0.78);
    --card-border:    rgba(255, 255, 255, 0.65);
    --card-shadow:    0 20px 60px -20px rgba(31, 41, 80, 0.18),
                      0 8px 24px -12px rgba(31, 41, 80, 0.08);

    --text:           #121826;
    --text-soft:      #3b4357;
    --muted:          #6b7280;
    --line:           rgba(15, 23, 42, 0.06);
    --line-strong:    rgba(15, 23, 42, 0.12);

    --surface-input:  rgba(255, 255, 255, 0.85);
    --surface-raised: rgba(255, 255, 255, 0.7);
    --surface-hover:  rgba(99, 102, 241, 0.05);
    --top-bar-bg:     rgba(255, 255, 255, 0.7);

    --accent:         #6366f1;
    --accent-2:       #8b5cf6;
    --accent-soft:    rgba(99, 102, 241, 0.12);
    --accent-ring:    rgba(99, 102, 241, 0.28);

    --folder:         #f59e0b;
    --folder-soft:    rgba(245, 158, 11, 0.15);
    --danger:         #e11d48;

    --radius-lg:      20px;
    --radius-md:      12px;
    --radius-sm:      8px;

    --ease:           cubic-bezier(0.2, 0.8, 0.2, 1);

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-0:           #0b0f1a;
        --bg-1:           #12172a;
        --card-bg:        rgba(22, 27, 41, 0.78);
        --card-border:    rgba(255, 255, 255, 0.08);
        --card-shadow:    0 24px 70px -20px rgba(0, 0, 0, 0.6),
                          0 10px 28px -12px rgba(0, 0, 0, 0.45);
        --text:           #e2e8f0;
        --text-soft:      #b6bdcc;
        --muted:          #8b93a7;
        --line:           rgba(255, 255, 255, 0.06);
        --line-strong:    rgba(255, 255, 255, 0.12);
        --surface-input:  rgba(17, 22, 36, 0.85);
        --surface-raised: rgba(30, 36, 54, 0.7);
        --surface-hover:  rgba(99, 102, 241, 0.12);
        --top-bar-bg:     rgba(11, 15, 26, 0.65);
        color-scheme: dark;
    }
}

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

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Arial, sans-serif;
    background: linear-gradient(135deg, var(--bg-0), var(--bg-1));
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Soft floating colour blobs behind everything */
body::before, body::after {
    content: "";
    position: fixed;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.55;
    pointer-events: none;
    z-index: 0;
}
body::before {
    width: 520px; height: 520px;
    top: -160px; left: -140px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.45), transparent 70%);
}
body::after {
    width: 560px; height: 560px;
    bottom: -200px; right: -160px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.35), transparent 70%);
}

/* =========================
   PAGE LAYOUT
========================= */
.page {
    position: relative;
    z-index: 1;
    height: 100vh;
    height: 100dvh;
    height: var(--app-vh, 100dvh);
    display: grid;
    grid-template-rows: 68px 1fr 56px;
    overflow: hidden;
}

.top-bar {
    position: relative;
    z-index: 100;
    display: flex;
    align-items: center;
    padding: 0 28px;
    background: transparent;
    border-bottom: 1px solid transparent;
}

.top-logo-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    cursor: pointer;
}
.top-logo {
    height: 28px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
    filter: brightness(1);
    display: block;
}
@media (prefers-color-scheme: dark) { .top-logo { filter: invert(1); } }

.top-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =========================
   LANGUAGE SWITCHER
========================= */
.lang-wrap { position: relative; }

.icon-btn.lang {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-raised);
    border: 1px solid var(--line);
    color: var(--text);
    padding: 6px 10px;
    font: inherit;
    font-size: 13px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s var(--ease);
}
.icon-btn.lang:hover {
    background: var(--surface-hover);
    border-color: var(--accent-ring);
    color: var(--accent);
}
.icon-btn.lang .flag {
    font-size: 14px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}
.icon-btn.lang .flag svg { width: 14px; height: 14px; }
.icon-btn.lang .code { font-weight: 600; }
.icon-btn.lang .chevron { display: inline-flex; align-items: center; }
.icon-btn.lang .chevron svg { width: 10px; height: 10px; }

.lang-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    padding: 6px;
    background: var(--menu-bg, var(--card-bg));
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--card-shadow);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: menuIn 0.15s var(--ease);
}
.lang-menu[hidden] { display: none; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

.lang-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: none;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s var(--ease);
}
.lang-menu button:hover { background: var(--surface-hover); }
.lang-menu button.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}
.lang-menu button .flag {
    width: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.lang-menu button .flag svg { width: 14px; height: 14px; }

.page-content {
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: stretch;
    padding: 16px;
}

.bottom-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0 28px;
    background: transparent;
    border-top: 1px solid transparent;
}

.footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
}
.footer-icon { height: 18px; opacity: 0.8; }

/* =========================
   CARD
========================= */
.container {
    width: 100%;
    max-width: 920px;
    max-height: calc(100vh - 116px);
    max-height: calc(100dvh - 116px);
    max-height: calc(var(--app-vh, 100dvh) - 116px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0 36px;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    animation: cardIn 0.45s var(--ease) both;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-ring) transparent;
}
.container::-webkit-scrollbar      { width: 10px; }
.container::-webkit-scrollbar-track{ background: transparent; }
.container::-webkit-scrollbar-thumb{ background: var(--accent-ring); border-radius: 999px; }

@keyframes cardIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =========================
   HEADER (sticky)
========================= */
.header {
    position: sticky;
    top: 0;
    z-index: 5;
    margin: 0 -36px;
    padding: 22px 36px 16px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.05) 70%),
        rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    border-bottom: 1px solid transparent;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.7),
        0 0 0 0 rgba(15, 23, 42, 0);
    transition: padding 0.2s var(--ease),
                box-shadow 0.25s var(--ease),
                border-color 0.25s var(--ease);
}

/* Compact variant + visible separator once the content scrolls past the header */
.container.scrolled .header {
    padding: 10px 36px;
    border-bottom-color: rgba(255, 255, 255, 0.35);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.7),
        0 10px 30px -14px rgba(15, 23, 42, 0.2);
}

@media (prefers-color-scheme: dark) {
    .header {
        background:
            linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0) 70%),
            rgba(20, 25, 40, 0.55);
        border-bottom-color: transparent;
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.08),
            0 0 0 0 rgba(0, 0, 0, 0);
    }
    .container.scrolled .header {
        border-bottom-color: rgba(255, 255, 255, 0.08);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.08),
            0 10px 30px -14px rgba(0, 0, 0, 0.55);
    }
}
.container.scrolled .header-text h2 { font-size: 16px; }
.container.scrolled .header-text .desc { display: none; }

.header-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-text {
    flex: 1;
    min-width: 0;
}
.header-text h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    transition: font-size 0.2s var(--ease);
    letter-spacing: -0.01em;
}
.header-text .desc {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--muted);
}

.header-search-toggle {
    flex-shrink: 0;
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.15s var(--ease);
}
.header-search-toggle:hover,
.header-search-toggle.active {
    background: var(--surface-hover);
    border-color: var(--accent-ring);
    color: var(--accent);
}
.header-search-toggle svg { width: 16px; height: 16px; }

.header-search-input {
    display: none;
    width: 240px;
    max-width: 40%;
    margin-left: auto;
    height: 36px;
    padding: 0 12px;
    font: inherit;
    font-size: 14px;
    color: var(--text);
    background: var(--surface-input);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    outline: none;
}
.header.search-open .header-search-input { display: block; }
.header-search-input:focus {
    border-color: var(--accent-ring);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* =========================
   TREE
========================= */
.tree-wrapper {
    padding: 8px 0 24px;
    flex: 1;
    min-width: 0;
    max-width: 100%;
    min-height: 0;
    overflow-x: hidden;
}

.tree-item-wrapper {
    animation: rowIn 0.35s var(--ease) both;
    border-radius: var(--radius-sm);
    transition: background 0.15s var(--ease);
}
@keyframes rowIn {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* Stagger the first few rows so a freshly loaded list cascades in */
.tree-root > .tree-item-wrapper:nth-child(1)  { animation-delay: 0.02s; }
.tree-root > .tree-item-wrapper:nth-child(2)  { animation-delay: 0.05s; }
.tree-root > .tree-item-wrapper:nth-child(3)  { animation-delay: 0.08s; }
.tree-root > .tree-item-wrapper:nth-child(4)  { animation-delay: 0.11s; }
.tree-root > .tree-item-wrapper:nth-child(5)  { animation-delay: 0.14s; }
.tree-root > .tree-item-wrapper:nth-child(6)  { animation-delay: 0.17s; }
.tree-root > .tree-item-wrapper:nth-child(7)  { animation-delay: 0.20s; }
.tree-root > .tree-item-wrapper:nth-child(8)  { animation-delay: 0.23s; }
.tree-root > .tree-item-wrapper:nth-child(9)  { animation-delay: 0.26s; }
.tree-root > .tree-item-wrapper:nth-child(n + 10) { animation-delay: 0.28s; }

.tree-item-wrapper.selected > .tree-item {
    background: var(--accent-soft);
    outline: 1px solid var(--accent-ring);
}

.tree-item-wrapper { max-width: 100%; min-width: 0; }

.tree-item {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin: 2px 0;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    border-radius: var(--radius-md);
    transition: background 0.2s var(--ease), transform 0.2s var(--ease);
    user-select: none;
}

/* Accent rail that slides in on hover */
.tree-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0.4);
    width: 3px;
    height: 60%;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--accent), var(--accent-2));
    opacity: 0;
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.tree-item:hover { background: var(--surface-hover); }
.tree-item:hover::before { opacity: 1; transform: translateY(-50%) scaleY(1); }

.tree-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    cursor: default;
}
.tree-left.folder { cursor: pointer; }

/* Folder icon flips between closed / open variants via JS; no separate chevron */

.tree-icon {
    width: 26px; height: 26px;
    flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    overflow: hidden;
    border-radius: 6px;
    transition: transform 0.25s var(--ease);
}
.tree-icon svg { width: 22px; height: 22px; }

.folder-icon { color: var(--folder); }
.folder-icon svg { width: 22px; height: 22px; }

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

.tree-left:hover .tree-icon { transform: scale(1.06); }

.tree-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: var(--surface-hover);
}

.tree-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.35;
}
.tree-left.folder .tree-name {
    font-weight: 600;
    color: var(--text);
}

.children {
    margin-left: 22px;
    padding-left: 14px;
    border-left: 1px dashed var(--line-strong);
    overflow: hidden;
    animation: expand 0.3s var(--ease);
}
@keyframes expand {
    from { opacity: 0; transform: translateY(-4px); max-height: 0; }
    to   { opacity: 1; transform: translateY(0); max-height: 2000px; }
}

/* =========================
   FILE ACTIONS
========================= */
.file-actions {
    display: inline-flex;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 0.15s var(--ease);
}
.tree-item:hover .file-actions { opacity: 1; }

.preview-btn, .download-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    display: inline-flex; align-items: center; justify-content: center;
    transition: all 0.15s var(--ease);
}
.preview-btn:hover, .download-btn:hover {
    background: var(--accent-soft);
    border-color: var(--accent-ring);
    color: var(--accent);
}
.preview-btn svg, .download-btn svg { width: 14px; height: 14px; }

/* =========================
   SELECTION CHECKBOX
========================= */
.selection-check {
    background: transparent; border: none; cursor: pointer; padding: 0;
    width: 24px; height: 24px;
    color: var(--muted);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.selection-check svg { width: 20px; height: 20px; }
.tree-item-wrapper.selected .selection-check { color: var(--accent); }

/* =========================
   CONTAINER ACTIONS (bottom of card)
========================= */
.container-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin: auto -36px 0;
    padding: 12px 24px 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
    min-width: 0;
    box-sizing: border-box;
    background: transparent;
    border-top: 1px solid transparent;
    transition: background 0.2s var(--ease),
                border-color 0.2s var(--ease),
                box-shadow 0.2s var(--ease);
}
.container-actions.selection-mode {
    justify-content: flex-start;
    padding: 14px 24px;
    gap: 10px;
}

.sel-cancel,
.sel-count,
.sel-actions { min-width: 0; }

/* Liquid-glass effect when there is content underneath the action bar */
.container.has-overflow-bottom .container-actions {
    background:
        linear-gradient(0deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 60%),
        var(--top-bar-bg);
    backdrop-filter: blur(34px) saturate(200%) brightness(1.04);
    -webkit-backdrop-filter: blur(34px) saturate(200%) brightness(1.04);
    border-top-color: rgba(255, 255, 255, 0.16);
    box-shadow:
        inset 0 -1px 0 rgba(255, 255, 255, 0.5),
        inset 0 0 0 1px rgba(255, 255, 255, 0.08),
        0 -8px 24px -12px rgba(15, 23, 42, 0.18);
}

@media (prefers-color-scheme: dark) {
    .container.has-overflow-bottom .container-actions {
        background:
            linear-gradient(0deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0) 60%),
            var(--top-bar-bg);
        border-top-color: rgba(255, 255, 255, 0.06);
        box-shadow:
            inset 0 -1px 0 rgba(255, 255, 255, 0.08),
            inset 0 0 0 1px rgba(255, 255, 255, 0.04),
            0 -10px 30px -12px rgba(0, 0, 0, 0.55);
    }
}

.container-action-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted);
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s var(--ease);
    opacity: 0.7;
}
.container-action-btn svg { width: 14px; height: 14px; }
.container-action-btn:hover {
    opacity: 1;
    background: var(--surface-hover);
    border-color: var(--line);
    color: var(--text);
}

/* Selection-bar items */
.sel-cancel {
    background: none; border: none; cursor: pointer;
    color: var(--muted); padding: 6px;
    border-radius: var(--radius-sm);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.sel-cancel svg { width: 14px; height: 14px; }
.sel-cancel:hover { color: var(--text); }

.sel-count {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.sel-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-wrap: nowrap;
    min-width: 0;
}

.sel-btn {
    background: var(--surface-raised);
    border: 1px solid var(--line-strong);
    color: var(--text);
    cursor: pointer;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 13px;
    white-space: nowrap;
    transition: all 0.15s var(--ease);
    display: inline-flex; align-items: center; gap: 6px;
}
.sel-btn svg { width: 12px; height: 12px; }
.sel-btn:hover:not([disabled]) {
    background: var(--accent-soft);
    border-color: var(--accent-ring);
    color: var(--accent);
}
.sel-btn[disabled] { opacity: 0.4; cursor: not-allowed; }

.sel-download {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}
.sel-download:hover:not([disabled]) { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }

/* =========================
   SEARCH RESULTS
========================= */
.search-results { display: flex; flex-direction: column; gap: 2px; padding: 4px 0; }

.search-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.15s var(--ease);
}
.search-result:hover { background: var(--surface-hover); }

.search-result-icon {
    width: 24px; height: 24px;
    color: var(--muted);
    flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    overflow: hidden;
    border-radius: 4px;
}
.search-result-icon svg { width: 22px; height: 22px; }
.search-result-icon .tree-thumbnail { width: 100%; height: 100%; }
.search-result-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.search-result-name {
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.search-result-path {
    font-size: 12px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.search-result-actions { display: inline-flex; gap: 4px; flex-shrink: 0; }

/* =========================
   STATES
========================= */
.empty, .folder-loading {
    color: var(--muted);
    padding: 12px;
    font-size: 13px;
    font-style: italic;
}

.center {
    margin: auto;
    width: 100%;
    max-width: 360px;
    text-align: center;
    color: var(--text);
}
.center.error h3 { color: var(--danger); }

.loader {
    margin: 0 auto 16px;
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 3px solid var(--accent-soft);
    border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
}
.mini-loader {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 2px solid var(--accent-soft);
    border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
    flex-shrink: 0;
}

/* Spinner inside the indigo Download button needs white colours to be visible */
.sel-download .mini-loader {
    border-color: rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
}
@keyframes spin { to { transform: rotate(360deg); } }

.folder-loading {
    display: flex; align-items: center;
    padding: 8px 12px;
}

/* =========================
   PASSWORD SCREEN
========================= */
.password {
    margin: auto;
    padding: 32px 28px;
    width: 100%;
    max-width: 420px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    text-align: center;
    box-sizing: border-box;
}
.password h2 { margin: 0 0 22px; font-size: 20px; }
.password .desc, .password p { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.password-icon { font-size: 32px; margin-bottom: 8px; }
.password input {
    width: 100%; height: 40px;
    padding: 0 12px;
    font: inherit; font-size: 14px;
    background: var(--surface-input);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    outline: none;
    margin-bottom: 12px;
}
.password input:focus { border-color: var(--accent-ring); box-shadow: 0 0 0 3px var(--accent-soft); }
.password-submit {
    width: 100%; height: 40px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font: inherit; font-size: 14px; font-weight: 600;
    cursor: pointer;
    transition: background 0.15s var(--ease);
}
.password-submit:hover { background: var(--accent-2); }

/* =========================
   MOBILE
========================= */
@media (max-width: 768px) {
    .page { grid-template-rows: 60px 1fr 52px; }
    .top-bar, .bottom-bar {
        padding: 0 16px;
        background: var(--top-bar-bg);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }
    .top-bar    { border-bottom: 1px solid var(--line); }
    .bottom-bar { border-top: 1px solid var(--line); }
    .top-logo { height: 24px; max-width: 180px; }

    .page-content { padding: 0; }
    .container {
        max-width: 100%;
        max-height: calc(100vh - 112px);
        max-height: calc(100dvh - 112px);
        max-height: calc(var(--app-vh, 100dvh) - 112px);
        padding: 0 22px 0 14px;
        border-radius: 0;
        border-left: none; border-right: none;
    }

    .header { margin: 0 -22px 0 -14px; padding: 18px 22px 12px 14px; }
    .container.scrolled .header { padding: 8px 22px 8px 14px; }
    .container.scrolled .header-text h2 { font-size: 14px; }
    .header-text { flex: 1; min-width: 0; }
    .header-text h2 { font-size: 18px; }
    .header-search-toggle { width: 30px; height: 30px; flex-shrink: 0; }
    .header-search-toggle svg { width: 14px; height: 14px; }
    .header.search-open .header-text { display: none; }
    .header.search-open .header-search-input {
        flex: 1;
        max-width: none;
        height: 32px;
        font-size: 13px;
        margin-left: 0;
    }

    .tree-item { padding: 8px 6px; gap: 6px; margin: 1px 0; align-items: flex-start; }
    .tree-icon { width: 22px; height: 22px; margin-top: 2px; }
    .tree-icon svg { width: 20px; height: 20px; }
    .folder-icon svg { width: 18px; height: 18px; }
    .tree-name {
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
        line-height: 1.3;
    }
    .file-actions { opacity: 1; gap: 2px; margin-top: 2px; }
    .preview-btn, .download-btn { padding: 5px; }
    .preview-btn svg, .download-btn svg { width: 12px; height: 12px; }
    .children { margin-left: 10px; padding-left: 8px; }

    .container-actions { margin: auto -22px 0 -14px; padding: 8px 18px 12px 14px; justify-content: flex-start; }
    .container-actions.selection-mode {
        padding: 8px 18px 8px 14px;
        gap: 6px;
        width: 100%;
        max-width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }
    .sel-count           { font-size: 12px; }
    .sel-btn             { padding: 6px 8px; font-size: 11px; gap: 4px; flex-shrink: 0; }
    .sel-btn svg         { width: 12px; height: 12px; }
    .sel-actions         {
        gap: 4px;
        flex-wrap: wrap;
        margin-left: 0;
        min-width: 0;
    }
    .sel-cancel          { padding: 5px; flex-shrink: 0; }
    .sel-cancel svg      { width: 14px; height: 14px; }

    .bottom-bar {
        justify-content: center;
        width: 100%;
        overflow: hidden;
    }
    .footer-brand        { font-size: 12px; min-width: 0; max-width: 100%; }
    .footer-brand span   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

