/* ============================================================================
 * BOX FIBRA — Componentes do Design System
 * Carrega depois de tokens.css.
 * ============================================================================ */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
}

/* ════════════════════════════════════════════════════════════════════════
 * Header global
 * ════════════════════════════════════════════════════════════════════════ */
.bf-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}
.bf-header__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--text-strong);
  font-weight: 600;
  font-size: 15px;
}
.bf-header__brand img {
  height: 36px;
  width: 36px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}
.bf-header__search {
  flex: 1;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}
.bf-header__search input {
  width: 100%;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px 8px 36px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
.bf-header__search input:focus {
  border-color: var(--brand-primary);
}
.bf-header__search .bf-search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}
.bf-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.bf-header__btn {
  position: relative;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  transition: background .15s;
}
.bf-header__btn:hover { background: var(--bg-hover); }
.bf-header__btn .bf-badge {
  position: absolute;
  top: -4px;
  right: -4px;
}

/* ════════════════════════════════════════════════════════════════════════
 * Network Semaphore — banner de estado da rede
 * ════════════════════════════════════════════════════════════════════════ */
.bf-semaphore {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-5);
  border: 1px solid;
  transition: all .25s;
}
.bf-semaphore--green {
  background: var(--status-green-bg);
  border-color: var(--status-green-border);
}
.bf-semaphore--yellow {
  background: var(--status-yellow-bg);
  border-color: var(--status-yellow-border);
}
.bf-semaphore--red {
  background: var(--status-red-bg);
  border-color: var(--status-red-border);
  animation: bf-pulse-red 2s ease-in-out infinite;
}
@keyframes bf-pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  50%      { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}
.bf-semaphore__dot {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: white;
}
.bf-semaphore--green .bf-semaphore__dot {
  background: var(--status-green);
  box-shadow: 0 0 20px rgba(22, 163, 74, 0.5);
}
.bf-semaphore--yellow .bf-semaphore__dot {
  background: var(--status-yellow);
  box-shadow: 0 0 20px rgba(217, 119, 6, 0.5);
}
.bf-semaphore--red .bf-semaphore__dot {
  background: var(--status-red);
  box-shadow: 0 0 20px rgba(220, 38, 38, 0.5);
}
.bf-semaphore__text { flex: 1; }
.bf-semaphore__title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  color: var(--text-strong);
}
.bf-semaphore__subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 4px 0 0;
}
.bf-semaphore__meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 6px;
}

/* ════════════════════════════════════════════════════════════════════════
 * KPI Cards — 4 cards principais
 * ════════════════════════════════════════════════════════════════════════ */
.bf-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.bf-kpi {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
}
.bf-kpi__label {
  font-size: var(--fs-small);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.bf-kpi__value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1;
}
.bf-kpi__suffix {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 4px;
  font-weight: 400;
}
.bf-kpi__delta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}
.bf-kpi__delta--up    { color: var(--status-green); }
.bf-kpi__delta--down  { color: var(--status-red); }

/* ════════════════════════════════════════════════════════════════════════
 * Issue Cards — cards de problema (só aparecem se há problema)
 * ════════════════════════════════════════════════════════════════════════ */
.bf-issues {
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.bf-issue {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--sev-info);
  border-radius: var(--radius);
}
.bf-issue--critical { border-left-color: var(--sev-critical); }
.bf-issue--major    { border-left-color: var(--sev-major); }
.bf-issue--minor    { border-left-color: var(--sev-minor); }
.bf-issue__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.bf-issue--critical .bf-issue__icon { background: var(--sev-critical-bg); color: var(--sev-critical); }
.bf-issue--major .bf-issue__icon    { background: var(--sev-major-bg);    color: var(--sev-major); }
.bf-issue--minor .bf-issue__icon    { background: var(--sev-minor-bg);    color: var(--sev-minor); }
.bf-issue__body { flex: 1; }
.bf-issue__title {
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--text-strong);
  margin: 0;
}
.bf-issue__detail {
  font-size: var(--fs-small);
  color: var(--text-muted);
  margin-top: 4px;
}
.bf-issue__action {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 6px 14px;
  font-size: var(--fs-small);
  cursor: pointer;
  white-space: nowrap;
}
.bf-issue__action:hover { background: var(--bg-hover); }

/* ════════════════════════════════════════════════════════════════════════
 * Painel de saúde inline (overview do index.html)
 * ════════════════════════════════════════════════════════════════════════ */
.ov-health {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 6px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  background: var(--panel, var(--bg-panel));
}
.ov-health--green  { border-left-color: var(--status-green, #22c55e); }
.ov-health--yellow { border-left-color: var(--status-yellow, #eab308); background: linear-gradient(90deg, rgba(234,179,8,.08), transparent 40%); }
.ov-health--red    { border-left-color: var(--status-red, #f43f5e);    background: linear-gradient(90deg, rgba(244,63,94,.10), transparent 40%); animation: ovHealthPulse 3s ease-in-out infinite; }
@keyframes ovHealthPulse {
  0%, 100% { box-shadow: inset 4px 0 0 0 rgba(244,63,94,.5); }
  50%      { box-shadow: inset 4px 0 0 0 rgba(244,63,94,1); }
}
.ov-health__dot {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.ov-health--green  .ov-health__dot { background: rgba(34,197,94,.15);  color: var(--status-green, #22c55e); }
.ov-health--yellow .ov-health__dot { background: rgba(234,179,8,.18);  color: var(--status-yellow, #eab308); }
.ov-health--red    .ov-health__dot { background: rgba(244,63,94,.18);  color: var(--status-red, #f43f5e); }
.ov-health__text   { flex: 1; min-width: 0; }
.ov-health__title  { font-size: 16px; font-weight: 700; color: var(--text, #e6edf3); line-height: 1.2; }
.ov-health__sub    { font-size: 12px; color: var(--muted, #8b949e); margin-top: 4px; }
.ov-health__meta   { font-size: 11px; color: var(--muted, #8b949e); opacity: .75; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* Wrap do bloco "Atenção" inline */
.ov-attention {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel, var(--bg-panel));
  padding: 14px 16px;
}
.ov-attention__header {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--status-red, #f43f5e);
  margin-bottom: 10px;
}
.ov-attention__header--yellow { color: var(--status-yellow, #eab308); }
.ov-attention__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 8px;
}
.ov-attention__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,.02);
  border: 1px solid var(--border);
  border-radius: 5px;
  border-left: 3px solid var(--status-red, #f43f5e);
}
.ov-attention__item--major { border-left-color: var(--status-yellow, #eab308); }
.ov-attention__item__icon {
  font-size: 18px;
  color: var(--status-red, #f43f5e);
  flex-shrink: 0;
}
.ov-attention__item--major .ov-attention__item__icon { color: var(--status-yellow, #eab308); }
.ov-attention__item__body { flex: 1; min-width: 0; }
.ov-attention__item__title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.3; }
.ov-attention__item__detail { font-size: 11px; color: var(--muted); margin-top: 2px; }
.ov-attention__item__cta {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
}
.ov-attention__item__cta:hover { background: rgba(255,255,255,.05); border-color: var(--text); }

/* ── Section header genérico para grupos da home ── */
.bf-section { margin-bottom: var(--space-6, 32px); }
.bf-section__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-h3, 18px);
  font-weight: 700;
  color: var(--text-strong);
  margin: 0 0 var(--space-4) 0;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}
.bf-section__title i {
  color: var(--brand-primary);
  font-size: 20px;
}

/* ── Issues redesenhadas (cards em grid, críticos pulsando) ── */
.bf-issues-section { margin-bottom: var(--space-5); }
.bf-issues-section__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-small);
  font-weight: 700;
  color: var(--sev-critical);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 0 0 var(--space-3) 0;
}
.bf-issues-section__title--major { color: var(--sev-major); }
.bf-issues-grid {
  display: grid;
  gap: var(--space-3);
}
.bf-issues-grid--critical { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.bf-issues-grid--major    { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.bf-issue-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
}
.bf-issue-card--critical {
  background: var(--sev-critical-bg);
  border: 1px solid var(--sev-critical);
  border-left: 4px solid var(--sev-critical);
}
.bf-issue-card--major {
  border-left: 4px solid var(--sev-major);
  background: var(--sev-major-bg, var(--bg-panel));
}
.bf-issue-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.bf-issue-card__icon {
  font-size: 22px;
  color: var(--sev-critical);
}
.bf-issue-card--major .bf-issue-card__icon { color: var(--sev-major); }
.bf-issue-card__count {
  font-size: 28px;
  font-weight: 800;
  color: var(--sev-critical);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.bf-issue-card--major .bf-issue-card__count { color: var(--sev-major); font-size: 22px; }
.bf-issue-card__title {
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--text-strong);
  margin: 0;
  line-height: 1.3;
}
.bf-issue-card--critical .bf-issue-card__title { color: var(--text-strong); }
.bf-issue-card__detail {
  font-size: var(--fs-small);
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}
.bf-issue-card__cta {
  margin-top: auto;
  background: var(--sev-critical);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: var(--fs-small);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: filter .15s, transform .1s;
}
.bf-issue-card__cta:hover  { filter: brightness(1.1); }
.bf-issue-card__cta:active { transform: translateY(1px); }
.bf-issue-card--major .bf-issue-card__cta { background: var(--sev-major); }

/* Pulso visual no card crítico */
.bf-pulse {
  animation: bf-card-pulse 2.4s ease-in-out infinite;
}
@keyframes bf-card-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.35); }
  50%      { box-shadow: 0 0 0 10px rgba(244, 63, 94, 0); }
}

/* Estado "tudo OK" */
.bf-issues-ok {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--space-4);
  background: var(--bg-panel);
  border: 1px solid var(--status-green-border, var(--border));
  border-left: 4px solid var(--status-green);
  border-radius: var(--radius);
  color: var(--status-green);
  font-size: var(--fs-body);
  font-weight: 500;
  margin-bottom: var(--space-5);
}
.bf-issues-ok i { font-size: 20px; }

/* ════════════════════════════════════════════════════════════════════════
 * Icon Launcher — grid de áreas funcionais
 * ════════════════════════════════════════════════════════════════════════ */
.bf-launcher {
  display: grid;
  gap: var(--space-5);
}
.bf-area {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
.bf-area__header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.bf-area__title {
  font-size: var(--fs-h3);
  font-weight: 600;
  color: var(--text-strong);
  margin: 0;
}
.bf-area__icon {
  color: var(--brand-primary);
  font-size: 18px;
}
.bf-area__items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-3);
}
.bf-launch-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-2);
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  color: var(--text);
  min-height: 100px;
}
.bf-launch-item:hover {
  border-color: var(--brand-primary);
  background: var(--bg-hover);
  transform: translateY(-2px);
}
.bf-launch-item__icon {
  font-size: 28px;
  color: var(--brand-primary);
}
.bf-launch-item__label {
  font-size: var(--fs-small);
  text-align: center;
  color: var(--text);
}
.bf-launch-item__badge {
  position: absolute;
  top: 8px;
  right: 8px;
}

/* ════════════════════════════════════════════════════════════════════════
 * Badges
 * ════════════════════════════════════════════════════════════════════════ */
.bf-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  color: white;
  background: var(--sev-info);
}
.bf-badge--critical { background: var(--sev-critical); }
.bf-badge--major    { background: var(--sev-major); }
.bf-badge--minor    { background: var(--sev-minor); }
.bf-badge--info     { background: var(--sev-info); }

/* ════════════════════════════════════════════════════════════════════════
 * Incident Banner — banner pulsante topo da página
 * ════════════════════════════════════════════════════════════════════════ */
.bf-incident-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: var(--status-red-bg);
  border-bottom: 2px solid var(--status-red);
  color: var(--text-strong);
  animation: bf-pulse-banner 2s infinite;
}
@keyframes bf-pulse-banner {
  0%, 100% { background: var(--status-red-bg); }
  50%      { background: rgba(220, 38, 38, 0.22); }
}
.bf-incident-banner__icon { color: var(--status-red); font-size: 18px; }
.bf-incident-banner__text { flex: 1; font-size: var(--fs-body); }
.bf-incident-banner__btn {
  background: var(--status-red);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 6px 16px;
  font-size: var(--fs-small);
  font-weight: 600;
  cursor: pointer;
}

/* ════════════════════════════════════════════════════════════════════════
 * Notification Drawer — bell expandido
 * ════════════════════════════════════════════════════════════════════════ */
.bf-drawer {
  position: fixed;
  top: 64px;
  right: 0;
  bottom: 0;
  width: 380px;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .2s ease-out;
  z-index: 200;
}
.bf-drawer.is-open { transform: translateX(0); }
.bf-drawer__header {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.bf-drawer__title {
  font-size: var(--fs-h3);
  font-weight: 600;
  color: var(--text-strong);
  margin: 0;
}
.bf-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3);
}
.bf-notif-group {
  margin-bottom: var(--space-4);
}
.bf-notif-group__title {
  font-size: var(--fs-tiny);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 0 0 var(--space-2);
}
.bf-notif {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius);
  margin-bottom: var(--space-2);
  border: 1px solid var(--border);
  background: var(--bg-panel-2);
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
}
.bf-notif:hover {
  border-color: var(--accent);
  background: var(--accent-soft, var(--bg-panel-2));
}
.bf-notif.is-seen { opacity: .55; }
.bf-notif.is-seen .bf-notif__icon { color: var(--text-muted); }
.bf-notif__seen-tag {
  margin-left: 6px;
  font-size: var(--fs-tiny);
  color: var(--text-muted);
  font-weight: 600;
}
.bf-notif__icon {
  font-size: 16px;
  flex-shrink: 0;
}
.bf-notif--critical .bf-notif__icon { color: var(--sev-critical); }
.bf-notif--major .bf-notif__icon    { color: var(--sev-major); }
.bf-notif--info .bf-notif__icon     { color: var(--sev-info); }
.bf-notif__title {
  font-size: var(--fs-small);
  color: var(--text);
  margin: 0;
}
.bf-notif__detail {
  font-size: var(--fs-tiny);
  color: var(--text-muted);
  margin-top: 2px;
}
/* Call-to-action explícito — deixa claro que a notificação É clicável */
.bf-notif__cta {
  align-self: center;
  flex-shrink: 0;
  font-size: var(--fs-tiny);
  font-weight: 700;
  color: var(--accent);
  opacity: .55;
  white-space: nowrap;
  transition: opacity .15s, transform .15s;
}
.bf-notif:hover .bf-notif__cta { opacity: 1; transform: translateX(2px); }
/* "visto" esmaece o card inteiro mas NÃO esconde o Investigar — é uma AÇÃO
   permanente, não um indicador de novidade (sumia na 2ª aberta do sino). */
/* Grupo "Monitorar" — tendências rebaixadas visualmente */
.bf-notif-group--monitor { margin-top: var(--space-2); opacity: .9; }
.bf-notif-group__title--monitor {
  color: var(--text-muted);
  font-weight: 600;
  border-top: 1px dashed var(--border);
  padding-top: var(--space-3);
}
/* Linhas do modal de investigação */
.notif-inv-row:hover { background: var(--accent-soft, rgba(255,255,255,.04)); }

/* ════════════════════════════════════════════════════════════════════════
 * Helpers e estados
 * ════════════════════════════════════════════════════════════════════════ */
.bf-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-5);
}
.bf-loading {
  text-align: center;
  padding: var(--space-8) var(--space-5);
  color: var(--text-muted);
}
.bf-loading i { animation: bf-spin 1s linear infinite; }
@keyframes bf-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* ════════════════════════════════════════════════════════════════════════
 * Toast notifications — canto inferior direito
 * ════════════════════════════════════════════════════════════════════════ */
.bf-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}
.bf-toast {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--sev-info);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 320px;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: bf-toast-in .25s ease-out;
  pointer-events: auto;
}
.bf-toast--critical { border-left-color: var(--sev-critical); }
.bf-toast--major    { border-left-color: var(--sev-major); }
.bf-toast--minor    { border-left-color: var(--sev-minor); }
.bf-toast__icon { font-size: 18px; flex-shrink: 0; }
.bf-toast--critical .bf-toast__icon { color: var(--sev-critical); }
.bf-toast--major    .bf-toast__icon { color: var(--sev-major); }
.bf-toast--minor    .bf-toast__icon { color: var(--sev-minor); }
.bf-toast__body { flex: 1; min-width: 0; }
.bf-toast__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong);
  margin: 0;
}
.bf-toast__detail {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}
.bf-toast__close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
}
.bf-toast__close:hover { color: var(--text-strong); }
@keyframes bf-toast-in {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}
.bf-toast.is-leaving {
  animation: bf-toast-out .2s ease-in forwards;
}
@keyframes bf-toast-out {
  to { opacity: 0; transform: translateX(40px); }
}

/* ════════════════════════════════════════════════════════════════════════
 * AI Chat — botão flutuante + painel lateral
 * ════════════════════════════════════════════════════════════════════════ */
.bf-ai-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-accent) 100%);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 24px;
  box-shadow: 0 8px 24px rgba(110, 19, 109, 0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s;
}
.bf-ai-fab:hover { transform: scale(1.08); }
.bf-ai-fab.is-open { transform: rotate(45deg); }

.bf-ai-panel {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 460px;
  height: calc(100vh - 140px);
  max-height: 720px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  z-index: 10001;
  overflow: hidden;
}
.bf-ai-panel.is-open { display: flex; }

/* Modo EXPANDIDO do assistente (2026-07-09): diagnósticos ricos com tabelas
   não cabem nos 460px. Toggle no cabeçalho; preferência em localStorage.
   min() garante que nunca estoura a viewport (inclusive mobile). */
.bf-ai-panel.is-wide {
  width: min(900px, calc(100vw - 56px));
  height: calc(100vh - 130px);
  max-height: none;
}
/* Tabelas markdown renderizadas nas respostas — legíveis nos dois modos */
.bf-ai-messages table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  margin: 6px 0;
}
.bf-ai-messages th, .bf-ai-messages td {
  border: 1px solid var(--border);
  padding: 4px 8px;
  text-align: left;
}
.bf-ai-messages th { background: color-mix(in srgb, var(--accent) 10%, transparent); }

.bf-ai-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-dark) 100%);
  color: white;
}
.bf-ai-header__title {
  font-weight: 600;
  font-size: 14px;
  flex: 1;
}
.bf-ai-header__sub {
  font-size: 11px;
  opacity: .85;
  margin-top: 2px;
}
.bf-ai-header__icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.bf-ai-header__close {
  background: rgba(255,255,255,.15);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bf-ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.bf-ai-msg {
  max-width: 92%;
  padding: var(--space-3) var(--space-4);
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
}
.bf-ai-msg--user {
  align-self: flex-end;
  background: var(--brand-primary);
  color: white;
  border-bottom-right-radius: 4px;
}
.bf-ai-msg--assistant {
  align-self: flex-start;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.bf-ai-msg--tool {
  align-self: flex-start;
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 4px 10px;
  border-radius: 6px;
  max-width: 100%;
}
.bf-ai-msg p { margin: 0 0 8px; }
.bf-ai-msg p:last-child { margin: 0; }
.bf-ai-msg ul, .bf-ai-msg ol { margin: 4px 0 8px 18px; }
.bf-ai-msg code {
  background: rgba(0,0,0,.3);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
  font-family: var(--font-mono);
}
.bf-ai-msg pre {
  background: rgba(0,0,0,.4);
  padding: 8px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 11px;
  margin: 4px 0;
}
.bf-ai-msg table {
  width: 100%;
  font-size: 11px;
  border-collapse: collapse;
  margin: 6px 0;
}
.bf-ai-msg th, .bf-ai-msg td {
  padding: 4px 6px;
  border: 1px solid var(--border);
  text-align: left;
}
.bf-ai-msg--assistant th { background: var(--bg-page); }

.bf-ai-typing {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-panel-2);
  border-radius: 14px;
}
.bf-ai-typing span {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: bf-ai-blink 1.4s infinite;
}
.bf-ai-typing span:nth-child(2) { animation-delay: .2s; }
.bf-ai-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes bf-ai-blink {
  0%, 80%, 100% { opacity: .3; }
  40% { opacity: 1; }
}

.bf-ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 var(--space-4) var(--space-3);
}
.bf-ai-suggest-btn {
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 16px;
  padding: 5px 12px;
  font-size: 11px;
  cursor: pointer;
}
.bf-ai-suggest-btn:hover {
  border-color: var(--brand-primary);
  background: var(--bg-hover);
}

.bf-ai-input-area {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
}
.bf-ai-input-box {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.bf-ai-input {
  flex: 1;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 13px;
  resize: none;
  max-height: 120px;
  font-family: inherit;
}
.bf-ai-input:focus {
  outline: none;
  border-color: var(--brand-primary);
}
.bf-ai-send {
  background: var(--brand-primary);
  border: none;
  color: white;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.bf-ai-send:disabled { opacity: .4; cursor: not-allowed; }
.bf-ai-footer {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 6px;
}
.bf-ai-cost {
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .bf-header__search { display: none; }
  .bf-area__items { grid-template-columns: repeat(3, 1fr); }
  .bf-launch-item { min-height: 80px; padding: var(--space-3) var(--space-1); }
  .bf-launch-item__icon { font-size: 22px; }
  .bf-launch-item__label { font-size: 10px; }
  .bf-semaphore { flex-direction: column; text-align: center; padding: var(--space-4); }
  .bf-semaphore__dot { width: 48px; height: 48px; font-size: 22px; }
  .bf-drawer { width: 100%; }
  .bf-container { padding: var(--space-3); }
}
