@font-face {
  font-family: "Mona Sans";
  src: url("/fonts/mona-sans.woff2") format("woff2");
  font-weight: 200 900;
  font-stretch: 75% 125%;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --page: #0d1a1f;
  --deep: #081216;
  --surface: #13242a;
  --surface-2: #1a2f36;
  --track: #112127;
  --text: #eef5f2;
  --text-2: #9db3b5;
  --lime: #cee119;
  --on-lime: #12170a;
  --s1: #cee119;
  --s2: #6d8a8f;
  --bar: #23424a;
  --bar-top: #4a5a17;
  --grid: #213940;
  --axis: #35545c;
  --line: #254047;
  --field: #4f7078;
  --good: #7fdc9b;
  --bad: #ff9c86;
  --wash: #1a2f36;
}

* { box-sizing: border-box; }
html { scrollbar-color: #35545c var(--page); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
  font-family: "Mona Sans", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}
::selection { background: var(--lime); color: var(--on-lime); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
h1, h2, p, ul { margin: 0; }
ul { list-style: none; padding: 0; }
svg { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }

.logo {
  display: block;
  width: 150px;
  aspect-ratio: 555 / 139;
  background: url("/img/logo.png") center / contain no-repeat;
}

/* ------------------------------------------------------------ barra do topo */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 14px max(clamp(18px, 3vw, 44px), calc((100% - 1400px) / 2 + 44px));
  background: var(--page);
}
.topbar::after {
  content: "";
  position: absolute;
  inset: 100% 0 auto;
  height: 18px;
  background: linear-gradient(var(--page), transparent);
  pointer-events: none;
}
.dock-slot { min-width: 0; }
.dock {
  position: relative;
  display: flex;
  max-width: 100%;
  padding: 6px;
  border-radius: 99px;
  background: var(--deep);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.32);
  overflow-x: auto;
  scrollbar-width: none;
}
.dock::-webkit-scrollbar { display: none; }
.dock-ind {
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  border-radius: 99px;
  background: var(--lime);
}
.dock button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 99px;
  color: #b4c5c6;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.2s;
}
.dock button svg { flex: none; }
.dock button:hover { color: #fff; }
.dock button[aria-selected="true"] { color: var(--on-lime); }
.dock button:focus-visible { outline-offset: -3px; }
.dock button[aria-selected="true"]:focus-visible { outline-color: var(--on-lime); outline-offset: -4px; }
.logout { justify-self: end; padding: 9px 6px; color: var(--text-2); font-weight: 500; transition: color 0.2s; }
.logout:hover { color: var(--text); }

.page { max-width: 1400px; margin: 0 auto; padding: 22px clamp(18px, 3vw, 44px) 48px; }

/* ------------------------------------------------------------------ filtros */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-bottom: 22px; min-height: 42px; }
h1 { font-size: 26px; font-weight: 600; font-stretch: 110%; letter-spacing: -0.01em; }
h2 { font-size: 17px; font-weight: 600; }
.hint { color: var(--text-2); font-size: 13px; }
.status { color: var(--text-2); font-size: 13px; margin: 5px auto 0 6px; }
.seg { position: relative; display: flex; padding: 4px; border-radius: 10px; background: var(--surface); }
.seg-ind { position: absolute; left: 0; top: 4px; bottom: 4px; border-radius: 7px; background: var(--lime); }
.seg button { position: relative; padding: 7px 15px; border-radius: 7px; color: var(--text-2); font-size: 14px; font-weight: 500; transition: color 0.2s; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { color: var(--on-lime); font-weight: 700; }
.ghost { padding: 10px 15px; border-radius: 10px; background: var(--surface); font-size: 14px; font-weight: 500; transition: background 0.2s; }
.ghost:hover { background: #20383f; }
.ghost:active { background: var(--surface); }
.ghost[aria-pressed="true"] { background: #35545c; }

.banner { margin-bottom: 18px; padding: 14px 18px; border: 1px solid var(--bad); border-radius: 12px; background: var(--surface); }
.banner small { display: block; margin-top: 4px; color: var(--text-2); overflow-wrap: anywhere; }
main { transition: opacity 0.2s; }
main.loading { opacity: 0.6; }

/* ------------------------------------------------- palco e faixa de números */
.stage { border-radius: 18px; background: var(--surface); overflow: hidden; }
.stage .card { padding: 22px 24px 20px; }
.mets { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.mets button { display: flex; flex-direction: column; justify-content: flex-start; padding: 22px 24px 20px; text-align: left; transition: background 0.2s; }
.mets button:hover { background: #182c33; }
.mets button:focus-visible { outline-offset: -4px; border-radius: 10px; }
.met-ind { position: absolute; left: 0; bottom: -1px; height: 3px; background: var(--lime); }
.label { display: block; color: var(--text-2); font-size: 14px; }
.value { display: block; margin: 4px 0; font-size: 36px; font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; transition: color 0.25s; }
.mets .value { color: #c8d6d5; }
.mets [aria-pressed="true"] .value { color: #fff; }
.delta { color: var(--text-2); font-size: 13px; }
.delta-slot { display: block; min-height: 19px; }
.delta .chg { font-weight: 700; }
.delta .chg svg { display: inline-block; vertical-align: -1px; margin-right: 3px; }
.delta .chg.up { color: var(--good); }
.delta .chg.down { color: var(--bad); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 30px; border-radius: 18px; background: var(--surface); }
.kpis:empty { min-height: 128px; }
.tile { padding: 22px 24px 20px; }

/* ------------------------------------------------------------------ cartões */
.card { min-width: 0; }
.card.surface { padding: 22px 24px 20px; border-radius: 18px; background: var(--surface); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 38px 34px; }
.stage + .grid2 { margin-top: 38px; }
.grid2.asym { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.grid2 .wide { grid-column: 1 / -1; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 14px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 20px; color: var(--text-2); font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.key { display: inline-block; flex: none; width: 16px; height: 3px; border-radius: 2px; }
.key.s1 { background: var(--s1); }
.key.s2 { background: var(--s2); }
.cardmsg { max-width: 70ch; margin-bottom: 12px; padding: 12px 14px; border-radius: 10px; background: var(--wash); color: var(--text-2); font-size: 14px; }
.cardmsg small { display: block; margin-top: 4px; overflow-wrap: anywhere; }

/* enquanto a primeira resposta não chega */
main.loading .chart-view:empty { min-height: 200px; border-radius: 12px; background: linear-gradient(100deg, var(--wash) 30%, #24414a 50%, var(--wash) 70%) 0 0 / 300% 100%; animation: wait 1.6s linear infinite; }
@keyframes wait { from { background-position: 100% 0; } to { background-position: -50% 0; } }

/* ----------------------------------------------------------------- gráficos */
.chart { position: relative; width: 100%; touch-action: pan-y; }
.chart svg { max-width: 100%; overflow: visible; border-radius: 8px; }
.grid { stroke: var(--grid); stroke-width: 1; }
.axis, .cross { stroke: var(--axis); stroke-width: 1; }
.tick { fill: var(--text-2); font-size: 12px; }
.endlabel { fill: var(--text); font-size: 12px; font-weight: 600; }
.line, .trail { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.line { stroke-width: 2; }
.trail { stroke-width: 7; opacity: 0.35; }
.line.s1, .trail.s1 { stroke: var(--s1); }
.line.s2 { stroke: var(--s2); }
.dot.s1 { fill: var(--s1); }
.dot.s2 { fill: var(--s2); }
.dot.ringed { stroke: var(--surface); stroke-width: 2; }
.hit { fill: transparent; }
.area.s1 { fill: var(--s1); fill-opacity: 0.1; }
.col { fill: var(--s1); transition: filter 0.1s; }
.col.dim { fill: #54777f; }
.col.hot { filter: brightness(1.2); }

/* ------------------------------------------------------------------- listas */
.row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; margin-bottom: 4px; padding: 11px 14px; border-radius: 9px; background: var(--track); overflow: hidden; }
.row:focus-visible { outline-offset: -2px; }
.bar { position: absolute; inset: 0; border-radius: 0 9px 9px 0; background: var(--bar); transform-origin: left; transition: filter 0.15s; }
.row.top .bar { background: var(--bar-top); }
.row:hover .bar, .row:focus-visible .bar { filter: brightness(1.2); }
.name { position: relative; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.name svg { display: inline-block; margin-right: 7px; vertical-align: -2px; color: var(--lime); fill: currentColor; }
.val { position: relative; font-weight: 600; }

/* ----------------------------------------------------------------- tooltip */
.tip { position: fixed; left: 0; top: 0; z-index: 50; max-width: 320px; min-width: 120px; padding: 9px 12px; border-radius: 9px; background: var(--text); color: var(--page); font-size: 13px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3); pointer-events: none; }
.tip-title { margin-bottom: 3px; overflow-wrap: anywhere; }
.tip-row { display: flex; align-items: center; gap: 8px; }
.tip-row strong { font-weight: 700; }
.tip .key.s1 { background: #8c9a00; }
.tip .key.s2 { background: #6d8a8f; }

/* ------------------------------------------------------------ vista tabela */
.table-view { display: none; }
body.tableview .table-view { display: block; }
body.tableview .chart-view, body.tableview .legend { display: none; }
.table-wrap { max-height: 380px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { position: sticky; top: 0; padding: 8px 12px 8px 0; background: var(--page); color: var(--text-2); font-weight: 500; text-align: left; box-shadow: 0 1px 0 var(--axis); }
.surface th, .stage th { background: var(--surface); }
td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--grid); overflow-wrap: anywhere; }
th.num, td.num { padding: 8px 0 8px 12px; text-align: right; }

/* --------------------------------------------------------- mapa de calor */
.heat-wrap { overflow-x: auto; padding: 2px; }
.heat { display: grid; grid-template-columns: 36px repeat(24, minmax(0, 1fr)); gap: 3px; align-items: center; min-width: 600px; }
.hlabel, .dlabel { color: var(--text-2); font-size: 12px; white-space: nowrap; }
.hcell { height: 26px; border-radius: 4px; }
.hcell:hover { outline: 2px solid var(--text); outline-offset: -1px; }
.heatscale { display: flex; align-items: center; gap: 4px; margin-top: 14px; color: var(--text-2); font-size: 12px; }
.heatscale .hsw { width: 22px; height: 12px; border-radius: 3px; }
.heatscale span:first-child { margin-right: 4px; }
.heatscale span:last-child { margin-left: 4px; }

/* -------------------------------------------------------------- tempo real */
.live { display: grid; grid-template-columns: 250px minmax(0, 1fr); align-items: center; }
.live-now { padding: 28px 0 28px 28px; }
.live-now .hint { margin-top: 10px; }
.hero { margin-bottom: 14px; font-size: 120px; font-weight: 600; line-height: 0.95; letter-spacing: -0.04em; }
.ping { position: relative; display: inline-block; width: 11px; height: 11px; margin-right: 11px; border-radius: 50%; background: var(--lime); }
.ping::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--lime); animation: ping 1.8s cubic-bezier(0.16, 1, 0.3, 1) infinite; }
@keyframes ping { from { transform: scale(1); opacity: 0.6; } to { transform: scale(3.4); opacity: 0; } }

.foot { max-width: 75ch; margin-top: 40px; color: var(--text-2); font-size: 13px; }

/* ------------------------------------------------------------------- login */
.login { display: grid; align-items: center; overflow-x: hidden; }
.login .trace { position: fixed; inset: 0; width: 100%; height: 100%; -webkit-mask: linear-gradient(90deg, transparent 42%, #000 56%); mask: linear-gradient(90deg, transparent 42%, #000 56%); }
.trace path { fill: none; stroke-linejoin: round; }
.trace .cold { stroke: #25444c; stroke-width: 1.5; }
.trace .hot { stroke: var(--lime); stroke-width: 2.5; }
.trace .runner { fill: var(--lime); }
.login main { position: relative; padding: 32px 20px; }
.login form { display: grid; gap: 18px; width: min(400px, 100%); margin-left: clamp(0px, 8vw, 140px); }
.login .logo { width: 230px; margin-bottom: 26px; }
.login h1 { margin-bottom: 6px; font-size: 38px; line-height: 1.08; font-stretch: 112%; letter-spacing: -0.02em; text-wrap: balance; }
.field { display: block; }
.field > span:first-child, .field > label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
.field input { width: 100%; height: 50px; padding: 0 14px; border: 1px solid var(--field); border-radius: 10px; background: var(--surface); font-size: 16px; caret-color: var(--lime); }
.field input:hover { border-color: #76979e; }
.field input:focus-visible { outline-offset: 1px; }
.field input[aria-invalid="true"] { border-color: var(--bad); }
.field input:-webkit-autofill { -webkit-text-fill-color: var(--text); box-shadow: inset 0 0 0 60px var(--surface); }
.pw { position: relative; display: block !important; margin: 0 !important; }
.pw input { padding-right: 92px; }
.pw button { position: absolute; top: 7px; right: 7px; height: 36px; padding: 0 10px; border-radius: 7px; color: var(--text-2); font-size: 13px; font-weight: 600; }
.pw button:hover { color: var(--text); }
.enter { height: 52px; border-radius: 10px; background: var(--lime); color: var(--on-lime); font-weight: 700; transition: background 0.2s; }
.enter:hover { background: #dcee35; }
.enter:active { background: #b9cb12; }
.enter:disabled { opacity: 0.7; cursor: default; }
.error { min-height: 44px; color: var(--bad); font-size: 14px; font-weight: 600; }

/* -------------------------------------------------------------- telas menores */
@media (max-width: 1180px) {
  .topbar { grid-template-columns: 1fr auto; gap: 12px; padding-block: 12px; }
  .dock-slot { grid-column: 1 / -1; grid-row: 2; justify-self: center; max-width: 100%; }
}
@media (max-width: 860px) {
  .grid2, .grid2.asym { grid-template-columns: minmax(0, 1fr); }
  .mets { grid-template-columns: 1fr 1fr; }
  .mets button { padding: 16px; }
  .mets [aria-pressed="true"] { background: #20383f; }
  .met-ind { display: none; }
  .value { font-size: 29px; }
  .stage .card, .card.surface { padding: 18px 14px 14px; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); }
  .tile { padding: 16px; }
  .live { grid-template-columns: minmax(0, 1fr); }
  .live-now { padding: 22px 16px 0; }
  .hero { font-size: 92px; }
  .logo { width: 124px; }
  .dock button { padding: 10px 13px; }
  .dock button svg { display: none; }
  .filters h1 { flex: 1 0 100%; }
  .status { order: 5; margin: 0; }
  .login form { margin-inline: auto; }
  .login .trace { opacity: 0.3; -webkit-mask: none; mask: none; }
  .login h1 { font-size: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
}
