:root {
  --slate-950: #020617;
  --slate-900: #0f172a;
  --slate-700: #334155;
  --slate-500: #64748b;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --white: #ffffff;
  --sky: #0ea5e9;
  --amber: #f59e0b;
  --rose: #e11d48;
  --pane-radius: 6px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--slate-100); color: var(--slate-950); }
button, input, select { font: inherit; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 300px 1fr; }
.sidebar { z-index: 5; height: 100vh; overflow: auto; padding: 18px; border-right: 1px solid var(--slate-200); background: rgba(255,255,255,.94); box-shadow: 0 24px 60px rgba(15, 23, 42, .15); display: flex; flex-direction: column; gap: 14px; }
.brand-card { border-radius: var(--pane-radius); padding: 10px; background: var(--slate-100); color: white; box-shadow: 0 20px 50px rgba(2,6,23,.28); }
.brand-row { display: flex; align-items: center; gap: 10px; }
.brand-row img {
    background-color: transparent !important;
}
.brand-icon { width: 46px; height: 46px; border-radius: var(--pane-radius); background: rgba(255,255,255,.12); display: grid; place-items: center; font-size: 25px; }
.eyebrow { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; font-weight: 800; color: #7dd3fc; }
h1, h2, p { margin: 0; }
h1 { font-size: 27px; letter-spacing: -.04em; }
.brand-card p { margin-top: 14px; color: #cbd5e1; line-height: 1.6; font-size: 14px; }
.panel { border: 1px solid var(--slate-200); background: white; border-radius: var(--pane-radius); padding: 16px; box-shadow: 0 8px 22px rgba(15,23,42,.06); }
.panel-title { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--slate-500); font-weight: 900; margin-bottom: 10px; }
.level-grid { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.level { cursor: pointer; display: inline-flex; align-items: center; gap: 7px; padding: 0; border: 0; background: transparent; border-radius: 0; text-align: left; font-weight: 800; color: var(--slate-950); }
.level input[type="radio"] { flex: 0 0 auto; width: 14px; height: 14px; margin: 0; accent-color: var(--slate-950); }
.level span { display: block; margin-top: 0; color: var(--slate-950); font-size: 12px; font-weight: 800; }
.level:hover span { color: var(--slate-700); }
.level input[type="radio"]:focus-visible + span { outline: 2px solid rgba(15,23,42,.22); outline-offset: 3px; border-radius: 3px; }
select, input[type="search"] { width: 100%; border: 1px solid var(--slate-200); border-radius: var(--pane-radius); padding: 11px 12px; outline: none; background: white; color: var(--slate-950); }
select:focus, input:focus { border-color: var(--slate-900); box-shadow: 0 0 0 3px rgba(15,23,42,.08); }
.primary-button { width: 100%; margin-top: 10px; padding: 12px 14px; border: 0; border-radius: var(--pane-radius); cursor: pointer; color: white; background: var(--slate-950); font-weight: 900; }
.primary-button:hover { background: var(--slate-700); }
.hidden { display: none !important; }
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { border-radius: var(--pane-radius); background: white; border: 1px solid var(--slate-200); padding: 14px; box-shadow: 0 8px 22px rgba(15,23,42,.06); }
.kpi span { display: block; color: var(--slate-500); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 900; }
.kpi strong { display: block; margin-top: 7px; font-size: 21px; letter-spacing: -.04em; }
.map-stage { position: relative; height: 100vh; min-height: 760px; overflow: hidden; background: #dbeafe; }
#map { position: absolute; inset: 0; }
.map-card { position: absolute; z-index: 2; border: 1px solid rgba(255,255,255,.75); background: rgba(255,255,255,.92); backdrop-filter: blur(14px); border-radius: var(--pane-radius); padding: 16px; box-shadow: 0 16px 40px rgba(15,23,42,.16); }
.top-left { top: 18px; left: 5%; width: 90%; max-width: none; }
.map-card-header { display: flex; align-items: flex-start; gap: 12px; width: 100%; }
.map-card h2 { margin-top: 4px; font-size: 28px; letter-spacing: -.04em; }
.map-card p { margin-top: 7px; color: var(--slate-700); line-height: 1.5; font-size: 14px; }
.market-search-panel { position: relative; flex: 0 0 300px; width: 300px; min-width: 0; }
.search-label { display: block; margin-bottom: 7px; color: var(--slate-500); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 900; }
.market-search-control { position: relative; }
.market-search-input { padding-right: 44px !important; font-weight: 800; }
.map-geography-panel { flex: 1 1 auto; min-width: 0; align-self: center; }
.map-geography-panel .level-grid { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.map-geography-panel .level { flex: 0 0 auto; min-width: 0; justify-content: flex-start; padding: 0; text-align: left; font-size: 12px; line-height: 1.2; gap: 6px; }
.map-geography-panel .level input[type="radio"] { width: 14px; height: 14px; }
.map-geography-panel .level span { margin-top: 0; font-size: 12px; line-height: 1.2; }
.search-clear { position: absolute; top: 50%; right: 8px; width: 30px; height: 30px; transform: translateY(-50%); border: 0; border-radius: 999px; cursor: pointer; background: var(--slate-100); color: var(--slate-700); font-size: 20px; line-height: 1; font-weight: 900; }
.search-clear:hover { background: var(--slate-200); color: var(--slate-950); }
.market-search-meta { margin-top: 7px; color: var(--slate-500); font-size: 12px; font-weight: 750; }
.market-suggestions { position: absolute; z-index: 25; left: 0; right: 0; top: calc(100% + 10px); max-height: 360px; overflow: auto; border: 1px solid var(--slate-200); border-radius: var(--pane-radius); background: rgba(255,255,255,.98); box-shadow: 0 20px 52px rgba(15,23,42,.22); padding: 8px; }
.market-suggestion { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 0; border-radius: var(--pane-radius); padding: 12px; cursor: pointer; background: transparent; color: var(--slate-950); text-align: left; }
.market-suggestion:hover, .market-suggestion.active { background: #f0f9ff; }
.market-suggestion.no-results { display: block; cursor: default; color: var(--slate-500); font-weight: 800; }
.suggestion-main { min-width: 0; display: grid; gap: 3px; }
.suggestion-main strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.suggestion-main em { color: var(--slate-500); font-size: 12px; font-style: normal; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggestion-value { flex: 0 0 auto; border-radius: 999px; padding: 6px 10px; background: var(--slate-100); color: var(--slate-900); font-size: 12px; font-weight: 950; }
.map-card-header,
.map-card-header :is(button, input, strong, em, span, div) {
  font-weight: 400;
}
.map-card-header input::placeholder {
  font-weight: 400;
}
.map-card-header .market-suggestion.no-results {
  font-weight: 400;
}
.tooltip { position: absolute; z-index: 10; pointer-events: none; background: rgba(255,255,255,.97); border: 1px solid var(--slate-200); color: var(--slate-950); border-radius: var(--pane-radius); box-shadow: 0 14px 32px rgba(15,23,42,.18); padding: 10px 12px; font-size: 13px; }
.tooltip strong { display: block; margin-bottom: 3px; }
.maplibregl-ctrl-attrib { font-size: 10px; }
@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { height: auto; max-height: none; }
  .map-stage { height: 75vh; min-height: 620px; }
  .top-left { left: 14px; right: 14px; width: auto; }
  .map-card-header { flex-wrap: wrap; }
  .market-search-panel { flex: 0 0 300px; width: 300px; }
  .map-geography-panel { flex: 1 1 260px; }
}

/* Selected-market map pane: additive GUI functionality. */
.market-detail-pane {
  --detail-chart-panel-height: 430px;
  position: absolute;
  z-index: 6;
  top: 50%;
  left: 50%;
  width: 95%;
  height: 95%;
  min-width: 560px;
  min-height: 520px;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  border: 1px solid rgba(255,255,255,.78);
  border-radius: var(--pane-radius);
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(18px);
  box-shadow: 0 28px 90px rgba(15, 23, 42, .32);
  padding: 18px;
}
.market-detail-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.market-detail-header h2 {
  margin-top: 4px;
  font-size: 28px;
  letter-spacing: -.04em;
}
.market-detail-header p {
  margin-top: 6px;
  color: var(--slate-500);
  font-size: 13px;
  font-weight: 750;
}
.detail-close {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border: 1px solid var(--slate-200);
  border-radius: var(--pane-radius);
  cursor: pointer;
  background: white;
  color: var(--slate-950);
  font-size: 26px;
  line-height: 1;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(15,23,42,.08);
}
.detail-close:hover { background: var(--slate-100); }
.detail-stat-grid {
  display: grid;
  grid-template-columns: repeat(6, 140px);
  gap: 10px;
}
.detail-stat {
  border: 1px solid var(--slate-200);
  border-radius: var(--pane-radius);
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  padding: 13px;
  text-align: center;
  box-shadow: 0 8px 22px rgba(15,23,42,.06);
}
.detail-stat span {
  display: block;
  color: var(--slate-500);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 900;
}
.detail-stat strong {
  display: block;
  margin-top: 7px;
  font-size: 23px;
  letter-spacing: -.045em;
}
.detail-stat em {
  display: block;
  margin-top: 3px;
  color: var(--slate-500);
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
}
.market-detail-body {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: max-content;
}
.chart-panel {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  height: var(--detail-chart-panel-height);
  border: 1px solid var(--slate-200);
  border-radius: var(--pane-radius);
  background: white;
  padding: 14px;
  box-shadow: 0 10px 24px rgba(15,23,42,.07);
}
.chart-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 10px;
}
.chart-toolbar h3 {
  margin: -4px 0 0;
  font-size: 22px;
  letter-spacing: -.035em;
}
.chart-metric-label {
  min-width: 230px;
  color: var(--slate-500);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 900;
}
.chart-metric-label select {
  margin-top: 5px;
  letter-spacing: 0;
  text-transform: none;
  font-size: 14px;
  font-weight: 700;
}
.chart-shell {
  flex: 1 1 auto;
  position: relative;
  min-height: 320px;
  border-radius: var(--pane-radius);
  background: transparent;
  overflow: auto;
}
.chart-frame {
  position: relative;
  width: 760px;
  height: 320px;
  min-width: 760px;
  border-radius: var(--pane-radius);
  background: white;
  overflow: hidden;
}
#historyChart {
  display: block;
  width: 760px;
  height: 320px;
  background: white;
  cursor: crosshair;
  outline: none;
  touch-action: auto;
}
#historyChart:focus-visible {
  outline: 2px solid var(--slate-900);
  outline-offset: -3px;
}
.history-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: var(--slate-500);
  font-weight: 850;
}
.forcast-pane {
  flex: 0 0 var(--detail-chart-panel-height);
  width: var(--detail-chart-panel-height);
  height: var(--detail-chart-panel-height);
  overflow: auto;
  border: 1px solid var(--slate-200);
  border-radius: var(--pane-radius);
  background: white;
  padding: 14px;
  box-shadow: 0 10px 24px rgba(15,23,42,.07);
}
.chart-bg { fill: white; }
.chart-grid-line { stroke: #e2e8f0; stroke-width: 1; }
.chart-axis-line { stroke: #cbd5e1; stroke-width: 1.2; }
.chart-axis-label { fill: #64748b; font-size: 12px; font-weight: 800; }
.chart-year-label { font-weight: 400; }
.chart-area { fill: rgba(14, 165, 233, .12); }
.chart-average-line { stroke: #94a3b8; stroke-width: 2; stroke-dasharray: 4 5; pointer-events: none; }
.chart-line { fill: none; stroke: #0f172a; stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; }
.chart-dot { fill: #0ea5e9; stroke: white; stroke-width: 1.5; }
.chart-hover-line { stroke: #0ea5e9; stroke-width: 1.4; stroke-dasharray: 5 5; pointer-events: none; }
.chart-hover-dot { fill: white; stroke: #0ea5e9; stroke-width: 3; filter: drop-shadow(0 4px 8px rgba(14, 165, 233, .28)); pointer-events: none; }
.chart-last-axis-tick { stroke: #64748b; stroke-width: 1.2; }
.chart-last-label rect { fill: rgba(14, 165, 233, .12); stroke: #cbd5e1; stroke-width: 1; }
.chart-last-label text { fill: #64748b; font-size: 12px; font-weight: 900; }
.chart-tooltip {
  position: absolute;
  z-index: 3;
  max-width: 230px;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 12px));
  border: 1px solid #0f172a;
  border-radius: var(--pane-radius);
  background: white;
  color: #64748b;
  box-shadow: 0 14px 32px rgba(15,23,42,.16);
  padding: 9px 11px;
  font-size: 12px;
  line-height: 1.35;
}
.chart-tooltip.below { transform: translate(-50%, 12px); }
.chart-tooltip strong {
  display: block;
  margin-bottom: 2px;
  font-size: 12px;
  font-weight: 400;
  color: #64748b;
}
.chart-tooltip span {
  display: block;
  color: #64748b;
  font-weight: 400;
}
@media (max-width: 1050px) {
  .market-detail-pane {
    width: calc(100% - 28px);
    height: calc(100% - 28px);
    min-width: 0;
    min-height: 0;
    border-radius: var(--pane-radius);
  }
  .detail-stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .market-detail-body {
    min-width: 0;
    flex-direction: column;
  }
  .chart-panel {
    width: 100%;
    max-width: 100%;
    height: auto;
  }
  .forcast-pane {
    flex-basis: auto;
    width: 100%;
    height: auto;
    min-height: 260px;
  }
  .chart-toolbar { flex-direction: column; }
  .chart-metric-label { width: 100%; min-width: 0; }
}
@media (max-width: 640px) {
  .top-left { top: 12px; left: 10px; right: 10px; padding: 12px; border-radius: var(--pane-radius); }
  .map-card-header { display: grid; gap: 12px; }
  .market-search-panel { width: 100%; flex-basis: auto; }
  .map-geography-panel .level-grid { display: flex; gap: 10px 14px; }
  .map-geography-panel .level { min-width: 0; width: auto; flex-basis: auto; }
  .map-card h2 { font-size: 22px; }
  .map-card p { font-size: 12px; }
  .market-suggestions { max-height: 260px; }
  .suggestion-value { display: none; }
  .detail-stat-grid { grid-template-columns: 1fr; }
  .market-detail-header h2 { font-size: 23px; }
  .detail-stat strong { font-size: 20px; }
}



.gauge-container {
  --gauge-size: 300px; 
  position: relative;
  width: var(--gauge-size);
  margin: 0 auto;
  text-align: center;
  font-family: sans-serif;
}

.gauge {
  width: 100%;
  height: auto;
  overflow: visible; 
}

#gauge-needle-mom, #gauge-needle-yoy {
  transform-origin: 100px 100px;
}

.gauge-label {
  position: absolute;
  left: 50%;

  bottom: 0; 
  transform: translateX(-50%); 
  
  font-size: calc(var(--gauge-size) * 0.1); 
  font-weight: bold;
  margin: 0;
  
  line-height: 1; 
  
  pointer-events: none; 
}