/* === Sentrack Dashboard === */
:root {
  --terracotta: #C4754B;
  --terracotta-light: #D4956B;
  --terracotta-dark: #A45A30;
  --cream: #FAF5F0;
  --cream-dark: #F0E8DE;
  --charcoal: #2D2D2D;
  --charcoal-light: #4A4A4A;
  --white: #FFFFFF;
  --green: #5B9A6F;
  --green-light: #E8F5EC;
  --amber: #D4A03C;
  --amber-light: #FFF5E0;
  --red: #C45B5B;
  --red-light: #FDECEC;
  --border: #E8E0D8;
  --shadow: rgba(45, 45, 45, 0.08);
  --shadow-md: rgba(45, 45, 45, 0.12);
  --font-main: 'Optima', 'Candara', 'Noto Sans', 'source-sans-pro', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-main);
  background: var(--cream);
  color: var(--charcoal);
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: var(--font-main);
  font-weight: 700;
  color: var(--charcoal);
}

/* === HEADER === */
.header {
  background: var(--charcoal);
  color: var(--cream);
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-logo {
  flex-shrink: 0;
}

.back-to-portal {
  font-family: var(--font-main);
  font-size: 0.75rem;
  color: rgba(250, 245, 240, 0.5);
  text-decoration: none;
  padding: 0.3rem 0.65rem;
  border: 1px solid rgba(250, 245, 240, 0.15);
  border-radius: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.back-to-portal:hover {
  color: var(--cream);
  border-color: var(--terracotta-light);
  background: rgba(196, 117, 75, 0.15);
}

.header h1 {
  font-size: 1.35rem;
  color: var(--cream);
  letter-spacing: 0.02em;
}

.header .subtitle {
  font-size: 0.8rem;
  color: var(--terracotta-light);
  font-weight: 400;
  font-family: var(--font-main);
}

.last-updated {
  font-size: 0.75rem;
  color: rgba(250, 245, 240, 0.6);
  font-family: var(--font-main);
}

/* === CUSTOMIZE BUTTON === */
.customize-btn {
  background: rgba(250, 245, 240, 0.1);
  border: 1px solid rgba(250, 245, 240, 0.2);
  color: rgba(250, 245, 240, 0.7);
  padding: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.customize-btn:hover {
  background: rgba(196, 117, 75, 0.2);
  border-color: var(--terracotta-light);
  color: var(--cream);
}

/* === NAV TABS === */
.nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex;
  gap: 0;
}

.nav-tab {
  padding: 0.9rem 1.5rem;
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--charcoal-light);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.nav-tab:hover {
  color: var(--charcoal);
  background: var(--cream);
}

.nav-tab.active {
  color: var(--terracotta);
  border-bottom-color: var(--terracotta);
  font-weight: 600;
}

/* === MAIN CONTENT === */
.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem;
}

.view { display: none; }
.view.active { display: block; }

/* === SECTION HEADERS === */
.section-header {
  margin-bottom: 1.5rem;
}

.section-header h2 {
  font-size: 1.4rem;
  color: var(--charcoal);
  margin-bottom: 0.25rem;
}

.section-subtitle {
  font-size: 0.85rem;
  color: var(--charcoal-light);
}

.section-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), var(--terracotta-light), var(--border), transparent);
  margin: 2.5rem 0;
}

/* === CARDS === */
.card {
  background: var(--white);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 1.5rem;
  box-shadow: 0 2px 8px var(--shadow);
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: 0 4px 16px var(--shadow-md);
}

.card h3 {
  font-size: 1.05rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* === INFO TOOLTIPS === */
.info-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--cream-dark);
  font-size: 0.65rem;
  cursor: help;
  flex-shrink: 0;
  font-style: normal;
  color: var(--charcoal-light);
  transition: background 0.2s ease;
}

.info-tooltip:hover {
  background: var(--terracotta-light);
  color: var(--white);
}

.info-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--charcoal);
  color: var(--cream);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.5;
  width: 300px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  font-family: var(--font-main);
}

.info-tooltip:hover::after {
  opacity: 1;
}

/* Tooltip arrow */
.info-tooltip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--charcoal);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 51;
}

.info-tooltip:hover::before {
  opacity: 1;
}

/* === OVERVIEW GRID === */
.overview-markets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.market-card {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.market-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--shadow-md);
}

.market-card .market-name {
  font-family: var(--font-main);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.market-card .market-flag {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

/* === SENTIMENT GAUGE === */
.gauge-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
}

.gauge {
  flex: 1;
  height: 10px;
  background: var(--cream-dark);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.gauge-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.6s ease;
}

.gauge-fill.positive { background: var(--green); }
.gauge-fill.mixed { background: var(--amber); }
.gauge-fill.negative { background: var(--red); }

.gauge-score {
  font-size: 1.6rem;
  font-weight: 700;
  font-family: var(--font-main);
  min-width: 3.5rem;
  text-align: right;
}

.gauge-score.positive { color: var(--green); }
.gauge-score.mixed { color: var(--amber); }
.gauge-score.negative { color: var(--red); }

.sentiment-label {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sentiment-label.positive, .sentiment-label.very\ positive { background: var(--green-light); color: var(--green); }
.sentiment-label.mixed, .sentiment-label.mixed-positive, .sentiment-label.mixed-negative, .sentiment-label.positive-mixed, .sentiment-label.cautiously\ optimistic { background: var(--amber-light); color: var(--amber); }
.sentiment-label.negative { background: var(--red-light); color: var(--red); }

/* === CHARTS GRID === */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.chart-container {
  position: relative;
  height: 280px;
}

/* === THEMES === */
.theme-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.theme-tag {
  padding: 0.4rem 0.85rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.theme-tag .count {
  font-weight: 700;
  font-size: 0.7rem;
  opacity: 0.7;
}

.theme-tag.positive { background: var(--green-light); border-color: var(--green); color: #3D7A50; }
.theme-tag.mixed, .theme-tag.neutral, .theme-tag.neutral-positive { background: var(--amber-light); border-color: var(--amber); color: #9A7520; }
.theme-tag.negative { background: var(--red-light); border-color: var(--red); color: #A04040; }

/* === INSIGHTS === */
.insights-list {
  list-style: none;
}

.insights-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--cream-dark);
  font-size: 0.88rem;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.insights-list li:last-child { border-bottom: none; }

.insight-bullet {
  width: 6px;
  height: 6px;
  min-width: 6px;
  border-radius: 50%;
  background: var(--terracotta);
  margin-top: 0.5rem;
}

/* === FORUM TABLE === */
.forum-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.forum-table th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--charcoal-light);
  border-bottom: 2px solid var(--border);
}

.forum-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--cream-dark);
}

.forum-table tr:last-child td { border-bottom: none; }

.forum-source {
  font-weight: 600;
  color: var(--terracotta-dark);
}

/* === COMPETITOR CARDS === */
.competitor-cards {
  display: grid;
  gap: 0.75rem;
}

.competitor-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--cream);
  border-radius: 8px;
}

.competitor-brand {
  font-weight: 700;
  font-size: 0.82rem;
  min-width: 80px;
  color: var(--charcoal);
  cursor: pointer;
  transition: color 0.2s ease;
}

.competitor-brand:hover {
  color: var(--terracotta);
}

.competitor-event {
  font-size: 0.82rem;
  color: var(--charcoal-light);
  flex: 1;
}

/* === BRAND CARDS GRID === */
.brand-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.brand-card-item {
  padding: 1rem;
  background: var(--cream);
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.brand-card-item:hover {
  border-color: var(--terracotta);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-md);
}

.brand-card-item .brand-card-name {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
  color: var(--charcoal);
}

.brand-card-item .brand-card-score {
  font-size: 1.4rem;
  font-weight: 700;
}

.brand-card-item .brand-card-mentions {
  font-size: 0.72rem;
  color: var(--charcoal-light);
  margin-top: 0.25rem;
}

/* === ABI CARD === */
.abi-card {
  border-left: 4px solid var(--terracotta);
}

.abi-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--terracotta);
  color: var(--white);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.abi-stats {
  display: flex;
  gap: 2rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.abi-stat {
  text-align: center;
}

.abi-stat-value {
  font-size: 1.6rem;
  font-weight: 700;
}

.abi-stat-label {
  font-size: 0.72rem;
  color: var(--charcoal-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.abi-stat-change {
  font-size: 0.72rem;
  font-weight: 600;
}

.abi-stat-change.up { color: var(--green); }
.abi-stat-change.down { color: var(--red); }

/* === DRILLDOWN === */
.drilldown-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.drilldown-header h2 {
  font-size: 1.6rem;
}

.drilldown-header .flag {
  font-size: 2rem;
}

.drilldown-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.drilldown-full {
  margin-bottom: 1.5rem;
}

/* === BACK BUTTON === */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-main);
  font-size: 0.8rem;
  color: var(--charcoal-light);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 1.5rem;
}

.back-btn:hover {
  background: var(--white);
  border-color: var(--terracotta);
  color: var(--terracotta);
}

/* === LAYOUT EDITOR PANEL === */
.editor-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(45, 45, 45, 0.4);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.editor-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.editor-panel {
  position: fixed;
  top: 0;
  right: -380px;
  width: 360px;
  height: 100vh;
  background: var(--white);
  z-index: 201;
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}

.editor-panel.open {
  right: 0;
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.editor-header h3 {
  font-size: 1.1rem;
  border: none;
  padding: 0;
  margin: 0;
}

.editor-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--charcoal-light);
  padding: 0.25rem;
  line-height: 1;
}

.editor-close:hover {
  color: var(--charcoal);
}

.editor-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.editor-desc {
  font-size: 0.82rem;
  color: var(--charcoal-light);
  margin-bottom: 1.5rem;
}

.editor-widgets {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.editor-widget-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--cream);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.editor-widget-label {
  font-size: 0.85rem;
  font-weight: 500;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--cream-dark);
  border-radius: 24px;
  transition: 0.3s;
  border: 1px solid var(--border);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background: var(--white);
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--terracotta);
  border-color: var(--terracotta-dark);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.editor-reset {
  margin-top: 1.5rem;
  width: 100%;
  padding: 0.75rem;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-main);
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--charcoal-light);
  transition: all 0.2s ease;
}

.editor-reset:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-light);
}

/* === WIDGET ANIMATIONS === */
.widget {
  transition: opacity 0.3s ease, max-height 0.4s ease, margin 0.3s ease;
  overflow: hidden;
}

.widget.hidden {
  opacity: 0;
  max-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  pointer-events: none;
}

/* === DEEP DIVE MODAL === */
.deepdive-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(45, 45, 45, 0.5);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.deepdive-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.deepdive-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  background: var(--white);
  border-radius: 16px;
  z-index: 301;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.deepdive-modal.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.deepdive-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
}

.deepdive-header h2 {
  font-size: 1.4rem;
}

.deepdive-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--charcoal-light);
  padding: 0.25rem;
  line-height: 1;
}

.deepdive-close:hover {
  color: var(--charcoal);
}

.deepdive-body {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}

.deepdive-score-section {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.deepdive-score-main {
  text-align: center;
}

.deepdive-big-score {
  font-size: 3rem;
  font-weight: 700;
}

.deepdive-sparkline {
  height: 50px;
  flex: 1;
  min-width: 160px;
}

.deepdive-breakdown {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.deepdive-breakdown-item {
  flex: 1;
  min-width: 100px;
  text-align: center;
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.deepdive-breakdown-item .dd-count {
  font-size: 1.6rem;
  font-weight: 700;
}

.deepdive-breakdown-item .dd-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--charcoal-light);
}

.deepdive-breakdown-item.positive { background: var(--green-light); }
.deepdive-breakdown-item.positive .dd-count { color: var(--green); }
.deepdive-breakdown-item.neutral { background: var(--amber-light); }
.deepdive-breakdown-item.neutral .dd-count { color: var(--amber); }
.deepdive-breakdown-item.negative { background: var(--red-light); }
.deepdive-breakdown-item.negative .dd-count { color: var(--red); }

.deepdive-market-avg {
  font-size: 0.82rem;
  color: var(--charcoal-light);
  margin-bottom: 2rem;
  padding: 0.75rem 1rem;
  background: var(--cream);
  border-radius: 8px;
  border-left: 3px solid var(--terracotta);
}

.deepdive-mentions-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.deepdive-mention {
  padding: 1rem;
  background: var(--cream);
  border-radius: 10px;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
}

.deepdive-mention-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.deepdive-mention-source {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--terracotta-dark);
}

.deepdive-mention-date {
  font-size: 0.72rem;
  color: var(--charcoal-light);
}

.deepdive-mention-snippet {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--charcoal);
  font-style: italic;
  margin-bottom: 0.5rem;
}

.deepdive-mention-snippet::before { content: '"'; }
.deepdive-mention-snippet::after { content: '"'; }

.deepdive-mention-link {
  font-size: 0.75rem;
  color: var(--terracotta);
  text-decoration: none;
}

.deepdive-mention-link:hover {
  text-decoration: underline;
}

.deepdive-mention-sentiment {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
}

/* === CLICKABLE BRAND NAMES === */
.brand-clickable {
  cursor: pointer;
  transition: color 0.2s ease;
}

.brand-clickable:hover {
  color: var(--terracotta);
  text-decoration: underline;
}

/* === DATE FILTER BAR === */
.date-filter-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.date-filter-presets {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.date-preset-btn {
  padding: 0.4rem 0.85rem;
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--charcoal-light);
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.date-preset-btn:hover {
  border-color: var(--terracotta-light);
  color: var(--terracotta);
  background: var(--cream-dark);
}

.date-preset-btn.active {
  background: var(--terracotta);
  color: var(--white);
  border-color: var(--terracotta-dark);
  font-weight: 600;
}

.date-custom-range {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.5rem 0;
}

.date-custom-range label,
.compare-custom-range label {
  font-size: 0.78rem;
  color: var(--charcoal-light);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.date-custom-range input[type="date"],
.compare-custom-range input[type="date"] {
  font-family: var(--font-main);
  font-size: 0.78rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--cream);
  color: var(--charcoal);
  outline: none;
  transition: border-color 0.2s ease;
}

.date-custom-range input[type="date"]:focus,
.compare-custom-range input[type="date"]:focus {
  border-color: var(--terracotta);
}

.date-apply-btn {
  padding: 0.35rem 0.75rem;
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--terracotta);
  color: var(--white);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.date-apply-btn:hover {
  background: var(--terracotta-dark);
}

.date-filter-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* === COMPARE TOGGLE === */
.compare-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--charcoal-light);
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.compare-toggle:hover {
  border-color: var(--terracotta-light);
  color: var(--terracotta);
}

.compare-toggle.active {
  background: var(--charcoal);
  color: var(--cream);
  border-color: var(--charcoal);
}

.compare-toggle.active:hover {
  background: var(--charcoal-light);
}

/* === COMPARISON CUSTOM RANGE === */
.compare-custom-range {
  background: var(--cream-dark);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.compare-custom-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--charcoal-light);
}

/* === COMPARISON SUMMARY CARD === */
.comparison-summary {
  max-width: 1280px;
  margin: 1rem auto 0;
  padding: 0 2rem;
}

.comparison-summary-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--charcoal);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 2px 8px var(--shadow);
}

.comparison-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.comparison-summary-header h3 {
  font-size: 1rem;
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.comparison-period-label {
  font-size: 0.75rem;
  color: var(--charcoal-light);
}

.comparison-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.comparison-summary-item {
  text-align: center;
  padding: 0.75rem;
  background: var(--cream);
  border-radius: 8px;
}

.comparison-summary-item .cs-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--charcoal-light);
  margin-bottom: 0.35rem;
}

.comparison-summary-item .cs-value {
  font-size: 1.4rem;
  font-weight: 700;
}

.comparison-summary-item .cs-delta {
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 0.15rem;
}

.comparison-movers {
  margin-top: 1rem;
}

.comparison-movers-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--charcoal-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.comparison-movers-list {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mover-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--border);
}

.mover-chip.up { background: var(--green-light); border-color: var(--green); color: #3D7A50; }
.mover-chip.down { background: var(--red-light); border-color: var(--red); color: #A04040; }
.mover-chip.new { background: #EDE8FF; border-color: #8B7ACC; color: #5B4A9E; }
.mover-chip.gone { background: var(--cream-dark); border-color: var(--border); color: var(--charcoal-light); }

/* === DELTA INDICATORS === */
.delta {
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
}

.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.delta.flat { color: var(--charcoal-light); }

/* === CHART LEGEND (comparison) === */
.chart-legend-comparison {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.72rem;
  color: var(--charcoal-light);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--cream-dark);
}

.chart-legend-comparison .legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.legend-swatch {
  width: 20px;
  height: 3px;
  border-radius: 2px;
}

.legend-swatch.solid { background: var(--terracotta); }
.legend-swatch.dashed {
  background: repeating-linear-gradient(90deg, var(--charcoal-light) 0, var(--charcoal-light) 4px, transparent 4px, transparent 7px);
  height: 2px;
}

/* === GAUGE COMPARISON MARKER === */
.gauge-container-wrap {
  position: relative;
}

.gauge-comparison-marker {
  position: absolute;
  top: 0;
  height: 100%;
  width: 3px;
  background: var(--charcoal-light);
  border-radius: 2px;
  opacity: 0.5;
  z-index: 2;
  transition: left 0.4s ease;
}

.gauge-comparison-marker::after {
  content: attr(data-label);
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  color: var(--charcoal-light);
  white-space: nowrap;
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .overview-markets {
    grid-template-columns: 1fr;
  }
  .charts-grid, .drilldown-grid {
    grid-template-columns: 1fr;
  }
  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
  }
  .header-right {
    align-self: flex-end;
  }
  .main {
    padding: 1.25rem;
  }
  .nav {
    padding: 0 1rem;
    overflow-x: auto;
  }
  .nav-tab {
    padding: 0.75rem 1rem;
    font-size: 0.78rem;
    white-space: nowrap;
  }
  .date-filter-bar {
    padding: 0.5rem 1rem;
  }
  .date-preset-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.72rem;
  }
  .compare-custom-range {
    padding: 0.5rem 1rem;
  }
  .comparison-summary {
    padding: 0 1.25rem;
  }
  .brand-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  .editor-panel {
    width: 300px;
  }
  .deepdive-modal {
    width: 95%;
    max-height: 90vh;
  }
  .deepdive-body {
    padding: 1.25rem;
  }
}

@media (max-width: 600px) {
  .header h1 { font-size: 1.1rem; }
  .card { padding: 1.1rem; }
  .gauge-score { font-size: 1.3rem; }
  .abi-stats { gap: 1rem; }
  .deepdive-score-section { gap: 1rem; }
  .deepdive-breakdown { gap: 0.5rem; }
}
