/* =========================================================
   Animação — Timeline (tema claro / wide)
   - Não altera o visual existente; só adiciona classes novas
========================================================= */

.animCard .lead{ margin: 0; }
.animTop{
  display:flex;
  gap:14px;
  align-items:flex-start;
  justify-content:space-between;
  flex-wrap:wrap;
}
.animTop__left{ min-width: 320px; flex: 1; }
.animTop__right{ display:grid; gap:8px; align-items:start; }
.animTitle{ font-weight: 900; font-size: 16px; }
.animSub{ color: var(--muted); line-height: 1.5; margin-top: 6px; font-size: 13.5px; }
.animControls{ display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end; }
.animHint{ color: var(--muted); font-size: 12.5px; text-align:right; }

.animGrid{ display:grid; gap:16px; }

.animRow{ display:grid; gap:10px; }
.animRow__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.animRow__title{ font-weight: 900; }
.animRow__meta{ display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }

.timeline{
  --h: 56px;
  --pad: 10px;
  position:relative;
}
.timeline__track{
  position:relative;
  height: var(--h);
  border:1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.75), rgba(255,255,255,.35));
  overflow:hidden;
  box-shadow: var(--shadow);
}

.band{
  position:absolute;
  top:0; bottom:0;
}
.band--ok{ background: rgba(83,229,178,.18); }
.band--mid{ background: rgba(255,211,122,.18); }
.band--bad{ background: rgba(255,107,122,.16); }

.timeline__ticks{
  position:absolute;
  left:0; right:0;
  top:0; bottom:0;
  background:
    linear-gradient(to right, rgba(2,6,23,.08) 1px, transparent 1px);
  background-size: 10% 100%;
  opacity:.6;
  pointer-events:none;
}

.marker{
  position:absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  display:grid;
  place-items:center;
  gap: 6px;
  z-index: 3;
  transition: left .32s ease;
}
.marker__pin{
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: rgba(137,180,255,.95);
  border: 2px solid rgba(255,255,255,.95);
  box-shadow: 0 10px 24px rgba(2,6,23,.25);
}
.marker__label{
  font-weight: 900;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.92);
}

.animExplain{
  border:1px solid var(--border);
  border-radius: 16px;
  padding: 12px 12px;
  background: rgba(255,255,255,.55);
  color: var(--muted);
  line-height: 1.55;
}

.animExplain b{ color: var(--text); }

.animSummary{
  margin-top: 0;
  background: rgba(137,180,255,.10);
  border-color: rgba(137,180,255,.28);
}
.animSummary__title{ font-weight: 900; margin-bottom: 8px; }

/* Hover/tap micro-highlight (apenas visual) */
.timeline__track:hover .marker__pin{ transform: scale(1.08); }
.timeline__track:active .marker__pin{ transform: scale(1.08); }

/* Mobile adjustments */
@media (max-width: 720px){
  .animHint{ text-align:left; }
  .animControls{ justify-content:flex-start; }
  .timeline__track{ height: 64px; }
}

/* ===== Toggle (Entrada+Saída vs Faixa única) ===== */
.animMode{
  display:flex;
  gap:8px;
  justify-content:flex-end;
  flex-wrap:wrap;
  margin-top:10px;
}
.segBtn{
  border:1px solid var(--border);
  background: rgba(255,255,255,.75);
  padding: 8px 10px;
  border-radius: 999px;
  font-weight: 900;
  cursor:pointer;
  transition: transform .12s ease, background .12s ease, box-shadow .12s ease;
  box-shadow: var(--shadow);
}
.segBtn:hover{ transform: translateY(-1px); }
.segBtn.is-active{
  background: rgba(137,180,255,.18);
  border-color: rgba(137,180,255,.35);
}

.animAssumption{
  margin-top:10px;
  display:flex;
  gap:10px;
  align-items:flex-start;
  justify-content:flex-end;
  flex-wrap:wrap;
  color: var(--muted);
  line-height: 1.5;
}

.pill.info{ background: rgba(137,180,255,.14); border-color: rgba(137,180,255,.30); }

/* ===== Faixa única ===== */
.timeline--unico .marker--in .marker__pin{ background: rgba(32,201,151,.95); }
.timeline--unico .marker--out .marker__pin{ background: rgba(255,183,3,.95); }
.timeline--unico .marker--in .marker__label{ border-color: rgba(32,201,151,.30); }
.timeline--unico .marker--out .marker__label{ border-color: rgba(255,183,3,.35); }

/* Impact FX (chama atenção quando cai em validação) */
.impact{
  position:absolute;
  inset:0;
  pointer-events:none;
  opacity:0;
  background:
    radial-gradient(380px 180px at 18% 55%, rgba(255,77,109,.20), transparent 60%),
    radial-gradient(380px 180px at 82% 55%, rgba(255,77,109,.20), transparent 60%);
}
.impact.is-on{
  animation: impactPulse .7s ease-out 1;
}
@keyframes impactPulse{
  0%{ opacity:0; transform: scale(1); }
  30%{ opacity:1; }
  100%{ opacity:0; transform: scale(1.01); }
}

/* pequena vibração do marcador em validação */
.marker.is-alert .marker__pin{
  animation: pinShake .35s ease-in-out 2;
  box-shadow: 0 0 0 10px rgba(255,77,109,.14), 0 10px 24px rgba(2,6,23,.25);
}
@keyframes pinShake{
  0%,100%{ transform: translateZ(0) scale(1); }
  25%{ transform: translateX(-2px) scale(1.03); }
  50%{ transform: translateX(2px) scale(1.03); }
  75%{ transform: translateX(-1px) scale(1.03); }
}

/* ===== Modelo toggle (Linha do tempo vs História) ===== */
.animModel{
  display:flex;
  gap:8px;
  justify-content:flex-end;
  flex-wrap:wrap;
  margin-top:10px;
}

/* ===== História ===== */
.animStory{ margin-top: 14px; }
.storyStage{
  border:1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255,255,255,.55);
  box-shadow: var(--shadow);
}
.storyHeader{ display:grid; gap:6px; }
.storyTitle{ font-weight: 900; font-size: 16px; }
.storySubtitle{ color: var(--muted); line-height: 1.5; }

.storyClock{
  margin: 14px 0 10px;
  display:flex;
  align-items:center;
  gap:14px;
  flex-wrap:wrap;
}
.clockFace{
  width: 84px; height: 84px;
  border-radius: 999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.8);
  position:relative;
  box-shadow: var(--shadow);
}
.clockHand{
  position:absolute;
  left:50%; top:50%;
  transform-origin: 0% 50%;
  height: 4px;
  width: 28px;
  background: rgba(2,6,23,.75);
  border-radius: 999px;
  transform: translateY(-50%) rotate(0deg);
}
.clockHand.hour{ width: 22px; opacity:.8; }
.clockHand.min{ width: 32px; }
.clockCenter{
  position:absolute;
  width: 10px; height:10px;
  border-radius: 999px;
  left:50%; top:50%;
  transform: translate(-50%,-50%);
  background: rgba(137,180,255,.95);
  box-shadow: 0 10px 24px rgba(2,6,23,.18);
}
.clockTime{
  font-weight: 900;
  font-size: 28px;
  letter-spacing: .5px;
}
.stamp{
  margin-left:auto;
  font-weight: 900;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(83,229,178,.18);
  color: rgba(2,6,23,.9);
  transform: rotate(-4deg) scale(1);
  box-shadow: var(--shadow);
}
.stamp.is-warn{ background: rgba(255,211,122,.22); }
.stamp.is-bad{ background: rgba(255,107,122,.20); }
.stamp.is-pop{ animation: stampPop .55s ease-out 1; }
@keyframes stampPop{
  0%{ transform: rotate(-4deg) scale(.7); opacity:.0; }
  35%{ transform: rotate(-6deg) scale(1.06); opacity:1; }
  100%{ transform: rotate(-4deg) scale(1); opacity:1; }
}

.storyCards{
  display:grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 10px;
}
.sCard{
  border:1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255,255,255,.82);
  transform: translateY(0);
  transition: transform .16s ease, box-shadow .16s ease;
}
.sCard:hover{ transform: translateY(-2px); box-shadow: var(--shadow); }
.sCard__title{ font-weight: 900; margin-bottom: 6px; }
.sCard__text{ color: var(--muted); line-height: 1.55; }

.sCard--sys{ background: rgba(255,211,122,.16); }
.sCard--clt{ background: rgba(83,229,178,.12); }
.sCard--gest{ background: rgba(255,107,122,.12); }
.sCard--myth{ background: rgba(137,180,255,.12); }

.storyControls{
  margin-top: 12px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

@media (max-width: 900px){
  .storyCards{ grid-template-columns: 1fr; }
  .stamp{ margin-left:0; }
}

/* V5 — História elegante */
.animStory{
  margin-top:16px;
  padding:18px;
  border-radius:18px;
  background:linear-gradient(180deg,#fff,#f4f7ff);
  box-shadow:0 20px 40px rgba(0,0,0,.08);
}
#storyText{
  font-size:18px;
  font-weight:600;
  padding:24px;
  border-radius:14px;
  background:#fff;
  border:1px solid #dbe3ff;
  min-height:96px;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
}

/* ===== View toggle (Entrada+Saída | Faixa única | História) ===== */
.animView{
  display:flex;
  gap:8px;
  justify-content:flex-end;
  flex-wrap:wrap;
  margin-top:10px;
}

/* ===== História (conto semanal) ===== */
.storyRefs{
  margin-top:10px;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
}

.weekBar{
  margin-top: 12px;
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
}
.dayChip{
  border:1px solid var(--border);
  background: rgba(255,255,255,.82);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 900;
  cursor:pointer;
  transition: transform .12s ease, background .12s ease, box-shadow .12s ease;
  box-shadow: var(--shadow);
}
.dayChip:hover{ transform: translateY(-1px); }
.dayChip.is-active{
  background: rgba(137,180,255,.18);
  border-color: rgba(137,180,255,.35);
}
.weekProgress{
  position:relative;
  height: 10px;
  flex: 1 1 240px;
  border-radius: 999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.75);
  overflow:hidden;
}
.weekProgress__fill{
  height:100%;
  width:0%;
  background: rgba(137,180,255,.55);
  transition: width .35s ease;
}

.storyGrid{
  display:grid;
  grid-template-columns: 220px 1fr;
  gap: 12px;
  margin-top: 12px;
}
.clockReadout{
  display:grid;
  gap:10px;
  align-content:start;
}
.storyPanel{
  display:grid;
  gap: 10px;
}
.storyNarrative{
  border:1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255,255,255,.86);
  line-height: 1.65;
  color: var(--text);
  box-shadow: var(--shadow);
  min-height: 120px;
}
.storyNarrative b{ font-weight: 900; }
.storyNarrative .muted{ color: var(--muted); }

.saldoBox{
  border:1px solid rgba(255,211,122,.35);
  background: rgba(255,211,122,.14);
  border-radius: 16px;
  padding: 12px;
  box-shadow: var(--shadow);
}
.saldoBox__title{ font-weight: 900; margin-bottom: 6px; }
.saldoBox__value{
  font-weight: 900;
  font-size: 26px;
  letter-spacing: .3px;
}
.saldoBox__hint{ color: var(--muted); margin-top: 6px; line-height: 1.4; }

.storyLesson{
  border:1px solid rgba(255,107,122,.32);
  background: rgba(255,107,122,.10);
  border-radius: 16px;
  padding: 12px;
  box-shadow: var(--shadow);
}
.storyLesson__title{ font-weight: 900; margin-bottom: 6px; }
.storyLesson__text{ color: var(--text); line-height: 1.6; }
.storyLesson .cite-badge{ margin-left: 6px; }

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


/* Garantia de visibilidade */
[hidden]{display:none !important;}

.storyTabs{
  margin-top: 10px;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.storyTab{
  border:1px solid var(--border);
  background: rgba(255,255,255,.86);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 900;
  cursor:pointer;
  box-shadow: var(--shadow);
  transition: transform .12s ease, background .12s ease;
}
.storyTab:hover{ transform: translateY(-1px); }
.storyTab.is-active{
  background: rgba(83,229,178,.14);
  border-color: rgba(83,229,178,.30);
}


/* =========================================================
   v9.1 — História "de verdade"
   Persona + Eventos + Consequência + Norma + KPIs
========================================================= */

.storyPanel{ display:grid; gap:12px; }

.storyPersona{
  display:flex;
  gap:12px;
  align-items:center;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius: 14px;
  background: rgba(137,180,255,.08);
}
.storyPersona .avatar{
  width:46px; height:46px;
  border-radius:999px;
  display:grid;
  place-items:center;
  font-size:22px;
  background: rgba(137,180,255,.22);
  border:1px solid rgba(137,180,255,.35);
}
.storyPersona .name{ font-weight:1000; }
.storyPersona .role{ color: var(--muted); font-size: 12.8px; margin-top: 2px; }

.storyEvents{
  margin:0;
  padding-left:18px;
  line-height:1.55;
}
.storyEvents li{ margin: 4px 0; font-weight: 900; }
.storyEvents li.ok{ color: var(--ok); }
.storyEvents li.mid{ color: var(--mid); }
.storyEvents li.bad{ color: var(--bad); }

.storyOutcome{
  border-radius: 14px;
  padding: 12px 12px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.55);
  box-shadow: var(--shadow);
}
.theme-dark .storyOutcome{ background: rgba(255,255,255,.04); }
.storyOutcome .title{ font-weight:1000; margin-bottom:6px; }
.storyOutcome.ok{ border-color: rgba(47,191,138,.28); background: rgba(47,191,138,.10); }
.storyOutcome.mid{ border-color: rgba(242,178,51,.30); background: rgba(242,178,51,.12); }
.storyOutcome.bad{ border-color: rgba(229,83,93,.28); background: rgba(229,83,93,.10); }

.storyNorm{
  font-size: 12.6px;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 14px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.45);
}
.theme-dark .storyNorm{ background: rgba(255,255,255,.03); }

.storyKpis{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.storyKpis .kpi{
  border-radius: 14px;
  padding: 10px 10px;
  text-align:center;
  border:1px solid var(--border);
  background: rgba(255,255,255,.55);
}
.theme-dark .storyKpis .kpi{ background: rgba(255,255,255,.03); }
.storyKpis .kpi .label{ color: var(--muted); font-size: 12px; font-weight:900; }
.storyKpis .kpi .value{ font-weight:1000; margin-top:4px; }

.storyKpis .kpi.ok{ border-color: rgba(47,191,138,.25); background: rgba(47,191,138,.10); }
.storyKpis .kpi.mid{ border-color: rgba(242,178,51,.28); background: rgba(242,178,51,.12); }
.storyKpis .kpi.bad{ border-color: rgba(229,83,93,.24); background: rgba(229,83,93,.10); }

.saldoBox{
  padding: 10px 12px;
  border-radius: 14px;
  border:1px solid var(--border);
  background: rgba(137,180,255,.06);
}
.saldoBox__value{ font-weight:1000; }
.saldoBox__hint{ color: var(--muted); font-size: 12.5px; margin-top: 2px; }
