/*
  ========================================================================
  SEÇÃO AGENTE AO VIVO — design system Transbordo
  Fundo branco gelo + moldura TBF (herdada dos estilos globais),
  Uncut Sans, itálico Georgia dourado e paleta #B8956A/#E8C49A.
  ========================================================================
*/

.tb-live {
  --tbl-ink: #1a1a1a;
  --tbl-body: #4d4d4d;
  --tbl-muted: #6f6f6f;
  --tbl-faint: #a09a90;
  --tbl-gold: #B8956A;
  --tbl-gold-deep: #8a6a42;
  --tbl-gold-border: rgba(184, 149, 106, .42);
  --tbl-gold-dim: rgba(184, 149, 106, .1);
  --tbl-card: #ffffff;
  --tbl-border: #ececec;
  --tbl-border-warm: #e9e2d6;
  --tbl-hairline: rgba(28, 26, 22, .07);
  --tbl-mono: ui-monospace, 'SF Mono', Menlo, monospace;
  --tbl-ease: cubic-bezier(.16, 1, .3, 1);
}
.tb-live * { box-sizing: border-box }

/* ── cabeçalho (mesma gramática da seção "Problema") ── */
.tb-live-head { position: relative; z-index: 1; padding: clamp(44px, 6vw, 64px) clamp(16px, 3vw, 36px) clamp(28px, 4vw, 40px) }
.tb-live-title { margin: 22px 0 0; font-family: 'Uncut Sans', system-ui, sans-serif; font-size: clamp(38px, 4.8vw, 62px); line-height: 1; letter-spacing: -.05em; font-weight: 800; color: var(--tbl-ink); text-wrap: balance }
.tb-live-title em { font-family: Georgia, serif; font-style: italic; font-weight: 400; letter-spacing: -.025em; color: var(--tbl-gold) }
.tb-live-sub { margin: 18px 0 0; max-width: 560px; font-size: 17px; line-height: 1.55; color: var(--tbl-body); text-wrap: pretty }

/* ── grade nav + palco ── */
.tb-live-grid { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(280px, .85fr) minmax(0, 2.2fr); gap: clamp(20px, 2.5vw, 32px); align-items: stretch; padding: clamp(22px, 3vw, 40px) clamp(16px, 3vw, 36px) clamp(36px, 5vw, 56px) }

/* halo dourado sutil atrás do chat */
.tbl-stage { position: relative; min-width: 0 }
.tbl-stage::before { content: ""; position: absolute; inset: -8% -6%; background: radial-gradient(55% 55% at 60% 40%, rgba(184, 149, 106, .12), transparent 70%); pointer-events: none }

/* ── navegação por área ── */
.tbl-nav { display: flex; flex-direction: column; gap: 8px; align-self: center }
.tbl-nav-item { font-family: inherit; text-align: left; width: 100%; background: none; border: 1px solid transparent; border-radius: 16px; padding: 15px 16px; cursor: pointer; display: block; transition: border-color .25s var(--tbl-ease), background .25s var(--tbl-ease), box-shadow .25s var(--tbl-ease) }
.tbl-nav-item:hover:not(.active) { background: rgba(255, 255, 255, .7) }
.tbl-nav-item.active { border-color: var(--tbl-gold-border); background: var(--tbl-card); box-shadow: rgba(0, 0, 0, .15) 0 1px 1px 0, rgba(0, 0, 0, .05) 0 3px 3px 0, rgba(184, 149, 106, .16) 0 14px 30px -14px }
.tbl-nav-head { display: flex; align-items: center; gap: 10px; font-family: var(--tbl-mono); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--tbl-muted); transition: color .25s var(--tbl-ease) }
.tbl-nav-item.active .tbl-nav-head { color: var(--tbl-gold-deep) }
.tbl-nav-head svg { width: 16px; height: 16px; flex-shrink: 0 }
.tbl-nav-body { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .34s var(--tbl-ease), opacity .3s var(--tbl-ease), margin-top .34s var(--tbl-ease); margin-top: 0 }
.tbl-nav-item.active .tbl-nav-body { grid-template-rows: 1fr; opacity: 1; margin-top: 12px }
.tbl-nav-body-in { overflow: hidden; display: flex; flex-direction: column; gap: 8px }
.tbl-nav-title { font-size: 17px; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; color: var(--tbl-ink) }
.tbl-nav-desc { font-size: 13px; line-height: 1.55; color: var(--tbl-muted) }
.tbl-nav-tools { display: flex; gap: 6px; margin-top: 3px }
.tbl-nav-tools img { width: 18px; height: 18px; object-fit: contain; border-radius: 5px; background: #fff; border: 1px solid var(--tbl-border); padding: 2px }

/* ── janela do chat ── */
.tbl-chat { position: relative; height: 100%; min-height: 500px; display: flex; flex-direction: column; background: var(--tbl-card); border: 1px solid var(--tbl-border-warm); border-radius: 22px; padding: clamp(16px, 2.2vw, 26px); box-shadow: 0 30px 70px -42px rgba(28, 26, 22, .35), rgba(0, 0, 0, .05) 0 3px 3px 0 }
.tbl-chat-main { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 16px; min-width: 0 }
.tbl-history { display: flex; flex-direction: column; gap: 18px; min-height: 200px }
.tbl-history > :first-child { margin-top: auto }

/* bolha do usuário com chip de skill */
.tbl-prompt { display: flex; justify-content: flex-end }
.tbl-prompt-in { max-width: 90%; background: #f5f3ef; border: 1px solid var(--tbl-hairline); border-radius: 16px 16px 6px 16px; padding: 12px 15px; font-size: 13.5px; line-height: 1.6; color: var(--tbl-ink) }
.tbl-skillchip { display: inline-flex; align-items: center; gap: 5px; background: #fff; border: 1px solid var(--tbl-border-warm); border-radius: 7px; padding: 1px 8px; font-size: 12px; font-weight: 600; color: var(--tbl-ink); white-space: nowrap }
.tbl-skillchip svg { width: 12px; height: 12px; color: var(--tbl-gold) }

/* etapas (colapsável) */
.tbl-steps-block { border: 1px solid var(--tbl-hairline); border-radius: 14px; padding: 11px 14px; background: rgba(245, 243, 239, .55) }
.tbl-steps-head { display: flex; align-items: center; gap: 9px; color: var(--tbl-muted); font-size: 13px }
.tbl-steps-block.done .tbl-steps-head { cursor: pointer }
.tbl-steps-head .tbl-chev { width: 13px; height: 13px; color: var(--tbl-faint); flex-shrink: 0; transition: transform .28s var(--tbl-ease) }
.tbl-steps-block.collapsed .tbl-steps-head .tbl-chev { transform: rotate(-90deg) }
.tbl-steps-ind { display: inline-flex; align-items: center; gap: 7px }
.tbl-mini-spin { width: 11px; height: 11px; border-radius: 50%; border: 1.6px solid rgba(184, 149, 106, .3); border-top-color: var(--tbl-gold); animation: tblSpin .8s linear infinite; flex-shrink: 0 }
.tbl-steps-block.done .tbl-mini-spin { display: none }
@keyframes tblSpin { to { transform: rotate(360deg) } }
.tbl-steps-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 6px; background: #fff; border: 1px solid var(--tbl-border-warm); font-size: 11px; color: var(--tbl-gold-deep); font-family: var(--tbl-mono); padding: 0 5px }
.tbl-steps-menu { margin-left: auto; display: inline-flex; gap: 3px }
.tbl-steps-menu i { width: 4px; height: 4px; border-radius: 50%; background: var(--tbl-gold); animation: tblPulse 1.7s ease-in-out infinite }
.tbl-steps-menu i:nth-child(2) { animation-delay: .85s }
@keyframes tblPulse { 0%, 100% { opacity: .3 } 50% { opacity: 1 } }
.tbl-steps-wrap { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .34s var(--tbl-ease) }
.tbl-steps-block.collapsed .tbl-steps-wrap { grid-template-rows: 0fr }
.tbl-steps-wrap > .tbl-steps { overflow: hidden }
.tbl-steps { display: flex; flex-direction: column; gap: 12px; padding-top: 13px; padding-left: 3px }
.tbl-stepline { display: flex; align-items: flex-start; gap: 10px; font-size: 12.5px; line-height: 1.5; color: var(--tbl-muted); min-width: 0 }
.tbl-stepline .tbl-sic { flex-shrink: 0; width: 15px; height: 15px; color: var(--tbl-faint); margin-top: 1px }
.tbl-stepline--code { align-items: center; font-family: var(--tbl-mono); font-size: 11px; color: var(--tbl-faint) }
.tbl-stepline--code .tbl-ct { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0 }
.tbl-stepline--code b { color: var(--tbl-gold-deep); font-weight: 600 }
.tbl-slogo { width: 16px; height: 16px; object-fit: contain; border-radius: 4px; flex-shrink: 0 }

/* card de resultado */
.tbl-result { border: 1px solid var(--tbl-border); border-radius: 16px; background: #fff; box-shadow: rgba(0, 0, 0, .15) 0 1px 1px 0, rgba(0, 0, 0, .04) 0 6px 14px -6px; overflow: hidden }
.tbl-result-body { padding: 16px 18px; max-height: 300px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--tbl-border-warm) transparent }
.tbl-result-body::-webkit-scrollbar { width: 7px }
.tbl-result-body::-webkit-scrollbar-track { background: transparent; margin: 6px 0 }
.tbl-result-body::-webkit-scrollbar-thumb { background: var(--tbl-border-warm); border-radius: 4px }
.tbl-result-h { font-size: 14px; font-weight: 800; letter-spacing: -.01em; color: var(--tbl-ink); margin: 0 0 11px }
.tbl-mdlist { list-style: none; display: flex; flex-direction: column; gap: 9px; margin: 0 0 13px; padding: 0 }
.tbl-mdlist li { position: relative; padding-left: 16px; font-size: 12.5px; line-height: 1.55; color: var(--tbl-body) }
.tbl-mdlist li::before { content: ''; position: absolute; left: 2px; top: 7px; width: 5px; height: 5px; border-radius: 2px; background: var(--tbl-gold) }
.tbl-mdlist b { color: var(--tbl-ink); font-weight: 700 }
.tbl-result-close { font-size: 12.5px; line-height: 1.6; color: var(--tbl-muted); margin: 0 }
.tbl-result-foot { display: flex; align-items: center; gap: 20px; border-top: 1px solid var(--tbl-hairline); padding: 10px 18px; color: var(--tbl-faint) }
.tbl-result-foot span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px }
.tbl-result-foot svg { width: 13px; height: 13px }
.tbl-result-foot .tbl-foot-right { margin-left: auto }

/* composer */
.tbl-composer { border: 1px solid var(--tbl-border-warm); border-radius: 16px; background: #fbfaf8; overflow: hidden }
.tbl-composer-ph { font-size: 13.5px; color: var(--tbl-faint); padding: 16px 16px 24px }
.tbl-composer-ph .tbl-typed { color: var(--tbl-ink) }
.tbl-composer-ph::after { content: ''; display: inline-block; width: 1.5px; height: 15px; background: var(--tbl-gold-deep); margin-left: 1px; vertical-align: -3px; animation: tblCaret 1.1s step-end infinite }
@keyframes tblCaret { 50% { opacity: 0 } }
.tbl-composer-ph.has-text .tbl-ph { display: none }
.tbl-composer-bar { display: flex; align-items: center; gap: 7px; padding: 0 12px 11px }
.tbl-cbtn { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: var(--tbl-muted) }
.tbl-cbtn svg { width: 17px; height: 17px }
.tbl-composer-right { margin-left: auto; display: flex; align-items: center; gap: 4px }
.tbl-model { display: inline-flex; align-items: center; gap: 5px; padding: 0 7px; height: 30px; color: var(--tbl-muted) }
.tbl-model .tbl-chev { width: 10px; height: 10px; color: var(--tbl-faint) }
.tbl-send { width: 32px; height: 32px; border-radius: 50%; background: #b9b4ab; display: grid; place-items: center; flex-shrink: 0; transition: background .3s var(--tbl-ease), box-shadow .3s var(--tbl-ease) }
.tbl-send svg { width: 16px; height: 16px; color: #fff }
.tbl-send.active { background: linear-gradient(135deg, #2A2015 0%, #4A3520 55%, #2A2015 100%); box-shadow: 0 6px 16px -6px rgba(74, 53, 32, .55) }
.tbl-composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 4px 0 }
.tbl-conn { font-size: 11px; color: var(--tbl-muted); display: inline-flex; align-items: center; gap: 7px }
.tbl-conn .tbl-cic { width: 13px; height: 13px; color: var(--tbl-faint); flex-shrink: 0 }
.tbl-conn-logos { display: inline-flex; align-items: center; gap: 8px }
.tbl-conn-logos img { width: 15px; height: 15px; object-fit: contain }
.tbl-conn-sep { width: 1px; height: 12px; background: var(--tbl-border-warm); margin: 0 1px }
.tbl-conn-set { width: 14px; height: 14px; color: var(--tbl-faint) }

/* ── chip de arquivo anexado na bolha do usuário ── */
.tbl-filechip { display: inline-flex; align-items: center; gap: 5px; background: #fff; border: 1px dashed var(--tbl-gold-border); border-radius: 7px; padding: 1px 8px; font-size: 12px; font-weight: 600; color: var(--tbl-gold-deep); white-space: nowrap }
.tbl-filechip svg { width: 12px; height: 12px }

/* ── animação de entrada dos resultados (leve, só CSS) ── */
.tbl-rise { animation: tblRise .55s var(--tbl-ease) both; animation-delay: calc(var(--i, 0) * 110ms) }
@keyframes tblRise { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: translateY(0) } }

/* plano de venda (Venda & Estratégia) */
.tbl-plan { list-style: none; margin: 2px 0 13px; padding: 0; display: flex; flex-direction: column; gap: 9px }
.tbl-plan li { display: flex; align-items: flex-start; gap: 11px }
.tbl-plan-n { flex-shrink: 0; display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 8px; background: var(--tbl-gold-dim); border: 1px solid var(--tbl-gold-border); font-family: var(--tbl-mono); font-size: 10.5px; color: var(--tbl-gold-deep) }
.tbl-plan-tx { display: flex; flex-direction: column; gap: 1px; font-size: 12.5px; line-height: 1.5 }
.tbl-plan-tx b { color: var(--tbl-ink); font-weight: 700 }
.tbl-plan-tx span { color: var(--tbl-muted) }

/* copy A/B (Copy & Texto) */
.tbl-quote { font-family: Georgia, serif; font-style: italic; font-size: 19px; line-height: 1.35; letter-spacing: -.01em; color: var(--tbl-ink); margin: 2px 0 12px }
.tbl-var { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; line-height: 1.55; color: var(--tbl-body); margin-bottom: 8px }
.tbl-var:last-of-type { margin-bottom: 13px }
.tbl-ab { flex-shrink: 0; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: #fff; border: 1px solid var(--tbl-border-warm); font-family: var(--tbl-mono); font-size: 10.5px; font-weight: 600; color: var(--tbl-gold-deep) }

/* mini dashboard (Tráfego & Análise) */
.tbl-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 2px 0 12px }
.tbl-kpi { display: flex; flex-direction: column; gap: 3px; background: #faf8f5; border: 1px solid var(--tbl-hairline); border-radius: 12px; padding: 10px 12px; min-width: 0 }
.tbl-kpi-l { font-family: var(--tbl-mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--tbl-faint) }
.tbl-kpi b { font-size: 16px; font-weight: 800; letter-spacing: -.02em; color: var(--tbl-ink); white-space: nowrap }
.tbl-delta { align-self: flex-start; font-size: 10.5px; font-weight: 700; border-radius: 6px; padding: 1px 6px }
.tbl-delta.up { color: #12693B; background: rgba(18, 105, 59, .1) }
.tbl-delta.down { color: #B4523F; background: rgba(180, 82, 63, .1) }
.tbl-bars { display: flex; align-items: flex-end; gap: 6px; height: 54px; margin: 0 0 13px; padding: 0 2px }
.tbl-bars i { flex: 1; height: var(--h); border-radius: 5px 5px 2px 2px; background: #e7e0d4; transform-origin: bottom; animation: tblGrow .7s var(--tbl-ease) both; animation-delay: calc(var(--i, 0) * 90ms + 200ms) }
.tbl-bars i.hot { background: linear-gradient(180deg, #E8C49A, var(--tbl-gold)) }
@keyframes tblGrow { from { transform: scaleY(0) } to { transform: scaleY(1) } }

/* carrossel (Design & Imagem) */
.tbl-gal { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 2px 0 12px }
.tbl-lam { position: relative; aspect-ratio: 4 / 5; border-radius: 10px; border: 1px solid var(--tbl-border-warm); background: linear-gradient(160deg, #f3ead9, #e4d3b8); overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; padding: 9px }
.tbl-lam::before { content: attr(data-n); position: absolute; top: 6px; left: 8px; font-family: var(--tbl-mono); font-size: 9px; color: var(--tbl-gold-deep); opacity: .75 }
.tbl-lam:nth-child(2) { background: linear-gradient(160deg, #efe6da, #d9c6a6) }
.tbl-lam:nth-child(3) { background: linear-gradient(160deg, #f5efe4, #e0cdb0) }
.tbl-lam-bar { height: 5px; border-radius: 3px; background: rgba(28, 26, 22, .28); width: 82% }
.tbl-lam-bar.curta { width: 52%; background: rgba(28, 26, 22, .16) }
.tbl-lam-mais { display: grid; place-items: center; background: #faf8f5; color: var(--tbl-faint); font-size: 13px; font-weight: 700; padding: 0 }
.tbl-gal-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 13px }
.tbl-mchip { font-size: 11px; font-weight: 600; color: var(--tbl-gold-deep); background: var(--tbl-gold-dim); border: 1px solid var(--tbl-gold-border); border-radius: 999px; padding: 3px 10px }

/* player (Vídeo & Animação) */
.tbl-player { display: flex; align-items: center; gap: 12px; background: linear-gradient(135deg, #241e15, #3d2d1a 60%, #241e15); border-radius: 14px; padding: 14px 16px; margin: 2px 0 12px }
.tbl-play { flex-shrink: 0; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(232, 196, 154, .16); border: 1px solid rgba(232, 196, 154, .4); color: #E8C49A }
.tbl-play svg { width: 14px; height: 14px; margin-left: 2px }
.tbl-track { flex: 1; height: 4px; border-radius: 999px; background: rgba(245, 240, 232, .16); overflow: hidden }
.tbl-track i { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, #B8956A, #E8C49A); transform-origin: left; animation: tblTrack 6s linear infinite }
@keyframes tblTrack { from { transform: scaleX(0) } to { transform: scaleX(1) } }
.tbl-dur { font-family: var(--tbl-mono); font-size: 10.5px; color: rgba(245, 240, 232, .65) }

@media (prefers-reduced-motion: reduce) {
  .tbl-rise, .tbl-bars i, .tbl-track i { animation: none }
}

/* ── responsivo ── */
@media (max-width: 960px) {
  .tb-live-grid { grid-template-columns: 1fr; gap: 18px }
  /* no mobile a navegação vira uma tira horizontal de abas curtas — o chat fica
     parado no lugar dele, o usuário só clica na aba e vê a animação ali dentro.
     A versão vertical (com descrição expandindo) não funciona bem no toque. */
  .tbl-nav { flex-direction: row; align-self: stretch; gap: 7px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none }
  .tbl-nav::-webkit-scrollbar { display: none }
  /* width:auto (não 100%) é o que faz cada aba ficar do tamanho do próprio texto,
     em vez de ocupar a tela inteira — só assim várias cabem lado a lado e dá pra
     ver (e arrastar) que existe mais coisa pro lado */
  .tbl-nav-item { flex: 0 0 auto; width: auto; padding: 9px 14px; border-radius: 999px }
  .tbl-nav-head { gap: 7px; font-size: 10px }
  .tbl-nav-head svg { width: 14px; height: 14px }
  .tbl-nav-body { display: none !important }
  .tbl-nav-head { white-space: nowrap }
  .tbl-chat { min-height: 440px }
}
@media (max-width: 560px) {
  .tbl-chat { min-height: 400px; border-radius: 18px }
  .tbl-composer-ph { padding: 14px 14px 20px }
  .tbl-conn-logos { display: none }
  .tbl-prompt-in { max-width: 100% }
}
