/* Universal box-sizing for all chart components */
.benchmark-charts,
.benchmark-charts *,
.benchmark-charts-layout,
.benchmark-charts-layout *,
.benchmark-survey-layout,
.benchmark-survey-layout * {
  box-sizing: border-box;
}

/* Benchmark Charts Styles */

.benchmark-charts {
  width: 100%;
  margin: 0 auto;
  padding: 40px 20px;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background: #f7f5f2;
  box-sizing: border-box;
}

.benchmark-charts .layout-revenue-selector {
  margin-bottom: 32px;
}

/* Revenue Controls */
.revenue-controls {
  margin-bottom: 30px;
  padding: 20px;
  background: #f5f5f5;
  border-radius: 8px;
}

.control-group {
  margin-bottom: 20px;
}

.control-group:last-child {
  margin-bottom: 0;
}

.control-group label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: #333;
}

.button-group {
  display: flex;
  gap: 10px;
}

.button-group button {
  padding: 10px 20px;
  border: 2px solid #ddd;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.button-group button:hover {
  border-color: #0D71A9;
  color: #0D71A9;
}

.button-group button.active {
  background: #0D71A9;
  border-color: #0D71A9;
  color: white;
}

.revenue-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #ddd;
  outline: none;
  -webkit-appearance: none;
}

.revenue-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #0D71A9;
  cursor: pointer;
}

.revenue-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #0D71A9;
  cursor: pointer;
  border: none;
}

/* Charts Grid */
.benchmark-charts .charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
  position: relative; /* Positioning context for expanded charts */
  min-height: 600px; /* Ensure grid has height for absolute positioning */
  box-sizing: border-box;
  width: 100%;
}

.chart-section {
  /* No background, padding, or shadow - the chart-card handles that */
}

@media (max-width: 1100px) {
  .benchmark-charts .charts-grid {
    grid-template-columns: 1fr;
  }
}

/* Individual Chart Styles */
.benchmark-chart {
  position: relative;
  width: 100%;
  height: auto;
  box-sizing: border-box;
  min-width: 0; /* Allow flex/grid children to shrink below content size */
}

.benchmark-chart:not(.expanded) {
  position: relative !important;
  width: 100% !important;
  height: auto !important;
  padding: 0 !important;
  background: transparent !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  z-index: auto !important;
  max-width: none !important;
  overflow: visible !important;
  transform: none !important;
}

.benchmark-chart:not(.expanded) .chart-card {
  background: white !important;
  border-radius: 12px !important;
  padding: 32px !important;
  height: 100% !important;
  min-height: auto !important;
  box-shadow: none !important;
  border: none !important;
  display: block !important;
  flex-direction: initial !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.benchmark-chart:not(.expanded) .chart-card:hover {
  transform: translateY(-1px);
}

.metric-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 15px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.metric-button {
  padding: 10px 18px;
  border: 1px solid #d0d0d0;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
  color: #6b6b6b;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.metric-button:hover {
  border-color: #1a1a1a;
  color: #1a1a1a;
  background: #fafafa;
}

.metric-button.active {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: white;
}

.chart-description {
  margin-bottom: 20px;
  padding: 16px 20px;
  background: white;
  border-left: 3px solid #1a1a1a;
  border-radius: 0;
  font-size: 15px;
  line-height: 1.6;
  color: #6b6b6b;
  font-family: Georgia, 'Times New Roman', serif;
}

.chart-container {
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Responsive Design */
@media (max-width: 1100px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .benchmark-charts {
    padding: 15px;
  }

  .chart-section {
    padding: 15px;
  }

  .metric-selector {
    flex-direction: column;
  }

  .metric-button {
    width: 100%;
  }

  .button-group {
    flex-direction: column;
  }

  .button-group button {
    width: 100%;
  }
}

/* Revenue Range Controls (per chart) */
.revenue-range-controls {
  margin-bottom: 20px;
  padding: 20px 24px;
  background: white;
  color: #1a1a1a;
  border-radius: 0;
  border: 1px solid #e8e8e8;
}

.revenue-mode {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 15px;
}

.control-label {
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0;
  color: #1a1a1a;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 400;
  color: #6b6b6b;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.radio-label input[type="radio"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: #1a1a1a;
}

.revenue-slider-container {
  margin-top: 15px;
}

.slider-label {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 12px;
  letter-spacing: 0;
  color: #1a1a1a;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 11px;
  opacity: 0.9;
  position: relative;
}

.slider-tick-label {
  flex: 0 0 auto;
  text-align: center;
  white-space: nowrap;
  font-size: 10px;
  position: relative;
}

.slider-tick-label:first-child {
  text-align: left;
}

.slider-tick-label:last-child {
  text-align: right;
}

.revenue-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #e8e8e8;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.revenue-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #1a1a1a;
  cursor: grab;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s ease;
}

.revenue-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.1);
}

.revenue-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #1a1a1a;
  cursor: grab;
  border: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s ease;
}

.revenue-slider::-moz-range-thumb:active {
  cursor: grabbing;
  transform: scale(1.1);
}

/* Chart Header with Expand Icon */
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

h3.chart-title {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  color: #20211b;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  letter-spacing: 0;
  line-height: 1.2;
  border: none;
}

.expand-button {
  background: #e6e1d6;
  border: none;
  padding: 4px;
    cursor: pointer;
  color: #20211b;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  margin-left: auto;
  gap: 1px;
}

.expand-button:hover {
  background: #cec6b6;
}

.expand-button svg {
  width: 32px;
  height: 32px;
}

/* Chart card wrapper */
.chart-card {
  background: white;
  border-radius: 12px;
  padding: 32px;
  height: 100%;
  box-shadow: none;
  border: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Override ApexCharts legend markers with CSS circles */
.apexcharts-legend-marker {
  width: 12px !important;
  height: 12px !important;
  border-radius: 50% !important;
  margin-right: 8px !important;
}

/* Hide the SVG inside the marker, use background color instead */
.apexcharts-legend-marker svg {
  display: none !important;
}

/* Set background colors for legend markers */
.apexcharts-legend-series:nth-child(1) .apexcharts-legend-marker {
  background-color: #9d917a !important;
}

.apexcharts-legend-series:nth-child(2) .apexcharts-legend-marker {
  background-color: #52B788 !important;
}

.apexcharts-legend-series:nth-child(3) .apexcharts-legend-marker {
  background-color: #5B67CA !important;
}

/* Expanded state - covers the entire grid area (all 4 charts) */
.benchmark-chart.expanded {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: #f7f5f2;
  padding: 0;
  border-radius: 0;
  width: auto !important;
  height: auto !important;
  max-width: none;
  max-height: none;
  box-sizing: border-box;
  overflow: auto;
  animation: fadeInOverlay 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.benchmark-chart.expanded .chart-card {
  background: white;
  border-radius: 12px;
  padding: 40px;
  height: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  border: none;
  box-sizing: border-box;
  animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center;
}

@keyframes fadeInOverlay {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.benchmark-chart:not(.expanded) .chart-header {
  padding-bottom: 0;
  border-bottom: none;
  margin-bottom: 15px;
}

.benchmark-chart:not(.expanded) .chart-container {
  margin-top: 0;
  flex: none;
  min-height: auto;
}

.benchmark-chart.expanded .revenue-range-controls {
  margin-bottom: 30px;
  flex-shrink: 0;
  animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.benchmark-chart.expanded .chart-header {
  padding-bottom: 20px;
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 30px;
  flex-shrink: 0;
  animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.benchmark-chart.expanded .metric-selector {
  margin-bottom: 30px;
  flex-shrink: 0;
  animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1) 0.1s both;
}

.benchmark-chart.expanded .chart-description {
  background: white;
  border-left: 3px solid #1a1a1a;
  margin-bottom: 30px;
  flex-shrink: 0;
  animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1) 0.15s both;
  border-radius: 0;
}

.benchmark-chart.expanded .chart-container {
  margin-top: 0;
  flex: 1;
  min-height: 0;
  animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
}

.benchmark-chart.expanded .expand-button {
  color: #20211b;
}

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

/* Benchmark Charts Layout */
.benchmark-charts-layout {
  width: 100%;
  margin: 0 auto;
  padding: 40px 20px;
  background: #f7f5f2;
  box-sizing: border-box;
}

/* Subtle Divider at top */
.layout-divider {
  width: 100%;
  height: 1px;
  background: #cec6b6;
  margin-bottom: 32px;
}

/* Layout Header */
.layout-header {
  margin-bottom: 40px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: start;
}

.layout-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #20211b;
  white-space: nowrap;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  line-height: 1.3;
}

.layout-description {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
  color: #504b41;
  font-family: 'Serrif-TRIAL', Georgia, 'Times New Roman', serif;
}

/* Revenue Selector */
.layout-revenue-selector {
  margin-bottom: 32px;
  padding: 20px 32px;
  background: white;
  border-radius: 12px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.revenue-selector-label {
  flex: 1 0 0;
  font-size: 12px;
  font-weight: 400;
  color: #20211b;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  line-height: 1.3;
  white-space: pre-wrap;
}

.revenue-options {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-shrink: 0;
}

.revenue-option {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.revenue-option input[type="radio"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #20211b;
}

.revenue-option-label {
  cursor: pointer;
  white-space: pre;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  color: #9d917a;
  transition: color 0.2s;
}

.revenue-option input[type="radio"]:checked + .revenue-option-label {
  color: #20211b;
}

/* Dropdown (hidden on desktop, shown on mobile) */
.revenue-dropdown {
  display: none;
  padding: 10px 16px;
  padding-right: 40px; /* Extra space for dropdown caret, matching left padding visually */
  font-size: 14px;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  font-weight: 500;
  color: #20211b;
  background: white;
  border: 1px solid #cec6b6;
  border-radius: 6px;
  cursor: pointer;
  outline: none;
  width: 100%;
  max-width: 300px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg width=%2712%27 height=%278%27 viewBox=%270 0 12 8%27 fill=%27none%27 xmlns=%27http://www.w3.org/2000/svg%27%3e%3cpath d=%27M1 1.5L6 6.5L11 1.5%27 stroke=%27%2320211b%27 stroke-width=%271.5%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

.revenue-dropdown:focus {
  border-color: #20211b;
}

/* Charts Grid Layout */
.benchmark-charts-layout .charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
  position: relative; /* Positioning context for expanded charts */
  min-height: 600px; /* Ensure grid has height for absolute positioning */
  box-sizing: border-box;
  width: 100%;
}

.benchmark-charts-layout .chart-item {
  /* No background, padding, or shadow - the chart-card handles that */
}

@media (max-width: 768px) {
  /* Hide radio buttons on mobile */
  .revenue-options-desktop {
    display: none !important;
  }

  /* Show dropdown on mobile */
  .revenue-dropdown-mobile {
    display: block;
  }

  .layout-revenue-selector {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .revenue-dropdown {
    width: 100%;
    max-width: none;
  }

  /* Main containers with consistent padding */
  .benchmark-charts-layout,
  .benchmark-charts {
    padding-left: 16px;
    padding-right: 16px;
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  /* Align charts grid with revenue selector box */
  .benchmark-charts .charts-grid,
  .benchmark-charts-layout .charts-grid {
    padding-left: 0;
    padding-right: 0;
    gap: 16px;
    margin-left: 0;
    margin-right: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Remove chart section padding for proper alignment */
  .chart-section {
    padding: 0 !important;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Reduce chart card padding to fit iPhone viewport */
  .benchmark-chart:not(.expanded) .chart-card {
    padding: 16px !important;
    box-sizing: border-box;
  }

  .benchmark-chart.expanded .chart-card {
    padding: 20px !important;
    box-sizing: border-box;
  }

  /* Ensure proper width reset on collapse */
  .benchmark-chart:not(.expanded) {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Revenue selector adjustments for mobile */
  .layout-revenue-selector {
    padding: 16px 20px;
    box-sizing: border-box;
  }

  .revenue-selector-label {
    font-size: 11px;
  }

  .revenue-dropdown {
    font-size: 13px;
    padding: 8px 12px;
    padding-right: 36px;
    background-position: right 12px center;
  }
}

@media (max-width: 1100px) {
  .benchmark-charts-layout .charts-grid {
    grid-template-columns: 1fr;
  }

  .layout-header {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .layout-title {
    white-space: normal;
  }
}

@media (max-width: 1100px) {
  .benchmark-charts-layout .charts-grid {
    grid-template-columns: 1fr;
  }

  .slider-labels {
    font-size: 10px;
  }

  .slider-label-mark {
    font-size: 9px;
  }
}

@media (max-width: 768px) {
  .layout-revenue-control {
    padding: 20px;
  }

  .revenue-mode-section {
    flex-direction: column;
    gap: 15px;
  }

  .slider-labels {
    flex-wrap: wrap;
    gap: 5px;
  }
}

/* ========================================
   Benchmark Survey Layout Styles
   ======================================== */

/* Main Survey Layout */
.benchmark-survey-layout {
  width: 100%;
  margin: 0 auto;
  padding: 40px 20px;
  background: #f7f5f2;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  box-sizing: border-box;
}

/* Main Container */
.survey-container {
  background: transparent;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header Bar */
.survey-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0;
  background: transparent;
  gap: 24px;
  min-height: 44px; /* Reserve space to prevent layout shift */
}


/* Desktop Filters Row - contains pills + button */
.filters-row-desktop {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 1;
  max-width: 90%;
  margin-left: auto;
  min-height: 36px;
}

/* Filter pills in header (desktop) */
.filter-pills-header {
  display: contents; /* Pills flow directly into parent flex container */
}

/* Mobile Filters Row - hidden on desktop */
.filters-row-mobile {
  display: none;
}

/* Mobile Filter Pills - hidden on desktop */
.filter-pills-mobile {
  display: none;
}

.survey-section-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: #20211b;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  line-height: 1.3;
  flex-shrink: 0;
}

/* Survey Content - Two Column Layout */
.survey-content {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 32px;
  position: relative;
  height: 100%;
  box-sizing: border-box;
  min-width: 0; /* Allow grid to shrink */
  align-items: start; /* Prevent vertical shifting */
}

/* Mobile Filter Toggle - Hidden */
.mobile-filter-toggle {
  display: none !important;
}

/* Mobile Sidebar Overlay */
.mobile-sidebar-overlay {
  display: none;
}

.mobile-sidebar-close {
  display: none;
}

/* Benchmark Sidebar */
.survey-sidebar {
  position: sticky;
  top: 20px;
  height: fit-content;
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  align-self: start;
  will-change: transform; /* Optimize sticky positioning */
  contain: layout; /* Isolate layout to prevent shift */
}

.benchmark-sidebar {
  background: transparent;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  display: none;
}

.sidebar-title {
  display: none;
}

.filters-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: #e6e1d6;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #20211b;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  position: relative;
  height: 36px;
  box-sizing: border-box;
}

/* Hide mobile filters button on desktop */
.filters-button-mobile {
  display: none;
}

.filters-button:hover {
  background: #cec6b6;
}

.filters-button svg {
  width: 12px;
  height: 8px;
  transition: transform 0.2s;
}

.filters-button svg.rotated {
  transform: rotate(180deg);
}

.filters-button.active {
  background: #20211b;
  color: white;
}

/* Filters Overlay - Constrained to graph area */
.filters-overlay-backdrop-constrained {
  position: absolute;
  inset: 0; /* Fill the inner wrapper edge-to-edge */
  background: rgba(0, 0, 0, 0.3);
  z-index: 100;
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(2px);
  border-radius: 8px;
}

.filters-overlay-panel-constrained {
  position: absolute;
  inset: 0; /* Fill the inner wrapper edge-to-edge */
  z-index: 101;
  overflow: hidden; /* No scroll on panel - scroll is on grid */
  animation: slideInConstrained 0.3s ease;
  border-radius: 8px;
}

@keyframes slideInConstrained {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Old full-screen overlay (keep for backwards compatibility) */
.filters-overlay-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 1000;
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(2px);
}

.filters-overlay-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1001;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideIn 0.3s ease;
  /* Scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: #cec6b6 #f7f5f2;
}

.filters-overlay-panel::-webkit-scrollbar {
  width: 8px;
}

.filters-overlay-panel::-webkit-scrollbar-track {
  background: #f7f5f2;
  border-radius: 4px;
}

.filters-overlay-panel::-webkit-scrollbar-thumb {
  background: #cec6b6;
  border-radius: 4px;
}

.filters-overlay-panel::-webkit-scrollbar-thumb:hover {
  background: #9d917a;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -48%) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Benchmark Filters Panel */
.benchmark-filters-panel {
  padding: 32px;
  padding-bottom: 0; /* Remove bottom padding - actions will handle it */
  background: white;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* When inside constrained overlay, no border radius or shadow (edge-to-edge) */
.filters-overlay-panel-constrained .benchmark-filters-panel {
  border-radius: 0;
  box-shadow: none;
}

/* Old Benchmark Filters (keep for backwards compatibility) */
.benchmark-filters {
  margin-bottom: 32px;
  padding: 24px;
  background: #fafaf8;
  border-radius: 8px;
  border: 1px solid #e6e1d6;
}

.filters-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.filters-title {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: #20211b;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.clear-filters-button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: none;
  color: #20211b;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.clear-filters-button:hover {
  opacity: 0.7;
}

/* New Filters Panel Grid */
.filters-panel-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px 24px;
  flex: 1;
  align-content: start;
  overflow-y: auto;
  padding-bottom: 100px; /* Space for sticky footer */
  /* Scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: #cec6b6 #f7f5f2;
}

.filters-panel-grid::-webkit-scrollbar {
  width: 8px;
}

.filters-panel-grid::-webkit-scrollbar-track {
  background: #f7f5f2;
  border-radius: 4px;
}

.filters-panel-grid::-webkit-scrollbar-thumb {
  background: #cec6b6;
  border-radius: 4px;
}

.filters-panel-grid::-webkit-scrollbar-thumb:hover {
  background: #9d917a;
}

/* Old Filters Grid */
.filters-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.filter-dropdown {
  position: relative;
}

.filter-dropdown-button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: white;
  border: 1px solid #cec6b6;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.filter-dropdown-button:hover {
  background: #fafaf8;
  border-color: #20211b;
}

.filter-dropdown-button.expanded {
  background: #e6e1d6;
  border-color: #20211b;
}

.filter-dropdown-button.has-selections {
  background: #e6e1d6;
  border-color: #9d917a;
}

.filter-label-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.filter-label {
  font-size: 13px;
  font-weight: 500;
  color: #20211b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-selected-count {
  font-size: 11px;
  color: #9d917a;
  font-weight: 400;
}

.filter-chevron {
  flex-shrink: 0;
  transition: transform 0.2s;
}

.filter-dropdown-button.expanded .filter-chevron {
  transform: rotate(180deg);
}

.filter-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #cec6b6;
  border-radius: 6px;
  padding: 8px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  cursor: pointer;
  transition: background 0.2s;
  border-radius: 4px;
  font-size: 13px;
  color: #20211b;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.filter-option:hover {
  background: #fafaf8;
}

.filter-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.filter-option span {
  flex: 1;
}

/* New Filter Column Styles */
.filter-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filter-column-header {
  padding: 4px 12px;
  background: #e6e1d6;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: #20211b;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  text-transform: none;
  width: fit-content;
}

.filter-column-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filter-checkbox-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #504b41;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.filter-checkbox-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #20211b;
  flex-shrink: 0;
}

.filter-checkbox-option:hover {
  color: #20211b;
}

/* Disabled filter option styling */
.filter-checkbox-option input:disabled + span {
  opacity: 0.4;
  cursor: not-allowed;
}

.filter-checkbox-option input:disabled {
  cursor: not-allowed;
}

/* Filter Panel Actions - Sticky Footer */
.filters-panel-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 24px 32px 32px 32px; /* Padding aligns with parent container edge */
  border-top: 1px solid #e6e1d6;
  background: white;
  z-index: 10;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

.filter-clear-button,
.filter-apply-button {
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  border: none;
}

.filter-clear-button {
  background: transparent;
  color: #504b41;
}

.filter-clear-button:hover {
  background: #f7f5f2;
  color: #20211b;
}

.filter-apply-button {
  background: #20211b;
  color: white;
}

.filter-apply-button:hover {
  background: #504b41;
}

/* Responsive adjustments for download menu */
@media (max-width: 768px) {
  .download-menu {
    right: 0;
    left: auto;
  }
}

.sidebar-divider {
  width: 100%;
  height: 1px;
  background: #cec6b6;
  margin-bottom: 12px;
}

.category-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: -12px;
}

.category-section {
  border-bottom: 1px solid #cec6b6;
  padding-bottom: 0;
  margin-bottom: 0;
}

.category-section:last-child {
  border-bottom: none;
}

.category-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  background: none;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
  text-align: left;
  margin-bottom: 0;
}

.category-header:hover {
  opacity: 0.7;
}

.category-title {
  font-size: 18px;
  font-weight: 700;
  color: #20211b;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  line-height: 1.3;
}

.category-icon {
  color: #20211b;
  transition: transform 0.2s;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.category-icon.expanded {
  transform: rotate(180deg);
}

.metric-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-left: 0;
  padding-top: 12px;
  padding-bottom: 20px;
  margin-bottom: 0;
}

.metric-item {
  padding: 0;
  background: none;
  border: none;
  text-align: left;
  font-size: 16px;
  font-weight: 700;
  color: #9d917a;
  cursor: pointer;
  transition: color 0.2s;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  line-height: 1.3;
}

.metric-item:hover {
  color: #20211b;
}

.metric-item.selected {
  color: #20211b;
  font-weight: 700;
}

/* Keep old filter sidebar for backwards compatibility */
.filter-sidebar {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: none;
}

.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e6e1d6;
}

.filter-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #20211b;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.clear-filters-btn {
  background: none;
  border: none;
  color: #9d917a;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.clear-filters-btn:hover {
  color: #20211b;
  background: #f7f5f2;
}

/* Filter Sections */
.filter-sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.filter-section {
  border-bottom: 1px solid #f0ebe3;
  padding-bottom: 16px;
}

.filter-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.filter-section-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  background: none;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

.filter-section-header:hover {
  opacity: 0.7;
}

.filter-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #20211b;
  text-align: left;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.filter-section-icon {
  color: #9d917a;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.filter-section-icon.expanded {
  transform: rotate(180deg);
}

.filter-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
  padding-left: 4px;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.filter-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #20211b;
  margin: 0;
  flex-shrink: 0;
}

.filter-option-label {
  font-size: 13px;
  font-weight: 400;
  color: #504b41;
  cursor: pointer;
  user-select: none;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.filter-option:hover .filter-option-label {
  color: #20211b;
}

/* Survey Main Area (with tabs - old version) */
.survey-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

/* Survey Main Area Full (without tabs - Figma version) */
.survey-main-full {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

/* Tab Navigation */
.tab-navigation {
  background: white;
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tab-scroll-container {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.tab-scroll-container::-webkit-scrollbar {
  display: none;
}

.tab-button {
  flex-shrink: 0;
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #9d917a;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.tab-button:hover {
  color: #20211b;
  background: #f7f5f2;
}

.tab-button.active {
  background: #20211b;
  color: white;
}

/* Survey Data Area */
.survey-data-area {
  background: white;
  border-radius: 12px;
  padding: 48px;
  min-height: 500px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Survey Main Full */
.survey-main-full {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 0;
  min-width: 0; /* Allow flex child to shrink */
  flex: 1;
  box-sizing: border-box;
}

/* Survey Data Area Full (without tabs) */
.survey-data-area-full {
  background: white;
  border-radius: 12px;
  padding: 48px;
  min-height: 500px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  flex: 1;
  box-sizing: border-box;
  min-width: 0; /* Allow flex child to shrink */
  overflow: hidden; /* Prevent content overflow */
}

/* Inner wrapper for filter positioning */
.survey-data-inner {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* This clips the absolutely positioned filters */
  border-radius: 8px; /* Slight radius for inner area */
  min-height: 600px; /* Ensure enough vertical space for filters */
}

/* Data Content Area */
.survey-data-content {
  position: relative; /* Positioning context for charts */
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Bottom Bar with Download Button */
.survey-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  width: 100%;
  margin-top: 24px;
}

/* Filter Pills Container */
.filter-pills-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
  /* Hide scrollbar but keep functionality */
  scrollbar-width: thin;
  scrollbar-color: #cec6b6 transparent;
}


.filter-pills-container::-webkit-scrollbar {
  height: 6px;
}

.filter-pills-container::-webkit-scrollbar-track {
  background: transparent;
}

.filter-pills-container::-webkit-scrollbar-thumb {
  background: #cec6b6;
  border-radius: 3px;
}

.filter-pills-container::-webkit-scrollbar-thumb:hover {
  background: #9d917a;
}

/* Individual Filter Pill */
.filter-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px 0 14px;
  background: #e6e1d6;
  border: 1px solid #cec6b6;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.filter-pill:hover {
  background: #d6d1c6;
  border-color: #9d917a;
}

.filter-pill-text {
  font-size: 13px;
  font-weight: 500;
  color: #20211b;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.filter-pill-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #504b41;
  transition: all 0.2s ease;
}

.filter-pill-remove:hover {
  background: #9d917a;
  color: white;
}

.filter-pill-remove svg {
  display: block;
}

/* Download Section Bottom */
.survey-download-section-bottom {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  position: relative;
  flex-shrink: 0;
}

/* Download Dropdown Inline (in chart header) */
.download-dropdown-container-inline {
  position: relative;
  display: flex;
  align-items: center;
}

/* Metric Selector Buttons */
.metric-selector-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e6e1d6;
}

.metric-select-button {
  padding: 10px 18px;
  background: white;
  border: 1px solid #cec6b6;
  border-radius: 6px;
  color: #504b41;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  white-space: nowrap;
}

.metric-select-button:hover {
  border-color: #20211b;
  background: #fafaf8;
  color: #20211b;
}

.metric-select-button.active {
  background: #20211b;
  border-color: #20211b;
  color: white;
}

/* Placeholder State */
.survey-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 400px;
  text-align: center;
}

.placeholder-icon {
  width: 80px;
  height: 80px;
  background: #f7f5f2;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  color: #9d917a;
}

.placeholder-title {
  margin: 0 0 12px 0;
  font-size: 20px;
  font-weight: 600;
  color: #20211b;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.placeholder-text {
  margin: 0;
  font-size: 15px;
  color: #9d917a;
  max-width: 400px;
  line-height: 1.5;
  font-family: 'Serrif-TRIAL', Georgia, 'Times New Roman', serif;
}

/* Responsive Styles */
@media (max-width: 1200px) {
  .survey-content {
    grid-template-columns: 280px 1fr;
    gap: 24px;
  }

  .survey-data-area-full {
    padding: 32px;
  }

  .category-title {
    font-size: 16px;
  }

  .metric-item {
    font-size: 15px;
  }

  .metric-list {
    padding-top: 10px;
  }
}

@media (max-width: 768px) {
  .benchmark-survey-layout {
    padding: 0px !important;
  }

  .survey-header-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .survey-container {
    gap: 20px;
  }

  .survey-section-title {
    font-size: 20px;
  }

  /* Hide desktop filters row on mobile */
  .filters-row-desktop {
    display: none !important;
  }

  .filters-button-desktop {
    display: none !important;
  }

  /* Show mobile filters row below sidebar */
  .filters-row-mobile {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-bottom: 20px;
  }

  .filters-button-mobile {
    display: flex;
    width: 100%;
    justify-content: center;
  }

  /* Mobile filter pills - horizontal wrap */
  .filter-pills-mobile {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  /* Keep mobile filter toggle hidden */
  .mobile-filter-toggle {
    display: none !important;
  }

  /* Single column layout on mobile */
  .survey-content {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  /* Mobile sidebar typography */
  .category-title {
    font-size: 16px;
  }

  .metric-item {
    font-size: 14px;
  }

  .metric-list {
    padding-top: 8px;
    padding-bottom: 16px;
  }

  .category-list {
    margin-top: -8px;
  }

  /* Mobile Sidebar Styling - Keep visible */
  .survey-sidebar {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    max-width: 100%;
    height: auto;
    background: transparent;
    z-index: auto;
    transition: none;
    overflow-y: visible;
    padding: 0;
    box-shadow: none;
    max-height: none;
    order: -1;
  }

  .survey-main-full {
    order: 0;
  }

  .mobile-sidebar-close {
    display: none !important;
  }

  .mobile-sidebar-overlay {
    display: none !important;
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }

  .filter-sidebar {
    padding: 48px 20px 20px;
    box-shadow: none;
    border-radius: 0;
  }

  .tab-navigation {
    margin-top: 0;
  }

  .survey-data-area,
  .survey-data-area-full {
    padding: 24px 16px;
  }

  /* Remove right margin on mobile */
  .filters-panel-actions {
    margin-right: 0;
  }

  /* No need to override overlay positioning on mobile - inset: 0 works everywhere */

  .benchmark-filters-panel {
    min-width: auto;
    width: 100%;
  }

  .metric-title-chart {
    font-size: 28px;
  }

  .metric-description-chart {
    font-size: 14px;
  }

  .download-button {
    padding: 10px 20px;
    font-size: 13px;
  }

  .placeholder-icon {
    width: 64px;
    height: 64px;
  }

  .placeholder-icon svg {
    width: 32px;
    height: 32px;
  }

  .placeholder-title {
    font-size: 18px;
  }

  .placeholder-text {
    font-size: 14px;
  }

  /* Bottom bar on mobile - hide download button */
  .survey-bottom-bar {
    display: none;
  }
}

/* ========================================
   Benchmark Data Display - Bar Chart Styles
   ======================================== */

.benchmark-data-display-chart {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  min-width: 0; /* Allow flex child to shrink */
  min-height: 600px; /* Stable minimum height to prevent shift */
}

.metric-header-chart {
  margin-bottom: 32px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.metric-header-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.metric-title-chart {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  color: #20211b;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  line-height: 1.2;
  letter-spacing: 0;
}

.metric-menu-button {
  background: #e6e1d6;
  border: none;
  border-radius: 6px;
  padding: 8px;
  cursor: pointer;
  color: #20211b;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
}

.metric-menu-button:hover {
  background: #cec6b6;
  color: #20211b;
}

.metric-menu-button svg {
  width: 20px;
  height: 20px;
}

.metric-description-chart {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
  color: #504b41;
  font-family: 'Serrif-TRIAL', Georgia, 'Times New Roman', serif;
  max-width: 700px;
}

/* Bar Chart */
.bar-chart-container {
  flex: 1;
  padding: 20px 0;
  min-height: 0;
  box-sizing: border-box;
  min-width: 0; /* Allow flex child to shrink */
}

.bar-chart-wrapper {
  isolation: isolate; /* Create stacking context */
  contain: layout; /* Optimize layout containment */
}

.bar-chart-container svg {
  max-width: 100%;
  height: auto;
}

/* Chart Actions */
.chart-actions {
  display: flex;
  justify-content: flex-end;
}

.download-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: #e6e1d6;
  border: none;
  border-radius: 8px;
  color: #20211b;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  position: relative;
  height: 48px;
}

.download-button:hover {
  background: #cec6b6;
}

/* Old Download Section - Hide */
.survey-download-section {
  display: none;
}

/* Download Dropdown */
.download-dropdown-container {
  position: relative;
  display: flex;
  align-items: center;
}

.download-menu-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 199;
}

.download-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  padding: 8px;
  min-width: 160px;
  z-index: 200;
  animation: fadeIn 0.2s ease;
}

.survey-download-section-bottom .download-menu {
  bottom: calc(100% + 8px);
  top: auto;
}

.download-menu-header {
  padding: 8px 12px;
  background: #e6e1d6;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: #20211b;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  margin-bottom: 8px;
}

.download-menu-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  background: white;
  border: none;
  text-align: left;
  font-size: 14px;
  font-weight: 400;
  color: #20211b;
  cursor: pointer;
  transition: background 0.2s;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  border-radius: 4px;
}

.download-menu-item:hover {
  background: #f7f5f2;
}

/* Hide old table styles but keep for backwards compatibility */
.data-table-container {
  overflow-x: auto;
  margin-bottom: 32px;
  display: none;
}

.benchmark-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.benchmark-table thead {
  background: #f7f5f2;
}

.benchmark-table th {
  padding: 16px 20px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: #20211b;
  border-bottom: 2px solid #e6e1d6;
}

.benchmark-table th.revenue-column {
  font-size: 14px;
}

.benchmark-table th.percentile-column {
  text-align: center;
}

.percentile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.percentile-label {
  font-size: 14px;
  font-weight: 600;
  color: #20211b;
}

.percentile-value {
  font-size: 11px;
  font-weight: 400;
  color: #9d917a;
}

.benchmark-table tbody tr {
  border-bottom: 1px solid #f0ebe3;
  transition: background 0.2s;
}

.benchmark-table tbody tr:hover {
  background: #fafaf8;
}

.benchmark-table tbody tr:last-child {
  border-bottom: none;
}

.benchmark-table td {
  padding: 16px 20px;
  font-size: 14px;
  color: #20211b;
}

.revenue-cell {
  font-weight: 500;
  color: #20211b;
}

.percentile-cell {
  text-align: center;
  font-weight: 600;
  font-size: 15px;
}

.p50-cell {
  color: #9d917a;
}

.p75-cell {
  color: #52B788;
}

.p90-cell {
  color: #e5a819;
}

/* Legend */
.benchmark-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding: 20px 24px;
  background: #f7f5f2;
  border-radius: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.legend-marker {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.p50-marker {
  background: #9d917a;
}

.p75-marker {
  background: #52B788;
}

.p90-marker {
  background: #e5a819;
}

.legend-label {
  font-size: 13px;
  color: #504b41;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.no-data-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 40px;
  min-height: 400px;
  background: #fafaf8;
  border-radius: 8px;
  margin-top: 24px;
}

.no-data-message p {
  margin: 0;
  font-size: 16px;
  color: #9d917a;
  font-family: 'Serrif-TRIAL', Georgia, 'Times New Roman', serif;
}

.no-data-message h3 {
  margin: 0;
  font-family: 'Saans-TRIAL', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

@media (max-width: 768px) {
  .metric-title {
    font-size: 22px;
  }

  .metric-description {
    font-size: 14px;
  }

  .benchmark-table {
    font-size: 12px;
  }

  .benchmark-table th,
  .benchmark-table td {
    padding: 12px 10px;
  }

  .percentile-label {
    font-size: 12px;
  }

  .percentile-value {
    font-size: 10px;
  }

  .benchmark-legend {
    flex-direction: column;
    gap: 12px;
  }

  /* Responsive Filters */
  .filters-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .benchmark-filters {
    padding: 16px;
  }

  .filters-panel-grid {
    padding: 0px 12px 144px 12px;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .benchmark-filters-panel {
    padding: 0px !important;
    min-width: auto;
  }

  .filters-overlay-panel {
    max-width: 95vw;
    max-height: 90vh;
    top: 5vh;
    transform: translateX(-50%);
  }

  @keyframes slideIn {
    from {
      opacity: 0;
      transform: translateX(-50%) scale(0.96);
    }
    to {
      opacity: 1;
      transform: translateX(-50%) scale(1);
    }
  }

  .filters-panel-actions {
    flex-direction: row;
    gap: 8px;
  }

  .filter-clear-button,
  .filter-apply-button {
    flex: 1;
  }
}

