.band-files {
    --files-accent: #0067c0;
    --files-border: #d4d4d4;
    --files-muted: #616161;
    color: #242424;
    font-size: 0.86rem;
    line-height: 1.4;
}

.band-files [hidden] {
    display: none !important;
}

.band-files button,
.band-files input,
.band-files select {
    font: inherit;
}

.band-files button,
.band-files select {
    min-height: 30px;
}

.band-files button:focus-visible,
.band-files select:focus-visible,
.band-files input:focus-visible,
.band-files [tabindex]:focus-visible,
.files-manager-toggle:focus-within {
    outline: 2px solid var(--files-accent, #0067c0);
    outline-offset: 2px;
}

.band-files button:disabled,
.band-files input:disabled,
.band-files select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.band-files .btn-small {
    padding: 5px 9px;
    font-size: 0.78rem;
    white-space: normal;
}

.band-files .btn:not(.btn-primary):not(.btn-delete) {
    border: 1px solid #c8c8c8;
    background: #f3f3f3;
    color: #242424;
}

.band-files .btn:not(.btn-primary):not(.btn-delete):hover {
    background: #e5e5e5;
}

.band-files .btn-primary {
    background: #0067c0;
    color: #fff;
}

.band-files .btn-primary:hover {
    background: #005a9e;
}

.band-files .btn-delete {
    background: #fff0f0;
    color: #a12626;
    border: 1px solid #edc7c7;
}

.band-files .btn-delete:hover {
    background: #ffe0e0;
}

.files-toolbar,
.files-detail-heading,
.files-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.files-toolbar h3 {
    font-size: 1rem;
    color: #242424;
}

.files-muted,
.files-list-meta,
.files-read-legend {
    color: var(--files-muted);
    font-size: 0.79rem;
}

.files-status {
    min-height: 1.2em;
    margin: 6px 0 8px;
    color: var(--files-muted);
    font-size: 0.76rem;
}

.files-status.is-error,
.files-error {
    color: #a12626;
}

.files-layout {
    --files-sidebar-width: 338px;
    display: grid;
    grid-template-columns: minmax(273px, var(--files-sidebar-width)) 8px minmax(0, 1fr);
    border: 1px solid var(--files-border);
    border-radius: 4px;
    overflow: hidden;
    min-height: 420px;
}

.files-sidebar {
    padding: 12px 10px;
    background: #f3f3f3;
    min-width: 0;
}

.files-resizer {
    position: relative;
    min-width: 8px;
    background: #ededed;
    cursor: col-resize;
    touch-action: none;
    user-select: none;
}

.files-resizer::before {
    position: absolute;
    inset: 0 auto 0 3px;
    width: 1px;
    background: #c4c4c4;
    content: "";
}

.files-resizer:hover::before,
.files-resizer:focus-visible::before,
.files-layout.is-resizing .files-resizer::before {
    width: 2px;
    background: var(--files-accent);
}

.files-resizer:focus-visible {
    outline: 2px solid var(--files-accent);
    outline-offset: -2px;
}

.files-layout.is-resizing,
.files-layout.is-resizing * {
    cursor: col-resize;
    user-select: none;
}

.files-sidebar h4 {
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.band-files label {
    display: block;
    font-size: 0.74rem;
    font-weight: 600;
    margin-bottom: 3px;
}

.band-files select,
.band-files input[type="text"],
.band-files input[type="url"] {
    width: 100%;
    max-width: 100%;
    padding: 5px 7px;
    border: 1px solid #b8b8b8;
    border-radius: 2px;
    background: white;
    color: #242424;
}

.files-folder-tools {
    margin-top: 9px;
}

.files-folder-create {
    display: grid;
    gap: 4px;
}

.files-folder-create .btn {
    width: 100%;
}

.files-link-form {
    display: grid;
    gap: 4px;
    margin: 12px 0;
    padding-top: 9px;
    border-top: 1px solid #d8d8d8;
}

.files-link-form h4 {
    margin: 0 0 3px;
    font-size: 0.82rem;
}

.files-link-form .btn {
    width: 100%;
    margin-top: 3px;
}

.files-breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    margin: 8px 0;
}

.band-files .files-breadcrumb {
    min-height: 24px;
    padding: 2px 4px;
    border: 0;
    background: transparent;
    color: #0067c0;
    font-size: 0.74rem;
}

.band-files .files-breadcrumb[aria-current="location"] {
    color: #34415a;
    font-weight: 700;
    cursor: default;
}

.files-breadcrumb-separator {
    color: #8992a2;
    font-size: 0.78rem;
}

.files-read-legend {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 7px 0;
    font-size: 0.68rem;
}

.files-read-legend .is-read {
    margin-left: 10px;
}

.files-dot {
    display: inline-block;
    flex: 0 0 9px;
    width: 9px;
    height: 9px;
    border: 2px solid var(--files-accent);
    border-radius: 50%;
    background: var(--files-accent);
}

.files-dot.is-read {
    background: transparent;
}

.files-list {
    max-height: 340px;
    overflow-y: auto;
    padding: 2px;
    margin: 0 -2px;
    scrollbar-width: thin;
}

.files-tree-node,
.files-tree-row {
    min-width: 0;
}

.files-tree-row {
    display: flex;
    align-items: center;
    gap: 2px;
}

.band-files .files-tree-expander {
    display: inline-flex;
    flex: 0 0 18px;
    align-items: center;
    justify-content: center;
    width: 18px;
    min-height: 22px;
    padding: 0;
    border: 0;
    border-radius: 2px;
    background: transparent;
    color: #616161;
    font-size: 0.72rem;
    line-height: 1;
    cursor: pointer;
}

.band-files .files-tree-expander:hover {
    background: #e5e5e5;
}

.files-tree-expander.is-empty {
    pointer-events: none;
}

.files-tree-children {
    min-width: 0;
    margin-left: 9px;
    padding-left: 8px;
    border-left: 1px solid #d8d8d8;
}

.band-files .files-tree-folder {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 7px;
    width: 100%;
    min-width: 0;
    min-height: 26px;
    padding: 3px 5px;
    border: 1px solid transparent;
    border-radius: 2px;
    background: transparent;
    color: #242424;
    text-align: left;
    cursor: pointer;
}

.band-files .files-tree-folder:hover {
    background: #e9f3fb;
}

.band-files .files-tree-folder.is-current {
    border-color: #99c9f0;
    background: #cce8ff;
}

.files-tree-folder .files-filename {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.files-tree-folder .files-dot {
    flex: 0 0 9px;
}

.band-files .files-folder-delete {
    display: inline-flex;
    flex: 0 0 24px;
    align-items: center;
    justify-content: center;
    width: 24px;
    min-height: 24px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 2px;
    background: transparent;
    color: #805050;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.band-files .files-folder-delete:hover {
    border-color: #edc7c7;
    background: #fff0f0;
    color: #a12626;
}

.files-tree-file-group {
    min-width: 0;
    margin-top: 3px;
}

.files-category-icon {
    position: relative;
    z-index: 1;
    display: inline-flex;
    flex: 0 0 16px;
    width: 16px;
    height: 18px;
    align-items: center;
    justify-content: center;
    cursor: help;
    transition: transform 120ms ease, filter 120ms ease;
}

.files-category-icon svg {
    width: 14px;
    height: 14px;
    overflow: visible;
}

.files-category-icon svg path {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.4;
}

.files-category-icon svg text {
    fill: currentColor;
    font-family: sans-serif;
    font-size: 7px;
    font-weight: 700;
}

.files-category-icon:hover,
.files-list-item:focus-visible .files-category-icon {
    z-index: 2;
    transform: scale(1.18);
    filter: drop-shadow(0 1px 2px #0005);
}

.files-category-icon::after {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    z-index: 3;
    padding: 3px 6px;
    border: 1px solid #c8d0dc;
    border-radius: 3px;
    background: #fff;
    box-shadow: 0 2px 5px #0002;
    color: #242424;
    content: attr(data-category-name);
    font-size: 0.72rem;
    font-weight: 400;
    line-height: 1.2;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.files-category-icon:hover::after,
.files-list-item:focus-visible .files-category-icon::after {
    opacity: 1;
    visibility: visible;
}

.files-tree-children > .files-list-empty {
    padding: 7px 6px;
    font-size: 0.74rem;
}

.files-group + .files-group {
    margin-top: 9px;
}

.files-group-label {
    padding: 0 6px 3px;
    color: var(--files-muted);
    font-size: 0.67rem;
    letter-spacing: 0.03em;
    overflow-wrap: anywhere;
}

.files-list-item {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 7px;
    padding: 5px 6px;
    border: 1px solid transparent;
    border-radius: 2px;
    background: transparent;
    color: #242424;
    text-align: left;
    cursor: pointer;
}

.files-list-item:hover {
    background: #e9f3fb;
}

a.files-list-item {
    text-decoration: none;
}

a.files-list-item:focus-visible {
    outline: 2px solid var(--files-accent);
    outline-offset: 1px;
}

.files-list-item.is-selected {
    border-color: #99c9f0;
    background: #cce8ff;
}

.files-folder-icon {
    position: relative;
    flex: 0 0 18px;
    width: 18px;
    height: 13px;
    border: 1px solid #b78b2d;
    border-radius: 2px;
    background: #f2cf77;
}

.files-folder-icon::before {
    position: absolute;
    top: -4px;
    left: 1px;
    width: 8px;
    height: 4px;
    border: 1px solid #b78b2d;
    border-bottom: 0;
    border-radius: 2px 2px 0 0;
    background: #f2cf77;
    content: "";
}

.files-list-info,
.files-detail-info {
    min-width: 0;
}

.files-filename {
    display: block;
    overflow-wrap: anywhere;
    font-size: 0.78rem;
    font-weight: 500;
}

.files-list-meta {
    display: block;
    margin-top: 1px;
    font-size: 0.68rem;
}

.files-list-empty {
    padding: 20px 8px;
    font-size: 0.85rem;
    color: var(--files-muted);
}

.files-upload {
    border-top: 1px solid var(--files-border);
    padding-top: 10px;
    margin-top: 12px;
}

.files-dropzone {
    border: 1px dashed #a6a6a6;
    background: #fff;
    border-radius: 2px;
    padding: 9px 8px;
    text-align: center;
    margin: 7px 0 5px;
    font-size: 0.74rem;
    color: #454545;
}

.files-dropzone.is-dragging,
.files-dropzone:focus-within {
    border-color: var(--files-accent);
    background: #e9f3fb;
}

.files-dropzone .files-picker {
    display: inline-block;
    padding: 5px 9px;
    border: 1px solid #a6a6a6;
    border-radius: 2px;
    background: #f3f3f3;
    color: #005a9e;
    margin: 6px 0 2px;
    cursor: pointer;
}

.files-dropzone .files-picker:hover {
    background: #e5e5e5;
}

.files-dropzone:has(input:focus-visible) .files-picker {
    outline: 3px solid var(--files-accent);
    outline-offset: 3px;
}

.files-dropzone:has(input:disabled) .files-picker {
    opacity: 0.6;
    cursor: not-allowed;
}

#files-clear-queue {
    margin-top: 12px;
}

.files-upload > .files-muted {
    margin-top: 6px;
}

.files-queue:empty,
.files-download-status:empty {
    display: none;
}

.files-queue {
    margin-top: 16px;
}

.files-queue-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 10px 0;
    border-bottom: 1px solid var(--files-border);
}

.files-queue-item progress {
    width: 100%;
    height: 7px;
    accent-color: var(--files-accent);
}

.files-detail {
    min-width: 0;
    margin: 0;
    background: white;
}

.files-detail-heading {
    padding: 10px 14px;
    flex-wrap: wrap;
    align-items: center;
    border-bottom: 1px solid var(--files-border);
    background: #f7f7f7;
}

.files-detail-heading h3 {
    font-size: 0.88rem;
    overflow-wrap: anywhere;
}

.files-detail-info {
    flex: 1 1 190px;
}

.files-detail-meta {
    margin-top: 4px;
}

.files-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
}

.files-edit-controls {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(160px, 1.5fr) auto;
    align-items: end;
    gap: 6px 10px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--files-border);
    background: #fafafa;
}

.files-edit-controls label {
    grid-row: 1;
}

.files-edit-controls select {
    grid-row: 2;
}

.files-edit-controls button {
    grid-column: 3;
    grid-row: 1 / span 2;
}

.files-preview {
    min-width: 0;
    min-height: 640px;
    background: #f6f6f6;
}

.files-empty {
    display: flex;
    min-height: 640px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px 16px;
    gap: 7px;
    color: var(--files-muted);
}

.files-empty h4 {
    color: #34415a;
    font-size: 1rem;
}

.files-empty p {
    max-width: 340px;
    font-size: 0.85rem;
}

.files-preview-message,
.files-download-status {
    padding: 12px 20px;
    font-size: 0.82rem;
    color: var(--files-muted);
}

.files-download-status {
    border-bottom: 1px solid var(--files-border);
}

.files-download-status .btn {
    margin-top: 8px;
}

.files-pdf {
    display: block;
    width: 100%;
    min-height: 1180px;
    border: none;
    background: white;
}

.files-image {
    display: block;
    width: 100%;
    height: 1020px;
    padding: 20px;
    object-fit: contain;
}

.files-audio {
    display: block;
    width: calc(100% - 40px);
    max-width: 640px;
    margin: 40px auto;
}

.files-workbook {
    min-width: 0;
    padding: 16px;
}

.files-sheet-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.files-sheet-controls label {
    margin: 0;
}

.files-sheet-controls select {
    width: auto;
    min-width: 0;
    max-width: 75%;
}

.files-filter-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.files-filter-status {
    margin: 4px 0;
    color: var(--files-muted);
    font-size: 0.78rem;
}

.files-column-filter {
    display: block;
    width: 100%;
    min-width: 90px;
    max-width: 160px;
    margin-top: 4px;
    padding: 3px 4px;
    font-size: 0.72rem;
}

.files-parser-notice {
    color: #765209;
    background: #fff7df;
    border-left: 3px solid #c79224;
    font-size: 0.78rem;
    padding: 8px 10px;
    margin-top: 8px;
}

.files-sheet-scroll {
    max-width: 100%;
    overflow: auto;
    max-height: 1080px;
    margin-top: 14px;
    border: 1px solid var(--files-border);
    background: white;
}

.files-sheet {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.78rem;
    width: max-content;
    min-width: 100%;
}

.files-sheet td,
.files-sheet th {
    border-right: 1px solid #e2e6ee;
    border-bottom: 1px solid #e2e6ee;
    padding: 5px 9px;
    min-width: 60px;
    max-width: 330px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    vertical-align: top;
    text-align: left;
}

.files-sheet th {
    color: #465570;
    background: #edf0f6;
}

.files-sheet td[data-type="number"],
.files-sheet td[data-type="date"] {
    text-align: right;
    white-space: nowrap;
}

.files-sheet td[data-type="boolean"] {
    text-align: center;
}

.files-sheet thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.files-sheet tbody th {
    min-width: 42px;
    position: sticky;
    left: 0;
}

.files-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.files-manager-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    margin: 6px 8px;
    color: #34415a;
}

.files-manager-toggle input {
    width: auto;
    margin: 0;
    accent-color: #5568d3;
}

.files-manager-status {
    font-size: 0.78rem;
    color: #596477;
}

#band-members-admin .admin-item {
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 720px) {
    .files-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .files-resizer {
        display: none;
    }

    .files-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--files-border);
    }

    .files-list {
        max-height: 280px;
    }

    .files-detail-heading {
        padding: 16px;
    }

    .files-edit-controls {
        grid-template-columns: minmax(0, 1fr);
        padding: 12px 16px;
    }

    .files-edit-controls label,
    .files-edit-controls select,
    .files-edit-controls button {
        grid-column: 1;
        grid-row: auto;
    }

    .files-toolbar {
        align-items: flex-start;
    }

    .files-empty {
        min-height: 560px;
    }

    .files-image {
        height: 720px;
    }

    .files-workbook {
        padding: 10px;
    }
}
