:root {
  --gea-ink: #05070B;
  --gea-surface: #0A0E14;
  --gea-panel: #0F141C;
  --gea-panel-2: #131923;
  --gea-line: rgba(255, 255, 255, .07);
  --gea-line-2: rgba(255, 255, 255, .045);
  --gea-celeste: #4FC3F7;
  --gea-turquesa: #14E0C4;
  --gea-naranja: #FF7A29;
  --kpi-yellow: #FFD83D;
  --kpi-green: #21D959;
  --kpi-red: #E84855;
  --kpi-orange: #FF9A3C;
  --kpi-violet: #8B5CF6;
  --t-primary: #E6EAF1;
  --t-secondary: #C6CBD4;
  --t-muted: #98A2B3;
  --t-faint: #6B7280;
}

* {
  box-sizing: border-box;
}

::-webkit-scrollbar {
  width: 4px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .3);
  border-radius: 2px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(20, 224, 196, .035), transparent 260px),
    var(--gea-ink);
  color: var(--t-primary);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
}

.shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 28px 32px 64px;
}

.eyebrow {
  margin: 0 0 6px;
  color: rgba(255, 255, 255, .36);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  line-height: 1.2;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 15px;
  line-height: 1.2;
}

.tabbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  backdrop-filter: blur(18px);
}

.tabbar h2 {
  white-space: nowrap;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.tab-btn,
.segmented button {
  min-height: 34px;
  border: 1px solid var(--gea-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .035);
  color: var(--t-muted);
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}

.tab-btn {
  padding: 0 14px;
  font-size: 13px;
  font-weight: 650;
}

.tab-btn:hover,
.segmented button:hover {
  border-color: rgba(20, 224, 196, .24);
  color: var(--t-primary);
}

.tab-btn.active,
.segmented button.active {
  background: rgba(20, 224, 196, .12);
  border-color: rgba(20, 224, 196, .4);
  color: var(--gea-turquesa);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.kpi-grid.vertical {
  grid-template-columns: 1fr;
  align-content: start;
  margin-bottom: 0;
}

.kpi-card,
.panel {
  border: 1px solid var(--gea-line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(20, 29, 41, .96), rgba(13, 19, 28, .98));
  box-shadow: 0 18px 42px rgba(0, 0, 0, .28);
}

.kpi-card {
  display: grid;
  align-content: space-between;
  gap: 4px;
  padding: 8px 10px;
}

.kpi-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--t-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.kpi-dot {
  width: 7px;
  height: 7px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--gea-turquesa);
  box-shadow: 0 0 10px rgba(20, 224, 196, .65);
  flex: 0 0 auto;
}

.kpi-value {
  font-size: clamp(22px, 2.2vw, 28px);
  font-weight: 750;
  line-height: 1;
}

.kpi-foot {
  min-height: 15px;
  color: var(--t-faint);
  font-size: 12px;
}

.layout {
  display: grid;
  gap: 14px;
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.layout > * {
  animation: fade-in-up .45s ease-out both;
  animation-delay: calc((sibling-index() - 1) * 70ms);
}

.two-col {
  grid-template-columns: minmax(0, 1.28fr) minmax(360px, .72fr);
}

.split-three {
  grid-template-columns: minmax(190px, .5fr) minmax(0, 2.5fr) minmax(360px, 1fr) minmax(360px, 1fr);
}

.exec-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.exec-side > .panel:last-child {
  flex: 1;
}

.territorial-layout {
  grid-template-columns: minmax(0, 1.8fr) minmax(260px, 1fr) minmax(260px, 1fr);
}

.sector-layout {
  grid-template-columns: 1.5fr 1.5fr 1fr;
}

.dynamic-layout {
  grid-template-columns: 3fr 1fr;
}

.dynamic-side {
  display: grid;
  align-content: start;
  gap: 14px;
}

.panel {
  min-width: 0;
  padding: 14px;
}

.panel.wide {
  min-height: 330px;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  min-height: 39px;
  margin-bottom: 6px;
}

.panel-head h3 .unit {
  font-size: 11px;
  font-weight: 600;
  color: var(--t-muted);
}

.dynamic-side .panel {
  display: grid;
  gap: 4px;
  padding: 10px;
}

.dynamic-side .panel-head {
  margin-bottom: 0;
}

.map-panel {
  min-height: 430px;
}

.map-panel.large {
  min-height: 590px;
}

.map-wrap {
  position: relative;
  width: 100%;
  min-height: 350px;
  height: 48vh;
  max-height: 520px;
  border: 1px solid var(--gea-line-2);
  border-radius: 8px;
  background: rgba(5, 7, 11, .32);
  overflow: hidden;
}

.map-wrap.tall {
  height: 530px;
  max-height: none;
}

.map-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.geo-path {
  stroke: rgba(230, 234, 241, .2);
  stroke-width: .55;
  vector-effect: non-scaling-stroke;
  transition: opacity .14s ease, fill .14s ease, stroke .14s ease;
}

.geo-path:hover {
  opacity: 1;
  stroke: var(--gea-turquesa);
  stroke-width: 1.3;
}

.legend {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, .42);
  font-size: 11px;
}

.legend i {
  width: 12px;
  height: 8px;
  border-radius: 2px;
}

.legend .neg {
  background: var(--kpi-red);
}

.legend .mid {
  background: rgba(255, 255, 255, .16);
}

.legend .pos {
  background: var(--gea-turquesa);
}

.rank-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.list-title {
  margin: 0 0 8px;
  color: var(--t-muted);
  font-size: 12px;
  font-weight: 700;
}

.rank-list {
  display: grid;
  gap: 6px;
}

.rank-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid var(--gea-line-2);
  border-radius: 7px;
  background: rgba(255, 255, 255, .028);
}

.rank-name {
  overflow: hidden;
  color: var(--t-secondary);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-value {
  color: var(--t-primary);
  font-size: 12px;
  font-weight: 750;
}

.rank-value.pos,
.kpi-value.pos {
  color: var(--gea-turquesa);
}

.rank-value.neg,
.kpi-value.neg {
  color: var(--kpi-red);
}

.rank-value.info {
  color: var(--gea-celeste);
}

.bar-list {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 60px;
  align-items: center;
  gap: 10px;
  color: var(--t-secondary);
  font-size: 12px;
}

.bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #4fc3f7;
}

.bar-value {
  color: var(--t-muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.candle-wrap {
  display: grid;
  gap: 8px;
}

.candle-svg {
  width: 100%;
  height: auto;
  display: block;
}

.candle-track {
  fill: rgba(255, 255, 255, .06);
}

.candle-bar.pos {
  fill: rgba(20, 224, 196, .55);
}

.candle-bar.neg {
  fill: rgba(232, 72, 85, .55);
}

.candle-axis {
  stroke: rgba(230, 234, 241, .55);
  stroke-width: 2;
  stroke-linecap: round;
}

.candle-text {
  fill: var(--t-muted);
  font-size: 12px;
  font-weight: 650;
}

.candle-text.strong {
  fill: var(--t-primary);
}

.candle-text.neg {
  fill: var(--kpi-red);
}

.candle-text.pos {
  fill: var(--gea-turquesa);
}

.candle-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.candle-summary span {
  color: var(--t-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.candle-summary b {
  font-size: 14px;
}

.candle-summary .pos {
  color: var(--gea-turquesa);
}

.candle-summary .neg {
  color: var(--kpi-red);
}

.swarm {
  position: relative;
  height: 172px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.swarm.scaled {
  border: 1px solid var(--gea-line-2);
  border-radius: 8px;
  background:
    linear-gradient(to right, rgba(255, 255, 255, .035) 1px, transparent 1px),
    rgba(5, 7, 11, .2);
  background-size: 25% 100%, auto;
}

.swarm-zero {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, .16);
}

.swarm-dot {
  position: absolute;
  width: 7px;
  height: 7px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: rgba(79, 195, 247, .58);
}

.swarm-dot.neg {
  background: rgba(232, 72, 85, .72);
}

.swarm-dot.pos {
  background: rgba(20, 224, 196, .8);
}

.swarm-dot.clipped {
  border: 1px solid #E6EAF1;
}

.swarm-axis {
  display: flex;
  justify-content: space-between;
  padding-top: 8px;
  color: var(--t-faint);
  font-size: 11px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.segmented button {
  padding: 0 12px;
  font-size: 12px;
  font-weight: 650;
}

.sector-composition {
  display: grid;
  gap: 6px;
}

.sector-row {
  display: grid;
  grid-template-columns: minmax(140px, 2fr) minmax(30px, .5fr) minmax(170px, 2fr);
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 7px 8px;
  border: 1px solid var(--gea-line-2);
  border-radius: 7px;
  background: rgba(255, 255, 255, .026);
}

.sector-main {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.sector-code {
  display: grid;
  place-items: center;
  width: 28px;
  height: 22px;
  border-radius: 5px;
  background: rgba(20, 224, 196, .11);
  color: var(--gea-turquesa);
  font-size: 11px;
  font-weight: 800;
  flex: 0 0 auto;
}

.sector-name {
  min-width: 0;
  overflow: hidden;
  color: var(--t-secondary);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sector-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  overflow: hidden;
}

.sector-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gea-celeste), var(--gea-turquesa));
}

.sector-metrics {
  display: grid;
  grid-template-columns: 1fr 52px 52px;
  gap: 8px;
  color: var(--t-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.sector-share {
  color: var(--t-secondary);
  font-weight: 700;
}

.sector-delta {
  font-weight: 750;
}

.sector-delta.pos {
  color: var(--gea-turquesa);
}

.sector-delta.neg {
  color: var(--kpi-red);
}

.heatmap {
  display: grid;
  gap: 5px;
  overflow: auto;
  padding-bottom: 4px;
}

.heat-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.4fr) repeat(5, minmax(48px, .6fr));
  gap: 5px;
  min-width: 460px;
}

.heat-cell {
  min-height: 31px;
  display: grid;
  align-items: center;
  padding: 6px 8px;
  border-radius: 6px;
  color: rgba(255, 255, 255, .86);
  font-size: 11px;
  font-weight: 650;
}

.heat-head {
  color: var(--t-muted);
  background: rgba(255, 255, 255, .045);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.flow-svg,
.flow-visual,
.gauge-svg,
.bullet-svg {
  width: 100%;
  height: auto;
  display: block;
}

.flow-visual-wrap {
  min-height: 300px;
  border: 1px solid var(--gea-line-2);
  border-radius: 8px;
  background:
    radial-gradient(420px circle at 70% 10%, rgba(20, 224, 196, .08), transparent 48%),
    linear-gradient(to right, rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, .025) 1px, transparent 1px),
    rgba(5, 7, 11, .28);
  background-size: auto, 48px 48px, 48px 48px, auto;
  overflow: hidden;
}

.flow-grid-lines line {
  stroke: rgba(255, 255, 255, .055);
  stroke-width: 1;
}

.flow-band {
  fill: none;
  stroke-linecap: round;
}

.flow-band.stay {
  stroke: var(--gea-celeste);
}

.flow-band.entry {
  stroke: url(#entryBand);
}

.flow-band.exit {
  stroke: url(#exitBand);
}

.flow-node rect,
.flow-callout rect {
  fill: rgba(8, 12, 18, .78);
  stroke: rgba(255, 255, 255, .09);
  backdrop-filter: blur(8px);
}

.flow-node.actual rect {
  stroke: rgba(20, 224, 196, .28);
}

.flow-node-label {
  fill: var(--t-muted);
  font-family: "Space Grotesk", "Segoe UI", Arial, sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.flow-node-value {
  fill: var(--t-primary);
  font-family: "Space Grotesk", "Segoe UI", Arial, sans-serif;
  font-size: 24px;
  font-weight: 800;
}

.flow-callout text {
  fill: var(--t-secondary);
  font-family: "Space Grotesk", "Segoe UI", Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
}

.flow-callout text + text {
  fill: var(--t-primary);
  font-size: 15px;
}

.flow-callout.stay rect {
  fill: rgba(79, 195, 247, .1);
  stroke: rgba(79, 195, 247, .26);
}

.flow-callout.entry rect {
  fill: rgba(20, 224, 196, .08);
  stroke: rgba(20, 224, 196, .24);
}

.flow-callout.exit rect {
  fill: rgba(232, 72, 85, .08);
  stroke: rgba(232, 72, 85, .24);
}

.dynamic-balance {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.dynamic-balance div {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--gea-line-2);
  border-radius: 8px;
  background: rgba(255, 255, 255, .026);
}

.dynamic-balance span {
  color: var(--t-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.dynamic-balance b {
  color: var(--t-primary);
  font-family: "Space Grotesk", "Segoe UI", Arial, sans-serif;
  font-size: 22px;
}

.dynamic-balance .pos {
  color: var(--gea-turquesa);
}

.dynamic-balance .neg {
  color: var(--kpi-red);
}

.chart-note {
  margin-top: 8px;
  color: var(--t-faint);
  font-size: 11px;
}

.tooltip {
  position: fixed;
  z-index: 20;
  min-width: 180px;
  max-width: 260px;
  padding: 9px 10px;
  border: 1px solid rgba(20, 224, 196, .24);
  border-radius: 8px;
  background: rgba(7, 11, 17, .95);
  box-shadow: 0 16px 34px rgba(0, 0, 0, .38);
  color: var(--t-secondary);
  font-size: 12px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .12s ease, transform .12s ease;
}

.tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

.tooltip b {
  display: block;
  margin-bottom: 4px;
  color: var(--t-primary);
}

@media (max-width: 1100px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .two-col,
  .territorial-layout,
  .dynamic-layout,
  .split-three,
  .sector-layout {
    grid-template-columns: 1fr;
  }

  .map-wrap,
  .map-wrap.tall {
    height: 520px;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 18px 14px 42px;
  }

  .tabbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .tabs {
    justify-content: flex-start;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rank-columns {
    grid-template-columns: 1fr;
  }

  .sector-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .sector-metrics {
    grid-template-columns: repeat(3, 1fr);
    text-align: left;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .map-wrap,
  .map-wrap.tall {
    height: 430px;
  }

  .dynamic-balance {
    grid-template-columns: 1fr;
  }
}
