/* Hero Simulation styles — neon spectrum on piano-black; AA-strong on snow-white */
.hero-sim {
  position: relative; width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  display: flex; flex-direction: column; overflow: hidden;
}
.hs-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--border-strong);
  background: var(--surface); flex-shrink: 0;
}
.hs-mode-switch { display: flex; gap: 8px; }
.hs-mode-btn {
  background: transparent; color: var(--fg);
  border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 8px 16px; font-family: var(--font-ui); font-weight: 700;
  font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  transition: all 0.2s;
}
.hs-mode-btn:hover { border-color: var(--sys-cyan); color: var(--sys-cyan); }
.hs-mode-btn.on { background: var(--sys-magenta); border-color: var(--sys-magenta); color: #fff; box-shadow: var(--glow-magenta); }
.hs-icon { font-size: 16px; }
.hs-controls { display: flex; gap: 12px; align-items: center; }
.hs-ctrl, .hs-speed button {
  background: transparent; color: var(--fg);
  border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 8px 14px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.hs-speed { display: flex; gap: 4px; }
.hs-speed button.on { background: var(--sys-magenta); border-color: var(--sys-magenta); color: #fff; box-shadow: var(--glow-magenta); }
.hs-stage { flex: 1; min-height: 0; padding: 24px; overflow: hidden; position: relative; }

/* ============= BOARD ============= */
.board-sim { width: 100%; height: 100%; display: flex; flex-direction: column; gap: 14px; }
.board-grid {
  flex: 1; display: grid;
  grid-template-columns: 0.6fr 2.4fr 0.5fr 0.5fr 0.5fr;
  gap: 12px; min-height: 0;
}
.board-group {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 16px;
  padding: 12px; min-height: 0;
}
.bg-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 4px 10px; border-bottom: 1px dashed var(--border-strong);
  margin-bottom: 10px;
}
.bg-cat { font-weight: 800; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg); }
.bg-count { font-size: 12px; color: var(--fg-muted); font-family: var(--font-mono); font-weight: 700; }

/* category-specific neon accents on the column header */
.cat-proposed   .bg-cat { color: var(--sys-cyan); }
.cat-inprogress .bg-cat { color: var(--sys-magenta); }
.cat-resolved   .bg-cat { color: var(--sys-violet); }
.cat-completed  .bg-cat { color: var(--sys-lime); }
.cat-removed    .bg-cat { color: var(--fg-dim); }

.bg-states { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; overflow: hidden; }
.bg-state {
  background: transparent; border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 6px 10px;
  transition: border-color 0.4s, background 0.4s, box-shadow 0.4s;
  height: 56px; flex-shrink: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.bg-state.active { border-color: var(--sys-magenta); box-shadow: var(--glow-magenta); }
.cat-completed .bg-state.active { border-color: var(--sys-lime); box-shadow: var(--glow-lime); }
.cat-resolved  .bg-state.active { border-color: var(--sys-cyan);  box-shadow: var(--glow-cyan); }
.cat-removed   .bg-state.active { border-color: var(--fg-muted); box-shadow: none; }

.bg-state-name { font-size: 11px; font-weight: 700; color: var(--fg); margin-bottom: 4px; letter-spacing: 0.05em; text-transform: uppercase; flex-shrink: 0; }
.bg-state-cards { display: flex; flex-direction: column; gap: 3px; flex: 1; min-height: 0; justify-content: center; }
.bg-state-cards .board-card + .board-card { margin-left: 6px; }

.board-card {
  background: var(--surface); border: 1px solid var(--card-color);
  border-left: 3px solid var(--card-color);
  border-radius: 6px; padding: 3px 8px;
  display: flex; flex-direction: row; align-items: center; gap: 6px;
  animation: cardPop 0.4s ease;
  box-shadow: 0 0 14px -2px var(--card-color);
  height: 22px;
  white-space: nowrap; overflow: hidden;
}
[data-theme="light"] .board-card { box-shadow: 0 1px 3px rgba(0,0,0,0.15); }

@keyframes cardPop { from { opacity: 0; transform: translateX(-8px) scale(0.95); } to { opacity: 1; transform: translateX(0) scale(1); } }
.bc-id { font-family: var(--font-mono); font-size: 10px; color: var(--fg-muted); flex-shrink: 0; font-weight: 700; }
.bc-label { font-size: 11px; font-weight: 700; line-height: 1; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--fg); }
.bc-phase {
  flex-shrink: 0; font-size: 8px; color: #fff;
  padding: 2px 6px; border-radius: 999px;
  font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase;
}

.board-legend {
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 12px; padding: 10px 14px;
  display: flex; flex-direction: column; gap: 4px; flex-shrink: 0;
}
.bl-title { font-size: 13px; font-weight: 800; color: var(--fg); }
.bl-rules { display: flex; gap: 10px; font-size: 12px; color: var(--fg-muted); font-weight: 600; }
.bl-rules strong { color: var(--sys-magenta); font-weight: 800; }

/* ============= TIMELINE ============= */
.timeline-sim {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  gap: 12px; overflow: hidden;
}
.tl-phase {
  display: grid; grid-template-columns: 200px 1fr 220px;
  gap: 18px; align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--ph-color);
  border-radius: 16px; padding: 14px 18px;
  flex: 1; min-height: 0;
  box-shadow: 0 0 24px -8px var(--ph-color);
}
[data-theme="light"] .tl-phase { box-shadow: none; }
.tl-phase-header { display: flex; flex-direction: column; }
.tl-phase-num { font-size: 11px; letter-spacing: 0.2em; color: var(--fg-muted); font-weight: 700; }
.tl-phase-name { font-family: var(--font-display); font-size: 32px; font-weight: 700; color: var(--ph-color); line-height: 1; }
.tl-phase-sub { font-size: 12px; color: var(--fg-muted); margin-top: 4px; font-weight: 600; }
.tl-stages { display: flex; gap: 6px; align-items: center; position: relative; }
.tl-stages::before {
  content: ''; position: absolute; left: 14px; right: 14px; top: 18px; height: 2px;
  background: var(--border-strong);
}
.tl-stage {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  flex: 1; min-width: 0; transition: all 0.4s;
}
.tl-dot {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 800; font-size: 14px;
  color: var(--fg-muted);
}
.tl-stage.done .tl-dot { background: var(--ph-color); border-color: var(--ph-color); color: #fff; }
.tl-stage.active .tl-dot { background: var(--ph-color); border-color: var(--ph-color); color: #fff; box-shadow: 0 0 0 8px color-mix(in srgb, var(--ph-color), transparent 75%), 0 0 24px var(--ph-color); animation: pulseGlow 1.6s infinite; }
.tl-label { font-size: 10px; line-height: 1.2; text-align: center; color: var(--fg-muted); max-width: 80px; font-weight: 600; }
.tl-stage.active .tl-label, .tl-stage.done .tl-label { color: var(--fg); font-weight: 700; }
.tl-validator {
  background: transparent; border: 1px dashed var(--ph-color);
  border-radius: 12px; padding: 10px 14px;
  display: flex; flex-direction: column;
}
.tl-vrole { font-size: 11px; color: var(--fg-muted); letter-spacing: 0.1em; font-weight: 700; }
.tl-vname { font-size: 14px; font-weight: 800; color: var(--ph-color); }
.tl-feedback {
  display: flex; gap: 12px; align-items: center; justify-content: center;
  padding: 12px; border: 1px dashed var(--bridge); border-radius: 999px;
  color: var(--bridge); font-weight: 800; font-size: 14px;
  background: transparent;
  box-shadow: 0 0 18px -6px var(--bridge);
}
[data-theme="light"] .tl-feedback { box-shadow: none; }
.tl-arrow { font-size: 22px; }

/* ============= INTERACTIONS ============= */
.inter-sim {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 24px;
}
.inter-stage {
  display: grid; grid-template-columns: 1fr 1.2fr 1fr;
  align-items: center; width: 90%;
}
.inter-node {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 28px;
  border: 2px solid var(--border-strong); border-radius: 24px;
  background: var(--surface);
  transition: all 0.4s;
}
.inter-node.role-human { border-color: var(--human); color: var(--human); box-shadow: 0 0 32px -8px var(--human); }
.inter-node.role-ai { border-color: var(--ai); color: var(--ai); box-shadow: 0 0 32px -8px var(--ai); }
.inter-node.role-validator { border-color: var(--validator); color: var(--validator); box-shadow: 0 0 32px -8px var(--validator); }
[data-theme="light"] .inter-node.role-human,
[data-theme="light"] .inter-node.role-ai,
[data-theme="light"] .inter-node.role-validator { box-shadow: none; }
.in-label { font-size: 16px; font-weight: 800; color: var(--fg); text-align: center; }
.role-icon svg { display: block; }
.inter-link { display: flex; flex-direction: column; align-items: center; gap: 14px; position: relative; }
.il-line {
  width: 100%; height: 4px; border-radius: 2px;
  background: var(--ai);
  position: relative; overflow: hidden;
}
.kind-pp .il-line { background: var(--human); box-shadow: 0 0 12px var(--human); }
.kind-pa .il-line { background: var(--ai); box-shadow: 0 0 12px var(--ai); }
.kind-aa .il-line { background: var(--validator); box-shadow: 0 0 12px var(--validator); }
[data-theme="light"] .il-line { box-shadow: none; }
.il-pulse {
  position: absolute; top: -4px; bottom: -4px; width: 50px;
  background: rgba(255,255,255,0.9);
  animation: pulseSlide 1.6s linear infinite;
}
[data-theme="light"] .il-pulse { background: rgba(0,0,0,0.4); }
@keyframes pulseSlide {
  from { left: -50px; } to { left: 100%; }
}
.il-msg {
  background: var(--surface); border: 1px solid var(--border-strong);
  padding: 10px 18px; border-radius: 12px;
  font-family: var(--font-mono); font-size: 13px; color: var(--fg);
  max-width: 340px; text-align: center; font-weight: 600;
}
.inter-meta { text-align: center; }
.im-title { font-family: var(--font-display); font-size: 32px; font-weight: 700; color: var(--fg); }
.im-sub { color: var(--fg-muted); font-size: 16px; margin-top: 6px; font-weight: 600; }
.inter-pager { display: flex; gap: 8px; }
.ip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); transition: all 0.3s; }
.ip-dot.on { background: var(--sys-magenta); width: 28px; border-radius: 4px; box-shadow: var(--glow-magenta); }

/* ============= SWIMLANE ============= */
.swim-sim { width: 100%; height: 100%; display: flex; flex-direction: column; gap: 14px; overflow: hidden; }
.swim-header { display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.sw-title { font-size: 14px; font-weight: 700; color: var(--fg); letter-spacing: 0.06em; }
.sw-progress { height: 4px; background: var(--border-strong); border-radius: 2px; overflow: hidden; }
.sw-progress-fill { height: 100%; background: var(--sys-magenta); box-shadow: 0 0 16px var(--sys-magenta); transition: width 0.3s; }
[data-theme="light"] .sw-progress-fill { box-shadow: none; }
.swim-grid { display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; }
.sw-lane {
  display: grid; grid-template-columns: 180px 1fr; gap: 10px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-left: 4px solid var(--lane-color); border-radius: 14px;
  padding: 10px 14px; flex: 1; min-height: 0;
}
.sw-lane-label { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--lane-color); font-size: 14px; }
.sw-lane-row { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 6px; }
.sw-cell { min-height: 60px; border-radius: 8px; padding: 6px 8px; }
.sw-cell.empty { background: transparent; }
.sw-cell.ev {
  background: transparent; border: 1px solid var(--border-strong);
  display: flex; flex-direction: column; gap: 2px; transition: all 0.3s;
}
.sw-cell.ev.active { border-color: var(--lane-color); box-shadow: 0 0 20px -4px var(--lane-color); }
.sw-cell.ev.past { opacity: 0.55; border-color: var(--border); }
.sw-ev-label { font-size: 11px; font-weight: 700; line-height: 1.2; color: var(--fg); }
.sw-ev-note { font-size: 9px; color: var(--fg-muted); font-weight: 600; }

/* ============= BOARD × RPI (Mode 5) ============= */
.board-rpi-sim {
  width: 100%; height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px; min-height: 0; min-width: 0;
  overflow: hidden;
}

/* Phase strip — 3 fases lado a lado, cada uma com 6 etapas */
.brs-phase-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  flex-shrink: 0;
  min-width: 0;
}
.brs-phase {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--ph-color);
  border-radius: 12px;
  padding: 6px 10px;
  display: flex; align-items: center; gap: 10px;
  min-width: 0; overflow: hidden;
}
.brs-phase-name {
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  color: var(--ph-color); letter-spacing: 0.04em;
  flex-shrink: 0;
  min-width: 64px;
}
.brs-phase-stages { display: flex; gap: 4px; flex: 1; min-width: 0; }
.brs-stage {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 3px 2px;
  border: 1px solid var(--border-strong); border-radius: 6px;
  background: transparent;
  transition: all 0.3s;
  cursor: default;
  overflow: hidden;
}
.brs-stage.done { border-color: var(--ph-color); background: color-mix(in srgb, var(--ph-color), transparent 90%); }
.brs-stage.active {
  border-color: var(--ph-color);
  background: color-mix(in srgb, var(--ph-color), transparent 78%);
  box-shadow: 0 0 18px -4px var(--ph-color);
  animation: pulseGlow 1.6s infinite;
}
.brs-stage-num { font-family: var(--font-mono); font-weight: 800; font-size: 12px; color: var(--ph-color); }
.brs-stage-label { font-size: 9px; color: var(--fg-muted); font-weight: 700; line-height: 1.05; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brs-stage.active .brs-stage-label,
.brs-stage.done .brs-stage-label { color: var(--fg); }

/* Grid: rows = WIT lanes, cols = 18 etapas + 1 head */
.brs-grid {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 8px 10px;
  display: flex; flex-direction: column; gap: 4px;
  min-height: 0; min-width: 0;
  overflow: hidden;
  width: 100%;
}
.brs-grid-header,
.brs-lane-row {
  display: grid;
  grid-template-columns: 110px repeat(18, minmax(0, 1fr));
  gap: 3px;
  align-items: center;
  min-width: 0;
}
.brs-grid-header {
  border-bottom: 1px dashed var(--border-strong);
  padding-bottom: 4px;
  flex-shrink: 0;
}
.brs-col-head {
  font-family: var(--font-mono); font-size: 10px; font-weight: 800;
  color: var(--fg-muted); text-align: center;
  padding: 4px 0;
  border-radius: 4px;
  transition: all 0.3s;
}
.brs-col-head.active { color: var(--ph-color); background: color-mix(in srgb, var(--ph-color), transparent 85%); }

.brs-lane-row { flex: 1; min-height: 0; }
.brs-lane-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 800;
  color: var(--lane-color);
  padding: 0 6px;
  letter-spacing: 0.04em;
  min-width: 0; overflow: hidden;
}
.brs-lane-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--lane-color);
  box-shadow: 0 0 8px var(--lane-color);
  flex-shrink: 0;
}
[data-theme="light"] .brs-lane-dot { box-shadow: none; }
.brs-lane-label { font-size: 11px; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.brs-cell {
  min-height: 36px; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
  padding: 2px 1px;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: background 0.3s;
  overflow: hidden;
}
.brs-cell.active { background: color-mix(in srgb, var(--lane-color), transparent 92%); border-color: color-mix(in srgb, var(--lane-color), transparent 70%); }
.brs-cell.past { opacity: 0.85; }
.brs-cell.future { opacity: 0.35; }

/* Card dentro da célula brs-cell */
.brs-card {
  display: flex; flex-direction: column; gap: 1px;
  background: var(--surface);
  border: 1px solid var(--card-color);
  border-left: 3px solid var(--card-color);
  border-radius: 4px;
  padding: 2px 3px;
  font-family: var(--font-mono);
  animation: cardPop 0.4s ease;
  min-width: 0; max-width: 100%;
  overflow: hidden;
}
.brs-card-id {
  font-size: 8px; font-weight: 800; color: var(--fg);
  line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brs-card-pill {
  font-size: 6.5px; font-weight: 800; color: #fff;
  padding: 1px 3px; border-radius: 3px;
  text-transform: uppercase; letter-spacing: 0.04em;
  align-self: flex-start;
  line-height: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}

/* Painel inferior — narrativa + cast */
.brs-stage-panel {
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--ph-color);
  border-radius: 12px;
  padding: 12px 16px;
  flex-shrink: 0;
}
.brs-sp-eyebrow { font-size: 10px; letter-spacing: 0.18em; font-weight: 800; color: var(--ph-color); }
.brs-sp-title { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--fg); margin-top: 4px; line-height: 1.05; }
.brs-sp-narrative { font-size: 13px; color: var(--fg-muted); margin-top: 6px; font-weight: 600; line-height: 1.4; }
.brs-sp-right { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.brs-sp-cast-group { display: flex; flex-direction: column; gap: 4px; }
.brs-sp-cast-label { font-size: 10px; font-weight: 800; color: var(--fg-muted); letter-spacing: 0.1em; }
.brs-sp-cast-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.brs-sp-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px; font-weight: 700;
  background: var(--surface);
  color: var(--fg);
}
.brs-sp-chip.role-human { border-color: var(--human); color: var(--human); }
.brs-sp-chip.role-ai { border-color: var(--ai); color: var(--ai); }
.brs-sp-chip.role-validator { border-color: var(--validator); color: var(--validator); }

/* ============= EFEITO LUPA — hover sobre cards das simulações ============= */
/* Amplia fontes pequenas das caixas de tarefas em movimento via transform: scale */
/* + libera overflow dos containers pais via :has() para a lupa não ser cortada. */

.board-card,
.brs-card,
.tl-stage,
.sw-cell.ev {
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  transform-origin: center center;
  cursor: zoom-in;
}

/* Board ADO Kanban */
.board-card:hover {
  transform: scale(2.4);
  z-index: 100;
  position: relative;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45),
              0 0 0 2px var(--card-color, var(--sys-yellow));
  overflow: visible;
}
.board-card:hover .bc-label,
.board-card:hover .bc-id {
  overflow: visible;
}

/* Board × RPI — cards minúsculos exigem zoom maior */
.brs-card:hover {
  transform: scale(3);
  z-index: 100;
  position: relative;
  background: var(--surface);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5),
              0 0 0 2px var(--card-color);
  overflow: visible;
}
.brs-card:hover .brs-card-id,
.brs-card:hover .brs-card-pill {
  overflow: visible;
}

/* Timeline RPI — etapa (dot + label) */
.tl-stage:hover {
  transform: scale(1.7);
  z-index: 100;
  position: relative;
}
.tl-stage:hover .tl-label {
  background: var(--surface);
  border: 1px solid var(--ph-color);
  padding: 3px 6px;
  border-radius: 6px;
  max-width: none;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  font-weight: 700;
  color: var(--fg);
}
.tl-stage:hover .tl-dot {
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--ph-color), transparent 70%),
              0 0 24px var(--ph-color);
}

/* Swimlane HITL — célula de evento */
.sw-cell.ev:hover {
  transform: scale(1.85);
  z-index: 100;
  position: relative;
  background: var(--surface);
  border-color: var(--lane-color);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4),
              0 0 0 2px var(--lane-color);
  opacity: 1 !important;
}
.sw-cell.ev:hover .sw-ev-label,
.sw-cell.ev:hover .sw-ev-note {
  white-space: normal;
  overflow: visible;
}

/* Liberar overflow dos containers pais via :has() (CSS Selectors L4) — */
/* sem isso a lupa é cortada pelos containers com overflow: hidden.       */
.bg-states:has(.board-card:hover),
.bg-state:has(.board-card:hover),
.bg-state-cards:has(.board-card:hover),
.board-group:has(.board-card:hover),
.board-grid:has(.board-card:hover),
.board-sim:has(.board-card:hover),
.brs-cell:has(.brs-card:hover),
.brs-lane-row:has(.brs-card:hover),
.brs-grid:has(.brs-card:hover),
.board-rpi-sim:has(.brs-card:hover),
.tl-stages:has(.tl-stage:hover),
.tl-phase:has(.tl-stage:hover),
.timeline-sim:has(.tl-stage:hover),
.sw-lane-row:has(.sw-cell.ev:hover),
.sw-lane:has(.sw-cell.ev:hover),
.swim-grid:has(.sw-cell.ev:hover),
.swim-sim:has(.sw-cell.ev:hover),
.hs-stage:has(.board-card:hover),
.hs-stage:has(.brs-card:hover),
.hs-stage:has(.tl-stage:hover),
.hs-stage:has(.sw-cell.ev:hover) {
  overflow: visible !important;
}

/* ============= SPRINT 1+2 — Pills com múltiplos eventos + cores Active/Done ============= */

/* A.1.2 — múltiplas pills consecutivas com seta entre elas */
.brs-card-states {
  display: inline-flex; align-items: center; gap: 2px; flex-wrap: wrap;
  min-width: 0; max-width: 100%;
}
.brs-card-arrow {
  font-size: 7px; font-weight: 800; color: var(--fg-muted); line-height: 1;
}

/* A.3.2 — Highlight animado quando state mudou na etapa atual */
@keyframes brsPillChange {
  0%   { box-shadow: 0 0 0 0 rgba(252, 66, 154, 0.6); transform: scale(1); }
  50%  { box-shadow: 0 0 0 4px rgba(252, 66, 154, 0.0); transform: scale(1.1); }
  100% { box-shadow: 0 0 0 0 rgba(252, 66, 154, 0.0); transform: scale(1); }
}
.brs-card-pill.changed {
  animation: brsPillChange 1.5s ease-out 1;
  outline: 1px solid rgba(255, 255, 255, 0.7);
}

/* ============= B.2 — Toggle Conceitual ⇄ Didática ============= */
.brs-lens-toggle {
  display: inline-flex; gap: 4px;
  align-self: flex-end;
  margin: 0 0 6px 0;
  background: color-mix(in srgb, var(--surface), transparent 30%);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 3px;
}
.brs-lens-btn {
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
  letter-spacing: 0.04em;
}
.brs-lens-btn:hover { color: var(--fg); }
.brs-lens-btn.on {
  background: linear-gradient(135deg, var(--sys-cyan), var(--sys-violet));
  color: #fff;
  box-shadow: 0 2px 8px rgba(94, 174, 255, 0.4);
}
[data-lens="didatica"] .brs-lens-btn.on {
  background: linear-gradient(135deg, #FBBF24, var(--sys-magenta));
}

/* ============= A.3.3 — Painel "Ações nesta etapa" ============= */
.brs-sp-actions {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-strong);
}
.brs-sp-actions-label {
  font-size: 9px; letter-spacing: 0.18em; font-weight: 800;
  color: var(--ph-color); margin-bottom: 4px;
}
.brs-sp-actions-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 2px;
  font-size: 11px; color: var(--fg-muted); line-height: 1.3;
}
.brs-sp-actions-list li strong { color: var(--fg); font-weight: 800; }
.brs-sp-actions-list li em { font-style: normal; color: var(--ph-color); font-weight: 700; }

/* ============= B.3.2 — Métricas progressivas ============= */
.brs-sp-metrics {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-strong);
}
.brs-sp-metrics-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.brs-sp-metric {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700;
  color: var(--fg);
  background: color-mix(in srgb, var(--sys-lime), transparent 88%);
  border-left: 3px solid var(--sys-lime);
  padding: 4px 8px; border-radius: 4px;
  animation: cardPop 0.4s ease;
}
.brs-sp-metric-icon { font-size: 12px; }

/* ============= B.3.1 — Storyteller (Carla em primeira pessoa) ============= */
.brs-storyteller {
  margin-top: 8px;
  padding: 14px 18px;
  border: 1px solid color-mix(in srgb, #FBBF24, transparent 60%);
  background: linear-gradient(135deg,
    color-mix(in srgb, #FBBF24, transparent 92%),
    color-mix(in srgb, var(--sys-magenta), transparent 92%));
  border-radius: 10px;
  position: relative;
  animation: storyFade 0.45s ease;
}
@keyframes storyFade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.brs-storyteller-eyebrow {
  font-size: 10px; letter-spacing: 0.18em; font-weight: 800;
  color: #B45309;
  text-transform: uppercase;
}
[data-theme="light"] .brs-storyteller-eyebrow { color: #92400E; }
.brs-storyteller-text {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 14px; line-height: 1.5;
  color: var(--fg);
  margin-top: 4px;
}

/* Toolbar do BoardRPISimulation (Epic A/B/C) — agora INTERNO ao canvas no topo */
.board-rpi-sim { position: relative; }
.board-rpi-sim > .brs-lens-toggle {
  /* Antes: absolute top:-42px right:8px (sobrepunha mode-tabs do hero-sim e ficava
     comprimido em viewport amplo). Agora: layout normal in-flow no topo do canvas,
     com flex-wrap para empilhar em viewports menores. */
  position: static;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 10px 0;
  padding: 4px 6px;
  background: color-mix(in srgb, var(--surface), transparent 30%);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  align-self: stretch;
  z-index: 5;
}

/* ============= Epic C Sprint 5+6 — toolbar estendido ============= */
.brs-lens-divider {
  width: 1px; height: 16px;
  background: var(--border-strong);
  margin: 0 2px;
  align-self: center;
  opacity: 0.6;
}
.brs-lens-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.brs-lens-btn:disabled:hover { color: var(--fg-muted); }
.brs-lens-btn--depth.on {
  background: linear-gradient(135deg, var(--sys-violet), var(--sys-magenta));
}
.brs-lens-btn--time.on {
  background: linear-gradient(135deg, #00B294, var(--sys-cyan));
}
.brs-lens-btn--post.on {
  background: linear-gradient(135deg, #CC293D, #F59E0B);
}
.brs-lens-btn--preset {
  background: color-mix(in srgb, var(--sys-cyan), transparent 80%);
  color: var(--fg);
  border: 1px dashed color-mix(in srgb, var(--sys-cyan), transparent 40%);
}
.brs-lens-btn--preset:hover {
  background: color-mix(in srgb, var(--sys-cyan), transparent 60%);
}
.brs-lens-btn--reset {
  background: transparent;
  color: var(--fg-muted);
  font-weight: 600;
}

/* ============= Epic C Sprint 5 — grid proporcional via override inline ============= */
/* Nada a fazer: gridTemplateColumns é aplicado inline via React quando timeMode='proporcional'. */

/* ============= Epic C Sprint 5 — visit gates (pill condicional dashed + ⚠️) ============= */
.brs-visit-gate {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono);
  font-size: 9px; font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg);
  padding: 2px 6px;
  margin-left: 4px;
  border: 1px dashed var(--border-strong);
  border-radius: 4px;
  background: color-mix(in srgb, #F59E0B, transparent 88%);
}
.brs-visit-gate:hover {
  background: color-mix(in srgb, #F59E0B, transparent 75%);
  border-color: #F59E0B;
}

/* ============= Epic C Sprint 5 — cards com parent ganham marca lateral sutil ============= */
.brs-card--has-parent {
  border-left: 2px solid color-mix(in srgb, var(--card-color, var(--lane-color, var(--border-strong))), transparent 50%);
}

/* ============= Epic C Sprint 5 — SVG overlay parent-child edges ============= */
.brs-grid { position: relative; }
.brs-parent-edges {
  position: absolute;
  inset: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
  z-index: 2;
  overflow: visible;
}

/* ============= Epic C Sprint 5+6 — data attribute hooks (debug visual) ============= */
[data-depth="completa"] .brs-grid {
  outline: 1px dashed color-mix(in srgb, var(--sys-violet), transparent 70%);
  outline-offset: 4px;
}
[data-time="proporcional"] .brs-col-head {
  font-style: italic;
}
