:root {
  color-scheme: dark;
  --bg: #070908;
  --panel: #0e1311;
  --panel-2: #121816;
  --panel-3: #171f1d;
  --text: #edf6ef;
  --muted: #aab8b0;
  --dim: #6f7d76;
  --line: #293731;
  --line-strong: #3f5149;
  --green: #83f3a2;
  --cyan: #66e5df;
  --amber: #ffd166;
  --red: #ff6f61;
  --violet: #c29bff;
  --blue: #77b7ff;
  --pink: #ff8bd4;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(255, 209, 102, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(102, 229, 223, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, #080b09 0%, #050706 100%);
  background-size: 48px 48px, 48px 48px, auto;
  color: var(--text);
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 8px 13px;
  border-bottom: 1px solid rgba(131, 243, 162, 0.18);
  background:
    linear-gradient(180deg, rgba(18, 24, 22, 0.96), rgba(10, 14, 13, 0.98)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 12px);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.24);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.brand-mark {
  width: 27px;
  height: 27px;
  border: 1px solid rgba(131, 243, 162, 0.42);
  border-radius: 8px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(131, 243, 162, 0.13), transparent 42%),
    linear-gradient(315deg, rgba(255, 209, 102, 0.18), transparent 48%),
    #111714;
  box-shadow: inset 0 0 18px rgba(102, 229, 223, 0.1);
}

.brand-mark span {
  width: 14px;
  height: 14px;
  border: 1px solid var(--green);
  border-radius: 50%;
  display: block;
  position: relative;
}

.brand-mark span::before,
.brand-mark span::after {
  content: "";
  position: absolute;
  inset: 4px -5px;
  border-top: 1px solid var(--amber);
  border-bottom: 1px solid var(--cyan);
  transform: rotate(35deg);
}

.brand-mark span::after {
  transform: rotate(-35deg);
  border-top-color: var(--cyan);
  border-bottom-color: var(--amber);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 13px;
  line-height: 1.1;
  font-weight: 760;
}

.eyebrow,
.panel-kicker,
.kpi-label {
  color: var(--amber);
  font-size: 8px;
  line-height: 1;
  text-transform: uppercase;
  font-weight: 800;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex: 1 1 auto;
  min-width: 0;
}

.timeline-control {
  width: min(360px, 28vw);
  min-width: 250px;
  display: grid;
  grid-template-columns: 96px minmax(130px, 1fr);
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border: 1px solid rgba(170, 184, 176, 0.2);
  border-radius: 6px;
  background: rgba(8, 12, 11, 0.72);
}

.timeline-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.timeline-copy span {
  color: var(--dim);
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.timeline-copy strong {
  color: var(--green);
  font-size: 9px;
  line-height: 1.1;
  font-weight: 760;
  white-space: nowrap;
}

.timeline-slider {
  --range-start: 0%;
  --range-end: 100%;
  position: relative;
  height: 24px;
  min-width: 0;
}

.timeline-slider::before,
.timeline-slider::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 11px;
  height: 3px;
  border-radius: 999px;
}

.timeline-slider::before {
  background: rgba(170, 184, 176, 0.18);
}

.timeline-slider::after {
  left: var(--range-start);
  right: calc(100% - var(--range-end));
  background: linear-gradient(90deg, var(--cyan), var(--green));
  box-shadow: 0 0 16px rgba(131, 243, 162, 0.18);
}

.timeline-slider input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  margin: 0;
  background: transparent;
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
}

.timeline-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 24px;
  background: transparent;
}

.timeline-slider input[type="range"]::-moz-range-track {
  height: 24px;
  background: transparent;
}

.timeline-slider input[type="range"]::-webkit-slider-thumb {
  width: 13px;
  height: 13px;
  margin-top: 5px;
  border: 1px solid rgba(7, 16, 11, 0.85);
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(131, 243, 162, 0.18);
  cursor: pointer;
  pointer-events: auto;
  appearance: none;
  -webkit-appearance: none;
}

.timeline-slider input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 1px solid rgba(7, 16, 11, 0.85);
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(131, 243, 162, 0.18);
  cursor: pointer;
  pointer-events: auto;
}

.search-control input {
  width: min(320px, 27vw);
  min-width: 160px;
  min-height: 29px;
  border: 1px solid rgba(102, 229, 223, 0.24);
  border-radius: 5px;
  color: var(--text);
  background: rgba(8, 12, 11, 0.82);
  padding: 0 9px;
  font-size: 11px;
  outline: none;
}

.search-control input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(102, 229, 223, 0.1);
}

.mode-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid rgba(170, 184, 176, 0.22);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
}

.mode-button,
.utility-button,
.button-row button {
  min-height: 25px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  padding: 0 8px;
  font-size: 11px;
}

.mode-button.is-active {
  color: #07100b;
  background: var(--green);
  border-color: rgba(131, 243, 162, 0.6);
  box-shadow: 0 0 22px rgba(131, 243, 162, 0.18);
}

.utility-button {
  color: var(--text);
  border-color: rgba(255, 209, 102, 0.3);
  background: rgba(255, 209, 102, 0.08);
}

.workspace {
  padding: 12px;
  display: grid;
  gap: 12px;
  min-width: 0;
}

.kpi-band {
  display: grid;
  grid-template-columns: minmax(280px, 2fr) repeat(5, minmax(112px, 1fr));
  gap: 10px;
}

.kpi-card,
.panel {
  border: 1px solid rgba(131, 243, 162, 0.14);
  background:
    linear-gradient(180deg, rgba(18, 24, 22, 0.93), rgba(9, 13, 12, 0.96)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 18px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025), 0 14px 36px rgba(0, 0, 0, 0.2);
}

.kpi-card {
  min-height: 66px;
  padding: 10px 12px;
  border-radius: 8px;
}

.kpi-card h2 {
  margin-top: 8px;
  color: var(--text);
  font-size: 18px;
  line-height: 1.08;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.kpi-wide h2 {
  font-size: 14px;
  color: var(--green);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(270px, 0.78fr) minmax(420px, 1.32fr);
  grid-template-rows: 370px 430px 420px 330px minmax(220px, auto);
  gap: 12px;
  min-height: 1770px;
}

.panel {
  border-radius: 8px;
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.trend-panel {
  grid-column: 1 / -1;
}

.detail-panel,
.volatility-panel,
.compare-panel {
  grid-column: 1 / -1;
  position: relative;
}

.panel-header {
  min-height: 42px;
  padding: 10px 12px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(170, 184, 176, 0.14);
}

.panel-header h2 {
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.15;
  font-weight: 760;
}

.panel-meta {
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.button-row {
  display: flex;
  gap: 4px;
}

.button-row button,
.detail-controls button {
  border-color: rgba(102, 229, 223, 0.24);
  color: var(--text);
  background: rgba(102, 229, 223, 0.07);
}

.detail-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.trend-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  flex-wrap: wrap;
  min-width: 0;
}

.volatility-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.range-control {
  display: grid;
  grid-template-columns: auto 150px 48px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.range-control span {
  color: var(--dim);
  text-transform: uppercase;
  font-size: 8px;
  font-weight: 780;
}

.range-control strong {
  color: var(--green);
  font-size: 10px;
  text-align: right;
}

.range-control input[type="range"] {
  width: 150px;
  accent-color: var(--green);
}

.detail-controls button {
  min-height: 25px;
  border-radius: 4px;
  padding: 0 9px;
  font-size: 11px;
}

.detail-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.detail-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  min-height: 0;
  overflow: hidden;
}

.chart-surface {
  position: relative;
  min-height: 0;
  overflow: hidden;
  padding: 10px;
}

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

.axis text,
.chart-label,
.treemap-label {
  fill: var(--muted);
  font-size: 10px;
}

.axis line,
.axis path,
.grid-line {
  stroke: rgba(170, 184, 176, 0.18);
  shape-rendering: crispEdges;
}

.year-bar {
  fill: rgba(102, 229, 223, 0.62);
  stroke: rgba(102, 229, 223, 0.8);
  rx: 3px;
}

.year-bar.is-selected {
  fill: rgba(131, 243, 162, 0.86);
  stroke: rgba(131, 243, 162, 1);
}

.year-bar.is-empty {
  fill: rgba(255, 111, 97, 0.24);
  stroke: rgba(255, 111, 97, 0.45);
}

.year-hit,
.tree-hit {
  fill: transparent;
  cursor: pointer;
}

.treemap-node {
  stroke: rgba(7, 9, 8, 0.82);
  stroke-width: 1;
}

.treemap-node.is-selected {
  stroke: var(--amber);
  stroke-width: 2;
}

.treemap-label {
  pointer-events: none;
  font-size: 9px;
  fill: #f5fff7;
  font-weight: 720;
}

.treemap-sub {
  pointer-events: none;
  font-size: 8px;
  fill: rgba(237, 246, 239, 0.72);
}

.trend-line {
  fill: none;
  stroke: var(--green);
  stroke-width: 2.2;
}

.trend-band {
  fill: rgba(102, 229, 223, 0.11);
  stroke: rgba(102, 229, 223, 0.22);
}

.trend-point {
  fill: var(--green);
  stroke: #07100b;
  stroke-width: 1.5;
  cursor: pointer;
}

.trend-point.is-selected {
  fill: var(--amber);
  stroke: var(--green);
  stroke-width: 2.5;
}

.variance-bar {
  fill: rgba(255, 209, 102, 0.28);
  stroke: rgba(255, 209, 102, 0.34);
}

.volatility-axis {
  stroke: rgba(237, 246, 239, 0.48);
  stroke-width: 1.4;
  shape-rendering: crispEdges;
}

.volatility-bar {
  cursor: pointer;
}

.volatility-bar.is-up {
  fill: rgba(131, 243, 162, 0.68);
  stroke: rgba(131, 243, 162, 0.95);
}

.volatility-bar.is-down {
  fill: rgba(255, 111, 97, 0.56);
  stroke: rgba(255, 111, 97, 0.92);
}

.volatility-label-up {
  fill: var(--green);
  font-size: 10px;
  font-weight: 740;
}

.volatility-label-down {
  fill: var(--red);
  font-size: 10px;
  font-weight: 740;
}

.detail-point {
  fill: rgba(102, 229, 223, 0.5);
  stroke: rgba(7, 9, 8, 0.58);
  stroke-width: 0.5;
  cursor: pointer;
}

.detail-point.is-selected {
  fill: var(--amber);
  stroke: #07100b;
  stroke-width: 1.2;
}

.adjusted-arrow {
  pointer-events: none;
  stroke-linecap: round;
  stroke-width: 1.35;
  opacity: 0.72;
}

.adjusted-arrow.is-up {
  stroke: var(--green);
}

.adjusted-arrow.is-down {
  stroke: var(--red);
}

.adjusted-arrow.is-selected {
  stroke-width: 2.25;
  opacity: 0.95;
}

.detail-hour-line {
  stroke: rgba(170, 184, 176, 0.1);
  shape-rendering: crispEdges;
}

.detail-meta {
  position: absolute;
  right: 284px;
  bottom: 8px;
  color: var(--muted);
  font-size: 10px;
  pointer-events: none;
}

.point-inspector {
  border-left: 1px solid rgba(170, 184, 176, 0.14);
  padding: 12px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 10px;
  min-height: 0;
  background: rgba(7, 10, 9, 0.34);
}

.point-inspector h3 {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.2;
  color: var(--green);
  overflow-wrap: anywhere;
}

.field-grid {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 0;
  overflow: auto;
}

.field-row {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  gap: 8px;
  font-size: 10px;
  line-height: 1.25;
}

.field-row span:first-child {
  color: var(--dim);
  text-transform: uppercase;
  font-weight: 760;
  font-size: 8px;
}

.field-row span:last-child {
  color: var(--text);
  overflow-wrap: anywhere;
}

.call-button {
  min-height: 30px;
  border: 1px solid rgba(131, 243, 162, 0.36);
  border-radius: 4px;
  color: #06100a;
  background: var(--green);
  font-size: 11px;
  font-weight: 780;
}

.call-button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.call-status {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.comparison-stack {
  min-height: 178px;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  align-content: start;
  gap: 10px;
}

.comparison-card {
  border: 1px solid rgba(102, 229, 223, 0.2);
  border-radius: 8px;
  background: rgba(8, 12, 11, 0.88);
  padding: 10px;
  min-height: 172px;
  display: grid;
  gap: 8px;
}

.comparison-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.comparison-card h3 {
  font-size: 12px;
  color: var(--green);
  line-height: 1.2;
  margin: 0;
}

.comparison-card .close-card {
  width: 23px;
  height: 23px;
  border: 1px solid rgba(255, 111, 97, 0.3);
  border-radius: 4px;
  color: var(--text);
  background: rgba(255, 111, 97, 0.1);
}

.comparison-card .field-grid {
  overflow: visible;
}

.empty-state {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 20px;
}

.tooltip {
  position: fixed;
  z-index: 50;
  max-width: 280px;
  pointer-events: none;
  opacity: 0;
  transform: translate(10px, 10px);
  padding: 8px 9px;
  border: 1px solid rgba(131, 243, 162, 0.26);
  border-radius: 7px;
  background: rgba(8, 12, 11, 0.96);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.38);
  color: var(--text);
  font-size: 11px;
  line-height: 1.35;
}

.tooltip.is-visible {
  opacity: 1;
}

.tooltip strong {
  color: var(--green);
}

@media (max-width: 1040px) {
  .topbar,
  .topbar-actions {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .kpi-band,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-rows: 360px 420px 430px 520px 330px minmax(220px, auto);
  }

  .trend-panel,
  .detail-panel,
  .volatility-panel,
  .compare-panel {
    grid-column: auto;
  }

  .search-control input {
    width: 100%;
  }

  .timeline-control {
    width: 100%;
    grid-template-columns: 112px minmax(170px, 1fr);
  }

  .detail-controls {
    align-items: flex-end;
    flex-direction: column;
    gap: 5px;
  }

  .trend-controls {
    align-items: flex-end;
    flex-direction: column;
    gap: 5px;
  }

  .detail-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(300px, 1fr) auto;
  }

  .point-inspector {
    border-left: 0;
    border-top: 1px solid rgba(170, 184, 176, 0.14);
  }

  .detail-meta {
    right: 12px;
  }
}
