:root {
    --fc-sidebar-width: 260px;
    --fc-primary: #1a73e8;
    --fc-bg: #f8f9fa;
    --fc-header-height: 56px;
    --fc-touch-min: 44px;
    --fc-safe-bottom: env(safe-area-inset-bottom, 0px);
}

body {
    background: var(--fc-bg);
    min-height: 100vh;
    min-height: 100dvh;
}

.auth-body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

.auth-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
}

body.sidebar-open {
    overflow: hidden;
}

/* —— Auth —— */
.auth-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-wrapper .card {
    width: 100%;
    max-width: 420px;
}

.site-powered-by {
    text-align: center;
    font-size: 0.8125rem;
    color: #6c757d;
    padding: 0.75rem 1rem;
    padding-bottom: calc(0.75rem + var(--fc-safe-bottom));
    line-height: 1.5;
}

.site-powered-by-inner {
    display: inline;
    font-size: inherit;
    color: inherit;
}

.site-powered-by-sep {
    white-space: pre;
}

.site-powered-by a {
    display: inline;
    color: var(--fc-primary);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.site-powered-by a:hover {
    text-decoration: underline;
}

.auth-page .site-powered-by,
.admin-auth-page .site-powered-by,
.main-content .site-powered-by,
.admin-content .site-powered-by {
    margin-top: auto;
    flex-shrink: 0;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

/* —— App shell —— */
.app-shell {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.sidebar-backdrop.show {
    display: block;
    opacity: 1;
}

.sidebar {
    width: var(--fc-sidebar-width);
    background: #fff;
    border-inline-end: 1px solid #dee2e6;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    z-index: 1050;
    -webkit-overflow-scrolling: touch;
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #eee;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    font-weight: 700;
    color: var(--fc-primary);
    padding: 1rem;
    margin: 0;
    border: none;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #444;
    border-radius: 0 24px 24px 0;
    margin: 2px 0;
    padding: 0.75rem 1rem;
    min-height: var(--fc-touch-min);
}

.sidebar .nav-link i {
    font-size: 1.15rem;
    width: 1.35rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar .nav-link.active,
.sidebar .nav-link:hover {
    background: #e8f0fe;
    color: var(--fc-primary);
}

.app-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    padding: 1.5rem 2rem;
    padding-bottom: calc(1.5rem + var(--fc-safe-bottom));
    overflow-x: hidden;
}

/* —— Top navbar —— */
.app-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    height: var(--fc-header-height);
    padding: 0 1rem;
    padding-top: env(safe-area-inset-top, 0px);
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 1030;
    flex-shrink: 0;
}

.app-navbar-start {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
    flex: 1;
}

.app-navbar-title {
    font-weight: 600;
    font-size: 1.05rem;
}

.app-navbar-end {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.app-navbar-page-actions {
    display: flex;
    align-items: center;
}

.navbar-profile-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    border: none;
    background: transparent;
    color: inherit;
    max-width: 200px;
}

.navbar-profile-toggle::after {
    margin-inline-start: 0.25rem;
}

.navbar-profile-toggle:hover,
.navbar-profile-toggle:focus,
.navbar-profile-toggle.show {
    background: #f1f3f4;
    color: inherit;
}

.navbar-avatar {
    object-fit: cover;
    flex-shrink: 0;
}

.navbar-profile-name {
    max-width: 120px;
    font-weight: 500;
    font-size: 0.9rem;
}

.navbar-profile-header {
    max-width: 240px;
}

.navbar-notifications.dropdown-toggle::after {
    display: none;
}

.navbar-notifications.show {
    color: var(--fc-primary);
    background: #e8f0fe;
}

.navbar-notifications-badge {
    top: 4px;
    inset-inline-end: 2px;
    min-width: 1.1rem;
    padding: 0.2em 0.45em;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    transform: none;
}

.notifications-dropdown-menu {
    width: min(360px, calc(100vw - 2rem));
    padding: 0;
    overflow: hidden;
}

.notifications-dropdown-header {
    margin: 0;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
}

.notifications-dropdown-list {
    max-height: min(360px, 50vh);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.navbar-notification-item {
    white-space: normal;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid #f1f3f4;
}

.navbar-notification-item:last-child {
    border-bottom: none;
}

.navbar-notification-item.unread {
    background: #e8f0fe;
}

.navbar-notification-item.unread .navbar-notification-message {
    font-weight: 500;
}

.navbar-notification-item.is-actionable {
    cursor: pointer;
}

.navbar-notification-message {
    display: block;
    line-height: 1.35;
}

.file-access-share-section[hidden] {
    display: none !important;
}

.fc-file-card-owner {
    margin: 0;
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.share-user-list {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 0.5rem 1.9rem;
    background: #fff;
}

.share-user-item {
    padding: 0.35rem 0;
    margin: 0;
}

.share-user-item .form-check-label {
    cursor: pointer;
    width: 100%;
}

/* —— Full-screen file viewer slider —— */
.file-viewer {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    flex-direction: column;
}

.file-viewer[hidden] {
    display: none !important;
}

body.file-viewer-open {
    overflow: hidden;
}

.file-viewer-chrome {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.file-viewer-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
    flex-shrink: 0;
    color: #fff;
}

.file-viewer-header-text {
    flex: 1;
}

.file-viewer-carousel {
    flex: 1;
    min-height: 0;
    position: relative;
}

.file-viewer-carousel .carousel-inner {
    height: 100%;
    min-height: 0;
}

.file-viewer-carousel .carousel-item {
    height: 100%;
    min-height: 0;
}

.file-viewer-slide-preview {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 3.5rem;
}

.file-viewer-zoom-stage {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    container-type: size;
    container-name: viewer-zoom;
}

.file-viewer-zoom-stage img.file-viewer-preview-media {
    pointer-events: none;
    -webkit-user-drag: none;
    user-drag: none;
    user-select: none;
    -webkit-user-select: none;
}

.file-viewer-zoom-stage.is-zoomed {
    cursor: grab;
}

.file-viewer-zoom-stage.is-grabbing {
    cursor: grabbing;
}

.file-viewer-zoom-pan {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    max-width: 100%;
    max-height: 100%;
    transform-origin: center center;
    will-change: transform;
}

.file-viewer-footer .file-viewer-zoom-controls {
    flex-shrink: 0;
}

.file-viewer-zoom-pan .file-viewer-preview-media {
    display: block;
    width: auto;
    height: auto;
    max-width: 100cqw;
    max-height: 100cqh;
    object-fit: contain;
}

.file-viewer-zoom-pan .file-viewer-preview-media.preview-frame {
    width: min(100cqw, 100%);
    height: min(100cqh, 100%);
    max-width: 100cqw;
    max-height: 100cqh;
    border: 0;
}

.file-viewer-slide-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-viewer-text-preview {
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    -webkit-overflow-scrolling: touch;
}

.file-viewer-text-content {
    margin: 0;
    padding: 1rem 1.25rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.92);
    white-space: pre-wrap;
    word-break: break-word;
    user-select: text;
    -webkit-user-select: text;
}

.file-viewer-text-truncated {
    flex-shrink: 0;
    padding: 0.5rem 1.25rem 1rem;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.55);
    text-align: center;
}

.file-viewer-video-preview {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-viewer-preview-video {
    display: block;
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    background: #000;
    outline: none;
}

.file-viewer-slide-fallback {
    text-align: center;
    color: #fff;
}

.file-viewer-slide-fallback .file-icon {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.file-viewer-control {
    width: 3rem;
    opacity: 0.85;
}

.file-viewer-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    flex-shrink: 0;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--fc-touch-min);
    height: var(--fc-touch-min);
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    border-radius: 50%;
}

.btn-icon:hover,
.btn-icon:focus {
    background: #f1f3f4;
}

/* —— Page toolbar —— */
.page-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.page-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
}

.page-toolbar-actions .form-control {
    flex: 1 1 100%;
    min-width: 0;
}

.page-toolbar-actions .btn {
    flex: 1 1 auto;
    min-height: var(--fc-touch-min);
}

/* —— Tables → cards on mobile —— */
.fc-table thead th {
    white-space: nowrap;
}

.fc-table .fc-actions {
    white-space: nowrap;
}

.fc-table .fc-actions .btn {
    min-width: var(--fc-touch-min);
    min-height: var(--fc-touch-min);
    padding: 0.375rem 0.5rem;
}

.file-drop-zone {
    display: block;
    border: 2px dashed #adb5bd;
    border-radius: 12px;
    padding: 2rem 1rem;
    text-align: center;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 0;
}

.file-drop-zone.dragover {
    border-color: var(--fc-primary);
    background: #e8f0fe;
}

.upload-preview-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 280px;
    overflow-y: auto;
}

.upload-preview-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 10px;
}

.upload-preview-thumb {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f1f3f4;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-preview-icon {
    color: var(--fc-primary);
}

.file-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #e8f0fe;
    color: var(--fc-primary);
    font-size: 1rem;
    flex-shrink: 0;
}

.file-icon-lg {
    width: 52px;
    height: 52px;
    font-size: 1.5rem;
    margin: 0 auto;
}

.fc-files-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

@media (min-width: 576px) {
    .fc-files-grid {
        gap: 1rem;
    }
}

@media (min-width: 768px) {
    .fc-files-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 992px) {
    .fc-files-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1200px) {
    .fc-files-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.fc-files-grid.fc-files-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.fc-files-grid.fc-files-list .fc-file-card {
    flex-direction: row;
    align-items: center;
    min-height: auto;
    padding: 0.65rem 0.75rem;
}

.fc-files-grid.fc-files-list .fc-file-card-thumb {
    width: 40px;
    height: 40px;
    min-height: 40px;
    flex-shrink: 0;
}

.fc-files-grid--compact {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .fc-files-grid--compact {
        grid-template-columns: repeat(3, 1fr);
    }
}

.fc-file-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

@media (max-width: 575.98px) {
    .fc-file-card {
        padding: 0.2rem;
    }
}

.fc-file-card:hover {
    border-color: #c6dafc;
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.12);
}

.fc-file-card--clickable {
    cursor: pointer;
}

.fc-file-card--clickable:focus-visible {
    outline: 2px solid var(--fc-primary);
    outline-offset: 2px;
}

.fc-file-card-thumb {
    width: 100%;
    height: 166px !important;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.75rem;
    background: #f1f3f4;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fc-file-card-thumb--icon {
    aspect-ratio: 1;
}

.fc-file-card-thumb-img {
    width: 100%;
    height: 100% !important;
    object-fit: cover;
    display: block;
}

.fc-file-card-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
}

.fc-file-card-thumb--video {
    position: relative;
}

.fc-file-card-thumb-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    color: #fff;
    font-size: 2.75rem;
    line-height: 1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.fc-file-card-thumb-play i {
    margin-left: 0.15rem;
}

.fc-file-card-name {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.3;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}

.fc-file-card-meta {
    font-size: 0.75rem;
    color: #6c757d;
    margin: 0.35rem 0 0.5rem;
}

.fc-file-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    min-height: 1.5rem;
    margin-bottom: 0.5rem;
}

.fc-file-card-badges:empty {
    display: none;
}

.fc-file-card-actions {
    position: absolute;
    top: 0.5rem;
    inset-inline-end: 0.5rem;
    z-index: 3;
    margin: 0;
    padding: 0;
}

.fc-file-card-menu.dropdown-toggle::after {
    display: none;
}

.fc-file-card-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    min-width: 2rem;
    height: 2rem;
    padding: 0;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.fc-file-card-actions .dropdown-menu {
    min-width: 11rem;
}

.fc-file-card-actions .dropdown-item {
    display: flex;
    align-items: center;
}

.fc-file-card--compact {
    padding: 0.75rem;
}

.fc-file-card--compact .file-icon-lg {
    width: 100%;
    height: 100px;
    font-size: 1.25rem;
}

.profile-avatar {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.preview-frame {
    max-height: 400px;
    width: 100%;
    object-fit: contain;
}

#page-loader {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

#fc-toast-container {
    padding-bottom: calc(1rem + var(--fc-safe-bottom)) !important;
}

/* Dashboard quick actions */
.quick-actions .btn {
    min-height: var(--fc-touch-min);
}

/* Notifications list — easier taps */
#notificationsList .list-group-item {
    min-height: var(--fc-touch-min);
    padding: 1rem;
}

/* Pagination — larger tap targets */
.pagination .page-link {
    min-width: var(--fc-touch-min);
    min-height: var(--fc-touch-min);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* —— Tablet & mobile —— */
@media (max-width: 991.98px) {
    /* Sidebar/backdrop sit outside .app-shell — never reserve horizontal space */
    .app-body {
        display: block;
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }

    .app-shell {
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 100vw;
        min-width: 0;
        margin: 0;
        padding: 0;
    }

    .app-main {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        flex: 1 1 auto;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1045;
        pointer-events: none;
    }

    .sidebar-backdrop.show {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .fc-drive-ui .sidebar-backdrop.show {
        background: rgba(32, 33, 36, 0.5);
    }

    .sidebar {
        --fc-drawer-width: min(288px, 86vw);
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        right: auto;
        width: var(--fc-drawer-width);
        max-width: 86vw;
        height: 100dvh;
        height: 100svh;
        margin: 0;
        padding: 0;
        flex: none;
        z-index: 1055;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        transform: translate3d(calc(-100% - 12px), 0, 0);
        transition: transform 0.28s ease, visibility 0.28s ease;
        box-shadow: none;
        pointer-events: none;
        visibility: hidden;
        will-change: transform;
    }

    .sidebar.open {
        transform: translate3d(0, 0, 0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
        pointer-events: auto;
        visibility: visible;
    }

    html[dir="rtl"] .sidebar,
    html.rtl .sidebar {
        left: auto;
        right: 0;
        transform: translate3d(calc(100% + 12px), 0, 0);
    }

    html[dir="rtl"] .sidebar.open,
    html.rtl .sidebar.open {
        transform: translate3d(0, 0, 0);
        box-shadow: -4px 0 24px rgba(0, 0, 0, 0.18);
    }

    .sidebar-top {
        flex-shrink: 0;
        padding-top: env(safe-area-inset-top, 0px);
    }

    .sidebar .brand {
        min-width: 0;
        flex: 1;
    }

    .sidebar .brand span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .sidebar .nav.flex-column {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .sidebar .drive-new-wrap,
    .sidebar #sidebarStorageWrap {
        flex-shrink: 0;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .main-content {
        padding: 1rem;
        padding-bottom: calc(1rem + var(--fc-safe-bottom));
    }

    .page-toolbar-actions .form-control {
        flex: 1 1 100%;
    }

    /* Responsive data tables */
    .fc-table thead {
        display: none;
    }

    .fc-table tbody tr {
        display: block;
        margin-bottom: 0.75rem;
        border: 1px solid #dee2e6;
        border-radius: 12px;
        background: #fff;
        padding: 0.25rem 0;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    }

    .fc-table tbody tr:last-child {
        margin-bottom: 0;
    }

    .fc-table tbody td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0.65rem 1rem;
        border: none;
        text-align: end !important;
    }

    .fc-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.02em;
        color: #6c757d;
        text-align: start;
        flex-shrink: 0;
    }

    .fc-table tbody td.fc-file-name {
        display: block;
        text-align: start !important;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid #f1f3f4;
    }

    .fc-table tbody td.fc-file-name::before {
        display: none;
    }

    .fc-table tbody td.fc-actions {
        justify-content: flex-end;
        padding-top: 0.75rem;
    }

    .fc-table tbody td.fc-actions::before {
        display: none;
    }

    .fc-table .table-responsive {
        overflow: visible;
    }

    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    .fc-drive-ui .modal-dialog {
        margin: 0.75rem auto;
    }

    .fc-drive-ui .modal-fullscreen-sm-down {
        margin: 0;
        max-width: 100%;
    }

    .file-viewer-slide-preview {
        padding: 0.5rem 2.75rem;
    }

    .file-viewer-control {
        width: 44px;
        height: 44px;
    }

    .file-viewer-header .btn-icon {
        width: 44px;
        height: 44px;
    }

    .file-viewer-footer .btn {
        min-height: 44px;
    }

    .quick-actions {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .quick-actions .btn {
        width: 100%;
        margin: 0 !important;
    }
}

@media (max-width: 575.98px) {
    .auth-wrapper .card-body {
        padding: 1.5rem !important;
    }

    .stat-card .fs-2 {
        font-size: 1.75rem !important;
    }

    .fc-table tbody td.fc-actions .btn-group-wrap {
        display: flex;
        gap: 0.35rem;
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}

@media (min-width: 992px) {
    /* Sidebar lives outside .app-shell — restore side-by-side desktop layout */
    .app-body {
        display: flex;
        flex-direction: row;
        align-items: stretch;
        min-height: 100dvh;
        overflow-x: visible;
    }

    .sidebar {
        position: sticky;
        top: 0;
        left: auto;
        right: auto;
        width: var(--fc-sidebar-width);
        height: 100dvh;
        flex-shrink: 0;
        transform: none !important;
        pointer-events: auto;
        visibility: visible !important;
        will-change: auto;
        overflow-y: auto;
        box-shadow: none;
    }

    .sidebar.open {
        transform: none !important;
        box-shadow: none;
    }

    html[dir="rtl"] .sidebar,
    html[dir="rtl"] .sidebar.open,
    html.rtl .sidebar,
    html.rtl .sidebar.open {
        transform: none !important;
        box-shadow: none;
    }

    .sidebar-backdrop {
        display: none !important;
        pointer-events: none !important;
    }

    .app-shell {
        flex: 1;
        min-width: 0;
        width: auto;
        max-width: none;
        display: flex;
        flex-direction: column;
    }

    .page-toolbar-actions {
        width: auto;
        flex-wrap: nowrap;
    }

    .page-toolbar-actions .form-control {
        flex: 0 1 220px;
        width: 220px;
    }
}

/* —— Language switcher —— */
.language-switcher-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: var(--fc-touch-min);
}

.language-switcher-toggle::after {
    margin-inline-start: 0.15rem;
}

@media (max-width: 991.98px) {
    .language-switcher-toggle {
        gap: 0;
        padding-inline: 0.5rem;
    }

    .language-switcher-toggle::after {
        margin-inline-start: 0.1rem;
    }
}

.language-switcher .dropdown-item.btn-locale.active {
    background-color: #e8f0fe;
    color: var(--fc-primary);
}

.language-switcher .dropdown-item.btn-locale .bi-check-lg {
    color: var(--fc-primary);
}

.auth-locale-bar {
    display: flex;
    justify-content: center;
}

/* —— RTL (Bootstrap RTL handles components; these cover app-specific layout) —— */
html[dir="rtl"] .sidebar .nav-link {
    border-radius: 24px 0 0 24px;
}

html[dir="rtl"] .fc-table tbody td::before {
    text-align: start;
}

html[dir="rtl"] .fc-table tbody td.fc-file-name,
html[dir="rtl"] .fc-table tbody td.fc-actions {
    text-align: start !important;
}

html[dir="rtl"] .fc-table tbody td.fc-actions {
    justify-content: flex-start;
}

/* —— Folders & drag-drop —— */
.fc-folder-card .fc-file-card-thumb--icon {
    color: var(--bs-warning);
}

@media (hover: none) and (pointer: coarse) {
    .fc-draggable-item {
        -webkit-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
    }
}

body.fc-touch-dragging {
    overflow: hidden;
    touch-action: none;
}

.fc-file-card.fc-dragging {
    opacity: 0.45;
}

.fc-file-card.fc-dragging.fc-touch-drag-source {
    pointer-events: none;
}

.fc-draggable-item .fc-file-card-thumb-img {
    -webkit-user-drag: none;
    user-drag: none;
    pointer-events: none;
}

.fc-file-card.fc-drop-over,
.fc-breadcrumb-root.fc-drop-over {
    outline: 2px dashed var(--bs-primary);
    outline-offset: 2px;
    background: rgba(26, 115, 232, 0.08);
}

.fc-files-breadcrumb .fc-breadcrumb-root,
.fc-files-breadcrumb .fc-breadcrumb-folder {
    text-decoration: none;
    max-width: 12rem;
}

.fc-files-breadcrumb .fc-breadcrumb-label {
    display: inline-block;
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.fc-files-breadcrumb .fc-breadcrumb-root.fc-drop-over,
.fc-files-breadcrumb .fc-breadcrumb-folder.fc-drop-over {
    border-radius: 0.25rem;
    padding: 0.125rem 0.375rem;
}

.fc-files-breadcrumb .fc-breadcrumb-segment {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
}

.fc-bulk-bar[hidden] {
    display: none !important;
}

.fc-card-select-wrap {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 2;
}

.fc-file-card {
    position: relative;
}

.fc-file-card--selected {
    outline: 2px solid var(--fc-primary);
    outline-offset: 2px;
}

.fc-details-list dt {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    margin-top: 1rem;
}

.fc-details-list dt:first-child {
    margin-top: 0;
}

.fc-details-list dd {
    margin-bottom: 0;
    font-weight: 500;
}

.fc-details-offcanvas {
    width: min(360px, 100vw);
}
