:root {
    --app-sidebar-bg: #f8f9fa;
    --app-border: #dee2e6;
}

body {
    background: #f5f6f8;
}

.app-auth-body {
    background: #eef1f5;
}

.app-auth-main {
    min-height: 100vh;
}

.app-navbar {
    min-height: 56px;
}

.app-brand {
    align-items: center;
    display: inline-flex;
    gap: 0.65rem;
}

.app-brand-logos {
    align-items: center;
    display: inline-flex;
    gap: 0.5rem;
}

.app-brand-logo {
    background: #ffffff;
    border-radius: 4px;
    height: 36px;
    object-fit: contain;
    padding: 3px 5px;
    width: auto;
}

.app-brand-logo-ater {
    padding-left: 7px;
    padding-right: 7px;
}

.app-brand-logo-cari {
    width: 130px;
}

.app-brand-name {
    white-space: nowrap;
}

.app-top-menu {
    margin-left: 1rem;
}

.app-top-menu .nav-link {
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.72);
    font-weight: 600;
    padding-left: 0.85rem;
    padding-right: 0.85rem;
}

.app-top-menu .nav-link.active,
.app-top-menu .nav-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.app-shell {
    padding-left: 0;
    padding-right: 0;
}

.app-content {
    background: #f5f6f8;
}

.app-breadcrumb {
    font-size: 0.875rem;
}

.app-breadcrumb .breadcrumb {
    background: transparent;
}

.app-breadcrumb a {
    color: #495057;
    text-decoration: none;
}

.app-breadcrumb a:hover {
    color: #0d6efd;
    text-decoration: underline;
}

.app-breadcrumb .active {
    color: #6c757d;
}

.app-card {
    border: 1px solid var(--app-border);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.app-edifici-table-wrap {
    width: 100%;
}

.app-row-actions .dropdown-menu {
    min-width: 9rem;
}

table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control::before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control::before {
    background-color: #111827;
    border: 0;
    box-shadow: none;
}

table.dataTable > tbody > tr.child ul.dtr-details {
    width: 100%;
}

table.dataTable > tbody > tr.child span.dtr-title {
    color: #6b7280;
    min-width: 120px;
}

#edifici-table th.app-col-denominazione,
#edifici-table td.app-col-denominazione {
    max-width: 18rem;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: normal;
}

#edifici-table th.app-col-indirizzo,
#edifici-table td.app-col-indirizzo {
    max-width: 20rem;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: normal;
}

@media (max-width: 767.98px) {
    .app-mobile-hide-filter {
        display: none;
    }

    #edifici-table th.app-col-denominazione,
    #edifici-table td.app-col-denominazione {
        max-width: 11rem;
        min-width: 9rem;
    }

    #edifici-table th.app-col-indirizzo,
    #edifici-table td.app-col-indirizzo,
    table.dataTable > tbody > tr.child li[data-dtr-index="2"] span.dtr-data {
        max-width: 16rem;
        white-space: normal !important;
        overflow-wrap: anywhere;
        word-break: normal;
    }

    table.dataTable > tbody > tr.child li[data-dtr-index="2"] span.dtr-data {
        display: inline-block;
        vertical-align: top;
    }

    .app-interventi-table-wrap {
        overflow-x: visible;
    }

    .app-interventi-table .app-mobile-hidden-col {
        display: none;
    }

    .app-interventi-table .app-intervento-title-col {
        max-width: 10rem;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .app-interventi-table .app-intervento-actions-col {
        min-width: 7rem;
    }

    .app-interventi-table .btn {
        margin-bottom: 0.25rem;
    }
}

.app-photo-thumb {
    aspect-ratio: 4 / 3;
    object-fit: cover;
    width: 100%;
}

.app-photo-gallery {
    align-items: center;
    background: rgba(5, 9, 14, 0.96);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 64px 84px 76px;
    position: fixed;
    z-index: 30000;
}

.app-photo-gallery-figure {
    align-items: center;
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: center;
    margin: 0;
    max-width: 100%;
    min-width: 0;
}

.app-photo-gallery-image {
    display: block;
    height: calc(100% - 34px);
    max-height: 100%;
    max-width: min(100%, 1400px);
    object-fit: contain;
    width: auto;
}

.app-photo-gallery-caption {
    color: #ffffff;
    font-size: 14px;
    line-height: 1.4;
    max-width: min(900px, 100%);
    overflow-wrap: anywhere;
    padding: 10px 12px 0;
    text-align: center;
}

.app-photo-gallery-count {
    bottom: 22px;
    color: #ffffff;
    font-size: 14px;
    left: 50%;
    position: absolute;
    transform: translateX(-50%);
}

.app-photo-gallery-close,
.app-photo-gallery-nav {
    align-items: center;
    background: #26313d;
    border: 1px solid #ffffff;
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    height: 48px;
    justify-content: center;
    line-height: 1;
    padding: 0;
    position: absolute;
    width: 48px;
}

.app-photo-gallery-close {
    font-size: 32px;
    right: 20px;
    top: 20px;
}

.app-photo-gallery-nav {
    font-size: 42px;
    top: 50%;
    transform: translateY(-50%);
}

.app-photo-gallery-nav.previous {
    left: 20px;
}

.app-photo-gallery-nav.next {
    right: 20px;
}

.app-photo-gallery-nav[hidden] {
    display: none;
}

.app-photo-gallery-close:hover,
.app-photo-gallery-close:focus,
.app-photo-gallery-nav:hover,
.app-photo-gallery-nav:focus {
    background: #ffffff;
    color: #17212c;
}

@media (max-width: 767.98px) {
    .app-photo-gallery {
        padding: calc(64px + env(safe-area-inset-top)) 8px calc(76px + env(safe-area-inset-bottom));
    }

    .app-photo-gallery-figure {
        width: 100%;
    }

    .app-photo-gallery-image {
        height: calc(100% - 42px);
        max-width: 100%;
        width: 100%;
    }

    .app-photo-gallery-close,
    .app-photo-gallery-nav {
        height: 46px;
        width: 46px;
    }

    .app-photo-gallery-close {
        right: 12px;
        top: calc(10px + env(safe-area-inset-top));
    }

    .app-photo-gallery-nav.previous {
        left: 8px;
    }

    .app-photo-gallery-nav.next {
        right: 8px;
    }

    .app-photo-gallery-count {
        bottom: calc(18px + env(safe-area-inset-bottom));
    }
}

.app-upload-preview {
    max-height: 180px;
    object-fit: cover;
}

.app-photo-upload-panel {
    border: 1px solid var(--app-border);
    border-radius: 8px;
    padding: 1rem;
}

.app-photo-upload-pre {
    border-left: 4px solid #0d6efd;
}

.app-photo-upload-post {
    border-left: 4px solid #6f42c1;
}

.app-photo-action {
    border: 0;
    color: #ffffff;
    font-weight: 700;
    min-height: 3rem;
}

.app-photo-action:hover,
.app-photo-action:focus {
    color: #ffffff;
    filter: brightness(0.94);
}

.app-photo-action-pre-gallery {
    background: #0d6efd;
}

.app-photo-action-pre-camera {
    background: #198754;
}

.app-photo-action-post-gallery {
    background: #6f42c1;
}

.app-photo-action-post-camera {
    background: #fd7e14;
}

.app-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.875rem;
    min-height: 64px;
    padding: 0.75rem 1rem;
}

.app-footer-powered {
    align-items: center;
    display: inline-flex;
    gap: 0.65rem;
}

.app-footer-logo {
    background: #ffffff;
    border-radius: 4px;
    height: 38px;
    object-fit: contain;
    padding: 3px 7px;
    width: auto;
}

@media (max-width: 991.98px) {
    .app-brand-name {
        display: none;
    }

    .app-brand-logo-cari {
        width: 110px;
    }

    .app-top-menu {
        margin-left: 0;
        margin-top: 0.75rem;
    }
}

@media (max-width: 575.98px) {
    .app-brand {
        gap: 0.4rem;
    }

    .app-brand-logos {
        gap: 0.35rem;
    }

    .app-brand-logo {
        height: 32px;
    }

    .app-brand-logo-cari {
        width: 92px;
    }

    .app-footer {
        text-align: center;
    }
}
