/* ============================================================
   BI AI Generator — prompt card inside Workbench
   ============================================================ */
.bi-ai-card {
  margin: 0 0 14px;
  padding: 14px 16px;
  border: 1px solid rgba(99, 102, 241, 0.18);
  background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(139,92,246,0.04));
  border-radius: 12px;
}
.bi-ai-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.bi-ai-title { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; letter-spacing: -0.01em; color: #4f46e5; }
.bi-ai-hint { font-size: 12px; color: #64748b; }
.bi-ai-textarea {
  width: 100%; box-sizing: border-box;
  padding: 10px 12px;
  font-family: inherit; font-size: 13px; line-height: 1.5;
  color: #0f172a; background: #fff;
  border: 1px solid rgba(15,23,42,0.10); border-radius: 8px;
  resize: vertical;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.bi-ai-textarea:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.14); }
.bi-ai-actions { margin-top: 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bi-ai-status { font-size: 12px; color: #475569; }

.bi-ai-preview { margin-top: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.bi-ai-preview-card { background: #fff; border: 1px solid rgba(15,23,42,0.08); border-radius: 9px; padding: 10px 12px; }
.bi-ai-preview-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.bi-ai-preview-card header strong { font-size: 13px; color: #0f172a; letter-spacing: -0.01em; display: block; line-height: 1.3; }
.bi-ai-preview-desc { margin: 6px 0 0; font-size: 11px; color: #64748b; line-height: 1.45; }
.btn.btn-sm { padding: 4px 10px; font-size: 11px; }

/* ============================================================
   BI Dashboards — professional grid
   ============================================================ */
.bid-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 18px;
  margin-top: 8px;
}
.bid-card {
  position: relative;
  background: #ffffff;
  border: 1px solid rgba(15,23,42,0.06);
  border-radius: 14px;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04);
  transition: box-shadow 200ms ease, border-color 200ms ease;
}
.bid-card:hover {
  box-shadow: 0 12px 32px -16px rgba(15,23,42,0.18), 0 2px 6px rgba(15,23,42,0.04);
  border-color: rgba(15,23,42,0.10);
}
.bid-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; }
.bid-card-title-wrap { min-width: 0; flex: 1; }
.bid-card-title { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.015em; color: #0f172a; line-height: 1.3; }
.bid-card-sub { margin: 4px 0 0; font-size: 12px; color: #64748b; line-height: 1.5; }
.bid-card-actions { display: flex; gap: 2px; flex-shrink: 0; }
.bid-icon-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  color: #64748b; cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}
.bid-icon-btn:hover { background: rgba(15,23,42,0.04); color: #0f172a; border-color: rgba(15,23,42,0.06); }
.bid-icon-btn.bid-icon-danger:hover { background: rgba(244,63,94,0.08); color: #e11d48; border-color: rgba(244,63,94,0.14); }
.bid-card-body {
  flex: 1; min-height: 240px;
  display: flex; align-items: center; justify-content: center;
  padding: 8px 18px 14px; position: relative;
}
.bid-card-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px;
  font-size: 10px; color: #94a3b8;
  border-top: 1px solid rgba(15,23,42,0.04);
  background: linear-gradient(to bottom, #fafbfc, #f6f7f9);
  letter-spacing: 0.06em; font-weight: 600; text-transform: uppercase;
}
.bid-meta, .bid-meta-source { display: inline-flex; align-items: center; gap: 6px; }
.bid-type-icon { display: inline-flex; color: #6366f1; }
.bid-type-icon svg { display: block; }
.bid-draft {
  padding: 2px 7px;
  background: rgba(245,158,11,0.12); color: #b45309;
  border-radius: 4px; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-top: 4px; display: inline-block;
}

/* SVG base */
.bid-svg { width: 100%; height: 240px; display: block; font-family: inherit; overflow: visible; }

/* Axis & grid */
.bid-grid-line { stroke: rgba(15,23,42,0.05); stroke-width: 1; stroke-dasharray: 2 3; }
.bid-axis-line { stroke: rgba(15,23,42,0.14); stroke-width: 1; }
.bid-axis-label { font-size: 10px; fill: #94a3b8; font-variant-numeric: tabular-nums; font-family: inherit; letter-spacing: 0.01em; }

/* Bar hover */
.bid-bar-g rect { transition: filter 150ms ease; }
.bid-bar-g:hover rect { filter: brightness(1.08) saturate(1.1); }

/* Line */
.bid-line-path { fill: none; stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.bid-line-dot { transition: r 150ms ease; }
.bid-line-dot:hover { r: 5; }

/* Pie / Donut */
.bid-pie-wrap { display: flex; align-items: center; gap: 20px; width: 100%; min-height: 200px; }
.bid-pie-chart { position: relative; width: 200px; height: 200px; flex-shrink: 0; }
.bid-pie-svg { width: 100%; height: 100%; display: block; }
.bid-pie-slice { transition: filter 150ms ease; transform-origin: center; cursor: pointer; }
.bid-pie-slice:hover { filter: brightness(1.1) saturate(1.15); }
.bid-pie-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; }
.bid-pie-total { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: #0f172a; font-variant-numeric: tabular-nums; line-height: 1; }
.bid-pie-total-label { margin-top: 4px; font-size: 9px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.bid-pie-legend {
  list-style: none; padding: 0; margin: 0;
  font-size: 12px; color: #0f172a; flex: 1; min-width: 0;
  max-height: 200px; overflow: auto;
  display: grid; gap: 2px;
}
.bid-pie-legend li {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  align-items: center; gap: 8px;
  padding: 5px 6px; border-radius: 6px;
  transition: background 120ms ease;
}
.bid-pie-legend li:hover { background: rgba(15,23,42,0.03); }
.bid-pie-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.bid-pie-label { color: #334155; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bid-pie-value { color: #0f172a; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 12px; }
.bid-pie-pct { color: #94a3b8; font-size: 11px; font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }

/* KPI */
.bid-kpi { text-align: center; padding: 24px 16px; width: 100%; }
.bid-kpi-value {
  font-size: 44px; font-weight: 700;
  letter-spacing: -0.035em; color: #0f172a;
  font-variant-numeric: tabular-nums; line-height: 1;
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.bid-kpi-label { margin-top: 10px; font-size: 10px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; }

/* Table */
.bid-table-wrap { width: 100%; max-height: 280px; overflow: auto; border: 1px solid rgba(15,23,42,0.05); border-radius: 8px; }
.bid-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.bid-table th {
  padding: 9px 12px; text-align: left; font-weight: 600;
  color: #64748b; background: #f8fafc;
  border-bottom: 1px solid rgba(15,23,42,0.06);
  position: sticky; top: 0; z-index: 1;
  text-transform: uppercase; font-size: 10px; letter-spacing: 0.06em;
}
.bid-table td { padding: 8px 12px; border-bottom: 1px solid rgba(15,23,42,0.04); color: #0f172a; }
.bid-table tbody tr:last-child td { border-bottom: none; }
.bid-table tbody tr:hover { background: rgba(99,102,241,0.03); }
.bid-th-num, .bid-td-num { text-align: right; font-variant-numeric: tabular-nums; }
.bid-num { font-variant-numeric: tabular-nums; }
.bid-muted { color: #94a3b8; }

/* Skeleton */
.bid-skeleton {
  position: relative; width: 100%; height: 200px;
  background: linear-gradient(90deg, #f1f5f9 0%, #f8fafc 50%, #f1f5f9 100%);
  border-radius: 8px; overflow: hidden;
}
.bid-skeleton-shimmer {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.6) 50%, transparent 100%);
  animation: bidShimmer 1.6s ease-in-out infinite;
}
@keyframes bidShimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.bid-skel-line { height: 10px; background: #f1f5f9; border-radius: 4px; margin-bottom: 8px; }
.bid-skel-line.w-60 { width: 60%; }
.bid-skel-line.w-40 { width: 40%; }
.bid-card-skel { padding: 16px 18px; min-height: 240px; }

/* Empty & error */
.bid-empty { text-align: center; padding: 48px 24px; color: #64748b; }
.bid-empty-icon { margin: 0 auto 14px; width: 48px; height: 48px; color: #cbd5e1; display: flex; align-items: center; justify-content: center; }
.bid-empty-icon svg { width: 100%; height: 100%; }
.bid-empty-data { padding: 24px; color: #94a3b8; font-size: 13px; text-align: center; }
.bid-error {
  padding: 16px 18px;
  background: rgba(244,63,94,0.06);
  border: 1px solid rgba(244,63,94,0.16);
  border-radius: 8px; color: #be123c;
  font-size: 12px; line-height: 1.5;
  width: 100%; text-align: center;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .bid-card { background: #0f172a; border-color: rgba(255,255,255,0.06); box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
  .bid-card:hover { border-color: rgba(255,255,255,0.12); box-shadow: 0 12px 32px -16px rgba(0,0,0,0.5); }
  .bid-card-title { color: #f1f5f9; }
  .bid-card-sub { color: #94a3b8; }
  .bid-card-foot { background: linear-gradient(to bottom, #0b1220, #080e1a); border-top-color: rgba(255,255,255,0.04); color: #64748b; }
  .bid-icon-btn { color: #94a3b8; }
  .bid-icon-btn:hover { background: rgba(255,255,255,0.05); color: #f1f5f9; }
  .bid-grid-line { stroke: rgba(255,255,255,0.06); }
  .bid-axis-line { stroke: rgba(255,255,255,0.12); }
  .bid-axis-label { fill: #64748b; }
  .bid-kpi-value { background: linear-gradient(135deg, #f1f5f9 0%, #94a3b8 100%); -webkit-background-clip: text; background-clip: text; }
  .bid-kpi-label { color: #64748b; }
  .bid-pie-total { color: #f1f5f9; }
  .bid-pie-total-label { color: #64748b; }
  .bid-pie-label { color: #cbd5e1; }
  .bid-pie-value { color: #f1f5f9; }
  .bid-pie-legend li:hover { background: rgba(255,255,255,0.04); }
  .bid-table-wrap { border-color: rgba(255,255,255,0.06); }
  .bid-table th { background: #0b1220; color: #64748b; border-bottom-color: rgba(255,255,255,0.06); }
  .bid-table td { color: #e2e8f0; border-bottom-color: rgba(255,255,255,0.04); }
  .bid-table tbody tr:hover { background: rgba(99,102,241,0.08); }
  .bid-muted { color: #64748b; }
  .bid-skeleton { background: linear-gradient(90deg, #1e293b 0%, #0f172a 50%, #1e293b 100%); }
  .bid-skeleton-shimmer { background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.05) 50%, transparent 100%); }
  .bid-skel-line { background: #1e293b; }
  .bid-empty { color: #64748b; }
  .bid-empty-icon { color: #334155; }
  .bid-empty-data { color: #64748b; }
  .bid-error { background: rgba(244,63,94,0.10); border-color: rgba(244,63,94,0.22); color: #fb7185; }
}

/* ============================================================
   BI Dashboards — grid editável (dentro de .gd-tile)
   ============================================================ */
.bid-top-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 24px 0;
  position: relative;
  z-index: 2;
}
.bid-top-bar .bi-inline-field { color: #e2e8f0; font-size: 12px; }
.bid-top-bar select {
  background: rgba(15,23,42,0.6);
  border: 1px solid rgba(255,255,255,0.08);
  color: #f1f5f9;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  margin-left: 8px;
}
.bid-top-bar select:focus { outline: none; border-color: rgba(99,102,241,0.5); }

/* Tile interno — herda o frame da .gd-tile, só estiliza conteúdo */
.bid-tile {
  display: flex; flex-direction: column;
  height: 100%; width: 100%;
  overflow: hidden;
  container-type: size;
  container-name: tile;
}
.bid-tile-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 8px;
  flex-shrink: 0;
}
.bid-tile-title-wrap { min-width: 0; flex: 1; }
.bid-tile-title {
  margin: 0;
  font-size: 13px; font-weight: 600;
  letter-spacing: -0.01em;
  color: #0f172a;
  line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bid-tile-sub {
  margin: 2px 0 0;
  font-size: 11px; color: #64748b;
  line-height: 1.45;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.bid-tile-actions { display: flex; gap: 2px; flex-shrink: 0; }
.bid-tile-body {
  flex: 1;
  min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 6px 14px 10px;
  position: relative;
  overflow: hidden;
}
.bid-tile-body .bid-svg { width: 100%; height: 100%; max-height: 100%; }

/* Pie/donut: cresce com o container, mantendo aspect ratio quadrado */
.bid-tile-body .bid-pie-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  height: 100%;
  min-height: 0;
}
.bid-tile-body .bid-pie-chart {
  position: relative;
  flex-shrink: 0;
  aspect-ratio: 1 / 1;
  height: 100%;
  max-height: 280px;
  min-height: 140px;
}
.bid-tile-body .bid-pie-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.bid-tile-body .bid-pie-legend {
  flex: 1;
  min-width: 0;
  overflow: auto;
  max-height: 100%;
}

/* Trocador de tipo de gráfico (popover por tile) */
.bid-chart-switch { position: relative; display: inline-flex; }
.bid-chart-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 30;
  min-width: 160px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.04);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.bid-chart-menu[hidden] { display: none; }
.bid-chart-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #1f2937;
  transition: background .12s;
  width: 100%;
}
.bid-chart-menu-item:hover { background: #f3f4f6; }
.bid-chart-menu-item.is-active { background: rgba(99, 102, 241, 0.10); color: #4338ca; font-weight: 600; }
.bid-chart-menu-icon { display: inline-flex; width: 16px; height: 16px; color: #6366f1; }
.bid-chart-menu-icon svg { width: 16px; height: 16px; }

/* Drill-down — alvos clicáveis */
.bid-drill-target { cursor: pointer; transition: opacity .12s, filter .12s; }
.bid-drill-target:hover { opacity: 0.82; filter: brightness(1.08); }
tr.bid-drill-target:hover { background: rgba(99, 102, 241, 0.06); }

/* Drill-down — modal */
.bid-drill-overlay {
  position: fixed; inset: 0; z-index: 5000;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: bidFadeIn .14s ease-out;
}
@keyframes bidFadeIn { from { opacity: 0; } to { opacity: 1; } }
.bid-drill-modal {
  background: #fff;
  width: 100%; max-width: 1200px; max-height: 88vh;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.32);
  display: flex; flex-direction: column;
  overflow: hidden;
  color: #0f172a;
}
.bid-drill-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}
.bid-drill-crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; font-size: 12px; }
.bid-drill-crumbs button {
  background: transparent; border: 0; padding: 2px 8px;
  border-radius: 6px; color: #4338ca; cursor: pointer; font-weight: 600;
}
.bid-drill-crumbs button:hover { background: #eef2ff; }
.bid-drill-crumbs .bid-drill-crumb-sep { color: #94a3b8; }
.bid-drill-title strong { display: block; font-size: 16px; color: #0f172a; line-height: 1.3; font-weight: 700; }
.bid-drill-title .bid-drill-sub { display: block; margin-top: 6px; font-size: 12px; color: #475569; line-height: 1.5; }
.bid-drill-title code { background: #eef2ff; color: #4338ca; padding: 2px 7px; border-radius: 4px; font-family: ui-monospace, SFMono-Regular, monospace; font-size: 11px; font-weight: 600; }
.bid-drill-close {
  background: transparent; border: 1px solid transparent; padding: 6px;
  border-radius: 8px; color: #475569; cursor: pointer;
  display: inline-flex; transition: background .12s, color .12s;
  flex-shrink: 0;
}
.bid-drill-close:hover { background: #f1f5f9; color: #0f172a; }
.bid-drill-body {
  flex: 1; min-height: 200px;
  overflow: auto;
  padding: 0;
}
.bid-drill-table-wrap { overflow: auto; padding: 0 22px 12px; }

/* Tabela do drill — alta legibilidade */
.bid-drill-modal table.bid-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  color: #0f172a;
  background: #fff;
}
.bid-drill-modal table.bid-table thead th {
  position: sticky; top: 0;
  background: #f1f5f9;
  color: #1e293b;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid #cbd5e1;
  white-space: nowrap;
  z-index: 1;
}
.bid-drill-modal table.bid-table thead th.bid-th-num { text-align: right; }
.bid-drill-modal table.bid-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  color: #1f2937;
  font-weight: 500;
  white-space: nowrap;
}
.bid-drill-modal table.bid-table tbody td.bid-td-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #0f172a;
}
.bid-drill-modal table.bid-table tbody tr:nth-child(even) td { background: #fafbfc; }
.bid-drill-modal table.bid-table tbody tr:hover td { background: #eef2ff; }
.bid-drill-modal table.bid-table tbody tr.bid-drill-row-clickable { cursor: pointer; }
.bid-drill-modal table.bid-table tbody tr.bid-drill-row-clickable td:first-child::before {
  content: "▶";
  color: #6366f1;
  font-size: 9px;
  margin-right: 6px;
  opacity: 0.5;
}
.bid-drill-modal table.bid-table tbody tr.bid-drill-row-clickable:hover td:first-child::before { opacity: 1; }
.bid-drill-modal .bid-empty-data {
  padding: 60px 22px;
  text-align: center;
  color: #64748b;
  font-size: 14px;
}
.bid-drill-modal .bid-error {
  padding: 24px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #b91c1c;
  margin: 18px 22px;
}

.bid-drill-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px;
  border-top: 1px solid #e2e8f0;
  background: #fafbfc;
  font-size: 12px; color: #475569;
  font-weight: 500;
}
.bid-drill-actions { display: flex; gap: 8px; }
.bid-drill-actions button {
  font-size: 12px; padding: 7px 14px; font-weight: 600;
  border: 1px solid #cbd5e1; border-radius: 6px;
  background: #fff; color: #1e293b;
  cursor: pointer;
  transition: all .12s;
}
.bid-drill-actions button:hover { background: #f8fafc; border-color: #94a3b8; }
.bid-drill-loading { padding: 60px 22px; text-align: center; color: #64748b; font-size: 13px; }
.bid-drill-loading .bid-skeleton { max-width: 600px; margin: 0 auto; height: 16px; border-radius: 4px; }
.bid-drill-ai-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(139,92,246,0.1));
  color: #6d28d9;
  padding: 2px 8px;
  border-radius: 50px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Modo de edição manual da SQL no erro */
.bid-drill-error-wrap { padding: 18px 22px; display: flex; flex-direction: column; gap: 16px; }
.bid-drill-edit { display: flex; flex-direction: column; gap: 10px; }
.bid-drill-edit-label {
  font-size: 12px; font-weight: 600; color: #1e293b;
}
.bid-drill-edit-label code {
  background: #eef2ff; color: #4338ca;
  padding: 1px 6px; border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, monospace; font-size: 11px;
}
.bid-drill-edit-sql {
  width: 100%; min-height: 220px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  color: #0f172a;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  resize: vertical;
}
.bid-drill-edit-sql:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
  background: #fff;
}
.bid-drill-edit-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bid-drill-edit-actions button {
  padding: 8px 16px; font-size: 13px; font-weight: 600;
  border-radius: 6px; cursor: pointer;
  border: 1px solid #cbd5e1; background: #fff; color: #1e293b;
  transition: all .12s;
}
.bid-drill-edit-actions button:hover { background: #f8fafc; border-color: #94a3b8; }
.bid-drill-edit-primary {
  background: #6366f1 !important; color: #fff !important;
  border-color: #6366f1 !important;
}
.bid-drill-edit-primary:hover { background: #4f46e5 !important; }
.bid-drill-edit-hint {
  font-size: 11px; color: #64748b; margin: 0; line-height: 1.5;
}
.bid-drill-base-input {
  width: 100%;
  padding: 8px 12px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
  font-weight: 600;
  color: #4338ca;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  text-transform: uppercase;
}
.bid-drill-base-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
  background: #fff;
}

/* Slicer Bar — filtros visuais estilo Power BI */
.bid-slicer-bar {
  display: flex; gap: 12px; flex-wrap: wrap;
  padding: 12px;
  margin: 0 0 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  align-items: stretch;
}
.bid-slicer-bar-active { padding: 14px; gap: 14px; }
.bid-slicer-empty {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: #64748b;
  padding: 4px 8px;
}
.bid-slicer-empty svg { color: #94a3b8; }
.bid-slicer-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  width: 240px;
  display: flex; flex-direction: column;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04);
  overflow: hidden;
}
.bid-slicer-card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
}
.bid-slicer-card-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.bid-slicer-col {
  font-size: 11px; font-weight: 800;
  color: #0f172a;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bid-slicer-count {
  font-size: 11px; color: #64748b; font-weight: 500;
}
.bid-slicer-count.is-active { color: #4338ca; font-weight: 700; }
.bid-slicer-close {
  background: transparent; border: 0;
  padding: 4px; border-radius: 5px;
  color: #94a3b8; cursor: pointer;
  display: inline-flex;
  transition: all .12s;
  flex-shrink: 0;
}
.bid-slicer-close:hover { background: #fef2f2; color: #ef4444; }
.bid-slicer-search {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid #f1f5f9;
  background: #fafbfc;
}
.bid-slicer-search svg { color: #94a3b8; flex-shrink: 0; }
.bid-slicer-search input {
  flex: 1;
  border: 0; background: transparent; outline: none;
  font-size: 12px; color: #0f172a;
}
.bid-slicer-search input::placeholder { color: #cbd5e1; }
.bid-slicer-actions {
  display: flex; gap: 4px;
  padding: 6px 10px;
  border-bottom: 1px solid #f1f5f9;
}
.bid-slicer-actions button {
  flex: 1;
  background: transparent; border: 0;
  padding: 4px 8px;
  font-size: 10px; font-weight: 600;
  color: #6366f1; cursor: pointer;
  border-radius: 4px;
  transition: background .12s;
}
.bid-slicer-actions button:hover { background: #eef2ff; }
.bid-slicer-list {
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}
.bid-slicer-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  color: #1e293b;
  transition: background .1s;
  user-select: none;
}
.bid-slicer-item:hover { background: #f8fafc; }
.bid-slicer-item.is-checked { background: #eef2ff; color: #1e1b4b; font-weight: 600; }
.bid-slicer-item input[type="checkbox"] {
  flex-shrink: 0;
  cursor: pointer;
  accent-color: #6366f1;
}
.bid-slicer-item-label {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bid-slicer-no-results, .bid-slicer-truncated {
  padding: 12px;
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
}
.bid-slicer-add-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  width: 140px; min-height: 80px;
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all .15s;
  font-size: 12px; font-weight: 600;
}
.bid-slicer-add-card:hover {
  border-color: #6366f1; color: #4338ca; background: #eef2ff;
}
.bid-slicer-add {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; margin-left: auto;
  border: 1px solid #6366f1; background: #6366f1;
  border-radius: 6px;
  color: #fff;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: background .12s;
}
.bid-slicer-add:hover { background: #4f46e5; border-color: #4f46e5; }
.bid-slicer-status {
  margin-top: 8px;
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  display: none;
}
.bid-slicer-status.loading { display: block; background: #eef2ff; color: #4338ca; }
.bid-slicer-status.err { display: block; background: #fef2f2; color: #b91c1c; }

/* Filter bar legado (mantido pra retrocompat caso alguma chamada antiga ainda use) */
.bid-filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px;
  margin: 0 0 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.bid-filter-label {
  font-size: 11px; font-weight: 700; color: #475569;
  text-transform: uppercase; letter-spacing: 0.06em;
  flex-shrink: 0;
}
.bid-filter-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; }
.bid-filter-empty { font-size: 12px; color: #94a3b8; font-style: italic; }
.bid-filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 6px 5px 10px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 50px;
  font-size: 12px;
  color: #1e293b;
  font-weight: 500;
}
.bid-filter-chip strong { color: #4338ca; font-weight: 700; }
.bid-filter-chip .bid-filter-op { color: #64748b; font-weight: 600; }
.bid-filter-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border: 0; border-radius: 50%;
  background: rgba(67, 56, 202, 0.12); color: #4338ca;
  font-size: 14px; font-weight: 700; line-height: 1;
  cursor: pointer; padding: 0;
  transition: all .12s;
}
.bid-filter-x:hover { background: #ef4444; color: #fff; }
.bid-filter-add, .bid-filter-clear {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #fff;
  font-size: 12px; font-weight: 600; color: #1e293b;
  cursor: pointer;
  transition: all .12s;
  flex-shrink: 0;
}
.bid-filter-add:hover { background: #eef2ff; border-color: #6366f1; color: #4338ca; }
.bid-filter-clear { color: #b91c1c; }
.bid-filter-clear:hover { background: #fef2f2; border-color: #fecaca; }

/* Modal de adicionar filtro */
.bid-filter-modal-overlay {
  position: fixed; inset: 0; z-index: 5100;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.bid-filter-modal {
  background: #fff;
  width: 100%; max-width: 480px;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.32);
  overflow: hidden;
}
.bid-filter-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #e2e8f0;
}
.bid-filter-modal-head h3 { margin: 0; font-size: 15px; font-weight: 700; color: #0f172a; }
.bid-filter-modal-close {
  background: transparent; border: 0; padding: 4px; cursor: pointer; color: #64748b;
  border-radius: 6px;
}
.bid-filter-modal-close:hover { background: #f1f5f9; color: #0f172a; }
.bid-filter-modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.bid-filter-field { display: flex; flex-direction: column; gap: 5px; }
.bid-filter-field span {
  font-size: 11px; font-weight: 700; color: #475569;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.bid-filter-field input, .bid-filter-field select {
  padding: 8px 12px;
  font-size: 13px;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-family: inherit;
}
.bid-filter-field input:focus, .bid-filter-field select:focus {
  outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.bid-filter-hint { font-size: 11px; color: #64748b; margin: 4px 0 0; line-height: 1.5; }
.bid-filter-modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px; border-top: 1px solid #f1f5f9;
}
.bid-filter-modal-foot button {
  padding: 8px 16px; font-size: 13px; font-weight: 600;
  border-radius: 6px; cursor: pointer;
}
.bid-filter-cancel { border: 1px solid #cbd5e1; background: #fff; color: #1e293b; }
.bid-filter-cancel:hover { background: #f8fafc; }
.bid-filter-save { border: 1px solid #6366f1; background: #6366f1; color: #fff; }
.bid-filter-save:hover { background: #4f46e5; border-color: #4f46e5; }
.bid-tile-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px;
  font-size: 9px; color: #64748b;
  border-top: 1px solid #f1f5f9;
  letter-spacing: 0.08em; font-weight: 600; text-transform: uppercase;
  flex-shrink: 0;
}
.bid-tile .bid-type-icon { color: #6366f1; }
.bid-tile .bid-icon-btn { color: #64748b; background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 4px; cursor: pointer; display: inline-flex; transition: all .12s ease; }
.bid-tile .bid-icon-btn:hover { background: #f3f4f6; color: #0f172a; border-color: #e5e7eb; }
.bid-tile .bid-icon-btn.bid-icon-danger:hover { background: rgba(244,63,94,0.08); color: #e11d48; border-color: rgba(244,63,94,0.2); }

/* Charts/SVG no tile light */
.bid-tile .bid-grid-line { stroke: #f1f5f9; }
.bid-tile .bid-axis-line { stroke: #cbd5e1; }
.bid-tile .bid-axis-label { fill: #64748b; }
.bid-tile .bid-kpi-value {
  background: linear-gradient(135deg, #0f172a 0%, #6366f1 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.bid-tile .bid-kpi-label { color: #64748b; }
.bid-tile .bid-pie-total { color: #0f172a; }
.bid-tile .bid-pie-total-label { color: #64748b; }
.bid-tile .bid-pie-label { color: #334155; }
.bid-tile .bid-pie-value { color: #0f172a; }
.bid-tile .bid-pie-pct { color: #64748b; }
.bid-tile .bid-pie-legend li:hover { background: #f3f4f6; }
.bid-tile .bid-table-wrap { border-color: #e5e7eb; }
.bid-tile .bid-table th { background: #f9fafb; color: #64748b; border-bottom-color: #e5e7eb; }
.bid-tile .bid-table td { color: #1e293b; border-bottom-color: #f3f4f6; }
.bid-tile .bid-table tbody tr:hover { background: rgba(99,102,241,0.06); }
.bid-tile .bid-muted, .bid-tile .bid-empty-data { color: #64748b; }
.bid-tile .bid-skeleton { background: linear-gradient(90deg, #f1f5f9 0%, #e5e7eb 50%, #f1f5f9 100%); }
.bid-tile .bid-skeleton-shimmer { background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.5) 50%, transparent 100%); }
.bid-tile .bid-error { background: rgba(244,63,94,0.08); border-color: rgba(244,63,94,0.22); color: #e11d48; }

/* ─── Container queries: conteúdo escala com o tamanho do widget ─── */
.bid-tile .bid-table-wrap {
  max-height: none;
  height: 100%;
  overflow: hidden;
}
.bid-tile .bid-table {
  font-size: clamp(9px, 1.9cqh, 14px);
  table-layout: fixed;
}
.bid-tile .bid-table th {
  padding: clamp(4px, 1.2cqh, 12px) clamp(6px, 1.8cqw, 14px);
  font-size: clamp(8px, 1.3cqh, 11px);
}
.bid-tile .bid-table td {
  padding: clamp(3px, 1.1cqh, 10px) clamp(6px, 1.8cqw, 14px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bid-tile .bid-kpi {
  padding: clamp(8px, 3cqh, 32px) clamp(8px, 3cqw, 20px);
}
.bid-tile .bid-kpi-value {
  font-size: clamp(22px, 14cqh, 88px);
}
.bid-tile .bid-kpi-label {
  font-size: clamp(8px, 1.6cqh, 13px);
  margin-top: clamp(4px, 1.2cqh, 14px);
}
.bid-tile-title {
  font-size: clamp(11px, 1.9cqh, 16px);
}
.bid-tile-sub {
  font-size: clamp(9px, 1.5cqh, 13px);
}
.bid-tile-foot {
  font-size: clamp(8px, 1.1cqh, 10px);
  padding: clamp(4px, 1cqh, 10px) clamp(10px, 2cqw, 18px);
}


/* Period picker (sempre visível) */
.bid-period {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.bid-period-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: #64748b;
}
.bid-period-chips {
  display: inline-flex; gap: 2px; padding: 3px;
  background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 10px;
}
.bid-period-chip {
  appearance: none; border: 0; background: transparent;
  padding: 6px 12px; border-radius: 7px;
  font-size: 12px; font-weight: 500; color: #475569;
  cursor: pointer; transition: all 150ms ease;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.bid-period-chip:hover { color: #0f172a; background: rgba(255,255,255,0.6); }
.bid-period-chip.is-active {
  background: #ffffff; color: #0f172a; font-weight: 600;
  box-shadow: 0 1px 2px rgba(15,23,42,0.06), 0 0 0 1px rgba(15,23,42,0.08);
}
.bid-period-custom {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px;
  background: #ffffff; border: 1px solid #e2e8f0; border-radius: 10px;
}
.bid-period-custom input[type="date"] {
  appearance: none; border: 0; background: transparent;
  font-size: 12px; color: #0f172a; font-family: inherit;
  padding: 4px 2px; outline: none;
}
.bid-period-sep { color: #94a3b8; font-size: 12px; }


/* Scroll internos — evita que prompt/preview/editor empurrem a tela */
.bi-ai-card {
  max-height: 360px;
  display: flex; flex-direction: column;
}
.bi-ai-textarea {
  max-height: 140px;
  overflow-y: auto;
}
.bi-ai-preview {
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}
/* Scrollbar estilizada (webkit) */
.bi-ai-textarea::-webkit-scrollbar,
.bi-ai-preview::-webkit-scrollbar { width: 8px; }
.bi-ai-textarea::-webkit-scrollbar-thumb,
.bi-ai-preview::-webkit-scrollbar-thumb {
  background: rgba(15,23,42,0.18); border-radius: 4px;
}
.bi-ai-textarea::-webkit-scrollbar-thumb:hover,
.bi-ai-preview::-webkit-scrollbar-thumb:hover {
  background: rgba(15,23,42,0.32);
}


/* Table sortable headers */
.bid-tile .bid-th-sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: background 120ms ease, color 120ms ease;
}
.bid-tile .bid-th-sortable:hover { background: #f1f5f9; color: #0f172a; }
.bid-tile .bid-th-sortable.is-sorted { color: #4f46e5; background: rgba(99,102,241,0.06); }
.bid-tile .bid-th-label { margin-right: 4px; }
.bid-tile .bid-sort-icon {
  display: inline-block;
  font-size: 10px;
  opacity: 0.35;
  transition: opacity 120ms ease;
  font-weight: 700;
}
.bid-tile .bid-th-sortable:hover .bid-sort-icon { opacity: 0.75; }
.bid-tile .bid-sort-icon.is-active { opacity: 1; color: #4f46e5; }

/* ===== Views (histórico IA) ===== */
.bi-views-wrap { padding: 24px 0; }
.bi-views-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.bi-views-title {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #0f172a;
}
.bi-views-sub { margin: 0; font-size: 13px; color: #64748b; }
.bi-views-list { display: flex; flex-direction: column; gap: 10px; }
.bi-views-empty {
  text-align: center;
  padding: 48px 24px;
  background: #f8fafc;
  border: 1px dashed #e2e8f0;
  border-radius: 12px;
  color: #64748b;
}
.bi-views-empty strong { display: block; color: #0f172a; margin-bottom: 4px; font-size: 14px; }
.bi-view-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.bi-view-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px -2px rgba(15, 23, 42, 0.08);
}
.bi-view-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.bi-view-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #64748b;
  flex-wrap: wrap;
}
.bi-view-dot { opacity: 0.5; }
.bi-view-when { font-variant-numeric: tabular-nums; }
.bi-view-stats { display: flex; gap: 6px; flex-shrink: 0; }
.bi-view-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  letter-spacing: 0.01em;
}
.bi-view-badge.bi-view-ok { background: #dcfce7; color: #15803d; }
.bi-view-badge.bi-view-err { background: #fee2e2; color: #b91c1c; }
.bi-view-prompt {
  margin: 0 0 10px;
  font-size: 13px;
  color: #1e293b;
  line-height: 1.5;
}
.bi-view-tables {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-size: 11px;
}
.bi-view-tables-label {
  color: #94a3b8;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.bi-view-table {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  padding: 2px 7px;
  background: #eef2ff;
  color: #4338ca;
  border-radius: 5px;
  border: 1px solid #e0e7ff;
}
.bi-view-actions { display: flex; gap: 6px; }
.bi-view-actions .btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
/* Modal detalhe */
.bi-view-detail-meta { margin-bottom: 18px; }
.bi-view-detail-meta > div { margin-bottom: 12px; font-size: 13px; }
.bi-view-detail-meta strong {
  display: block;
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.bi-view-detail-meta p { margin: 0; color: #0f172a; line-height: 1.5; }
.bi-view-panel {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.bi-view-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.bi-view-panel-head strong { flex: 1; font-size: 13px; color: #0f172a; letter-spacing: -0.01em; }
.bi-view-panel-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.bi-view-panel-badge {
  font-size: 10px;
  padding: 3px 8px;
  background: #fef3c7;
  color: #92400e;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.bi-view-edit {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px;
  margin-top: 8px;
}
.bi-view-edit-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 0 0 4px;
}
.bi-view-edit-label:not(:first-child) { margin-top: 10px; }
.bi-view-edit-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
  color: #0f172a;
  background: #ffffff;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.bi-view-edit-input:focus,
.bi-view-edit-sql:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
.bi-view-edit-sql {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
  color: #0f172a;
  background: #f8fafc;
  resize: vertical;
  min-height: 140px;
}
.bi-view-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
.bi-view-edit-msg {
  margin-top: 8px;
  font-size: 12px;
  color: #64748b;
  text-align: right;
}
.bi-view-edit-msg.is-ok { color: #15803d; }
.bi-view-edit-msg.is-err { color: #b91c1c; }
.bi-view-chart {
  font-size: 10px;
  padding: 2px 7px;
  background: #e0e7ff;
  color: #4338ca;
  border-radius: 999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.bi-view-panel-desc { margin: 0 0 8px; font-size: 12px; color: #64748b; }
.bi-view-panel-err {
  margin-bottom: 8px;
  padding: 6px 10px;
  background: #fef2f2;
  border-left: 3px solid #dc2626;
  color: #991b1b;
  font-size: 12px;
  border-radius: 4px;
}
.bi-view-sql {
  margin: 0;
  padding: 10px 12px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
}
.bi-view-sql::-webkit-scrollbar { height: 6px; }
.bi-view-sql::-webkit-scrollbar-thumb { background: #475569; border-radius: 3px; }

/* ===== AI tab target (Criar BI) ===== */
.bi-ai-tab-target {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 10px 0 0;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.bi-ai-tab-target > label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.bi-ai-tab-sel {
  padding: 7px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  font-size: 13px;
  color: #0f172a;
  background: #ffffff;
  min-width: 180px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.bi-ai-tab-sel:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
.bi-ai-tab-new {
  background: transparent;
  border: 1px dashed #cbd5e1;
  color: #64748b;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 120ms ease;
}
.bi-ai-tab-new:hover {
  border-color: #4f46e5;
  color: #4f46e5;
  background: rgba(79, 70, 229, 0.04);
}

/* ===== Tab bar ===== */
.bid-tabbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px;
  margin: 4px 0 16px;
  border-bottom: 1px solid #e2e8f0;
  overflow-x: auto;
  scrollbar-width: thin;
}
.bid-tabbar::-webkit-scrollbar { height: 6px; }
.bid-tabbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.bid-tabbar-inner {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: max-content;
}
.bid-tab {
  display: inline-flex;
  align-items: center;
  position: relative;
  border-radius: 8px 8px 0 0;
  transition: background 120ms ease;
}
.bid-tab:hover { background: #f8fafc; }
.bid-tab.is-active { background: #ffffff; }
.bid-tab.is-active::after {
  content: "";
  position: absolute;
  left: 8px; right: 8px; bottom: -1px;
  height: 2px;
  background: #4f46e5;
  border-radius: 2px;
}
.bid-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: transparent;
  border: 0;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: color 120ms ease;
}
.bid-tab.is-active .bid-tab-btn { color: #0f172a; font-weight: 600; }
.bid-tab-name { line-height: 1; }
.bid-tab-lock {
  font-size: 11px;
  opacity: 0.6;
  display: inline-flex;
  align-items: center;
}
.bid-tab-kebab {
  background: transparent;
  border: 0;
  padding: 6px 8px;
  margin-right: 2px;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1;
  transition: background 120ms ease, color 120ms ease;
}
.bid-tab-kebab:hover { background: #f1f5f9; color: #0f172a; }
.bid-tab-add {
  margin-left: 6px;
  background: transparent;
  border: 1px dashed #cbd5e1;
  color: #64748b;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 120ms ease;
}
.bid-tab-add:hover {
  border-color: #4f46e5;
  color: #4f46e5;
  background: rgba(79, 70, 229, 0.04);
}

/* ===== Modal ===== */
.bid-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: bidFadeIn 160ms ease;
}
@keyframes bidFadeIn { from { opacity: 0; } to { opacity: 1; } }
.bid-modal {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 24px 60px -12px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(15, 23, 42, 0.05);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: bidModalIn 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes bidModalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.bid-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid #e2e8f0;
}
.bid-modal-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  letter-spacing: -0.01em;
}
.bid-modal-close {
  background: transparent;
  border: 0;
  color: #94a3b8;
  font-size: 20px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 120ms ease, color 120ms ease;
}
.bid-modal-close:hover { background: #f1f5f9; color: #0f172a; }
.bid-modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1;
}
.bid-modal-body::-webkit-scrollbar { width: 6px; }
.bid-modal-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.bid-modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}
.bid-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.bid-form-field > label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.bid-form-field input[type="text"] {
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  color: #0f172a;
  background: #ffffff;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.bid-form-field input[type="text"]:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
.bid-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
}
.bid-radio input[type="radio"] { accent-color: #4f46e5; margin: 0; }
.bid-member-list {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  max-height: 240px;
  overflow-y: auto;
  background: #ffffff;
}
.bid-member-list::-webkit-scrollbar { width: 6px; }
.bid-member-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.bid-member-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 120ms ease;
}
.bid-member-item:last-child { border-bottom: 0; }
.bid-member-item:hover { background: #f8fafc; }
.bid-member-item input[type="checkbox"] { accent-color: #4f46e5; margin: 0; }
.bid-member-item > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.bid-member-name {
  font-size: 13px;
  font-weight: 500;
  color: #0f172a;
  line-height: 1.3;
}
.bid-member-email {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.3;
}
.bid-muted {
  color: #94a3b8;
  font-size: 12px;
}
.btn-danger {
  background: #ffffff;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 120ms ease;
}
.btn-danger:hover {
  background: #fef2f2;
  border-color: #f87171;
}


