/*
 * Tema e moldura do painel (topo, abas, status). Não estiliza nada de metodologia: cada uma traz o
 * próprio style.css escopado em .m-<id>, e só usa estas variáveis de cor.
 */
:root {
  --bg: #0B0C0E;
  --bar: #0E1013;
  --col: #0F1114;
  --card: #15181C;
  --card2: #1B1F24;
  --line: #1A1D22;
  --line2: #1F2329;
  --line3: #2A2F36;
  --text: #ECEEF1;
  --sub: #9AA1AB;
  --dim: #8B929C;
  --faint: #3A3F47;
  --accent: #FFB547;
  --accent-bg: #2A2113;
  --accent-line: #4D3A17;
  --blue: #5E8BFF;
  --violet: #B48CFF;
  --gray: #8B93A1;
  --green: #2FD29B;
  --green2: #4ADBA6;
  --red: #F2545B;
  --red2: #FF7A86;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 13px/1.4 'Onest', system-ui, sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.grow { flex: 1; }

/* ---------- topo ---------- */
.top { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1680px; margin: 0 auto; padding: 0 20px; min-height: 56px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand em { font-style: normal; color: var(--accent); }
.logo { width: 28px; height: 28px; border-radius: 7px; background: var(--card); color: var(--accent); display: grid; place-items: center; }
.logo svg { width: 18px; height: 18px; }
.search { flex: 1 1 240px; max-width: 460px; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border-radius: 8px; background: #121418; border: 1px solid var(--line2); color: var(--dim); }
.search:focus-within { border-color: var(--line3); }
.search svg { width: 16px; height: 16px; flex: none; }
.search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--text); }
.search kbd { font-family: var(--mono); font-size: 11px; color: var(--dim); border: 1px solid #262A31; border-radius: 4px; padding: 0 5px; }
.live { display: flex; align-items: center; gap: 16px; font-size: 12px; color: var(--sub); }
.live-i { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.live-i b { color: var(--text); font-weight: 500; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); flex: none; display: inline-block; }
.dot.on { background: var(--green); }
.dot.wait { background: var(--faint); }
.icon-btn { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line2); background: #121418; color: #C4C9D0; display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { border-color: var(--line3); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.pop-wrap { position: relative; }
.pop { position: absolute; right: 0; top: 44px; width: 360px; max-width: calc(100vw - 32px); max-height: 70vh; overflow: auto; background: var(--card); border: 1px solid var(--line3); border-radius: 12px; padding: 12px 14px; box-shadow: 0 16px 40px rgba(0, 0, 0, .5); display: flex; flex-direction: column; gap: 8px; z-index: 30; }
.pop-h { font-size: 11px; font-weight: 600; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
.feed { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 8px; align-items: center; font-size: 12px; padding: 4px 0; border-top: 1px solid var(--line2); }
.feed:first-of-type { border-top: 0; }
.feed b { font-weight: 500; font-family: var(--mono); font-size: 12px; }
.feed time { color: var(--dim); font-family: var(--mono); font-size: 11px; }
.feed p { grid-column: 2 / -1; margin: 0; color: var(--dim); font-size: 11px; overflow-wrap: anywhere; }
.feed p.err { color: var(--red2); }

/* ---------- conteúdo ---------- */
.wrap { max-width: 1680px; margin: 0 auto; padding: 16px 20px 40px; }

/* abas de metodologia (cards) */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.tab { flex: none; min-width: 180px; max-width: 340px; text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bar); color: var(--sub); cursor: pointer; }
.tab:hover { border-color: var(--line3); color: var(--text); }
.tab-t { display: flex; align-items: baseline; gap: 8px; }
.tab-t b { font-weight: 600; color: var(--text); }
.tab-t em { font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--dim); }
.tab-d { font-size: 11px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab.active { border-color: var(--accent-line); background: var(--accent-bg); box-shadow: inset 0 0 0 1px var(--accent-line); }
.tab.active .tab-t em { color: var(--accent); }
.tab.err { border-style: dashed; }
.tab.err .tab-d { color: var(--red2); }

.notice { border: 1px solid var(--line2); background: var(--bar); border-radius: 12px; padding: 28px 20px; text-align: center; color: var(--sub); }
.notice b { display: block; color: var(--text); margin-bottom: 6px; }
.notice.err { border-color: #4A2226; background: #1C1214; }
.notice.err b { color: var(--red2); }
.notice pre { margin: 8px auto 0; max-width: 900px; text-align: left; white-space: pre-wrap; font-family: var(--mono); font-size: 12px; color: #E6B7BC; }

/* carregando: barra animada embaixo do topo + loading no meio da tela (app.js: renderLoading). O véu não bloqueia
   clique (pointer-events: none): dá para trocar de aba ou abrir o status enquanto carrega; o topo fica por cima. */
.loadbar { height: 2px; overflow: hidden; background: var(--line); position: relative; }
.loadbar::after { content: ''; position: absolute; top: 0; left: -40%; width: 40%; height: 100%; background: var(--accent); animation: loadbar 1.2s ease-in-out infinite; }
@keyframes loadbar { to { left: 100%; } }
.loading { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; padding: 16px; pointer-events: none; background: rgba(11, 12, 14, .55); }
.loading.hidden { display: none !important; }
.loading-box { display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 360px; padding: 26px 30px; border-radius: 16px; border: 1px solid var(--line3); background: var(--card); box-shadow: 0 20px 50px rgba(0, 0, 0, .55); color: var(--sub); font-size: 13px; text-align: center; }
.spin { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 3px solid var(--accent-line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* gráfico subindo em loop: a linha se desenha (dashoffset 100 → 0), a área e o ponto do topo aparecem, some e recomeça */
.ld-chart { width: 96px; height: 60px; overflow: visible; }
.ld-base { stroke: var(--line3); stroke-width: 1; }
.ld-line { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 100; stroke-dashoffset: 100; animation: ld-draw 1.8s ease-in-out infinite; }
.ld-area { fill: var(--accent); opacity: 0; animation: ld-fill 1.8s ease-in-out infinite; }
.ld-dot { fill: var(--accent); opacity: 0; animation: ld-dot 1.8s ease-in-out infinite; }
@keyframes ld-draw { 0% { stroke-dashoffset: 100; opacity: 1; } 65% { stroke-dashoffset: 0; opacity: 1; } 90% { stroke-dashoffset: 0; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes ld-fill { 0%, 45% { opacity: 0; } 70%, 90% { opacity: .14; } 100% { opacity: 0; } }
@keyframes ld-dot { 0%, 60% { opacity: 0; transform: scale(.4); } 70%, 90% { opacity: 1; transform: scale(1); } 100% { opacity: 0; } }
.ld-dot { transform-box: fill-box; transform-origin: center; }
@media (prefers-reduced-motion: reduce) { .loadbar::after, .spin, .ld-line, .ld-area, .ld-dot { animation-duration: 4s; } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--card2); border: 1px solid var(--line3); border-radius: 10px; padding: 10px 16px; box-shadow: 0 12px 30px rgba(0, 0, 0, .5); z-index: 40; max-width: calc(100vw - 32px); }
.toast.err { border-color: #4A2226; color: var(--red2); }

@media (max-width: 760px) {
  .top-in, .wrap { padding-left: 16px; padding-right: 16px; }
  .top-in { padding-top: 8px; padding-bottom: 8px; }
  .search { order: 5; flex-basis: 100%; max-width: none; }
  .live { gap: 10px; }
  .tab { min-width: 150px; }
}
