/* Componentes — visual "adesivo": cartões brancos com borda verde, títulos em vermelho, números gigantes. */

/* ---------- cabeçalho ---------- */
.top { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; justify-content: space-between; background: var(--verde); color: var(--branco); border-radius: var(--r-lg); padding: .6rem 1.3rem; box-shadow: var(--sombra); }
.top__title { display: grid; line-height: 1.05; }
.top__title strong { font-family: var(--font-display); font-weight: 900; font-size: 1.35rem; letter-spacing: .04em; text-transform: uppercase; }
.top__title span { font-size: .85rem; font-weight: 600; opacity: .8; letter-spacing: .04em; }
.top__updated { display: grid; justify-items: end; line-height: 1.05; margin-left: auto; }
.top__updated-label { font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; opacity: .75; }
.top__updated-value { font-family: var(--font-display); font-weight: 900; font-size: 1.9rem; font-variant-numeric: tabular-nums; }
.top__age { font-size: .76rem; opacity: .75; font-variant-numeric: tabular-nums; min-height: 1em; }
.top__clock { display: grid; justify-items: end; line-height: 1.05; opacity: .7; font-variant-numeric: tabular-nums; }
.top__clock span { font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; }
.top__clock strong { font-size: 1rem; font-weight: 600; }

/* ---------- faixas de alerta ---------- */
.ribbons { display: grid; gap: .35rem; }
.ribbon { border-radius: var(--r-sm); padding: .4rem .9rem; font-weight: 800; font-size: .95rem; letter-spacing: .03em; display: flex; gap: .7rem; align-items: baseline; flex-wrap: wrap; }
.ribbon small { font-weight: 600; letter-spacing: 0; opacity: .92; }
.ribbon--demo { background: var(--vermelho); color: var(--branco); }
.ribbon--contingency { background: var(--aviso); color: var(--tinta); }
.ribbon--warn { background: var(--branco); color: var(--vermelho-escuro); border: 2px solid var(--vermelho); }
.ribbon--bad { background: var(--vermelho-escuro); color: var(--branco); }

/* ---------- painéis ---------- */
.panel { position: relative; background: var(--fundo); color: var(--tinta); border: 2px solid var(--verde); border-radius: var(--r-lg); padding: .85rem 1.1rem; display: flex; flex-direction: column; gap: .55rem; overflow: hidden; box-shadow: var(--sombra); }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; }
.panel__head h2 { font-family: var(--font-display); font-weight: 900; font-size: 1rem; color: var(--vermelho); letter-spacing: .05em; text-transform: uppercase; }
.panel__foot { font-size: .78rem; color: var(--tinta-suave); }
.note { font-size: .85rem; color: var(--vermelho-escuro); font-weight: 700; }
.chip { display: inline-block; border-radius: 99px; padding: .3rem .85rem; font-family: var(--font-display); font-weight: 700; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
.chip--status { background: var(--aviso); color: var(--tinta); align-self: flex-start; }
.chip--status.is-final { background: var(--verde); color: var(--branco); }
.chip--mini { background: var(--aviso); color: var(--tinta); font-size: .62rem; padding: .22rem .6rem; }
.chip--mini.is-final { background: var(--verde); color: var(--branco); }
.btn { background: var(--vermelho); color: var(--branco); border: 0; border-radius: var(--r-sm); padding: .5rem 1rem; font-weight: 800; transition: background .2s, transform .2s; }
.btn:hover { background: var(--vermelho-escuro); transform: translateY(-1px); }
.seg { display: inline-flex; background: var(--verde-claro); border-radius: 99px; padding: .15rem; }
.seg button { border: 0; background: transparent; padding: .25rem .8rem; border-radius: 99px; font-weight: 800; font-size: .78rem; color: var(--tinta-suave); transition: background .2s, color .2s; }
.seg button.is-on { background: var(--verde); color: var(--branco); }
.search { border: 2px solid var(--verde-linha); background: var(--branco); border-radius: 99px; padding: .3rem .9rem; min-width: 0; width: 11rem; color: var(--tinta); font-size: .9rem; transition: border-color .2s; }
.search:focus { outline: none; border-color: var(--verde); }

/* ---------- destaque (Júlia) ---------- */
.panel--hero { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: .8rem 1.6rem; padding: .8rem 1.4rem; border-width: 3px; border-radius: 1.8rem; }
.hero__photo { --foto-h: 12rem; height: var(--foto-h); display: grid; place-items: end center; }
.hero__photo img { height: var(--foto-h); width: auto; max-width: none; object-fit: contain; mix-blend-mode: multiply; }
.hero__id { display: grid; gap: .45rem; justify-items: start; }
.hero__logo { height: 8.6rem; width: auto; }
.hero__role { font-family: var(--font-display); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: .78rem; color: var(--verde); }
.hero__votes { display: grid; gap: .1rem; justify-items: start; align-content: center; }
.hero__votes-value { font-family: var(--font-display); font-weight: 900; font-size: 5rem; line-height: 1; color: var(--verde); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.hero__votes-sub { font-size: 1.05rem; font-weight: 600; color: var(--tinta-suave); }
.hero__votes-sub b { color: var(--vermelho); font-family: var(--font-display); font-weight: 900; font-size: 1.5rem; }
.hero__stats { display: grid; grid-template-columns: repeat(2, minmax(9rem, 1fr)); gap: 1.4rem; }
.stat { display: grid; gap: .12rem; align-content: center; }
.stat__value { font-family: var(--font-display); font-weight: 900; font-size: 2.6rem; line-height: 1; color: var(--vermelho); font-variant-numeric: tabular-nums; }
.stat__sub { font-size: .82rem; color: var(--tinta-suave); font-weight: 600; }
.bar { height: .6rem; background: var(--verde-claro); border-radius: 99px; overflow: hidden; margin-top: .3rem; }
.bar i { display: block; height: 100%; width: 0; background: var(--verde); border-radius: 99px; transition: width .8s ease; }
.hero__note { grid-column: 1 / -1; font-size: .72rem; color: var(--tinta-suave); margin-top: -.2rem; }
.is-flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { color: var(--vermelho); transform: scale(1.03); } 100% { } }

/* ---------- mapa ---------- */
.map { flex: 1; min-height: 0; display: grid; place-items: center; }
.map svg { width: 100%; height: 100%; max-height: 100%; }
.map .mun { stroke: var(--branco); stroke-width: 1.1; stroke-linejoin: round; fill: var(--verde-claro); transition: fill .5s; cursor: pointer; vector-effect: non-scaling-stroke; }
.map .mun:hover, .map .mun.is-sel { stroke: var(--vermelho); stroke-width: 2.4; }
.map .mun.dim { opacity: .18; }
.map .mun.is-sel { animation: pulse-sel 1.4s ease-in-out infinite; }
@keyframes pulse-sel { 50% { stroke: var(--tinta); } }
.legend { display: flex; align-items: center; gap: .6rem; font-size: .75rem; font-weight: 700; color: var(--tinta-suave); }
.legend__bar { flex: 1; height: .55rem; border-radius: 99px; }
.legend__na { display: inline-flex; align-items: center; gap: .3rem; }
.legend__na i { width: .9rem; height: .55rem; border-radius: 2px; background: #dfe5e1; border: 1px solid var(--verde-linha); }
.tip { position: absolute; z-index: 5; pointer-events: none; background: var(--verde-escuro); color: var(--branco); border-radius: var(--r-sm); padding: .5rem .7rem; font-size: .85rem; line-height: 1.3; box-shadow: 0 .4rem 1.2rem rgba(0, 0, 0, .3); max-width: 14rem; }
.tip b { color: var(--branco); display: block; font-family: var(--font-display); font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; margin-bottom: .1rem; }
.tip span { opacity: .85; }

/* ---------- tabelas ---------- */
.table-wrap { flex: 1; min-height: 0; overflow: auto; border-radius: var(--r-sm); scrollbar-width: thin; }
.layout-tv .table-wrap { overflow: hidden; }
.layout-tv .table-wrap.is-user { overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { position: sticky; top: 0; background: var(--fundo); text-align: left; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--tinta-suave); padding: .3rem .4rem; border-bottom: 2px solid var(--verde); z-index: 1; }
.table th.num { text-align: right; }
.table th button { all: unset; cursor: pointer; font: inherit; letter-spacing: inherit; }
.table th button:hover, .table th button.is-on { color: var(--vermelho); }
.table td { padding: .28rem .4rem; border-bottom: 1px solid var(--verde-linha); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 14rem; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover td { background: var(--verde-claro); }
.table tr.is-sel td { background: var(--vermelho-claro); font-weight: 800; }
.table tr.is-julia td, .table tr.is-julia:hover td { background: var(--vermelho); color: var(--branco); font-weight: 800; }
.table tr.is-julia td.pos { color: var(--branco); }
.table .pos { width: 2.6rem; font-family: var(--font-display); font-weight: 900; font-size: .95rem; color: var(--vermelho); }
.table small { color: var(--tinta-suave); font-weight: 600; }
.table tr.is-julia small { color: rgba(255, 255, 255, .85); }
.mini { display: inline-block; width: 4.2rem; height: .42rem; background: var(--verde-claro); border-radius: 99px; overflow: hidden; vertical-align: middle; margin-right: .35rem; }
.mini i { display: block; height: 100%; background: var(--verde); }
.mini.is-partial i { background: var(--aviso); }

/* ---------- evolução ---------- */
.evol { flex: 1; min-height: 9rem; position: relative; }
.evol canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.evol-list { font-size: .9rem; }
.evol-list table { width: 100%; border-collapse: collapse; }
.evol-list td, .evol-list th { padding: .25rem .4rem; border-bottom: 1px solid var(--verde-linha); text-align: right; }
.evol-list th:first-child, .evol-list td:first-child { text-align: left; }
.evol.is-off { display: none; }

/* ---------- visão geral (secundária) ---------- */
.ov { all: unset; box-sizing: border-box; cursor: pointer; background: var(--verde); color: var(--branco); border-radius: var(--r-md); padding: .65rem .85rem; display: flex; flex-direction: column; gap: .3rem; overflow: hidden; min-height: 9rem; border: 2px solid var(--verde); transition: background .2s, transform .2s, border-color .2s; }
.ov:hover { background: var(--verde-escuro); border-color: var(--vermelho); transform: translateY(-2px); }
.ov:focus-visible { outline: .18rem solid var(--vermelho); }
.ov__head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.ov__title { font-family: var(--font-display); font-weight: 900; font-size: .95rem; color: var(--branco); text-transform: uppercase; letter-spacing: .04em; }
.ov__meta { font-size: .66rem; font-weight: 700; opacity: .75; white-space: nowrap; }
.ov__bar { height: .3rem; background: rgba(255, 255, 255, .25); border-radius: 99px; overflow: hidden; }
.ov__bar i { display: block; height: 100%; background: var(--branco); }
.ov__list { list-style: none; margin: 0; padding: 0; display: grid; gap: .12rem; font-size: .8rem; min-height: 0; overflow: hidden; }
.ov__list li { display: flex; justify-content: space-between; gap: .5rem; }
.ov__list li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov__list li span:last-child { font-variant-numeric: tabular-nums; font-weight: 800; white-space: nowrap; }
.ov__state { font-size: .62rem; font-weight: 800; letter-spacing: .07em; color: var(--aviso); }
.ov__state.is-final { color: var(--branco); }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(3, 50, 29, .82); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 1rem; }
.modal__box { background: var(--fundo); color: var(--tinta); border: 3px solid var(--verde); border-radius: var(--r-lg); padding: 1.1rem 1.3rem; width: min(60rem, 100%); max-height: 100%; display: flex; flex-direction: column; gap: .6rem; overflow: hidden; }
.modal__head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.modal__head h2 { font-family: var(--font-display); font-weight: 900; font-size: 1.6rem; color: var(--vermelho); text-transform: uppercase; }
.modal__head p { color: var(--tinta-suave); font-weight: 600; }
.modal__badges { display: flex; gap: .5rem; flex-wrap: wrap; }
.table-wrap--modal { overflow: auto !important; }
.layout-tv .modal__box { font-size: 1.15rem; }

/* ---------- TV: densidade ---------- */
.layout-tv .board { display: grid; }
.layout-tv .ov { min-height: 0; height: 100%; }
.layout-tv .panel__head h2 { font-size: .95rem; }
.layout-tv .table { font-size: .9rem; }
.layout-tv .table td { padding: .17rem .4rem; }
.layout-tv .ribbon { padding: .22rem .8rem; font-size: .85rem; }
.layout-tv .panel--hero { padding: .6rem 1.3rem; }
.layout-tv .hero__note { display: none; }
.layout-tv .top { padding: .45rem 1.3rem; }

/* ---------- tablet / celular ---------- */
@media (max-width: 700px) {
  .panel--hero { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 1rem; }
  .hero__photo { --foto-h: 11rem; }
  .hero__id { justify-items: center; }
  .hero__logo { height: 7rem; }
  .hero__votes { justify-items: center; }
  .hero__votes-value { font-size: 3.1rem; }
  .hero__stats { grid-template-columns: 1fr 1fr; width: 100%; }
  .stat__value { font-size: 1.8rem; }
  .map { min-height: 16rem; }
  .table-wrap { max-height: 26rem; }
  .top__updated { margin-left: 0; justify-items: start; }
  .top__updated-value { font-size: 1.6rem; }
  .top__title strong { font-size: 1.05rem; }
}
@media (min-width: 701px) and (max-width: 1099px) {
  .panel--hero { grid-template-columns: auto 1fr; }
  .hero__stats { grid-column: 1 / -1; }
  .hero__votes { grid-column: 1 / -1; }
  .map { min-height: 22rem; }
  .table-wrap { max-height: 30rem; }
}
@media (min-width: 1100px) { html:not(.layout-tv) .map { min-height: 26rem; } html:not(.layout-tv) .table-wrap { max-height: 32rem; } }

/* ---------- vídeo (YouTube) embutido ---------- */
.panel--video { gap: .45rem; }
.vframe { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--r-md); overflow: hidden; background: #000; }
.vframe iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* fluxo (celular/PC): o vídeo ocupa a largura e vem primeiro */
#p-video { grid-column: 1 / -1; }
@media (min-width: 700px) { html:not(.layout-tv) #p-video { max-width: 52rem; width: 100%; justify-self: center; } }
.layout-tv #p-video { justify-content: flex-start; }
