/* The sidebar footer holds the notifications trigger and the account menu. Filament
   stacks them as two full-width rows; this lays them out as one control: the account
   takes the space, the bell keeps its icon only. */
.fi-sidebar .fi-sidebar-footer {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 0.25rem;
}

.fi-sidebar-footer .fi-user-menu {
    flex: 1 1 auto;
    min-width: 0;
}

.fi-sidebar-footer .fi-sidebar-database-notifications-btn {
    position: relative;
    width: auto;
    flex-shrink: 0;
}

.fi-sidebar-footer .fi-sidebar-database-notifications-btn-label {
    display: none;
}

/* Unread count sits on the bell instead of after the hidden label. */
.fi-sidebar-footer .fi-sidebar-database-notifications-btn-badge-ctn {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
}

/* ---- File manager ---- */

/* Tree, contents and details side by side; on a narrow screen they stack, with the
   tree collapsed to a scrolling strip so the files stay the point of the page. */
.fb-files {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

@media (min-width: 1024px) {
    .fb-files {
        grid-template-columns: 16rem minmax(0, 1fr);
    }

    .fb-files:has(.fb-files-details) {
        grid-template-columns: 16rem minmax(0, 1fr) 20rem;
    }
}

.fb-files-tree,
.fb-files-main,
.fb-files-details {
    border-radius: 0.75rem;
    background: var(--fb-surface, rgb(255 255 255));
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
    outline: 1px solid rgb(0 0 0 / 0.05);
    padding: 0.75rem;
}

:is(.dark) .fb-files-tree,
:is(.dark) .fb-files-main,
:is(.dark) .fb-files-details {
    background: rgb(255 255 255 / 0.05);
    outline-color: rgb(255 255 255 / 0.1);
}

.fb-files-tree {
    max-height: 70vh;
    overflow-y: auto;
}

.fb-files-disks {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgb(0 0 0 / 0.06);
}

.fb-files-disk,
.fb-files-branch {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.375rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    text-align: start;
    color: inherit;
}

.fb-files-disk {
    align-items: flex-start;
}

.fb-files-disk .fb-files-icon {
    margin-top: 0.125rem;
}

.fb-files-disk-text {
    display: flex;
    flex-direction: column;
}

.fb-files-disk-note {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.6;
}

.fb-files-disk:hover,
.fb-files-branch:hover {
    background: rgb(0 0 0 / 0.04);
}

:is(.dark) .fb-files-disk:hover,
:is(.dark) .fb-files-branch:hover {
    background: rgb(255 255 255 / 0.06);
}

.fb-files-disk-active,
.fb-files-branch-active {
    background: rgb(0 0 0 / 0.06);
    font-weight: 600;
}

:is(.dark) .fb-files-disk-active,
:is(.dark) .fb-files-branch-active {
    background: rgb(255 255 255 / 0.1);
}

.fb-files-node {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    padding-inline-start: calc(var(--fb-depth, 0) * 0.75rem);
}

.fb-files-toggle {
    flex-shrink: 0;
    padding: 0.25rem;
    border-radius: 0.375rem;
    color: rgb(107 114 128);
}

.fb-files-chevron {
    width: 1rem;
    height: 1rem;
}

.fb-files-icon {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
}

.fb-files-branch-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fb-files-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid rgb(0 0 0 / 0.06);
}

.fb-files-crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
}

.fb-files-crumb:hover {
    text-decoration: underline;
}

.fb-files-crumb-sep {
    color: rgb(156 163 175);
}

.fb-files-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.fb-files-search {
    height: 2.25rem;
    padding-inline: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid rgb(0 0 0 / 0.12);
    background: transparent;
    font-size: 0.875rem;
    color: inherit;
}

.fb-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
    gap: 0.75rem;
}

.fb-files-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    padding: 0.625rem;
    border-radius: 0.625rem;
    outline: 1px solid rgb(0 0 0 / 0.06);
    text-align: center;
}

.fb-files-tile:hover {
    outline-color: rgb(0 0 0 / 0.2);
}

.fb-files-tile-active {
    outline: 2px solid var(--primary-500, rgb(245 158 11));
}

.fb-files-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 0.5rem;
    overflow: hidden;
    background: rgb(0 0 0 / 0.04);
}

:is(.dark) .fb-files-thumb {
    background: rgb(255 255 255 / 0.06);
}

.fb-files-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fb-files-thumb-icon {
    width: 2rem;
    height: 2rem;
    color: rgb(107 114 128);
}

.fb-files-tile-name {
    width: 100%;
    font-size: 0.8125rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fb-files-tile-meta {
    font-size: 0.6875rem;
    color: rgb(107 114 128);
}

.fb-files-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 3rem 1rem;
    color: rgb(107 114 128);
    font-size: 0.875rem;
}

.fb-files-empty-icon {
    width: 2.5rem;
    height: 2.5rem;
}

.fb-files-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
    border-radius: 0.5rem;
    overflow: hidden;
    background: rgb(0 0 0 / 0.04);
}

:is(.dark) .fb-files-preview {
    background: rgb(255 255 255 / 0.06);
}

.fb-files-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.fb-files-preview-icon {
    width: 3rem;
    height: 3rem;
    color: rgb(107 114 128);
}

.fb-files-details-name {
    margin-top: 0.75rem;
    font-weight: 600;
    word-break: break-all;
}

.fb-files-meta {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.8125rem;
}

.fb-files-meta dt {
    color: rgb(107 114 128);
}

.fb-files-path {
    word-break: break-all;
}

.fb-files-details-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Sign-in beside an image. The visual only renders when one is configured, so
   :has keeps the centred layout untouched everywhere else. Below the fold of a
   laptop there is no room for both, and the form wins. */
.fi-simple-layout:has(.lb-auth-visual) {
    display: grid;
    grid-template-columns: 1fr;
    min-height: 100vh;
}

@media (min-width: 1024px) {
    .fi-simple-layout:has(.lb-auth-visual) {
        grid-template-columns: 1fr 1fr;
    }
}

.lb-auth-visual {
    display: none;
}

@media (min-width: 1024px) {
    .lb-auth-visual {
        display: block;
        position: relative;
        overflow: hidden;
        order: 2;
    }

    .lb-auth-visual img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
    }
}

.fi-simple-layout:has(.lb-auth-visual) .fi-simple-main-ctn {
    order: 1;
    min-height: 100vh;
}
