/* ======================================================
   OPTA Marketing — Design system (verde)
   Struttura colori: var(--primary) = verde #16a34a
   Portale=blu  Bandi=rosso  Marketing=verde
   ====================================================== */

:root {
  /* Primario verde */
  --primary:     #16a34a;
  --primary-d:   #15803d;
  --primary-xl:  #f0fdf4;
  --primary-tag: #dcfce7;

  /* Neutrali */
  --bg:     #f8fafc;
  --panel:  #ffffff;
  --ink:    #111827;
  --ink-2:  #374151;
  --muted:  #6b7280;
  --line:   #e5e7eb;
  --line-2: #d1d5db;

  /* Stati */
  --amber:       #d97706;
  --amber-light: #fef3c7;
  --red:         #dc2626;
  --red-light:   #fef2f2;
  --blue:        #2563eb;
  --green:       #16a34a;
  --green-light: #f0fdf4;

  /* Geometria */
  --radius: 10px;
  --radius-lg: 14px;
  --sh: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --sh-md: 0 4px 8px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.04);
}

/* ——— Reset ——— */
*, *::before, *::after { box-sizing: border-box }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--ink);
}
a { color: var(--primary); text-decoration: none }
a:hover { text-decoration: underline }
h1 { font-size: 22px; margin: 0; font-weight: 700 }
h2 { font-size: 17px; margin: 28px 0 12px; font-weight: 600 }
h3 { font-size: 14px; margin: 0 0 10px; font-weight: 600 }

/* ——— Sidebar ———
   Il menù sta a sinistra come negli altri portali OPTA. Su schermo largo e' sempre
   visibile e comprimibile a sole icone; sotto gli 860px diventa un cassetto, perche'
   il portale si usa spesso dal telefono. */
.layout { display: flex; min-height: 100vh; align-items: flex-start }
.content { flex: 1; min-width: 0 }

.sidebar {
  width: 222px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  border-top: 3px solid var(--primary);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 60;
}
.sb-brand { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 2px 6px 12px }
.sb-brand .app-name {
  font-size: 11px; font-weight: 700; color: var(--primary);
  letter-spacing: .06em; text-transform: uppercase;
}
.sidebar .ham {
  background: none; border: none; cursor: pointer; color: var(--muted);
  font-size: 17px; padding: 4px 6px; line-height: 1; border-radius: 6px; flex-shrink: 0;
}
.sidebar .ham:hover { background: var(--bg); color: var(--primary) }

.sb-nav { display: flex; flex-direction: column; gap: 1px }
.navlink {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 9px; border-radius: 8px;
  color: var(--ink-2); text-decoration: none;
  font-size: 14px; white-space: nowrap;
  transition: background .12s, color .12s;
}
.navlink:hover { background: var(--bg); color: var(--primary); text-decoration: none }
.navlink.active { background: var(--primary-xl); color: var(--primary-d); font-weight: 600 }
.navlink .ic { width: 20px; text-align: center; flex-shrink: 0; font-size: 15px }
.navgrp {
  font-size: 10.5px; color: var(--muted); margin: 13px 0 3px; padding: 0 9px;
  letter-spacing: .06em; text-transform: uppercase; font-weight: 600;
}
.sb-bottom { margin-top: auto; border-top: 1px solid var(--line); padding-top: 10px }
.sb-bottom button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; cursor: pointer; padding: 8px 9px; border-radius: 8px;
  color: var(--muted); font: inherit; font-size: 13px; text-align: left;
}
.sb-bottom button:hover { background: var(--bg); color: var(--red) }
.sb-bottom .ic { width: 20px; text-align: center; flex-shrink: 0 }

/* Compressa: restano solo le icone */
.sidebar.compressa { width: 62px }
.sidebar.compressa .label, .sidebar.compressa .navgrp { display: none }
.sidebar.compressa .navlink, .sidebar.compressa .sb-bottom button { justify-content: center }
.sidebar.compressa .sb-brand { justify-content: center }
.sidebar.compressa .brand img { height: 26px }

.mobilebar { display: none }
.sb-velo { display: none }

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
  min-width: 0;
}
.brand:hover { text-decoration: none }
.brand img {
  height: 32px;
  width: auto;
  object-fit: contain;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1 }
.brand-text .app-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.brand-text .org-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
/* Se non c'è logo mostra il testo "OPTA" con accent verde */
.brand-wordmark { font-size: 18px; font-weight: 800; color: var(--ink) }
.brand-wordmark span { color: var(--primary) }

/* ——— Layout ——— */
.container { max-width: 1000px; margin: 28px auto; padding: 0 22px }

/* ——— Page head ——— */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

/* ——— Pulsanti ——— */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  color: var(--ink-2);
  padding: 7px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
  transition: border-color .15s, background .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; box-shadow: var(--sh) }
.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 1px 3px rgba(22,163,74,.25);
}
.btn.primary:hover { background: var(--primary-d); border-color: var(--primary-d); color: #fff }
.btn[disabled], .btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none }
.btn.danger { color: var(--red); border-color: #fca5a5 }
.btn.danger:hover { background: var(--red); border-color: var(--red); color: #fff }
.inline-form { display: inline }

/* ——— Cards statistiche ——— */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin: 20px 0;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--sh);
}
.card .num { font-size: 32px; font-weight: 800; letter-spacing: -.01em; line-height: 1 }
.card .lbl { color: var(--muted); font-size: 12.5px; font-weight: 500; margin-top: 6px }
.card.amber .num { color: var(--amber) }
.card.amber { border-left: 3px solid var(--amber); background: var(--amber-light) }
.card.green .num { color: var(--primary) }
.card.green { border-left: 3px solid var(--primary); background: var(--primary-xl) }
.card.red .num { color: var(--red) }
.card.red { border-left: 3px solid var(--red); background: var(--red-light) }

/* ——— Tabelle ——— */
.tbl {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--sh);
}
.tbl th, .tbl td {
  text-align: left;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.tbl th {
  background: #f9fafb;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.tbl tr:last-child td { border-bottom: none }
.tbl tbody tr:hover { background: #f9fafb }

/* ——— Form ——— */
.form p { margin: 0 0 14px }
.form label { display: block; font-weight: 500; font-size: 13.5px; margin-bottom: 5px; color: var(--ink-2) }
.form input, .form select, .form textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}
.form input[type=checkbox], .form input[type=radio] { width: auto; padding: 0; margin: 0; flex: none }
#id_tipi_contenuti { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px,1fr)); gap: 8px; margin: 8px 0 }
#id_tipi_contenuti > div { display: flex }
#id_tipi_contenuti label { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 0; cursor: pointer }
.form .helptext { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.4 }
.actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; align-items: center }

/* ——— Panel ——— */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0 }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--sh);
}
.panel p { margin: 6px 0 }
.panel.next { border-style: dashed; border-color: var(--primary-tag); background: var(--primary-xl) }
.panel.next h3 { color: var(--primary) }

/* ——— Messaggi flash ——— */
.messages { list-style: none; padding: 0; margin: 0 0 18px }
.msg {
  padding: 10px 16px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.msg.success { border-color: #86efac; background: var(--green-light); color: #166534 }
.msg.error { border-color: #fca5a5; background: var(--red-light); color: #991b1b }
.msg.info { border-color: #bfdbfe; background: #eff6ff; color: #1e40af }
.msg.warning { border-color: #fde68a; background: var(--amber-light); color: #92400e }

/* ——— Login ——— */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 50%, #f8fafc 100%);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 36px 32px 32px;
  box-shadow: var(--sh-md);
}
.login-logo { text-align: center; margin-bottom: 24px }
.login-logo img { height: 52px; width: auto; object-fit: contain }
.login-logo .wordmark { font-size: 22px; font-weight: 800; color: var(--ink) }
.login-logo .wordmark span { color: var(--primary) }
.login-app { text-align: center; margin-bottom: 20px }
.login-app .badge {
  display: inline-block;
  background: var(--primary-xl);
  color: var(--primary);
  border: 1px solid var(--primary-tag);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 3px 12px;
}
.login-card label { display: block; margin: 14px 0 0; font-weight: 500; font-size: 13.5px; color: var(--ink-2) }
.login-card input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line-2);
  border-radius: 8px; font: inherit; font-size: 14px; margin-top: 5px;
  transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}
.login-card .btn { width: 100%; margin-top: 22px; justify-content: center; padding: 10px }

/* ——— CTA row (dashboard) ——— */
.cta-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 18px 0 }
.cta {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 22px;
  text-decoration: none; color: var(--ink);
  box-shadow: var(--sh);
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.cta:hover { border-color: var(--primary); text-decoration: none; box-shadow: var(--sh-md); transform: translateY(-2px) }
.cta .ic { font-size: 28px; margin-bottom: 2px }
.cta .t { font-weight: 700; font-size: 15px; color: var(--ink) }
.cta .d { color: var(--muted); font-size: 13px; line-height: 1.45 }

/* ——— Badge/Pill ——— */
.pill {
  display: inline-block; font-size: 11.5px; padding: 2px 8px;
  border-radius: 999px; background: #f3f4f6; border: 1px solid var(--line-2); color: var(--muted);
}
.pill.green { background: var(--primary-xl); border-color: var(--primary-tag); color: #166534 }
.pill.red { background: var(--red-light); border-color: #fca5a5; color: #991b1b }
.pill.amber { background: var(--amber-light); border-color: #fde68a; color: #92400e }

/* ——— Preview iframe ——— */
.preview-frame { width: 100%; height: 640px; border: 1px solid var(--line); border-radius: 8px; background: #fff }
details.panel summary { cursor: pointer; font-weight: 500 }

/* ——— Media grid ——— */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin: 14px 0 }
.media-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--sh);
}
.media-card img { width: 100%; height: 140px; object-fit: cover; border-radius: 6px; background: #f0f2f4 }
/* I video si vedono INTERI: con «cover» un verticale 9:16 veniva tagliato a fettina,
   nell'anteprima e anche a schermo intero. Fondo scuro perche' le bande laterali di un
   verticale su riquadro largo si notano meno del grigio chiaro. */
.media-card video { width: 100%; height: auto; max-height: 460px; object-fit: contain;
  border-radius: 6px; background: #14161a; display: block; margin: 0 auto }
.media-file {
  height: 140px; display: flex; align-items: center; justify-content: center;
  background: var(--bg); border-radius: 6px; font-size: 13px; color: var(--muted);
  text-align: center; padding: 8px; word-break: break-all;
}
.media-meta { font-size: 13px; flex: 1 }
.media-card .btn { align-self: flex-start; padding: 5px 10px; font-size: 12.5px }

/* ——— Misc ——— */
.brief-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; white-space: pre-wrap; font-size: 14px; line-height: 1.65 }
.domande { margin: 0; padding-left: 18px }
.domande li { margin-bottom: 6px }
code { font-family: ui-monospace, "Cascadia Code", monospace; font-size: 12.5px; background: #f3f4f6; padding: 1px 5px; border-radius: 4px; color: var(--ink-2) }

/* ——— Archivio Asset ——— */
.filtri { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 16px 0 12px }
.filtri-riga { display: flex; gap: 10px; flex-wrap: wrap; align-items: center }
.filtri input[type=search] { flex: 1 1 280px; min-width: 200px; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 8px; font: inherit; background: #fff }
.filtri input[type=search]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tag) }
.filtri select { padding: 9px 10px; border: 1px solid var(--line-2); border-radius: 8px; font: inherit; background: #fff }

.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 8px 0 }
.chips-lbl { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-right: 4px }
.chip {
  display: inline-flex; gap: 5px; align-items: center; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); font-size: 12.5px; text-decoration: none;
}
.chip:hover { border-color: var(--primary); color: var(--primary); text-decoration: none }
.chip b { color: var(--muted); font-weight: 600; font-size: 11.5px }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff }
.chip.on b { color: rgba(255,255,255,.75) }

.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin: 14px 0 }
.asset-card {
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden; text-decoration: none; color: inherit; transition: .12s;
}
.asset-card:hover { border-color: var(--primary); box-shadow: var(--sh-md); text-decoration: none; transform: translateY(-2px) }
.asset-thumb { position: relative; height: 132px; background: #f1f5f9; display: flex; align-items: center; justify-content: center }
.asset-thumb img, .asset-thumb video { width: 100%; height: 100%; object-fit: cover }
.asset-thumb .ic { font-size: 40px; opacity: .55 }
.badge-tipo {
  position: absolute; left: 8px; bottom: 8px; background: rgba(17,24,39,.82); color: #fff;
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
}
.badge-arch { position: absolute; right: 8px; top: 8px; background: var(--red); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 999px }
.asset-body { padding: 11px 12px 13px; display: flex; flex-direction: column; gap: 5px; flex: 1 }
.asset-body b { font-size: 14px; line-height: 1.3 }
.small { font-size: 12px }
.asset-desc { font-size: 12.5px; color: var(--ink-2); line-height: 1.45 }
.asset-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 2px }
.tagline {
  font-size: 11px; background: var(--bg); border: 1px solid var(--line); color: var(--muted);
  padding: 1px 7px; border-radius: 999px; text-decoration: none;
}
a.tagline:hover { border-color: var(--primary); color: var(--primary); text-decoration: none }
.asset-uso { margin-top: auto; padding-top: 6px }
.rinomina summary { cursor: pointer; padding: 2px 0 }
.rinomina .form input { margin-bottom: 6px }

/* ——— Responsive ——— */

/* Sotto gli 860px la sidebar diventa un cassetto: fuori schermo, entra col tasto ☰ della
   barra in alto e si chiude toccando il velo. Il velo serve anche a non lasciare la pagina
   scorrevole sotto il menù aperto. */
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0; width: 250px; height: 100vh;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: var(--sh-md);
  }
  .sidebar.aperta { transform: translateX(0) }
  .sidebar.compressa { width: 250px }
  .sidebar.compressa .label, .sidebar.compressa .navgrp { display: revert }
  .sidebar.compressa .navlink, .sidebar.compressa .sb-bottom button, .sidebar.compressa .sb-brand { justify-content: flex-start }
  .sidebar.compressa .sb-brand { justify-content: space-between }

  .sb-velo {
    display: block; position: fixed; inset: 0; z-index: 50;
    background: rgba(17, 24, 39, .45);
    opacity: 0; pointer-events: none; transition: opacity .22s;
  }
  .sb-velo.visibile { opacity: 1; pointer-events: auto }

  .mobilebar {
    display: flex; align-items: center; gap: 10px;
    background: var(--panel); border-bottom: 1px solid var(--line);
    border-top: 3px solid var(--primary);
    padding: 8px 14px; position: sticky; top: 0; z-index: 40;
  }
  .mobilebar .ham {
    background: none; border: none; cursor: pointer;
    font-size: 22px; line-height: 1; color: var(--ink-2); padding: 2px 6px;
  }
  .mb-titolo { font-size: 13px; font-weight: 700; color: var(--primary); letter-spacing: .06em; text-transform: uppercase }
  .container { margin: 18px auto }
}

@media (max-width: 720px) {
  .grid2, .cta-row { grid-template-columns: 1fr }
  .asset-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px }
  .filtri-riga input[type=search] { flex: 1 1 100% }
  .container { padding: 0 14px }
}

/* ═══════════════════════════════════════════════════════════════════════
   PAGINE DI ANALISI (Ads, Analytics, Briefing, Funnel)
   Queste classi erano usate nei template ma non erano mai state definite:
   senza stile i numeri e le etichette finivano incollati come testo semplice.
   ═══════════════════════════════════════════════════════════════════════ */

/* ——— Navigazione a schede (sotto-menu delle pagine di analisi) ——— */
.stats-submenu {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 18px 0 0;
  border-bottom: 2px solid var(--line);
  padding-bottom: 0;
}
.stats-submenu a {
  padding: 9px 15px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-radius: 8px 8px 0 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color .12s, background .12s;
}
.stats-submenu a:hover { color: var(--ink); background: #f9fafb }
.stats-submenu a.is-active {
  color: var(--primary-d);
  border-bottom-color: var(--primary);
  font-weight: 600;
  background: var(--primary-xl);
}

/* ——— Riquadri dei numeri chiave ——— */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}
/* Il numero: tabellare, così le cifre restano incolonnate fra riquadri diversi */
.stat-n {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.stat-l {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
/* Variante per il dato più importante della pagina */
.stat-tile.principale {
  background: var(--primary-xl);
  border-color: var(--primary-tag);
}
.stat-tile.principale .stat-n { color: var(--primary-d) }
/* Il denominatore accanto al numero grande ("3/10"): un dato da solo mente, il totale no */
.stat-su { font-size: 16px; font-weight: 600; color: var(--muted) }

/* Confronto col periodo precedente */
.delta { font-size: 12px; font-weight: 600 }
.delta.su   { color: var(--primary-d) }
.delta.giu  { color: var(--red) }
.delta.pari { color: var(--muted) }

/* ——— Tabelle di dati: numeri leggibili e incolonnati ——— */
.tbl td.num, .tbl th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tbl td.num { font-size: 14px }
.tbl .forte { font-weight: 700; color: var(--ink) }
.tbl .vuoto { color: var(--line-2) }
/* Prima colonna (il nome): non deve spingere fuori le altre */
.tbl td.nome {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.tbl tr.totali td {
  background: #f9fafb;
  font-weight: 700;
  border-top: 2px solid var(--line-2);
}
.tavola-scroll { overflow-x: auto; margin: 0 -16px; padding: 0 16px }

/* Barra proporzionale dentro una cella (colpo d'occhio sui volumi) */
.barra { display: block; height: 4px; border-radius: 2px; background: var(--line); margin-top: 5px }
.barra > i { display: block; height: 100%; border-radius: 2px; background: var(--primary) }

/* ——— Etichette ——— */
.badge-fonte {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-fonte.meta   { background: #e7f0ff; color: #1d4ed8 }
.badge-fonte.google { background: #fef3c7; color: #b45309 }
.badge-fonte.social { background: #fce7f3; color: #be185d }

/* ——— Nota/avvertenza compatta (al posto dei paragrafi lunghi) ——— */
.nota {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 14px;
  border-radius: 9px;
  font-size: 13px;
  line-height: 1.5;
  background: #f9fafb;
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.nota .ic { flex: 0 0 auto; font-size: 15px; line-height: 1.3 }
.nota.attenzione { background: var(--amber-light); border-color: #fde68a; color: #92400e }
.nota.problema   { background: var(--red-light); border-color: #fecaca; color: #991b1b }

/* Dettagli richiudibili: la spiegazione lunga c'è, ma non ingombra */
.spiega { margin-top: 12px; font-size: 12.5px; color: var(--muted) }
.spiega > summary {
  cursor: pointer;
  color: var(--ink-2);
  font-weight: 500;
  padding: 4px 0;
  list-style: none;
}
.spiega > summary::before { content: "▸ "; color: var(--muted) }
.spiega[open] > summary::before { content: "▾ " }
.spiega > div { padding: 8px 0 0 14px; line-height: 1.6 }

/* ——— Qualità del dato: quanto è tracciato davvero ——— */
.copertura {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: 9px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 13px;
}
.copertura .misura {
  flex: 1 1 160px;
  height: 7px;
  border-radius: 4px;
  background: var(--line);
  overflow: hidden;
  min-width: 120px;
}
.copertura .misura > i { display: block; height: 100%; background: var(--primary) }
.copertura .misura.bassa > i { background: var(--amber) }
.copertura .valore { font-weight: 700; font-variant-numeric: tabular-nums }

.mini { font-size: 11.5px }

@media (max-width: 700px) {
  .stat-row { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 9px }
  .stat-n { font-size: 21px }
  .stat-tile { padding: 11px 12px }
  .tbl td.nome { max-width: 150px }
  .stats-submenu a { padding: 8px 11px; font-size: 12.5px }
}

/* ═══════════════════════════════════════════════════════════════════════
   TESTO SECONDARIO — .muted era definita solo come VARIABILE colore
   (--muted) ma mai come classe, mentre i template la usano ovunque
   (class="muted"): le didascalie avevano lo stesso peso del testo
   principale, ed è il motivo per cui le pagine sembravano "tutto attaccato".
   ═══════════════════════════════════════════════════════════════════════ */
.muted { color: var(--muted); font-size: 13px; line-height: 1.5 }
.muted b, .muted strong { color: var(--ink-2) }
a.muted:hover { color: var(--ink-2) }

/* ——— Esiti dello screening (ammissibile / non ammissibile / nurturing) ——— */
.esito-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: #f3f4f6;
  color: var(--ink-2);
  white-space: nowrap;
}
.esito-pill b { font-weight: 700 }
.esito-ammissibile,  .esito-idoneo    { background: var(--primary-tag); color: var(--primary-d) }
.esito-nonammissibile, .esito-non_ammissibile,
.esito-nonidoneo     { background: #fee2e2; color: var(--red) }
.esito-nurturing     { background: var(--amber-light); color: #92400e }

/* ——— Grafico a barre degli accessi giornalieri ——— */
.serie {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 90px;
  padding: 8px 0 0;
  border-bottom: 1px solid var(--line);
}
.serie-col {
  flex: 1 1 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
  min-width: 3px;
  cursor: default;
}
.serie-bar {
  width: 100%;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  opacity: .8;
  transition: opacity .12s;
}
.serie-col:hover .serie-bar { opacity: 1 }
.serie-x {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
}

/* ——— Barra orizzontale (classifiche: pagine viste, provenienze) ——— */
.bar { display: block; height: 5px; border-radius: 3px; background: var(--line); margin-top: 4px }
.barw { display: block; height: 100%; border-radius: 3px; background: var(--primary) }

/* ——— Selettore di periodo a pillole ——— */
.pchip {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  background: #f3f4f6;
  text-decoration: none;
  border: 1px solid transparent;
}
.pchip:hover { background: var(--line) }
.pchip.on { background: var(--primary); color: #fff; font-weight: 600 }

/* ——— Dettaglio di un singolo sito ——— */
.sd-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.sd-periodo { display: flex; gap: 6px; align-items: center; flex-wrap: wrap }
.sd-periodo input[type=date] {
  padding: 4px 9px;
  border: 1px solid var(--line-2);
  border-radius: 20px;
  font: inherit;
  font-size: 12.5px;
}
.sd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px }
@media (max-width: 760px) { .sd-grid { grid-template-columns: 1fr; gap: 16px } }
