/* Artifis Drive — UI */

:root {
    --bg: #f7f8fa;
    --bg-elev: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-hover: #eef0f4;
    --bg-active: #e6ecff;
    --bg-dropzone: #f0f4ff;
    --border: #e6e8ee;
    --border-strong: #d4d7df;
    --text: #1a1d24;
    --text-muted: #5f6470;
    --text-faint: #9ba0ad;
    --primary: #4f6dff;
    --primary-hover: #3f5cee;
    --primary-soft: rgba(79, 109, 255, 0.08);
    --danger: #e23f3f;
    --warning: #d68512;
    --success: #1f9d55;
    --star: #f1b418;
    --shadow-sm: 0 1px 2px rgba(20, 25, 50, 0.05), 0 1px 1px rgba(20, 25, 50, 0.04);
    --shadow-md: 0 4px 12px rgba(20, 25, 50, 0.08), 0 1px 2px rgba(20, 25, 50, 0.04);
    --shadow-lg: 0 12px 32px rgba(20, 25, 50, 0.18);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --sidebar-w: 260px;
    --topbar-h: 60px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1115;
        --bg-elev: #181b21;
        --bg-sidebar: #14171c;
        --bg-hover: #20242c;
        --bg-active: #2c3550;
        --bg-dropzone: #1a2138;
        --border: #262a33;
        --border-strong: #353a45;
        --text: #e6e8ee;
        --text-muted: #9aa0ad;
        --text-faint: #6c7180;
        --primary: #6b86ff;
        --primary-hover: #809aff;
        --primary-soft: rgba(107, 134, 255, 0.12);
        --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    }
}

* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
body { min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

.muted { color: var(--text-muted); }
.hidden { display: none !important; }
[hidden] { display: none !important; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 38px; padding: 0 16px;
    border: 1px solid var(--border);
    background: var(--bg-elev);
    color: var(--text);
    border-radius: var(--radius-md);
    font-weight: 500; font-size: 14px;
    transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--bg-hover); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-small { height: 30px; padding: 0 12px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.95); }
.btn-ghost { background: transparent; border: none; }
.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    background: transparent; border: none;
    color: var(--text-muted); border-radius: 8px;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text); }

/* ===== Forms ===== */
.field {
    display: flex; flex-direction: column; gap: 6px;
    margin-bottom: 14px;
}
.field > span { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.field input, .field select, .field textarea {
    border: 1px solid var(--border-strong);
    background: var(--bg-elev);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ===== Auth ===== */
.auth-page { background: var(--bg); }
.auth {
    min-height: 100vh;
    display: grid; place-items: center;
    padding: 24px;
}
.auth-card {
    width: 100%; max-width: 400px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-md);
}
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-logo {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, var(--primary), #8c63ff);
    border-radius: 14px;
    margin: 0 auto 16px;
    box-shadow: 0 4px 16px rgba(79, 109, 255, 0.3);
}
.auth-brand h1 { margin: 0; font-size: 22px; }
.auth-subtitle { margin: 4px 0 0; color: var(--text-muted); font-size: 14px; }
.auth-error {
    background: rgba(226, 63, 63, 0.08);
    border: 1px solid rgba(226, 63, 63, 0.25);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    margin-bottom: 16px;
}
.auth-foot { text-align: center; margin: 16px 0 0; font-size: 13px; color: var(--text-muted); }
.auth .btn-primary { width: 100%; height: 42px; }

/* ===== App layout ===== */
.app-page { overflow: hidden; }
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    padding: 16px;
    gap: 16px;
    overflow-y: auto;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 4px 4px;
}
.brand-mark {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--primary), #8c63ff);
    border-radius: 8px;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 14px; }
.brand-sub { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn-new { width: 100%; height: 42px; font-weight: 600; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 500;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--bg-active); color: var(--primary); }
.nav-item.active svg { stroke: var(--primary); }
.nav-item svg { flex-shrink: 0; }
.nav-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.storage { padding: 4px; font-size: 12px; }
.storage-bar {
    height: 6px; background: var(--bg-hover);
    border-radius: 999px; overflow: hidden;
    margin-bottom: 6px;
}
.storage-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #8c63ff);
    transition: width .3s;
}
.storage-text { color: var(--text-muted); }

.user-row {
    display: flex; align-items: center; gap: 8px;
    padding: 8px;
    border-top: 1px solid var(--border);
    padding-top: 14px;
}
.user-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    display: grid; place-items: center;
    font-weight: 600; font-size: 13px;
    flex-shrink: 0;
}
.user-info { min-width: 0; flex: 1; }
.user-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-email { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Content */
.content { display: flex; flex-direction: column; overflow: hidden; }
.topbar {
    height: var(--topbar-h);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elev);
    gap: 16px;
    flex-shrink: 0;
}
.breadcrumbs {
    display: flex; align-items: center; gap: 6px;
    font-size: 18px; font-weight: 600;
    min-width: 0;
    overflow: hidden;
}
.breadcrumbs a, .breadcrumbs span {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    max-width: 280px;
}
.breadcrumbs a {
    color: var(--text-muted); cursor: pointer;
    transition: color .15s;
}
.breadcrumbs a:hover { color: var(--text); }
.breadcrumb-sep { color: var(--text-faint); font-weight: 400; }
.breadcrumb-current { color: var(--text); }

.topbar-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.search {
    position: relative;
    display: flex; align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0 14px;
    transition: border-color .15s, box-shadow .15s;
}
.search:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.search svg { color: var(--text-muted); margin-right: 8px; }
.search input {
    border: none; background: transparent; outline: none;
    padding: 8px 0; width: 320px;
}

.view-toggle {
    display: flex; background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 2px;
}
.view-toggle button {
    width: 32px; height: 28px;
    background: transparent; border: none;
    color: var(--text-muted); border-radius: 6px;
    display: grid; place-items: center;
}
.view-toggle button.active { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-sm); }

/* Dropzone & content pane */
.dropzone {
    flex: 1; overflow: hidden;
    position: relative;
    display: flex; flex-direction: column;
}
.dropzone.is-dragging { background: var(--bg-dropzone); }
.dropzone-hint {
    display: none;
    position: absolute; inset: 16px;
    background: var(--primary-soft);
    border: 2px dashed var(--primary);
    border-radius: var(--radius-lg);
    align-items: center; justify-content: center;
    flex-direction: column; gap: 12px;
    color: var(--primary);
    font-weight: 600; font-size: 18px;
    pointer-events: none;
    z-index: 5;
}
.dropzone.is-dragging .dropzone-hint { display: flex; }
.dz-icon { font-size: 36px; }

.content-pane {
    flex: 1; overflow-y: auto;
    padding: 24px;
}

/* Section heads inside content pane */
.section-head {
    display: flex; align-items: center; justify-content: space-between;
    margin: 8px 0 16px;
}
.section-head h2 { margin: 0; font-size: 14px; color: var(--text-muted); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }

/* ===== Grid view ===== */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.item {
    position: relative;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .05s;
    overflow: hidden;
    user-select: none;
}
.item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.item.is-selected { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--shadow-sm); }
.item.is-folder .item-thumb { background: var(--primary-soft); }
.item.is-uploading { opacity: 0.6; }

.item-thumb {
    height: 110px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    display: grid; place-items: center;
    margin-bottom: 10px;
    color: var(--primary);
    overflow: hidden;
}
.item-thumb img {
    width: 100%; height: 100%; object-fit: cover;
}
.item-thumb svg { width: 40%; max-width: 60px; opacity: 0.85; }
.item-name {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 500;
    overflow: hidden;
}
.item-name span {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;
}
.item-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.item-star {
    position: absolute; top: 8px; right: 8px;
    background: rgba(255,255,255,.85);
    border-radius: 50%;
    width: 26px; height: 26px;
    display: none; align-items: center; justify-content: center;
    color: var(--text-faint);
}
@media (prefers-color-scheme: dark) {
    .item-star { background: rgba(0,0,0,.4); }
}
.item:hover .item-star { display: flex; }
.item-star.active { display: flex; color: var(--star); }

/* ===== List view ===== */
.items-list { width: 100%; }
.items-list-head, .items-list-row {
    display: grid;
    grid-template-columns: 1fr 140px 160px 60px;
    gap: 16px;
    align-items: center;
    padding: 10px 12px;
}
.items-list-head {
    font-size: 12px; color: var(--text-muted); font-weight: 600;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase; letter-spacing: .04em;
}
.items-list-row {
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background .1s;
}
.items-list-row:hover { background: var(--bg-hover); }
.items-list-row.is-selected { background: var(--primary-soft); }
.list-name { display: flex; align-items: center; gap: 12px; overflow: hidden; }
.list-name .item-thumb-sm {
    width: 32px; height: 32px;
    border-radius: 6px;
    background: var(--bg-hover);
    display: grid; place-items: center;
    color: var(--primary);
    flex-shrink: 0;
}
.list-name .item-thumb-sm.is-folder { background: var(--primary-soft); }
.list-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-meta { font-size: 13px; color: var(--text-muted); }

/* Empty state */
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 60vh; gap: 16px;
    color: var(--text-muted);
}
.empty-icon { font-size: 48px; opacity: .4; }
.empty-state h3 { margin: 0; color: var(--text); font-size: 18px; }
.empty-state p { margin: 0; }

/* Popovers / menus */
.popover {
    position: absolute;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 6px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    min-width: 200px;
    display: flex; flex-direction: column;
    gap: 1px;
}
.popover button, .popover .item-action {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px;
    border: none; background: transparent;
    color: var(--text);
    border-radius: var(--radius-sm);
    text-align: left;
    width: 100%;
    font-size: 13px;
}
.popover button:hover, .popover .item-action:hover { background: var(--bg-hover); }
.popover .danger { color: var(--danger); }
.popover-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* Modal */
.modal {
    position: fixed; inset: 0;
    z-index: 2000;
    display: flex; align-items: center; justify-content: center;
}
.modal[hidden] { display: none; }
.modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(10, 12, 20, 0.5);
    backdrop-filter: blur(2px);
}
.modal-window {
    position: relative;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%; max-width: 500px;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}
.modal-window h2 { margin: 0 0 6px; font-size: 18px; }
.modal-window .modal-sub { color: var(--text-muted); margin: 0 0 18px; font-size: 13px; }
.modal-actions {
    display: flex; gap: 10px; justify-content: flex-end;
    margin-top: 20px;
}

/* Share dialog */
.share-link-row {
    display: flex; gap: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 8px;
    align-items: center;
    margin-bottom: 16px;
}
.share-link-row input {
    flex: 1; border: none; background: transparent;
    outline: none; font-family: ui-monospace, "SF Mono", "Menlo", monospace;
    font-size: 13px;
    color: var(--text);
}

.share-existing-list {
    margin-top: 16px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}
.share-existing-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 0;
}
.share-existing-meta {
    flex: 1;
    font-size: 12px; color: var(--text-muted);
    overflow: hidden;
}
.share-existing-meta strong {
    color: var(--text);
    font-family: ui-monospace, "SF Mono", "Menlo", monospace;
    font-size: 12px;
}
.share-perm-pill {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    background: var(--bg-hover);
    color: var(--text-muted);
}
.share-perm-pill.download { background: var(--primary-soft); color: var(--primary); }
.share-perm-pill.view { background: rgba(214, 133, 18, 0.12); color: var(--warning); }
.share-perm-pill.upload { background: rgba(31, 157, 85, 0.12); color: var(--success); }
.share-upload-hint {
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 14px;
}

/* Uploads */
.uploads {
    position: fixed; bottom: 16px; right: 16px;
    width: 360px; max-height: 60vh;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1500;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.uploads-head {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    font-weight: 600; font-size: 13px;
}
.uploads-list {
    overflow-y: auto;
    padding: 8px;
    flex: 1;
}
.upload-item { padding: 8px; }
.upload-name {
    font-size: 13px; margin-bottom: 4px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
}
.upload-name span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-bar {
    height: 4px; background: var(--bg-hover);
    border-radius: 999px; overflow: hidden;
}
.upload-fill {
    height: 100%; background: var(--primary);
    transition: width .15s;
}
.upload-fill.error { background: var(--danger); }
.upload-fill.done { background: var(--success); }

/* Toasts */
.toasts {
    position: fixed; top: 20px; right: 20px;
    z-index: 3000;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    box-shadow: var(--shadow-md);
    font-size: 13px;
    min-width: 240px; max-width: 360px;
    animation: toastIn .2s ease-out;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
@keyframes toastIn {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* File icons (placeholder SVG-like shapes via mask or just colored squares) */
.icon-folder, .icon-file, .icon-image, .icon-video, .icon-audio, .icon-pdf, .icon-archive,
.icon-doc, .icon-sheet, .icon-slide, .icon-code {
    background: var(--bg-hover);
    width: 60px; height: 60px;
    border-radius: 8px;
    display: inline-block;
}

/* Admin / users table */
.users-table {
    width: 100%;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.users-table-head, .users-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr 100px;
    gap: 12px;
    padding: 12px 16px;
    align-items: center;
}
.users-table-head {
    background: var(--bg);
    font-size: 12px; color: var(--text-muted); font-weight: 600;
    text-transform: uppercase; letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
}
.users-row + .users-row { border-top: 1px solid var(--border); }
.users-row:hover { background: var(--bg-hover); }
.user-cell-name strong { font-size: 14px; display: block; }
.user-cell-name span { font-size: 12px; color: var(--text-muted); }
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    background: var(--bg-hover);
    color: var(--text-muted);
}
.badge.admin { background: var(--primary-soft); color: var(--primary); }
.badge.disabled { background: rgba(226,63,63,0.12); color: var(--danger); }

/* Share public page */
.share-page-body { background: var(--bg); }
.share-page {
    min-height: 100vh;
    display: flex; flex-direction: column;
}
.share-header {
    height: 64px;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 32px;
}
.share-brand { display: flex; align-items: center; gap: 12px; }
.share-back { color: var(--primary); font-weight: 500; font-size: 14px; }
.share-body {
    flex: 1;
    max-width: 900px; width: 100%;
    margin: 0 auto;
    padding: 40px 32px;
}
.share-card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex; align-items: center; gap: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}
.share-meta { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 0; }
.share-meta .share-icon {
    width: 64px; height: 64px;
    background: var(--primary-soft); color: var(--primary);
    border-radius: 12px;
    flex-shrink: 0;
}
.share-title { margin: 0; font-size: 18px; }
.share-sub { margin: 4px 0 0; color: var(--text-muted); font-size: 13px; }

.share-preview {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
    background: var(--bg-elev);
}
.share-preview img, .share-preview video {
    display: block; width: 100%; max-height: 70vh; object-fit: contain;
    background: #000;
}
.share-preview audio { width: 100%; padding: 12px; }
.share-preview-pdf iframe { width: 100%; height: 80vh; border: none; }

.share-list {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.share-row {
    display: grid;
    grid-template-columns: 40px 1fr 100px 120px;
    gap: 12px;
    align-items: center;
    padding: 10px 16px;
}
.share-row + .share-row { border-top: 1px solid var(--border); }
.share-icon-sm {
    width: 32px; height: 32px;
    background: var(--bg-hover);
    border-radius: 6px;
}
.share-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.share-size { font-size: 12px; color: var(--text-muted); }
.share-actions { text-align: right; }
.share-foot { text-align: center; margin-top: 24px; font-size: 12px; }

/* Public upload share (file request) */
.upload-share-card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
}
.upload-zone {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    margin-top: 8px;
}
.upload-zone:hover, .upload-zone.is-dragging {
    border-color: var(--primary);
    background: var(--primary-soft);
}
.upload-zone-icon { color: var(--primary); margin-bottom: 8px; }
.upload-zone-title { font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.upload-zone-sub { color: var(--text-muted); font-size: 13px; }

.upload-share-list {
    margin-top: 20px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}
.upload-share-list-head {
    font-size: 12px; color: var(--text-muted); font-weight: 600;
    text-transform: uppercase; letter-spacing: .04em;
    margin-bottom: 8px;
}
.upload-share-row {
    display: grid;
    grid-template-columns: 1fr 120px 32px;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
}
.upload-share-row + .upload-share-row { border-top: 1px solid var(--border); }
.upload-share-row-name {
    font-size: 14px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.upload-share-row-size { font-size: 12px; }
.upload-share-row-bar {
    height: 4px; background: var(--bg-hover);
    border-radius: 999px; overflow: hidden;
}
.upload-share-row-fill {
    height: 100%; width: 0%;
    background: var(--primary);
    transition: width .15s;
}
.upload-share-row-fill.done { background: var(--success); }
.upload-share-row-fill.error { background: var(--danger); }
.upload-share-row-status { text-align: center; font-size: 16px; }
.upload-check { color: var(--success); }
.upload-x { color: var(--danger); cursor: help; }

/* Account page */
.account-card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    max-width: 540px;
    margin-bottom: 16px;
}
.account-card h3 { margin: 0 0 16px; font-size: 16px; }
.account-row {
    display: flex; justify-content: space-between;
    padding: 10px 0;
    font-size: 14px;
}
.account-row + .account-row { border-top: 1px solid var(--border); }
.account-row .muted { color: var(--text-muted); }

/* Responsive */
@media (max-width: 800px) {
    :root { --sidebar-w: 0; }
    .app { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .search input { width: 140px; }
    .topbar { padding: 0 16px; }
    .content-pane { padding: 16px; }
    .items-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .items-list-head, .items-list-row { grid-template-columns: 1fr 80px 40px; }
    .list-modified { display: none; }
}
/* ============= Mobile fixes for share view ============= */
@media (max-width: 720px) {
    .share-row {
        grid-template-columns: 32px 1fr auto;
        grid-template-areas:
            "icon name action"
            "icon size action";
        padding: 12px;
        gap: 2px 12px;
    }
    .share-icon-sm { grid-area: icon; align-self: center; }
    .share-name {
        grid-area: name;
        white-space: normal;
        word-break: break-word;
        font-weight: 500;
    }
    .share-size { grid-area: size; }
    .share-actions { grid-area: action; align-self: center; }

    /* Upload-progress rows */
    .upload-share-row {
        grid-template-columns: 1fr 32px;
        grid-template-areas:
            "name status"
            "bar  bar";
        gap: 6px 12px;
    }
    .upload-share-row-info { grid-area: name; }
    .upload-share-row-bar { grid-area: bar; }
    .upload-share-row-status { grid-area: status; }
    .upload-share-row-size { display: inline; margin-left: 8px; }

    /* Bigger, more obvious tap target on the upload zone */
    .upload-zone { padding: 32px 16px; }
    .upload-zone-title { font-size: 15px; }

    /* The new "Choose files" button shown on mobile */
    .upload-zone-btn {
        display: inline-block;
        margin-top: 16px;
        padding: 12px 24px;
        background: var(--primary);
        color: #fff;
        border-radius: var(--radius-md);
        font-weight: 600;
        cursor: pointer;
        border: none;
    }
    .upload-zone-btn:active { transform: scale(0.97); }
}

/* The "Choose files" button is hidden on desktop (drag/drop is fine there) */
@media (min-width: 721px) {
    .upload-zone-btn { display: none; }
}
/* Folder cover thumbnails — make injected <img> fit the existing thumb boxes */
.item-thumb-sm img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}
.item-thumb img {
    object-fit: cover;
}
/* Cover thumbnails in share view */
.share-icon.cover-thumb {
    width: 72px;
    height: 72px;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: var(--bg-hover);
}
.share-icon.cover-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.share-icon-sm.cover-thumb {
    overflow: hidden;
    background: var(--bg-hover);
}
.share-icon-sm.cover-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
