/* ============================================================
   Bellerofonte — Social Intelligence Platform
   Nuovo design system (da handoff Claude Design, tmp/project/)
   Tutte le classi sono prefissate `bf-` per coesistere con
   Bulma e i CSS legacy durante la migrazione.
   ============================================================ */

:root {
  /* Neutrals */
  --page: #f5f7f9;      /* sfondo app — dietro rail, panel & frame */
  --canvas: #f5f7f9;    /* superficie card (dentro il frame bianco) */
  --frame: #ffffff;     /* frame principale */
  --frame-line: #dde1e4;
  --panel: #ffffff;
  --card: #f5f7f9;
  --ink: #1a1a1a;
  --ink-2: #6b6860;
  --ink-3: #9a9ea1;
  --ink-4: #b6babe;
  --line: #e4e7eb;
  --line-2: #eceef1;
  --rail: #1a1a1a;
  --rail-hover: #2a2a2a;
  --rail-ink: #7c7f83;

  /* AI / purple */
  --ai-deep: #31135e;
  --ai-deep-2: #3d1c6e;
  --ai-accent: #8a38f5;
  --ai-soft: #d4bbff;
  --ai-btn: #6929c4;
  --ai-btn-hover: #5a22ab;
  --ai-chip-bg: #efe9fc;
  --ai-chip-ink: #6929c4;

  /* Semantic */
  --green: #2d7d52;
  --green-soft: #e7f3ec;
  --red: #d6402f;
  --red-strong: #da1e28;
  --red-soft: #fef0f0;
  --red-line: #f3b6b1;
  --amber: #b5790f;
  --amber-dot: #f0a818;
  --amber-soft: #fdf6e6;
  --amber-line: #f0deb0;
  --brand: #ef4b25;

  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;

  --shadow-card: 0 1px 2px rgba(26, 26, 26, 0.04);
  --shadow-pop: 0 12px 30px rgba(26, 26, 26, 0.12);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Sans", var(--font);
}

html.bf-root {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--page);
}
body.bf-body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--page);
  font-family: var(--font);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.bf-app * { box-sizing: border-box; }
.bf-app button { font-family: inherit; cursor: pointer; }
body.bf-body ::selection { background: var(--ai-soft); }

/* Focus ring accessibile per navigazione da tastiera */
body.bf-body :focus-visible {
  outline: 2px solid var(--ai-accent);
  outline-offset: 2px;
  border-radius: 6px;
}
.bf-rail-btn:focus-visible { outline-offset: -2px; }

/* ---------- App shell: full viewport ---------- */
.bf-app {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  background: var(--page);
  display: flex;
  gap: 26px;
  padding: 10px;
  align-items: stretch;
  overflow: hidden;
  font-family: var(--font);
}

/* ---------- Rail scura primaria ---------- */
.bf-rail {
  width: 80px;
  flex: 0 0 auto;
  background: var(--rail);
  border-radius: 15px;
  padding: 14px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  align-self: stretch;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width .26s ease;
}
.bf-rail.expanded { width: max-content; align-items: stretch; }

.bf-rail-toggle {
  width: 44px; height: 32px;
  border-radius: 999px;
  border: 1px solid #3a3a3a;
  background: transparent;
  color: #cfd1d4;
  display: flex; align-items: center; justify-content: center;
  align-self: center;
  flex: 0 0 auto;
  transition: background .15s, border-color .15s, width .26s ease;
}
.bf-rail-toggle:hover { background: #262626; border-color: #4a4a4a; }
.bf-rail-toggle svg { transition: transform .26s ease; }
.bf-rail.expanded .bf-rail-toggle { width: 100%; align-self: stretch; }
.bf-rail.expanded .bf-rail-toggle svg { transform: rotate(180deg); }

.bf-rail-nav {
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; margin-top: 6px;
}
.bf-rail.expanded .bf-rail-nav { align-items: stretch; align-self: stretch; }
.bf-rail-spacer { flex: 1 1 auto; }
.bf-rail-btn {
  width: 44px; height: 44px;
  border-radius: 12px;
  border: none; background: transparent;
  color: #aeb1b5;
  display: flex; align-items: center; justify-content: center;
  gap: 14px; padding: 0;
  transition: background .15s, color .15s;
  text-decoration: none;
  overflow: hidden; white-space: nowrap;
  flex: 0 0 auto;
}
.bf-rail-btn:hover { background: var(--rail-hover); color: #fff; }
.bf-rail-btn.active { background: #ffffff; color: #1a1a1a; }
.bf-rail-btn svg { width: 22px; height: 22px; flex: 0 0 22px; }
.bf-rail-label {
  display: none;
  font-size: 15px; font-weight: 600; color: inherit;
}
.bf-rail.expanded .bf-rail-btn { width: 100%; justify-content: flex-start; padding: 0 16px; height: 46px; }
.bf-rail.expanded .bf-rail-label { display: inline; }

.bf-rail-logo {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--brand); color: #fff; font-weight: 800; font-size: 22px;
  display: grid; place-items: center; letter-spacing: -1px;
  flex: 0 0 auto;
}

/* ---------- Pannello contestuale chiaro ---------- */
.bf-panel {
  width: 250px;
  flex: 0 0 250px;
  padding: 12px 4px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  align-self: stretch;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}
.bf-panel-section { display: flex; flex-direction: column; gap: 10px; }
.bf-panel-label {
  font-size: 13px; color: var(--ink-3); font-weight: 500;
  padding: 0 6px;
}
.bf-divider { height: 1px; background: var(--line); margin: 2px 6px; flex: 0 0 auto; }

/* link semplici nel pannello (sottosezioni legacy) */
.bf-panel-link {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px; border-radius: 9px;
  font-size: 14px; font-weight: 600; color: var(--ink-2);
  text-decoration: none;
  transition: background .12s, color .12s;
}
.bf-panel-link:hover { background: #ececef; color: var(--ink); }
.bf-panel-link.active { background: #e6e8ec; color: var(--ink); }

/* segmented toggle (24h / 7d, filtri) */
.bf-seg {
  display: inline-flex; gap: 4px;
  background: #e9ebee; border-radius: 10px; padding: 4px;
  align-self: flex-start;
}
.bf-seg button, .bf-seg a {
  border: none; background: transparent;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  padding: 7px 16px; border-radius: 7px; white-space: nowrap;
  text-decoration: none;
  transition: background .15s, color .15s;
  cursor: pointer;
}
.bf-seg button.on, .bf-seg a.on { background: var(--ink); color: #fff; }
.bf-seg.light button.on, .bf-seg.light a.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-card); }

/* righe progetto / liste generiche nel pannello */
.bf-list-row {
  display: flex; align-items: center; gap: 10px;
  justify-content: space-between;
  padding: 11px 12px; border-radius: 10px;
  cursor: pointer; transition: background .12s;
  border: 1px solid transparent;
  text-decoration: none;
}
.bf-list-row:hover { background: #ececef; }
.bf-list-row.active { background: #e6e8ec; border-color: var(--line); }
.bf-list-row .bf-lr-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.bf-list-row .bf-lr-count { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.bf-list-row.active .bf-lr-count { color: var(--ink-2); }
.bf-list-row[hidden] { display: none; }

/* riga progetto con pin: il contenitore prende sfondo/bordo, il link resta
   trasparente perché il pin è un secondo elemento cliccabile accanto. */
.bf-list-item {
  display: flex; align-items: center;
  border-radius: 10px; border: 1px solid transparent;
  transition: background .12s;
}
.bf-list-item:hover { background: #ececef; }
.bf-list-item.active { background: #e6e8ec; border-color: var(--line); }
.bf-list-item[hidden] { display: none; }
.bf-list-item > .bf-list-row {
  flex: 1 1 auto; min-width: 0;
  padding-right: 6px;
}
.bf-list-item > .bf-list-row:hover { background: none; }
.bf-list-item.active .bf-lr-count { color: var(--ink-2); }

.bf-pin-form { display: flex; flex: 0 0 auto; padding-right: 8px; }
.bf-pin {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0;
  background: none; border: none; border-radius: 8px;
  color: var(--ink-4); cursor: pointer;
  opacity: 0; transition: opacity .12s, background .12s, color .12s;
}
.bf-list-item:hover .bf-pin,
.bf-pin:focus-visible { opacity: 1; }
.bf-pin:hover { background: rgba(26, 26, 26, .07); color: var(--ink-2); }
.bf-pin.on { opacity: 1; color: var(--brand); }
.bf-pin.on:hover { color: var(--brand); }
/* senza hover (touch) il pin resta sempre visibile, altrimenti irraggiungibile */
@media (hover: none) {
  .bf-pin { opacity: 1; }
}

/* ricerca live + lista progetti scrollabile nel pannello */
.bf-search-wrap { position: relative; display: flex; align-items: center; }
.bf-search-ic {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--ink-3); pointer-events: none;
}
.bf-search-input.with-icon { padding: 10px 14px 10px 38px; }

.bf-list-scroll {
  display: flex; flex-direction: column; gap: 4px;
  max-height: clamp(180px, 38vh, 380px);
  overflow-y: auto; overflow-x: hidden;
  margin: 0 -2px; padding: 2px;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.bf-list-scroll::-webkit-scrollbar { width: 8px; }
.bf-list-scroll::-webkit-scrollbar-track { background: transparent; }
.bf-list-scroll::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 8px;
  border: 2px solid transparent; background-clip: padding-box;
}
.bf-list-scroll:hover::-webkit-scrollbar-thumb { background: var(--ink-4); background-clip: padding-box; }
.bf-list-empty { font-size: 13px; color: var(--ink-3); padding: 8px 6px; margin: 0; }

.bf-panel-btn {
  margin-top: 4px;
  background: var(--ink); color: #fff;
  border: none; border-radius: 11px;
  padding: 13px; font-size: 14px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
  transition: background .15s;
}
.bf-panel-btn:hover { background: var(--brand); color: #fff; }
.bf-panel-btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.bf-panel-btn.ghost:hover { background: #f4f6f8; }

/* sotto-lista entità nel pannello */
.bf-ent-row {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px; border-radius: 9px; cursor: pointer;
  font-size: 13px; color: var(--ink-2);
  text-decoration: none;
  transition: background .12s;
}
.bf-ent-row:hover { background: #ececef; color: var(--ink); }
.bf-ent-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }

/* ---------- Area contenuto: frame bianco, scroll interno ---------- */
.bf-frame {
  flex: 1 1 auto;
  min-width: 0;
  align-self: stretch;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--frame);
  border: 1px solid var(--frame-line);
  border-radius: 15px;
  padding: 24px 26px 28px;
  display: flex; flex-direction: column; gap: 22px;
}
.bf-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex: 0 0 auto; }
.bf-page-head > div:first-child { min-width: 0; }
.bf-page-title { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; margin: 0; white-space: nowrap; }
.bf-page-sub { font-size: 15px; color: var(--ink-3); margin: 4px 0 0; }
.bf-head-actions { display: flex; gap: 10px; flex: 0 0 auto; }

.bf-btn {
  border-radius: 11px; padding: 12px 20px;
  font-size: 14px; font-weight: 600;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
.bf-btn:hover { background: #f4f6f8; }
.bf-btn:active { transform: translateY(1px); }
.bf-btn.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.bf-btn.dark:hover { background: var(--brand); border-color: var(--brand); }
.bf-btn.ai { background: var(--ai-btn); color: #fff; border-color: var(--ai-btn); }
.bf-btn.ai:hover { background: var(--ai-btn-hover); }
.bf-btn.danger { background: var(--red-strong); color: #fff; border-color: var(--red-strong); }
.bf-btn.danger:hover { background: #b91a22; }

/* ---------- Card ---------- */
.bf-card {
  background: var(--card);
  border: none;
  border-radius: var(--radius-lg);
  padding: 22px;
}
.bf-card-title { font-size: 19px; font-weight: 800; margin: 0; letter-spacing: -0.3px; }
.bf-card-sub { font-size: 13px; color: var(--ink-3); margin: 3px 0 0; }
.bf-grid { display: grid; gap: 18px; }

/* AI summary card (viola scuro) */
.bf-ai-card {
  background: var(--ai-deep);
  border-radius: var(--radius-lg);
  padding: 26px;
  color: #fff;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  display: flex; flex-direction: column; gap: 14px;
}
.bf-ai-card::after {
  content: ""; position: absolute; right: -60px; top: -60px;
  width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(138,56,245,.45), transparent 70%);
  pointer-events: none;
}
.bf-ai-tag {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 700; color: var(--ai-soft);
  letter-spacing: .2px;
}
.bf-ai-pill {
  position: absolute; top: 22px; right: 22px;
  background: rgba(138,56,245,.25); color: var(--ai-soft);
  border: 1px solid rgba(212,187,255,.35);
  font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 999px;
  display: inline-flex; gap: 6px; align-items: center;
}
.bf-ai-text { font-size: 15px; line-height: 1.55; color: #efeafc; margin: 0; max-width: 60ch; }
.bf-ai-text b { color: #fff; }
.bf-ai-btn {
  align-self: flex-start;
  background: var(--ai-btn); color: #fff; border: none;
  padding: 12px 22px; border-radius: 11px; font-size: 14px; font-weight: 600;
  display: inline-flex; gap: 8px; align-items: center;
  text-decoration: none;
  transition: background .15s;
}
.bf-ai-btn:hover { background: var(--ai-btn-hover); }
.bf-ai-btn.outline { background: transparent; border: 1px solid rgba(212,187,255,.4); color: #fff; }
.bf-ai-btn.outline:hover { background: rgba(138,56,245,.2); }

/* Card allarme */
.bf-alert {
  display: flex; align-items: center; gap: 14px;
  border-radius: 12px; padding: 14px 16px;
  border: 1px solid var(--line);
  background: #fff;
}
.bf-alert.red { background: var(--red-soft); border-color: var(--red-line); }
.bf-alert.amber { background: var(--amber-soft); border-color: var(--amber-line); }
.bf-alert.resolved { opacity: .72; }
.bf-alert-ico {
  width: 36px; height: 36px; border-radius: 9px; flex: 0 0 36px;
  display: grid; place-items: center; color: #fff;
}
.bf-alert.red .bf-alert-ico { background: var(--red-strong); }
.bf-alert.amber .bf-alert-ico { background: var(--amber-dot); }
.bf-alert-body { flex: 1 1 auto; min-width: 0; }
.bf-alert-name { font-size: 15px; font-weight: 700; }
.bf-alert-desc { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.bf-alert-desc b { color: var(--ink); }
.bf-badge {
  font-size: 12px; font-weight: 700; padding: 5px 11px; border-radius: 999px;
  white-space: nowrap;
}
.bf-badge.live { background: #fff; color: var(--red-strong); border: 1px solid var(--red-line); }
.bf-badge.live-amber { background: #fff; color: var(--amber); border: 1px solid var(--amber-line); }
.bf-badge.resolved { background: #eceef1; color: var(--ink-3); }
.bf-badge.ai { background: var(--ai-chip-bg); color: var(--ai-chip-ink); }
.bf-badge.manual { background: #eceef1; color: var(--ink-2); }
.bf-badge.engine { background: #fff; color: var(--ink-2); border: 1px solid var(--line); font-weight: 600; }
.bf-badge.ent { background: var(--green-soft); color: var(--green); }
.bf-badge.cmp { background: var(--ai-chip-bg); color: var(--ai-chip-ink); }
.bf-badge.proj { background: #eceef1; color: var(--ink-2); }
.bf-vedi {
  background: #fff; border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 16px; font-size: 13px; font-weight: 600; color: var(--ink);
  text-decoration: none; white-space: nowrap;
}
.bf-vedi:hover { background: #f4f6f8; }

/* Card metriche */
.bf-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; flex: 0 0 auto; }
.bf-metric {
  background: var(--card); border: none; border-radius: var(--radius-lg);
  padding: 20px;
  display: flex; flex-direction: column; gap: 8px;
}
.bf-metric-label { font-size: 14px; color: var(--ink-2); font-weight: 500; }
.bf-metric-value { font-size: 38px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.bf-metric-value.brand { color: var(--ink); font-size: 28px; }
.bf-metric-delta { font-size: 12px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; }
.bf-metric-delta.up { color: var(--green); }
.bf-metric-delta.down { color: var(--red); }
.bf-metric-delta.flat { color: var(--ink-3); }

/* Lista ranking */
.bf-rank-row {
  display: flex; align-items: center; gap: 16px;
  padding: 15px 16px; border: 1px solid var(--line); border-radius: 12px;
  margin-bottom: 12px; transition: border-color .12s, background .12s;
  cursor: pointer; background: #fff;
  text-decoration: none; color: inherit;
}
.bf-rank-row:last-child { margin-bottom: 0; }
.bf-rank-row:hover { background: #fafbfc; }
.bf-rank-row.lead { border-color: var(--brand); background: #fff6f3; }
.bf-rank-num { font-size: 14px; font-weight: 700; color: var(--ink-3); width: 16px; }
.bf-rank-row.lead .bf-rank-num { color: var(--brand); }
.bf-rank-name { font-size: 16px; font-weight: 700; flex: 1 1 auto; }
.bf-rank-row.lead .bf-rank-name { color: var(--brand); }
.bf-spark { width: 84px; height: 30px; flex: 0 0 84px; }
.bf-rank-fig { text-align: right; min-width: 64px; }
.bf-rank-val { font-size: 16px; font-weight: 800; }
.bf-rank-delta { font-size: 12px; font-weight: 700; }
.bf-rank-delta.up { color: var(--green); }
.bf-rank-delta.down { color: var(--red); }

/* Barre sentiment */
.bf-senti-head {
  display: grid; grid-template-columns: 90px 1fr 64px;
  gap: 12px; align-items: center;
  font-size: 11px; font-weight: 700; letter-spacing: .6px; color: var(--ink-3);
  text-transform: uppercase; padding: 0 2px 10px;
}
.bf-senti-row {
  display: grid; grid-template-columns: 90px 1fr 64px;
  gap: 12px; align-items: center; padding: 9px 2px;
}
.bf-senti-name { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bf-senti-track { height: 12px; border-radius: 999px; background: #e4e8ec; overflow: hidden; }
.bf-senti-fill { display: block; height: 100%; border-radius: 999px; }
.bf-senti-pct { font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.bf-senti-pct .up { color: var(--green); }
.bf-senti-pct .down { color: var(--red); }

/* Topic & keywords */
.bf-tk-label { font-size: 11px; font-weight: 700; letter-spacing: .6px; color: var(--ink-3); text-transform: uppercase; margin: 0 0 10px; }
.bf-tk-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px; border-radius: 9px; margin-bottom: 8px; font-size: 14px;
}
.bf-tk-bar.light { background: #fff; color: var(--ink); }
.bf-tk-bar.dark { background: var(--ink); color: #fff; }
.bf-tk-bar .bf-tk-n { font-size: 13px; font-weight: 700; opacity: .85; }
.bf-tk-chip {
  display: inline-flex; align-items: center;
  background: var(--ai-chip-bg); color: var(--ai-chip-ink);
  font-size: 14px; font-weight: 600; padding: 9px 14px; border-radius: 9px;
  margin: 0 8px 8px 0;
}

/* Identity gap */
.bf-ig-row { margin-bottom: 16px; }
.bf-ig-row:last-child { margin-bottom: 0; }
.bf-ig-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.bf-ig-name { font-size: 15px; font-weight: 700; }
.bf-ig-pct { font-size: 15px; font-weight: 800; }
.bf-ig-track { height: 8px; border-radius: 999px; background: #e4e8ec; overflow: hidden; }
.bf-ig-fill { display: block; height: 100%; border-radius: 999px; }

/* Placeholder grafico / funzioni in arrivo */
.bf-chart-ph {
  border: 1.5px dashed #cfd4d9;
  border-radius: 12px;
  background: repeating-linear-gradient(135deg, #fafbfc, #fafbfc 11px, #f1f3f5 11px, #f1f3f5 22px);
  display: flex; flex-direction: column; gap: 6px;
  align-items: center; justify-content: center;
  text-align: center; padding: 24px; color: var(--ink-2);
}
.bf-chart-ph .bf-cp-type {
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: var(--ai-btn);
  background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 4px 9px;
}
.bf-chart-ph .bf-cp-desc { font-size: 13px; max-width: 40ch; line-height: 1.5; }

/* utility */
.bf-row { display: flex; gap: 18px; }
.bf-muted { color: var(--ink-3); }
.bf-flash {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 13px 22px; border-radius: 12px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-pop);
  font-family: var(--font);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 150;
  display: flex; align-items: center; gap: 9px;
}
.bf-flash.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@keyframes bfFadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  .bf-fade-up { animation: bfFadeUp .35s ease; }
}

/* Post in evidenza */
.bf-post-row { display: flex; gap: 13px; padding: 13px 0; border-top: 1px solid var(--line-2); }
.bf-post-row:first-of-type { border-top: none; padding-top: 4px; }
.bf-post-row.link { cursor: pointer; border-radius: 10px; transition: background .12s; text-decoration: none; color: inherit; }
.bf-post-row.link:hover { background: #eef0f3; }
.bf-post-ico {
  width: 34px; height: 34px; border-radius: 9px; flex: 0 0 34px;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px;
  overflow: hidden;
}
.bf-post-ico img { width: 100%; height: 100%; object-fit: cover; }
.bf-post-ico.fb { background: #1877f2; }
.bf-post-ico.ig { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #bc1888); }
.bf-post-ico.rd { background: #ff4500; }
.bf-post-ico.yt { background: #ff0000; }
.bf-post-ico.tw { background: #14171a; }
.bf-post-body { flex: 1 1 auto; min-width: 0; }
.bf-post-name { font-size: 14px; font-weight: 700; }
.bf-post-text { font-size: 14px; color: var(--ink-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bf-post-meta { font-size: 12px; color: var(--ink-3); margin-top: 6px; display: flex; gap: 14px; align-items: center; font-weight: 600; }
.bf-post-meta .bf-pm { display: inline-flex; gap: 5px; align-items: center; }
.bf-post-time { font-size: 11px; color: var(--ink-3); font-weight: 700; letter-spacing: .4px; text-transform: uppercase; white-space: nowrap; flex: 0 0 auto; }

/* Bar chart (barre grigie) */
.bf-barchart { display: flex; align-items: flex-end; gap: 14px; height: 180px; padding: 6px 0; }
.bf-barcol { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 9px; height: 100%; justify-content: flex-end; }
.bf-barcol .bf-bar { width: 100%; max-width: 46px; border-radius: 7px 7px 4px 4px; background: #e1e4e8; transition: background .15s; }
.bf-barcol:hover .bf-bar { background: var(--ai-soft); }
.bf-barcol .bf-blabel { font-size: 12px; color: var(--ink-3); font-weight: 600; }

/* chips piattaforma */
.bf-chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 0 0 auto; }
.bf-chip {
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px;
  cursor: pointer; text-decoration: none;
  transition: background .12s, color .12s, border-color .12s;
}
.bf-chip:hover { background: #f4f6f8; }
.bf-chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.bf-chip.add { padding: 6px 11px; }

/* input di ricerca */
.bf-search-input {
  font-family: inherit; font-size: 14px; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 11px;
  padding: 12px 14px; width: 100%;
}
.bf-search-input:focus { outline: none; border-color: var(--ink); }
.bf-search-input::placeholder { color: var(--ink-4); }
select.bf-search-input {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239a9ea1' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}

/* ---------- Pill allarme inline (header pagina) ---------- */
.bf-alert-pills { display: flex; gap: 10px; flex-wrap: wrap; flex: 0 0 auto; }
.bf-apill {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; letter-spacing: .1px;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .05s;
}
.bf-apill:hover { background: #fafbfc; }
.bf-apill:active { transform: translateY(1px); }
.bf-apill .bf-ap-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.bf-apill.red { background: var(--red-soft); border-color: var(--red-line); color: var(--red-strong); }
.bf-apill.red .bf-ap-dot { background: var(--red-strong); }
.bf-apill.red:hover { background: #fde6e4; }
.bf-apill.amber { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
.bf-apill.amber .bf-ap-dot { background: var(--amber-dot); }
.bf-apill.amber:hover { background: #fbeecb; }

/* ---------- Line chart (SVG) ---------- */
.bf-chart-card { background: var(--card); border-radius: var(--radius-lg); padding: 22px; }
.bf-line-wrap { width: 100%; }
.bf-linechart { width: 100%; height: auto; display: block; }
.bf-chart-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 14px; }
.bf-chart-legend .bf-cl-item { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.bf-chart-legend .bf-cl-swatch { width: 14px; height: 4px; border-radius: 2px; flex: 0 0 14px; }

/* ============================================================
   Modale generico + campi form
   ============================================================ */
.bf-modal-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(26,26,26,.42);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  opacity: 0; pointer-events: none; transition: opacity .18s;
  font-family: var(--font);
}
.bf-modal-backdrop.show { opacity: 1; pointer-events: auto; }
.bf-modal {
  width: 580px; max-width: 100%; max-height: 90vh; overflow-y: auto;
  background: #fff; border-radius: 15px; padding: 36px;
  display: flex; flex-direction: column; gap: 22px;
  box-shadow: var(--shadow-pop); transform: translateY(10px) scale(.98); transition: transform .18s;
}
.bf-modal * { box-sizing: border-box; }
.bf-modal-backdrop.show .bf-modal { transform: none; }
.bf-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.bf-modal-title { font-size: 21px; font-weight: 800; margin: 0; letter-spacing: -.3px; }
.bf-modal-sub { font-size: 13px; color: var(--ink-3); margin: 4px 0 0; }
.bf-modal-close {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); display: grid; place-items: center; flex: 0 0 32px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.bf-modal-close:hover { background: #f4f6f8; color: var(--ink); }
.bf-modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding-top: 2px; }
.bf-modal .bf-seg.light { flex-wrap: wrap; }
.bf-modal .bf-seg.light button { flex: 1; }
.bf-modal input.bf-search-input, .bf-modal select.bf-search-input { background: var(--canvas); }

.bf-field { display: flex; flex-direction: column; gap: 9px; }
.bf-field-label { font-size: 12px; font-weight: 700; color: var(--ink-3); letter-spacing: .3px; text-transform: uppercase; }
.bf-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* variante campi form su card (pagina Allarmi) */
.bf-form-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.bf-form-field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.bf-form-field input, .bf-form-field select, .bf-form-field textarea {
  font-family: inherit; font-size: 14px; color: var(--ink);
  background: #f4f6f8; border: 1px solid var(--line); border-radius: 10px;
  padding: 13px 14px; width: 100%; transition: border-color .12s, background .12s;
}
.bf-form-field input:focus, .bf-form-field select:focus, .bf-form-field textarea:focus { outline: none; border-color: var(--ink); background: #fff; }
.bf-form-actions { display: flex; gap: 10px; margin-top: 4px; }

.bf-check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.bf-check { display: flex; align-items: center; gap: 11px; font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer; padding: 3px 0; }
.bf-check input {
  appearance: none; -webkit-appearance: none; width: 20px; height: 20px; flex: 0 0 20px;
  border: 1.5px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer;
  display: grid; place-items: center; margin: 0; transition: background .12s, border-color .12s;
}
.bf-check input:checked { background: var(--ink); border-color: var(--ink); }
.bf-check input:checked::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-1px); }

.bf-social-pick { display: flex; gap: 12px; }
.bf-social-pick button {
  flex: 1; height: 52px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--canvas); color: var(--ink-2); display: grid; place-items: center;
  font-weight: 700; font-size: 14px; transition: border-color .12s, background .12s, color .12s;
}
.bf-social-pick button .bf-sp-ico { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 700; }
.bf-social-pick button.on { border-color: var(--ink); background: #fff; box-shadow: var(--shadow-card); }

/* ============================================================
   Pagina Report
   ============================================================ */
.bf-report-list { display: flex; flex-direction: column; gap: 12px; }
.bf-report-item {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px;
  background: #fff;
  cursor: pointer; text-decoration: none; color: inherit;
  transition: border-color .12s, background .12s;
}
.bf-report-item:hover { background: #fafbfc; }
.bf-report-item.sel { border-color: var(--ink); background: #fff; box-shadow: 0 0 0 1px var(--ink); }
.bf-report-item > div:first-child { min-width: 0; flex: 1; }
.bf-report-item h4 { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bf-report-item .bf-rdate { font-size: 13px; color: var(--ink-3); margin-top: 4px; }

.bf-preview {
  background: #fafbfc; border: 1px solid var(--line); border-radius: 12px;
  padding: 24px; display: flex; flex-direction: column; gap: 14px; min-height: 440px;
}
.bf-preview h3 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.3px; text-wrap: pretty; }
.bf-preview .bf-pv-meta { font-size: 13px; color: var(--ink-3); }
.bf-preview p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.bf-preview .bf-pv-sec {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  background: #fff; border: 1px solid var(--line); border-radius: 9px; font-size: 14px; font-weight: 600;
}
.bf-preview .bf-pv-sec .bf-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ai-btn); flex: 0 0 7px; }
.bf-empty-pv { color: var(--ink-3); font-size: 14px; text-align: center; margin: auto; max-width: 30ch; line-height: 1.5; }

/* tabella confronto in anteprima */
.bf-cmp-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bf-cmp-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: #fff; }
.bf-cmp-chip .bf-cc-dot { width: 8px; height: 8px; border-radius: 50%; }
.bf-cmp-vs { font-size: 12px; font-weight: 800; color: var(--ink-3); letter-spacing: .5px; }
.bf-cmp-table { background: #fff; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.bf-cmp-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line-2); }
.bf-cmp-row:first-child { border-top: none; }
.bf-cmp-row.cmp-th { background: #f4f6f8; }
.bf-cmp-row .bf-cmp-lab { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.bf-cmp-row.cmp-th .bf-cmp-lab { color: var(--ink-3); font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
.bf-cmp-val { font-size: 15px; font-weight: 700; text-align: right; color: var(--ink); }
.bf-cmp-val.win { color: var(--brand); }
.bf-cmp-row.cmp-th .bf-cmp-val { font-size: 13px; font-weight: 700; }

/* ============================================================
   Pagina Entità
   ============================================================ */
.bf-ent-list-row {
  padding: 12px 13px; border-radius: 11px; cursor: pointer;
  border: 1px solid transparent; transition: background .12s, border-color .12s;
  text-decoration: none; color: inherit; display: block;
}
.bf-ent-list-row:hover { background: #ececef; }
.bf-ent-list-row.active { background: #fff; border-color: var(--line); box-shadow: var(--shadow-card); }
.bf-ent-list-row .bf-el-name { font-size: 15px; font-weight: 700; line-height: 1.2; color: var(--ink); }
.bf-ent-list-row .bf-el-sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.bf-vedi-orig { font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--ink-3); text-decoration: none; white-space: nowrap; align-self: center; }
.bf-vedi-orig:hover { color: var(--ink); }
.bf-card-link { font-size: 12px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--ink-3); text-decoration: none; transition: color .12s; }
.bf-card-link:hover { color: var(--ink); }
.bf-gap-list .bf-tk-bar { margin-bottom: 10px; }
.bf-gap-bar-row { margin-bottom: 18px; }
.bf-gap-bar-row .bf-gb-top { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; margin-bottom: 8px; white-space: nowrap; gap: 12px; }
.bf-gap-bar-track { height: 10px; border-radius: 999px; background: #edeef1; overflow: hidden; }
.bf-gap-bar-fill { display: block; height: 100%; border-radius: 999px; }

/* ============================================================
   Pagina Entità-Post (tutti i post)
   ============================================================ */
.bf-ai-search {
  background: var(--ai-accent);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
  color: #fff;
}
.bf-ai-search .bf-ais-title { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.bf-ai-search .bf-ais-sub { font-size: 12px; line-height: 1.45; color: #ecdcff; margin: 0; }
.bf-ai-search input {
  font-family: inherit; font-size: 13px; color: var(--ink);
  background: #fff; border: none; border-radius: 9px;
  padding: 11px 12px; width: 100%; margin-top: 2px;
}
.bf-ai-search input::placeholder { color: var(--ai-chip-ink); opacity: .8; }
.bf-ai-search input:focus { outline: 2px solid rgba(255,255,255,.5); }

.bf-ai-mini {
  background: var(--ai-deep-2); color: #fff;
  border: none; border-radius: 11px;
  padding: 13px; font-size: 14px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
  transition: background .15s;
}
.bf-ai-mini:hover { background: var(--ai-deep); }
.bf-ai-mini svg { color: var(--ai-soft); }

.bf-post-full {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  display: flex; flex-direction: column; gap: 0;
}
.bf-pf-head { display: flex; align-items: center; gap: 12px; }
.bf-pf-head .bf-post-ico { width: 36px; height: 36px; flex: 0 0 36px; font-size: 14px; }
.bf-pf-id { flex: 1 1 auto; min-width: 0; }
.bf-pf-name { font-size: 15px; font-weight: 700; color: #4d4d4d; }
.bf-pf-date { font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--ink-3); letter-spacing: .3px; text-transform: uppercase; margin-top: 3px; }
.bf-pf-orig { font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--ink-3); text-decoration: none; white-space: nowrap; transition: color .12s; }
.bf-pf-orig:hover { color: var(--ink); }
.bf-pf-line { height: 1px; background: #e1e5e9; margin: 16px 0; }
.bf-pf-text { font-size: 15px; line-height: 1.55; color: #3a3a3a; margin: 0; text-wrap: pretty; }
.bf-pf-metrics { display: flex; gap: 38px; flex-wrap: wrap; }
.bf-pf-metric { display: flex; flex-direction: column; gap: 4px; }
.bf-pf-metric .bf-pm-val { font-size: 21px; font-weight: 800; letter-spacing: -.5px; line-height: 1; }
.bf-pf-metric .bf-pm-val.neg { color: var(--red-strong); }
.bf-pf-metric .bf-pm-lab { font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--ink-3); }
.bf-pf-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.bf-pf-act {
  background: var(--ai-deep-2); color: #fff;
  border: none; border-radius: 9px;
  padding: 9px 15px; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  text-decoration: none;
  transition: background .15s;
}
.bf-pf-act:hover { background: var(--ai-deep); }
.bf-pf-act svg { color: var(--ai-soft); }
.bf-post-empty { padding: 40px; text-align: center; color: var(--ink-3); }

/* ============================================================
   Pagina Allarmi
   ============================================================ */
.bf-alarm-nav { display: flex; flex-direction: column; gap: 8px; }
.bf-alarm-nav-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px; border-radius: 11px; cursor: pointer;
  border: 1px solid transparent; transition: background .12s, border-color .12s;
  text-decoration: none; color: inherit;
}
.bf-alarm-nav-item:hover { background: #ececef; }
.bf-alarm-nav-item.sel { background: #fff; border-color: var(--line); box-shadow: var(--shadow-card); }
.bf-alarm-nav-item .bf-sev-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: 0 0 9px; }
.bf-sev-red { background: var(--red-strong); }
.bf-sev-amber { background: var(--amber-dot); }
.bf-sev-green { background: var(--green); }
.bf-alarm-nav-item .bf-an-name { font-size: 14px; font-weight: 700; line-height: 1.25; }
.bf-alarm-nav-item .bf-an-meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.bf-alarm-nav-item .bf-an-status { font-size: 11px; font-weight: 700; margin-left: auto; white-space: nowrap; padding-top: 1px; }
.bf-an-status.active { color: var(--red-strong); }
.bf-an-status.active.amber { color: var(--amber); }
.bf-an-status.resolved { color: var(--ink-3); }

.bf-evidence {
  border-radius: var(--radius-lg); padding: 24px; border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 12px;
  background: #fff;
  flex: 0 0 auto;
}
.bf-evidence.red { background: var(--red-soft); border-color: var(--red-line); }
.bf-evidence.amber { background: var(--amber-soft); border-color: var(--amber-line); }
.bf-evidence.resolved { background: #f6f7f8; }
.bf-ev-head { display: flex; align-items: center; gap: 13px; }
.bf-ev-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: 0 0 40px; background: var(--ink); }
.bf-evidence.red .bf-ev-ico { background: var(--red-strong); }
.bf-evidence.amber .bf-ev-ico { background: var(--amber-dot); }
.bf-evidence.resolved .bf-ev-ico { background: var(--green); }
.bf-ev-title { font-size: 19px; font-weight: 800; letter-spacing: -0.3px; }
.bf-ev-line { font-size: 14px; color: var(--ink-2); }
.bf-ev-line b { color: var(--ink); }

/* ============================================================
   Adattamento pagine legacy (Bulma dentro il frame)
   ============================================================ */
.bf-frame .section { padding: 6px 0 18px; }
.bf-frame .container { max-width: none; width: 100%; margin: 0; }
.bf-frame > .section:first-child { padding-top: 0; }

/* ============================================================
   Stampa: si stampa solo il contenuto del frame
   ============================================================ */
@media print {
  html.bf-root, body.bf-body { overflow: visible; height: auto; background: #fff; }
  .bf-app { display: block; height: auto; padding: 0; overflow: visible; }
  .bf-rail, .bf-panel { display: none !important; }
  .bf-frame { height: auto; overflow: visible; border: none; padding: 0; }
}

/* ============================================================
   Schermi stretti: il pannello si restringe
   ============================================================ */
@media (max-width: 1180px) {
  .bf-app { gap: 14px; }
  .bf-panel { width: 210px; flex: 0 0 210px; }
  .bf-metrics { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   Pagina statistiche provider — variazioni e dati periodo
   ============================================================ */
/* riga delle variazioni percentuali (interazioni / condivisioni) */
.bf-stat-changes { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 18px; }
.bf-change {
  display: flex; flex-direction: column; gap: 4px;
  background: #fff; border: 1px solid var(--line); border-radius: 11px;
  padding: 12px 16px; min-width: 160px; flex: 1 1 160px;
}
.bf-change-val { font-size: 23px; font-weight: 800; letter-spacing: -.5px; line-height: 1; color: var(--ink-3); }
.bf-change.up .bf-change-val { color: var(--green); }
.bf-change.down .bf-change-val { color: var(--red); }
.bf-change-lab { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.bf-change-lab .bf-muted { font-weight: 500; }

/* griglia di tessere con i valori assoluti del periodo */
.bf-stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 12px; }
.bf-stat {
  background: #fff; border: 1px solid var(--line); border-radius: 11px;
  padding: 14px; display: flex; flex-direction: column; gap: 6px;
}
.bf-stat-val { font-size: 22px; font-weight: 800; letter-spacing: -.5px; line-height: 1; color: var(--ink); }
.bf-stat-lab { font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--ink-3); }

/* barra filtri (profili, date, ricerca) sopra i grafici */
.bf-filter-card { margin-bottom: 4px; }
.bf-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px 18px;
  align-items: end;
}
.bf-filters .bf-field-wide { grid-column: 1 / -1; }
@media (min-width: 760px) { .bf-filters .bf-field-wide { grid-column: span 2; } }
/* il web component multi-select riempie la cella e resta allineato */
.bf-filters multi-select { display: block; width: 100%; }
.bf-filter-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px 24px; flex-wrap: wrap; margin-top: 20px;
}
.bf-filter-checks { display: flex; gap: 22px; flex-wrap: wrap; }
.bf-filter-foot .bf-btn { padding: 11px 22px; }

/* card "tag usati nei post" per profilo (pagina tags) */
.bf-tag-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.bf-tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.bf-tag-n { margin-left: 7px; font-weight: 700; color: var(--ink-3); }
.bf-pf-tag:hover .bf-tag-n { color: var(--ink-2); }

/* card grafico interazioni per profilo (pagina interactions) */
.bf-chart-block { display: flex; flex-direction: column; gap: 16px; }
.bf-chart-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bf-chart-canvas { overflow-x: auto; }
.bf-chart-canvas .bk-root { margin: 0 auto; }
.bf-pf-img { border-radius: 10px; overflow: hidden; margin: 4px 0 2px; max-height: 240px; }
.bf-pf-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bf-pf-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.bf-pf-tag {
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px;
  text-decoration: none; transition: background .12s, color .12s;
}
.bf-pf-tag:hover { background: #f4f6f8; color: var(--ink); }

/* ============================================================
   Pagina Login / autenticazione (standalone, senza shell)
   ============================================================ */
.bf-auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--page);
  font-family: var(--font);
  color: var(--ink);
  overflow-y: auto;
}
.bf-auth, .bf-auth * { box-sizing: border-box; }
.bf-auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--frame-line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-pop);
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.bf-auth-head { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.bf-auth-logo {
  width: 56px; height: 56px; border-radius: 15px;
  background: var(--brand); color: #fff; font-weight: 800; font-size: 28px;
  display: grid; place-items: center; letter-spacing: -1px;
}
.bf-auth-title { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; margin: 0; }
.bf-auth-sub { font-size: 14px; color: var(--ink-3); margin: 4px 0 0; }

.bf-auth-form { display: flex; flex-direction: column; gap: 16px; }
.bf-auth-form .bf-form-field { margin-bottom: 0; }
.bf-auth-form .bf-btn { width: 100%; justify-content: center; padding: 13px 20px; margin-top: 4px; }

/* l'autofill del browser non deve sovrascrivere lo sfondo del campo */
.bf-auth-form input:-webkit-autofill,
.bf-auth-form input:-webkit-autofill:hover,
.bf-auth-form input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--ink);
  -webkit-box-shadow: 0 0 0 1000px #f4f6f8 inset;
  box-shadow: 0 0 0 1000px #f4f6f8 inset;
  caret-color: var(--ink);
  border-color: var(--line);
}
.bf-auth-form input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #fff inset;
  box-shadow: 0 0 0 1000px #fff inset;
  border-color: var(--ink);
}

/* messaggi (errore / warning / info) sopra il form */
.bf-auth-msg {
  font-size: 13px; font-weight: 600; line-height: 1.45;
  border-radius: var(--radius-md); padding: 12px 14px; text-align: center;
}
.bf-auth-msg.error { background: var(--red-soft); border: 1px solid var(--red-line); color: var(--red-strong); }
.bf-auth-msg.warning { background: var(--amber-soft); border: 1px solid var(--amber-line); color: var(--amber); }
.bf-auth-msg.info { background: var(--ai-chip-bg); border: 1px solid transparent; color: var(--ai-chip-ink); }

/* separatore "oppure" */
.bf-auth-divider { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 13px; }
.bf-auth-divider::before, .bf-auth-divider::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--line); }

/* bottone provider esterno (Google) — eredita .bf-btn chiaro */
.bf-auth-google { width: 100%; justify-content: center; gap: 10px; }
.bf-auth-google svg { width: 18px; height: 18px; flex: 0 0 18px; }

/* ============================================================
   Blocchi generici: tabelle dati, note, input file, pagine testo
   (usati da import entità, gestione entità, guide)
   ============================================================ */
.bf-table-wrap {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  overflow-x: auto;
}
.bf-table { width: 100%; border-collapse: collapse; font-size: 14px; font-family: var(--font); }
.bf-table th {
  text-align: left; padding: 12px 14px; white-space: nowrap;
  font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  color: var(--ink-3); background: #f4f6f8;
}
.bf-table td {
  padding: 13px 14px; border-top: 1px solid var(--line-2);
  color: var(--ink); vertical-align: top; line-height: 1.5;
}
.bf-table tbody tr:hover { background: #fafbfc; }
.bf-table th.num, .bf-table td.num { text-align: right; white-space: nowrap; }
.bf-table td strong { font-weight: 700; }
.bf-table a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.bf-table a:hover { color: var(--brand); border-color: var(--brand); }
.bf-td-sub { display: block; font-size: 12px; color: var(--ink-3); margin-top: 3px; line-height: 1.45; }
.bf-td-sub.err { color: var(--red-strong); }
.bf-table-empty { padding: 18px 14px; font-size: 14px; color: var(--ink-3); }

/* note informative dentro una card */
.bf-note {
  font-size: 13px; font-weight: 500; line-height: 1.55;
  border: 1px solid transparent; border-radius: var(--radius-md);
  padding: 12px 14px; margin-bottom: 12px;
}
.bf-note:last-child { margin-bottom: 0; }
.bf-note.info { background: var(--ai-chip-bg); color: var(--ai-chip-ink); }
.bf-note.warn { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
.bf-note.error { background: var(--red-soft); border-color: var(--red-line); color: var(--red-strong); }
.bf-note.ok { background: var(--green-soft); color: var(--green); }
.bf-note a { color: inherit; font-weight: 700; }

/* input file allineato agli altri campi */
.bf-file-input {
  font-family: inherit; font-size: 14px; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 11px;
  padding: 9px 12px; width: 100%; cursor: pointer;
}
.bf-file-input:focus { outline: none; border-color: var(--ink); }
.bf-file-input::file-selector-button {
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink);
  background: #f4f6f8; border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 14px; margin-right: 12px; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.bf-file-input::file-selector-button:hover { background: #ececef; border-color: var(--ink-4); }

/* select nativa multipla con l'aspetto dei campi bf- */
select.bf-search-input[multiple] {
  background-image: none; appearance: auto; -webkit-appearance: auto;
  padding: 8px 10px; min-height: 118px;
}
select.bf-search-input[multiple] option { padding: 4px 6px; }

/* aiuto sotto un campo */
.bf-help { font-size: 12px; color: var(--ink-3); line-height: 1.5; }

/* pagine di testo (guide): tipografia leggibile dentro una card */
.bf-doc { font-size: 14px; line-height: 1.65; color: var(--ink); max-width: 980px; }
.bf-doc > *:first-child { margin-top: 0; }
.bf-doc h2 {
  font-size: 15px; font-weight: 700; letter-spacing: -.1px;
  margin: 28px 0 10px; color: var(--ink);
}
.bf-doc p { margin: 0 0 12px; color: var(--ink-2); }
.bf-doc p strong, .bf-doc li strong { color: var(--ink); font-weight: 700; }
.bf-doc ul { margin: 0 0 12px; padding-left: 20px; }
.bf-doc li { margin-bottom: 7px; color: var(--ink-2); }
.bf-doc code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
  background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px;
  color: var(--ink);
}
.bf-doc em { color: var(--ink-2); }
