/* ============================================================
   Il Diario di Lampedusa — Dashboard Insights
   Palette "Mare" su sfondo chiaro, design pulito per laptop/tablet.
   Solo CSS, no librerie.
   ============================================================ */

:root {
  --bg:              #f5fafd;
  --white:           #ffffff;
  --turquoise:       #4dd0e1;
  --turquoise-soft:  #b2ebf2;
  --sea-blue:        #0288d1;
  --sea-blue-dark:   #0277bd;
  --sun-yellow:      #ffd54f;
  --navy:            #0b1e4c;
  --ink:             #1a2b4a;
  --muted:           #5b6577;
  --border:          #e2eef3;
  --success:         #16a34a;
  --positive-trend:  var(--success);
  --bar-1:           var(--sea-blue);
  --bar-2:           var(--turquoise);
  --bar-3:           var(--sun-yellow);
  --bar-4:           #7e57c2;
  --bar-5:           #ef6c00;
  --shadow-sm:       0 1px 2px rgba(11, 30, 76, 0.06);
  --shadow-md:       0 4px 14px rgba(11, 30, 76, 0.08);
  --shadow-lg:       0 8px 28px rgba(11, 30, 76, 0.12);
  --font-display:    'Satisfy', 'Brush Script MT', cursive;
  --font-body:       'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.45;
}

a { color: var(--sea-blue); text-decoration: none; }

/* ============================================================
   HEADER TOP
   ============================================================ */
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex; align-items: center; gap: 24px;
  position: sticky; top: 0; z-index: 30;
  box-shadow: var(--shadow-sm);
}
.topbar .brand {
  display: flex; flex-direction: column;
  line-height: 1;
}
.topbar .brand .title {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--sea-blue);
}
.topbar .brand .sub {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}
.topbar .spacer { flex: 1; }
.topbar .period-select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}
.topbar .btn-export {
  background: var(--sea-blue);
  color: var(--white);
  border: 0;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.topbar .btn-export:hover { background: var(--sea-blue-dark); }

/* ============================================================
   LAYOUT
   ============================================================ */
.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 28px 48px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 12px;
  display: flex; align-items: center; gap: 10px;
}
.section-title .hint {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

/* ============================================================
   CARD
   ============================================================ */
.card {
  background: var(--white);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-md);
  margin-bottom: 18px;
}
.card.tight { padding: 16px; }
.card h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.01em;
}
.card h3 .sub {
  font-weight: 400;
  font-size: 12px;
  color: var(--muted);
  margin-left: 6px;
}

/* ============================================================
   KPI ROW
   ============================================================ */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.kpi {
  background: var(--white);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: var(--shadow-md);
  border-left: 4px solid var(--sea-blue);
}
.kpi.kpi-2 { border-left-color: var(--turquoise); }
.kpi.kpi-3 { border-left-color: var(--sun-yellow); }
.kpi.kpi-4 { border-left-color: var(--bar-4); }
.kpi .label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.kpi .value {
  font-size: 32px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.1;
  margin-top: 6px;
}
.kpi .trend {
  font-size: 12px;
  margin-top: 4px;
  color: var(--positive-trend);
  font-weight: 600;
}
.kpi .trend.neutral { color: var(--muted); }

/* ============================================================
   GRID DEMOGRAFIE (3 colonne)
   ============================================================ */
.demo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
@media (max-width: 980px) {
  .demo-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-row   { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .demo-grid { grid-template-columns: 1fr; }
  .kpi-row   { grid-template-columns: 1fr; }
}

/* ============================================================
   BAR CHART ORIZZONTALE (CSS puro)
   ============================================================ */
.barlist { display: flex; flex-direction: column; gap: 8px; }
.barlist .row {
  display: grid;
  grid-template-columns: 90px 1fr 42px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.barlist .row .lbl {
  color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.barlist .row .bar-bg {
  background: var(--bg);
  border-radius: 6px;
  height: 14px;
  overflow: hidden;
}
.barlist .row .bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sea-blue), var(--turquoise));
  border-radius: 6px;
  transition: width .4s ease;
}
.barlist .row .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-weight: 600;
}

/* variante palette */
.barlist.warm .row .bar-fill { background: linear-gradient(90deg, var(--bar-5), var(--sun-yellow)); }
.barlist.purple .row .bar-fill { background: linear-gradient(90deg, var(--bar-4), var(--turquoise)); }

/* compact (etichette piu' lunghe come citta') */
.barlist.compact .row { grid-template-columns: 110px 1fr 36px; font-size: 12px; }

/* ============================================================
   DONUT (SVG inline)
   ============================================================ */
.donut-wrap {
  display: flex;
  gap: 16px;
  align-items: center;
}
.donut {
  width: 130px; height: 130px;
  flex-shrink: 0;
}
.donut .track { fill: none; stroke: var(--bg); stroke-width: 22; }
.donut .seg   { fill: none; stroke-width: 22; transform-origin: 50% 50%; transform: rotate(-90deg); }
.donut-legend {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 12px;
}
.donut-legend .item {
  display: flex; align-items: center; gap: 8px;
}
.donut-legend .dot {
  width: 10px; height: 10px; border-radius: 50%;
}
.donut-legend .pct {
  margin-left: auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   TABELLA RANKED (citta')
   ============================================================ */
.ranked {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column;
}
.ranked li {
  display: grid;
  grid-template-columns: 22px 1fr 50px;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.ranked li:last-child { border-bottom: 0; }
.ranked .rk {
  font-weight: 700;
  color: var(--sea-blue);
  font-variant-numeric: tabular-nums;
}
.ranked .ct {
  text-align: right;
  color: var(--muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   LISTA PAESI con flag
   ============================================================ */
.flaglist {
  display: flex; flex-direction: column; gap: 7px;
  font-size: 13px;
}
.flaglist .row {
  display: grid;
  grid-template-columns: 28px 1fr 40px;
  align-items: center;
  gap: 8px;
}
.flaglist .flag { font-size: 20px; line-height: 1; }
.flaglist .ct { text-align: right; color: var(--muted); font-weight: 600; }

/* ============================================================
   CHIPS (tipo viaggiatore)
   ============================================================ */
.chips {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.chip {
  background: var(--turquoise-soft);
  color: var(--navy);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip .count {
  background: var(--white);
  color: var(--sea-blue);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
}

/* ============================================================
   ENGAGEMENT
   ============================================================ */
.engagement-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 2fr;
  gap: 18px;
  align-items: center;
}
.engagement-grid .stat .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.engagement-grid .stat .value {
  font-size: 28px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.1;
}
.engagement-grid .stat .icon {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; margin-right: 6px;
  vertical-align: middle;
}

/* mini bar chart (7 giorni) */
.minichart {
  display: flex; align-items: flex-end;
  gap: 6px;
  height: 70px;
}
.minichart .col {
  flex: 1;
  background: linear-gradient(180deg, var(--turquoise), var(--sea-blue));
  border-radius: 4px 4px 0 0;
  position: relative;
  min-height: 6px;
}
.minichart .col .v {
  position: absolute; top: -16px; left: 50%;
  transform: translateX(-50%);
  font-size: 10px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.minichart .col .d {
  position: absolute; bottom: -16px; left: 50%;
  transform: translateX(-50%);
  font-size: 10px; color: var(--muted);
}
.minichart-wrap { padding: 14px 4px 22px; }

@media (max-width: 980px) {
  .engagement-grid { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   HEATMAP (7 giorni x 24 ore)
   ============================================================ */
.heatmap {
  display: grid;
  grid-template-columns: 50px repeat(24, 1fr);
  gap: 3px;
  font-size: 10px;
}
.heatmap .hdr {
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  padding: 2px 0;
}
.heatmap .hdr-day {
  text-align: right;
  padding-right: 8px;
  color: var(--muted);
  font-weight: 600;
  display: flex; align-items: center; justify-content: flex-end;
}
.heatmap .cell {
  height: 22px;
  border-radius: 3px;
  background: var(--bg);
  transition: transform .15s;
}
.heatmap .cell:hover { transform: scale(1.4); z-index: 2; box-shadow: var(--shadow-md); }
.heatmap-legend {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--muted);
  margin-top: 12px;
  justify-content: flex-end;
}
.heatmap-legend .scale {
  display: inline-flex;
  gap: 2px;
}
.heatmap-legend .scale span {
  width: 18px; height: 12px; border-radius: 2px;
}

/* ============================================================
   TABELLA TOP ATTIVITA'
   ============================================================ */
.table-wrap { overflow-x: auto; }
table.activities {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.activities thead th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
table.activities thead th:hover { color: var(--sea-blue); }
table.activities thead th .arrow { opacity: .35; margin-left: 4px; }
table.activities thead th.sort-asc .arrow,
table.activities thead th.sort-desc .arrow { opacity: 1; color: var(--sea-blue); }

table.activities tbody tr {
  cursor: pointer;
  transition: background .15s;
}
table.activities tbody tr:hover { background: var(--bg); }
table.activities tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
table.activities tbody td.title {
  font-weight: 600;
  color: var(--navy);
}
table.activities tbody td.cat {
  color: var(--muted);
  font-size: 12px;
}
table.activities tbody td.conv {
  color: var(--success);
  font-weight: 600;
}

/* ============================================================
   FOOTER CTA
   ============================================================ */
.cta-pack {
  background: linear-gradient(135deg, var(--sea-blue), var(--turquoise));
  color: var(--white);
  border-radius: 12px;
  padding: 28px 32px;
  display: flex; align-items: center; gap: 28px;
  box-shadow: var(--shadow-lg);
}
.cta-pack .text { flex: 1; }
.cta-pack h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 32px;
}
.cta-pack p { margin: 0; opacity: 0.95; }
.cta-pack .packs {
  display: flex; gap: 10px;
  flex-wrap: wrap;
}
.cta-pack .pack {
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 10px;
  padding: 12px 16px;
  text-align: center;
  backdrop-filter: blur(4px);
}
.cta-pack .pack .name { font-size: 12px; opacity: 0.9; text-transform: uppercase; letter-spacing: 0.1em; }
.cta-pack .pack .price { font-size: 22px; font-weight: 700; margin-top: 4px; }
.cta-pack .pack.featured {
  background: var(--sun-yellow);
  color: var(--navy);
  border-color: var(--sun-yellow);
}

@media (max-width: 760px) {
  .cta-pack { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   STATUS BANNER (backend offline)
   ============================================================ */
.status-banner {
  background: #fff7e6;
  border: 1px solid #ffd54f;
  color: #7a5a00;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12px;
  margin-bottom: 14px;
  display: none;
}
.status-banner.visible { display: block; }

/* ============================================================
   PAGINA ATTIVITA' (attivita.html)
   ============================================================ */
.activity-hero {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  align-items: center;
}
.activity-hero img {
  width: 100%; height: 180px;
  object-fit: cover;
  border-radius: 12px;
}
.activity-hero .meta { flex: 1; }
.activity-hero h1 {
  margin: 0 0 6px;
  font-size: 26px;
  color: var(--navy);
}
.activity-hero .cat-line {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}
.activity-hero .badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  background: var(--turquoise-soft);
  color: var(--navy);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
}

@media (max-width: 760px) {
  .activity-hero { grid-template-columns: 1fr; }
  .activity-hero img { height: 160px; }
}

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--sea-blue); font-weight: 600;
  font-size: 13px;
  margin-bottom: 14px;
}
.back-link:hover { color: var(--sea-blue-dark); }

/* funnel */
.funnel { display: flex; flex-direction: column; gap: 6px; }
.funnel .step {
  display: grid;
  grid-template-columns: 110px 1fr 80px;
  align-items: center;
  gap: 10px;
}
.funnel .step .lbl { font-size: 13px; font-weight: 600; color: var(--ink); }
.funnel .step .bar {
  background: linear-gradient(90deg, var(--sea-blue), var(--turquoise));
  height: 28px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 10px;
  color: var(--white);
  font-weight: 700;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  min-width: 40px;
}
.funnel .step .pct {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.funnel .step.s2 .bar { background: linear-gradient(90deg, var(--turquoise), var(--sun-yellow)); }
.funnel .step.s3 .bar { background: linear-gradient(90deg, var(--sun-yellow), var(--bar-5)); }

/* ============================================================
   VERTICAL BAR CHART (timeline viaggi + peak hours)
   ============================================================ */
.vbar-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 200px;
  padding: 18px 8px 28px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.vbar-chart .vcol {
  flex: 1;
  position: relative;
  min-height: 8px;
  background: linear-gradient(180deg, var(--turquoise), var(--sea-blue));
  border-radius: 6px 6px 0 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 6px;
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: filter .15s;
  cursor: default;
}
.vbar-chart .vcol:hover { filter: brightness(1.08); }
.vbar-chart .vcol.peak {
  background: linear-gradient(180deg, var(--sun-yellow), var(--bar-5));
  color: var(--navy);
}
.vbar-chart .vcol .vlbl {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.vbar-chart-mini { height: 140px; gap: 4px; padding: 12px 4px 26px; }
.vbar-chart-mini .vcol { font-size: 10px; padding-top: 3px; border-radius: 4px 4px 0 0; }
.vbar-chart-mini .vcol .vlbl { font-size: 10px; bottom: -20px; }

.card-insight {
  margin: 14px 0 0;
  padding: 12px 14px;
  background: var(--bg);
  border-left: 3px solid var(--sea-blue);
  border-radius: 6px;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.55;
}
.card-cta {
  margin-top: 14px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: linear-gradient(90deg, rgba(2,136,209,0.08), rgba(77,208,225,0.08));
  border: 1px dashed var(--turquoise);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--ink);
}
.card-cta.cta-top {
  background: linear-gradient(90deg, rgba(255,213,79,0.18), rgba(239,108,0,0.10));
  border-color: var(--sun-yellow);
}
.pack-tag {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--sea-blue);
  color: var(--white);
}
.pack-tag.pack-top {
  background: var(--sun-yellow);
  color: var(--navy);
}

/* ============================================================
   ACQUISITION CARD
   ============================================================ */
.acquisition-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: center;
}
.acq-donut h3 { margin-bottom: 14px; }
.acq-kpis { display: flex; flex-direction: column; gap: 12px; }
.kpi-mini {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg);
  border-radius: 10px;
  padding: 14px 16px;
  border-left: 4px solid var(--sea-blue);
}
.kpi-mini-ig { border-left-color: var(--bar-4); }
.kpi-mini-org { border-left-color: var(--turquoise); }
.kpi-mini-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--white);
  color: var(--sea-blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.kpi-mini-ig .kpi-mini-icon { color: var(--bar-4); }
.kpi-mini-org .kpi-mini-icon { color: var(--turquoise); }
.kpi-mini-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.kpi-mini-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.1;
}

@media (max-width: 760px) {
  .acquisition-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   SESSION STATS
   ============================================================ */
.session-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.4fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}
.session-kpi-row {
  display: flex; flex-direction: column; gap: 14px;
}
.session-kpi {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px 14px;
  border-left: 4px solid var(--sea-blue);
}
.session-kpi .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.session-kpi .value {
  font-size: 26px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.1;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.session-kpi .hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
@media (max-width: 980px) {
  .session-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   HOT LEADS TABLE
   ============================================================ */
table.hot-leads {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.hot-leads thead th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
table.hot-leads thead th:hover { color: var(--sea-blue); }
table.hot-leads thead th .arrow { opacity: .35; margin-left: 4px; }
table.hot-leads thead th.sort-asc .arrow,
table.hot-leads thead th.sort-desc .arrow { opacity: 1; color: var(--sea-blue); }
table.hot-leads tbody tr {
  transition: background .15s;
}
table.hot-leads tbody tr:hover { background: var(--bg); }
table.hot-leads tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.hot-leads tbody td.lead-name {
  font-weight: 600;
}
table.hot-leads tbody td.lead-name a {
  color: var(--navy);
  text-decoration: none;
}
table.hot-leads tbody td.lead-name a:hover { color: var(--sea-blue); }
table.hot-leads tbody td.lead-name small {
  display: block;
  color: var(--muted);
  font-weight: 400;
  font-size: 11px;
  margin-top: 2px;
}
.lead-traveler {
  display: inline-block;
  background: var(--turquoise-soft);
  color: var(--navy);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
}
.lead-dates { font-size: 12px; color: var(--ink); white-space: nowrap; }
.engagement-badge {
  display: inline-block;
  min-width: 42px;
  text-align: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--white);
}
.engagement-badge.hi  { background: var(--success); }
.engagement-badge.mid { background: var(--sun-yellow); color: var(--navy); }
.engagement-badge.low { background: var(--muted); }
.lead-acts {
  display: flex; flex-wrap: wrap; gap: 4px;
  max-width: 320px;
}
.lead-act-chip {
  background: var(--bg);
  color: var(--navy);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
}
.lead-act-chip strong {
  color: var(--sea-blue);
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   NEWSLETTER SECTION
   ============================================================ */
.newsletter-section {
  background: linear-gradient(135deg, #f5fafd 0%, #e8f5fa 100%);
  border-left: 4px solid var(--sea-blue);
}
.newsletter-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.kpi-news {
  background: var(--white);
  border-radius: 10px;
  padding: 14px 18px;
  border-left: 4px solid var(--sea-blue);
  display: flex; flex-direction: column;
}
.kpi-news-2 { border-left-color: var(--turquoise); }
.kpi-news-3 { border-left-color: var(--sun-yellow); }
.kpi-news-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.kpi-news-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.1;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.newsletter-segments {
  background: var(--white);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 16px;
}
.newsletter-segments h3 { margin-bottom: 6px; }
.newsletter-segments p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}
.segments-list {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.segment-chip {
  background: var(--sea-blue);
  color: var(--white);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
}
.segment-chip.seg-2 { background: var(--turquoise); color: var(--navy); }
.segment-chip.seg-3 { background: var(--sun-yellow); color: var(--navy); }
.segment-chip.seg-4 { background: var(--bar-4); }
.segment-chip.seg-5 { background: var(--bar-5); }
.newsletter-actions {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: filter .15s, background .15s;
}
.btn-primary {
  background: var(--sea-blue);
  color: var(--white);
}
.btn-primary:hover { background: var(--sea-blue-dark); }
.btn-ghost {
  background: var(--white);
  color: var(--sea-blue);
  border: 1px solid var(--sea-blue);
}
.btn-ghost:hover { background: var(--bg); }

@media (max-width: 760px) {
  .newsletter-stats { grid-template-columns: 1fr; }
}

/* ============================================================
   MODALE
   ============================================================ */
.modal {
  position: fixed; inset: 0;
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(11, 30, 76, 0.45);
  backdrop-filter: blur(2px);
}
.modal-panel {
  position: relative;
  background: var(--white);
  border-radius: 14px;
  width: 100%;
  max-width: 720px;
  max-height: 80vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-head {
  display: flex; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; }
.modal-close {
  margin-left: auto;
  background: transparent;
  border: 0;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.modal-close:hover { color: var(--navy); }
.modal-body {
  overflow-y: auto;
  padding: 16px 20px;
}
.subscribers-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.subscribers-table thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 2px solid var(--border);
}
.subscribers-table tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.subscribers-table tbody tr:hover { background: var(--bg); }
