:root {
    --mire-ink: #111a24;
    --mire-navy: #172333;
    --mire-navy-soft: #213248;
    --mire-ivory: #f5f1e8;
    --mire-paper: #fcfaf5;
    --mire-gold: #a78957;
    --mire-gold-light: #d8c59d;
    --mire-line: #d9d5cc;
    --mire-muted: #65707c;
    --bs-primary: #172333;
    --bs-primary-rgb: 23, 35, 51;
    --bs-body-color: #111a24;
    --bs-body-bg: #fcfaf5;
    --bs-border-color: #d9d5cc;
    --bs-link-color: #172333;
    --bs-link-color-rgb: 23, 35, 51;
    --bs-link-hover-color: #7c6137;
    --bs-link-hover-color-rgb: 124, 97, 55;
    --bs-font-sans-serif: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html { scroll-behavior: smooth; }
body { background: var(--mire-paper); color: var(--mire-ink); letter-spacing: .005em; }
a { color: var(--mire-navy); text-decoration-color: var(--mire-gold); text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { color: #7c6137; text-decoration-color: currentColor; }
h1, h2, h3 { letter-spacing: -.035em; line-height: 1.08; }
h1 { font-size: clamp(2.6rem, 6vw, 5.8rem); font-weight: 500; }
h2 { font-size: clamp(2rem, 3.8vw, 3.3rem); font-weight: 500; }
h3 { font-size: 1.35rem; font-weight: 600; }
.btn { --bs-btn-padding-x: 1.25rem; --bs-btn-padding-y: .72rem; border-radius: 0; font-weight: 600; letter-spacing: .02em; }
.btn-sm { --bs-btn-padding-y: .48rem; --bs-btn-padding-x: .9rem; }
.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--mire-navy);
    --bs-btn-border-color: var(--mire-navy);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #26384e;
    --bs-btn-hover-border-color: #26384e;
    --bs-btn-focus-shadow-rgb: 167, 137, 87;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #0f1925;
    --bs-btn-active-border-color: #0f1925;
    --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, .16);
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: var(--mire-navy);
    --bs-btn-disabled-border-color: var(--mire-navy);
}
.form-control, .form-select { border-radius: 0; min-height: 46px; background-color: #fff; }
.form-control:focus, .form-select:focus, .form-check-input:focus, .btn:focus, .btn:focus-visible, a:focus-visible, summary:focus-visible { border-color: var(--mire-gold); box-shadow: 0 0 0 .22rem rgba(167, 137, 87, .25); outline: 0; }
.form-label { font-size: .82rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 2000; transform: translateY(-160%); background: #fff; color: #000; padding: .75rem 1rem; }
.skip-link:focus { transform: translateY(0); }
.min-vh-75 { min-height: 75vh; }
.section-pad { padding: clamp(4.5rem, 9vw, 8rem) 0; }
.bg-ivory { background: var(--mire-ivory); }
.eyebrow { color: var(--mire-gold); font-size: .75rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.text-gold { color: var(--mire-gold-light) !important; }
.lead-copy { color: #35404c; font-size: clamp(1.15rem, 2vw, 1.45rem); line-height: 1.6; }
.text-link { display: inline-flex; gap: .7rem; align-items: center; color: var(--mire-navy); font-weight: 700; text-decoration: none; border-bottom: 1px solid var(--mire-gold); padding-bottom: .2rem; }
.text-link:hover { color: #7c6137; }
.text-justify{text-align: justify}

.site-header { position: relative; z-index: 100; background: rgba(252, 250, 245, .96); border-bottom: 1px solid rgba(217, 213, 204, .8); }
.site-header .navbar, .admin-header .navbar { min-height: 88px; }
.brand-logo-link { display: inline-block; line-height: 0; }
.brand-logo { display: block; width: 220px; height: auto; }
.brand-logo-compact .brand-logo { width: 175px; }
.brand-logo-private .brand-logo { width: 190px; }
.brand-logo-footer { width: min(100%, 245px); }
.site-header .nav-link, .admin-header .nav-link { color: var(--mire-ink); font-size: .9rem; font-weight: 600; padding: .65rem .8rem !important; }
.site-header .nav-link:hover, .admin-header .nav-link:hover { color: var(--mire-gold); }

.hero-section { position: relative; overflow: hidden; background: linear-gradient(135deg, var(--mire-paper) 0%, #eee8dc 100%); }
.hero-grid { position: absolute; inset: 0 0 0 52%; opacity: .42; background-image: linear-gradient(rgba(23,35,51,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(23,35,51,.12) 1px, transparent 1px); background-size: 64px 64px; transform: skewX(-8deg); transform-origin: bottom; }
.hero-section h1 { max-width: 880px; }
.hero-lead { max-width: 760px; margin-top: 1.8rem; color: #39434e; font-size: clamp(1.08rem, 1.8vw, 1.33rem); line-height: 1.65; }
.hero-monogram {position: relative; width: min(100%, 410px); aspect-ratio: 1; margin-left: auto; border: 1px solid rgba(23,35,51,.3); display: grid; grid-template: 1fr 1fr / 1fr 1fr; background: rgba(252,250,245,.75); box-shadow: 36px 36px 0 rgba(167,137,87,.16); }
.hero-monogram::before, .hero-monogram::after { content: ""; position: absolute; background: rgba(23,35,51,.25); }
.hero-monogram::before { width: 1px; height: 100%; left: 50%; }
.hero-monogram::after { height: 1px; width: 100%; top: 50%; }
.hero-monogram span { display: flex; align-items: center; justify-content: center;font-family: "Times New Roman", Times, serif; font-size: clamp(3rem, 8vw, 6rem); font-weight: bold; letter-spacing: -.08em; }
.hero-monogram span:nth-child(2) { grid-column: 2; grid-row: 2; }
.hero-monogram small { position: absolute; right: 1rem; bottom: 1rem; color: var(--mire-muted); font-size: .65rem; letter-spacing: .15em; text-transform: uppercase; }

.facts-grid { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--mire-line); border-left: 1px solid var(--mire-line); }
.facts-grid > div { min-height: 145px; padding: 1.5rem; border-right: 1px solid var(--mire-line); border-bottom: 1px solid var(--mire-line); }
.facts-grid dt { margin-bottom: .85rem; color: var(--mire-muted); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; }
.facts-grid dd { margin: 0; font-size: 1.08rem; font-weight: 600; }
.section-heading { display: grid; grid-template-columns: minmax(0, 2fr) minmax(250px, 1fr); align-items: end; gap: 3rem; margin-bottom: 2rem; }
.section-heading > p { color: var(--mire-muted); line-height: 1.65; }
.scope-card, .detail-card { position: relative; border: 1px solid var(--mire-line); background: rgba(255,255,255,.45); padding: clamp(1.5rem, 4vw, 2.5rem); transition: border-color .2s ease, transform .2s ease; }
.scope-card:hover, .detail-card:hover { border-color: var(--mire-gold); transform: translateY(-2px); }
.scope-card > span, .card-index { display: block; margin-bottom: 3rem; color: var(--mire-gold); font-size: .72rem; font-weight: 800; letter-spacing: .12em; }
.scope-card p, .detail-card p { margin: 1rem 0 0; color: var(--mire-muted); line-height: 1.65; }
.private-callout { padding: clamp(4rem, 8vw, 7rem) 0; background: var(--mire-navy); color: #fff; }
.private-callout h2 { max-width: 850px; }
.private-callout p:not(.eyebrow) { max-width: 780px; color: #bfc8d1; font-size: 1.05rem; line-height: 1.65; }

.page-hero { padding: clamp(5rem, 11vw, 9rem) 0; background: var(--mire-navy); color: #fff; }
.page-hero h1 { max-width: 950px; }
.page-hero > .container > p:last-child { max-width: 760px; margin-top: 1.5rem; color: #c4ccd4; font-size: 1.18rem; line-height: 1.6; }
.page-hero-small { padding: 4rem 0; }
.company-table { border: 1px solid var(--mire-line); background: #fff; }
.company-table th, .company-table td { padding: 1.1rem 1.3rem; border-color: var(--mire-line); }
.company-table th { width: 42%; color: var(--mire-muted); font-size: .78rem; letter-spacing: .05em; text-transform: uppercase; }
.notice-box, .security-note { border-left: 3px solid var(--mire-gold); background: var(--mire-ivory); padding: 1.4rem 1.6rem; }
.notice-box strong, .security-note strong { display: block; margin-bottom: .4rem; }
.detail-card { min-height: 310px; }
.detail-card h2 { font-size: 1.65rem; }
.contact-panel { background: var(--mire-navy); color: #fff; padding: 2.5rem; }
.contact-panel address { color: #ccd2d9; font-size: 1.25rem; line-height: 1.7; }
.contact-panel hr { border-color: rgba(255,255,255,.2); }
.contact-alert { padding: 1.5rem 0 0; background: var(--mire-paper); }
.bot-trap { position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important; }
.legal-copy { max-width: 880px; }
.legal-copy h2 { margin-top: 3rem; font-size: 1.8rem; }
.legal-copy p { color: #4b5661; line-height: 1.75; }

.login-section { min-height: calc(100vh - 88px); display: grid; align-items: center; padding: 5rem 0; background: var(--mire-ivory); }
.login-card { border-top: 4px solid var(--mire-gold); background: #fff; padding: clamp(2rem, 6vw, 3.5rem); box-shadow: 0 24px 70px rgba(17,26,36,.1); }
.login-card h1 { font-size: clamp(2.4rem, 5vw, 3.5rem); }

.private-header { background: #101a27; border-bottom: 1px solid rgba(255,255,255,.13); }
.private-header .navbar { min-height: 82px; }
.private-hero { padding: 5rem 0; background: var(--mire-navy); color: #fff; }
.private-hero-small { padding: 3.5rem 0; }
.private-hero h1 { font-size: clamp(2.5rem, 5vw, 4.5rem); }
.private-hero p:last-child { color: #c3cad1; font-size: 1.1rem; }
.back-link { color: #fff; text-decoration: none; }
.profile-strip { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--mire-line); background: #fff; }
.profile-strip > div { padding: 1.25rem 1.5rem; border-right: 1px solid var(--mire-line); }
.profile-strip > div:last-child { border-right: 0; }
.profile-strip span, .profile-strip strong { display: block; }
.profile-strip span { margin-bottom: .35rem; color: var(--mire-muted); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; }
.count-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 42px; height: 42px; border-radius: 50%; background: var(--mire-navy); color: #fff; font-weight: 700; }
.property-card { display: flex; flex-direction: column; border: 1px solid var(--mire-line); background: #fff; padding: 1.75rem; }
.property-code { color: var(--mire-gold); font-size: .7rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.property-card h3 { margin: 2.5rem 0 .5rem; }
.property-location { color: var(--mire-muted); }
.property-card > p:last-of-type { flex: 1; }
.property-footer { display: flex; justify-content: space-between; border-top: 1px solid var(--mire-line); padding-top: 1rem; margin-top: 1rem; font-size: .85rem; }
.property-footer a { font-weight: 700; text-decoration: none; }
.empty-state { border: 1px dashed #b5b0a5; background: rgba(255,255,255,.5); padding: 3rem; text-align: center; }
.property-description { max-width: 800px; }
.document-list { border-top: 1px solid var(--mire-line); }
.document-row { display: grid; grid-template-columns: 58px 1fr auto; gap: 1.25rem; align-items: center; padding: 1.35rem 0; border-bottom: 1px solid var(--mire-line); }
.document-icon { width: 52px; height: 64px; display: grid; place-items: center; background: var(--mire-navy); color: #fff; font-size: .65rem; font-weight: 800; letter-spacing: .1em; }
.document-category { color: var(--mire-gold); font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.document-main h3 { margin: .25rem 0; font-size: 1.1rem; }
.document-main p { margin: 0; color: var(--mire-muted); font-size: .82rem; }

.admin-shell { background: #f2f3f4; }
.admin-header { background: #fff; }
.admin-page { padding: 2.5rem 0 5rem; }
.admin-title { display: flex; justify-content: space-between; align-items: end; gap: 2rem; margin-bottom: 2rem; }
.admin-title h1 { margin: 0; font-size: clamp(2.2rem, 4vw, 3.5rem); }
.admin-title > p, .admin-title > div > p:last-child { color: var(--mire-muted); }
.back-link-dark { color: var(--mire-ink); font-size: .9rem; font-weight: 700; text-decoration: none; }
.metric-card, .admin-panel, .admin-property-card { border: 1px solid #dde0e3; background: #fff; }
.metric-card { padding: 1.6rem; }
.metric-card span, .metric-card strong, .metric-card a { display: block; }
.metric-card span { color: var(--mire-muted); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.metric-card strong { margin: 1rem 0; font-size: 2.5rem; font-weight: 500; }
.metric-card a { font-size: .85rem; font-weight: 700; text-decoration: none; }
.admin-panel { padding: 1.5rem; }
.form-panel { max-width: 900px; }
.panel-heading { display: flex; justify-content: space-between; align-items: start; gap: 1rem; margin-bottom: 1.3rem; }
.panel-heading h2, .admin-panel > h2 { font-size: 1.35rem; font-weight: 700; }
.panel-heading p, .admin-panel > p { margin: .3rem 0 0; color: var(--mire-muted); font-size: .9rem; }
.admin-table { margin: 0; }
.admin-table th { padding: .8rem; color: var(--mire-muted); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.admin-table td { padding: .95rem .8rem; }
.admin-table td small { display: block; margin-top: .25rem; color: var(--mire-muted); }
.status-badge { display: inline-block; border: 1px solid #cfd4d9; background: #f5f6f7; padding: .25rem .5rem; color: #4e5964; font-size: .66rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.status-active, .status-published { border-color: #9dc3aa; background: #edf7f0; color: #22603a; }
.status-disabled, .status-archived, .status-inactive { border-color: #dfb1ae; background: #fbefee; color: #8a302a; }
.status-new { border-color: #dac28e; background: #fff8e7; color: #76551f; }
.status-reviewed { border-color: #b8c4cf; background: #f1f4f6; color: #405261; }
.message-filters { display: flex; flex-wrap: wrap; gap: .6rem; margin: 0 0 1.5rem; }
.message-filters a { border: 1px solid var(--mire-line); padding: .5rem .8rem; color: var(--mire-ink); font-size: .82rem; font-weight: 700; text-decoration: none; }
.message-filters a:hover, .message-filters a.is-active { border-color: var(--mire-navy); background: var(--mire-navy); color: #fff; }
.message-table tr.is-unread > * { background: #fffdf8; }
.message-preview { display: block; max-width: 560px; color: var(--mire-ink); line-height: 1.45; }
.message-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .4rem; }
.message-actions form { margin: 0; }
.message-detail { max-width: 920px; }
.message-meta { display: flex; flex-wrap: wrap; gap: 2.5rem; margin: 0; padding-bottom: 1.25rem; border-bottom: 1px solid #e2e4e6; }
.message-meta dt { color: var(--mire-muted); font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.message-meta dd { margin: .3rem 0 0; }
.message-body { max-width: 760px; padding: 2rem 0 .5rem; font-size: 1.05rem; line-height: 1.75; white-space: normal; }
.admin-property-card { padding: 1.5rem; }
.admin-property-card h2 { margin: 2.5rem 0 .4rem; font-size: 1.5rem; }
.admin-property-card > p { color: var(--mire-muted); }
.property-stats { display: flex; gap: 1.7rem; margin: 1.5rem 0; padding-top: 1rem; border-top: 1px solid #e2e4e6; color: var(--mire-muted); font-size: .82rem; }
.property-stats strong { color: var(--mire-ink); font-size: 1.1rem; }
.association-list { display: grid; gap: .8rem; }
.association-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-bottom: 1px solid #e5e7e9; padding-bottom: .8rem; }
.association-row small { display: block; margin-top: .2rem; color: var(--mire-muted); }
.document-admin-list { display: grid; gap: .8rem; }
.document-admin-item { border: 1px solid #e0e3e5; padding: 1rem; }
.document-admin-item h3 { margin: .25rem 0; font-size: 1.05rem; }
.document-summary p { margin: 0; color: var(--mire-muted); font-size: .8rem; }
.document-admin-item details { margin-top: .8rem; border-top: 1px solid #e0e3e5; padding-top: .7rem; }
.document-admin-item summary { cursor: pointer; color: var(--mire-navy); font-size: .82rem; font-weight: 700; }
.audit-agent { max-width: 260px; overflow-wrap: anywhere; color: var(--mire-muted) !important; font-size: .75rem; }

.site-footer { padding: 4.5rem 0 2rem; background: #101820; color: #d5d9dd; }
.footer-heading { color: var(--mire-gold-light); font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.site-footer address { line-height: 1.75; }
.footer-links li { margin-bottom: .55rem; }
.footer-links a { color: #d5d9dd; text-decoration-color: rgba(216, 197, 157, .7); }
.footer-links a:hover { color: var(--mire-gold-light); }
.footer-bottom { margin-top: 3rem; border-top: 1px solid rgba(255,255,255,.13); padding-top: 1.4rem; color: #8e99a3; font-size: .72rem; }
.error-page { min-height: 68vh; display: grid; align-items: center; padding: 5rem 0; }
.error-page p:not(.eyebrow) { max-width: 650px; color: var(--mire-muted); font-size: 1.1rem; }
.debug-box { max-width: 900px; overflow: auto; margin: 2rem 0; padding: 1rem; background: #1b222a; color: #f3f3f3; font-size: .8rem; }

@media (max-width: 991.98px) {
    .site-header .navbar-collapse, .admin-header .navbar-collapse { margin-top: 1rem; padding: 1rem 0; border-top: 1px solid var(--mire-line); }
    .hero-grid { left: 30%; }
    .hero-section { padding: 3rem 0 6rem; }
    .hero-monogram { margin: 1rem auto 0; max-width: 360px; }
    .section-heading { grid-template-columns: 1fr; gap: 1rem; }
    .profile-strip { grid-template-columns: 1fr; }
    .profile-strip > div { border-right: 0; border-bottom: 1px solid var(--mire-line); }
    .profile-strip > div:last-child { border-bottom: 0; }
}

@media (max-width: 767.98px) {
    h1 { font-size: 2.65rem; }
    h2 { font-size: 2rem; }
    .brand-logo { width: 180px; }
    .brand-logo-compact .brand-logo { width: 155px; }
    .brand-logo-private .brand-logo { width: 170px; }
    .facts-grid { grid-template-columns: 1fr; }
    .facts-grid > div { min-height: auto; }
    .company-table th, .company-table td { display: block; width: 100%; }
    .company-table th { padding-bottom: .25rem; border-bottom: 0; }
    .company-table td { padding-top: .25rem; }
    .document-row { grid-template-columns: 48px 1fr; }
    .document-row .btn { grid-column: 1 / -1; }
    .admin-title { align-items: flex-start; flex-direction: column; }
    .association-row { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 575.98px) {
    /* Le righe g-5 devono rientrare nei 12px di padding del container mobile. */
    .public-shell .container > .row.g-5 { --bs-gutter-x: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
