/* ============================================================
   CodiciCatastali.it — Via Stylesheet
   Design: pulito, moderno, cartografia e dati catastali
   ============================================================ */

/* ── Via page layout ───────────────────────────────────────────── */
.via-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 55%, #0055A4 100%);
    border-radius: 14px;
    padding: 2rem 2.2rem 1.75rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 55, 140, .25);
    max-width: 100%;
    box-sizing: border-box;
}

.via-hero::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, .07) 0%, transparent 70%);
    pointer-events: none;
}

.via-hero h1 {
    color: #fff;
    margin: 0 0 .45rem;
    font-size: clamp(1.35rem, 3.5vw, 2rem);
    font-weight: 800;
    letter-spacing: -.02em;
    word-break: break-word;
    overflow-wrap: break-word;
}

.via-hero .subtitle {
    color: rgba(255, 255, 255, .72);
    font-size: .9rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.via-hero .subtitle .chip {
    background: rgba(255, 255, 255, .15);
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: .78rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

/* ── Selectors ─────────────────────────────────────────────────── */
.via-selector-box {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.75rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
    max-width: 100%;
    box-sizing: border-box;
}

.via-selector-box label {
    font-size: .82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #64748b;
    display: block;
    margin-bottom: .65rem;
}

.via-selector-row {
    display: flex;
    align-items: center;
    gap: .85rem;
    flex-wrap: wrap;
    max-width: 100%;
    box-sizing: border-box;
}

.via-selector-row select {
    flex: 1;
    min-width: 180px;
    max-width: 280px;
    padding: .6rem .95rem;
    border-radius: 7px;
    border: 1.5px solid #cbd5e1;
    font-size: .92rem;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
    box-sizing: border-box;
}

.via-selector-row select:focus {
    border-color: #0055A4;
    box-shadow: 0 0 0 3px rgba(0, 85, 164, .12);
    outline: none;
}

#sel-count {
    font-size: .82rem;
    color: #64748b;
    font-weight: 600;
    font-family: monospace;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

@keyframes via-spin {
    to {
        transform: rotate(360deg);
    }
}

#sel-spinner {
    animation: via-spin 1s linear infinite;
}

/* ── Parcel card ───────────────────────────────────────────────── */
.parcel-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .07);
    max-width: 100%;
    box-sizing: border-box;
}

.parcel-card-header {
    background: linear-gradient(90deg, #0055A4 0%, #1d4ed8 100%);
    padding: .85rem 1.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
    max-width: 100%;
    box-sizing: border-box;
}

.parcel-card-header .ref-title {
    color: #fff;
    font-family: ui-monospace, monospace;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: .04em;
    min-width: 0;
    word-break: break-all;
    overflow-wrap: anywhere;
}

.parcel-card-header .ref-copy-btn {
    background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255, 255, 255, .3);
    color: #fff;
    border-radius: 6px;
    padding: .3rem .7rem;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    transition: background .15s;
    flex-shrink: 0;
}

.parcel-card-header .ref-copy-btn:hover {
    background: rgba(255, 255, 255, .3);
}

#ref-copy-toast {
    transition: opacity .3s;
    font-size: .75rem;
    background: #1e293b;
    color: #fff;
    padding: .2rem .6rem;
    border-radius: 4px;
    pointer-events: none;
    white-space: nowrap;
    opacity: 0;
}

.parcel-card-body {
    display: flex;
    flex-wrap: wrap;
    max-width: 100%;
    box-sizing: border-box;
}

/* left: data grid */
.parcel-data-col {
    flex: 1;
    min-width: 260px;
    padding: 1.4rem 1.6rem;
    border-right: 1px solid #f1f5f9;
    max-width: 100%;
    box-sizing: border-box;
}

.parcel-grid {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    row-gap: 0;
    column-gap: 1.2rem;
    max-width: 100%;
    box-sizing: border-box;
}

.parcel-grid-label {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #475569;
    padding: .55rem 0 .55rem;
    border-bottom: 1px solid #f8fafc;
    white-space: nowrap;
}

.parcel-grid-value {
    font-size: .92rem;
    color: #1e293b;
    font-weight: 500;
    padding: .55rem 0;
    border-bottom: 1px solid #f8fafc;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.parcel-grid-label:last-of-type,
.parcel-grid-value:last-of-type {
    border-bottom: none;
}

.mono {
    font-family: ui-monospace, monospace;
    font-size: .88rem;
}

/* right: map */
.parcel-map-col {
    flex: 0 0 360px;
    min-width: 260px;
    position: relative;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

#parcella-map {
    height: 100%;
    min-height: 300px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* ── WMS layer toggle ──────────────────────────────────────────── */
.map-layers-bar {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
}

.layer-chip {
    background: rgba(255, 255, 255, .92);
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: .72rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: border-color .15s, background .15s;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .1);
}

.layer-chip.active {
    background: #0055A4;
    color: #fff;
    border-color: #0055A4;
}

.layer-chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── CTA buttons ───────────────────────────────────────────────── */
.parcel-cta {
    display: flex;
    gap: .65rem;
    flex-wrap: wrap;
    padding: 1rem 1.6rem;
    border-top: 1px solid #f1f5f9;
    background: #fafbfd;
}

.btn-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: .5rem 1rem;
    border-radius: 7px;
    font-size: .83rem;
    font-weight: 600;
    text-decoration: none;
    transition: transform .12s, box-shadow .15s;
    cursor: pointer;
    border: none;
}

.btn-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
}

.btn-cta-primary {
    background: #0055A4;
    color: #fff;
}

.btn-cta-green {
    background: #059669;
    color: #fff;
}

.btn-cta-outline {
    background: #fff;
    color: #374151;
    border: 1.5px solid #e2e8f0;
}

/* ── Legal notice ──────────────────────────────────────────────── */
.legal-notice {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    padding: .85rem 1.25rem;
    margin-bottom: 1.5rem;
    font-size: .83rem;
    color: #78350f;
}

/* ── Relazione tecnico-catastale e territoriale ─────────────────── */
.via-seo-text-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .07);
    margin-top: 1.75rem;
    margin-bottom: 2rem;
}

.via-seo-text-body {
    padding: 1.6rem 2rem;
    color: #334155;
    font-size: .95rem;
    line-height: 1.78;
}

.via-seo-text-body p {
    margin: 0 0 1.25rem;
}

.via-seo-text-body p:last-child {
    margin-bottom: 0;
}

.via-seo-text-body strong {
    color: #0f172a;
    font-weight: 700;
}

/* ── General via map ───────────────────────────────────────────── */
.via-map-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .07);
    margin-top: 1.5rem;
    max-width: 100%;
    box-sizing: border-box;
}

.via-map-card-header {
    padding: .9rem 1.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .65rem;
    border-bottom: 1px solid #f1f5f9;
    flex-wrap: wrap;
    max-width: 100%;
    box-sizing: border-box;
}

.via-map-card-header h2,
.via-map-card-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    flex: 1 1 auto;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: break-word;
}

.via-map-badge {
    margin-left: auto;
    font-size: .75rem;
    background: #eff6ff;
    color: #1d4ed8;
    padding: .22rem .65rem;
    border-radius: 9999px;
    font-weight: 700;
    border: 1px solid #bfdbfe;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
}

#via-map {
    height: 440px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Map background */
.leaflet-container {
    background: #ffffff !important;
    max-width: 100%;
}

@media (max-width: 768px) {
    .parcel-map-col {
        flex: 0 0 100%;
        min-width: 0;
        border-top: 1px solid #f1f5f9;
    }

    .parcel-data-col {
        border-right: none;
    }

    #parcella-map {
        min-height: 250px;
    }

    .via-selector-row select {
        max-width: 100%;
    }
}

/* ── Italy map placeholder SVG ──────────────────────────────── */
.italy-map-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    background: #f8fafc;
    width: 100%;
    height: 100%;
    min-height: 300px;
    position: relative;
    overflow: hidden;
}

.italy-map-placeholder .italy-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: .06;
    pointer-events: none;
}

.italy-map-placeholder .italy-svg .st0 {
    fill: none;
    stroke: #0055A4;
    stroke-width: 4;
    stroke-linejoin: round;
}

.italy-map-placeholder .map-loading-label {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
}

/* ── POI: Accessibilità e servizi ──────────────────────────────── */
.poi-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .07);
    margin-top: 1.5rem;
    max-width: 100%;
    box-sizing: border-box;
}

.poi-subtitle {
    margin: 0;
    padding: .8rem 1.4rem 0;
    font-size: .8rem;
    color: #64748b;
    line-height: 1.5;
    word-break: break-word;
}

.poi-subtitle a {
    color: #0055A4;
    text-decoration: underline;
    font-weight: 600;
}

.poi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: .9rem;
    padding: 1rem 1.4rem 1.4rem;
    max-width: 100%;
    box-sizing: border-box;
}

.poi-cat {
    border: 1px solid #e9eef5;
    border-radius: 10px;
    padding: .8rem 1rem;
    background: #fbfcfe;
    min-width: 0;
    box-sizing: border-box;
}

.poi-cat-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .55rem;
    min-width: 0;
}

.poi-cat-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.poi-cat-title {
    font-size: .85rem;
    font-weight: 700;
    color: #1e293b;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.poi-cat-count {
    margin-left: auto;
    font-size: .7rem;
    background: #eff6ff;
    color: #1d4ed8;
    padding: .15rem .5rem;
    border-radius: 999px;
    font-weight: 700;
    border: 1px solid #bfdbfe;
    flex-shrink: 0;
}

.poi-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.poi-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .6rem;
    padding: .32rem 0;
    border-top: 1px dashed #eef2f7;
    font-size: .8rem;
    min-width: 0;
}

.poi-item:first-child {
    border-top: none;
}

.poi-item-name {
    color: #334155;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1 1 auto;
}

.poi-item-sub {
    color: #64748b;
    font-size: .72rem;
}

.poi-dist {
    color: #0055A4;
    font-weight: 700;
    white-space: nowrap;
    font-size: .76rem;
    flex-shrink: 0;
}

.poi-item[data-poi-idx] {
    cursor: pointer;
    padding: .32rem .3rem;
    margin: 0 -.3rem;
    border-radius: 4px;
    transition: background .12s;
}

.poi-item[data-poi-idx]:hover {
    background: #eef4fb;
}

.poi-item[data-poi-idx]:focus-visible {
    outline: 2px solid #0055A4;
    outline-offset: 1px;
}

@media (max-width: 700px) {
    .poi-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Migrated from inline styles in via.php ── */
.via-hero .subtitle strong,
.via-hero .stat-pill strong {
    color: #ffffff;
}

.alert-empty-parcels {
    background: #fff8e1;
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    padding: 1rem 1.4rem;
    color: #7a5c00;
    font-size: 0.9rem;
}

.selector-hint {
    font-size: 0.78rem;
    color: #64748b;
    margin-top: -5px;
    margin-bottom: 12px;
}

#sel-parcella {
    visibility: hidden;
    flex: 2;
    min-width: 240px;
}

.parcel-header-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.parcel-grid-value.mono {
    font-size: 0.82rem;
}

.parcel-belfiore-sub {
    font-size: 0.8rem;
    color: #64748b;
}

.text-not-available {
    color: #475569;
    font-style: italic;
    font-weight: 500;
}

.link-agenzia-entrate {
    color: #0055A4;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.omi-section {
    margin-top: 1.5rem;
    padding-top: 1.2rem;
    border-top: 1px dashed #cbd5e1;
}

.omi-section-title {
    margin: 0 0 0.3rem;
    font-size: 0.9rem;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.omi-zone-subtitle {
    font-size: 0.75rem;
    color: #64748b;
    margin: 0 0 1rem;
}

.omi-price-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.7rem;
}

.omi-price-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.6rem;
}

.omi-card-type {
    font-size: 0.75rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 2px;
    line-height: 1.2;
}

.omi-card-status {
    font-size: 0.7rem;
    color: #64748b;
    margin-bottom: 6px;
}

.omi-card-price {
    font-size: 0.85rem;
    font-weight: 600;
    color: #059669;
}

.map-grid-pattern {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.7;
}

.map-loading-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.85);
    padding: 1.5rem 2.5rem;
    border-radius: 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(4px);
    position: relative;
    z-index: 2;
}

.via-spin-icon {
    animation: via-spin 1.2s linear infinite;
}

.map-title-label {
    font-size: 1.1rem;
    font-weight: 700;
    color: #334155;
    letter-spacing: 0.02em;
    margin-top: 0.5rem;
}

.map-status-label {
    font-size: 0.85rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.layer-chip-dot--red { background: #e53e3e; }
.layer-chip-dot--blue { background: #3182ce; }
.layer-chip-dot--purple { background: #805ad5; }
.layer-chip-dot--amber { background: #f59e0b; }
.layer-chip-dot--gray { background: #ccc; }

.legal-notice-link {
    color: #78350f;
    text-decoration: underline;
    font-weight: 700;
}

.legal-notice-link:hover {
    color: #92400e;
}

.via-map-placeholder {
    height: 440px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background: #0f172a;
}

.via-sat-preview-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.85);
    transition: transform .35s ease, filter .35s ease;
}

.via-map-placeholder:hover .via-sat-preview-img {
    filter: brightness(0.95);
    transform: scale(1.02);
}

.via-sat-overlay {
    position: relative;
    z-index: 2;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    padding: .85rem 1.4rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    text-align: center;
    color: #fff;
    pointer-events: none;
}

.via-sat-overlay .map-title-label {
    color: #fff;
    font-weight: 700;
    font-size: .95rem;
    margin-bottom: .25rem;
}

.via-sat-btn {
    display: inline-flex;
    align-items: center;
    background: #0055A4;
    color: #fff;
    font-weight: 600;
    font-size: .82rem;
    padding: .4rem .9rem;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 85, 164, 0.45);
    transition: background .2s, transform .15s;
    pointer-events: auto;
}

.via-map-placeholder:hover .via-sat-btn {
    background: #1d4ed8;
    transform: translateY(-1px);
}

#via-map {
    height: 440px;
    width: 100%;
    display: none;
}

/* POI category icon styles */
.poi-cat-icon--bus { background: rgba(14, 165, 233, 0.1); color: #0ea5e9; }
.poi-cat-icon--health { background: rgba(220, 38, 38, 0.1); color: #dc2626; }
.poi-cat-icon--pharmacy { background: rgba(5, 150, 105, 0.1); color: #059669; }
.poi-cat-icon--book { background: rgba(124, 58, 237, 0.1); color: #7c3aed; }
.poi-cat-icon--cart { background: rgba(217, 119, 6, 0.1); color: #d97706; }
.poi-cat-icon--card { background: rgba(3, 105, 161, 0.1); color: #0369a1; }
.poi-cat-icon--mail { background: rgba(202, 138, 4, 0.1); color: #ca8a04; }
.poi-cat-icon--coffee { background: rgba(180, 83, 9, 0.1); color: #b45309; }
.poi-cat-icon--parking { background: rgba(37, 99, 235, 0.1); color: #2563eb; }
.poi-cat-icon--fuel { background: rgba(71, 85, 105, 0.1); color: #475569; }
.poi-cat-icon--landmark { background: rgba(15, 118, 110, 0.1); color: #0f766e; }

/* Leaflet marker pins & popups */
.marker-pin-active {
    width: 16px;
    height: 16px;
    background: #dc2626;
    border-radius: 50%;
    border: 2.5px solid #fff;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
}
.marker-pin-gray {
    width: 14px;
    height: 14px;
    background: #64748b;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.marker-pin-portal {
    width: 14px;
    height: 14px;
    background: #3b82f6;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.marker-pin-adj {
    width: 14px;
    height: 14px;
    background: #f59e0b;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.popup-ref-label {
    font-family: monospace;
    font-size: 0.85rem;
    font-weight: 700;
}

.poi-popup-card {
    min-width: 150px;
}
.poi-popup-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1e293b;
}
.poi-popup-sub {
    font-size: 0.72rem;
    color: #64748b;
}
.poi-popup-desc {
    font-size: 0.72rem;
    color: #64748b;
}
.poi-popup-dist {
    font-size: 0.76rem;
    color: #0055A4;
    font-weight: 700;
    margin-top: 3px;
}

/* Modal colindante */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 440px;
    height: 310px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
}
.modal-title {
    margin-top: 0;
    margin-bottom: 12px;
    color: #0f172a;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.modal-body {
    margin: 8px 0;
    font-size: 0.95rem;
    color: #334155;
    line-height: 1.6;
    flex: 1;
    overflow-y: auto;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.btn-modal-close {
    padding: 8px 16px;
    border: 1px solid #cbd5e1;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color var(--transition);
}
.btn-modal-close:hover {
    background-color: #f1f5f9;
}
.btn-modal-link {
    padding: 8px 16px;
    background: #0055A4;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color var(--transition);
}
.btn-modal-link:hover {
    background: #003d75;
    color: #fff;
}
.modal-coords {
    margin-top: 10px;
    font-size: 0.85em;
    color: #64748b;
}

/* ── Altre vie / Calles cercanas (Enlazado circular SEO) ── */
.xor-grid-cercanos-wrap {
    max-width: 1100px;
    margin: 3rem auto 2.5rem;
    padding: 0 1rem;
    text-align: center;
    box-sizing: border-box;
    width: 100%;
}

.xor-grid-cercanos-wrap h2,
.xor-grid-cercanos-wrap h3 {
    font-size: 1.15rem;
    color: #0f172a;
    font-weight: 700;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
    display: inline-block;
    max-width: 100%;
    word-break: break-word;
}

.xor-grid-cercanos {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
}

.xor-grid-cercanos a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-decoration: none;
    color: #334155;
    font-weight: 500;
    font-size: 0.9rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.xor-grid-cercanos a:hover {
    border-color: #0055A4;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 85, 164, 0.1);
    color: #0055A4;
}

.xor-grid-cercanos a svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #0055A4;
    stroke-width: 2;
}

.xor-grid-cercanos a span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1 1 0%;
}

@media (max-width: 900px) {
    .xor-grid-cercanos {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ── Global responsive adjustments for Via page ─────────────── */
@media (max-width: 640px) {
    .via-hero {
        padding: 1.25rem 1rem 1.1rem;
        margin-bottom: 1.25rem;
        border-radius: 10px;
    }

    .via-hero h1 {
        font-size: clamp(1.2rem, 5vw, 1.55rem);
    }

    .via-hero .subtitle {
        font-size: 0.82rem;
        gap: 0.35rem;
    }

    .via-selector-box {
        padding: 1rem 0.85rem;
        margin-bottom: 1.25rem;
    }

    .via-selector-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
    }

    .via-selector-row select {
        width: 100%;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    #sel-parcella {
        min-width: 0 !important;
        width: 100%;
    }

    /* Parcel Card Mobile */
    .parcel-card {
        border-radius: 10px;
        margin-bottom: 1.25rem;
    }

    .parcel-card-header {
        padding: 0.75rem 0.85rem;
    }

    .parcel-card-header .ref-title {
        font-size: 0.92rem;
    }

    .parcel-data-col {
        min-width: 0;
        padding: 1rem 0.85rem;
    }

    .parcel-grid {
        grid-template-columns: minmax(95px, 120px) minmax(0, 1fr);
        column-gap: 0.65rem;
    }

    .parcel-grid-label {
        font-size: 0.72rem;
        white-space: normal;
        line-height: 1.25;
        padding: 0.45rem 0;
    }

    .parcel-grid-value {
        font-size: 0.88rem;
        padding: 0.45rem 0;
    }

    .parcel-grid-value.mono {
        font-size: 0.8rem;
        word-break: break-all;
    }

    .parcel-cta {
        padding: 0.75rem 0.85rem;
        gap: 0.5rem;
    }

    .btn-cta {
        flex: 1 1 calc(50% - 0.5rem);
        justify-content: center;
        padding: 0.5rem 0.65rem;
        font-size: 0.78rem;
        text-align: center;
    }

    /* Map card header & badges */
    .via-map-card-header {
        padding: 0.75rem 0.85rem;
        gap: 0.45rem 0.6rem;
    }

    .via-map-card-header h2,
    .via-map-card-header h3 {
        font-size: 0.92rem;
        line-height: 1.35;
    }

    .via-map-badge {
        font-size: 0.7rem;
        padding: 0.18rem 0.55rem;
    }

    #via-map,
    .via-map-placeholder {
        height: 320px;
    }

    /* POI Section Mobile */
    .poi-section {
        border-radius: 10px;
    }

    .poi-subtitle {
        padding: 0.65rem 0.85rem 0;
        font-size: 0.76rem;
    }

    .poi-grid {
        grid-template-columns: 1fr;
        padding: 0.85rem 0.85rem 1rem;
        gap: 0.75rem;
    }

    .poi-cat {
        padding: 0.7rem 0.85rem;
    }

    /* SEO text card Mobile */
    .via-seo-text-card {
        border-radius: 10px;
        margin-top: 1.25rem;
        margin-bottom: 1.5rem;
    }

    .via-seo-text-body {
        padding: 1.1rem 0.95rem;
        font-size: 0.9rem;
        line-height: 1.65;
    }

    /* Circular link cards Mobile */
    .xor-grid-cercanos-wrap {
        margin: 2rem auto 1.5rem;
        padding: 0;
    }

    .xor-grid-cercanos-wrap h2,
    .xor-grid-cercanos-wrap h3 {
        font-size: 1.05rem;
        margin-bottom: 1rem;
    }

    .xor-grid-cercanos {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.6rem;
    }

    .xor-grid-cercanos a {
        padding: 0.75rem 0.85rem;
        font-size: 0.85rem;
    }

    /* OMI Section Mobile */
    .omi-price-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 0.5rem;
    }

    .omi-price-card {
        padding: 0.5rem;
    }

    .map-loading-label {
        padding: 1rem 1.25rem;
        max-width: 90%;
        text-align: center;
    }
}

/* ── Extra small screens (≤ 380px) ────────────────────────── */
@media (max-width: 380px) {
    .parcel-grid {
        grid-template-columns: 1fr;
        row-gap: 0.15rem;
    }

    .parcel-grid-label {
        padding: 0.4rem 0 0.1rem;
        border-bottom: none;
    }

    .parcel-grid-value {
        padding: 0 0 0.45rem;
        border-bottom: 1px solid #f1f5f9;
    }

    .btn-cta {
        flex: 1 1 100%;
    }

    .via-map-card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .via-map-badge {
        margin-left: 0;
        margin-top: 0.25rem;
    }
}

/* ── Via Empty State Card (Páginas de vía sin parcelas a 50m) ──── */
.via-empty-state-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 2.2rem;
    margin-bottom: 2.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.via-empty-state-header {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.via-empty-state-icon {
    flex-shrink: 0;
    background: rgba(0, 85, 164, 0.08);
    border: 1px solid rgba(0, 85, 164, 0.16);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.via-empty-state-header-text h2 {
    font-size: 1.28rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.5rem;
    line-height: 1.35;
}

.via-empty-state-header-text p {
    font-size: 0.94rem;
    color: #475569;
    line-height: 1.6;
    margin: 0;
}

.via-empty-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.via-empty-option-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.via-empty-option-step {
    display: inline-block;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    width: fit-content;
    margin-bottom: 0.65rem;
}

.via-empty-option-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 0.6rem;
}

.via-empty-option-card p {
    font-size: 0.88rem;
    color: #64748b;
    line-height: 1.55;
    margin: 0 0 1.2rem;
    flex-grow: 1;
}

.via-empty-office-desc {
    margin-bottom: 0.75rem !important;
}

.via-empty-office-info {
    font-size: 0.85rem;
    color: #334155;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.via-empty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #0055A4;
    color: #ffffff !important;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 85, 164, 0.2);
}

.via-empty-btn:hover {
    background: #003e7a;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 85, 164, 0.3);
}

.via-empty-btn-sec {
    background: #0284c7;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.2);
}

.via-empty-btn-sec:hover {
    background: #0369a1;
}

.via-empty-summary-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
}

.via-empty-summary-box h4 {
    font-size: 0.78rem;
    text-transform: uppercase;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.5px;
    margin: 0 0 0.85rem;
}

.via-empty-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.85rem;
    font-size: 0.9rem;
    color: #334155;
}

.via-empty-summary-grid span {
    color: #64748b;
    margin-right: 0.35rem;
}

@media (max-width: 640px) {
    .via-empty-state-card {
        padding: 1.5rem;
    }
    .via-empty-state-header {
        flex-direction: column;
        gap: 0.85rem;
    }
    .via-empty-options-grid {
        grid-template-columns: 1fr;
    }
}
