/* Explorer layout with sidebar */
.explorer-layout {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}
.explorer-main { min-width: 0; }
.explorer-create-panel {
    background: #fff;
    border: 1px dashed #d1d5db;
    border-radius: 12px;
    overflow: hidden;
}
.explorer-create-panel .upload-zone {
    border: 0;
    border-radius: 0;
    margin: 0;
}
.new-folder-form, .folder-upload-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    padding: 14px 24px;
}
.upload-zone ~ .new-folder-form, .folder-upload-form, .folder-upload-form + .new-folder-form { border-top: 1px solid #f0f1f3; }
.new-folder-form input { flex: 0 1 300px; min-width: 0; }
.folder-upload-form input { flex: 0 1 300px; min-width: 0; }
.folder-upload-status { flex-basis: 100%; }
.folder-upload-status:empty { display: none; }
.explorer-executable-warning { margin: 0 24px 12px; }
#executable-warning[hidden] { display: none; }
.trash-panel .file-list-head,
.trash-panel .file-row {
    grid-template-columns: minmax(180px, 1fr) 90px 140px 140px minmax(125px, auto);
    align-items: center;
    gap: 12px;
}
.trash-panel .file-actions { justify-content: flex-end; }
.trash-panel .file-actions form { max-width: 280px; }
.trash-mobile-label { display: none; }
.explorer-layout .sidebar-panel {
    background: #fff;
    border: 1px solid rgba(17, 24, 39, .08);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(17, 24, 39, .02);
    padding: 1rem 1rem 1.25rem;
    position: sticky;
    top: 1rem;
}
.explorer-layout .sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .75rem;
}
.explorer-layout .sidebar-header a {
    font-size: .875rem;
    color: var(--nc-color-muted, #6b7280);
    text-decoration: none;
}
.explorer-layout .sidebar-header a:hover {
    color: var(--nc-color-text, #111827);
}
.explorer-layout .sidebar-empty {
    color: var(--nc-color-muted, #6b7280);
    font-size: .875rem;
    margin: 0;
}

.folder-tree {
    list-style: none;
    margin: 0;
    padding: 0;
}
.folder-tree .folder-tree {
    padding-left: calc((var(--depth, 0) + 1) * .75rem);
}
.folder-tree-item {
    position: relative;
}
.folder-tree-link {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .375rem .5rem .375rem calc(var(--depth, 0) * .75rem + .25rem);
    border-radius: 8px;
    text-decoration: none;
    color: var(--nc-color-text, #111827);
    font-size: .9rem;
}
.folder-tree-link:hover {
    background: rgba(17, 24, 39, .03);
}
.folder-tree-item.is-active > .folder-tree-link {
    background: rgba(220, 38, 38, .08);
    color: var(--nc-color-accent, #dc2626);
    font-weight: 600;
}
.folder-tree .tree-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%236b7280' d='M1.75 2A1.75 1.75 0 0 0 0 3.75v8.5C0 13.216.784 14 1.75 14h12.5A1.75 1.75 0 0 0 16 12.25v-6.5A1.75 1.75 0 0 0 14.25 4H8.061a1.75 1.75 0 0 1-1.238-.513L6.197 2.513A1.75 1.75 0 0 0 4.959 2H1.75Z'/%3E%3C/svg%3E") no-repeat center / contain;
}
.folder-tree-item.is-active > .folder-tree-link .tree-icon {
    filter: brightness(0) saturate(100%) invert(18%) sepia(94%) saturate(7493%) hue-rotate(353deg) brightness(91%) contrast(96%);
}
.folder-tree .tree-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* File thumbnails and icons */
.file-thumb {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(17, 24, 39, .06);
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}
.file-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.file-thumb-fallback {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7280' d='M4 4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.586A2 2 0 0 1 11 5.586L9.414 4H4Z'/%3E%3C/svg%3E") no-repeat center / 20px;
}
.file-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 22px;
}
.file-icon-file {
    background-color: rgba(107, 114, 128, .08);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%234b5563' d='M6 2h9l5 5v15a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1Zm8 1.5V8h4.5L14 3.5Z'/%3E%3C/svg%3E");
}
.file-icon-pdf {
    background-color: rgba(220, 38, 38, .08);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23dc2626' d='M6 2h9l5 5v15a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1Zm8 1.5V8h4.5L14 3.5ZM8 13.5v2H7v-5h2.5a1.5 1.5 0 0 1 0 3H8Zm0-1.5h1.5a.5.5 0 0 0 0-1H8v1Zm5 .5h-2v1h2v1.5h-3.5v-5H13v1.5h-2v1h2v1Zm3.5-.5a1 1 0 0 1 1 1v1.5a1 1 0 0 1-1 1H15v-5h1.5Zm-.5 2h1v-1h-1v1Z'/%3E%3C/svg%3E");
}
.file-icon-xls {
    background-color: rgba(16, 185, 129, .08);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%230f9f6e' d='M6 2h9l5 5v15a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1Zm8 1.5V8h4.5L14 3.5ZM8 12.5l1.5 2 1.5-2h1.5l-2.25 3 2.25 3H12l-1.5-2-1.5 2H7.5l2.25-3-2.25-3H8Zm5 1v1h2v-1h-2Zm0 2v1h2v-1h-2Z'/%3E%3C/svg%3E");
}
.file-icon-doc {
    background-color: rgba(59, 130, 246, .08);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%232563eb' d='M6 2h9l5 5v15a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1Zm8 1.5V8h4.5L14 3.5ZM8 11h5v1H8v-1Zm0 2h5v1H8v-1Zm0 2h3v1H8v-1Z'/%3E%3C/svg%3E");
}
.file-icon-zip {
    background-color: rgba(234, 179, 8, .12);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23b45309' d='M6 2h9l5 5v15a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1Zm8 1.5V8h4.5L14 3.5ZM11 9v2h-1v-2h1Zm0 2h1v2h-1v-2Zm0 2v2h-1v-2h1Zm0 2h1v2h-1v-2Zm0 2v2h-1v-2h1Z'/%3E%3C/svg%3E");
}
.file-icon-video {
    background-color: rgba(168, 85, 247, .08);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%237e22ce' d='M6 2h9l5 5v15a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1Zm8 1.5V8h4.5L14 3.5ZM10 12v5l4-2.5-4-2.5Z'/%3E%3C/svg%3E");
}
.file-icon-audio {
    background-color: rgba(14, 165, 233, .08);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%230284c7' d='M6 2h9l5 5v15a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1Zm8 1.5V8h4.5L14 3.5ZM12 11a3 3 0 0 0-3 3v1a3 3 0 1 0 6 0v-1a3 3 0 0 0-3-3Zm0 1.5a1.5 1.5 0 0 1 1.5 1.5v1a1.5 1.5 0 1 1-3 0v-1a1.5 1.5 0 0 1 1.5-1.5Z'/%3E%3C/svg%3E");
}
.file-icon-txt {
    background-color: rgba(107, 114, 128, .08);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%234b5563' d='M6 2h9l5 5v15a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1Zm8 1.5V8h4.5L14 3.5ZM8 12h5v1H8v-1Zm0 2h5v1H8v-1Zm0 2h3v1H8v-1Z'/%3E%3C/svg%3E");
}

@media (max-width: 991.98px) {
    .explorer-layout { grid-template-columns: 1fr; }
    .explorer-layout .sidebar-panel {
        position: static;
    }
}
@media (max-width: 767.98px) {
    .trash-panel .file-row { display: flex; flex-wrap: wrap; gap: 8px 16px; }
    .trash-panel .file-name, .trash-panel .file-actions { flex: 1 0 100%; }
    .trash-panel .file-actions { justify-content: flex-start; }
    .trash-panel .file-meta { font-size: .75rem; }
    .trash-mobile-label { display: inline; }
}
@media (max-width: 479.98px) {
    .new-folder-form, .folder-upload-form { padding: 14px 18px; }
    .new-folder-form label, .folder-upload-form label { flex-basis: 100%; }
    .new-folder-form input, .folder-upload-form input { flex: 1 1 150px; }
    .explorer-executable-warning { margin-inline: 18px; }
}
