.sale-detail-hero{
    background:linear-gradient(135deg,rgb(var(--theme-rgb-secondary,90,23,47)),rgb(var(--theme-rgb-secondary,90,23,47)));
}

.sale-hero-layout{
    display:flex;
    align-items:center;
    gap:2rem;
}

.sale-hero-content{
    min-width:0;
}

.sale-affiliation{
    display:inline-flex;
    margin-bottom:.75rem;
    padding:.35rem .75rem;
    color:color-mix(in srgb,rgb(var(--theme-rgb-primary)) 24%,#fff);
    background:rgba(59,130,246,.18);
    border:1px solid rgba(147,197,253,.3);
    border-radius:999px;
    font-size:.8rem;
    font-weight:700;
}

.detail-logo{
    flex:0 0 150px;
    width:150px;
    height:150px;
    padding:1rem;
    display:flex;
    align-items:center;
    justify-content:center;
    overflow:hidden;
    background:#fff;
    border-radius:24px;
}

.detail-logo img{
    max-width:100%;
    max-height:100%;
    object-fit:contain;
}

.sale-cover{
    width:100%;
    height:min(46vw,520px);
    overflow:hidden;
    background:rgb(var(--theme-rgb-secondary,90,23,47));
}

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

.info-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:1.5rem;
}

.info-grid > div{
    display:flex;
    flex-direction:column;
    gap:.35rem;
}

.info-grid strong{
    font-size:.9rem;
}

.info-grid span{
    color:#475569;
}

.info-grid__wide{
    grid-column:1/-1;
}

.service-public-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
    gap:.85rem;
}

.service-public-item{
    min-height:58px;
    padding:.85rem 1rem;
    display:flex;
    align-items:center;
    gap:.75rem;
    color:rgb(var(--theme-rgb-secondary,90,23,47));
    background:rgba(var(--theme-rgb-primary,91,42,134),.08);
    border:1px solid rgba(var(--theme-rgb-primary,91,42,134),.32);
    border-radius:16px;
    font-weight:700;
}

.service-public-item i{
    font-size:1.25rem;
}

.discipline-public-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(230px,1fr));
    gap:1rem;
}

.discipline-public-card{
    padding:1.15rem;
    background:#f8fafc;
    border:1px solid #dce3eb;
    border-radius:18px;
}

.discipline-public-card h3{
    margin:0 0 .85rem;
    font-size:1.05rem;
}

.badge-soft{
    display:inline-flex;
    border-radius:999px;
    padding:.35rem .7rem;
    background:#f1f5f9;
    color:#334155;
    font-size:.8rem;
    font-weight:700;
}

.table-total-badge{
    display:inline-flex;
    padding:.55rem .9rem;
    color:#fff;
    background:rgb(var(--theme-rgb-primary,91,42,134));
    border-radius:999px;
    font-weight:800;
}

.table-summary-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(130px,1fr));
    gap:.75rem;
}

.table-summary-card{
    padding:1rem;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:.75rem;
    background:#f8fafc;
    border:1px solid #dce3eb;
    border-radius:14px;
}

.table-summary-card span{
    color:#64748b;
    font-weight:700;
}

.table-summary-card strong{
    font-size:1.45rem;
}

.public-table-list{
    display:grid;
    gap:1rem;
}

.public-table-card{
    display:grid;
    grid-template-columns:64px 1fr;
    overflow:hidden;
    border:1px solid #dce3eb;
    border-radius:18px;
}

.public-table-card__count{
    display:flex;
    align-items:center;
    justify-content:center;
    color:#fff;
    background:rgb(var(--theme-rgb-primary,91,42,134));
    font-size:1.45rem;
    font-weight:900;
}

.public-table-card__content{
    padding:1rem 1.15rem;
}

.public-table-card h3{
    margin:0;
    font-size:1.05rem;
}

.public-table-details{
    display:flex;
    flex-wrap:wrap;
    gap:.5rem 1.25rem;
    color:#64748b;
    font-size:.88rem;
}

.public-table-details strong{
    color:#334155;
}

.sale-gallery{
    overflow:hidden;
    border-radius:18px;
    background:rgb(var(--theme-rgb-secondary,90,23,47));
}

.sale-gallery .carousel-item{
    height:min(48vw,520px);
}

.sale-gallery .carousel-item img{
    width:100%;
    height:100%;
    object-fit:cover;
}

.sale-gallery .carousel-caption{
    right:1rem;
    bottom:1rem;
    left:1rem;
    padding:0;
    text-align:left;
}

.sale-gallery .carousel-caption span{
    display:inline-flex;
    padding:.55rem .8rem;
    background:rgba(15,23,42,.82);
    border-radius:10px;
}

.contact-card{
    position:sticky;
    top:1rem;
}

.contact-button{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:1rem;
    padding:.85rem 1rem;
    color:rgb(var(--theme-rgb-secondary,90,23,47));
    background:#fff;
    border:1px solid #cbd5e1;
    border-radius:18px;
    text-decoration:none;
}

.contact-button:hover{
    border-color:rgb(var(--theme-rgb-primary,91,42,134));
    box-shadow:0 8px 20px rgba(var(--theme-rgb-primary,91,42,134),.12);
}

.contact-button span{
    color:#64748b;
    font-size:.85rem;
    font-weight:700;
}

.contact-button strong{
    font-size:.95rem;
    text-align:right;
    word-break:break-word;
}

.contact-phone{
    color:rgb(var(--theme-rgb-primary,91,42,134));
    border-color:rgb(var(--theme-rgb-primary,91,42,134));
}

.contact-whatsapp{
    border-color:rgb(var(--theme-rgb-primary,91,42,134));
}

.contact-site{
    border-color:rgb(var(--theme-rgb-primary,91,42,134));
}

@media(max-width:767px){
    .sale-hero-layout{
        align-items:flex-start;
        flex-direction:column;
    }

    .detail-logo{
        width:110px;
        height:110px;
        flex-basis:110px;
    }

    .sale-cover{
        height:300px;
    }

    .info-grid{
        grid-template-columns:1fr 1fr;
    }

    .contact-card{
        position:static;
    }
}

@media(max-width:520px){
    .info-grid{
        grid-template-columns:1fr;
    }

    .public-table-card{
        grid-template-columns:48px 1fr;
    }

    .sale-gallery .carousel-item{
        height:280px;
    }
}

.sale-cover__button,
.sale-gallery__button{
    position:relative;
    width:100%;
    height:100%;
    padding:0;
    display:block;
    overflow:hidden;
    background:transparent;
    border:0;
    cursor:zoom-in;
}

.sale-photo-open__icon{
    position:absolute;
    right:1rem;
    bottom:1rem;
    width:44px;
    height:44px;
    display:flex;
    align-items:center;
    justify-content:center;
    color:#fff;
    background:rgba(15,23,42,.78);
    border:1px solid rgba(255,255,255,.25);
    border-radius:50%;
    backdrop-filter:blur(8px);
    transition:transform .18s ease,background-color .18s ease;
}

.sale-photo-open:hover .sale-photo-open__icon{
    transform:scale(1.07);
    background:rgba(37,99,235,.9);
}

.sale-lightbox-modal .modal-content{
    color:#fff;
    background:#05070b;
    border:0;
}

.sale-lightbox-modal .modal-header{
    min-height:68px;
    color:#fff;
    background:#0b0f16;
    border-bottom:1px solid rgba(255,255,255,.12);
}

.sale-lightbox-modal .btn-close{
    filter:invert(1);
}

.sale-lightbox-modal .modal-body{
    position:relative;
    min-height:0;
    padding:1.25rem 5rem;
    display:flex;
    align-items:center;
    justify-content:center;
    overflow:hidden;
}

.sale-lightbox-figure{
    width:100%;
    height:100%;
    margin:0;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:1rem;
}

.sale-lightbox-image{
    display:block;
    max-width:100%;
    max-height:calc(100vh - 150px);
    object-fit:contain;
    border-radius:12px;
    box-shadow:0 24px 80px rgba(0,0,0,.45);
}

.sale-lightbox-figure figcaption{
    min-height:24px;
    color:#dbe4f0;
    text-align:center;
    font-weight:600;
}

.sale-lightbox-nav{
    position:absolute;
    top:50%;
    z-index:2;
    width:50px;
    height:50px;
    padding:0;
    display:flex;
    align-items:center;
    justify-content:center;
    color:#fff;
    background:rgba(15,23,42,.72);
    border:1px solid rgba(255,255,255,.2);
    border-radius:50%;
    transform:translateY(-50%);
}

.sale-lightbox-nav:hover{
    background:rgb(var(--theme-rgb-primary,91,42,134));
}

.sale-lightbox-nav--prev{
    left:1.25rem;
}

.sale-lightbox-nav--next{
    right:1.25rem;
}

.sale-lightbox-nav:disabled{
    opacity:.35;
    cursor:not-allowed;
}

@media(max-width:767px){
    .sale-lightbox-modal .modal-body{
        padding:1rem 3.4rem;
    }

    .sale-lightbox-nav{
        width:42px;
        height:42px;
    }

    .sale-lightbox-nav--prev{
        left:.5rem;
    }

    .sale-lightbox-nav--next{
        right:.5rem;
    }
}


.summary-affiliation,
.gallery-count-badge{
    display:inline-flex;
    align-items:center;
    padding:.5rem .8rem;
    color:rgb(var(--theme-rgb-primary,91,42,134));
    background:rgba(var(--theme-rgb-primary,91,42,134),.08);
    border:1px solid rgba(var(--theme-rgb-primary,91,42,134),.32);
    border-radius:999px;
    font-size:.82rem;
    font-weight:800;
}

.summary-chip-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(150px,1fr));
    gap:.75rem;
}

.summary-chip{
    min-height:52px;
    padding:.75rem .9rem;
    display:flex;
    align-items:center;
    gap:.65rem;
    color:#334155;
    background:#f8fafc;
    border:1px solid #dce3eb;
    border-radius:14px;
    font-weight:700;
}

.summary-chip i{
    color:rgb(var(--theme-rgb-primary,91,42,134));
    font-size:1rem;
}

.public-table-card__count{
    flex-direction:column;
    gap:.15rem;
}

.public-table-card__count strong{
    font-size:1.55rem;
    line-height:1;
}

.public-table-card__count span{
    font-size:.72rem;
    font-weight:700;
    text-transform:uppercase;
    letter-spacing:.04em;
}

.public-table-type{
    margin-bottom:.8rem;
    display:flex;
    align-items:center;
    gap:.55rem;
    color:#0f172a;
}

.public-table-type i{
    color:rgb(var(--theme-rgb-primary,91,42,134));
}

.public-table-details span{
    display:inline-flex;
    align-items:center;
    gap:.35rem;
}

.public-table-details i{
    color:rgb(var(--theme-rgb-primary,91,42,134));
}

.gallery-featured{
    position:relative;
    overflow:hidden;
    background:rgb(var(--theme-rgb-secondary,90,23,47));
    border-radius:18px;
}

.gallery-featured__button{
    position:relative;
    width:100%;
    height:min(48vw,520px);
    padding:0;
    display:block;
    overflow:hidden;
    background:transparent;
    border:0;
    cursor:zoom-in;
}

.gallery-featured__button img{
    width:100%;
    height:100%;
    object-fit:cover;
}

.gallery-featured__caption{
    position:absolute;
    right:1rem;
    bottom:1rem;
    left:1rem;
    width:max-content;
    max-width:calc(100% - 2rem);
    padding:.55rem .8rem;
    color:#fff;
    background:rgba(15,23,42,.82);
    border-radius:10px;
    font-weight:700;
}

.gallery-thumbnails{
    margin-top:1rem;
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(110px,1fr));
    gap:.75rem;
}

.gallery-thumbnail{
    height:82px;
    padding:0;
    overflow:hidden;
    background:#e2e8f0;
    border:3px solid transparent;
    border-radius:12px;
}

.gallery-thumbnail.active{
    border-color:rgb(var(--theme-rgb-primary,91,42,134));
}

.gallery-thumbnail img{
    width:100%;
    height:100%;
    object-fit:cover;
}

.map-embed{
    height:360px;
    overflow:hidden;
    border:1px solid #dce3eb;
    border-radius:18px;
}

.map-embed iframe{
    width:100%;
    height:100%;
    border:0;
}

.contact-map{
    border-color:rgb(var(--theme-rgb-primary,91,42,134));
}

@media(max-width:767px){
    .gallery-featured__button{
        height:300px;
    }

    .gallery-thumbnails{
        grid-template-columns:repeat(3,1fr);
    }

    .map-embed{
        height:300px;
    }
}

/* =====================================================
   CORREZIONI V5 - PALETTE ISTITUZIONALE
===================================================== */

.sale-detail-hero {
    padding: 3.6rem 0;
    background:
        radial-gradient(circle at 88% 20%, rgba(255,255,255,.10), transparent 28%),
        linear-gradient(135deg, rgb(var(--theme-rgb-secondary,90,23,47)) 0%, rgb(var(--theme-rgb-secondary,90,23,47)) 52%, rgb(var(--theme-rgb-primary,91,42,134)) 100%);
}

.sale-hero-content h1 {
    margin-bottom: .65rem;
    color: #fff;
    font-weight: 900;
    letter-spacing: -.035em;
}

.sale-hero-content .lead {
    color: rgba(255,255,255,.82);
}

.detail-logo {
    border: 1px solid rgba(255,255,255,.18);
    box-shadow: 0 18px 40px rgba(0,0,0,.22);
}

.card-clean {
    border: 1px solid #dbe4ee;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(15,23,42,.07);
}

.contact-whatsapp,
.contact-map,
.contact-phone,
.contact-site {
    border-color: rgb(var(--theme-rgb-primary,91,42,134));
}

.contact-whatsapp:hover,
.contact-map:hover,
.contact-phone:hover,
.contact-site:hover {
    border-color: rgb(var(--theme-rgb-primary,91,42,134));
    background: rgba(var(--theme-rgb-primary,91,42,134),.08);
    color: rgb(var(--theme-rgb-secondary,90,23,47));
}

.contact-button i {
    color: rgb(var(--theme-rgb-primary,91,42,134));
}

.scheda-map-button {
    border-color: rgb(var(--theme-rgb-primary,91,42,134));
    color: rgb(var(--theme-rgb-primary,91,42,134));
    font-weight: 800;
}

.scheda-map-button:hover,
.scheda-map-button:focus {
    border-color: rgb(var(--theme-rgb-primary,91,42,134));
    background: rgb(var(--theme-rgb-primary,91,42,134));
    color: #fff;
}

.summary-chip i,
.public-table-type i,
.public-table-details i {
    color: rgb(var(--theme-rgb-primary,91,42,134));
}

.summary-affiliation,
.gallery-count-badge {
    border-color: rgba(var(--theme-rgb-primary,91,42,134),.32);
    background: rgba(var(--theme-rgb-primary,91,42,134),.16);
    color: rgb(var(--theme-rgb-primary,91,42,134));
}

.table-total-badge,
.public-table-card__count {
    background: rgb(var(--theme-rgb-primary,91,42,134));
}

.gallery-thumbnail.active {
    border-color: rgb(var(--theme-rgb-primary,91,42,134));
}

.sale-photo-open:hover .sale-photo-open__icon,
.sale-lightbox-nav:hover {
    background: rgb(var(--theme-rgb-primary,91,42,134));
}

@media (max-width: 767.98px) {
    .sale-detail-hero {
        padding: 2.8rem 0;
    }

    .sale-hero-layout {
        gap: 1.25rem;
    }
}
