/* =============================================================================
   TOKEN DI DESIGN
   I nomi restano quelli storici - --cream, --ink, --line - perche' sono usati
   in oltre millesettecento righe di questo foglio: rimappare i VALORI ri-veste
   l'intero sito in modo coerente, mentre rinominarli avrebbe richiesto di
   toccare ogni regola senza cambiare nulla di sostanziale.
   Palette slate/blu, scala di grigi fredda, come da riferimento.
   ============================================================================= */
:root {
  --bg: #0f172a;         /* slate-900 */
  --cream: #f1f5f9;      /* slate-100: fondali tenui, barre, nav */
  --cream-2: #e2e8f0;    /* slate-200 */
  --ink: #020617;        /* slate-950: testo primario e superfici scure */
  --ink-soft: #64748b;   /* slate-500: testo secondario */
  --line: #e2e8f0;       /* slate-200: bordi */
  --line-2: #f1f5f9;     /* slate-100: separatori interni */
  --white: #ffffff;
  --accent: #2563eb;     /* blue-600: azione e stato attivo */
  --accent-soft: #eff6ff;/* blue-50 */
  --pagina: #f8fafc;     /* slate-50: fondo pagina */
  --radius: 16px;

  /* Stati, condivisi da badge, grafici e barre di avanzamento. */
  --ok: #059669;         /* emerald-600 */
  --ok-soft: #ecfdf5;
  --attesa: #d97706;     /* amber-600 */
  --attesa-soft: #fffbeb;
  --erroneo: #dc2626;    /* red-600 */

  /* Ombre a due livelli: la carta a riposo e la carta sollevata. Una sola
     ombra usata ovunque tiene insieme la gerarchia meglio di tante diverse. */
  --ombra: 0 1px 3px 0 rgba(15, 23, 42, .05), 0 1px 2px -1px rgba(15, 23, 42, .05);
  --ombra-alta: 0 8px 24px -4px rgba(15, 23, 42, .08), 0 4px 8px -4px rgba(15, 23, 42, .04);

  /* Nomi ereditati da una palette precedente, ancora usati dalle tabelle.
     Definiti qui per farli seguire il resto invece di restare appesi a un
     valore di ripiego scritto in linea. */
  --border: #e2e8f0;
  --border-soft: #f1f5f9;
  --text-3: #94a3b8;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--pagina);
  color: #1e293b;   /* slate-800 */
  -webkit-font-smoothing: antialiased;
}
.tabular { font-variant-numeric: tabular-nums; }

.app { width: 100%; min-height: 100vh; }

/* Larghezza massima unica per header, contenuto e footer: e' cio' che tiene
   allineate le tre fasce su schermi larghi. */
.contenitore { max-width: 1720px; margin: 0 auto; padding: 0 32px; }

/* ---------------- NAV ----------------
   Barra fissa in alto con sfondo semitrasparente e sfocatura: il contenuto
   che scorre sotto resta percepibile senza disturbare la lettura. */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 40px;
  height: 64px; padding: 0 32px;
  max-width: 1720px; margin: 0 auto;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, .8);
}
/* <button> per accessibilita' (raggiungibile da tastiera, annunciato come
   comando): azzerati gli stili nativi del bottone. */
.brand {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  background: none; border: none; padding: 0; font: inherit; text-align: left;
}
.brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 12px; }
.brand-logo {
  width: 36px; height: 36px; border-radius: 12px; flex: none;
  background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--ombra); transition: background .15s;
}
.brand:hover .brand-logo { background: var(--accent); }
.brand-testo { display: flex; flex-direction: column; line-height: 1.15; }
.brand-mark { font-weight: 700; font-size: 16px; letter-spacing: -.3px; color: var(--ink); }
.brand-sub { font-size: 12px; color: var(--ink-soft); font-weight: 500; }

/* Voci di menu a pillola: l'attiva ha un fondo pieno invece del solo grassetto,
   cosi' resta riconoscibile anche in visione periferica. */
.nav-links {
  display: flex; gap: 6px; list-style: none;
  font-size: 14px; font-weight: 500; color: #475569;
}
.nav-links li {
  cursor: pointer; padding: 6px 14px; border-radius: 8px;
  transition: color .15s, background .15s; white-space: nowrap;
}
.nav-links li:hover { color: var(--ink); background: var(--pagina); }
.nav-links li.active { color: var(--ink); background: var(--cream); font-weight: 600; }
.nav-links li:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.nav-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.nav-user-sep { padding-left: 8px; border-left: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.bell { position: relative; background: none; border: none; font-size: 17px; cursor: pointer; }
.bell .dot {
  position: absolute; top: 0; right: -1px; width: 7px; height: 7px;
  background: var(--accent); border-radius: 50%; border: 1.5px solid var(--white);
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--cream);
}
.user-blocco { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; max-width: 160px; }
.user-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.user-name, .user-ruolo { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-ruolo { font-size: 12px; color: var(--ink-soft); }

/* Responsive header.
   Widths measured on the real bar (2026-10-16): brand 131 px, the seven links
   990 px, user block up to 303 px with the name capped at 160 px, padding
   64 px. Three layouts follow from those numbers:
     >= 1560 px  everything on one line;
     1280-1559   tighter links, the user shows as avatar only (full name on
                 hover): 1248 px needed;
     < 1280      a menu button opens a panel with links and user block.
   The panel is display: contents on wide screens, so its children sit in the
   bar as if the wrapper did not exist. */
.nav-pannello { display: contents; }
.nav-menu-btn { display: none; }

@media (max-width: 1559px) {
  .nav { gap: 24px; }
  .nav-links { gap: 4px; }
  .nav-links li { padding: 6px 8px; }
  .nav-user .user-blocco { display: none; }
}

@media (max-width: 1279px) {
  .nav-menu-btn {
    display: inline-flex; align-items: center; gap: 10px; margin-left: auto;
    min-height: 44px; padding: 0 14px; border-radius: 10px;
    font: inherit; font-size: 14px; font-weight: 600; color: var(--ink);
    background: var(--white); border: 1px solid var(--line); cursor: pointer;
  }
  .nav-menu-btn:hover, .nav.aperta .nav-menu-btn { background: var(--cream); }
  .nav-menu-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .nav-menu-icona { display: inline-flex; flex-direction: column; gap: 3px; }
  .nav-menu-icona span { display: block; width: 16px; height: 2px; border-radius: 1px; background: currentColor; }

  .nav-pannello {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 10px; padding: 10px 32px 16px;
    background: var(--white); border-bottom: 1px solid var(--line); box-shadow: var(--ombra-alta);
    max-height: calc(100vh - 64px); max-height: calc(100dvh - 64px); overflow-y: auto;
  }
  .nav.aperta .nav-pannello { display: flex; }
  .nav-links { flex-direction: column; gap: 2px; font-size: 15px; }
  .nav-links li { display: flex; align-items: center; min-height: 44px; padding: 0 14px; }
  .nav-links li:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  .nav-user { margin-left: 0; padding-top: 12px; border-top: 1px solid var(--line-2); }
  .nav-user-sep { width: 100%; padding-left: 0; border-left: none; }
  .nav-user .user-blocco { display: flex; flex: 1; max-width: none; }
}

@media (max-width: 700px) {
  .nav { padding: 0 16px; }
  .nav-pannello { padding: 8px 16px 16px; }
}

/* ---------------- FOOTER ---------------- */
.piede {
  margin-top: 64px; padding: 24px 0;
  background: var(--white); border-top: 1px solid var(--line);
  font-size: 12px; color: var(--ink-soft);
}
.piede-riga {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.piede strong { color: #334155; font-weight: 600; }
.piede-link { display: flex; gap: 24px; }
.piede a { color: inherit; text-decoration: none; transition: color .15s; }
.piede a:hover { color: var(--ink); }

/* ------- FRESCHEZZA ARCHIVIO ANAC (in cima all'hero Mercato nazionale) --- */
/* Titolo a sinistra, stato dell'archivio e pulsante di sincronizzazione in
   alto a destra sulla stessa riga del sopratitolo. Senza riquadro ne'
   sfondo: e' un'informazione di servizio, non un pannello. */
.search-head-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
}
.anac-fresh-hero {
  display: flex; align-items: center; gap: 9px;
  font-size: 12px; color: var(--ink-soft);
}
.anac-fresh-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: #2e7d32; /* ok */
}
.anac-fresh-dot.in-corso { background: #c9611c; animation: anac-fresh-pulse 1.4s ease-in-out infinite; }
.anac-fresh-dot.errore { background: #c0392b; }
@keyframes anac-fresh-pulse { 50% { opacity: .35; } }
/* Solo icona: quadrato, discreto, si accende al passaggio. */
.anac-sync-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  background: none; border: 1px solid var(--line); border-radius: 50%;
  color: var(--ink-soft); cursor: pointer; transition: border-color .15s, color .15s;
}
.anac-sync-btn:hover:not(:disabled) { border-color: var(--ink); color: var(--ink); }
.anac-sync-btn:disabled { opacity: .55; cursor: default; }
.anac-sync-freccia { font-size: 15px; line-height: 1; display: inline-block; }
.anac-sync-btn.gira .anac-sync-freccia { animation: anac-rotella 1.1s linear infinite; }
@keyframes anac-rotella { to { transform: rotate(360deg); } }

/* ---------------- TOP GRID ---------------- */
/* Testata delle viste di dettaglio: stessa carta bianca su fondo tenue del
   riepilogo in panoramica, cosi' le pagine appartengono visibilmente allo
   stesso sistema invece di sembrare schermate diverse. */
.top {
  display: grid;
  grid-template-columns: 1.05fr 1.15fr .95fr;
  gap: 32px;
  max-width: 1656px; margin: 32px auto 0;
  padding: 32px;
  background: var(--white);
  border: 1px solid rgba(226, 232, 240, .8);
  border-radius: 20px;
  box-shadow: var(--ombra);
}

/* HERO */
.hero { display: flex; flex-direction: column; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  font-size: 12px; font-weight: 600; color: #475569;
  background: var(--cream); border: 1px solid var(--line);
  padding: 4px 10px; border-radius: 999px;
}
.eyebrow::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); flex: none;
}
.hero-title {
  font-size: 34px; line-height: 1.1; font-weight: 800; letter-spacing: -1px;
  color: var(--ink); margin: 14px 0 24px; max-width: 18ch;
}
.hero-label {
  font-size: 12px; color: var(--ink-soft); font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
}
.hero-value {
  font-size: 48px; font-weight: 900; letter-spacing: -1.5px; line-height: 1;
  color: var(--ink); margin: 6px 0 18px; font-variant-numeric: tabular-nums;
}
.hero-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.badge {
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 6px; box-shadow: var(--ombra);
}
.hero-update {
  font-size: 12px; color: #475569; font-weight: 500;
  background: var(--cream); border: 1px solid var(--line);
  padding: 5px 12px; border-radius: 6px;
}
.hero-update strong { color: var(--ink); font-weight: 600; }

/* Colore del badge in base allo stato reale della gara. Gli stessi valori
   sono replicati in COLORE_STATO dentro app.js, per pallini e barre della
   distribuzione: il colore deve significare la stessa cosa ovunque. */
.st-programmata   { background: #f1f5f9; color: #475569; }   /* futura / pianificata */
.st-pubblicata    { background: #2563eb; color: #fff; }      /* bando aperto, offerte in corso */
.st-in_valutazione{ background: #d97706; color: #fff; }      /* offerte chiuse, in esame */
.st-aggiudicata   { background: #7c3aed; color: #fff; }      /* aggiudicata (provv./def.) */
.st-efficace      { background: #059669; color: #fff; }      /* AQ attivo / efficace */
.st-conclusa      { background: #64748b; color: #fff; }      /* terminata */
.st-sospesa       { background: #ea580c; color: #fff; }      /* sospesa */
.st-revocata,
.st-deserta,
.st-annullata     { background: #dc2626; color: #fff; }      /* esiti negativi */

/* PANEL (generic) */
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.panel-head h2, .col-head h2 { font-size: 22px; font-weight: 700; letter-spacing: -.5px; }
.panel-desc { font-size: 13px; color: var(--ink-soft); margin: 4px 0 18px; }
.chip {
  background: var(--white); border: 1px solid var(--line);
  font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 18px;
}
.chip-ghost { background: transparent; }

/* Colonna laterale del dettaglio gara: impila i suoi pannelli uno sotto
   l'altro indipendentemente dall'altezza dell'hero accanto - un figlio in
   piu' nella griglia a 2 colonne di .detail-hero finirebbe altrimenti su una
   riga implicita alta quanto l'hero, con un vuoto sopra pari alla differenza. */
.side-stack { display: flex; flex-direction: column; gap: 20px; }

.btn-cta {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 600;
  padding: 10px 18px; border-radius: 20px; text-decoration: none;
  transition: opacity .15s ease;
}
.btn-cta:hover { opacity: .82; }

.legend { display: flex; gap: 18px; margin: 14px 0 6px; font-size: 12px; color: var(--ink-soft); }
.legend span { display: flex; align-items: center; gap: 7px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw-solid { background: var(--ink); }
.sw-hatch {
  background: repeating-linear-gradient(45deg, #c9cabb, #c9cabb 2px, transparent 2px, transparent 5px);
  border: 1px solid #c9cabb;
}

/* CHART */
.chart {
  display: flex; align-items: flex-end; justify-content: space-around;
  gap: 10px; height: 220px; margin-top: 20px;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.bar-wrap { display: flex; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.bar {
  width: 30px; border-radius: 6px 6px 0 0;
  background: var(--ink);
  transition: height .6s cubic-bezier(.2,.8,.2,1);
  position: relative;
}
.bar.hatch {
  background: repeating-linear-gradient(45deg, #cccdbe, #cccdbe 3px, transparent 3px, transparent 7px);
  border: 1px solid #cccdbe;
}
.bar-val {
  position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.bar-label { font-size: 12px; color: var(--ink-soft); margin-top: 12px; text-align: center; font-weight: 500; }

/* SIDE PANEL: contact-style list */
.contact-list { display: flex; flex-direction: column; gap: 6px; }
.contact {
  display: flex; align-items: center; gap: 14px; padding: 12px 4px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.contact:last-child { border-bottom: none; }
.contact-badge {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.contact-badge.alt {
  background: repeating-linear-gradient(45deg, #d5d6c8, #d5d6c8 3px, transparent 3px, transparent 7px);
  color: var(--ink); border: 1px solid #d5d6c8;
}
.contact-info { flex: 1; min-width: 0; }
.contact-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-role { font-size: 12px; color: var(--ink-soft); }
.contact-value { font-size: 13px; font-weight: 700; white-space: nowrap; }

/* ---------------- BOTTOM GRID ---------------- */
.bottom {
  display: grid;
  grid-template-columns: 1fr 1fr 1.1fr;
  gap: 40px;
  max-width: 1720px; margin: 0 auto; padding: 32px;
}
.col-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.col-head h2 { font-size: 20px; font-weight: 800; letter-spacing: -.5px; color: var(--ink); }

/* DATE GRID (calendar cards) */
.date-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.date-card {
  background: #f4f4f1; border-radius: 18px; padding: 16px 14px; min-height: 118px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.date-card.dark { background: var(--ink); color: #fff; }
.date-day { font-size: 30px; font-weight: 700; letter-spacing: -1px; }
.date-tag { font-size: 12px; font-weight: 600; margin-top: 8px; }
.date-sub { font-size: 11px; opacity: .7; margin-top: 2px; }

/* SCHEDULE / DOCUMENTI */
.schedule { display: flex; flex-direction: column; }
.sched-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 0;
  border-bottom: 1px solid var(--line-2);
}
.sched-row:last-child { border-bottom: none; }
.sched-time {
  font-size: 12px; color: var(--ink-soft); width: 84px; flex-shrink: 0; font-weight: 500;
}
.sched-type {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  padding: 3px 8px; border-radius: 8px; background: #f0f0ec; color: var(--ink-soft);
  flex-shrink: 0;
}
.sched-title { font-size: 14px; font-weight: 500; text-align: right; margin-left: auto; }

/* EVENT CARD / AREE */
.event-card {
  border: 1px solid var(--line-2); border-radius: 22px; padding: 22px;
}
.aree-list { display: flex; flex-direction: column; gap: 12px; }
.aree-row { display: flex; align-items: center; gap: 12px; }
.aree-name { font-size: 13px; font-weight: 600; width: 46%; flex-shrink: 0; }
.aree-bar-track { flex: 1; height: 9px; background: #f0f0ec; border-radius: 6px; overflow: hidden; }
.aree-bar-fill { height: 100%; background: var(--ink); border-radius: 6px; transition: width .6s; }
.aree-count { font-size: 12px; font-weight: 700; width: 22px; text-align: right; }

.loading { color: var(--ink-soft); font-size: 13px; padding: 20px 0; }
.pad { max-width: 1720px; margin: 0 auto; padding: 48px 32px; }

/* ---------------- MINI KPI ---------------- */
.mini-kpi { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 12px; flex: 1; }
.kpi {
  background: var(--white); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; box-shadow: var(--ombra);
  display: flex; flex-direction: column; justify-content: space-between;
  transition: border-color .15s;
}
.kpi:hover { border-color: #cbd5e1; }
.kpi-lab {
  font-size: 12px; color: var(--ink-soft); font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
}
.kpi-val {
  font-size: 30px; font-weight: 800; letter-spacing: -.8px; color: var(--ink);
  margin-top: 12px; font-variant-numeric: tabular-nums;
}
.kpi-val.kpi-val-sm { font-size: 22px; font-weight: 900; }
.kpi-nota { font-size: 11px; color: #94a3b8; margin-top: 2px; }
/* Variante per la metrica che conta piu' delle altre. */
.kpi-rilievo { position: relative; overflow: hidden; }
.kpi-rilievo::after {
  content: ''; position: absolute; top: -16px; right: -16px;
  width: 64px; height: 64px; background: var(--ok-soft);
  border-bottom-left-radius: 999px; pointer-events: none;
}
.kpi-rilievo .kpi-lab { color: #047857; }
.kpi-rilievo .kpi-val { color: #022c22; }
.kpi-rilievo .kpi-nota { color: var(--ok); font-weight: 500; }

/* ---------------- BACK link ---------------- */
.back {
  display: inline-block; font-size: 13px; font-weight: 600; color: var(--ink-soft);
  text-decoration: none; margin-bottom: 18px;
}
.back:hover { color: var(--ink); }

/* ---------------- OVERVIEW: gara cards ----------------
   In panoramica le tre colonne stanno dentro una carta sola, invece che su
   una fascia colorata a tutta larghezza: raggruppa cio' che si legge insieme
   e separa nettamente il riepilogo dall'elenco delle gare sotto. */
.top-overview {
  grid-template-columns: 1fr 1fr 1fr;
  gap: 36px;
  background: var(--white);
  border: 1px solid rgba(226, 232, 240, .8);
  border-radius: 20px;
  box-shadow: var(--ombra);
  padding: 32px;
  margin: 32px auto 0;
  max-width: 1656px;   /* 1720 meno i margini laterali del contenitore */
  transition: box-shadow .2s;
}
.top-overview:hover { box-shadow: var(--ombra-alta); }
.bottom-cards { display: block; max-width: 1720px; margin: 0 auto; padding: 40px 32px 16px; }
.cards-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.cards-head h2 { font-size: 24px; font-weight: 800; letter-spacing: -.6px; color: var(--ink); }
.cards-sub { font-size: 14px; color: var(--ink-soft); margin: 0 0 20px; }

/* Colonna centrale: distribuzione per stato con barre proporzionali. */
.riquadro {
  background: rgba(248, 250, 252, .7);
  border: 1px solid rgba(226, 232, 240, .6);
  border-radius: 12px; padding: 24px;
  display: flex; flex-direction: column;
}
.riquadro-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.riquadro-head h2 { font-size: 16px; font-weight: 700; color: var(--ink); }
.riquadro-nota { font-size: 12px; color: #94a3b8; font-weight: 500; }
.riquadro-piede {
  margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(226, 232, 240, .6);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--ink-soft);
}
.riquadro-piede strong { color: #334155; font-weight: 600; }

.stato-lista { display: flex; flex-direction: column; gap: 20px; margin-top: 24px; }
.stato-riga-top {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 600; margin-bottom: 8px;
}
.stato-nome { display: flex; align-items: center; gap: 8px; color: #1e293b; font-weight: 500; }
.stato-pallino { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.stato-valori { display: flex; align-items: center; gap: 8px; }
.stato-importo { font-weight: 700; color: var(--ink); font-size: 14px; }
.stato-pct { color: var(--ink-soft); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; }
.stato-track { width: 100%; height: 10px; background: rgba(226, 232, 240, .8); border-radius: 999px; overflow: hidden; }
.stato-fill { height: 100%; border-radius: 999px; transition: width .7s ease-out; }

/* min(..., 100%): on screens narrower than the minimum card width the card
   takes the full width instead of overflowing it. */
.gara-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 20px; }

/* Filtro stazione appaltante (chips sopra la griglia gare) */
.ente-filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -8px 0 20px; }
.ente-filter-label {
  font-size: 11px; font-weight: 600; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: .4px; margin-right: 4px;
}
.ente-chip { cursor: pointer; transition: border-color .15s, background .15s; }
.ente-chip:hover { border-color: var(--ink-soft); }
.ente-chip.active { background: var(--ink); color: var(--white); border-color: var(--ink); }
.ente-chip-n { opacity: .55; font-weight: 700; margin-left: 2px; }

/* Carta gara: corpo e piede separati, il piede fa da invito all'azione e
   reagisce al passaggio sull'intera carta. */
.gara-card {
  border: 1px solid rgba(226, 232, 240, .9); border-radius: 12px;
  background: var(--white); box-shadow: var(--ombra);
  cursor: pointer; transition: box-shadow .2s, border-color .2s;
  display: flex; flex-direction: column; overflow: hidden;
}
.gara-card:hover { box-shadow: var(--ombra-alta); border-color: #93c5fd; }
.gara-card-corpo { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.gara-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.gara-code {
  font-size: 11px; font-weight: 600; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: .04em;
}
.badge-sm { font-size: 11px; padding: 3px 10px; border-radius: 999px; font-weight: 700; }
.gara-card-title {
  font-size: 14px; font-weight: 700; line-height: 1.35; letter-spacing: -.2px;
  color: var(--ink); margin-bottom: 12px; transition: color .15s;
}
.gara-card:hover .gara-card-title { color: var(--accent); }
.gara-card-obj {
  font-size: 12px; color: #475569; line-height: 1.6; margin-bottom: 16px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
/* Dati chiave appaiati: etichetta piccola sopra, valore in evidenza sotto. */
.gara-card-dati {
  margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line-2);
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 11px;
}
.gara-card-dati dt { color: #94a3b8; display: block; }
.gara-card-dati dd { font-weight: 700; color: #1e293b; margin: 0; }
.gara-card-piede {
  padding: 10px 20px; background: var(--pagina); border-top: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 600; color: #475569; transition: color .15s;
}
.gara-card:hover .gara-card-piede { color: var(--accent); }
.gara-card-piede .freccia { transition: transform .15s; }
.gara-card:hover .gara-card-piede .freccia { transform: translateX(4px); }

/* ---------------- DETAIL body ---------------- */
.detail-body { max-width: 1720px; margin: 0 auto; padding: 32px; }
.oggetto-box {
  background: #f6f6f2; border-radius: 18px; padding: 22px 26px; margin-bottom: 40px;
}
.oggetto-box h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-soft); margin-bottom: 8px; }
.oggetto-box p { font-size: 14px; line-height: 1.6; max-width: 100ch; }

.doc-scroll { max-height: 360px; overflow-y: auto; }

/* Capitolati */
.cap-list { display: flex; flex-direction: column; gap: 12px; }
.cap-item { border: 1px solid var(--line-2); border-radius: 14px; padding: 14px 16px; }
.cap-title { font-size: 14px; font-weight: 700; }
.cap-obj { font-size: 12px; color: var(--ink-soft); line-height: 1.5; margin-top: 5px; }
.cap-meta { font-size: 11px; color: var(--ink-soft); margin-top: 5px; }

/* Ripartizione lotto (espansione) */
.lotto-row { cursor: pointer; }
.lotto-detail { padding: 0 4px; }
.rip-wrap { background: #f6f6f2; border-radius: 14px; padding: 14px 16px; margin: 4px 0 12px; }
.rip-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; margin-bottom: 10px; color: var(--ink-soft); }
.rip-scenario { display: flex; align-items: center; gap: 12px; padding: 5px 0; }
.rip-scen-label { font-size: 12px; font-weight: 600; width: 110px; flex-shrink: 0; }
.rip-bars { display: flex; gap: 8px; flex-wrap: wrap; }
.rip-pos {
  font-size: 11px; background: var(--white); border: 1px solid var(--line);
  padding: 3px 9px; border-radius: 12px; font-weight: 500;
}
.rip-pos b { font-weight: 700; }

/* ============================================================================
   TIMELINE GARE (Gantt panoramica)
   ============================================================================ */
.timeline-sec { padding-top: 8px; }
.tl-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.tl-chips b { font-weight: 800; }

.tl-axis, .tl-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: center;
}
.tl-axis { margin-bottom: 6px; }
.tl-axis .tl-cell-bar { position: relative; height: 30px; }
.tl-tick {
  position: absolute; top: 12px; transform: translateX(-50%);
  font-size: 10px; font-weight: 600; color: var(--ink-soft);
}
.tl-today-label {
  position: absolute; top: 0; transform: translateX(-50%);
  font-size: 10px; font-weight: 800; color: #e5533c; white-space: nowrap;
  letter-spacing: .3px;
}

.tl-rows { display: flex; flex-direction: column; }
.tl-row {
  padding: 13px 0; border-top: 1px solid var(--line-2); cursor: pointer;
  transition: background .15s;
}
.tl-row:hover { background: #faf9f5; }
.tl-code { font-size: 13px; font-weight: 700; }
.tl-stato {
  display: inline-block; margin-top: 4px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px; padding: 3px 8px; border-radius: 9px;
  background: #f0f0ec; color: var(--ink-soft);
}
.tl-stato-offerte { background: var(--ink); color: #fff; }
.tl-stato-valutazione { background: #e7e3d5; color: #6b6250; }
.tl-stato-esecuzione { background: #e2f2e8; color: #1f7a4d; }
.tl-stato-conclusa { background: #ececec; color: #7a7a7a; }

.tl-cell-bar { position: relative; height: 22px; }
.tl-row .tl-cell-bar { background: #f7f7f3; border-radius: 8px; overflow: hidden; }
.tl-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: #e4e4dc; }
.tl-seg { position: absolute; top: 3px; bottom: 3px; border-radius: 5px; }
.seg-offerte { background: var(--ink); }
.seg-valut {
  background: repeating-linear-gradient(45deg, #cfd0c1, #cfd0c1 3px, #e9eae0 3px, #e9eae0 7px);
}
.seg-esec { background: #2f8f5b; }
.seg-esec.seg-stimato { background: repeating-linear-gradient(45deg, #2f8f5b, #2f8f5b 6px, #7cc29d 6px, #7cc29d 10px); }
.seg-stima {
  background: transparent; border: 1.5px dashed #b9bbaa; border-radius: 5px;
}
.seg-stima.seg-user {
  border-color: #2f8f5b; background: rgba(47, 143, 91, .13);
}
.tl-today {
  position: absolute; top: -3px; bottom: -3px; width: 2px; background: #e5533c;
  border-radius: 2px; z-index: 2;
}
.tl-cell-note { font-size: 12.5px; color: var(--ink-soft); line-height: 1.45; }
.tl-cell-note b { color: var(--ink); }

.tl-legend {
  display: flex; gap: 20px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--line-2); font-size: 11.5px; color: var(--ink-soft);
}
.tl-legend span { display: flex; align-items: center; gap: 7px; }
.tls { width: 18px; height: 9px; border-radius: 3px; display: inline-block; }
.tls-offerte { background: var(--ink); }
.tls-valut { background: repeating-linear-gradient(45deg, #cfd0c1, #cfd0c1 3px, #e9eae0 3px, #e9eae0 7px); }
.tls-esec { background: #2f8f5b; }
.tls-stima { background: transparent; border: 1.5px dashed #b9bbaa; }
.tls-user { background: rgba(47,143,91,.13); border: 1.5px dashed #2f8f5b; }
.tls-today { width: 3px; height: 14px; background: #e5533c; border-radius: 2px; }

/* controllo "avvio stimato" nelle righe timeline */
.tl-stima-ctrl {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 7px;
}
.tl-stima-ctrl label {
  display: flex; align-items: center; gap: 7px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px;
  color: var(--ink-soft);
}
.tl-stima-ctrl input[type=month] {
  font-family: inherit; font-size: 12px; font-weight: 600; color: var(--ink);
  border: 1px solid var(--line); border-radius: 9px; padding: 4px 8px;
  background: var(--white); cursor: pointer;
}
.tl-stima-ctrl input[type=month]:focus { outline: none; border-color: #2f8f5b; }
.tl-stima-clear {
  width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--white); cursor: pointer; font-size: 13px; line-height: 1;
  color: var(--ink-soft); display: flex; align-items: center; justify-content: center;
}
.tl-stima-clear:hover { border-color: #e5533c; color: #e5533c; }

@media (max-width: 900px) {
  .tl-axis, .tl-row { grid-template-columns: 120px minmax(0,1fr); }
  .tl-cell-note { grid-column: 2; }
  .tl-axis .tl-cell-note { display: none; }
}

/* ============================================================================
   VIEW 3 — RETE PARTECIPANTI
   ============================================================================ */
.rete-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 30px;
  padding: 34px 46px 26px; background: var(--cream);
}
.rete-title { font-size: 30px; font-weight: 700; letter-spacing: -1px; margin: 10px 0 12px; }
.rete-sub { font-size: 14px; color: var(--ink-soft); line-height: 1.6; max-width: 70ch; }
.rete-sub b { color: var(--ink); font-weight: 600; }
.rete-stats { display: flex; gap: 12px; flex-shrink: 0; }
.rete-stats .kpi { text-align: center; min-width: 92px; }

.rete-body {
  display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 30px;
  padding: 30px 46px 50px; background: var(--white); align-items: start;
}

.graph-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.graph-toolbar label { font-size: 12px; color: var(--ink-soft); display: flex; align-items: center; gap: 10px; font-weight: 500; }
.graph-toolbar input[type=range] { accent-color: var(--ink); }
.btn-reset {
  font-size: 12px; font-weight: 600; padding: 7px 14px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--white); cursor: pointer;
}
.btn-reset:hover { background: #f4f4f1; }

.graph-wrap {
  position: relative; border: 1px solid var(--line-2); border-radius: 22px;
  background: #fbfbf9; overflow: hidden;
}
#graph { width: 100%; height: auto; display: block; }

.edge { stroke: #c7c8bb; stroke-opacity: .45; transition: stroke-opacity .2s, stroke .2s; }
.edge-on { stroke: #16160f; stroke-opacity: .85; }
.edge-off { stroke-opacity: .06; }

.node { cursor: pointer; stroke: #fff; stroke-width: 1.5; transition: opacity .2s; }
.node-capo { fill: #16160f; }
.node-membro { fill: #b9bbaa; }
.node.sel { stroke: #e5533c; stroke-width: 3; }
.node.hl { fill: #16160f; stroke: #e5533c; stroke-width: 2.5; }
.node.dim { opacity: .16; }

.graph-legend {
  position: absolute; left: 16px; bottom: 14px; display: flex; gap: 16px; flex-wrap: wrap;
  font-size: 11px; color: var(--ink-soft); background: rgba(251,251,249,.85);
  padding: 6px 10px; border-radius: 12px;
}
.graph-legend span { display: flex; align-items: center; gap: 6px; }
.gl { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.gl-capo { background: #16160f; }
.gl-membro { background: #b9bbaa; }
.gl-note { font-style: italic; }

.node-info {
  position: absolute; right: 16px; top: 16px; width: 230px;
  background: var(--white); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.10);
}
.ni-name { font-size: 14px; font-weight: 700; line-height: 1.3; margin-bottom: 8px; }
.ni-row { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
.ni-row b { color: var(--ink); }

/* colonna RTI */
.rti-col .col-head { margin-bottom: 18px; }
.rti-list { display: flex; flex-direction: column; gap: 12px; max-height: 760px; overflow-y: auto; padding-right: 4px; }
.rti-item {
  border: 1px solid var(--line-2); border-radius: 16px; padding: 16px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.rti-item:hover { border-color: #cfcfcf; }
.rti-item.active { border-color: #16160f; background: #faf9f5; box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.rti-item-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.rti-tag {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  background: #16160f; color: #fff; padding: 4px 9px; border-radius: 10px;
}
.rti-tag.solo { background: #b9bbaa; color: #16160f; }
.rti-lotti { font-size: 11px; color: var(--ink-soft); font-weight: 600; }
.rti-capo { font-size: 14px; font-weight: 700; line-height: 1.3; }
.rti-count { font-size: 12px; color: var(--ink-soft); margin: 3px 0 10px; }
.rti-members { display: flex; flex-wrap: wrap; gap: 6px; }
.member {
  font-size: 11px; padding: 3px 8px; border-radius: 10px; max-width: 190px;
  background: #f0f0ec; color: var(--ink-soft); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}
.member.lead { background: #16160f; color: #fff; font-weight: 600; }
.member.cons { background: #e7e3d5; color: #6b6250; }

/* ============================================================================
   VIEW 4 — RICERCA AZIENDE
   ============================================================================ */
/* Testata delle viste di ricerca: carta bianca come il riepilogo della
   panoramica, non piu' una fascia colorata a tutta larghezza. */
.search-head {
  max-width: 1656px; margin: 32px auto 0; padding: 32px;
  background: var(--white); border: 1px solid rgba(226, 232, 240, .8);
  border-radius: 20px; box-shadow: var(--ombra);
}
.search-box {
  margin-top: 24px; max-width: 620px; display: flex; align-items: center; gap: 12px;
  background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 14px 18px;
}
.search-box:focus-within { border-color: var(--ink); }
.search-ico { font-size: 16px; opacity: .6; }
.search-box input { flex: 1; border: none; outline: none; font-size: 16px; font-family: inherit; background: transparent; color: var(--ink); }

.search-results { max-width: 1720px; margin: 0 auto; padding: 32px; }
.az-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.az-card {
  border: 1px solid var(--line-2); border-radius: 18px; padding: 20px; cursor: pointer;
  transition: transform .15s, box-shadow .15s, border-color .15s; background: var(--white);
  display: flex; flex-direction: column;
}
.az-card:hover { transform: translateY(-3px); border-color: #cfcfcf; box-shadow: 0 14px 34px rgba(0,0,0,.09); }
.az-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.az-avatar {
  width: 40px; height: 40px; border-radius: 12px; background: #b9bbaa; color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px;
}
.az-avatar.capo { background: var(--ink); }
.az-flag { font-size: 11px; font-weight: 700; color: var(--ink); }
.az-card-name { font-size: 15px; font-weight: 700; line-height: 1.3; margin-bottom: 5px; min-height: 40px; }
.az-card-piva { font-size: 12px; color: var(--ink-soft); margin-bottom: 16px; }
.az-card-foot {
  display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--ink-soft);
  border-top: 1px solid var(--line-2); padding-top: 12px; margin-top: auto;
}
.az-card-foot b { color: var(--ink); }
.az-card-foot .go { margin-left: auto; font-weight: 700; color: var(--ink); }
/* Operatore del solo archivio nazionale: stessa scheda, peso visivo minore -
   non e' un'azienda censita, ha meno dati dietro. */
.az-card-anac { background: var(--cream); border-color: var(--line); }
.az-card-anac .az-avatar { background: #cfd1c2; color: var(--ink); }
.az-flag-anac {
  font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-soft);
}

/* ============================================================================
   VIEW 5 — DETTAGLIO STRATEGICO AZIENDA
   ============================================================================ */
.az-name { font-size: 28px; max-width: 20ch; }
.ruoli-list { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.ruolo-row { display: flex; align-items: center; gap: 10px; }
.ruolo-info { font-size: 12px; color: var(--ink-soft); }

.az-cols { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); gap: 34px; align-items: start; }

.gara-block { border: 1px solid var(--line-2); border-radius: 18px; overflow: hidden; margin-bottom: 20px; }
.gara-block-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 20px; background: #f6f6f2; cursor: pointer;
}
.gara-block-head:hover { background: #efefe9; }
.gara-block-code { font-size: 11px; font-weight: 700; color: var(--ink-soft); letter-spacing: .3px; }
.gara-block-name { font-size: 15px; font-weight: 700; line-height: 1.3; margin-top: 8px; }
.gara-block-tot { font-size: 20px; font-weight: 700; text-align: right; white-space: nowrap; }
.gara-block-tot span { display: block; font-size: 10px; font-weight: 500; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .3px; }

.lotti-table { width: 100%; border-collapse: collapse; }
.lotti-table th {
  text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--ink-soft); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line-2);
}
.lotti-table td { font-size: 13px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.lotti-table tr:last-child td { border-bottom: none; }
.ta-r { text-align: right; }
.ta-muted { color: var(--ink-soft); font-size: 12px; }
.ta-win { font-size: 11px; color: #1f7a4d; font-weight: 600; }

.pill {
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 12px;
  background: #f0f0ec; color: var(--ink-soft); white-space: nowrap;
}
.pill-win { background: #e2f2e8; color: #1f7a4d; }
.pill-lost { background: #f6e3e3; color: #a23b3b; }
.pill-obbl { background: var(--ink); color: #fff; }

/* ---------------- Winners (gara detail) ----------------
   One block per lot, one card per winning group: ranking on the left,
   composition in the middle, share on the right. The share is what gets
   compared across cards, so it always sits in the same column. */
.agg2 { display: flex; flex-direction: column; gap: 40px; }
.agg2-lotto-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.agg2-lotto-info { min-width: 0; }
.agg2-lotto-nome { font-size: 16px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.agg2-lotto-meta { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.agg2-quote-nota { font-size: 13px; color: var(--ink-soft); line-height: 1.55; margin: 0 0 16px; max-width: 100ch; }
.agg2-quote-nota b { color: var(--ink); font-weight: 600; }
.agg2-lista { display: flex; flex-direction: column; gap: 12px; }

.agg2-rti {
  display: grid; grid-template-columns: 72px minmax(0, 1fr) 160px; gap: 20px;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
  background: var(--white); scroll-margin-top: 88px;
  transition: border-color .15s, box-shadow .15s;
}
/* The group reached through a link: border and halo in the action colour,
   the same as the active state elsewhere in the site. */
.agg2-rti.agg2-focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.agg2-pos { display: flex; flex-direction: column; gap: 2px; }
.agg2-pos b { font-size: 24px; font-weight: 800; color: var(--ink); letter-spacing: -.5px; line-height: 1; }
.agg2-pos span { font-size: 11px; color: var(--ink-soft); }

.agg2-nome { font-size: 15px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.agg2-sub { font-size: 12px; color: var(--ink-soft); margin: 3px 0 12px; }

.agg2-membri {
  list-style: none; display: grid; gap: 6px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.agg2-membro {
  display: flex; flex-direction: column; gap: 1px; height: 100%;
  padding: 7px 10px; border-radius: 10px; background: var(--cream);
  border-left: 2px solid transparent; text-decoration: none; color: inherit;
  transition: background .12s;
}
.agg2-membro:hover { background: var(--cream-2); }
.agg2-membro:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.agg2-membro.lead { border-left-color: var(--ink); }
.agg2-membro-nome { font-size: 13px; color: var(--ink); line-height: 1.3; overflow-wrap: anywhere; }
.agg2-membro.lead .agg2-membro-nome { font-weight: 600; }
.agg2-membro-ruolo { font-size: 11px; color: var(--ink-soft); }

.agg2-quota { text-align: right; }
.agg2-pct { font-size: 28px; font-weight: 800; color: var(--ink); letter-spacing: -.5px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.agg2-imp { font-size: 15px; font-weight: 700; color: var(--ink); margin-top: 12px; font-variant-numeric: tabular-nums; }
.agg2-lab { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
.agg2-assente { font-size: 13px; color: var(--ink-soft); margin: 0 0 16px; }

/* Narrow: ranking and share move to one row above the composition, which
   takes the full card width. */
@media (max-width: 700px) {
  .agg2-rti { grid-template-columns: minmax(0, 1fr) auto; gap: 12px 16px; padding: 16px; }
  .agg2-pos { flex-direction: row; align-items: baseline; gap: 6px; }
  .agg2-corpo { grid-column: 1 / -1; grid-row: 2; }
  .agg2-quota { grid-column: 2; grid-row: 1; }
  .agg2-membri { grid-template-columns: 1fr; }
}

/* Pills linking to a winning group. */
a.pill { text-decoration: none; display: inline-block; }
a.pill:hover { filter: brightness(.96); }
a.pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pill-link { background: var(--accent-soft); color: var(--accent); }
.part-esito { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 10px; }
.conc-lotti { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; }
.conc-lotti a { font-size: 11px; font-weight: 600; color: var(--accent); text-decoration: none; }
.conc-lotti a:hover { text-decoration: underline; }

/* ---------------- Distribuzione aggiudicazione ---------------- */
.agg-list { margin-bottom: 44px; }
.agg-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) 170px;
  gap: 20px; align-items: center;
  padding: 13px 0; border-bottom: 1px solid var(--line-2); cursor: pointer;
  transition: background .15s;
}
.agg-row:hover { background: #faf9f5; }
.agg-row:last-child { border-bottom: none; }
.agg-name { font-size: 14px; line-height: 1.35; min-width: 0; }
.agg-bar { height: 12px; background: #f0f0ec; border-radius: 7px; overflow: hidden; }
.agg-fill { display: block; height: 100%; background: var(--ink); border-radius: 7px; transition: width .5s; }
.agg-val { text-align: right; font-size: 15px; white-space: nowrap; }
.agg-desc { display: none; grid-column: 1 / -1; padding-bottom: 4px; }
.agg-desc .pill { margin: 2px 4px 2px 0; }
.agg-row.open .agg-desc { display: block; }

/* ---------------- Approfondimenti (tab) ---------------- */
.tabs {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px;
  border-bottom: 1px solid var(--line-2); padding-bottom: 14px;
}
.tab {
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink-soft);
  background: transparent; border: 1px solid var(--line-2); border-radius: 20px;
  padding: 8px 16px; cursor: pointer; display: flex; align-items: center; gap: 8px;
  transition: all .15s;
}
.tab:hover { border-color: #cfcfcf; color: var(--ink); }
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab-n {
  font-size: 10.5px; font-weight: 800; background: #f0f0ec; color: var(--ink-soft);
  padding: 1px 7px; border-radius: 9px;
}
.tab.active .tab-n { background: rgba(255,255,255,.18); color: #fff; }

.appr-group { margin-bottom: 26px; }
.appr-group-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  font-size: 14px; font-weight: 800; padding-bottom: 10px; margin-bottom: 4px;
  border-bottom: 1px solid var(--line-2);
}
.appr-subhead {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  color: var(--ink-soft); margin: 14px 0 4px;
}
.appr-row {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px solid var(--line-2);
}
.appr-row:last-child { border-bottom: none; }
.appr-exp { cursor: pointer; }
.appr-name { font-size: 13.5px; font-weight: 500; flex: 1; min-width: 240px; line-height: 1.45; }
.appr-desc {
  flex-basis: 100%; font-size: 12.5px; color: var(--ink-soft); line-height: 1.55;
  max-width: 120ch; display: none; margin-top: 2px;
}
.appr-row.open .appr-desc { display: block; }
.appr-scroll { max-height: 560px; overflow-y: auto; padding-right: 6px; }
.prezzo-sub { font-size: 11px; color: var(--ink-soft); font-weight: 400; margin-top: 2px; }

/* ---------------- Cronologia eventi ---------------- */
.evt-list { position: relative; padding-left: 4px; }
.evt-row {
  display: grid; grid-template-columns: 92px 20px minmax(0, 1fr);
  gap: 10px; align-items: start; padding: 11px 0;
  border-bottom: 1px solid var(--line-2);
}
.evt-row:last-child { border-bottom: none; }
.evt-date { font-size: 12px; font-weight: 600; color: var(--ink-soft); padding-top: 2px; }
.evt-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--ink);
  margin-top: 5px; justify-self: center;
}
.evt-dot-mod { background: #fff; border: 2.5px solid #e5533c; }
.evt-body { font-size: 13px; line-height: 1.5; }
.evt-body .sched-type { margin-right: 6px; }
.evt-desc { font-weight: 500; }

/* ---------------- Requisiti capitolato (capitolato_voce) ---------------- */
.voci-caps { display: flex; flex-direction: column; gap: 14px; }
.voci-cap {
  border: 1px solid var(--line-2); border-radius: 18px; overflow: hidden; background: var(--white);
}
.voci-cap summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 22px; cursor: pointer; background: #f6f6f2; list-style: none;
}
.voci-cap summary::-webkit-details-marker { display: none; }
.voci-cap summary::before {
  content: '▸'; font-size: 13px; color: var(--ink-soft); margin-right: 4px;
  transition: transform .15s; display: inline-block;
}
.voci-cap[open] summary::before { transform: rotate(90deg); }
.voci-cap summary:hover { background: #efefe9; }
.voci-cap-title { font-size: 15px; font-weight: 700; flex: 1; }

.voci-list { padding: 6px 22px 14px; }
.voce {
  padding: 11px 0 11px calc(var(--ind, 0) * 26px);
  border-bottom: 1px solid var(--line-2); cursor: pointer;
}
.voce:last-child { border-bottom: none; }
.voce-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.voce-code {
  font-size: 11px; font-weight: 800; color: var(--ink-soft); letter-spacing: .3px;
  background: #f0f0ec; padding: 2px 8px; border-radius: 8px; flex-shrink: 0;
}
.voce-area .voce-code { background: var(--ink); color: #fff; }
.voce-title { font-size: 13.5px; font-weight: 600; }
.voce-area .voce-title { font-size: 14.5px; font-weight: 800; }
.voce-serv {
  font-size: 11px; color: #6b6250; background: #e7e3d5; padding: 3px 9px;
  border-radius: 10px; max-width: 300px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.voce-pag { font-size: 11px; color: var(--ink-soft); margin-left: auto; flex-shrink: 0; font-weight: 600; }
.voce-desc {
  font-size: 12.5px; color: var(--ink-soft); line-height: 1.55; margin-top: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  max-width: 120ch;
}
.voce.open .voce-desc { -webkit-line-clamp: unset; }

.partner-list { display: flex; flex-direction: column; gap: 8px; max-height: 640px; overflow-y: auto; padding-right: 4px; }
.partner-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 14px; border: 1px solid var(--line-2); border-radius: 12px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.partner-row:hover { border-color: #cfcfcf; background: #faf9f5; }
.partner-name { font-size: 13px; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; }
.partner-meta { display: flex; gap: 10px; font-size: 12px; color: var(--ink-soft); flex-shrink: 0; }

/* ---------------- DETTAGLIO GARA — master-detail con sidebar ---------------- */
.detail-hero { grid-template-columns: 1.6fr 1fr; }
.detail-hero .hero-title { max-width: 34ch; font-size: 30px; }
.mini-kpi-3 { grid-template-columns: 1fr 1fr 1fr; }

.detail-master {
  display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 44px;
  padding: 36px 46px 70px; background: var(--white); align-items: start;
}
.dm-nav {
  position: sticky; top: 24px;
  display: flex; flex-direction: column; gap: 2px;
  border-left: 1px solid var(--line-2); padding-left: 0;
}
.dm-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font: inherit; font-size: 13px; font-weight: 500; color: var(--ink-soft);
  padding: 11px 14px; border: none; background: transparent;
  border-left: 2px solid transparent; margin-left: -1px;
  border-radius: 0 12px 12px 0; cursor: pointer; text-align: left;
  transition: background .12s, color .12s;
}
.dm-item:hover { background: #f4f4f1; color: var(--ink); }
.dm-item.active { background: var(--cream); color: var(--ink); font-weight: 700; border-left-color: var(--ink); }
.dm-n {
  font-size: 11px; font-weight: 600; color: var(--ink-soft);
  background: var(--line-2); border-radius: 999px; padding: 2px 8px;
  min-width: 26px; text-align: center; flex-shrink: 0;
}
.dm-item.active .dm-n { background: var(--ink); color: #fff; }
.dm-content { min-width: 0; }
.dm-content .col-head { margin-bottom: 14px; }
.dm-content .sec-note { margin-bottom: 22px; }
.dm-content .oggetto-box { margin-bottom: 0; }

/* sezione Partecipanti (dettaglio gara) */
.part-kpis { padding: 0; margin: 0 0 22px; grid-template-columns: repeat(3, 1fr); max-width: 640px; }
.part-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 14px; }
.part-item { border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.part-item .rti-capo { cursor: pointer; }
.part-item .rti-capo:hover { text-decoration: underline; }
.part-item .member { cursor: pointer; }
.part-item .member[data-az-link]:hover { filter: brightness(0.95); }

/* ---------------- ANALISI PARTECIPANTI (pagina strategica) ---------------- */
.rete-filter { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; min-width: 280px; }
.rete-filter label { font-size: 11px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .4px; }
.rete-filter select {
  font: inherit; font-size: 13px; font-weight: 500; color: var(--ink);
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--white); cursor: pointer; max-width: 360px;
}

.strat-kpis {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px;
  padding: 30px 46px 0; margin: 0 0 44px;
}
.strat-kpis .kpi { text-align: left; }
.kpi-sub { font-size: 11px; color: var(--ink-soft); margin-top: 4px; }
.kpi-frac { font-size: 14px; font-weight: 600; color: var(--ink-soft); }

.analisi-sec { padding: 0 46px; margin-bottom: 48px; }
.analisi-sec .cards-head { margin-bottom: 8px; }
.analisi-sec .rete-body { padding: 0; }
.analisi-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 40px; padding: 0 46px; margin-bottom: 48px; }
.analisi-grid .analisi-sec { padding: 0; margin-bottom: 0; }
.sec-note { font-size: 13px; color: var(--ink-soft); line-height: 1.55; margin-bottom: 18px; max-width: 100ch; }
.sec-note b { color: var(--ink); font-weight: 600; }

/* leaderboard */
.lb-wrap { border: 1px solid var(--line-2); border-radius: 16px; overflow: hidden; }
.lb-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.lb-table th.sortable:hover { color: var(--ink); }
.lb-table th.sortable::after { content: attr(data-dir); margin-left: 4px; font-size: 9px; }
.lb-table th.sorted { color: var(--ink); font-weight: 700; }
.lb-row { cursor: pointer; transition: background .12s; }
.lb-row:hover { background: #faf9f5; }
.wr-track {
  display: inline-block; vertical-align: middle; width: 56px; height: 6px;
  background: var(--line-2); border-radius: 3px; overflow: hidden; margin-right: 8px;
}
.wr-fill { display: block; height: 100%; background: #1f7a4d; border-radius: 3px; }
.wr-val { font-size: 12px; font-weight: 600; }
.lb-vinto { white-space: nowrap; }
.lb-vinto-bar {
  display: inline-block; vertical-align: middle; height: 6px; border-radius: 3px;
  background: var(--ink); opacity: .18; margin-right: 8px;
}
.lb-more {
  display: block; width: 100%; border: none; border-top: 1px solid var(--line-2);
  border-radius: 0; padding: 12px; background: #fbfbf9;
}

/* concentrazione */
.conc-list { display: flex; flex-direction: column; gap: 4px; }
.conc-row {
  display: grid; grid-template-columns: minmax(0, 1.3fr) 1fr auto; align-items: center; gap: 14px;
  padding: 9px 0; border-bottom: 1px solid var(--line-2);
}
.conc-row:last-child { border-bottom: none; }
.conc-name { font-size: 13px; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; }
.conc-bar { height: 10px; background: var(--line-2); border-radius: 5px; overflow: hidden; }
.conc-fill { display: block; height: 100%; background: var(--ink); border-radius: 5px; }
.conc-val { text-align: right; font-size: 13px; white-space: nowrap; }
.conc-resto .conc-name, .conc-resto .conc-val b { color: var(--ink-soft); font-weight: 500; }
.conc-resto .conc-fill { opacity: .35; }

/* alleanze ricorrenti */
.all-list { display: flex; flex-direction: column; max-height: 520px; overflow-y: auto; }
.all-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 11px 2px; border-bottom: 1px solid var(--line-2);
}
.all-row:last-child { border-bottom: none; }
.all-pair { font-size: 13px; line-height: 1.4; min-width: 0; }
.all-pair b { font-weight: 600; cursor: pointer; }
.all-pair b:hover { text-decoration: underline; }
.all-x { color: var(--ink-soft); margin: 0 6px; font-weight: 400; }
.all-meta { display: flex; gap: 6px; flex-shrink: 0; }

/* pressione competitiva */
.heat {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.heat-hot { background: #fbe3dc; color: #b03a1e; }
.heat-warm { background: #faf0d7; color: #93700f; }
.heat-low { background: #e7ede8; color: #4b6f57; }

/* ---------------- LA MIA AZIENDA (tenant) ---------------- */
.mia-profile { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 900px; }
.mia-field { display: flex; flex-direction: column; gap: 6px; }
.mia-field-wide { grid-column: 1 / -1; }
.mia-field > span { font-size: 11px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .4px; }
.mia-field input, .mia-field textarea, .mia-offerta-form input, .mia-offerta-form select {
  font: inherit; font-size: 14px; color: var(--ink); padding: 10px 13px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--white); resize: vertical;
}
.mia-msg { font-size: 13px; color: #1f7a4d; font-weight: 600; margin-left: 8px; }

.mia-offerta-form {
  display: grid; grid-template-columns: 140px 1.2fr 1fr 1.4fr auto; gap: 10px;
  margin-bottom: 20px; max-width: 1000px;
}
.mia-offerte { display: flex; flex-direction: column; gap: 8px; max-width: 1000px; }
.mia-offerta {
  display: flex; align-items: flex-start; gap: 14px; padding: 12px 14px;
  border: 1px solid var(--line-2); border-radius: 12px;
}
.mia-off-tag {
  font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: #e7ede8; color: #4b6f57; flex-shrink: 0;
}
.mia-off-tag.prod { background: #eae6f0; color: #5c4b78; }
.mia-off-body { flex: 1; min-width: 0; }
.mia-off-nome { font-size: 14px; font-weight: 600; }
.mia-off-cat { font-size: 11px; font-weight: 500; color: var(--ink-soft); background: var(--line-2); padding: 2px 7px; border-radius: 6px; margin-left: 6px; }
.mia-off-desc { font-size: 13px; color: var(--ink-soft); margin-top: 3px; }
.mia-off-del, .mia-link-del {
  border: none; background: transparent; font-size: 20px; line-height: 1; color: var(--ink-soft);
  cursor: pointer; padding: 0 4px; flex-shrink: 0;
}
.mia-off-del:hover, .mia-link-del:hover { color: #b03a1e; }

.mia-tenant-grid, .mia-gara-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.mia-tenant-card, .mia-gara-card {
  text-align: left; font: inherit; cursor: pointer; padding: 16px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--white); transition: border-color .12s, background .12s;
}
.mia-tenant-card:hover, .mia-gara-card:hover { border-color: var(--ink); background: #faf9f5; }
.mia-tenant-name, .mia-gara-code { font-size: 14px; font-weight: 700; }
.mia-tenant-meta, .mia-gara-name { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

.mia-match-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.mia-match-title { font-size: 15px; font-weight: 700; flex: 1; }
.mia-voci { display: flex; flex-direction: column; gap: 8px; }
.mia-voce { border: 1px solid var(--line-2); border-left: 3px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.mia-voce-ok { border-left-color: #1f7a4d; }
.mia-voce-part { border-left-color: #93700f; }
.mia-voce-none { border-left-color: var(--line); }
.mia-voce-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mia-voce-titolo { font-size: 14px; font-weight: 600; flex: 1; min-width: 0; }
.mia-voce-stato { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.mia-voce-ok .mia-voce-stato { color: #1f7a4d; }
.mia-voce-part .mia-voce-stato { color: #93700f; }
.mia-link, .mia-proposta {
  display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 7px 10px;
  background: #faf9f5; border-radius: 8px; font-size: 13px;
}
.mia-link-off { font-weight: 600; }
.mia-link-note { color: var(--ink-soft); flex: 1; }
.mia-ader { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.mia-ader-totale { background: #e2f2e8; color: #1f7a4d; }
.mia-ader-parziale { background: #faf0d7; color: #93700f; }
.mia-ader-assente { background: #fbe3dc; color: #b03a1e; }
.mia-proposta { background: #f3f0e6; color: #6b5b2f; }
.mia-voce-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.mia-voce-actions select, .mia-voce-actions input {
  font: inherit; font-size: 13px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--white);
}
.mia-add-note { flex: 1; min-width: 140px; }

/* ============================================================================
   VIEW 7 — MAPPA ESIGENZE E SERVIZI
   ============================================================================ */
.mappa-filters { display: flex; align-items: flex-end; gap: 14px; flex-shrink: 0; flex-wrap: wrap; }
.mappa-filters .rete-filter { min-width: 240px; }
.mappa-filters .btn-reset { height: 40px; }

/* autocompletamento */
.mappa-ac { position: relative; }
.mappa-ac input {
  width: 100%; font: inherit; font-size: 13px; font-weight: 500; color: var(--ink);
  padding: 10px 34px 10px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--white);
}
.mappa-ac input:focus { outline: none; border-color: var(--ink); }
.mappa-ac-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--white); cursor: pointer; font-size: 13px; line-height: 1;
  color: var(--ink-soft); display: flex; align-items: center; justify-content: center;
}
.mappa-ac-clear:hover { border-color: #e5533c; color: #e5533c; }
.mappa-ac-list {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  background: var(--white); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 14px 38px rgba(0,0,0,.14); overflow: hidden; max-height: 320px; overflow-y: auto;
}
.mappa-ac-item {
  display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left;
  font: inherit; font-size: 13px; padding: 10px 14px; border: none; background: transparent;
  cursor: pointer; border-bottom: 1px solid var(--line-2);
}
.mappa-ac-item:last-child { border-bottom: none; }
.mappa-ac-item:hover { background: #faf9f5; }
.mappa-ac-item b { font-weight: 600; }
.mappa-ac-sub { font-size: 11px; color: var(--ink-soft); }
.mappa-ac-none { font-size: 12px; color: var(--ink-soft); padding: 12px 14px; }

/* corpo pagina: grafo + pannello di dettaglio */
.mappa-body {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 30px;
  padding: 30px 46px 56px; background: var(--white); align-items: start;
}
.mappa-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mappa-tools[hidden] { display: none; }
.mappa-wrap[hidden] { display: none; }
.mappa-wrap { height: 680px; }
#mappaSvg { width: 100%; height: 100%; display: block; cursor: grab; }
#mappaSvg:active { cursor: grabbing; }

/* nodi per tipologia */
.mp-node .main { stroke: #fff; stroke-width: 1.5; cursor: pointer; transition: opacity .2s; }
.mp-gara .main { fill: #16160f; }
.mp-capitolato .main { fill: #1f7a4d; }
.mp-voce .main { fill: #b9bbaa; }
.mp-azienda .main { fill: #e5533c; }
.mp-node.dim { opacity: .13; }
.mp-node.sel .main { stroke: #e5533c; stroke-width: 3; }
.mp-azienda.sel .main { stroke: #16160f; }
.mp-label {
  font-size: 11px; font-weight: 600; fill: var(--ink); text-anchor: middle;
  pointer-events: none; paint-order: stroke; stroke: rgba(251,251,249,.85); stroke-width: 3px;
}
.mp-gara .mp-label { font-size: 12.5px; font-weight: 800; }
.mp-voce .mp-label { font-weight: 500; fill: #55554c; }

/* badge espandi/comprimi */
.mp-exp { cursor: pointer; }
.mp-exp circle { fill: var(--white); stroke: var(--line); stroke-width: 1; }
.mp-exp:hover circle { stroke: var(--ink); }
.mp-exp text {
  font-size: 12px; font-weight: 800; fill: var(--ink); text-anchor: middle;
  dominant-baseline: central; pointer-events: none;
}

/* archi per livello */
.mp-edge { stroke: #c7c8bb; transition: stroke-opacity .2s, stroke .2s; }
.mp-edge-ag { stroke: #e5533c; stroke-opacity: .5; stroke-width: 1.8; }
.mp-edge-ap { stroke: #a3a496; stroke-opacity: .55; stroke-width: 1.4; stroke-dasharray: 5 4; }
.mp-edge-ap.on { stroke: #6b6b60; stroke-opacity: .9; }
.mp-edge-gc { stroke-opacity: .55; stroke-width: 1.8; }
.mp-edge-cv { stroke-opacity: .4; stroke-width: 1.1; }
.mp-edge-vv { stroke-opacity: .3; stroke-width: .9; }
.mp-edge.on { stroke: #16160f; stroke-opacity: .85; }
.mp-edge-ag.on { stroke: #e5533c; stroke-opacity: .9; }
.mp-edge.off { stroke-opacity: .04; }

/* legenda: colori tipologia */
.mp-gl-azienda { background: #e5533c; }
.mp-gl-gara { background: #16160f; }
.mp-gl-cap { background: #1f7a4d; }
.mp-gl-voce { background: #b9bbaa; }

/* stato vuoto */
.mappa-empty[hidden] { display: none; }
.mappa-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; text-align: center;
  background: rgba(251,251,249,.96); padding: 40px;
}
.mappa-empty-ico { font-size: 44px; color: var(--line); line-height: 1; }
.mappa-empty-title { font-size: 17px; font-weight: 700; }
.mappa-empty p { font-size: 13px; color: var(--ink-soft); max-width: 46ch; line-height: 1.55; }
.mappa-empty .btn-reset { margin-top: 8px; }

/* switch grafo/lista */
.mp-switch { display: flex; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.mp-switch .btn-reset { border: none; border-radius: 0; }
.mp-switch .btn-reset.active { background: var(--ink); color: #fff; }

/* vista lista */
.mappa-lista {
  border: 1px solid var(--line-2); border-radius: 22px; background: #fbfbf9;
  height: 680px; overflow-y: auto; padding: 20px 24px; position: relative;
}
.mappa-lista[hidden] { display: none; }
.mappa-lista-gara { margin-bottom: 28px; }
.mappa-lista-gara-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 13px 18px; background: #f0f0ea; border-radius: 14px; cursor: pointer;
  margin-bottom: 10px; transition: background .12s;
}
.mappa-lista-gara-head:hover { background: #e9e9e1; }
.mappa-lista .voci-cap { margin-bottom: 10px; }
.mappa-lista .voci-cap-title:hover { text-decoration: underline; }
.mappa-lista-voce.mp-active,
.mappa-lista-gara-head.mp-active { background: var(--cream); border-radius: 10px; }
.mappa-empty-lista { position: static; background: transparent; min-height: 420px; }

/* liste di figli nel pannello di dettaglio */
.mappa-det-scroll { max-height: 340px; overflow-y: auto; margin-top: 8px; padding-right: 4px; }
.mappa-det-cap {
  border: 1px solid var(--line-2); border-radius: 12px; margin-top: 8px;
  overflow: hidden; background: var(--white);
}
.mappa-det-cap summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; cursor: pointer; list-style: none;
  font-size: 12.5px; font-weight: 600; background: #f6f6f2;
}
.mappa-det-cap summary::-webkit-details-marker { display: none; }
.mappa-det-cap summary:hover { background: #efefe9; }
.mappa-det-cap-t:hover { text-decoration: underline; }
.mappa-det-voci { padding: 4px 12px 8px; }
.mappa-det-item {
  display: flex; align-items: center; gap: 8px; font-size: 12px;
  padding: 6px 0 6px calc(var(--ind, 0) * 16px);
  border-bottom: 1px solid var(--line-2); cursor: pointer;
}
.mappa-det-item:last-child { border-bottom: none; }
.mappa-det-item:hover .mappa-det-item-t { text-decoration: underline; }
.mappa-det-item { flex-wrap: wrap; }
.mappa-det-item-t {
  flex: 1; min-width: 0; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mappa-det-item-desc {
  flex-basis: 100%; display: none; font-size: 11.5px; color: var(--ink-soft);
  line-height: 1.55; padding: 4px 0 2px;
}
.mappa-det-item.open .mappa-det-item-desc { display: block; }
.mappa-det-exp {
  border: none; background: transparent; cursor: pointer; flex-shrink: 0;
  font-size: 12px; line-height: 1; color: var(--ink-soft); padding: 2px 4px;
  transition: transform .15s;
}
.mappa-det-exp:hover { color: var(--ink); }
.mappa-det-exp.open { transform: rotate(90deg); }
/* descrizione espandibile anche nelle voci della vista lista */
.mappa-lista-voce .voce-desc { display: none; }
.mappa-lista-voce.open .voce-desc { display: block; -webkit-line-clamp: unset; }

/* pannello di dettaglio */
.mappa-side { position: sticky; top: 24px; }
.mappa-detail {
  border: 1px solid var(--line-2); border-radius: 18px; padding: 20px 22px;
  background: #fbfbf9; min-height: 220px;
}
.mappa-hint { font-size: 13px; color: var(--ink-soft); line-height: 1.6; }
.mappa-hint-list { margin: 14px 0 0 18px; font-size: 12.5px; color: var(--ink-soft); line-height: 1.9; }
.mappa-hint-list b { color: var(--ink); }
.mappa-tag {
  display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; padding: 4px 10px; border-radius: 10px; margin-bottom: 12px;
  background: #f0f0ec; color: var(--ink-soft);
}
.mappa-tag-gara { background: #16160f; color: #fff; }
.mappa-tag-capitolato { background: #e2f2e8; color: #1f7a4d; }
.mappa-tag-voce { background: #eceddf; color: #6b6250; }
.mappa-tag-azienda { background: #fbe3dc; color: #b03a1e; }
.mappa-det-title { font-size: 16px; font-weight: 700; line-height: 1.35; }
.mappa-det-title .voce-code { vertical-align: 2px; margin-right: 4px; }
.mappa-det-sub { font-size: 12px; color: var(--ink-soft); margin-top: 6px; }
.mappa-det-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.mappa-det-kpis .kpi { padding: 10px 12px; }
.mappa-det-kpis .kpi-val { font-size: 17px; }
.mappa-det-desc { font-size: 12.5px; color: var(--ink-soft); line-height: 1.6; margin-top: 8px; }
.mappa-det-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  color: var(--ink-soft); margin-top: 16px;
}
.mappa-det-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mappa-det-pills .pill[data-az-link]:hover { background: var(--ink); color: #fff; }
.mappa-det-btn {
  display: block; width: 100%; text-align: center; margin-top: 14px;
  text-decoration: none; color: var(--ink);
}

@media (max-width: 1080px) {
  .top, .top-overview, .az-hero-wrap { grid-template-columns: 1fr; }
  .bottom { grid-template-columns: 1fr; }
  .rete-body { grid-template-columns: 1fr; }
  .rete-head { flex-direction: column; }
  .mappa-body { grid-template-columns: 1fr; }
  .mappa-side { position: static; }
  .mappa-wrap { height: 520px; }
  .az-cols { grid-template-columns: 1fr; }
  .mia-profile { grid-template-columns: 1fr; }
  .mia-offerta-form { grid-template-columns: 1fr 1fr; }
  .strat-kpis { grid-template-columns: repeat(3, 1fr); }
  .analisi-grid { grid-template-columns: 1fr; }
  .detail-master { grid-template-columns: 1fr; gap: 24px; }
  .dm-nav {
    position: static; flex-direction: row; overflow-x: auto;
    border-left: none; border-bottom: 1px solid var(--line-2); padding-bottom: 8px;
  }
  .dm-item { flex-shrink: 0; border-left: none; border-radius: 999px; margin-left: 0; }
  .dm-item.active { border-left: none; }
}

/* --- Contratti attuativi ------------------------------------------------- */
.ca-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ca-table th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3, #8b95a1);
  font-weight: 600;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border, #e3e7ec);
  white-space: nowrap;
}
.ca-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-soft, #eef1f4);
  vertical-align: top;
}
.ca-table tbody tr:last-child td { border-bottom: none; }
/* `.ca-table th` (classe + elemento) batte `.ta-r` (sola classe) per
   specificita': senza questa riga un <th class="ta-r"> restava allineato a
   sinistra mentre i valori della sua colonna erano a destra. */
.ca-table th.ta-r { text-align: right; }
/* Cifre a larghezza fissa: senza, '1.234' e '999' non incolonnano le unita'
   nemmeno essendo entrambi allineati a destra. */
.ca-table td.ta-r, .ca-table th.ta-r { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ca-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ca-table .ca-data { white-space: nowrap; font-variant-numeric: tabular-nums; }
.ca-table .ca-ente { min-width: 200px; }
.ca-table .ca-lotto { white-space: nowrap; font-weight: 600; }
.ca-table .muted { color: var(--text-3, #8b95a1); }
.ca-wrap { margin-top: 18px; }
/* L'allineamento e' voluto a fine-riga (flex-end): i campi hanno un'etichetta
   sopra il controllo, la casella di ricerca no, e i bordi inferiori devono
   comunque combaciare. */
.ca-filtri { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin-top: 16px; }
.search-box-sm { flex: 1; min-width: 220px; margin: 0; }

/* --- Dettaglio contratto attuativo --------------------------------------- */
.ca-table .ca-cig { white-space: nowrap; font-variant-numeric: tabular-nums; }
.cd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 18px; margin-top: 22px; }
.cd-list { padding: 4px 0; }
.cd-row {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-soft, #eef1f4);
  font-size: 13.5px;
}
.cd-row:last-child { border-bottom: none; }
.cd-lab { color: var(--text-3, #8b95a1); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; padding-top: 2px; }
.cd-raw { font-size: 12px; }
.cd-raw .cd-raw-k { color: var(--ink-soft); white-space: nowrap; width: 230px; font-size: 12.5px; }

/* --- Bandi in Italia: mappa di calore ------------------------------------ */
:root {
  --heat-0: #eef2f0; --heat-1: #d7e5e0; --heat-2: #b8d4cc;
  --heat-3: #93bfb4; --heat-4: #6aa697; --heat-5: #3f8a78;
  --heat-6: #1f6a59; --heat-empty: #f4f5f2;
}
.bd-search { max-width: 640px; margin-bottom: 18px; }
/* Two independent groups, never interleaved: metriche (view mode) is a fixed
   4-column grid that only ever reflows at its own breakpoints below, and
   bd-filtri-ricerca (settore) wraps to its own line as one atomic block
   instead of splitting apart mid-row. */
.bd-filtri {
  display: flex; flex-wrap: wrap; gap: 20px;
  align-items: stretch; justify-content: space-between;
  margin: 26px 0 18px;
}
.bd-metriche {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
  flex: 1 1 480px; min-width: 480px;
}
.bd-metrica {
  display: flex; flex-direction: column; justify-content: center; min-height: 56px;
  font: inherit; text-align: left; cursor: pointer;
  padding: 8px 14px; border: 1px solid var(--line, #d9dacd);
  border-radius: 12px; background: var(--white); color: inherit;
}
.bd-metrica b { display: block; font-size: 13px; font-weight: 600; }
.bd-metrica span { display: block; font-size: 11px; color: var(--ink-soft, #6b6b60); margin-top: 1px; }
.bd-metrica.active { border-color: var(--ink, #16160f); background: var(--cream, #edeee7); }
.bd-filtri-ricerca {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  flex: 1 1 auto;
}
/* Tre filtri identici e compatti, senza etichette sopra: stessa altezza,
   stesso raggio, stesso peso visivo, allineati sulla stessa linea. */
.bd-filtro {
  font: inherit; font-size: 13px; font-weight: 500; color: var(--ink);
  height: 38px; padding: 0 14px; min-width: 210px;
  background-color: var(--white); border: 1px solid var(--line);
  border-radius: 10px; transition: border-color .15s ease;
}
select.bd-filtro {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236b6b60' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 10px 7px;
}
.bd-filtro::placeholder { color: var(--ink-soft); font-weight: 400; }
.bd-filtro:hover { border-color: var(--ink-soft); }
.bd-filtro:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(22, 22, 15, .08); }
@media (max-width: 900px) {
  .bd-filtri-ricerca {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    flex-basis: 100%;
  }
  .bd-filtro { min-width: 0; width: 100%; }
}
@media (max-width: 600px) {
  .bd-metriche { grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 0; flex-basis: 100%; }
  .bd-filtri-ricerca { grid-template-columns: 1fr; }
  .campo input[type="text"] { min-width: 0; width: 100%; }
}
/* Il menu dei settori non ha piu' una regola propria per ID: e' uno dei tre
   .bd-filtro, e deve restare identico agli altri due. Una regola su #bdSettore
   vincerebbe per specificita' e lo sfalserebbe di nuovo. */
#bdSettore { max-width: 340px; }
/* La sagoma dell'Italia e' piu' alta che larga: una colonna troppo larga per
   la mappa la lasciava con una fascia vuota fino alla barra laterale. */
.bd-mappa { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(260px, 1fr); gap: 26px; align-items: start; }
.bd-canvas { position: relative; }
.hm-canvas { width: 100%; height: auto; max-height: 72vh; display: block; }
.hm-area { stroke: var(--white); stroke-width: 0.012; cursor: pointer; transition: opacity .12s; }
.hm-area:hover, .hm-area:focus { opacity: .78; outline: none; }
.hm-area-sel { stroke: var(--ink, #16160f); stroke-width: 0.03; }
.bd-back { margin-bottom: 10px; }
.bd-legenda { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 11.5px; color: var(--ink-soft, #6b6b60); }
.bd-legenda div { display: flex; flex: 1; max-width: 260px; height: 9px; border-radius: 5px; overflow: hidden; }
.bd-legenda i { flex: 1; }
.bd-readout { padding: 16px 0 20px; border-bottom: 1px solid var(--line-2, #ececec); }
.bd-ro-area { font-size: 15px; font-weight: 600; }
.bd-ro-val { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }
.bd-ro-metric { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft, #6b6b60); }
.bd-ro-extra, .bd-ro-hint { font-size: 12px; color: var(--ink-soft, #6b6b60); margin-top: 6px; }
.bd-classifica { padding-top: 16px; }
.bd-cl-row { display: grid; grid-template-columns: 1fr 70px auto; gap: 10px; align-items: center; padding: 5px 0; font-size: 12.5px; }
.bd-cl-nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-cl-bar { height: 6px; background: var(--line-2, #ececec); border-radius: 3px; overflow: hidden; }
.bd-cl-bar span { display: block; height: 100%; background: var(--heat-4); }
.bd-cl-val { font-variant-numeric: tabular-nums; font-size: 11.5px; white-space: nowrap; }
.bd-ogg { max-width: 320px; }
@media (max-width: 900px) { .bd-mappa { grid-template-columns: 1fr; } }

/* --- Righe-scheda: contratti attuativi e risultati di ricerca ------------ */
/* Stesso idioma del pattern .contact (badge + info + valore) applicato a
   liste dense, invece di tabelle HTML nude. */
.riga-lista { display: flex; flex-direction: column; gap: 8px; }
/* Pannello a altezza fissa per i risultati di Mercato nazionale: sempre la
   stessa ingombro a schermo, scorrevole al suo interno, che la ricerca porti
   10 righe o 200 - niente piu' pagina che si allunga ad ogni ricerca. */
.riga-lista-panel { max-height: 640px; overflow-y: auto; padding-right: 4px; }
.riga {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 16px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color .15s ease;
}
/* L'attributo hidden da solo non basta: display:flex qui sopra e' una regola
   d'autore e batte sempre il display:none dello user-agent stylesheet che
   applica [hidden], a prescindere dall'ordine. Senza questa riga i filtri
   impostano .hidden ma la riga resta visibile. */
.riga[hidden] { display: none; }
.riga:hover { border-color: var(--ink-soft); }
.riga-corpo { flex: 1; min-width: 0; }
.riga-overline {
  font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 3px;
}
.riga-titolo { font-size: 14.5px; font-weight: 600; line-height: 1.35; color: var(--ink); }
.riga-titolo a { color: var(--ink); text-decoration: none; }
.riga-titolo a:hover { text-decoration: underline; }
.riga-sub { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.riga-meta {
  display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 11px; color: var(--ink-soft); letter-spacing: .01em;
}
.riga-cig { color: inherit; text-decoration: none; }
.riga-cig:hover { text-decoration: underline; }
.riga-esito { flex-shrink: 0; text-align: right; }
.riga-importo { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.riga-fornitore { font-size: 11.5px; color: var(--ink-soft); margin-top: 3px; white-space: nowrap; }
.riga-fornitore a { color: inherit; }
.riga-piu { color: var(--ink-soft); font-weight: 500; }

@media (max-width: 620px) {
  .riga { flex-direction: column; align-items: stretch; }
  .riga-esito { text-align: left; margin-top: 4px; }
}

/* --- Campo etichettato: sostituisce le <select> spoglie ------------------- */
/* Stesso principio del componente "field" di asp-scraper (etichetta sopra il
   controllo), tradotto nella palette esistente di questa dashboard. */
.campo { display: flex; flex-direction: column; gap: 5px; }
.campo-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-soft);
}
/* Altezza esplicita e identica per select e input: un <select> e un <input>
   con lo stesso padding e la stessa dimensione del carattere NON hanno la
   stessa altezza intrinseca (il select la ricava dal proprio line-height
   interno, diverso da browser a browser). Senza questo, i tre filtri della
   stessa riga risultavano sfalsati di un paio di pixel, etichette comprese. */
.campo select,
.campo input[type="text"] { height: 42px; }
.campo select {
  appearance: none; -webkit-appearance: none;
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink);
  padding: 10px 34px 10px 14px; min-width: 200px;
  background-color: var(--white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236b6b60' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 10px 7px;
  border: 1px solid var(--line); border-radius: 12px; cursor: pointer;
  transition: border-color .15s ease;
}
.campo select:hover { border-color: var(--ink-soft); }
.campo select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(22, 22, 15, .08); }
.campo input[type="text"] {
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink);
  padding: 10px 14px; min-width: 180px;
  background-color: var(--white);
  border: 1px solid var(--line); border-radius: 12px;
  transition: border-color .15s ease;
}
.campo input[type="text"]::placeholder { color: var(--ink-soft); font-weight: 500; }
.campo input[type="text"]:hover { border-color: var(--ink-soft); }
.campo input[type="text"]:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(22, 22, 15, .08); }

/* --- Righe cliccabili: il contratto/bando intero porta al lotto ---------- */
.riga-clic { cursor: pointer; }
.riga-clic:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.riga-dettaglio {
  color: var(--ink-soft); text-decoration: none; font-weight: 600;
  border-bottom: 1px dotted var(--ink-soft);
}
.riga-dettaglio:hover { color: var(--ink); border-color: var(--ink); }

/* --- Navigazione della mappa: zoom col trackpad --------------------------- */
.bd-canvas { position: relative; touch-action: none; }
.hm-canvas { cursor: grab; }
.hm-zoom {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  display: flex; flex-direction: column; gap: 1px;
  background: var(--white); border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(22, 22, 15, .08);
}
.hm-zoom button {
  width: 30px; height: 30px; border: none; background: var(--white); color: var(--ink);
  font-size: 16px; line-height: 1; cursor: pointer;
}
.hm-zoom button:hover { background: var(--cream); }
.hm-zoom button + button { border-top: 1px solid var(--line); }
.bd-hint { margin-top: 8px; font-size: 11px; color: var(--ink-soft); text-align: center; }

/* --- Breadcrumb di navigazione della mappa -------------------------------- */
/* Sempre in cima ai risultati, non dentro il riquadro della mappa: resta
   raggiungibile anche quando l'elenco sopra e' lungo e la mappa e' scesa
   sotto lo scroll. Vuoto (e quindi invisibile) al livello Italia. */
.bd-breadcrumb {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13px; color: var(--ink-soft);
}
.bd-breadcrumb:empty { margin: 0; }
.bd-breadcrumb:not(:empty) { margin-bottom: 16px; }
.bd-breadcrumb button {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink);
  background: none; border: none; padding: 0; cursor: pointer; text-decoration: underline;
  text-decoration-color: var(--line); text-underline-offset: 3px;
}
.bd-breadcrumb button:hover { text-decoration-color: var(--ink); }
.bd-breadcrumb span:last-child { color: var(--ink); font-weight: 600; }
.bd-crumb-sep { color: var(--ink-soft); }

/* --- Freccia di ritorno alla mappa, sopra l'elenco filtrato --------------- */
.bd-torna-mappa {
  background: none; border: none; padding: 0; cursor: pointer; font-family: inherit;
}

/* ---------------- LOGIN ---------------- */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--cream);
}
.login-overlay[hidden] { display: none; }

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 40px 36px 34px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.login-brand { display: flex; flex-direction: column; gap: 2px; }
.login-intro { font-size: 14px; color: var(--ink-soft); line-height: 1.5; margin-bottom: 4px; }

.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field span { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.login-field input {
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
}
.login-field input:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }

.login-msg {
  font-size: 13px;
  line-height: 1.45;
  color: #a23b3b;
  background: #f6e3e3;
  border-radius: 10px;
  padding: 9px 12px;
}
.login-msg[hidden] { display: none; }

.login-btn {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--white);
  background: var(--ink);
  border: none;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  margin-top: 4px;
}
.login-btn:hover { opacity: .88; }
.login-btn:disabled { opacity: .5; cursor: progress; }

.user-logout {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 13px;
  cursor: pointer;
}
.user-logout:hover { color: var(--ink); border-color: var(--ink); }

@media (max-width: 430px) {
  .login-card { padding: 30px 22px 26px; border-radius: 20px; }
}

/* Hero without side panels: one column across the whole card. */
.top.top-solo { grid-template-columns: minmax(0, 1fr); }

/* Notes under the operator hero: one row per note, text on the left and its
   action or evidence on the right; on narrow screens the right part drops
   below the text instead of squeezing it. */
.op-note {
  margin-top: 24px; background: var(--pagina);
  border: 1px solid var(--line); border-radius: 14px;
}
.op-nota {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px 24px; padding: 14px 18px;
}
.op-nota + .op-nota { border-top: 1px solid var(--line); }
.op-nota-testo {
  display: flex; flex-direction: column; gap: 2px; flex: 1 1 360px; min-width: 0;
  font-size: 13.5px; line-height: 1.5; color: var(--ink-soft);
}
.op-nota-titolo { font-weight: 600; color: var(--ink); }
.op-nota .btn-cta { flex: none; }
.op-grafie { display: flex; flex-wrap: wrap; gap: 8px; }
.op-grafia {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
  color: var(--ink); background: var(--white);
  border: 1px solid var(--line); border-radius: 8px; padding: 4px 9px;
}
/* The differing characters: often a single comma or semicolon, so they get a
   tinted box wide enough to be seen. */
.op-grafia mark {
  background: var(--accent-soft); color: var(--accent); font-weight: 700;
  border-radius: 3px; padding: 0 3px; margin-left: 1px;
}

/* --- Barra di avanzamento del ciclo di vita di una gara ------------------- */
/* Quattro tappe; accesa solo quella di cui esiste la data che la dimostra.
   Spenta significa "non risulta", non "non avvenuto": ANAC pubblica l'avvio
   contratto nell'11,7% dei casi e la fine nel 4,8%. */
.tl { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 11.5px; color: var(--ink-soft); }
.tl-barra { display: flex; gap: 3px; flex: none; }
.tl-tappa {
  width: 26px; height: 4px; border-radius: 2px; background: var(--line);
  display: inline-block;
}
.tl-tappa.fatta { background: #3f8a78; }
.tl-stato { font-weight: 600; color: var(--ink); }
.tl-conta { font-variant-numeric: tabular-nums; }
.tl-scadenza { color: #c9611c; font-weight: 600; }

/* --- Radar del segmento (profilo operatore) ------------------------------ */
.rad-mia { color: #2e7d32; font-weight: 600; }
.rad-altri { color: var(--ink-soft); }
.rad-scadenza { font-size: 11.5px; color: var(--ink-soft); margin-top: 4px; white-space: nowrap; }
.rad-scadenza.vicina { color: #c9611c; font-weight: 600; }
.panel-desc code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px;
  background: var(--cream-2); padding: 1px 6px; border-radius: 5px; margin-right: 2px;
}

/* --- Barra della vita di un contratto (radar del segmento) ---------------- */
/* Da inizio a fine, con la posizione di oggi: mostra quanto manca in
   proporzione alla durata, non solo la data di scadenza. */
.cbar { margin-top: 10px; width: 100%; }
.cbar-track {
  position: relative; height: 5px; border-radius: 3px;
  background: var(--line); overflow: visible;
}
.cbar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: #93bfb4; border-radius: 3px 0 0 3px;
}
.cbar-fill.urgente { background: #e0a87c; }
.cbar-oggi {
  position: absolute; top: 50%; width: 9px; height: 9px; border-radius: 50%;
  background: #3f8a78; border: 2px solid var(--white);
  transform: translate(-50%, -50%);
}
.cbar-oggi.urgente { background: #c9611c; }
/* Senza data di inizio la proporzione non esiste: traccia tenue, nessun
   riempimento, per non suggerire un avanzamento che non conosciamo. */
.cbar-parziale .cbar-track { background: repeating-linear-gradient(90deg, var(--line) 0 4px, transparent 4px 8px); }
.cbar-righe {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-top: 6px; font-size: 11px; color: var(--ink-soft);
}
.cbar-estremo { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cbar-resta { font-weight: 600; color: var(--ink); white-space: nowrap; }
.cbar-resta.urgente { color: #c9611c; }

/* --- Elenco del radar: chiuso di default, apribile ----------------------- */
.rad-elenco { margin-top: 4px; }
.rad-apri {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  cursor: pointer; padding: 12px 16px; border: 1px solid var(--line);
  border-radius: 14px; background: var(--white); list-style: none;
  transition: border-color .15s;
}
.rad-apri::-webkit-details-marker { display: none; }
.rad-apri:hover { border-color: var(--ink-soft); }
.rad-apri::before {
  content: '▸'; color: var(--ink-soft); font-size: 12px;
  transition: transform .15s; display: inline-block;
}
.rad-elenco[open] > .rad-apri::before { transform: rotate(90deg); }
.rad-elenco[open] > .rad-apri { margin-bottom: 14px; }
.rad-apri-testo { font-weight: 600; font-size: 14px; color: var(--ink); }
.rad-apri-hint { font-size: 12px; color: var(--ink-soft); }

/* Esito economico nella riga: come si e' chiusa la gara. */
.rad-ribasso { color: #2e7d32; font-weight: 600; }
.rad-ribasso.rad-nessun-ribasso { color: var(--ink-soft); font-weight: 500; }
.rad-offerenti { color: var(--ink-soft); }
.rad-offerenti.rad-solo { color: #c9611c; font-weight: 600; }

/* --- Gare correlate: etichette e filtri combinabili ----------------------- */
/* Le etichette non si escludono: una gara puo' essere insieme "aggiudicata" e
   "di interesse". Ognuna porta un title con la spiegazione per esteso. */
.gb-badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: .03em;
  padding: 2px 8px; border-radius: 10px; cursor: help; white-space: nowrap;
}
.gb-aggiudicato     { background: #e0ede8; color: #2e7d32; }
.gb-non_aggiudicato { background: #f0ece6; color: #8a6a3f; }
.gb-interesse       { background: #e6ecf2; color: #3a6b8a; }

/* La propria offerta: solo prova diretta di partecipazione (otto gare
   censite), quindi compare raramente e va segnalata senza pesare sul resto
   della riga - un filo di testo fra i badge e la barra del contratto. */
.gb-offerta {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-soft); margin-top: 8px;
}
.gb-offerta-lab {
  font-size: 10.5px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-3, #8b95a1);
}
.gb-offerta span:not(.gb-offerta-lab) { color: var(--ink); font-weight: 600; }
.gb-offerta .gb-offerta-esito { color: #8a6a3f; }

/* Quando "Gare correlate" e' una sezione del dettaglio bando l'intestazione la
   scrive la sezione stessa: resta solo il conteggio, che va staccato da sopra. */
.gc-conteggio-solo { display: inline-block; margin-bottom: 14px; }

/* Un accordo quadro puo' avere decine di aggiudicatari: l'elenco da cui si
   sceglie il segmento va contenuto, non lasciato correre per mezza pagina. */
.gc-operatori { max-height: 132px; overflow-y: auto; align-items: flex-start; padding-bottom: 2px; }
.gc-operatori .gb-filtro { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.gb-filtri { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 16px; }
.gb-filtri-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-soft); margin-right: 2px;
}
.gb-filtro {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink);
  background: var(--white); border: 1px solid var(--line);
  padding: 6px 13px; border-radius: 16px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.gb-filtro:hover { border-color: var(--ink-soft); }
.gb-filtro.attivo { background: var(--ink); border-color: var(--ink); color: #fff; }
.gb-filtro-n {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 11px;
  color: var(--ink-soft);
}
.gb-filtro.attivo .gb-filtro-n { color: rgba(255, 255, 255, .75); }
.gb-azzera {
  font: inherit; font-size: 12px; color: var(--ink-soft);
  background: none; border: none; cursor: pointer; text-decoration: underline;
}
.gb-azzera:hover { color: var(--ink); }

/* Contratto gia' concluso: la barra e' piena, il tono spento - e' storia, non
   un'occasione. */
.cbar-fill.concluso { background: #cfd1c2; }
.cbar-oggi.concluso { background: #a7a99a; }
.cbar-resta.concluso { color: var(--ink-soft); font-weight: 500; }
.cbar-assente { font-size: 11px; color: var(--ink-soft); margin-top: 10px; font-style: italic; }

/* --- Doppia timeline del contratto: tempo e budget ------------------------ */
/* Due assi affiancati che rispondono a domande diverse. Sono appaiati proprio
   perche' il loro SCARTO e' l'informazione: un contratto all'80% del tempo e
   al 20% della spesa racconta qualcosa che nessuna delle due barre dice da
   sola. Sotto i 900px vanno in colonna, restando comunque adiacenti. */
.dt {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  margin-bottom: 28px;
}
@media (max-width: 900px) { .dt { grid-template-columns: 1fr; } }

.dt-blocco {
  background: var(--white); border: 1px solid var(--line);
  border-radius: 12px; padding: 18px 20px; box-shadow: var(--ombra);
}
.dt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.dt-head h3 {
  font-size: 12px; font-weight: 700; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: .06em;
}
.dt-esito { font-size: 13px; font-weight: 700; color: var(--ink); text-align: right; }
.dt-esito.urgente { color: var(--attesa); }
.dt-esito.sforato { color: var(--erroneo); }
.dt-esito.concluso { color: var(--ink-soft); font-weight: 600; }

.dt-track {
  position: relative; height: 8px; border-radius: 999px;
  background: var(--cream-2); overflow: visible;
}
.dt-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--accent); transition: width .7s ease-out; }
.dt-fill.urgente { background: var(--attesa); }
.dt-fill.sforato { background: var(--erroneo); }
.dt-fill.concluso { background: #cbd5e1; }
.dt-oggi {
  position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: 2.5px solid var(--white);
  transform: translate(-50%, -50%); box-shadow: var(--ombra);
}
.dt-oggi.urgente { background: var(--attesa); }
.dt-oggi.concluso { background: #94a3b8; }
/* Tacca sul cento per cento quando la barra lo supera: senza, il pieno
   rosso non direbbe DI QUANTO si e' sforato. */
.dt-soglia {
  position: absolute; top: -3px; bottom: -3px; left: 100%; width: 2px;
  background: var(--ink); transform: translateX(-2px);
}

.dt-estremi {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-top: 10px; font-size: 11.5px; color: #475569;
  font-variant-numeric: tabular-nums;
}
.dt-estremi em { font-style: normal; color: var(--text-3); }
.dt-centro { text-align: center; color: var(--ink-soft); }

.dt-vuoto { display: flex; flex-direction: column; justify-content: center; }
.dt-motivo { font-size: 12px; color: var(--ink-soft); font-style: italic; }

/* ---------------- Professional profiles (gara detail) ----------------
   One card per profile. A profile required on more than one group of lots
   shows one requirement block per group, side by side, and marks the fields
   that differ: the comparison the reader is after. */
.fg-sezione { margin-bottom: 34px; }
.fg-sezione-titolo {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 700; color: var(--ink); margin: 0 0 6px;
}
.fg-sezione-nota { font-size: 13px; color: var(--ink-soft); margin: 0 0 14px; max-width: 100ch; }
.fg-lista { display: flex; flex-direction: column; gap: 12px; }

.fg-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); padding: 16px 18px; }
.fg-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 12px; }
.fg-nome { font-size: 15px; font-weight: 700; color: var(--ink); margin: 0; }
.fg-tags { display: flex; flex-wrap: wrap; gap: 6px; }
/* Group colour: the same group keeps the same colour in every card. */
.fg-tag { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.fg-tag-0 { background: var(--accent-soft); color: var(--accent); }
.fg-tag-1 { background: var(--ok-soft); color: var(--ok); }
.fg-tag-2 { background: var(--attesa-soft); color: var(--attesa); }

.fg-blocchi.fg-affiancati { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 12px; }
.fg-affiancati .fg-blocco { background: var(--pagina); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; }
.fg-blocco-titolo {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 12px; font-weight: 700; color: var(--ink); margin-bottom: 8px;
}
.fg-blocco-titolo span { font-weight: 500; color: var(--ink-soft); }

.fg-req { display: grid; gap: 0; margin: 0; }
.fg-riga {
  display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px;
  padding: 7px 0; border-top: 1px solid var(--line-2);
}
.fg-riga:first-child { border-top: none; }
.fg-riga dt { font-size: 11.5px; font-weight: 600; color: var(--ink-soft); margin: 0; padding-top: 1px; }
.fg-riga dd { font-size: 13px; color: var(--ink); margin: 0; line-height: 1.45; overflow-wrap: anywhere; }
.fg-sub { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 1px; }
.fg-prezzo-lotto { display: block; }
/* A field whose value changes between the groups of the same profile. */
.fg-diversa dd { color: var(--ink); }
.fg-diversa { box-shadow: inset 3px 0 0 var(--attesa); padding-left: 9px; }
.fg-diversa-tag {
  display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 700;
  color: var(--attesa); background: var(--attesa-soft); border-radius: 6px; padding: 0 5px;
}
.fg-lungo summary, .fg-ruolo summary { cursor: pointer; list-style: none; }
.fg-lungo summary::-webkit-details-marker, .fg-ruolo summary::-webkit-details-marker { display: none; }
.fg-lungo summary::after { content: ' mostra tutto'; font-size: 11.5px; font-weight: 600; color: var(--accent); }
.fg-lungo[open] summary { display: none; }
.fg-lungo p, .fg-ruolo p { margin: 4px 0 0; }
.fg-ruolo { margin-top: 8px; font-size: 13px; color: var(--ink-soft); }
.fg-ruolo summary { font-size: 12px; font-weight: 600; color: var(--accent); }
.fg-ruolo summary::before { content: '+ '; }
.fg-ruolo[open] summary::before { content: '- '; }
.fg-listino-gruppo th {
  text-align: left; font-size: 11.5px; font-weight: 700; color: var(--ink);
  background: var(--cream); padding: 8px 10px;
}
@media (max-width: 700px) {
  .fg-riga { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .fg-card { padding: 14px; }
}

/* Documents: download links and archive notes. */
.doc-nota { font-size: 13px; color: var(--ink-soft); margin: 0 0 12px; max-width: 100ch; }
.doc-nota-avviso { color: var(--ink); background: var(--attesa-soft); border-left: 3px solid var(--attesa); padding: 8px 12px; border-radius: 0 8px 8px 0; }
.doc-link { color: var(--accent); text-decoration: none; }
.doc-link:hover { text-decoration: underline; }
.doc-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.doc-link::after { content: ' \2193'; font-size: 12px; }
.doc-non-uff { background: var(--attesa-soft); color: var(--attesa); flex-shrink: 0; }
