/* =============================================================
   CASE ITALIA RADAR — DESIGN SYSTEM "Casa d'Aste"
   Editoriale · premium · autorevole. Bordeaux + Crema + Oro + Salvia.
   Typeface signature: Fraunces (titoli) · Hanken Grotesk (testo) · IBM Plex Mono (codici).
   Direzione "Casa d'Aste" approvata da Andrea 2026-06-05 (vedi mockups/art-direction.html).
   Token-driven: i font si cambiano SOLO qui (--font-serif/-sans/-mono).
   ============================================================= */

:root {
  /* === Palette "Casa d'Aste" (valori allineati al mockup approvato) === */
  --bg:        #F7F3EC;  /* crema */
  --bg-2:      #FFFFFF;
  --surface:   #FFFFFF;  /* paper */
  --surface-2: #EFE9DD;  /* crema-2 */
  --border:    #E4DCCD;  /* line */
  --border-2:  #D4C9B7;

  --text:      #1A1714;  /* ink — nero caldo profondo */
  --text-1:    #1A1714;
  --text-2:    #5A4F45;  /* ink-2 — grigio caldo */
  --text-dim:  #9A8F80;  /* dim */

  /* Brand bordeaux */
  --brand:        #6B2C39;
  --brand-light:  #8B3548;
  --brand-dark:   #531F2A;  /* bord-d */
  --brand-glow:   rgba(107, 44, 57, 0.18);

  /* Accenti oro antico */
  --accent:       #9A7B3F;  /* gold */
  --accent-light: #B89968;  /* gold-l */

  /* Salvia (firma "Casa d'Aste": usata per pignoramenti / segnali calmi) */
  --sage:         #5C6B4F;

  /* Semantici (tutti smorzati, "istituzionali") */
  --pos:       #2D5016;  /* verde oliva scuro (al posto del verde Bloomberg) */
  --pos-glow:  rgba(45, 80, 22, 0.18);
  --neg:       #8B1A1A;  /* rosso bordeaux */
  --warn:      #9A7B3F;  /* oro antico = warning */
  --info:      #2C3E5B;  /* blu polvere */
  --purple:    #6B2C39;  /* mapping: viola → bordeaux (consistenza) */

  /* Effetti */
  --shadow:    0 2px 8px rgba(42, 37, 32, 0.05), 0 1px 2px rgba(42, 37, 32, 0.07);
  --shadow-lg: 0 8px 32px rgba(42, 37, 32, 0.10), 0 2px 8px rgba(42, 37, 32, 0.07);
  --radius:    6px;
  --radius-lg: 10px;
  --t:         cubic-bezier(0.4, 0, 0.2, 1);

  /* === Typeface signature (cambiare SOLO qui) === */
  --font-serif: 'Fraunces', Georgia, 'Times New Roman', serif;  /* titoli, prezzi */
  --font-sans:  'Hanken Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;  /* testo */
  --font-mono:  'IBM Plex Mono', 'JetBrains Mono', monospace;  /* codici, numeri */
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  display: flex; flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; }

/* =============================================================
   TOPBAR
   ============================================================= */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 22px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  height: 60px;
  box-shadow: var(--shadow);
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-link {
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius);
  padding: 4px 8px;
  margin-left: -8px;
  transition: background 0.15s var(--t);
}
.brand-link:hover { background: var(--surface-2); }
.brand-link:hover .brand-text h1 .brand-accent { color: var(--pos); }

.logo-mark {
  font-size: 22px;
  color: var(--pos);
  line-height: 1;
}

.brand-text h1 {
  margin: 0;
  /* Titoli in Fraunces (typeface signature "Casa d'Aste") */
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--brand);
}
.brand-text h1 .brand-accent {
  color: var(--accent);
  font-style: italic;
}

.brand-text .subtitle {
  display: block;
  font-size: 10px;
  color: var(--text-2);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 2px;
  font-weight: 500;
}

.topbar-right { display: flex; align-items: center; gap: 14px; }

.file-status {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
  letter-spacing: 0.3px;
}

/* =============================================================
   SALDO TOKEN (topbar)
   ============================================================= */
.saldo-token {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 10px;
  background: linear-gradient(135deg, #FAF3E5, #F0E2C8);
  border: 1px solid #8B6F3B;
  border-radius: 16px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12px;
  color: #5A4A22;
  transition: all 0.15s var(--t);
}
.saldo-token:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(217, 119, 6, 0.25);
}
.saldo-token.hidden { display: none; }
.saldo-token.saldo-basso {
  background: linear-gradient(135deg, #FAE5E5, #F4D4D4);
  border-color: var(--neg);
  color: #4A0E0E;
  animation: saldoPulse 2s infinite;
}
@keyframes saldoPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(197, 48, 48, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(197, 48, 48, 0); }
}
.saldo-icon { font-size: 14px; }
.saldo-value { font-weight: 800; font-family: var(--font-mono); font-size: 13px; }
.saldo-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* =============================================================
   MODAL CARRELLO TOKEN
   ============================================================= */
.carrello-modal-content {
  max-width: 920px;
  position: relative;
}
.carrello-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  gap: 14px;
  flex-wrap: wrap;
}
.carrello-saldo {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #FAF3E5, #F0E2C8);
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid #8B6F3B;
}
.carrello-saldo-icon { font-size: 28px; }
.carrello-saldo-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #5A4A22;
  font-weight: 700;
}
.carrello-saldo-value {
  font-size: 22px;
  font-weight: 800;
  color: #5A4A22;
  font-family: var(--font-mono);
}

.carrello-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: var(--radius);
}
.carrello-tab {
  padding: 7px 14px;
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--text-2);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.carrello-tab.active { background: var(--pos); color: white; }

.carrello-tab-content h3 {
  font-size: 16px;
  margin: 0 0 6px;
  font-weight: 700;
}
.carrello-tab-content.hidden { display: none; }
.carrello-help {
  color: var(--text-2);
  font-size: 13px;
  margin: 0 0 16px;
}

/* Pacchetti */
.pacchetti-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.pacchetto-card {
  background: var(--bg-2);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 18px 14px 14px;
  text-align: center;
  position: relative;
  transition: all 0.15s var(--t);
}
.pacchetto-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.pacchetto-card.consigliato {
  border-color: var(--pos);
  background: linear-gradient(180deg, rgba(0,135,90,0.05), var(--bg-2));
}
.pacchetto-badge {
  position: absolute;
  top: -10px; left: 50%;
  transform: translateX(-50%);
  background: var(--pos);
  color: white;
  padding: 3px 10px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
}
.pacchetto-card h4 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
}
.pacchetto-token {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.pacchetto-token-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-2);
  letter-spacing: 1.5px;
  margin-bottom: 8px;
}
.pacchetto-prezzo {
  font-size: 22px;
  font-weight: 700;
  color: var(--pos);
  font-family: var(--font-mono);
  margin: 4px 0 2px;
}
.pacchetto-sconto, .pacchetto-sconto-blank {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--neg);
  margin-bottom: 10px;
  min-height: 12px;
}
.pacchetto-descrizione {
  font-size: 11px;
  color: var(--text-2);
  min-height: 30px;
  line-height: 1.4;
}
.pacchetto-cta {
  width: 100%;
  padding: 9px;
  background: var(--text);
  color: white;
  border: 0;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  margin-top: 12px;
  text-transform: uppercase;
  transition: background 0.15s;
}
.pacchetto-cta:hover { background: var(--pos); }
.pacchetto-card.consigliato .pacchetto-cta { background: var(--pos); }
.pacchetto-card.consigliato .pacchetto-cta:hover { background: #1F3A0F; }

.carrello-bonifico-info {
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
}

/* Ordini */
.ordini-section { margin-bottom: 18px; }
.ordini-section-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.ordine-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  gap: 12px;
}
.ordine-row.pendente { border-color: var(--warn); background: rgba(180, 83, 9, 0.04); }
.ordine-id { font-size: 10px; color: var(--text-dim); }
.ordine-pacchetto { font-size: 13px; margin: 2px 0; }
.ordine-data { font-size: 10px; color: var(--text-2); }
.ordine-stato {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.ordine-stato-in_attesa_pagamento { background: rgba(180, 83, 9, 0.15); color: var(--warn); }
.ordine-stato-confermato { background: rgba(0, 135, 90, 0.15); color: var(--pos); }
.ordine-bonifico-box {
  background: #FAF3E5;
  border-left: 4px solid var(--warn);
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 12px;
  color: #4A3A1A;
}
.ordine-bonifico-box ul { margin: 6px 0; padding-left: 20px; }
.ordine-bonifico-box .mono { font-size: 11px; }
.ordine-bonifico-hint { font-style: italic; margin-top: 8px; }

/* Scelta metodo pagamento (bonifico / carta) */
.paga-metodi {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.paga-metodo-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-2);
  border: 2px solid var(--border-2);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
  transition: all 0.15s var(--t);
}
.paga-metodo-btn:hover { border-color: var(--text-dim); }
.paga-metodo-btn.active {
  border-color: var(--pos);
  background: rgba(0, 135, 90, 0.06);
}
.paga-metodo-icon { font-size: 26px; }
.paga-metodo-nome {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.paga-metodo-sub {
  font-size: 11px;
  color: var(--text-2);
}
.badge-validazione {
  display: inline-block;
  background: var(--warn);
  color: white;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-left: 6px;
}

.paga-form-area { animation: fadeIn 0.2s var(--t); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.carta-form .form-row { margin-bottom: 10px; }
.carta-form input {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 1px;
}
.carta-form input:focus {
  outline: none;
  border-color: var(--pos);
  box-shadow: 0 0 0 3px var(--pos-glow);
}
.carta-form label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 5px;
}

/* Storico table */
.storico-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.storico-table th {
  background: var(--surface-2);
  padding: 8px 10px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-2);
  border-bottom: 2px solid var(--border-2);
}
.storico-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.tx-tipo {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.tx-tipo.tx-ricarica_acquisto { background: rgba(0, 135, 90, 0.1); color: var(--pos); }
.tx-tipo.tx-ricarica_regalo { background: rgba(180, 83, 9, 0.1); color: var(--warn); }
.tx-tipo.tx-ricarica_admin { background: rgba(30, 64, 175, 0.1); color: var(--info); }
.tx-tipo.tx-consumo_visura { background: rgba(197, 48, 48, 0.1); color: var(--neg); }
.tx-tipo.tx-refund { background: rgba(107, 114, 128, 0.15); color: var(--text-2); }

/* =============================================================
   USER MENU
   ============================================================= */
.user-menu { position: relative; }

.user-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 5px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s var(--t);
  font-family: var(--font-sans);
}
.user-trigger:hover { border-color: var(--pos); }

.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--pos);
  color: white;
  font-weight: 700;
  font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  text-transform: uppercase;
}

.user-info {
  display: flex; flex-direction: column;
  align-items: flex-start;
  line-height: 1;
}
.user-name { font-size: 12px; font-weight: 600; color: var(--text); }
.user-role {
  font-size: 9px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-2);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.user-dropdown {
  position: fixed;
  top: 60px;   /* sotto la topbar (height 60px) */
  right: 14px;
  width: 280px;
  max-height: calc(100vh - 80px);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0;
  z-index: 2147483647;  /* MAX z-index possibile — sopra a tutto (mappa Leaflet, modal, ecc.) */
  display: flex;
  flex-direction: column;
  overflow: hidden;  /* il dropdown stesso non scrolla — solo l'area scope dentro scrolla */
  isolation: isolate;
}
.user-dropdown.hidden { display: none; }

/* Area info utente — scrollabile se troppo lunga */
.user-scope {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-2);
  line-height: 1.6;
  overflow-y: auto;        /* scroll interno per scope lunghi */
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;          /* prende lo spazio disponibile */
  min-height: 60px;
}

/* Area bottoni — SEMPRE visibile in fondo, fissa */
.user-dropdown-actions {
  flex: 0 0 auto;
  padding: 6px;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
}
.user-scope strong {
  color: var(--text);
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  display: block;
  margin-bottom: 4px;
}

.user-menu-item {
  display: block;
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: 0;
  border-radius: 4px;
  text-align: left;
  font-family: inherit;
  font-size: 12px;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s var(--t);
}
.user-menu-item:hover { background: var(--surface-2); }
.user-menu-item.logout { color: var(--neg); }
.user-menu-item.hidden { display: none; }

/* =============================================================
   BUTTONS
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 11px; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s var(--t);
  user-select: none;
}

.btn:hover {
  border-color: var(--pos);
  color: var(--pos);
  box-shadow: 0 0 0 3px var(--pos-glow);
}

.btn-ghost { background: var(--surface); }

.btn-primary {
  background: var(--pos);
  border-color: var(--pos);
  color: white;
}
.btn-primary:hover {
  background: #1F3A0F;
  border-color: #1F3A0F;
  color: white;
}

.btn-toggle {
  width: 34px; height: 34px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s var(--t);
}
.btn-toggle:hover { color: var(--warn); border-color: var(--warn); }
.btn-toggle.active {
  color: var(--warn);
  border-color: var(--warn);
  background: rgba(180, 83, 9, 0.08);
}

/* =============================================================
   BANNER BETA (sticky in alto, anteprima privata team)
   ============================================================= */
.banner-beta {
  padding: 8px 20px;
  background: linear-gradient(90deg, #3A2A2A, #2A2520);
  color: #B89968;
  font-size: 11px;
  text-align: center;
  border-bottom: 1px solid #B89968;
  font-family: var(--font-sans);
  letter-spacing: 0.3px;
}
.banner-beta strong {
  color: #B89968;
  font-family: var(--font-mono);
  letter-spacing: 1px;
  margin-right: 4px;
}
.banner-beta a {
  color: #B89968;
  text-decoration: underline;
  font-weight: 600;
}

/* =============================================================
   BANNER ABBONAMENTO
   ============================================================= */
.banner-abbonamento {
  padding: 10px 20px;
  background: linear-gradient(90deg, #FAF3E5, #F0E2C8);
  color: #4A3A1A;
  border-bottom: 2px solid var(--warn);
  font-size: 12px;
  text-align: center;
  font-weight: 500;
}
.banner-abbonamento.hidden { display: none; }
.banner-abbonamento strong { color: var(--warn); }

/* =============================================================
   LISTS BAR (selettore liste + filtro categorie)
   ============================================================= */
.lists-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.lists-bar-label,
.lists-cat-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-2);
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.lists-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.lists-spacer { flex: 1; }

.list-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s var(--t);
  position: relative;
}
.list-tab:hover { border-color: var(--pos); }
.list-tab.active {
  background: var(--pos);
  border-color: var(--pos);
  color: white;
  box-shadow: 0 2px 6px rgba(0,135,90,0.25);
}
.list-tab.active .list-tab-count { background: rgba(255,255,255,0.25); color: white; }
.list-tab.active .list-tab-prio  { color: white; }

.list-tab-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block;
}
.list-tab-prio {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  text-transform: uppercase;
}
.list-tab-count {
  background: var(--border);
  color: var(--text-2);
  padding: 1px 6px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
}

.list-tab-scadenza {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--neg);
  font-weight: 700;
  letter-spacing: 0.3px;
}
.list-tab.active .list-tab-scadenza { color: white; opacity: 0.9; }

.list-tab-locked {
  background: var(--surface-2);
  color: var(--text-dim);
  cursor: not-allowed;
  opacity: 0.7;
  border-style: dashed;
}
.list-tab-locked:hover { border-color: var(--border-2); }
.list-tab-locked .list-tab-scadenza { color: var(--text-dim); }

/* Categoria filters */
.lists-categories {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cat-filters {
  display: flex;
  gap: 5px;
}
.cat-filter-chip {
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s var(--t);
  user-select: none;
}
.cat-filter-chip:hover { border-color: var(--text-2); color: var(--text); }
.cat-filter-chip.active {
  color: white;
  border-color: currentColor;
}
.cat-filter-chip.active.cat-warn    { background: var(--warn); border-color: var(--warn); }
.cat-filter-chip.active.cat-info    { background: var(--info); border-color: var(--info); }
.cat-filter-chip.active.cat-pos     { background: var(--pos);  border-color: var(--pos); }
.cat-filter-chip.active.cat-purple  { background: var(--purple); border-color: var(--purple); }
.cat-filter-chip.active.cat-neg     { background: var(--neg);  border-color: var(--neg); }

/* Badge categoria su list items */
.cat-badges {
  display: inline-flex;
  gap: 3px;
  margin-left: 4px;
}
.cat-mini {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

/* =============================================================
   METRICS STRIP
   ============================================================= */
.metrics-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.metric {
  padding: 14px 20px;
  border-right: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.metric:last-child { border-right: none; }
.metric[data-tip] { cursor: help; }
.metric[data-filter-giorni] { cursor: pointer; }
.metric-active { background: var(--surface-2); }
.metric-active::before { background: var(--pos); }
.kpi-tip {
  position: fixed;
  z-index: 10000;
  display: none;
  max-width: 280px;
  background: #2b2422;
  color: #fff;
  font-size: 11.5px;
  line-height: 1.45;
  font-weight: 500;
  padding: 9px 11px;
  border-radius: 9px;
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
  pointer-events: none;
  white-space: pre-line;   /* preserva i ritorni a capo dei tooltip multi-riga */
}

.metric::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: transparent;
  transition: background 0.3s var(--t);
}
.metric:hover::before { background: var(--pos); }
.metric:hover { background: var(--surface-2); }

.metric-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-2);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 5px;
  font-weight: 600;
}

.metric-value {
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.5px;
  font-feature-settings: "tnum";
}
.metric-value.mono { font-family: var(--font-mono); font-size: 18px; font-weight: 600; }
.metric-value.pos { color: var(--pos); }
.metric-value.neg { color: var(--neg); }
.metric-value.warn { color: var(--warn); }

.metric-delta {
  font-size: 10px;
  color: var(--text-2);
  margin-top: 3px;
  letter-spacing: 0.3px;
}

/* =============================================================
   LAYOUT
   ============================================================= */
.layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  background: var(--bg);
}

/* SIDEBAR --------------------------------------------------- */
.sidebar {
  width: var(--sidebar-w, 380px);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.filters {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
  background: var(--bg-2);
}

.search-wrapper { position: relative; }
.search-wrapper::before {
  content: '⌕';
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 16px;
  pointer-events: none;
}

.filters input,
.filters select {
  width: 100%;
  padding: 9px 11px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12px;
  transition: all 0.15s var(--t);
}
.filters input { padding-left: 30px; }

.filters input:focus,
.filters select:focus {
  outline: none;
  border-color: var(--pos);
  box-shadow: 0 0 0 3px var(--pos-glow);
}

.filters input::placeholder { color: var(--text-dim); }

.filter-row { display: flex; gap: 6px; }
.filter-row select { flex: 1; min-width: 0; }

/* Toolbar COMPATTA (Opzione A, 2026-06-19): categoria + regione + ordina + ★ + 📷 in una
   sola riga. Sort un filo più largo (testo più lungo), toggle alti come i select.
   flex-wrap = rete di sicurezza: su larghezze molto strette degrada a 2 righe invece di
   schiacciare i controlli. */
.filter-row-compatta { flex-wrap: wrap; align-items: stretch; }
.filter-row-compatta select { min-width: 70px; }
.filter-row-compatta #sort-by { flex: 1.6; }
.filter-row-compatta .btn-toggle { height: auto; min-height: 36px; flex: 0 0 auto; }

/* Filtro rapido tipo pratica (Tutto / Aste / Pignoramenti) — solo affiliati */
.filter-tabs {
  display: flex;
  flex-wrap: wrap;          /* 4 tab: vanno a capo invece di tagliarsi nella sidebar stretta */
  gap: 4px;
  margin-bottom: 4px;
  padding: 3px;
  background: var(--surface-2, #F4F4F6);
  border: 1px solid var(--border, #E4E4E7);
  border-radius: 6px;
}
.filter-tab {
  flex: 1;
  padding: 6px 8px;
  background: transparent;
  border: none;
  border-radius: 4px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.filter-tab:hover {
  color: var(--text-1);
  background: rgba(0, 0, 0, 0.03);
}
.filter-tab.active {
  background: var(--surface, #FFFFFF);
  color: var(--text-1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* List header --------------------------------------------------*/
.list-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-2);
  letter-spacing: 1px;
  text-transform: uppercase;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.list-header select {
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 10px;
  cursor: pointer;
  font-weight: 600;
}

/* List -------------------------------------------------------- */
.list {
  list-style: none; margin: 0; padding: 0;
  overflow-y: auto; flex: 1;
  background: var(--bg-2);
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}
.list::-webkit-scrollbar { width: 8px; }
.list::-webkit-scrollbar-track { background: transparent; }
.list::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }

.list-item {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.12s var(--t);
  border-left: 3px solid transparent;
  position: relative;
  background: var(--bg-2);
}

.list-item:hover {
  background: var(--surface-2);
  border-left-color: var(--pos);
}

.list-item.active {
  background: var(--surface-2);
  border-left-color: var(--pos);
  box-shadow: inset 0 0 0 1px var(--border);
}

/* Wrapper del contenuto testuale dentro la card (a destra della thumbnail) */
.list-item .li-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Thumbnail 84x84 — foto vera o illustrazione SVG categoria */
.list-item .thumb {
  flex-shrink: 0;
  width: 84px;
  height: 84px;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
  background: var(--surface-2);
  align-self: flex-start;
}
.list-item .thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.list-item .thumb-cat {
  width: 100%;
  height: 100%;
  display: block;
}
.list-item .thumb-cat-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 3px 5px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  text-align: center;
  color: var(--text);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item .thumb .badge-foto-count {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
  pointer-events: none;
}

.list-item .row-top {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 8px; margin-bottom: 4px;
}

.list-item .row-id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.row-icon {
  font-size: 13px;
  line-height: 1;
  display: inline-block;
  cursor: default;
}

.list-item .row-price {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.list-item .row-title {
  font-size: 13px; font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.list-item .row-address {
  font-size: 11px;
  color: var(--text-2);
  margin-bottom: 7px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.list-item .row-meta {
  display: flex; gap: 6px; align-items: center;
  font-size: 10px;
  flex-wrap: wrap;
}

/* =============================================================
   CARD "Casa d'Aste" (vista lista) — .li-card · layout ORIZZONTALE
   Foto a sinistra, contenuto a destra (stile Immobiliare.it): compatta in
   altezza, pratica nella sidebar stretta. In modalità "lista espansa"
   (.layout.list-wide) si allarga e mostra più dati (foto grande + descrizione).
   Degrada con eleganza: ogni elemento compare solo se il dato esiste.
   Convive con le righe .row-* dell'header "procedura multi-lotto".
   ============================================================= */
.list { background: var(--bg); padding: 12px 12px 28px; }

/* ===== VISTA ELENCO — tabella a tutta larghezza al posto della mappa ===== */
.layout.elenco-mode .map-section,
.layout.elenco-mode #resize-sidebar { display: none; }
.layout.elenco-mode .sidebar { width: 100% !important; max-width: none !important; flex: 1 1 100%; }
.layout.elenco-mode #segui-mappa-wrap,
.layout.elenco-mode #list-expand-toggle { display: none; }
.ve-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-right: auto; }
.ve-seg { border: 0; background: transparent; color: var(--text-2); padding: 4px 12px; font-size: 12.5px; cursor: pointer; }
.ve-seg.on { background: var(--brand); color: #fff; }
#list-table { padding: 8px 12px 28px; overflow-x: auto; }
.ve-sec { margin-bottom: 18px; }
.ve-sec-h { font-size: 12px; font-weight: 600; color: var(--accent); margin: 6px 2px 8px; }
.ve-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ve-table th { text-align: left; font-weight: 500; color: var(--text-2); padding: 7px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.ve-table td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.ve-table tbody tr { cursor: pointer; }
.ve-table tbody tr:hover { background: rgba(0,0,0,.025); }
.ve-num { text-align: right; white-space: nowrap; }
.ve-ctr { text-align: center; }
.ve-bold { font-weight: 600; }
.ve-dim { color: var(--text-2); white-space: nowrap; }
.ve-dim2 { color: var(--text-dim); }
.ve-sigon { color: var(--brand); font-weight: 600; }
.ve-imm-in { display: flex; align-items: center; gap: 8px; }
.ve-tt { font-weight: 500; white-space: nowrap; }
.ve-sub { font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
.ve-sub2 { font-size: 11px; color: var(--text-2); }
.ve-anc { font-size: 10.5px; color: var(--neg); }
.ve-seal { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 4px; color: #fff; white-space: nowrap; }
.ve-seal-asta { background: var(--brand); }
.ve-seal-pign { background: #8a5a2b; }
.ve-seal-spv { background: #2C3E5B; }
.ve-seal-ml { background: #0f766e; }
.ve-lotti { font-size: 10px; color: var(--accent); font-weight: 600; }
.ve-chip { display: inline-block; padding: 2px 7px; border-radius: 12px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.ve-sc-aff, .ve-band-aff { background: rgba(0,135,90,.12); color: var(--pos); }
.ve-sc-buon, .ve-band-int { background: rgba(154,123,63,.16); color: var(--warn); }
.ve-sc-cont, .ve-sc-poco, .ve-band-lin { background: rgba(107,114,128,.12); color: var(--text-2); }
.ve-sc-caro { background: rgba(139,26,26,.1); color: var(--neg); }
.ve-cond-r { color: var(--brand); font-weight: 600; }
.ve-pos { color: var(--pos); font-weight: 600; }
.ve-en { display: inline-block; min-width: 14px; text-align: center; padding: 0 4px; border-radius: 3px; font-size: 10px; font-weight: 600; }
.ve-en-a, .ve-en-b { background: #e7f0e3; color: #2D5016; }
.ve-en-c, .ve-en-d { background: #f4ecd9; color: #7d6325; }
.ve-en-e, .ve-en-f, .ve-en-g { background: #f6e9e9; color: #8B1A1A; }
.ve-empty { padding: 30px; text-align: center; color: var(--text-2); }

.list-item.li-card {
  display: flex;
  align-items: stretch;
  padding: 0;
  margin: 0 0 12px;
  min-height: 138px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: box-shadow .15s var(--t), border-color .15s var(--t);
}
.list-item.li-card:hover {
  background: var(--surface);
  border-color: var(--accent-light);
  box-shadow: 0 6px 22px rgba(42, 37, 32, 0.10);
}
.list-item.li-card.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand), 0 6px 22px rgba(42, 37, 32, 0.12);
}

/* Colonna foto / placeholder a sinistra (più grande = più scansionabile, 2026-06-19) */
.li-card .li-ph {
  position: relative;
  width: 168px;
  flex-shrink: 0;
  background: var(--surface-2);
}
.li-card .li-ph .thumb {
  width: 100%; height: 100%;
  border: none; border-radius: 0;
}
.li-card .li-ph .thumb-cat {           /* placeholder SVG categoria: elemento di design, non un buco */
  object-fit: contain;
  padding: 16px;
  opacity: 0.85;
}
.li-card .li-ph .thumb-cat-label { display: none; }  /* categoria già nel titolo: evita sovrapposizione col badge fonte */
.li-card .li-seal {
  position: absolute; left: 8px; top: 8px;
  font-family: var(--font-mono);
  font-size: 8px; font-weight: 700;
  letter-spacing: 0.8px; text-transform: uppercase;
  padding: 3px 7px; border-radius: 2px;
  color: var(--bg);
}
.li-card .li-seal-asta { background: var(--brand); }
.li-card .li-seal-pign { background: var(--sage); }
.li-card .li-seal-mercato { background: #0f766e; }  /* teal = stesso colore del marker mercato libero */
.li-card .li-src {
  position: absolute; left: 8px; bottom: 8px;
  background: rgba(255, 255, 255, 0.94);
  font-family: var(--font-mono);
  font-size: 8.5px; font-weight: 700; letter-spacing: 0.3px;
  color: var(--text); padding: 2px 7px; border-radius: 3px;
  max-width: calc(100% - 16px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Foto reale (lazy, solo cache) sovrapposta all'illustrazione di categoria.
   Se la foto è pronta sul server copre l'SVG; se manca o si rompe, resta l'SVG sotto. */
.li-card .li-ph .thumb .thumb-overlay {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 0;
}

/* Badge SCONTO sul valore di perizia: sticker sulla foto (per chi cerca affari).
   Colore = quanto è conveniente. È una stima dalla base d'asta (tooltip lo dichiara). */
.li-card .li-ph .li-sconto {
  position: absolute; right: 8px; top: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px; font-weight: 800; letter-spacing: 0.2px;
  padding: 3px 7px; border-radius: 3px;
  color: #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.28);
}
.li-sconto-aff  { background: #1F8A4C; }   /* potenziale affare */
.li-sconto-buon { background: #2F8F8A; }   /* buon margine */
.li-sconto-cont { background: #C08A2E; }   /* margine contenuto */
.li-sconto-poco { background: #8A7B66; }   /* poco margine */
.li-sconto-caro { background: #9A4B45; }   /* sopra il valore di perizia */

/* Corpo della card a destra */
.li-card .li-bd {
  flex: 1; min-width: 0;
  padding: 11px 14px;
  display: flex; flex-direction: column;
}
.li-card .li-price-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
}
.li-card .li-price {
  font-family: var(--font-serif);
  font-size: 21px; font-weight: 600; letter-spacing: -0.4px;
  color: var(--text); line-height: 1.05; white-space: nowrap;
}
.li-card .li-price-tbd {
  font-size: 13px; font-weight: 500; color: var(--text-dim);
  font-family: var(--font-sans); letter-spacing: 0;
}
.li-card .li-rep {
  font-family: var(--font-mono); font-size: 9.5px;
  color: var(--text-dim); letter-spacing: 0.3px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 42%;
}
.li-card .li-title {
  font-size: 13px; font-weight: 600; color: var(--text); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.li-card .li-addr {
  font-size: 11.5px; color: var(--text-2); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.li-card .li-desc { display: none; }   /* descrizione: visibile solo in lista espansa */
.li-card .li-rule { display: none; }   /* nella card orizzontale niente riga separatrice */
.li-card .li-specs {
  display: flex; gap: 13px; flex-wrap: wrap; font-size: 11.5px; color: var(--text);
  margin-top: 8px;
}
.li-card .li-specs span { display: inline-flex; align-items: center; gap: 5px; }
.li-ico {
  width: 14px; height: 14px;
  stroke: var(--brand); fill: none; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -2px; flex-shrink: 0;
}
.li-card .li-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 9px; }
.li-card .li-tag {
  font-family: var(--font-mono);
  font-size: 9px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 2px;
  border: 1px solid var(--border); color: var(--brand);
}
.li-card .li-tag-gold { color: var(--accent); border-color: #E3D6BD; }

/* ---- Modalità LISTA ESPANSA (toggle "Espandi") ----
   La sidebar si allarga, le card respirano: foto grande + descrizione. */
/* La larghezza ora è guidata da --sidebar-w (drag + toggle Espandi via JS). */
.layout.list-wide .li-card { min-height: 188px; }
.layout.list-wide .li-card .li-ph { width: 264px; }
.layout.list-wide .li-card .li-ph .thumb-cat { padding: 28px; }
.layout.list-wide .li-card .li-bd { padding: 16px 20px; }
.layout.list-wide .li-card .li-price { font-size: 26px; }
.layout.list-wide .li-card .li-title { font-size: 15px; white-space: normal; }
.layout.list-wide .li-card .li-specs { font-size: 12.5px; gap: 18px; }
.layout.list-wide .li-card .li-desc {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; font-size: 12.5px; color: var(--text-2);
  margin-top: 9px; line-height: 1.45;
}

/* ---- SCHEDA DI DESTRA APERTA (.detail-open) ----
   La lista si restringe (~10% in meno di 380px) per dare aria alla mappa, e
   torna COMPATTA anche se era espansa (neutralizza le regole .list-wide della
   card). Alla chiusura tutto torna com'era senza toccare lo stato del toggle. */
/* Con la scheda aperta la larghezza della lista resta quella scelta dall'utente (--sidebar-w). */
.layout.detail-open.list-wide .li-card { min-height: 126px; }
.layout.detail-open.list-wide .li-card .li-ph { width: 148px; }
.layout.detail-open.list-wide .li-card .li-ph .thumb-cat { padding: 16px; }
.layout.detail-open.list-wide .li-card .li-bd { padding: 11px 14px; }
.layout.detail-open.list-wide .li-card .li-price { font-size: 21px; }
.layout.detail-open.list-wide .li-card .li-title { font-size: 13px; white-space: nowrap; }
.layout.detail-open.list-wide .li-card .li-specs { font-size: 11.5px; gap: 13px; }
.layout.detail-open.list-wide .li-card .li-desc { display: none; }

/* Pulsante toggle Espandi/Riduci nell'header lista */
.list-expand-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border-2);
  color: var(--text); cursor: pointer;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.6px; text-transform: uppercase;
  padding: 6px 11px; border-radius: 5px;
  transition: border-color .12s var(--t), background .12s var(--t);
}
.list-expand-btn:hover { border-color: var(--accent-light); background: var(--surface-2); }
.list-expand-btn svg { width: 13px; height: 13px; stroke: var(--brand); fill: none; stroke-width: 2; }
@media (max-width: 900px) { .list-expand-btn { display: none; } }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 7px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.chip-hot   { background: rgba(0, 135, 90, 0.1); color: var(--pos); border-color: rgba(0, 135, 90, 0.25); }
.chip-warm  { background: rgba(180, 83, 9, 0.08); color: var(--warn); border-color: rgba(180, 83, 9, 0.25); }
.chip-cold  { background: rgba(30, 64, 175, 0.08); color: var(--info); border-color: rgba(30, 64, 175, 0.25); }
.chip-sold  { background: rgba(107, 114, 128, 0.1); color: var(--text-2); border-color: var(--border-2); }
.chip-neg   { background: rgba(197, 48, 48, 0.08); color: var(--neg); border-color: rgba(197, 48, 48, 0.25); }

/* Chip "tipo pratica" — distinguono Aste da Pignoramenti nella lista per gli affiliati */
.chip-tipo {
  font-weight: 800;
}
.chip-tipo-asta {
  background: rgba(30, 64, 175, 0.12);
  color: #1E40AF;
  border-color: rgba(30, 64, 175, 0.3);
}
.chip-tipo-pignoramento {
  background: rgba(180, 83, 9, 0.12);
  color: #92400E;
  border-color: rgba(180, 83, 9, 0.3);
}
/* Chip "foto disponibili" — segnala visivamente che l'immobile ha foto */
.chip-foto {
  background: rgba(0, 135, 90, 0.10);
  color: var(--pos, #00875A);
  border-color: rgba(0, 135, 90, 0.25);
  font-weight: 700;
}

/* =============================================================
   COMPARABILI — card grandi per aste simili, Immobiliare, Idealista
   ============================================================= */
.comparabili-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.comparabile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #FFFFFF;
  border: 1px solid var(--border, #E4E4E7);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  width: 100%;
  transition: all 0.15s;
}
.comparabile-card:not(:disabled):hover {
  border-color: var(--brand, #A4203F);
  background: #FBF3F4;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}
.comparabile-card:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.comparabile-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border-radius: 8px;
  background: #FAFAFB;
  border: 1px solid var(--border-2, #EAEAEE);
}
.comparabile-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.comparabile-titolo {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
}
.comparabile-sub {
  font-size: 11px;
  color: var(--text-2);
}
.comparabile-sub strong {
  color: var(--brand, #A4203F);
  font-size: 13px;
}
.comparabile-cta {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand, #A4203F);
  white-space: nowrap;
}

/* Variante "Aste simili" — icona blu */
.comparabile-aste .comparabile-icon {
  background: rgba(30, 64, 175, 0.08);
  border-color: rgba(30, 64, 175, 0.25);
  color: #1E40AF;
}

/* Logo stilizzato "i" per Immobiliare.it (giallo brand) */
.comparabile-logo-immobiliare {
  background: linear-gradient(135deg, #FFE05A, #FFC700) !important;
  border-color: #E6B000 !important;
  color: #1a1a1a !important;
  font-family: Georgia, serif;
  font-weight: 900;
  font-size: 26px !important;
  font-style: italic;
}

/* Logo stilizzato "id" per Idealista (verde brand) */
.comparabile-logo-idealista {
  background: linear-gradient(135deg, #6FCF97, #2EB872) !important;
  border-color: #1F9C5C !important;
  color: #FFFFFF !important;
  font-weight: 800;
  font-size: 16px !important;
  letter-spacing: -1px;
}

.comparabili-note {
  margin-top: 12px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-2);
  background: #FAFAFB;
  border-left: 3px solid var(--border-1);
  border-radius: 4px;
  line-height: 1.5;
}

/* =============================================================
   MODAL ASTE SIMILI — lista comparabili cliccabili
   ============================================================= */
.aste-simili-intro {
  margin: 0 0 14px 0;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-2);
  background: rgba(30, 64, 175, 0.04);
  border-left: 3px solid rgba(30, 64, 175, 0.3);
  border-radius: 4px;
}
.aste-simili-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 60vh;
  overflow-y: auto;
}
.aste-simili-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #FFFFFF;
  border: 1px solid var(--border, #E4E4E7);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  width: 100%;
  transition: all 0.15s;
}
.aste-simili-card:hover {
  border-color: var(--brand, #A4203F);
  background: #FBF3F4;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.aste-simili-icon {
  flex-shrink: 0;
  font-size: 26px;
  width: 38px;
  text-align: center;
}
.aste-simili-info {
  flex: 1;
  min-width: 0;
}
.aste-simili-titolo {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 2px;
}
.aste-simili-addr {
  font-size: 11px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aste-simili-meta {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 3px;
}
.aste-simili-price {
  flex-shrink: 0;
  text-align: right;
}
.aste-simili-prezzo {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
}
.aste-simili-delta {
  font-size: 10px;
  font-weight: 600;
  margin-top: 2px;
}
.aste-simili-delta.pos { color: var(--neg, #C53030); }
.aste-simili-delta.neg { color: var(--pos, #00875A); }
.aste-simili-delta.neutro { color: var(--text-2); }
.aste-simili-altro {
  margin-top: 12px;
  text-align: center;
  font-size: 11px;
  color: var(--text-2);
  font-style: italic;
}
.aste-simili-empty {
  padding: 30px 20px;
  text-align: center;
  color: var(--text-2);
}
.aste-simili-empty-icon {
  font-size: 36px;
  opacity: 0.5;
  margin-bottom: 10px;
}

/* =============================================================
   LIGHTBOX FOTO IMMOBILE — fullscreen viewer
   ============================================================= */
.foto-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
}
.foto-lightbox.hidden { display: none; }
.foto-lightbox-stage {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.foto-lightbox-stage img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  user-select: none;
}
.foto-lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.foto-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.6);
}
.foto-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: #fff;
  font-size: 32px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.foto-lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.6);
}
.foto-lightbox-prev { left: 24px; }
.foto-lightbox-next { right: 24px; }
.foto-lightbox-counter {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.5px;
}
/* Sull'immagine del carosello: cursor zoom per indicare cliccabilità */
.ga-foto-slide img,
.ga-foto-thumb img {
  cursor: zoom-in;
}

/* Banner tipo pratica — IN ALTO nella scheda dettaglio, ben visibile.
   Fa capire subito se è un'asta in calendario o un pignoramento pre-asta. */
.tipo-pratica-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 12px;
  border: 1px solid;
  border-left-width: 5px;
}
.tipo-pratica-icon {
  font-size: 28px;
  line-height: 1;
}
.tipo-pratica-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tipo-pratica-text strong {
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.1em;
  font-weight: 800;
}
.tipo-pratica-text small {
  font-size: 11px;
  opacity: 0.85;
}
.tipo-pratica-asta {
  background: rgba(30, 64, 175, 0.08);
  border-color: rgba(30, 64, 175, 0.3);
  color: #1E40AF;
}
.tipo-pratica-pignoramento {
  background: rgba(180, 83, 9, 0.08);
  border-color: rgba(180, 83, 9, 0.3);
  color: #92400E;
}

.list-item.more-info {
  display: block;
  text-align: center;
  font-size: 11px;
  color: var(--text-2);
  font-style: italic;
  cursor: default;
  padding: 16px;
  background: var(--surface-2);
}
.list-item.more-info:hover { background: var(--surface-2); border-left-color: transparent; }

/* =============================================================
   MAP
   ============================================================= */
/* z-index:0 crea uno stacking context proprio della mappa: così i livelli interni di
   Leaflet (panes 200-700) restano CONFINATI qui dentro e non superano la topbar (z-index:10),
   che altrimenti veniva coperta — col menu utente che spariva sotto la mappa. */
.map-section { flex: 1; position: relative; background: #FAFAFB; z-index: 0; min-width: 0; }

/* MANIGLIE DI RIDIMENSIONAMENTO (sidebar + scheda), Andrea 2026-06-19 -------- */
.resize-handle {
  flex: 0 0 8px; align-self: stretch; position: relative;
  cursor: col-resize; z-index: 6; background: transparent;
}
.resize-handle .rh-grip {
  position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 2px; background: var(--border);
  transition: width .12s var(--t), background .12s var(--t);
}
.resize-handle:hover .rh-grip, .resize-handle.dragging .rh-grip {
  width: 4px; background: var(--brand, #6B2C39);
}
/* Maniglia della SCHEDA: ancorata al bordo sinistro del pannello (position:fixed) */
.resize-handle-detail {
  position: absolute; left: 0; top: 0; bottom: 0; width: 12px; height: 100%;
  flex: none; z-index: 1110;
}
.resize-handle-detail .rh-grip { left: 4px; transform: none; }
/* Durante il trascinamento: niente selezione testo, cursore coerente, niente animazioni */
body.resizing { cursor: col-resize !important; user-select: none; -webkit-user-select: none; }
body.resizing .sidebar, body.resizing .detail-panel { transition: none !important; }
@media (max-width: 900px) { .resize-handle { display: none; } }
#map { width: 100%; height: 100%; background: #FAFAFB; }

/* Popup leaflet */
.leaflet-popup-content-wrapper {
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 12px;
  box-shadow: var(--shadow-lg);
}
.leaflet-popup-content {
  margin: 12px 14px;
  line-height: 1.5;
}
.leaflet-popup-tip {
  background: var(--bg-2);
  border: 1px solid var(--border);
}
.leaflet-popup-close-button {
  color: var(--text-2) !important;
  font-size: 18px !important;
  padding: 6px 8px !important;
}
.leaflet-popup-content strong { color: var(--text); font-weight: 700; }
.leaflet-popup-content em {
  color: var(--pos); font-style: normal;
  font-family: var(--font-mono);
  font-weight: 700;
}
.popup-link {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 12px;
  background: var(--pos);
  color: white !important;
  text-decoration: none;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-radius: 3px;
  transition: background 0.15s var(--t);
}
.popup-link:hover { background: #1F3A0F; }

/* Custom map pins (divIcon) */
.pin {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: transform 0.15s var(--t);
}
.pin-hot {
  background: var(--pos);
  box-shadow: 0 0 0 4px var(--pos-glow), 0 2px 6px rgba(0,0,0,0.2);
  animation: pulse 2s infinite;
}
.pin-warm { background: var(--warn); }
.pin-cold { background: var(--info); }
.pin-sold { background: var(--text-dim); }

/* Pin approssimato (livello comune) — anello tratteggiato indica incertezza */
.pin-approx {
  opacity: 0.7;
  outline: 2px dashed currentColor;
  outline-offset: 3px;
}

/* =============================================================
   MARKER A PILLOLA €PREZZO (vista mappa) — stile Immobiliare in
   identità Casa d'Aste. Bordeaux base · oro = asta <30gg · grigio = venduto.
   data-id sul div interno per l'hover-sync card↔pin.
   ============================================================= */
.mk-wrap { background: none; border: 0; }
.mk-pin {
  position: relative;
  transform: translate(-50%, -100%);   /* bottom-center (punta freccia) sul punto */
  background: var(--mk-color, var(--brand)); color: var(--bg);
  font-family: var(--font-serif); font-weight: 600; font-size: 12px; line-height: 1;
  padding: 4px 9px; border-radius: 13px; white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  transition: transform .12s var(--t), box-shadow .12s var(--t);
}
.mk-pin::after {
  content: ""; position: absolute; left: 50%; bottom: -5px;
  transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--mk-color, var(--brand));
}
.mk-pin.mk-hot  { background: var(--accent); }
.mk-pin.mk-hot::after  { border-top-color: var(--accent); }
.mk-pin.mk-sold { background: var(--text-dim); }
.mk-pin.mk-sold::after { border-top-color: var(--text-dim); }
.mk-pin.mk-approx { opacity: 0.78; }
.mk-pin.mk-on, .mk-pin:hover {
  transform: translate(-50%, -100%) scale(1.12);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.42); z-index: 1000;
}

/* Pin compatto per immobili senza prezzo */
.mk-dot {
  width: 13px; height: 13px; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--mk-color, var(--brand)); border: 2px solid var(--bg);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); cursor: pointer;
  transition: transform .12s var(--t);
}
.mk-dot.mk-hot  { background: var(--accent); }
.mk-dot.mk-sold { background: var(--text-dim); }
.mk-dot.mk-approx { opacity: 0.78; }
.mk-dot.mk-on, .mk-dot:hover { transform: translate(-50%, -50%) scale(1.3); }

/* MERCATO LIBERO — marker DISTINTO da aste (pillola bordeaux/oro) e pignoramenti
   (pallino a freschezza): colore TEAL + forma SQUADRATA (tag/quadrato) + glifo 🏠.
   Arancio acceso per le "opportunità calde". */
.mk-pin.mk-mercato { background: #0f766e; border-radius: 4px; }
.mk-pin.mk-mercato::after { border-top-color: #0f766e; }
/* scala AFFARE: ambra = Interessante, arancio = Affare (gli affari spiccano sulla mappa) */
.mk-pin.mk-mercato.mk-mercato-mid { background: #d97706; }
.mk-pin.mk-mercato.mk-mercato-mid::after { border-top-color: #d97706; }
.mk-pin.mk-mercato.mk-mercato-affare { background: #ea580c; box-shadow: 0 0 0 2px rgba(234,88,12,0.30); }
.mk-pin.mk-mercato.mk-mercato-affare::after { border-top-color: #ea580c; }
.mk-dot.mk-mercato { background: #0f766e; border-radius: 3px; }   /* quadratino vs pallino tondo */
.mk-dot.mk-mercato.mk-mercato-mid { background: #d97706; }
.mk-dot.mk-mercato.mk-mercato-affare { background: #ea580c; }

/* Card evidenziata quando si passa sul pin corrispondente */
.list-item.li-card.hot {
  border-color: var(--accent-light);
  box-shadow: 0 6px 22px rgba(42, 37, 32, 0.14);
}

/* =============================================================
   ASTE PUBBLICHE — layer secondario mappa
   Marker: anello piccolo blu chiaro (non ruba scena al portafoglio)
   ============================================================= */
.pin-asta-pubblica-wrap {
  background: transparent;
  border: 0;
}
.pin-asta-pubblica {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  border: 3px solid #3B82F6; /* colore default, sovrascritto inline */
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.9);
  transition: transform 0.15s;
}
.pin-asta-pubblica:hover {
  transform: scale(1.25);
  border-width: 4px;
}

/* Cluster aste pubbliche — stile blu chiaro per distinguere dal portafoglio (verde) */
.cluster-aste-pubbliche-wrap {
  background: transparent;
  border: 0;
}
.cluster-aste-pubbliche {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.25);
  border: 2px solid #3B82F6;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1E3A8A;
  font-weight: 600;
  font-size: 12px;
  font-family: var(--font-mono);
}

/* Bolle numerate "potenziale pignoramenti" — cluster che sommano le posizioni,
   colore = scala oro→bordeaux dal totale (variante mista 2026-06-12) */
.pot-bolla-wrap {
  background: transparent;
  border: 0;
}
.pot-bolla {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-family: var(--font-mono);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
  line-height: 1;
}

/* Chip "ASTE TRIBUNALE" nella barra categorie — distinguibile dalle categorie portafoglio */
.cat-filter-chip.cat-aste-tribunale {
  border-color: #3B82F6;
  color: #1E40AF;
  font-weight: 600;
  margin-left: 12px;
  position: relative;
}
.cat-filter-chip.cat-aste-tribunale::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 20%;
  bottom: 20%;
  width: 1px;
  background: var(--border-2);
}
.cat-filter-chip.cat-aste-tribunale.active {
  background: #3B82F6;
  color: #fff;
  border-color: #3B82F6;
}

/* Toggle "POTENZIALE PIGNORAMENTI" (Layer 1 magnete) — nella sidebar, visibile a tutti */
.potenziale-toggle {
  display: flex; align-items: center; gap: 7px;
  width: 100%;
  margin-top: 8px;
  padding: 7px 12px;
  background: var(--surface);
  border: 1px solid var(--brand);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--brand);
  cursor: pointer;
  transition: all 0.15s var(--t);
}
.potenziale-toggle:hover { background: #F6EFE7; }
.potenziale-toggle .pt-ico {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--brand); flex: 0 0 auto;
}
.potenziale-toggle.active {
  background: var(--brand); color: #fff; border-color: var(--brand);
}
.potenziale-toggle.active .pt-ico { background: #fff; }
.potenziale-toggle .pt-on  { display: none; }
.potenziale-toggle .pt-off { display: inline; }
.potenziale-toggle.active .pt-on  { display: inline; }
.potenziale-toggle.active .pt-off { display: none; }

/* Divisore tra immobili portafoglio e aste pubbliche nella sidebar */
.list-item-divider {
  list-style: none;
  padding: 10px 14px 6px 14px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #1E40AF;
  background: #EFF6FF;
  border-top: 1px solid var(--border-2);
  border-bottom: 1px solid #B6DDFB;
  margin-top: 8px;
}

/* Voce lista per asta pubblica — sfondo leggermente blu per distinguerla */
.list-item.list-item-asta {
  background: linear-gradient(90deg, #F6FAFF 0%, #FFFFFF 100%);
}
.list-item.list-item-asta:hover {
  background: linear-gradient(90deg, #E6F1FB 0%, #FAFCFF 100%);
}
.list-item.list-item-asta .row-icon {
  filter: hue-rotate(-15deg);
}

/* Chip "+ aste vecchie" (bypass filtro inattivi >12 mesi) */
.cat-filter-chip.cat-aste-inattive {
  border-color: var(--border-2);
  color: var(--text-2);
  font-size: 11px;
  opacity: 0.85;
  margin-left: 4px;
}
.cat-filter-chip.cat-aste-inattive.active {
  background: #4A5568;
  color: #fff;
  border-color: #4A5568;
  opacity: 1;
}

/* Banner metriche aste pubbliche — visibile solo quando toggle ASTE TRIBUNALE attivo.
   Posizionato sotto le 6 metriche del portafoglio (.metrics-strip). */
.banner-aste-metriche {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 18px;
  background: linear-gradient(90deg, #EFF6FF 0%, #FAFAFA 100%);
  border-bottom: 1px solid var(--border-2);
  font-size: 12px;
  flex-wrap: wrap;
}
.bam-fonte {
  font-weight: 600;
  color: #1E40AF;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.bam-divider {
  width: 1px;
  height: 18px;
  background: var(--border-2);
}
.bam-stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--text-2);
  transition: opacity 0.2s;
}
.bam-stat.disattivo {
  opacity: 0.35;
}
.bam-stat strong {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--c, var(--text-1));
}
.bam-stat.bam-totale strong {
  color: var(--text-1);
  font-size: 16px;
}

/* Sotto-chip filtri badge aste (appaiono quando ASTE TRIBUNALE è attivo) */
.filtri-badge-aste {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: 8px;
  align-items: center;
}
.filtri-badge-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
  margin-right: 2px;
}
.filtri-badge-separatore {
  color: var(--border-2);
  font-size: 14px;
  margin: 0 4px;
}
/* Preset rapidi */
.filtro-preset-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  background: #FFF8E1;
  border: 1px solid #E8C977;
  color: #6B5511;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.filtro-preset-btn:hover {
  background: #FEF4D6;
  border-color: #D4A017;
}
/* Chip badge: stato INCLUSO/ESCLUSO chiaro */
.filtro-badge-chip {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s;
}
.filtro-badge-chip.attivo {
  background: var(--c);
  color: #fff;
  border: 1px solid var(--c);
}
.filtro-badge-chip.escluso {
  background: #f5f5f5;
  color: #aaa;
  border: 1px dashed #c4c4c4;
  text-decoration: line-through;
}
.filtro-badge-chip:hover {
  filter: brightness(0.95);
}

/* Griglia di dati 2 colonne per la card asta pubblica */
.dettaglio-griglia {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  font-size: 13px;
}
.dettaglio-griglia > div {
  display: flex;
  flex-direction: column;
  padding: 6px 10px;
  background: #FAFAFA;
  border-radius: 6px;
  min-height: 42px;
}
.dettaglio-griglia label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
  margin-bottom: 2px;
}
.dettaglio-griglia span {
  font-size: 13px;
  color: var(--text-1);
  font-family: var(--font-mono);
  word-break: break-word;
}

/* =============================================================
   FORM nei modal (lead "Richiedi qualifica MO", consulenza, ecc.)
   Layout label-sopra-input, padding generoso, focus blu.
   ============================================================= */
.dd-modal-content .form-row {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dd-modal-content .form-row label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
}
.dd-modal-content .form-row input,
.dd-modal-content .form-row select,
.dd-modal-content .form-row textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
.dd-modal-content .form-row input:focus,
.dd-modal-content .form-row select:focus,
.dd-modal-content .form-row textarea:focus {
  outline: none;
  border-color: #3B82F6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.dd-modal-content .form-row textarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.45;
}
.dd-modal-content .form-row textarea::placeholder,
.dd-modal-content .form-row input::placeholder {
  color: var(--text-dim);
  font-family: inherit;
  font-style: italic;
}
.dd-modal-content .form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-2);
}
.dd-modal-content .form-actions .btn {
  padding: 9px 18px;
  font-size: 13px;
}
.dd-modal-content .form-err {
  margin-top: 10px;
  color: var(--neg);
  font-size: 12px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: 4px;
  padding: 8px 12px;
  display: none;
}
.dd-modal-content .form-err.show {
  display: block;
}
/* Modal "warning box" (giallo / blu per disclaimer info) */
.dd-modal-warning {
  background: #FEF7E0;
  border: 1px solid #E8C977;
  color: #6B5511;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 13px;
  line-height: 1.5;
}
.dd-modal-warning strong {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  color: inherit;
}
.dd-modal-warning p {
  margin: 0 0 6px 0;
}
.dd-modal-warning p:last-child {
  margin-bottom: 0;
}

/* =============================================================
   MO-FLOW — "Cosa fa il Middle Office per te" (modal Apri pratica)
   Layout dedicato per non ereditare il display:block forzato sui
   <strong> dello stile .dd-modal-warning.
   ============================================================= */
.mo-flow {
  background: linear-gradient(135deg, #FBF3F4, #F9EFEF);
  border: 1px solid #E8D5D5;
  border-left: 4px solid #6B2C39;
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 18px;
}
.mo-flow-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6B2C39;
  margin-bottom: 14px;
}
.mo-flow-steps {
  list-style: none;
  counter-reset: mo-step;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mo-flow-steps li {
  position: relative;
  padding: 10px 12px 10px 46px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(107, 44, 57, 0.12);
  border-radius: 8px;
  counter-increment: mo-step;
}
.mo-flow-steps li::before {
  content: counter(mo-step);
  position: absolute;
  left: 10px;
  top: 10px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #6B2C39;
  color: white;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(107, 44, 57, 0.3);
}
.mo-step-head {
  font-size: 13px;
  font-weight: 700;
  color: #4A1F28;
  margin-bottom: 2px;
  line-height: 1.35;
}
.mo-step-body {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-2);
}
.mo-flow-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed rgba(107, 44, 57, 0.25);
  font-size: 13px;
  font-weight: 600;
  color: #4A1F28;
  text-align: center;
}

/* =============================================================
   APRI PRATICA — Modal a 2 step: scelta tecnica + form qualifica
   ============================================================= */
.ap-step.hidden { display: none; }

/* Step 1: intro + 3 card tecnica */
.ap-step-intro {
  margin-bottom: 14px;
}
.ap-step-intro strong {
  font-size: 14px;
  color: var(--text-1);
}
.ap-step-intro p {
  margin: 4px 0 0 0;
  font-size: 12px;
  color: var(--text-2);
}
.ap-tecniche-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.ap-tecnica-card {
  position: relative;
  display: block;
  text-align: left;
  padding: 14px 16px;
  background: #FFFFFF;
  border: 1px solid var(--border, #E4E4E7);
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.ap-tecnica-card:hover {
  border-color: var(--brand, #A4203F);
  background: #FBF3F4;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}
.ap-tecnica-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.ap-tecnica-icon {
  font-size: 22px;
}
.ap-tecnica-nome {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
}
.ap-tecnica-breve {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}
.ap-tecnica-descrizione {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-2);
}

/* Step 2: riepilogo tecnica + form qualifica */
.ap-tecnica-scelta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: rgba(0, 135, 90, 0.06);
  border: 1px solid rgba(0, 135, 90, 0.2);
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
}
.ap-tecnica-scelta-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pos, #006A47);
}
.ap-cambia-tecnica {
  margin-left: auto;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--brand, #A4203F);
  cursor: pointer;
  text-decoration: underline;
}
.ap-cambia-tecnica:hover { color: #6B2C39; }

.ap-form-section {
  margin-bottom: 16px;
}
.ap-section-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 8px;
}
.ap-form-section select,
.ap-form-section textarea {
  width: 100%;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  border: 1px solid var(--border, #E4E4E7);
  border-radius: 6px;
  background: var(--surface, #FFFFFF);
}
.ap-radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}
.ap-radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}

/* Sezione "Check di consapevolezza" — domande specifiche per tecnica */
.ap-consapevolezza {
  padding: 14px 16px;
  background: linear-gradient(135deg, #FBF8F0, #FFFFFF);
  border: 1px solid #E8D9A8;
  border-left: 4px solid #C8A24B;
  border-radius: 8px;
}
.ap-consapevolezza-hint {
  margin: 4px 0 12px 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-2);
  font-style: italic;
}
.ap-domande {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ap-domanda {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(200, 162, 75, 0.15);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
  transition: background 0.15s;
}
.ap-domanda:hover {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(200, 162, 75, 0.35);
}
.ap-domanda input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
}
.ap-domanda input[type="checkbox"]:checked + span {
  font-weight: 600;
  color: var(--text-1);
}

/* Box "I tuoi contatti" — vista compatta sempre visibile + bottone Modifica */
.ap-contatti-view {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--border, #E4E4E7);
  border-radius: 8px;
}
.ap-contatti-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.ap-contatti-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--surface, #FFFFFF);
  border: 1px solid var(--border, #E4E4E7);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
  word-break: break-word;
  max-width: 100%;
}
.ap-contatti-chip.missing {
  background: rgba(180, 83, 9, 0.06);
  border-color: rgba(180, 83, 9, 0.2);
  color: var(--warn, #B45309);
  font-style: italic;
  font-weight: 500;
}
.ap-contatti-edit-btn {
  background: transparent;
  border: 1px solid var(--border, #E4E4E7);
  border-radius: 6px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand, #A4203F);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.ap-contatti-edit-btn:hover {
  border-color: var(--brand, #A4203F);
  background: #FBF3F4;
}
.ap-contatti-edit {
  padding: 12px;
  background: var(--surface, #FFFFFF);
  border: 1px solid var(--border, #E4E4E7);
  border-radius: 8px;
}
.ap-contatti-edit.hidden { display: none; }
.ap-contatti-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}
.btn-small {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
}

/* =============================================================
   CAROSELLO FOTO (Gestionale-Aste) — sezione "Foto immobile"
   ============================================================= */
.ga-foto-carousel {
  background: #fafafa;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  overflow: hidden;
}
.ga-foto-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--bg-2);
  padding: 2px 8px;
  border-radius: 12px;
  margin-left: 8px;
  font-family: var(--font-mono);
}
.ga-foto-stage {
  position: relative;
  width: 100%;
  height: 320px;
  background: #000;
  overflow: hidden;
}
.ga-foto-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.ga-foto-slide.active {
  opacity: 1;
  pointer-events: auto;
}
.ga-foto-slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.ga-foto-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 24px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 0.2s;
}
.ga-foto-nav:hover {
  background: rgba(0, 0, 0, 0.8);
}
.ga-foto-prev { left: 12px; }
.ga-foto-next { right: 12px; }
.ga-foto-thumbs {
  display: flex;
  gap: 4px;
  padding: 8px;
  overflow-x: auto;
  background: #fff;
}
.ga-foto-thumb {
  flex-shrink: 0;
  width: 64px;
  height: 48px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  background: #f0f0f0;
}
.ga-foto-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ga-foto-thumb.active {
  border-color: var(--brand);
}
.ga-foto-thumb:hover:not(.active) {
  border-color: var(--text-dim);
}

/* =============================================================
   ALLEGATI (PDF Avviso/Perizia) — sezione "Allegati ufficiali"
   ============================================================= */
.ga-allegati-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.ga-allegato-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #FBF3F4, #FFFFFF);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: all 0.15s;
  cursor: pointer;
}
.ga-allegato-btn:hover {
  background: linear-gradient(135deg, #F5E8EA, #FAFAFA);
  border-color: var(--brand);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.ga-allegato-icon {
  font-size: 28px;
  flex-shrink: 0;
}
.ga-allegato-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}
.ga-allegato-label strong {
  font-size: 13px;
  color: var(--text-1);
}
.ga-allegato-label small {
  font-size: 10px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
/* Variante "PVP": documento non in archivio ma disponibile gratis sul Portale Vendite Pubbliche */
.ga-allegato-btn.ga-allegato-pvp {
  background: linear-gradient(135deg, #F4F4F6, #FAFAFB);
  border-style: dashed;
  border-color: var(--border-1);
}
.ga-allegato-btn.ga-allegato-pvp:hover {
  border-color: var(--brand);
  background: linear-gradient(135deg, #FBF3F4, #FFFFFF);
}
.ga-allegato-btn.ga-allegato-pvp .ga-allegato-icon {
  opacity: 0.7;
}
.ga-allegato-btn.ga-allegato-pvp .ga-allegato-label strong {
  color: var(--text-2);
}
/* Variante "altri allegati" — card sempre presente che porta al fascicolo PVP completo */
.ga-allegato-btn.ga-allegato-altri {
  background: linear-gradient(135deg, #EFF6FF, #F8FAFC);
  border-color: rgba(30, 64, 175, 0.3);
}
.ga-allegato-btn.ga-allegato-altri:hover {
  border-color: #1E40AF;
  background: linear-gradient(135deg, #DBEAFE, #EFF6FF);
}
.ga-allegato-btn.ga-allegato-altri .ga-allegato-label strong {
  color: #1E40AF;
}
.ga-allegato-btn.ga-allegato-altri .ga-allegato-cta {
  color: #1E40AF;
}
/* Variante "non disponibile" — fascicolo non rintracciabile, card disabilitata */
.ga-allegato-btn.ga-allegato-na {
  background: #FAFAFB;
  border-style: dashed;
  border-color: var(--border-1);
  opacity: 0.55;
  cursor: not-allowed;
}
.ga-allegato-cta {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  white-space: nowrap;
}
.ga-allegati-note {
  margin-top: 12px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-2);
  background: #FAFAFB;
  border-left: 3px solid var(--border-1);
  border-radius: 4px;
  line-height: 1.5;
}

/* Box informativo VDR — pignoramenti senza documenti pubblici ancora prodotti.
   Implementato come <details>/<summary> collassabile: chiuso di default,
   l'utente apre se vuole leggere la spiegazione completa. */
.vdr-details {
  background: linear-gradient(135deg, #FBF8F0, #FFFFFF);
  border: 1px solid #E8D9A8;
  border-left: 4px solid #C8A24B;
  border-radius: 8px;
  overflow: hidden;
}
.vdr-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background 0.15s;
}
.vdr-summary:hover {
  background: rgba(200, 162, 75, 0.08);
}
.vdr-summary::-webkit-details-marker { display: none; }
.vdr-details[open] .vdr-summary {
  border-bottom: 1px dashed #E8D9A8;
}
.vdr-summary-icon {
  font-size: 22px;
  flex-shrink: 0;
}
.vdr-summary-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.vdr-summary-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-1);
}
.vdr-summary-sub {
  font-size: 12px;
  color: var(--text-2);
}
.vdr-summary-toggle {
  font-size: 11px;
  font-weight: 700;
  color: #8B6914;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}
.vdr-summary-toggle::after {
  content: "▾";
  font-size: 14px;
  transition: transform 0.15s;
}
.vdr-details[open] .vdr-summary-toggle::after {
  transform: rotate(180deg);
}
.vdr-summary-toggle::before {
  font-size: 11px;
}
.vdr-details[open] .vdr-summary-toggle::before {
  content: "Nascondi";
}
.vdr-details:not([open]) .vdr-summary-toggle::before {
  content: "Vedi dettagli";
}

/* Contenuto espandibile (descrizione VDR completa) */
.vdr-info {
  padding: 14px 18px 16px 18px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-1);
}
.vdr-info p {
  margin: 8px 0;
  color: var(--text-2);
}
.vdr-info p:first-child { margin-top: 0; }
.vdr-info-cta-line {
  margin-top: 12px !important;
  padding-top: 10px;
  border-top: 1px dashed #E8D9A8;
  color: var(--text-1) !important;
}
.vdr-info-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

/* =============================================================
   FEEDBACK SYSTEM — Floating button + modal segnalazioni
   ============================================================= */
.fb-floating-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: var(--brand, #A4203F);
  color: #fff;
  border: none;
  border-radius: 30px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  transition: all 0.2s;
}
.fb-floating-btn:hover {
  background: #6B2C39;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.24);
}
.fb-floating-icon { font-size: 18px; }
.fb-floating-label { white-space: nowrap; }
@media (max-width: 720px) {
  .fb-floating-btn { padding: 12px 14px; }
  .fb-floating-label { display: none; }
}

.fb-row { margin-bottom: 14px; }
.fb-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 6px;
}
.fb-optional {
  font-weight: 400;
  font-size: 11.5px;
  color: var(--text-2);
}
#fb-titolo, #fb-descrizione {
  width: 100%;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  border: 1px solid var(--border, #E4E4E7);
  border-radius: 6px;
  background: var(--surface, #FFFFFF);
  color: var(--text-1);
}
#fb-descrizione { resize: vertical; min-height: 90px; }

.fb-cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
@media (max-width: 600px) { .fb-cat-grid { grid-template-columns: 1fr; } }
.fb-cat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface, #FFFFFF);
  border: 1px solid var(--border, #E4E4E7);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  transition: all 0.15s;
}
.fb-cat:hover { border-color: var(--brand, #A4203F); }
.fb-cat:has(input:checked) {
  border-color: var(--brand, #A4203F);
  background: rgba(164, 32, 63, 0.05);
  font-weight: 600;
}

.fb-prio-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.fb-prio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface, #FFFFFF);
  border: 1px solid var(--border, #E4E4E7);
  border-radius: 16px;
  cursor: pointer;
  font-size: 12.5px;
  transition: all 0.15s;
}
.fb-prio:has(input:checked) {
  background: var(--brand, #A4203F);
  border-color: var(--brand, #A4203F);
  color: #fff;
  font-weight: 600;
}

.fb-drop {
  padding: 22px 18px;
  background: rgba(0, 0, 0, 0.02);
  border: 2px dashed var(--border-2, #D9D9DD);
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.fb-drop:hover, .fb-drop-active {
  border-color: var(--brand, #A4203F);
  background: rgba(164, 32, 63, 0.03);
}
.fb-drop-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
}
.fb-pick-btn {
  background: none;
  border: none;
  color: var(--brand, #A4203F);
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.fb-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.fb-prev {
  position: relative;
  background: var(--surface, #FFFFFF);
  border: 1px solid var(--border, #E4E4E7);
  border-radius: 6px;
  overflow: hidden;
}
.fb-prev img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}
.fb-prev-name {
  padding: 4px 8px;
  font-size: 10.5px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fb-prev-rm {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.fb-prev-rm:hover { background: var(--neg, #C53030); }


/* Bottone preferito sulla card asta */
.btn-preferito-asta {
  padding: 4px 12px;
  font-size: 12px;
  background: #fff;
  border: 1px solid var(--border-2);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-weight: 600;
}
.btn-preferito-asta:hover {
  background: #F5F5F5;
  border-color: var(--accent);
}
.btn-preferito-asta.is-pref {
  background: #FFF9E8;
  border-color: #D4A017;
  color: #6B5511;
}

/* Card asta pubblica nel pannello dettaglio */
.asta-pubblica-detail h2 {
  font-size: 17px;
  margin: 0 0 4px 0;
  color: var(--text-1);
}
.asta-pubblica-detail .dettaglio-loc {
  font-size: 13px;
  color: var(--text-2);
}
.asta-pubblica-detail h3 {
  border-bottom: 1px solid var(--border-2);
  padding-bottom: 4px;
}
.asta-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  margin-right: 4px;
  margin-top: 2px;
}

/* =============================================================
   SCHEDA ASTA — redesign "Casa d'Aste" (v2)
   Hero + sezioni numerate + badge potenziale affare + parti procedura.
   Adattato al pannello laterale 520px (colonna singola). Solo token esistenti.
   ============================================================= */
.ap-hero { margin: 2px 0 4px; }
.ap-hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ap-eyebrow {
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; font-family: var(--font-sans);
}
.ap-title {
  font-family: var(--font-serif); font-weight: 600;
  font-size: 24px; line-height: 1.1; color: var(--text);
  margin: 5px 0 3px; letter-spacing: -.2px;
}
.ap-loc { font-size: 13.5px; color: var(--text-2); }
.btn-preferito-asta {
  flex: 0 0 auto; background: var(--bg-2); border: 1px solid var(--border-2);
  color: var(--text-2); border-radius: 8px; padding: 6px 11px;
  font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: all .15s var(--t); font-family: var(--font-sans);
}
.btn-preferito-asta:hover { border-color: var(--accent); color: var(--accent); }
.btn-preferito-asta.is-pref { background: rgba(154,123,63,.10); border-color: var(--accent); color: var(--accent); }

/* Azioni hero scheda asta: Salva + Condividi affiancati */
.ap-hero-actions { display: flex; gap: 6px; flex: 0 0 auto; align-items: flex-start; }

/* Menu condivisione (fallback desktop, senza condivisione nativa) */
.condividi-menu {
  position: fixed; z-index: 4000; min-width: 180px;
  background: #fff; border: 1px solid var(--border-2); border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,.16); padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
  font-family: var(--font-sans);
}
.condividi-menu a, .condividi-menu button {
  display: block; width: 100%; text-align: left; box-sizing: border-box;
  padding: 8px 10px; border: none; background: none; border-radius: 7px;
  font-size: 13px; font-weight: 600; color: var(--text); text-decoration: none;
  cursor: pointer; font-family: var(--font-sans);
}
.condividi-menu a:hover, .condividi-menu button:hover { background: var(--bg-2); color: var(--accent); }

/* badge potenziale affare nell'hero (popolato async dopo la perizia) */
.ap-affare {
  display: flex; gap: 26px; flex-wrap: wrap; align-items: flex-start; align-self: stretch;
  margin-top: 14px; padding: 16px 18px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border-2);
}
.ap-affare .apa-left { flex: 0 0 auto; min-width: 190px; }
.ap-affare .apa-right { flex: 1 1 280px; min-width: 250px; }
.ap-affare .apa-head { display: flex; align-items: center; gap: 7px; }
.ap-affare .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); flex: 0 0 8px; }
.ap-affare .lbl { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); font-weight: 700; line-height: 1.2; font-family: var(--font-sans); }
.ap-affare .apa-main { display: flex; align-items: baseline; gap: 10px; margin-top: 6px; }
.ap-affare .v { font-family: var(--font-serif); font-weight: 600; font-size: 40px; color: var(--text); line-height: 1; }
.ap-affare .sub { font-size: 12px; color: var(--text-2); line-height: 1.3; }
.ap-affare .apa-warn { font-size: 10.5px; color: var(--text-dim); font-style: italic; line-height: 1.35; margin-top: 9px; }
/* barra valore: oro = quanto paghi · verde = margine · tacca = base d'asta */
.ap-affare .apa-bar { position: relative; height: 7px; margin-top: 10px; border-radius: 4px; background: var(--surface-2); }
.ap-affare .apa-bar-pay { position: absolute; top: 0; left: 0; height: 7px; border-radius: 4px 0 0 4px; background: var(--accent); }
.ap-affare .apa-bar-gap { position: absolute; top: 0; right: 0; height: 7px; border-radius: 0 4px 4px 0; background: var(--pos); }
.ap-affare .apa-bar-tick { position: absolute; top: -3px; width: 1px; height: 13px; background: var(--text-2); }
.ap-affare .apa-ends { display: flex; justify-content: space-between; gap: 12px; margin-top: 9px; }
.ap-affare .apa-end.r { text-align: right; }
.ap-affare .apa-l { font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim); }
.ap-affare .apa-n { font-family: var(--font-serif); font-size: 16px; font-weight: 600; color: var(--text); margin-top: 1px; }
.ap-affare .apa-n.pay { color: var(--accent); }
.ap-affare .apa-n.val { color: var(--pos); }
.ap-affare .apa-h { font-size: 9.5px; color: var(--text-dim); margin-top: 1px; }
.ap-affare .apa-cap { font-size: 10.5px; color: var(--text-dim); text-align: center; margin-top: 10px; }
/* stati badge: dot + etichetta + valore + bordo per i 5 livelli di sconto */
.ap-affare.aff  { border-color: rgba(45,80,22,.30); }
.ap-affare.aff  .dot { background: var(--pos); } .ap-affare.aff  .lbl, .ap-affare.aff  .v { color: var(--pos); }
.ap-affare.buon { border-color: rgba(154,123,63,.32); }
.ap-affare.buon .dot { background: var(--accent); } .ap-affare.buon .lbl, .ap-affare.buon .v { color: var(--accent); }
.ap-affare.cont .dot { background: var(--accent-light); } .ap-affare.cont .lbl, .ap-affare.cont .v { color: var(--accent-light); }
.ap-affare.poco .dot { background: var(--text-dim); } .ap-affare.poco .lbl, .ap-affare.poco .v { color: var(--text-2); }
.ap-affare.caro { border-color: rgba(107,44,57,.32); }
.ap-affare.caro .dot { background: var(--brand); } .ap-affare.caro .lbl, .ap-affare.caro .v { color: var(--brand); }
/* detector congruità perizia (CTU vs mercato) */
.perizia-detector { border-radius: 10px; padding: 12px 14px; margin-top: 12px; background: var(--surface); border: 1px solid var(--border-2); border-left-width: 3px; }
.perizia-detector .pd-tit { font-size: 13px; font-weight: 700; }
.perizia-detector .pd-txt { font-size: 12.5px; color: var(--text-2); line-height: 1.5; margin-top: 5px; }
.perizia-detector.ok     { border-left-color: var(--pos); }     .perizia-detector.ok .pd-tit     { color: var(--pos); }
.perizia-detector.alert  { border-left-color: var(--brand); }   .perizia-detector.alert .pd-tit  { color: var(--brand); }
.perizia-detector.caro   { border-left-color: var(--accent); }  .perizia-detector.caro .pd-tit   { color: var(--accent); }
.perizia-detector.neutro { border-left-color: var(--border-2); }.perizia-detector.neutro .pd-tit { color: var(--text-2); }
.perizia-detector.premium { border-left-color: var(--accent); background: rgba(154,123,63,.06); } .perizia-detector.premium .pd-tit { color: var(--accent); }
/* sintesi AI — verdetto "Tecniche possibili" (S&S / acquisto credito) */
.sp-tecnica { font-size: 12.5px; line-height: 1.5; color: var(--text-2); background: var(--surface-2); border-left: 3px solid var(--border-2); border-radius: 0 8px 8px 0; padding: 8px 11px; margin-top: 6px; }
.sp-tecnica b { color: var(--text); }
.sp-tecnica-ok { border-left-color: var(--pos); }
.sp-tecnica-warn { border-left-color: var(--accent); }
.sp-tecnica-no { border-left-color: var(--brand); }
.sp-tecnica-na { border-left-color: var(--border-2); }
.sp-tecnica-credito { border-left-color: var(--accent-light); }

/* riga meta (RGE · tribunale · prossima asta) */
.ap-meta { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 16px; }
.ap-meta > div .l { font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); font-weight: 600; }
.ap-meta > div .v { font-family: var(--font-serif); font-size: 15px; color: var(--text); margin-top: 1px; }
.ap-meta > div .v.mono { font-family: var(--font-mono); font-size: 14px; }

/* chip di stato sotto l'hero */
.ap-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.ap-chip {
  font-size: 10.5px; font-weight: 600; letter-spacing: .02em;
  padding: 3px 9px; border-radius: 20px; border: 1px solid var(--border-2);
  color: var(--text-2); background: var(--bg-2); font-family: var(--font-sans);
}
.ap-chip.warn { color: var(--accent); border-color: rgba(154,123,63,.30); background: rgba(154,123,63,.07); }
.ap-chip.neg  { color: var(--neg); border-color: rgba(139,26,26,.25); background: rgba(139,26,26,.05); }

/* sezione numerata (sostituisce gli header con emoji) */
.ap-sec { padding: 20px 0; border-top: 1px solid var(--border); }
.ap-sec h3 {
  font-family: var(--font-serif); font-weight: 600; font-size: 16px;
  color: var(--text); margin: 0 0 2px; display: flex; align-items: baseline; gap: 9px;
  border: none; padding: 0;
}
.ap-sec h3 .num { font-family: var(--font-mono); font-size: 11px; color: var(--accent); letter-spacing: .08em; }
.ap-sec h3 .tag-soft { font-family: var(--font-sans); font-size: 11px; font-weight: 400; color: var(--text-2); }

/* box opportunità (sezione 01) */
.ap-opp {
  margin-top: 12px; padding: 16px 18px; border-radius: 12px;
  background: rgba(107,44,57,.05); border: 1px solid rgba(107,44,57,.16);
  display: flex; gap: 15px; align-items: flex-start;
}
.ap-opp .tag {
  flex: 0 0 auto; background: var(--brand); color: #fff; border-radius: 8px;
  padding: 7px 11px; font-size: 11px; font-weight: 700; letter-spacing: .03em;
  text-align: center; line-height: 1.25; font-family: var(--font-sans);
}
.ap-opp p { margin: 0; font-size: 13.5px; color: var(--text); line-height: 1.5; }
.ap-opp-stats { display: flex; gap: 22px; margin-top: 12px; flex-wrap: wrap; }
.ap-opp-stats .v { font-family: var(--font-serif); font-size: 19px; color: var(--brand); }
.ap-opp-stats .l { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }

/* === Verdetto opportunità (sez. 02) — segnali deterministici + CTA premium (Andrea 2026-06-20) === */
.opp-headline { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.oh-pct { flex: 0 0 auto; color: #fff; font-family: var(--font-serif); font-weight: 700; font-size: 18px; padding: 7px 12px; border-radius: 8px; line-height: 1; }
.oh-txt { font-size: 13.5px; color: var(--text-1); line-height: 1.4; }
.oh-fonte { display: block; font-size: 10.5px; color: var(--text-2); margin-top: 2px; }
.opp-segnali { margin: 0 0 12px; padding-left: 18px; }
.opp-segnali li { font-size: 13.5px; line-height: 1.5; color: var(--text-1); margin-bottom: 5px; }
.opp-onesta { font-size: 11px; color: var(--text-2); font-style: italic; margin-bottom: 10px; }
.opp-cta { display: block; width: 100%; text-align: left; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 8px; padding: 9px 13px; font-size: 13px; font-weight: 600; color: var(--brand); cursor: pointer; font-family: var(--font-sans); }
.opp-cta:hover { background: rgba(107,44,57,.06); }

/* parti della procedura (creditore + debitori) — onesto sui dati mancanti */
.ap-parti {
  display: flex; gap: 28px; flex-wrap: wrap; margin-top: 14px;
  padding: 13px 18px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface-2);
}
.ap-parti-i .r { display: block; font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); font-weight: 700; margin-bottom: 2px; }
.ap-parti-i .v { font-family: var(--font-serif); font-size: 15px; color: var(--text); }
.ap-parti-i .v small { font-family: var(--font-sans); font-size: 11.5px; color: var(--text-2); }
.ap-parti-i .v.pending { font-family: var(--font-sans); font-size: 12.5px; color: var(--text-dim); font-style: italic; }
.ap-note { font-size: 11.5px; color: var(--text-2); font-style: italic; margin-top: 8px; line-height: 1.45; }

/* popup mappa branded (Leaflet) */
.ap-popup { font-family: var(--font-sans); min-width: 184px; }
.ap-popup .seal {
  display: inline-block; background: var(--brand); color: #fff; font-size: 9px;
  letter-spacing: .1em; text-transform: uppercase; font-weight: 700;
  padding: 3px 7px; border-radius: 4px; margin-bottom: 7px;
}
.ap-popup .t { font-family: var(--font-serif); font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.2; }
.ap-popup .loc { font-size: 12px; color: var(--text-2); margin-top: 1px; }
.ap-popup .rowp { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 8px; }
.ap-popup .rowp .price { font-family: var(--font-serif); font-size: 16px; font-weight: 600; color: var(--text); }
.ap-popup .rowp .rge { font-family: var(--font-mono); font-size: 11px; color: var(--text-2); }
.ap-popup .bdg { font-size: 11px; font-weight: 600; margin-top: 6px; }
.ap-popup .ap-popup-link {
  display: inline-block; margin-top: 9px; background: var(--brand); color: #fff !important;
  text-decoration: none; padding: 6px 12px; border-radius: 7px; font-size: 12px; font-weight: 600;
}
.ap-popup .ap-popup-link:hover { background: var(--brand-light); }
.timeline-ribassi-chart {
  background: #FAFAFA;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 12px;
  margin-top: 4px;
}
.timeline-ribassi-mini {
  display: flex;
  gap: 16px;
  font-size: 12px;
  padding: 8px;
  background: #FAFAFA;
  border-radius: 6px;
}
.timeline-ribassi-mini .tr-data {
  font-family: var(--font-mono);
  color: var(--text-2);
  font-size: 11px;
}
.timeline-ribassi-mini .tr-prezzo {
  font-weight: 600;
  font-family: var(--font-mono);
}
.desc-lotto-collapse {
  background: #FAFAFA;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  padding: 8px 12px;
}
.desc-lotto-collapse summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--accent);
}
.desc-lotto-text {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-1);
  white-space: pre-wrap;
}
/* === Countdown prossima asta (Opzione B — riquadri). Diventa ROSSO a 7 giorni. === */
.asta-countdown { margin: 14px 0 2px; }
.acd-lab { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 7px; }
.acd-boxes { display: flex; gap: 8px; }
.acd-box { flex: 1; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 4px 7px; text-align: center; }
.acd-num { display: block; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 24px; font-weight: 600; line-height: 1.05; color: var(--text); font-variant-numeric: tabular-nums; }
.acd-u { display: block; font-size: 10px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim); margin-top: 3px; }
.asta-countdown.is-urgent .acd-lab { color: var(--neg); }
.asta-countdown.is-urgent .acd-box { background: rgba(139, 26, 26, 0.07); border-color: rgba(139, 26, 26, 0.32); }
.asta-countdown.is-urgent .acd-num { color: var(--neg); }
.chip-scadenza { background: var(--surface-2); color: var(--text-2); border-color: var(--border-2); }

/* === Composizione & descrizione del lotto (sezione 01 unificata) === */
.comp-lotto { margin-top: 10px; }
.cl-lab { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; }
.cl-list { display: flex; flex-direction: column; gap: 6px; }
.cl-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cl-chip { font-size: 13px; color: var(--text-1); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 11px; }
.cl-disp { font-size: 11px; color: var(--text-2); border: 1px solid var(--border-2); border-radius: 999px; padding: 2px 9px; }
.cl-testo { margin: 9px 0 0; font-size: 14px; line-height: 1.55; color: var(--text-1); }

/* === Dati catastali — Layout B (sezione 01): identificativi gratis + cosa dà la visura === */
.ap-catasto { margin-top: 12px; padding: 13px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.apc-head { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 9px; }
.apc-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.apc-id { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-1); background: var(--bg-2); border: 1px solid var(--border); border-radius: 7px; padding: 4px 9px; white-space: nowrap; }
.apc-visura { margin-top: 12px; padding-top: 11px; border-top: 1px dashed var(--border-2); }
.apc-visura-lab { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); margin-bottom: 6px; }
.apc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--text-2); padding: 3px 0; }
.apc-row .k { display: flex; align-items: center; gap: 7px; }
.apc-row .t { font-size: 10.5px; font-style: italic; color: var(--text-dim); white-space: nowrap; }

/* === Sezione 01 "Il bene" — card editoriale "Com'è fatto" (Andrea 2026-06-20) === */
.bene-card { margin-top: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; }
.bene-head { font-family: var(--font-serif); font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 12px; }
.bene-head-lotto { font-family: var(--font-sans); font-size: 12px; font-weight: 400; color: var(--text-2); }
.bene-card .dettaglio-griglia { margin-top: 0; }
.bene-desc { margin: 12px 0 0; font-family: var(--font-serif); font-size: 14px; line-height: 1.6; color: var(--text-1); }
.bene-desc.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bene-piu { display: inline-block; margin-top: 5px; font-size: 12px; color: var(--accent); cursor: pointer; }
.bene-extra { margin-top: 6px; }
.bene-beni-lab { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim); margin: 14px 0 8px; }
.bene-acc { border: 1px solid var(--border); border-radius: 8px; margin-top: 6px; overflow: hidden; }
.bene-acc > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; padding: 10px 12px; font-size: 13px; background: #FAFAFA; }
.bene-acc > summary::-webkit-details-marker { display: none; }
.bene-acc > summary::before { content: "\25B8"; color: var(--text-2); font-size: 11px; }
.bene-acc[open] > summary::before { content: "\25BE"; }
.bene-acc .ba-tit { font-weight: 600; color: var(--text); }
.bene-acc .ba-meta { margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: var(--text-2); text-align: right; }
.ba-body { padding: 10px 12px 12px 28px; }
.ba-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ba-chip { font-size: 11.5px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 9px; color: var(--text-1); }
.ba-desc { margin: 0; font-size: 13px; line-height: 1.55; color: var(--text-1); }
.lotti-fallback { padding: 10px 12px; border-top: 1px dashed var(--border-2); font-size: 12px; }
.lotti-fallback a { color: var(--accent); font-weight: 600; text-decoration: none; }
.lotti-fallback .lf-note { display: block; margin-top: 4px; color: var(--text-2); font-style: italic; }

.azioni-asta-pubblica {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.azioni-asta-pubblica .btn,
.azioni-asta-pubblica .btn-primary {
  flex: 1 1 calc(50% - 4px);
  min-width: 200px;
  text-align: center;
  font-size: 12px;
  padding: 8px 12px;
}

/* === Sez. 07 azioni asta PVP — card "Cosa puoi fare ora" (declutter 2026-06-21, Andrea):
   3 azioni a peso decrescente. Unico verde pieno = Entra in consulenza. === */
.az-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-top: 12px;
  box-sizing: border-box;
}
.az-card-h {
  font-family: var(--font-serif);
  font-size: 13px; font-weight: 600;
  color: var(--text-2);
  margin-bottom: 12px;
}
.az-act {
  display: block; width: 100%; box-sizing: border-box;
  text-align: left; text-decoration: none;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 11px 14px; margin-bottom: 9px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all .15s var(--t);
}
.az-act:last-child { margin-bottom: 0; }
.az-act-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.az-act-lab { font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }
.az-act-arr { font-size: 13px; flex: none; }
.az-act-sub { display: block; font-size: 11px; margin-top: 3px; letter-spacing: 0; text-transform: none; color: var(--text-2); }
/* verde pieno = azione in evidenza (consulenza) */
.az-act.az-primary { background: var(--pos); border-color: var(--pos); }
.az-act.az-primary .az-act-lab,
.az-act.az-primary .az-act-arr { color: #fff; }
.az-act.az-primary .az-act-sub { color: rgba(255,255,255,.82); }
.az-act.az-primary:hover { background: #1F3A0F; border-color: #1F3A0F; }
/* bordeaux outline = azione (partecipa) */
.az-act.az-brand { border-color: var(--brand); }
.az-act.az-brand .az-act-lab { font-weight: 700; }
.az-act.az-brand .az-act-lab,
.az-act.az-brand .az-act-arr { color: var(--brand); }
.az-act.az-brand:hover { background: rgba(107,44,57,.06); }
/* neutro = consultazione (PVP) */
.az-act.az-quiet { border-color: var(--border-2); }
.az-act.az-quiet .az-act-lab { color: var(--text-2); }
.az-act.az-quiet .az-act-arr { color: var(--accent); }
.az-act.az-quiet .az-act-sub { color: var(--text-dim); }
.az-act.az-quiet:hover { border-color: var(--accent); }

/* === COMING SOON · Dossier premium (sez.05) — teaser su tutti i livelli (Andrea 2026-06-21) === */
.dossier-soon {
  margin-top: 14px;
  border: 1px dashed var(--border-2);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  padding: 14px 16px;
}
.dossier-soon .ds-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dossier-soon .ds-badge {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: #fff; background: var(--accent); padding: 3px 8px; border-radius: 5px;
}
.dossier-soon .ds-title { font-family: var(--font-serif); font-size: 15px; font-weight: 600; color: var(--text); }
.dossier-soon .ds-body { margin-top: 8px; font-size: 12.5px; line-height: 1.55; color: var(--text-2); }
.dossier-soon .ds-cta {
  margin-top: 10px; display: inline-block;
  font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-dim); border: 1px solid var(--border-2); border-radius: var(--radius); padding: 7px 12px;
}

.fonte-pvp {
  margin-top: 18px;
  padding: 8px 12px;
  background: #F0F5FA;
  border-left: 3px solid #3B82F6;
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-2);
}
.fonte-pvp strong {
  color: #1E40AF;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}

/* Cluster style — oro "Casa d'Aste" (firma del mockup) */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background-color: rgba(154, 123, 63, 0.25) !important;
}
.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background-color: var(--accent) !important;
  color: #fff !important;
  font-family: var(--font-mono);
  font-weight: 700;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

/* Map legend */
.map-legend {
  position: absolute;
  bottom: 20px; left: 20px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 10px;
  color: var(--text-2);
  z-index: 500;
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 600;
  box-shadow: var(--shadow);
}

.legend-row {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 0;
}
.legend-row .dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block;
  border: 1.5px solid white;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.dot-hot  { background: var(--accent); }   /* asta <30gg = oro */
.dot-proc { background: var(--brand); }     /* in procedura = bordeaux */
.dot-warm { background: var(--warn); }
.dot-cold { background: var(--info); }
.dot-sold { background: var(--text-dim); }

/* Legenda LAYER 1 — Potenziale pignoramenti: a destra per non sovrapporsi a quella base */
.map-legend-potenziale {
  left: auto;
  right: 20px;
}
.legend-title {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

/* Empty-state lista (es. aste nascoste + utente senza NPL) */
.list-empty {
  list-style: none;
  padding: 22px 18px;
  margin: 10px;
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}
.list-empty strong { color: var(--text); font-family: var(--font-serif); font-size: 15px; }
.list-empty em { color: var(--brand); font-style: normal; font-weight: 600; }

/* Leaflet attribution + controls */
.leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.85) !important;
  color: var(--text-2) !important;
  font-size: 9px !important;
}
.leaflet-control-attribution a { color: var(--text) !important; }
.leaflet-control-zoom a {
  background: var(--bg-2) !important;
  color: var(--text) !important;
  border-color: var(--border-2) !important;
}
.leaflet-control-zoom a:hover { background: var(--surface-2) !important; }

/* =============================================================
   DETAIL PANEL (slide-in da destra)
   ============================================================= */
.detail-panel {
  position: fixed;
  top: 0; right: 0;
  width: var(--detail-w, 520px); max-width: 100%;
  height: 100vh;
  background: var(--bg-2);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(10, 14, 26, 0.08);
  z-index: 1100;
  overflow-y: auto;
  display: flex; flex-direction: column;
  transform: translateX(0);
  transition: transform 0.32s var(--t);
}

.detail-panel.hidden {
  transform: translateX(100%);
  pointer-events: none;
}

.detail-panel::-webkit-scrollbar { width: 8px; }
.detail-panel::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }

.backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 14, 26, 0.25);
  z-index: 1050;
  opacity: 1;
  transition: opacity 0.25s var(--t);
}
.backdrop.hidden { opacity: 0; pointer-events: none; }

@media (min-width: 769px) {
  .backdrop { display: none; }
}

.detail-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  position: sticky; top: 0;
  z-index: 5;
}

.badges { display: flex; gap: 6px; flex-wrap: wrap; }

.close-btn {
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  color: var(--text-2);
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.15s var(--t);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}
.close-btn:hover { color: var(--neg); border-color: var(--neg); background: rgba(197, 48, 48, 0.05); }

/* Il contenuto della scheda usa id="detail-content": senza l'id qui il padding
   non si applicava e il contenuto (foto incluse) finiva a filo del bordo sinistro,
   disallineato dall'header (che ha 20px). Allinea il contenuto all'header. */
#detail-content, .detail-content { padding: 4px 20px 24px; }

/* === Ambiente NPL (pignoramenti AGRO + cessioni SPV) — Andrea 2026-06-23 ===
   Re-skin "fascicolo riservato": l'accento oro diventa salvia SOLO dentro la
   scheda dei pignoramenti (classe .env-npl, aggiunta dal JS quando isPignoramento).
   Scoped: non tocca la scheda asta nE il mercato libero. Reversibile. */
.detail-panel.env-npl { --accent: var(--sage); }
.detail-panel.env-npl .ap-hero { border-left: 3px solid var(--sage); padding-left: 14px; }
.detail-panel.env-npl .npl-riservato {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em;
  color: var(--sage); background: rgba(92,107,79,.08);
  border: 1px solid rgba(92,107,79,.30); border-radius: var(--radius-lg);
  padding: 7px 12px; margin: 2px 0 12px;
}
.detail-panel.env-npl .npl-riservato .npl-sp { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; color: var(--text-dim); }
/* Passo "banner + accenti" (Andrea 2026-06-23): il banner arancione del pignoramento
   diventa salvia, e la banda si rinforza — solo nell'ambiente NPL. */
.detail-panel.env-npl .npl-riservato { background: rgba(92,107,79,.13); font-weight: 500; }
.detail-panel.env-npl .tipo-pratica-pignoramento {
  background: rgba(92,107,79,.10); border-color: rgba(92,107,79,.35); color: #3f4a36;
}
.detail-panel.env-npl .tipo-pratica-pignoramento .tipo-pratica-icon { color: var(--sage); }
.detail-panel.env-npl .ap-sec h3 .num { font-weight: 700; }
/* Box "Apri la posizione" (sblocco identità) — Andrea 2026-06-23 */
.detail-panel.env-npl .npl-apri-box { margin: 4px 0 14px; padding: 14px; background: rgba(92,107,79,.07); border: 1px solid rgba(92,107,79,.30); border-radius: var(--radius-lg); }
.detail-panel.env-npl .npl-apri-box .npl-apri-txt { font-size: 13px; color: var(--text-2); line-height: 1.5; margin-bottom: 10px; }

.detail-content h2 {
  margin: 10px 0 5px;
  font-size: 19px; font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  line-height: 1.3;
}

/* =============================================================
   FONTE DATI (badge interno / scaricata / da richiedere)
   ============================================================= */
.fonte-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-left: 6px;
  vertical-align: middle;
  cursor: help;
  white-space: nowrap;
}
.fonte-interno {
  background: rgba(0, 135, 90, 0.1);
  color: var(--pos);
  border: 1px solid rgba(0, 135, 90, 0.3);
}
.fonte-scaricata {
  background: rgba(30, 64, 175, 0.1);
  color: var(--info);
  border: 1px solid rgba(30, 64, 175, 0.3);
}
.fonte-richiedere {
  background: rgba(180, 83, 9, 0.08);
  color: var(--warn);
  border: 1px solid rgba(180, 83, 9, 0.3);
}

/* =============================================================
   PANNELLO RIEPILOGO COMPLETEZZA
   ============================================================= */
.rcomp-card {
  background: linear-gradient(135deg, #FBF9F5, #F0E8E0);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 8px 0 16px;
}

.rcomp-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.rcomp-pct {
  background: var(--pos);
  color: white;
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 14px;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.rcomp-body { flex: 1; min-width: 0; }

.rcomp-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-2);
  margin-bottom: 2px;
}

.rcomp-sub {
  font-size: 12px;
  color: var(--text);
  line-height: 1.4;
}

.rcomp-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
}
.rcomp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--pos), #4A7A2A);
  border-radius: 2px;
  transition: width 0.4s var(--t);
}

.rcomp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.rcomp-chip {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.rcomp-internal {
  background: rgba(0, 135, 90, 0.12);
  color: var(--pos);
  border: 1px solid rgba(0, 135, 90, 0.3);
}
.rcomp-ok {
  background: rgba(30, 64, 175, 0.1);
  color: var(--info);
  border: 1px solid rgba(30, 64, 175, 0.3);
}
.rcomp-todo {
  background: rgba(180, 83, 9, 0.08);
  color: var(--warn);
  border: 1px solid rgba(180, 83, 9, 0.3);
  cursor: help;
}
/* Profilo di lancio: visure non ancora attive → chip spento "in attivazione" */
.rcomp-soon {
  background: rgba(120, 120, 120, 0.08);
  color: var(--text-dim);
  border: 1px solid rgba(120, 120, 120, 0.25);
  opacity: 0.75;
  cursor: default;
}

/* =============================================================
   TIMELINE 17 STEP DEL DEBITO
   ============================================================= */
.t17-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 8px 0 16px;
}

.t17-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.t17-title {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.t17-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-2);
  padding: 3px 8px;
  background: var(--surface-2);
  border-radius: 3px;
}

.t17-fase-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 9px;
  border-radius: 3px;
}

.t17-pct {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 800;
  color: var(--pos);
  padding: 4px 12px;
  background: rgba(0, 135, 90, 0.1);
  border-radius: 6px;
  border: 1px solid rgba(0, 135, 90, 0.3);
}

.t17-current {
  background: var(--surface-2);
  padding: 12px 14px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 13px;
  border-left: 3px solid var(--pos);
}
.t17-current strong { font-size: 13px; color: var(--text); }
.t17-desc { color: var(--text-2); margin-top: 4px; line-height: 1.45; }
.t17-tempo {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 6px;
  letter-spacing: 0.3px;
}

.t17-conf {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-left: 6px;
  vertical-align: middle;
  cursor: help;
}
.t17-conf-media { background: rgba(180, 83, 9, 0.12); color: var(--warn); border: 1px solid rgba(180, 83, 9, 0.3); }
.t17-conf-bassa { background: rgba(107, 114, 128, 0.15); color: var(--text-2); border: 1px solid var(--border-2); }

.t17-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 4px 2px;
}

.t17-bullet {
  flex: 1 1 0;
  min-width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  cursor: help;
  background: var(--surface);
  transition: all 0.15s var(--t);
  position: relative;
}
.t17-bullet:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.t17-bullet.step-done {
  background: var(--fase-color, var(--pos));
  border-color: var(--fase-color, var(--pos));
  color: white;
}
.t17-bullet.step-done::after {
  content: "✓";
  position: absolute;
  top: -4px;
  right: -4px;
  background: white;
  color: var(--pos);
  border: 1px solid var(--pos);
  border-radius: 50%;
  width: 14px;
  height: 14px;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}
.t17-bullet.step-now {
  background: var(--fase-color, var(--pos));
  border-color: var(--fase-color, var(--pos));
  color: white;
  animation: t17pulse 2s infinite;
  box-shadow: 0 0 0 4px rgba(0, 135, 90, 0.15);
}
@keyframes t17pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(0, 135, 90, 0.15); }
  50% { box-shadow: 0 0 0 8px rgba(0, 135, 90, 0.05); }
}
.t17-bullet.step-future {
  background: var(--surface);
  border-color: var(--border-2);
  color: var(--text-dim);
  border-style: dashed;
}

.t17-legenda {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 10px;
  color: var(--text-2);
  font-family: var(--font-mono);
  letter-spacing: 0.3px;
}
.t17-leg-item { display: flex; align-items: center; gap: 5px; }
.t17-leg-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}

@media (max-width: 600px) {
  .t17-bullet { min-width: 28px; height: 28px; font-size: 10px; }
  .t17-pct { font-size: 14px; padding: 3px 8px; }
}

/* Card visiva tipologia (icona categoria catastale + info chiave) */
.cat-visual {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 10px;
  border: 1px solid;
  margin: 8px 0 18px;
  box-shadow: var(--shadow);
  animation: catVisualFadeIn 0.3s var(--t);
}

@keyframes catVisualFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.cat-visual-icon {
  font-size: 44px;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.08));
}

/* Illustrazione SVG categoria (sostituisce l'emoji nella scheda dettaglio) */
.cat-visual-illustr {
  flex-shrink: 0;
  width: 76px;
  height: 76px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}
.cat-visual-illustr img {
  width: 100%;
  height: 100%;
  display: block;
}

.cat-visual-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cat-visual-badge {
  display: inline-block;
  width: fit-content;
  padding: 2px 9px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.cat-visual-label {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}

.cat-visual-info {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  margin-top: 3px;
  opacity: 0.85;
}
.cat-visual-info span {
  white-space: nowrap;
  font-family: var(--font-mono);
}
.cat-visual-info strong { font-size: 13px; }

.detail-address {
  color: var(--text-2);
  margin-bottom: 4px;
  font-size: 12px;
}

.detail-id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 1px;
  margin-bottom: 22px;
  display: flex; gap: 12px;
  font-weight: 600;
}

/* RGE in testata (oltre che nella sezione Procedura in basso) */
.detail-rge {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin: 2px 0 6px;
}
.detail-rge-tag {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  color: var(--accent, #8B6F3B);
  background: rgba(139, 111, 59, 0.10);
  border: 1px solid rgba(139, 111, 59, 0.30);
  padding: 3px 9px; border-radius: 6px;
}
.detail-rge-trib { font-size: 11.5px; color: var(--text-2); }

/* 💰 Badge "potenziale affare" in cima alla sezione valore (solo aste) */
.deal-badge {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 1px solid;
}
.deal-badge-head { display: flex; align-items: center; gap: 8px; }
.deal-badge-ico { font-size: 15px; line-height: 1; }
.deal-badge-title { font-size: 13.5px; font-weight: 600; flex: 1 1 auto; }
.deal-badge-pct { font-family: var(--font-mono); font-size: 17px; font-weight: 800; }
.deal-badge-body {
  font-size: 12px; margin-top: 5px; color: var(--text-2);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.deal-badge-verify {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 2px 7px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.05); color: var(--text-2);
}
.deal-badge-expl {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--text-2);
  font-style: italic;
}
.deal-badge-expl strong { color: var(--text); font-style: normal; }
.deal-alto { background: rgba(45, 80, 22, 0.08); border-color: rgba(45, 80, 22, 0.35); }
.deal-alto .deal-badge-title, .deal-alto .deal-badge-pct, .deal-alto .deal-badge-ico { color: var(--pos, #2D5016); }
.deal-medio { background: rgba(139, 111, 59, 0.08); border-color: rgba(139, 111, 59, 0.35); }
.deal-medio .deal-badge-title, .deal-medio .deal-badge-pct { color: var(--accent, #8B6F3B); }
.deal-basso { background: var(--bg, #FAF8F5); border-color: var(--border-2, #D9D9DD); }
.deal-basso .deal-badge-title, .deal-basso .deal-badge-pct { color: var(--text-2); }

.detail-section {
  margin-bottom: 24px;
  animation: fadeUp 0.4s var(--t) backwards;
}
.detail-section:nth-child(2) { animation-delay: 0.05s; }
.detail-section:nth-child(3) { animation-delay: 0.1s; }
.detail-section:nth-child(4) { animation-delay: 0.15s; }
.detail-section:nth-child(5) { animation-delay: 0.2s; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.detail-section h3 {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin: 0 0 10px;
  font-weight: 700;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.kv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
}
.kv-grid:empty { display: none; }

.kv-cell {
  background: var(--bg, #FAF8F5);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  display: flex; flex-direction: column;
  min-width: 0;
  transition: border-color 0.18s var(--t), box-shadow 0.18s var(--t);
}
.kv-cell:hover {
  border-color: var(--accent-light, #B89968);
  box-shadow: 0 1px 4px rgba(42, 37, 32, 0.05);
}
.kv-cell label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-2);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 3px;
  font-weight: 600;
}
.kv-cell .value {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  word-break: break-word;
}
.kv-cell .value.mono { font-family: var(--font-mono); font-size: 12px; }
.kv-cell .value.pos { color: var(--pos); }
.kv-cell .value.neg { color: var(--neg); }
.kv-cell .value.warn { color: var(--warn); }
.kv-cell .value.big {
  font-size: 19px; font-weight: 700;
  font-family: var(--font-mono);
}
/* Stato "non applicabile" — campo che non si applica al tipo di pratica (es: campi asta su pignoramento) */
.kv-cell .value.na {
  color: var(--text-2);
  opacity: 0.6;
  font-style: italic;
  font-size: 11px;
}
/* Esecutato (proprietario nei pignoramenti) — campo importante, leggermente in evidenza */
.kv-cell .value.esecutato {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
}

/* Link "Apri scheda asta sul PVP" che appare in fondo al blocco Stato asta */
.link-asta-pvp {
  display: inline-flex;
  align-items: center;
  margin-top: 10px;
  padding: 8px 14px;
  background: rgba(44, 62, 91, 0.07);
  color: var(--info, #2C3E5B);
  border: 1px solid rgba(44, 62, 91, 0.22);
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.15s var(--t);
}
.link-asta-pvp:hover {
  background: rgba(44, 62, 91, 0.13);
  border-color: var(--info, #2C3E5B);
  transform: translateY(-1px);
}

/* Sotto-titoli all'interno di una detail-section (raggruppamento Sintesi) */
.kv-subgroup {
  margin: 16px 0 8px 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.kv-subgroup:first-of-type { margin-top: 4px; }

/* Icona SVG nei sotto-titoli della Sintesi (sostituisce le emoji) */
.kv-subgroup i.ph {
  color: var(--brand);
  font-size: 15px;
  vertical-align: -2px;
  margin-right: 5px;
}

/* Cella "protetta" — dato riservato che si sblocca in VDR (non è un campo vuoto) */
.kv-cell .value.lock {
  color: var(--brand);
  font-weight: 700;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.kv-cell .value.lock i.ph { font-size: 15px; }

/* ===== Striscia "stato dato + completezza" (colpo d'occhio in testata) ===== */
.detail-datastate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 14px 0 4px;
  padding: 13px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.detail-datastate .datastate-txt {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.45;
}
.detail-datastate .datastate-txt strong { color: var(--text-1); font-weight: 700; }
.detail-datastate .datastate-comp {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}
.comp-ring { position: relative; width: 44px; height: 44px; }
.comp-ring .comp-num {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600;
  color: var(--text-1);
}
.datastate-comp .comp-lab {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  line-height: 1.25;
}
@media (max-width: 520px) {
  .detail-datastate { flex-direction: column; align-items: flex-start; }
}

/* Icona SVG nel banner tipo-pratica */
.tipo-pratica-icon i.ph { font-size: 20px; vertical-align: -3px; }

/* Riga di highlight (valori chiave in evidenza) sopra ai sotto-blocchi */
.kv-grid.kv-highlight {
  margin-bottom: 8px;
  background: transparent;
  border: none;
}
.kv-grid.kv-highlight .kv-cell {
  background: var(--brand-soft, #FBF3F4);
  border-color: rgba(107, 44, 57, 0.28);
}

/* Contatore inline nel titolo di una detail-section (es: "Soggetti — 1 creditore · 2 debitori") */
.section-counter {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0;
  text-transform: none;
  margin-left: 6px;
}

/* Identificativo catastale composto (F.X P.Y Sub.Z) in evidenza copia-incolla */
.catastale-id {
  padding: 8px 12px;
  margin-bottom: 8px;
  background: #FAFAFB;
  border: 1px dashed var(--border-1, #D9D9DD);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: 0.05em;
  user-select: all;
}

.actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.action-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 9px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s var(--t);
}
.action-btn:hover {
  background: var(--surface-2);
  border-color: var(--text-2);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.action-btn:active {
  transform: translateY(0) scale(0.985);
  box-shadow: none;
}

.action-btn.primary {
  background: var(--pos);
  border-color: var(--pos);
  color: white;
}
.action-btn.primary:hover {
  background: #1F3A0F;
  border-color: #1F3A0F;
  color: white;
  box-shadow: 0 4px 12px var(--pos-glow);
}

.action-btn.favorite.active {
  background: rgba(180, 83, 9, 0.08);
  border-color: var(--warn);
  color: var(--warn);
}

.action-btn.paid {
  position: relative;
}

/* Nuovo bottone "Apri pratica con Middle Office" — usa classe action-btn-primary
   (con trattino, non punto, per allinearsi alla nomenclatura BEM-like degli altri bottoni nuovi) */
.action-btn-primary {
  background: var(--pos);
  border-color: var(--pos);
  color: white;
}
.action-btn-primary:hover {
  background: #1F3A0F;
  border-color: #1F3A0F;
  color: white;
  box-shadow: 0 4px 12px var(--pos-glow);
}

/* Bottone "Crea DD (admin only)" — visibile solo per ruoli admin/super_admin.
   Stile distintivo (viola/indigo) per ricordare all'admin che è un'azione interna del team. */
.action-btn-admin {
  background: #6B2C39;
  border-color: #4A1F28;
  color: white;
  font-weight: 600;
}
.action-btn-admin:hover {
  background: #4A1F28;
  border-color: #4A1F28;
  color: white;
  box-shadow: 0 4px 12px rgba(67, 56, 202, 0.35);
}

/* =============================================================
   PERIZIA VELOCE — box mostrato sulla scheda immobile.
   Stili portati dal mockup approvato 2026-05-24.
   ============================================================= */
/* Wrapper a tendina (details/summary) — perizia chiusa di default per snellire UX */
.perizia-details {
  margin: 18px 0;
}
.perizia-details[open] .perizia-box {
  margin-top: 0;
}
.perizia-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  background: linear-gradient(135deg, #FCF5F5, #F9EFEF);
  border: 1px solid #E8D5D5;
  border-left: 4px solid #6B2C39;
  border-radius: 10px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background 0.15s;
}
.perizia-summary:hover {
  background: linear-gradient(135deg, #FAEFEF, #F4E8E8);
}
.perizia-summary::-webkit-details-marker { display: none; }
.perizia-details[open] .perizia-summary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: 1px dashed #E8D5D5;
}
.perizia-summary-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.perizia-summary-title {
  font-weight: 700;
  font-size: 13px;
  color: #6B2C39;
}
.perizia-summary-info {
  font-size: 12px;
  color: var(--text-2);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.perizia-summary-valore {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: #6B2C39;
}
.perizia-summary-valore.na {
  color: var(--text-2);
  font-weight: 500;
}
.perizia-summary-cap {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}
.perizia-summary-cap.capiente {
  background: rgba(0, 135, 90, 0.12);
  color: var(--pos);
}
.perizia-summary-cap.non-capiente {
  background: rgba(197, 48, 48, 0.12);
  color: var(--neg);
}
.perizia-summary-toggle {
  font-size: 11px;
  font-weight: 700;
  color: #6B2C39;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}
.perizia-summary-toggle::after {
  content: "▾";
  font-size: 14px;
  transition: transform 0.15s;
}
.perizia-details[open] .perizia-summary-toggle::after {
  transform: rotate(180deg);
}
.perizia-details[open] .perizia-summary-toggle {
  /* Quando aperto: "Nascondi" più discreto */
}
.perizia-details[open] .perizia-summary-toggle::before {
  content: "Nascondi";
}
.perizia-details:not([open]) .perizia-summary-toggle::before {
  content: "Vedi dettagli";
}
/* Rimuoviamo il vecchio testo "Vedi dettagli" duplicato dal markup HTML */
.perizia-summary-toggle { font-size: 0; }
.perizia-summary-toggle::before { font-size: 11px; }
.perizia-summary-toggle::after { font-size: 14px; }

.perizia-box {
  background: linear-gradient(135deg, #FCF5F5, #F9EFEF);
  border: 1px solid #E8D5D5;
  border-top: none;
  border-left: 4px solid #6B2C39;
  border-radius: 0 0 10px 10px;
  padding: 18px 20px;
  margin: 0;
  box-shadow: var(--shadow);
}
.perizia-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 14px;
}
.perizia-title {
  font-size: 13px; font-weight: 700; color: #6B2C39;
  text-transform: uppercase; letter-spacing: 0.5px;
  display: flex; align-items: center; gap: 6px;
}
.perizia-fonte {
  font-size: 11px; color: var(--text-2);
  font-family: var(--font-mono);
}
.perizia-conf {
  padding: 3px 8px; border-radius: 6px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.3px;
  white-space: nowrap;
}
.perizia-conf.alta  { background: rgba(45, 80, 22, 0.15); color: #2D5016; }
.perizia-conf.media { background: rgba(139, 111, 59, 0.15); color: #8B6F3B; }
.perizia-conf.bassa { background: rgba(139, 26, 26, 0.15);  color: #8B1A1A; }

.perizia-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.perizia-cell {
  background: #fff; border: 1px solid var(--border, #E8E0D5);
  border-radius: 9px; padding: 9px 12px;
}
.perizia-cell label {
  display: block; font-size: 10px; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.3px;
  font-weight: 600; margin-bottom: 3px;
}
.perizia-cell .val {
  font-size: 14px; font-weight: 700; color: var(--text-1);
  font-family: var(--font-mono);
}
.perizia-cell.highlight .val { color: #6B2C39; }
.perizia-cell.warn .val { color: #8B6F3B; }
.perizia-cell.danger .val { color: #8B1A1A; }
.perizia-cell.dashed {
  background: var(--bg, #FAF8F5); border-style: dashed;
}
.perizia-cell.dashed .val { color: var(--text-dim); }

.perizia-valore-box {
  background: white; border: 1px solid #E0CCCC;
  border-radius: 6px; padding: 14px 16px;
  margin: 12px 0; text-align: center;
}
.perizia-valore-box .label {
  font-size: 11px; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px;
}
.perizia-valore-box .range {
  font-size: 13px; color: var(--text-2);
  font-family: var(--font-mono); margin-bottom: 4px;
}
.perizia-valore-box .medio {
  font-size: 22px; font-weight: 800; color: #6B2C39;
  font-family: var(--font-mono);
}

/* === CAPIENZA — logica NPL CORRETTA ===
   Capiente (GBV ≥ valore) = OPPORTUNITÀ (verde)
   Non capiente (GBV < valore) = OPERAZIONE MENO INTERESSANTE (rosso)
   Vedi memory/regole_logica_npl.md */
.perizia-capienza {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-radius: 6px;
  font-size: 13px; margin-top: 10px;
  border: 1px solid;
}
.perizia-capienza.capiente {
  background: rgba(45, 80, 22, 0.10);
  border-color: rgba(45, 80, 22, 0.4);
  color: #2D5016;
}
.perizia-capienza.non-capiente {
  background: rgba(139, 26, 26, 0.08);
  border-color: rgba(139, 26, 26, 0.3);
  color: #8B1A1A;
}
.perizia-capienza.non-calcolabile {
  background: var(--bg-2);
  border-color: var(--border-2);
  color: var(--text-2);
}
.perizia-capienza .cap-badge {
  font-size: 12px; font-weight: 800;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.perizia-capienza .cap-body { flex: 1; }
.perizia-capienza .cap-msg { font-weight: 500; line-height: 1.4; }
.perizia-capienza .cap-rapporto {
  font-size: 11px; opacity: 0.75; margin-top: 4px;
}

/* === GRADO IPOTECA — badge evidenziato (specialmente 1° grado) === */
.perizia-grado {
  padding: 10px 14px; border-radius: 6px;
  font-size: 13px; margin-top: 10px;
  border: 1px solid;
}
.perizia-grado.primo-grado {
  background: rgba(67, 56, 202, 0.06);
  border-color: rgba(67, 56, 202, 0.3);
  color: #4A1F28;
}
.perizia-grado.altro-grado {
  background: var(--bg-2);
  border-color: var(--border-2);
  color: var(--text-2);
}

/* === CREDITORE CEDENTE === */
.perizia-creditore {
  padding: 10px 14px; border-radius: 6px;
  font-size: 13px; margin-top: 10px;
  background: white;
  border: 1px solid #E5E9F2;
  color: var(--text-1);
}

/* === TRIANGOLAZIONE VALORE — multi-fonte === */
.perizia-triangolazione {
  margin-top: 14px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.02), transparent);
  border: 1px solid #E5E9F2;
  border-radius: 8px;
}
.triang-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.triang-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
}
.triang-conf {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
}
.triang-conf-alta   { background: rgba(0, 135, 90, 0.10); color: var(--pos, #00875A); }
.triang-conf-media  { background: rgba(180, 83, 9, 0.10); color: var(--warn, #B45309); }
.triang-conf-bassa  { background: rgba(197, 48, 48, 0.10); color: var(--neg, #C53030); }

.triang-fonti {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.triang-fonte {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: white;
  border: 1px solid #ECEEF2;
  border-radius: 6px;
  border-left: 3px solid #C7C2B8;
}
.triang-fonte.triang-aff-alta  { border-left-color: var(--pos, #00875A); }
.triang-fonte.triang-aff-media { border-left-color: var(--warn, #B45309); }
.triang-fonte.triang-aff-bassa { border-left-color: var(--text-2); }
.triang-fonte.triang-loading {
  border-left-color: var(--text-2);
  opacity: 0.7;
  position: relative;
}
.triang-fonte.triang-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 16px;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border, #E4E4E7);
  border-top-color: var(--brand, #A4203F);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  transform: translateY(-50%);
}
@keyframes spin { to { transform: translateY(-50%) rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .triang-fonte.triang-loading::after { animation: none; }
}

.triang-fonte-icon {
  font-size: 20px;
  flex-shrink: 0;
}
.triang-fonte-body {
  flex: 1;
  min-width: 0;
}
.triang-fonte-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-1);
}
.triang-fonte-sub {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 1px;
}
.triang-fonte-range {
  text-align: right;
  flex-shrink: 0;
}
.triang-fonte-medio {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
}
.triang-fonte-minmax {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-2);
}
.triang-fonte-peso {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  background: #F2F2F4;
  border-radius: 4px;
  color: var(--text-2);
  flex-shrink: 0;
}

.triang-warnings {
  margin-bottom: 10px;
}
.triang-warning {
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.5;
  border-radius: 4px;
  margin-top: 4px;
}
.triang-warning-divergenza {
  background: rgba(180, 83, 9, 0.08);
  border-left: 3px solid var(--warn, #B45309);
  color: var(--text-1);
}
.triang-warning-fonte_singola {
  background: rgba(0, 0, 0, 0.03);
  border-left: 3px solid var(--text-2);
  color: var(--text-2);
}

.triang-finale {
  padding: 14px 16px;
  background: linear-gradient(135deg, #FBF3F4, #FFFFFF);
  border: 1px solid var(--brand, #A4203F);
  border-radius: 6px;
  text-align: center;
  position: relative;
}
.triang-finale-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand, #A4203F);
  margin-bottom: 6px;
}
.triang-finale-range {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 2px;
}
.triang-finale-medio {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--brand, #A4203F);
  letter-spacing: -0.01em;
}
.triang-finale-note {
  font-size: 11px;
  font-style: italic;
  color: var(--text-2);
  margin-top: 4px;
}
.triang-disclaimer {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--surface-2, #f5f1ea);
  border-radius: 8px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-2, #6a6258);
}
.perizia-summary-note {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  font-style: italic;
  color: var(--text-2, #8a8175);
}

/* === RINUNCIA AGLI ATTI — valutazione fattibilità === */
.perizia-rinuncia {
  margin-top: 12px;
  padding: 14px 16px;
  background: white;
  border: 1px solid #E5E9F2;
  border-left: 4px solid #94A3B8;
  border-radius: 8px;
}
.perizia-rinuncia-buona { border-left-color: var(--pos, #00875A); }
.perizia-rinuncia-verifica { border-left-color: var(--warn, #B45309); }
.perizia-rinuncia-ostacoli { border-left-color: var(--neg, #C53030); }
.rinuncia-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-1);
  margin-bottom: 12px;
}
.rinuncia-icon { font-size: 18px; }
.rinuncia-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.rinuncia-cell {
  padding: 8px 10px;
  background: #FAFAFB;
  border: 1px solid #ECEEF2;
  border-radius: 6px;
}
.rinuncia-cell label {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 3px;
}
.rinuncia-cell .val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  word-break: break-word;
}
.rinuncia-cell .val.neg { color: var(--neg, #C53030); }
.rinuncia-motivi {
  list-style: none;
  padding: 0;
  margin: 0 0 10px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rinuncia-motivi li {
  position: relative;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-2);
}
.rinuncia-motivi li::before {
  content: "•";
  position: absolute;
  left: 6px;
  color: var(--text-2);
  font-weight: 700;
}
.rinuncia-disclaimer {
  margin-top: 10px;
  padding: 8px 10px;
  background: #FBF8F0;
  border-left: 3px solid #C8A24B;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-2);
}

/* === PROCEDURA GIUDIZIARIA (PVP) === */
.perizia-procedura {
  background: white;
  border: 1px solid #E5E9F2;
  border-left: 4px solid var(--brand);
  border-radius: 6px;
  padding: 14px 16px;
  margin-top: 12px;
}
.perizia-procedura.validato { border-left-color: var(--pos); }
.perizia-procedura.da-verificare { border-left-color: var(--accent); background: #FBF9F0; }
.perizia-procedura.non-trovato { border-left-color: var(--text-dim); background: var(--bg-2); }
.proc-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
}
.proc-title {
  font-size: 13px; font-weight: 700;
  color: var(--brand);
  text-transform: uppercase; letter-spacing: 0.4px;
}
.proc-badge {
  font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.proc-badge-validato {
  background: rgba(45, 80, 22, 0.10);
  color: var(--pos);
  border: 1px solid rgba(45, 80, 22, 0.3);
}
.proc-badge-da-verificare {
  background: rgba(139, 111, 59, 0.10);
  color: var(--accent);
  border: 1px solid rgba(139, 111, 59, 0.3);
}
.proc-badge-non-trovato {
  background: var(--bg-2);
  color: var(--text-dim);
  border: 1px solid var(--border-2);
}
.proc-link {
  display: inline-block;
  font-size: 12px; font-weight: 600;
  color: var(--brand);
  text-decoration: none;
  padding: 6px 10px; border-radius: 4px;
  background: rgba(107, 44, 57, 0.06);
  border: 1px solid rgba(107, 44, 57, 0.2);
}
.proc-link:hover {
  background: rgba(107, 44, 57, 0.12);
}
.proc-disclaimer {
  margin-top: 10px; padding: 8px 12px;
  background: #FFFBEB;
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  font-size: 11px; color: #5A4A22;
  line-height: 1.5;
}
.proc-stato-sommario {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  margin-top: 8px; padding: 8px 12px;
  background: var(--bg-2);
  border-radius: 4px;
  font-size: 13px; color: var(--text-1);
  font-weight: 500;
}
.proc-disp {
  font-size: 11px; color: var(--text-2);
  background: white;
  padding: 3px 8px;
  border-radius: 3px;
  border: 1px solid var(--border);
}
.proc-storico-coming {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px dashed var(--border-2);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-1);
}
.proc-coming-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: rgba(139, 111, 59, 0.10);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-radius: 3px;
  border: 1px solid rgba(139, 111, 59, 0.3);
}

/* === FATTORI CHE IMPATTANO LO SCONTO === */
.perizia-fattori {
  background: white;
  border: 1px solid #E5E9F2;
  border-radius: 6px;
  padding: 12px 14px;
  margin-top: 12px;
}
.fattori-head {
  font-size: 12px; font-weight: 700;
  color: var(--text-1);
  text-transform: uppercase; letter-spacing: 0.4px;
  margin-bottom: 10px;
}
.fattore-row {
  display: grid;
  grid-template-columns: 130px 1fr 110px;
  grid-template-areas: "label detail impatto" "spiegazione spiegazione spiegazione";
  gap: 4px 10px;
  padding: 8px 0;
  border-top: 1px solid #F0F2F7;
  font-size: 12px;
}
.fattore-row:first-of-type { border-top: none; }
.fattore-label { grid-area: label; font-weight: 600; color: var(--text-1); }
.fattore-detail { grid-area: detail; color: var(--text-2); font-family: var(--font-mono); }
.fattore-impatto {
  grid-area: impatto;
  text-align: right;
  font-weight: 700; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.fattore-impatto.impatto-alto  { color: #2D5016; }
.fattore-impatto.impatto-medio { color: #8B6F3B; }
.fattore-impatto.impatto-basso { color: #6B7280; }
.fattore-impatto.impatto-na    { color: var(--text-dim); }
.fattore-spiegazione {
  grid-area: spiegazione;
  font-size: 11px; color: var(--text-2);
  font-style: italic;
  padding-left: 2px;
}
.fattori-nota {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px dashed #E5E9F2;
  font-size: 11px; color: var(--text-2);
}

/* === NOTA STRATEGIA === */
.perizia-nota-strategia {
  background: #F8FAFC;
  border: 1px solid #E5E9F2;
  border-radius: 6px;
  padding: 12px 14px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
}
.perizia-nota-strategia strong { color: var(--text-1); }
.perizia-nota-strategia ul { margin: 8px 0 0 18px; padding: 0; }
.perizia-nota-strategia li { margin-bottom: 4px; }
.perizia-nota-strategia p { margin: 6px 0; }

.perizia-actions {
  display: flex; gap: 8px; margin-top: 14px;
  padding-top: 12px; border-top: 1px dashed #E8D5D5;
  flex-wrap: wrap;
}
.perizia-actions .btn-small {
  padding: 6px 12px; font-size: 12px; background: white;
  border: 1px solid #E0CCCC; border-radius: 4px; color: #6B2C39;
  cursor: pointer; font-weight: 600;
}
.perizia-actions .btn-small:hover { background: #FBF3F4; }
.perizia-actions .btn-small.primary { background: #6B2C39; color: white; border-color: #6B2C39; }
.perizia-actions .btn-small.primary:hover { background: #4A1F28; }

.perizia-loading, .perizia-error {
  padding: 20px; text-align: center; color: var(--text-2);
  font-size: 13px;
}
.perizia-error { color: #8B6F3B; }

.perizia-note {
  font-size: 11px; color: var(--text-2); margin-top: 8px;
  font-style: italic;
}

/* === MODAL CONFERMA SPESA TOKEN ===
   Vedi memory/regole_token_e_cache.md regola 1.
   Sempre obbligatorio prima di scalare token. */
.cs-riepilogo {
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  padding: 14px 16px;
  margin: 14px 0;
}
.cs-riga {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
  color: var(--text-2);
}
.cs-riga strong {
  color: var(--text-1);
}
.cs-riga-totale {
  border-top: 1px solid var(--border-2);
  margin-top: 6px;
  padding-top: 12px;
  font-size: 15px;
  color: var(--text-1);
  font-weight: 600;
}
.cs-riga-totale strong {
  color: #6B2C39;
  font-size: 17px;
}
.cs-riga-totale.cs-insufficiente strong {
  color: #8B1A1A;
}

/* Checkbox di "analisi rapida" nel modal Apri pratica MO */
.ap-checks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ap-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.ap-check:hover {
  background: rgba(67, 56, 202, 0.05);
  border-color: rgba(67, 56, 202, 0.4);
}
.ap-check input[type="checkbox"] {
  margin-top: 2px;
  cursor: pointer;
  accent-color: #6B2C39;
}
.ap-check input[type="checkbox"]:checked + span {
  color: var(--text-1);
}

.action-btn .paid-dot {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--warn);
  color: white;
  font-size: 9px;
  font-weight: 700;
  margin-right: 6px;
  flex-shrink: 0;
}

.risorse-sottosezione {
  margin-top: 12px;
}
.risorse-sottosezione:first-child { margin-top: 0; }

.risorse-titolo {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-2);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
  font-weight: 700;
}

.risorse-hint {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 10px;
  color: var(--text-2);
  letter-spacing: 0.3px;
}

.detail-description {
  font-size: 12px; line-height: 1.6;
  color: var(--text-2);
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 3px solid var(--info);
}

.detail-description strong {
  color: var(--text); font-weight: 700; display: inline-block; margin-bottom: 4px;
}

/* Variante collassabile per note lunghe: max ~5 righe + fade in fondo */
.detail-description.collapsable {
  max-height: 8em;
  overflow: hidden;
  position: relative;
  transition: max-height 0.2s;
}
.detail-description.collapsable::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 36px;
  background: linear-gradient(to bottom, transparent, var(--surface-2));
  pointer-events: none;
}
.detail-description.collapsable.expanded {
  max-height: 4000px;
}
.detail-description.collapsable.expanded::after {
  display: none;
}
.detail-description-toggle {
  margin-top: 6px;
  background: none;
  border: none;
  padding: 4px 0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand, #A4203F);
  cursor: pointer;
  letter-spacing: 0.02em;
}
.detail-description-toggle:hover {
  text-decoration: underline;
}

/* Street View / Satellite */
.streetview-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}
.sv-tab {
  flex: 1;
  padding: 7px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s var(--t);
}
.sv-tab:hover { color: var(--text); border-color: var(--text-dim); }
.sv-tab.active {
  background: var(--pos);
  color: white;
  border-color: var(--pos);
}

.streetview-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16/10;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 8px;
}

.sv-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--t);
}
.sv-frame.active {
  opacity: 1;
  pointer-events: auto;
}

.streetview-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

/* Soggetti */
.soggetti-block { margin-bottom: 12px; }
.soggetti-block:last-child { margin-bottom: 0; }
.soggetti-label {
  font-family: var(--font-mono);
  font-size: 9px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  margin-bottom: 6px;
}
.soggetti-label.pos { color: var(--pos); }
.soggetti-label.neg { color: var(--neg); }

.soggetto-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 6px;
}
.soggetto-card:last-child { margin-bottom: 0; }
.soggetto-nome {
  font-size: 13px; font-weight: 600; color: var(--text);
  margin-bottom: 3px;
}
.soggetto-cf {
  font-size: 11px; color: var(--text-2);
  letter-spacing: 0.5px;
}
.soggetto-sede {
  font-size: 11px; color: var(--text-2); margin-top: 2px;
}
.soggetto-diritto {
  font-size: 10px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-top: 3px;
  font-family: var(--font-mono);
  font-weight: 600;
}

/* Badges per stato */
.badge {
  padding: 4px 9px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.badge-hot  { background: rgba(0, 135, 90, 0.1); color: var(--pos); border: 1px solid rgba(0, 135, 90, 0.3); }
.badge-warm { background: rgba(180, 83, 9, 0.1); color: var(--warn); border: 1px solid rgba(180, 83, 9, 0.3); }
.badge-cold { background: rgba(30, 64, 175, 0.1); color: var(--info); border: 1px solid rgba(30, 64, 175, 0.3); }
.badge-sold { background: rgba(107, 114, 128, 0.12); color: var(--text-2); border: 1px solid var(--border-2); }

/* =============================================================
   VIEW SWITCHER (Radar / Marketplace)
   ============================================================= */
.view-switcher {
  display: inline-flex;
  gap: 2px;
  background: rgba(0, 0, 0, 0.04);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  position: relative;
}
.view-btn {
  position: relative;
  padding: 8px 16px;
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: var(--text-2);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.view-btn:hover:not(.active) {
  color: var(--text);
  background: rgba(0, 0, 0, 0.03);
}
.view-btn:active:not(.active) {
  transform: scale(0.97);
}
.view-btn.active {
  background: linear-gradient(180deg, var(--pos, #00875A) 0%, #006A47 100%);
  color: white;
  box-shadow:
    0 1px 2px rgba(0, 135, 90, 0.25),
    0 4px 12px rgba(0, 135, 90, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.view-btn.active:hover {
  filter: brightness(1.05);
}

/* Badge contatore — più compatto e leggibile */
.view-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  background: rgba(255, 255, 255, 0.22);
  color: white;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transition: all 0.2s;
}
.view-btn:not(.active) .view-badge {
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-2);
}
.view-btn:not(.active):hover .view-badge {
  background: rgba(0, 0, 0, 0.12);
}
/* Quando il contatore è 0, lo sfumiamo per non far rumore */
.view-badge:empty,
.view-btn .view-badge[data-zero] {
  opacity: 0.5;
}

/* =============================================================
   MARKETPLACE — "Salone Privato" (dark, cinematico)
   Quando si entra nel Marketplace si abbassano le luci:
   sfondo nero-caldo, oro antico, titoli serif, dati in mono.
   Palette scoped: non tocca il resto del portale (chiaro).
   ============================================================= */
.marketplace-view {
  flex: 1;
  overflow-y: auto;

  /* palette dark locale al Marketplace */
  /* Variante C (Andrea 2026-06-04): palette CHIARA coerente col portale, al posto del dark */
  --mk-bg-deep:    #FAF8F5;  /* sfondo crema del portale */
  --mk-bg-card:    #FFFFFF;
  --mk-bg-tint:    #FBF9F5;
  --mk-cream-1:    #2A2520;  /* testo principale (nero caldo) */
  --mk-cream-2:    #6B5D52;  /* testo secondario */
  --mk-grey-1:     #A89B8D;  /* testo tenue */
  --mk-grey-2:     #8B7E70;
  --mk-tan:        #8B6F3B;  /* accent oliva/oro del portale */
  --mk-tan-soft:   #8B6F3B;
  --mk-tan-deep:   #6F5730;
  --mk-tan-dim:    #B89968;
  --mk-positive:   #2D5016;  /* verde oliva */
  --mk-warn:       #B5651D;  /* ocra caldo */
  --mk-line:       #E8E0D5;  /* bordo crema */
  --mk-line-strong:#D4C9B7;

  color: var(--mk-cream-1);
  background: var(--mk-bg-deep);
  background-image:
    radial-gradient(ellipse 70% 45% at 50% -2%, rgba(139, 111, 59, 0.05), transparent 70%);
  font-family: var(--font-sans);
}
.marketplace-view.hidden { display: none; }
.layout.hidden { display: none; }

/* Variante C (Andrea 2026-06-04): il Marketplace è ora CHIARO come il resto del portale →
   niente più "dim the lights". La topbar resta nel suo stile normale. */
/* La chrome del Radar (barre liste/metriche) sparisce nel "salone" */
body.mkt-mode .lists-bar,
body.mkt-mode .metrics-strip,
body.mkt-mode .banner-aste-metriche { display: none !important; }

/* container centrato del "salone" */
.mkt-room {
  max-width: 1180px;
  margin: 0 auto;
  padding: 56px 36px 96px;
  animation: mktFadeIn 520ms var(--t) both;
}
@keyframes mktFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@media (max-width: 720px) { .mkt-room { padding: 32px 18px 64px; } }

/* ---------- HERO ---------- */
.mkt-hero {
  padding-bottom: 32px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--mk-line-strong);
}
.mkt-hero-rule {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}
.mkt-hero-rule::before, .mkt-hero-rule::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--mk-line-strong);
}
.mkt-hero-rule span {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: var(--mk-tan);
}
.mkt-hero-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(36px, 4.6vw, 56px);
  line-height: 1.06;
  letter-spacing: -0.01em;
  color: var(--mk-cream-1);
  margin: 0 0 18px 0;
  text-align: center;
}
.mkt-hero-title .ital {
  font-style: italic;
  font-weight: 500;
  color: var(--mk-tan-soft);
}
.mkt-hero-tagline {
  margin: 0 auto;
  max-width: 58ch;
  text-align: center;
  color: var(--mk-cream-2);
  font-size: 15.5px;
  line-height: 1.7;
}
.mkt-hero-tagline strong { color: var(--mk-cream-1); font-weight: 600; }
.mkt-hero-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 30px;
  padding: 14px 0;
  border-top: 1px solid var(--mk-line);
  border-bottom: 1px solid var(--mk-line);
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--mk-grey-1);
}
.mkt-hero-meta span {
  padding: 0 20px;
  border-right: 1px solid var(--mk-line);
}
.mkt-hero-meta span:last-child { border-right: none; }
.mkt-hero-meta strong { color: var(--mk-tan-soft); font-weight: 600; }

/* ---------- BETA notice ---------- */
.mkt-beta-banner {
  position: relative;
  padding: 26px 30px;
  margin-bottom: 28px;
  background: var(--mk-bg-card);
  border: 1px solid var(--mk-line-strong);
  border-radius: 4px;
}
.mkt-beta-banner::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 60px; height: 2px;
  background: var(--mk-tan);
}
.mkt-beta-kicker {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--mk-tan);
  margin-bottom: 12px;
}
.mkt-beta-body strong {
  display: block;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 24px;
  line-height: 1.2;
  color: var(--mk-cream-1);
  margin-bottom: 10px;
}
.mkt-beta-body p {
  margin: 0;
  color: var(--mk-cream-2);
  font-size: 14px;
  line-height: 1.7;
  max-width: 74ch;
}

/* ---------- FILTRI ---------- */
.mkt-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 36px;
  padding: 18px 0;
  border-top: 1px solid var(--mk-line-strong);
  border-bottom: 1px solid var(--mk-line-strong);
}
.mkt-filter-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--mk-grey-1);
  margin-right: 4px;
}
.mkt-filters select {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--mk-line-strong);
  border-radius: 999px;
  color: var(--mk-cream-2);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease;
}
.mkt-filters select:hover { border-color: var(--mk-tan-dim); color: var(--mk-cream-1); }
.mkt-filters select:focus-visible { outline: 2px solid var(--mk-tan); outline-offset: 2px; }
.mkt-filters select option { background: var(--mk-bg-card); color: var(--mk-cream-1); }

/* ---------- DISCLAIMER ---------- */
.mkt-disclaimer { margin-top: 8px; }
.mkt-disclaimer details {
  background: transparent;
  border: none;
}
.mkt-disclaimer summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: var(--mk-bg-card);
  border: 1px solid var(--mk-line-strong);
  border-radius: 2px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--mk-cream-2);
  transition: border-color 160ms ease, background 160ms ease;
}
.mkt-disclaimer summary::-webkit-details-marker { display: none; }
.mkt-disclaimer summary::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--mk-tan);
  flex-shrink: 0;
}
.mkt-disclaimer summary::after {
  content: "Leggi";
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--mk-grey-1);
}
.mkt-disclaimer details[open] summary::after { content: "Chiudi"; }
.mkt-disclaimer summary:hover { border-color: var(--mk-tan-dim); background: var(--mk-bg-tint); }
.mkt-disclaimer-body {
  padding: 18px 20px 6px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--mk-cream-2);
}
.mkt-disclaimer-body p { margin: 0 0 12px 0; }
.mkt-disclaimer-body strong { color: var(--mk-cream-1); }
.mkt-disclaimer-foot {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px dashed var(--mk-line-strong);
  font-size: 12px;
  color: var(--mk-grey-1);
}
.mkt-disclaimer-foot a {
  color: var(--mk-tan);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

/* ---------- GRID + CARD ---------- */
.mkt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  margin-bottom: 56px;
}
@media (max-width: 880px) { .mkt-grid { grid-template-columns: 1fr; gap: 22px; } }

.mkt-card {
  background: var(--mk-bg-card);
  border: 1px solid var(--mk-line-strong);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: border-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}
.mkt-card:hover {
  border-color: var(--mk-tan-dim);
  transform: translateY(-3px);
  box-shadow: 0 18px 48px rgba(0,0,0,0.45), 0 0 0 1px rgba(184,133,74,0.12);
}

.mkt-card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background-size: cover;
  background-position: center;
  background-color: var(--mk-bg-tint);
  overflow: hidden;
  filter: contrast(0.92) saturate(0.78) sepia(0.12);
}
.mkt-card-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(22,17,13,0) 45%, rgba(22,17,13,0.62));
}
.mkt-card-tag {
  position: absolute;
  top: 16px; left: 16px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: rgba(22,17,13,0.85);
  color: var(--mk-cream-1);
  border: 1px solid var(--mk-tan-dim);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
}
.mkt-card-tag::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--mk-tan-soft);
}
.mkt-card-tag.is-ss::before { background: var(--mk-warn); }
.mkt-card-dd {
  position: absolute;
  top: 16px; right: 16px;
  z-index: 1;
  padding: 5px 11px;
  background: rgba(22,17,13,0.85);
  color: var(--mk-positive);
  border: 1px solid rgba(143,166,122,0.5);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
}

.mkt-card-body { padding: 26px 26px 22px; flex: 1; display: flex; flex-direction: column; }
.mkt-card-comune {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--mk-grey-1);
  margin-bottom: 10px;
}
.mkt-card-comune .sigla { color: var(--mk-tan); font-weight: 600; }
.mkt-card h3 {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--mk-cream-1);
  margin: 0 0 6px 0;
}
.mkt-card .mkt-sub {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.35;
  color: var(--mk-cream-2);
  margin: 0 0 22px 0;
}

.mkt-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--mk-line-strong);
  border-bottom: 1px solid var(--mk-line-strong);
  margin-bottom: 20px;
}
.mkt-metric { padding: 13px 16px; border-right: 1px solid var(--mk-line-strong); }
.mkt-metric:nth-child(2n) { border-right: none; }
.mkt-metric:nth-child(n+3) { border-top: 1px solid var(--mk-line-strong); }
.mkt-metric-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--mk-grey-1);
  margin-bottom: 4px;
}
.mkt-metric-value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
  color: var(--mk-cream-1);
  line-height: 1.2;
}
.mkt-metric-value .small { font-size: 11px; color: var(--mk-grey-1); font-weight: 400; margin-left: 3px; }
.mkt-metric-value.is-pos { color: var(--mk-positive); }
.mkt-metric-value.is-tan { color: var(--mk-tan-soft); }

.mkt-card-status {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--mk-bg-tint);
  border-left: 2px solid var(--mk-tan);
  border-radius: 0 2px 2px 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--mk-cream-2);
  margin-bottom: 22px;
}
.mkt-card-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--mk-positive);
  flex-shrink: 0;
  margin-top: 5px;
}
.mkt-card-status-dot.is-warn { background: var(--mk-warn); }
.mkt-card-status strong { color: var(--mk-cream-1); font-weight: 600; }

.mkt-card-foot {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--mk-line-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.mkt-card-price-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--mk-grey-1);
  margin-bottom: 4px;
}
.mkt-card-price-value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--mk-tan-soft);
}
.mkt-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  background: var(--mk-tan);
  color: var(--mk-bg-deep);
  border: none;
  border-radius: 2px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}
.mkt-cta:hover { background: var(--mk-tan-soft); transform: translateX(2px); }

.mkt-empty {
  grid-column: 1 / -1;
  padding: 64px 24px;
  text-align: center;
  color: var(--mk-grey-1);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 18px;
}

/* =============================================================
   VISTA "LE MIE POSIZIONI"
   ============================================================= */
.posizioni-view {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  padding: 24px 28px 40px;
}
.posizioni-view.hidden { display: none; }

.pos-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.pos-header h2 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.pos-sub {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
}
.pos-filters {
  display: flex;
  gap: 8px;
}
.pos-filters input,
.pos-filters select {
  padding: 8px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12px;
}
.pos-filters input { min-width: 240px; }

/* Layout area preferiti: elenco verticale a sinistra + card come prima a destra */
.pos-layout {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}
.pos-sidebar {
  flex: 0 0 250px;
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.pos-sidebar-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 2px 4px 6px;
}
.pos-mini {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--border-2);
  border-radius: 9px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.pos-mini:hover { border-color: var(--accent, #8a6d3b); background: rgba(138, 109, 59, 0.06); }
.pos-mini.active { border-color: var(--accent, #8a6d3b); background: rgba(138, 109, 59, 0.12); }
.pos-mini-ico { font-size: 16px; flex: 0 0 auto; }
.pos-mini-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 auto; }
.pos-mini-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pos-mini-sub { font-size: 10px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-mini-flags { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; font-size: 11px; }
.pos-mini-badge {
  background: var(--accent, #8a6d3b);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* Card: evidenziazione breve quando si arriva dall'elenco laterale */
.pos-card.pos-card-highlight {
  box-shadow: 0 0 0 3px rgba(138, 109, 59, 0.45);
  transition: box-shadow .2s;
}
.pos-grid {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}
@media (max-width: 760px) {
  .pos-layout { flex-direction: column; }
  .pos-sidebar {
    position: static;
    flex-basis: auto;
    max-height: none;
    width: 100%;
    flex-direction: column;
  }
}
/* Banner "pratica aperta con il Middle Office" nella card della dashboard */
.pos-pratica-aperta {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 14px;
  padding: 11px 13px;
  border: 1px solid rgba(0, 135, 90, 0.30);
  border-left: 4px solid var(--pos, #00875a);
  border-radius: 9px;
  background: rgba(0, 135, 90, 0.07);
}
.pos-pratica-ico { font-size: 18px; line-height: 1.2; flex: 0 0 auto; }
.pos-pratica-txt { display: flex; flex-direction: column; gap: 2px; }
.pos-pratica-txt strong { font-size: 13px; color: var(--pos, #00875a); font-weight: 700; }
.pos-pratica-txt span { font-size: 11.5px; color: var(--text-2); line-height: 1.45; }

.pos-loading, .pos-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-2);
}
.pos-empty h3 {
  margin: 12px 0 6px;
  font-size: 18px;
  color: var(--text);
}
.pos-empty-icon { font-size: 48px; opacity: 0.4; }

.pos-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.18s var(--t);
}
.pos-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--text-dim);
}

.pos-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 16px 10px;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.pos-card-title {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.pos-fav {
  color: var(--warn);
  font-size: 16px;
  margin-top: 2px;
}
.pos-cat-icon {
  font-size: 28px;
  line-height: 1;
  margin-top: -2px;
}
.pos-card-title h3 {
  margin: 0 0 3px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.pos-card-addr {
  font-size: 11px;
  color: var(--text-2);
}
.pos-card-price {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.pos-card-meta {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.pos-card-body {
  padding: 14px 16px;
  flex: 1;
}

.pos-section { margin-bottom: 14px; }
.pos-section:last-child { margin-bottom: 0; }

.pos-section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 6px;
}

.pos-docs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* Riga di un documento acquistato (ri-scaricabile) nell'area preferiti */
.pos-doc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border-2);
  border-radius: 9px;
  background: var(--surface);
}
.pos-doc-ico { font-size: 18px; line-height: 1; flex: 0 0 auto; }
.pos-doc-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 auto; }
.pos-doc-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pos-doc-date { font-size: 10.5px; color: var(--text-dim); }
.pos-doc-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.pos-doc-btn {
  font-size: 11px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 7px;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--accent, #8a6d3b);
  transition: background .15s, color .15s, transform .05s;
}
.pos-doc-btn:active { transform: scale(0.97); }
.pos-doc-view { color: var(--accent, #8a6d3b); background: transparent; }
.pos-doc-view:hover { background: rgba(138, 109, 59, 0.10); }
.pos-doc-dl { color: #fff; background: var(--accent, #8a6d3b); }
.pos-doc-dl:hover { background: #755c30; }
.pos-visura-chip {
  display: inline-block;
  background: rgba(30, 64, 175, 0.1);
  color: var(--info);
  border: 1px solid rgba(30, 64, 175, 0.3);
  padding: 3px 9px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.pos-dd-chip {
  display: inline-block;
  background: rgba(0, 135, 90, 0.1);
  color: var(--pos);
  border: 1px solid rgba(0, 135, 90, 0.3);
  padding: 3px 9px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.pos-dd-chip.empty {
  background: var(--surface);
  color: var(--text-dim);
  border-color: var(--border-2);
}
.pos-dd-chip.local {
  background: rgba(180, 83, 9, 0.1);
  color: var(--warn);
  border-color: rgba(180, 83, 9, 0.3);
}
.pos-no-docs {
  color: var(--text-dim);
  font-size: 11px;
  font-style: italic;
}

.pos-note-input {
  width: 100%;
  min-height: 60px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12px;
  resize: vertical;
  line-height: 1.5;
}
.pos-note-input:focus {
  outline: none;
  border-color: var(--pos);
  box-shadow: 0 0 0 2px var(--pos-glow);
}
.pos-note-status {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 4px;
  min-height: 14px;
  letter-spacing: 0.3px;
}

.pos-card-foot {
  display: flex;
  gap: 4px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}
.pos-card-foot button {
  flex: 1;
  padding: 7px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s var(--t);
}
.pos-card-foot button:hover {
  border-color: var(--pos);
  color: var(--pos);
}
.pos-card-foot .pos-action-remove:hover {
  border-color: var(--neg);
  color: var(--neg);
}

/* Modal Marketplace — dark "Salone Privato" */
.mkt-modal-content {
  max-width: 720px;
  position: relative;
  background: #1F1813;
  border: 1px solid #3E3024;
  color: #F0E8D8;
}
.mkt-modal-content .close-btn { color: #D9CCB6; }
.mkt-modal-content .close-btn:hover { color: #D4A269; }
.mkt-modal-content .mkt-modal-kicker {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #B8854A;
  margin-bottom: 10px;
}
.mkt-modal-content h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 34px;
  line-height: 1.08;
  color: #F0E8D8;
  margin: 0 0 6px;
  padding-right: 40px;
}
.mkt-modal-loc {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #8E8478;
  margin-bottom: 18px;
}
.mkt-modal-loc .sigla { color: #B8854A; font-weight: 600; }
.mkt-detail-img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-radius: 3px;
  margin-bottom: 22px;
  filter: contrast(0.94) saturate(0.8) sepia(0.1);
}
.mkt-detail-section { margin-bottom: 22px; }
.mkt-detail-section h4 {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #B8854A;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #3E3024;
  font-weight: 600;
}
.mkt-detail-section p { color: #D9CCB6; }
.mkt-detail-section .mkt-numbers {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border-top: 1px solid #3E3024;
  border-left: 1px solid #3E3024;
  border-radius: 2px;
  overflow: hidden;
}
.mkt-detail-section .mkt-numbers .item {
  padding: 13px 16px;
  border-right: 1px solid #3E3024;
  border-bottom: 1px solid #3E3024;
}
.mkt-detail-section .mkt-numbers .item label {
  display: block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #8E8478;
  margin-bottom: 4px;
}
.mkt-detail-section .mkt-numbers .item .value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
  color: #F0E8D8;
}
.mkt-detail-section .mkt-numbers .item .value.pos { color: #8FA67A; }
.mkt-detail-section .mkt-numbers .item .value.tan { color: #D4A269; }
.mkt-doc-list { list-style: none; padding: 0; margin: 0; }
.mkt-doc-list li {
  padding: 7px 0;
  font-size: 13px;
  color: #D9CCB6;
  display: flex;
  align-items: center;
  gap: 10px;
}
.mkt-doc-list li::before { content: "✓"; color: #8FA67A; font-weight: 700; }
.mkt-requisiti {
  background: #241B14;
  border-left: 3px solid #B8854A;
  padding: 14px 16px;
  border-radius: 0 2px 2px 0;
  font-size: 12.5px;
  color: #D9CCB6;
  line-height: 1.6;
}

.mkt-cta-bar {
  display: flex;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid #3E3024;
}
.mkt-cta-bar button {
  flex: 1;
  padding: 13px;
  border-radius: 2px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.16s var(--t);
}
.mkt-cta-bar .primary {
  background: #B8854A;
  color: #16110D;
  border: 1px solid #B8854A;
}
.mkt-cta-bar .primary:hover { background: #D4A269; }
.mkt-cta-bar .secondary {
  background: transparent;
  border: 1px solid #3E3024;
  color: #D9CCB6;
}
.mkt-cta-bar .secondary:hover { border-color: #7A5A2F; color: #F0E8D8; }

/* =============================================================
   VISURE AUTOMATICHE
   ============================================================= */
.visure-status {
  font-size: 10px;
  color: var(--text-2);
  margin-bottom: 8px;
  padding: 6px 10px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border-left: 3px solid var(--info);
}

.visure-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}

.visura-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 9px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s var(--t);
  text-align: left;
  position: relative;
}
.visura-btn:hover {
  background: var(--surface-2);
  border-color: var(--pos);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.visura-btn:active {
  transform: translateY(0) scale(0.985);
  box-shadow: none;
}
.visura-icon { font-size: 18px; margin-bottom: 2px; }
.visura-label { font-weight: 600; display: block; }
.visura-cost {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  color: var(--warn);
  margin-top: 3px;
  letter-spacing: 0.5px;
}
.visura-btn:hover .visura-cost { color: var(--pos); }
.visura-status-tag {
  position: absolute;
  top: 8px; right: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 2px 6px;
  border-radius: 3px;
  background: transparent;
}
.visura-status-tag.done {
  color: var(--pos);
  background: rgba(0, 135, 90, 0.12);
}
.visura-status-tag.soon {
  color: var(--text-dim);
  background: rgba(120, 120, 120, 0.12);
}

/* Profilo di lancio: bottone visura non ancora attivo → look spento "in attivazione".
   Il click resta abilitato (mostra il modale "in arrivo"), quindi NON usiamo pointer-events:none. */
.visura-btn.visura-soon {
  background: var(--bg-2);
  border-style: dashed;
  border-color: var(--border-2);
  opacity: 0.7;
  cursor: default;
}
.visura-btn.visura-soon:hover {
  background: var(--bg-2);
  border-color: var(--border-2);
  transform: none;
  box-shadow: none;
  opacity: 0.85;
}
.visura-btn.visura-soon:active {
  transform: none;
  scale: 1;
}
.visura-cost-soon {
  color: var(--text-dim) !important;
  text-transform: none;
}
.visura-btn.visura-soon:hover .visura-cost { color: var(--text-dim); }

.visura-note {
  font-size: 10px;
  color: var(--text-2);
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-mock {
  background: var(--warn);
  color: white;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.badge-live {
  background: var(--pos);
  color: white;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.badge-cache {
  background: var(--info);
  color: white;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Modal Visura */
.visura-modal-content {
  max-width: 780px;
  position: relative;
}
.visura-modal-content h2 {
  margin: 0 0 10px;
  padding-right: 40px;
}
.visura-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 16px;
  font-size: 11px;
  color: var(--text-2);
}
.visura-refresh {
  margin-left: auto;
  padding: 4px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  color: var(--text);
}
.visura-refresh:hover { border-color: var(--pos); color: var(--pos); }

.visura-loader {
  text-align: center;
  padding: 60px 0;
  color: var(--text-2);
}
.visura-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--pos);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Tabella ipoteche per modal visure */
.visura-modal-content .dd-ipoteche-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 12px;
}
.visura-modal-content .dd-ipoteche-table th {
  background: var(--surface-2);
  text-align: left;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-2);
  border-bottom: 2px solid var(--border-2);
}
.visura-modal-content .dd-ipoteche-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.visura-modal-content .dd-ipoteche-table .grado {
  font-family: var(--font-mono);
  font-weight: 800;
  color: var(--pos);
}
.visura-modal-content .dd-sub-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-weight: 700;
  margin: 16px 0 6px;
}

/* =============================================================
   MODAL DUE DILIGENCE (manleva)
   ============================================================= */
.dd-modal {
  position: fixed; inset: 0;
  background: rgba(10, 14, 26, 0.55);
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 1;
  transition: opacity 0.2s var(--t);
}
.dd-modal.hidden { opacity: 0; pointer-events: none; }

.dd-modal-content {
  background: var(--bg-2);
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px 30px;
  border: 1px solid var(--border);
  animation: modalIn 0.25s var(--t);
}

@keyframes modalIn {
  from { transform: translateY(20px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.dd-modal-content h2 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.dd-modal-intro {
  font-size: 13px;
  color: var(--text-2);
  margin: 0 0 18px;
  line-height: 1.5;
}

.dd-modal-warning {
  background: #FAF3E5;
  border: 1px solid #B89968;
  border-left: 4px solid var(--warn);
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  font-size: 12px;
  color: #4A3A1A;
  line-height: 1.5;
}
.dd-modal-warning strong {
  color: var(--warn);
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.dd-modal-warning p { margin: 6px 0; }
.dd-modal-warning ul {
  margin: 8px 0;
  padding-left: 20px;
}
.dd-modal-warning li { margin-bottom: 4px; }

.dd-modal-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: 18px;
  transition: all 0.15s var(--t);
}
.dd-modal-checkbox:hover { border-color: var(--text-dim); }
.dd-modal-checkbox input { margin-top: 2px; cursor: pointer; }
.dd-modal-checkbox span {
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
}

.dd-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.dd-modal-actions .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.dd-modal-actions .btn[disabled]:hover {
  border-color: var(--border-2);
  color: var(--text);
  box-shadow: none;
}

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 768px) {
  .metrics-strip { grid-template-columns: repeat(3, 1fr); }
  .metric:nth-child(3) { border-right: none; }
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: 45%; }
  .map-section { height: 55%; }
  .detail-panel { width: 100%; }
  .map-legend { bottom: 10px; left: 10px; font-size: 9px; padding: 6px 10px; }
  .map-legend-potenziale { left: auto; right: 10px; }
  .brand-text h1 { font-size: 13px; }
  .brand-text .subtitle { font-size: 9px; }
  .user-dropdown { right: 8px; width: calc(100vw - 16px); max-width: 320px; }
}

/* =============================================================
   CONTESTO DI ZONA (Fase 0 Mercato Libero)
   ============================================================= */
.contesto-zona-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin: 14px 0;
}
.contesto-zona-box .cz-loading {
  color: var(--text-2);
  font-size: 14px;
  padding: 6px 0;
}
.cz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.cz-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-1);
}
.cz-din-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.cz-din-alta  { background: rgba(46,160,67,0.12);  color: var(--pos); }
.cz-din-media { background: rgba(210,153,34,0.14); color: var(--mk-warn, #b8860b); }
.cz-din-bassa { background: rgba(207,76,76,0.12);  color: var(--neg); }

.cz-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.cz-cell {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 10px;
  text-align: center;
}
.cz-cell-tempo {
  border-color: var(--accent);
  background: var(--bg-2, var(--surface-2));
}
.cz-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.1;
}
.cz-unit { font-size: 12px; font-weight: 600; color: var(--text-2); }
.cz-lab {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 5px;
  line-height: 1.25;
}
.cz-trend { font-weight: 700; margin-left: 4px; white-space: nowrap; }
.cz-trend-up   { color: var(--pos); }
.cz-trend-down { color: var(--neg); }

.cz-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-2);
}
.cz-nota { cursor: help; opacity: 0.7; }

@media (max-width: 640px) {
  .cz-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Approfondimento compravendite reali (a gettoni) */
.cz-approfondisci {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: filter var(--t, 0.15s) ease;
}
.cz-approfondisci:hover { filter: brightness(1.08); }
.cz-approfondisci:disabled { opacity: 0.6; cursor: default; }
.cz-approfondisci .cz-costo { font-weight: 700; opacity: 0.9; }
.cz-approf-hint {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 6px;
}
.cz-approf-cta { margin-top: 14px; }
.cz-approf-consiglio {
  padding: 8px 11px;
  margin-bottom: 10px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-2);
  background: var(--bg, #FAF8F5);
  border: 1px dashed var(--border-2, #D9D9DD);
  border-radius: 9px;
}
.cz-approf-consiglio strong { color: var(--accent, #8B6F3B); }
.cz-approf-cta .cz-approfondisci { margin-top: 0; }
.cz-approf-cta .cz-approf-hint { margin-top: 6px; }

/* Slot "Scopri il valore reale" + "Analisi NPL": ritmo coerente con le sezioni */
#valore-slot { display: block; margin-bottom: 14px; }
#npl-slot { display: block; margin-bottom: 24px; }
#npl-slot:empty { display: none; margin: 0; }

.cz-dettaglio { margin-top: 14px; }
.cz-dett-validazione {
  margin: 10px 0;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-2);
  background: rgba(45, 80, 22, 0.06);
  border: 1px solid rgba(45, 80, 22, 0.22);
  border-radius: 9px;
}
.cz-dett-validazione strong { color: var(--text); }
.cz-dett-validazione em { color: var(--accent, #8B6F3B); font-style: normal; font-weight: 600; }
.cz-dett-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  color: var(--text-1);
  margin-bottom: 8px;
}
.cz-dett-token { font-size: 11px; color: var(--text-2); white-space: nowrap; }
.cz-dett-sub { font-size: 11px; font-weight: 400; color: var(--text-2); }

/* Controlli "visibili ma bloccati" (upsell per layer superiori) */
.filter-tab-locked { opacity: .5; cursor: help; }
.filter-tab-locked:hover { opacity: .72; }
.filter-tab-locked.active { opacity: .5; }
.filter-tab-locked .lock-ic { font-size: .9em; }
.filter-tab-soon { opacity: .72; }
.filter-tab-soon::after { content: " · presto"; font-size: .82em; opacity: .7; }

/* =========================================================
   Autocomplete ricerca (città / provincia) — tendina sotto la barra
   ========================================================= */
.search-suggest {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 1200;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(26, 23, 20, .16);
  max-height: 320px; overflow-y: auto; display: none;
}
.ss-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 11px; cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.ss-item:last-child { border-bottom: none; }
.ss-item:hover, .ss-item.ss-active { background: var(--surface-2); }
.ss-ic { color: var(--accent); font-size: 13px; width: 14px; text-align: center; flex: none; }
.ss-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ss-name { font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-sub { font-size: 10.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .03em; }
.ss-count { font-size: 11px; font-weight: 700; color: var(--brand); flex: none; white-space: nowrap; padding-left: 6px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 1px; line-height: 1.25; }
.ss-count .ss-c-pign { color: var(--brand); }
.ss-count .ss-c-aste { color: #1d6b34; }   /* aste in verde, distinte dai pignoramenti */
.ss-count .ss-c-zero { color: var(--text-dim); font-weight: 600; }
.ss-count.ss-zero { color: var(--text-dim); font-weight: 600; }
.ss-count.ss-open { color: #1d6b34; font-weight: 600; }   /* riga RGE: "apre la scheda →" */
#search.search-has-scope { font-weight: 600; color: var(--brand); }

/* Posizioni oscurate (teaser) sulla mappa */
.pin-oscurato { filter: grayscale(1); }

/* Barra "Proponi operazione" nel Marketplace (vista dark) */
#mkt-propose-bar { margin: 0 0 14px; }
.mkt-propose-btn {
  background: var(--mk-tan, #c8a96a);
  color: #1a1a1a;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.mkt-propose-btn:hover { filter: brightness(1.08); }
.mkt-propose-locked {
  font-size: 13px;
  color: var(--mk-cream-2, #cfc6b4);
  background: rgba(255,255,255,0.04);
  border: 1px dashed rgba(255,255,255,0.18);
  border-radius: 8px;
  padding: 10px 14px;
}
.cz-dett-scroll { max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.cz-dett-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cz-dett-table thead th {
  position: sticky; top: 0;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.cz-dett-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text-1); }
.cz-dett-table tbody tr:last-child td { border-bottom: none; }
.cz-dett-via { font-weight: 600; }
.cz-dett-prezzo { font-weight: 700; }
.cz-dett-data { color: var(--text-2); white-space: nowrap; }
.cz-dett-foot { font-size: 11px; color: var(--text-2); margin-top: 8px; }
.cz-dett-err { font-size: 13px; color: var(--neg); margin-top: 12px; }

.cz-riepilogo {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-1);
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.cz-map {
  height: 260px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  z-index: 0;
}
.cz-map .leaflet-popup-content { font-size: 12px; line-height: 1.35; }
.cz-fase2 {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-2);
  background: var(--bg-2, var(--surface-2));
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-top: 12px;
}

/* ============================================================
   Approfondimenti tecnici — accordion neutro della scheda immobile.
   Stesso affordance "Vedi dettagli ▾" dei box valore/NPL, ma sfondo
   neutro (è un blocco tecnico, non deve "pesare" come il valore).
   <details> nativo: nessun JS richiesto, chiuso di default.
   ============================================================ */
.detail-approfondimenti {
  border: 1px solid var(--border);
  border-radius: var(--radius, 12px);
  background: var(--surface-2, var(--bg-2, #faf9f6));
  margin: 18px 0;
  overflow: hidden;
}
.detail-approfondimenti > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
}
.detail-approfondimenti > summary::-webkit-details-marker { display: none; }
.detail-approfondimenti > summary:hover { background: rgba(0, 0, 0, 0.025); }
.appro-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.appro-titolo { font-weight: 700; font-size: 13px; color: var(--text, #2b2b2b); }
.appro-sub { font-size: 12px; color: var(--text-2); }
/* Toggle "Vedi dettagli / Nascondi ▾" replicato dal pattern .perizia-summary-toggle */
.appro-toggle {
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}
.appro-toggle::before { content: "Vedi dettagli"; font-size: 11px; }
.detail-approfondimenti[open] .appro-toggle::before { content: "Nascondi"; }
.appro-toggle::after { content: "▾"; font-size: 14px; transition: transform 0.15s; }
.detail-approfondimenti[open] .appro-toggle::after { transform: rotate(180deg); }
.detail-approfondimenti-body {
  padding: 4px 16px 10px;
  border-top: 1px solid var(--border);
}
.detail-approfondimenti-body > .detail-section:first-child { margin-top: 6px; }

/* Intro del blocco visure "Documenti ufficiali (a gettoni)" */
.visura-intro {
  color: var(--muted, #8a8578);
  font-size: 0.82rem;
  line-height: 1.45;
  margin-bottom: 10px;
}

/* Su mobile il sottotitolo dell'accordion va a capo male: lo nascondo */
@media (max-width: 560px) {
  .appro-sub { display: none; }
}

/* ============================================================
   Riga "Procedura" nella lista — raggruppa i lotti che condividono
   lo stesso repertorio. Una riga sola, cliccabile per espandere i lotti.
   ============================================================ */
.list-item-procedura { cursor: pointer; background: var(--surface-2, #faf9f6); }
.list-item-procedura:hover { background: rgba(0, 0, 0, 0.03); }
.list-item-procedura.espansa { border-left: 3px solid var(--accent, #8a6d3b); }
.li-proc-icon {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: var(--bg-2, #efece4);
  border-radius: 8px;
}
.chip-proc { background: var(--accent, #8a6d3b); color: #fff; }
.li-proc-toggle {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent, #8a6d3b);
  white-space: nowrap;
}
/* I lotti espansi: leggermente rientrati e con un filetto a sinistra */
.list-item-lotto { background: rgba(0, 0, 0, 0.015); }
.list-item-lotto .li-content {
  border-left: 2px dashed var(--border);
  padding-left: 10px;
  margin-left: 2px;
}
/* Card-asta come lotto figlio di una procedura espansa: rientro + filetto accent */
.list-item-asta.list-item-lotto {
  margin-left: 14px;
  border-left: 3px solid var(--accent, #8a6d3b);
}

/* ---- Multi-lotto ASTE: tasto "Vedi tutti i lotti" → pannello link nella scheda ---- */
.lotti-procedura-box {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface, #fff);
}
.lotti-procedura-titolo {
  padding: 9px 12px;
  background: var(--surface-2, #faf9f6);
  border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 700; color: var(--text);
}
.lotto-link {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left;
  padding: 9px 12px;
  background: transparent; border: none; border-top: 1px solid var(--border);
  cursor: pointer; font: inherit; font-size: 12px; color: var(--text);
}
.lotto-link:first-of-type { border-top: none; }
.lotto-link:hover:not(:disabled) { background: rgba(0, 0, 0, 0.03); }
.lotto-link:disabled { cursor: default; opacity: 0.72; }
.lotto-link.corrente { background: rgba(138, 109, 59, 0.08); }
.lotto-link-l { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lotto-link-p { flex: 0 0 auto; font-weight: 600; }
.lotto-qui { color: var(--accent, #8a6d3b); font-weight: 700; }

/* Tasto "Prenota una visita": evidenziato (azione, colore brand) */
.azioni-asta-pubblica .btn-visita {
  border-color: var(--brand, #7a1f2b);
  color: var(--brand, #7a1f2b);
  font-weight: 700;
}
.azioni-asta-pubblica .btn-visita:hover { background: rgba(122, 31, 43, 0.06); }

/* Riga "Referente per le visite" in evidenza */
.ap-note.ap-visite {
  background: rgba(122, 31, 43, 0.05);
  border-left: 3px solid var(--brand, #7a1f2b);
  padding: 8px 10px;
  border-radius: 4px;
}

/* ============================================================
   Marketplace — pannello teaser "in arrivo" (modalità non attiva)
   ============================================================ */
.mkt-teaser {
  max-width: 620px;
  margin: 32px auto;
  text-align: center;
  padding: 36px 28px;
  border: 1px dashed var(--border);
  border-radius: 16px;
  background: var(--surface-2, var(--bg-2, #faf9f6));
}
.mkt-teaser-ico { font-size: 40px; line-height: 1; margin-bottom: 12px; }
.mkt-teaser h3 {
  margin: 0 0 12px;
  font-size: 1.35rem;
  color: var(--text, #2b2b2b);
}
.mkt-teaser p {
  margin: 0 auto 10px;
  max-width: 520px;
  color: var(--text-2);
  line-height: 1.55;
}
.mkt-teaser-soft { font-size: 0.88rem; color: var(--muted, #8a8578); }
.mkt-teaser-soft a { color: var(--accent, #8a6d3b); font-weight: 600; }

/* ============================================================
   Feedback / Segnalazione — form e "Grazie" mutuamente esclusivi.
   Mancava la regola .hidden per questi elementi → il pannello "Grazie"
   restava SEMPRE visibile sotto il form (sembrava inviato prima del tempo).
   ============================================================ */
#fb-form.hidden,
#fb-success.hidden { display: none !important; }

/* ===== Ricerca patrimoniale del debitore (Tier 1 OpenAPI) ===== */
.patr-comune-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--border, #eee);
  flex-wrap: wrap;
}
.patr-result-head { font-size: 13px; margin-bottom: 10px; color: var(--text-2, #666); }
.patr-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.patr-table th, .patr-table td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--border, #eee); }
.patr-table th { color: var(--text-2, #666); font-weight: 600; }

/* =============================================================
   GLOSSARIO — tooltip sui termini tecnici poco comuni
   Termine sottolineato (puntinato oro) + spiegazione al passaggio del mouse.
   ============================================================= */
.gloss {
  border-bottom: 1px dotted var(--accent);
  cursor: help;
  position: relative;
}
.gloss::after {
  content: attr(data-tip);
  position: absolute;
  left: 0; bottom: calc(100% + 9px);
  width: max-content; max-width: 280px;
  background: var(--text); color: #F7F3EC;
  font-family: var(--font-sans); font-size: 12px; font-weight: 500;
  line-height: 1.45; letter-spacing: 0; text-transform: none;
  padding: 9px 12px; border-radius: 8px;
  box-shadow: var(--shadow-lg);
  white-space: normal;
  opacity: 0; visibility: hidden; transform: translateY(4px);
  transition: opacity .15s var(--t), transform .15s var(--t);
  pointer-events: none; z-index: 3000;
}
.gloss::before {
  content: ""; position: absolute; left: 13px; bottom: calc(100% + 4px);
  border: 5px solid transparent; border-top-color: var(--text);
  opacity: 0; visibility: hidden;
  transition: opacity .15s var(--t); pointer-events: none; z-index: 3000;
}
.gloss:hover::after, .gloss:hover::before { opacity: 1; visibility: visible; transform: translateY(0); }

/* Tooltip stilizzato su chip/badge (riusa la grafica del glossario, ma SOTTO
   l'elemento: i chip stanno in cima alla scheda e un tooltip sopra verrebbe tagliato) */
.chip-tip { position: relative; cursor: help; }
.chip-tip::after {
  content: attr(data-tip);
  position: absolute; left: 0; top: calc(100% + 9px);
  width: max-content; max-width: 300px;
  background: var(--text); color: #F7F3EC;
  font-family: var(--font-sans); font-size: 12px; font-weight: 500;
  line-height: 1.45; letter-spacing: 0; text-transform: none; text-align: left;
  padding: 9px 12px; border-radius: 8px; box-shadow: var(--shadow-lg);
  white-space: normal;
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .15s var(--t), transform .15s var(--t);
  pointer-events: none; z-index: 3000;
}
.chip-tip::before {
  content: ""; position: absolute; left: 16px; top: calc(100% + 4px);
  border: 5px solid transparent; border-bottom-color: var(--text);
  opacity: 0; visibility: hidden; transition: opacity .15s var(--t);
  pointer-events: none; z-index: 3000;
}
.chip-tip:hover::after, .chip-tip:hover::before { opacity: 1; visibility: visible; transform: translateY(0); }

/* Chip stato occupazione (verde = libero) nella scheda asta */
.ap-chip.pos { color: #1d6b34; border-color: rgba(29,107,52,.30); background: rgba(29,107,52,.07); }

/* Verifica live sul PVP (scheda asta): spunta verde / avviso oro */
.verifica-live {
  margin-top: 10px; padding: 7px 12px; border-radius: 8px;
  font-size: 12px; line-height: 1.5;
}
.verifica-live.ok   { background: rgba(29,107,52,.07); color: #1d6b34; border: 1px solid rgba(29,107,52,.22); }
.verifica-live.warn { background: #fdf6e3; color: #7a5d10; border: 1px solid #ecd9a0; }
/* Intelligence pre-asta: il Radar conosceva la posizione prima della pubblicazione */
.verifica-live.intel { background: rgba(110,28,46,.06); color: #6e1c2e; border: 1px solid rgba(110,28,46,.25); }

/* Micro-badge di provenienza: il valore del campo arriva dall'asta PVP agganciata */
.badge-pvp {
  display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 4px;
  font-size: 9px; font-weight: 700; letter-spacing: .5px; line-height: 14px;
  vertical-align: 1px; cursor: help;
  background: rgba(110,28,46,.08); color: #6e1c2e; border: 1px solid rgba(110,28,46,.25);
}

/* Stato procedura esecutiva (PST) nella scheda asta */
.sp-box { margin: 10px 0 4px; padding: 12px 14px; border: 1px solid var(--linea, #e4ded3); border-radius: 10px; background: #fbf9f5; }
.sp-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.sp-fase { font-family: 'Fraunces', serif; font-size: 16px; color: var(--bordeaux, #6b1f2a); font-weight: 600; }
.sp-meta { font-size: 12px; color: var(--text-2, #6b665d); }
.sp-parti { margin-top: 6px; font-size: 12.5px; color: var(--text-2, #57534e); }
.sp-alert { margin-top: 8px; padding: 7px 11px; border-radius: 8px; font-size: 12.5px; line-height: 1.45; }
.sp-alert.neg { background: rgba(139,26,26,.06); color: #8b1a1a; border: 1px solid rgba(139,26,26,.22); }
.sp-alert.warn { background: #fdf6e3; color: #7a5d10; border: 1px solid #ecd9a0; }
.sp-timeline { margin-top: 6px; }
.sp-riga { font-size: 12.5px; padding: 3px 0; border-top: 1px dashed #efe9de; }
.sp-data { color: var(--text-2, #78716c); margin-right: 8px; }

/* Documenti della procedura: nome + doppio tasto (apri / scarica) */
.doc-proc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 8px; }
.doc-proc-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px; border: 1px solid var(--linea, #e4ded3); border-radius: 10px; background: #fff;
}
.doc-proc-nome { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-proc-azioni { display: flex; gap: 6px; flex-shrink: 0; }
.doc-proc-azioni .btn { padding: 5px 10px; font-size: 12px; }

/* ===== Sync mappa→lista: toggle "Segui la mappa" + tasto "Cerca in questa zona" ===== */
.segui-mappa {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--text-2, #6b665d); cursor: pointer; user-select: none;
  white-space: nowrap;
}
.segui-mappa input { accent-color: var(--brand, #6B2C39); cursor: pointer; margin: 0; }
.count-zona { color: var(--brand, #6B2C39); font-weight: 600; }
.cerca-in-zona {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 600; padding: 9px 18px; border: none; border-radius: 999px;
  background: var(--brand, #6B2C39); color: #fff; font-size: 13px; font-weight: 600;
  cursor: pointer; box-shadow: 0 3px 12px rgba(0,0,0,.22);
}
.cerca-in-zona:hover { background: var(--brand-dark, #531F2A); }

/* ===== Sintesi perizia AI (servizio premium, on-demand) ===== */
.sp-ai-card { border: 1px solid var(--linea, #e4ded3); border-radius: 12px; padding: 14px 16px; margin-top: 12px; background: #fff; }
.sp-ai-incluso { border-color: #c9a86a; background: linear-gradient(180deg,#fffdf6,#fff); }
.sp-ai-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sp-ai-titolo { font-weight: 700; font-size: 14px; color: var(--brand,#6B2C39); }
.sp-ai-ai { font-weight: 600; font-size: 11px; color: #7C3AED; background: #f3ecfd; padding: 1px 8px; border-radius: 999px; margin-left: 6px; }
.sp-ai-sub { font-size: 12px; color: var(--text-2,#6b665d); margin-top: 4px; line-height: 1.5; }
.sp-ai-badge { font-size: 11px; font-weight: 700; padding: 3px 11px; border-radius: 999px; white-space: nowrap; flex: none; }
.sp-ai-badge.soon { background: #fdf6e3; color: #8a6d1a; }
.sp-ai-badge.esclusivo { background: linear-gradient(90deg,#c9a86a,#e6cd92,#c9a86a); background-size: 200% 100%; color: #4a3410;
  animation: sp-shine 3s linear infinite; box-shadow: 0 1px 6px rgba(201,168,106,.4); }
@keyframes sp-shine { 0%{background-position:0% 0} 100%{background-position:200% 0} }
.sp-ai-btn { margin-top: 12px; width: 100%; padding: 11px 16px; border: none; border-radius: 10px;
  background: var(--brand,#6B2C39); color: #fff; font-size: 13.5px; font-weight: 700; cursor: pointer; transition: background .15s; }
.sp-ai-btn:hover:not(:disabled) { background: var(--brand-dark,#531F2A); }
.sp-ai-btn:disabled { opacity: .7; cursor: default; }
.sp-ai-incluso .sp-ai-btn { background: linear-gradient(90deg,#8a5a1e,#b5832f); }
.sp-ai-teaser { background: #faf8f4; border-style: dashed; }
.sp-ai-working { opacity: .85; }
/* === Vetrina "cosa sblocchi" — momento di conversione sintesi AI (Andrea 2026-06-20) === */
.sp-vetrina { background: linear-gradient(180deg,#fffdf9,#fff); border-color: #d9c6a0; }
.sp-vetrina-tit { font-family: var(--font-serif,serif); font-weight: 700; font-size: 15.5px; color: var(--brand,#6B2C39); line-height: 1.3; }
.sp-vetrina-sub { font-size: 12.5px; color: var(--text-2,#6b665d); margin-top: 4px; line-height: 1.5; }
.sp-sblocchi { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 7px 14px; margin: 13px 0; }
.sp-sblocco { display: flex; gap: 7px; align-items: flex-start; font-size: 12.5px; color: var(--text-1,#3a352d); line-height: 1.35; }
.sp-lock { flex: 0 0 auto; font-size: 11px; opacity: .55; }
.sp-esempio { background: #fbf3f1; border: 1px solid #e8d3cf; border-radius: 9px; padding: 10px 12px; margin-bottom: 12px; }
.sp-esempio-tit { font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; color: #8a6d3b; margin-bottom: 6px; }
.sp-esempio-righe { display: flex; flex-direction: column; gap: 4px; }
.sp-esempio-riga { font-size: 12.5px; color: var(--text-1,#3a352d); line-height: 1.4; }
.sp-esempio-riga b { color: var(--brand,#6B2C39); }
.sp-trust { font-size: 11px; color: var(--text-2,#6b665d); line-height: 1.5; margin-bottom: 12px; }
.sp-vetrina-cta { margin-top: 4px; padding: 11px 16px; border-radius: 10px; text-align: center; font-size: 13px; font-weight: 700; cursor: pointer; }
.sp-cta-upsell { background: #f3ecfd; color: #5b21b6; border: 1px solid #d9c6f5; }
/* === Lettura su misura — questionario a chip + card (Fase 1, Andrea 2026-06-20) === */
.sm-card { background: linear-gradient(180deg,#fbf9ff,#fff); border: 1px solid #d9c6f5 !important; }
.sm-intro { font-size: 12px; color: var(--text-2,#6b665d); line-height: 1.5; margin: 2px 0 12px; }
.sm-group { margin-bottom: 10px; }
.sm-q { font-size: 12px; font-weight: 700; color: var(--text-1,#3a352d); margin-bottom: 6px; }
.sm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sm-chip { font-size: 12.5px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-2,#e4ded3); background: #fff; color: var(--text-1,#3a352d); cursor: pointer; font-family: var(--font-sans); }
.sm-chip:hover { border-color: #b79de8; }
.sm-chip.on { background: #6d28d9; color: #fff; border-color: #6d28d9; }
.sm-dettaglio { margin: 8px 0; }
.sm-dettaglio summary { cursor: pointer; font-size: 12px; color: #6d28d9; }
.sm-testo { width: 100%; margin-top: 7px; padding: 8px 10px; border: 1px solid var(--border-2,#e4ded3); border-radius: 8px; font: inherit; font-size: 13px; resize: vertical; box-sizing: border-box; }
.sm-btn { background: #6d28d9 !important; }
.sm-btn:hover:not(:disabled) { background: #5b21b6 !important; }
.sm-done .sm-blocco { margin-top: 10px; padding-left: 11px; border-left: 3px solid var(--border-2,#e4ded3); }
.sm-blocco-tit { font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--text-2,#6b665d); margin-bottom: 3px; }
.sm-blocco .sp-ul { margin: 0; }
.sm-enfasi { border-left-color: #6d28d9 !important; }
.sm-avvisi { border-left-color: #C08A2E !important; }
.sm-fiscali { border-left-color: #2F8F8A !important; }
.sm-mo { border-left-color: var(--brand,#6B2C39) !important; }
.sm-perchi { font-family: var(--font-sans); font-size: 12px; font-weight: 400; color: #6d28d9; }
.sm-disc { font-size: 10.5px; color: var(--text-2,#6b665d); font-style: italic; margin-top: 11px; line-height: 1.45; }
.sm-cambia { margin-top: 8px; }
.sm-link { background: none; border: none; color: #6d28d9; font-size: 12px; cursor: pointer; padding: 0; font-family: var(--font-sans); }
.sp-ai-disclaimer { margin: 10px 0; padding: 8px 11px; background: #fdf6e3; border: 1px solid #ecd9a0;
  border-radius: 8px; font-size: 11.5px; color: #7a5d10; line-height: 1.45; }
.sp-descr { font-size: 13px; color: var(--text,#2b2823); line-height: 1.55; margin: 8px 0; }
.sp-grid { display: grid; grid-template-columns: 1fr; gap: 0; margin: 10px 0; }
.sp-riga2 { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px dashed #efece4; font-size: 12.5px; }
.sp-lbl { color: var(--text-2,#6b665d); flex: none; }
.sp-val { text-align: right; font-weight: 600; color: var(--text,#2b2823); }
.sp-val.sp-na, .sp-na { color: #b3ada2; font-weight: 500; font-style: italic; }
.sp-fonte { display: inline-block; font-size: 10px; font-weight: 600; color: #8a7e6a; background: #f4f1ea; padding: 1px 6px; border-radius: 5px; margin-left: 4px; }
.sp-nota { display: block; font-size: 11px; color: var(--text-2,#78716c); font-weight: 400; margin-top: 2px; }
.sp-warn-inline { color: #b3403a; font-weight: 700; }
.sp-sez { margin-top: 12px; }
.sp-sez-tit { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2,#6b665d); margin-bottom: 5px; }
.sp-ul { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.6; }
.sp-p { font-size: 12.5px; line-height: 1.6; margin: 0; color: var(--text,#2b2823); }
.sp-lettura { background: #f6f3ec; border-radius: 8px; padding: 10px 12px; }
.sp-attenzione .sp-ul { color: #8a2b25; }
.sp-verifica { background: #fbf7ef; border-radius: 8px; padding: 10px 12px; }
