/**
 * Price Optimization & Pricing Strategy Sandbox
 * App-specific styles
 */

/* ============================================================================
   ERROR AND WARNING MESSAGES
   ============================================================================ */

.error-message {
  background: #fee2e2;
  color: #991b1b;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  border-left: 3px solid #dc2626;
  margin-top: 1rem;
  font-size: 0.9rem;
}

/* ============================================================================
   CONCEPTS GRID - Overview Section
   ============================================================================ */

.concepts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.concept-card {
  background: #f8f9fb;
  border-radius: 8px;
  padding: 1rem;
  border-left: 3px solid var(--app-accent);
}

.concept-card h4 {
  margin: 0 0 0.5rem 0;
  color: var(--app-text);
  font-size: 1rem;
}

.concept-card p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.concept-card .equation {
  font-size: 0.85rem;
  background: white;
  padding: 0.5rem;
  border-radius: 4px;
  margin: 0.5rem 0;
  overflow-x: auto;
  max-width: 100%;
}

/* ============================================================================
   MODEL TYPES GRID
   ============================================================================ */

.model-types-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.model-type-card {
  background: white;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 1rem;
}

.model-type-card h4 {
  margin: 0 0 0.75rem 0;
  color: #1e40af;
}

.model-type-card .equation {
  font-size: 0.9rem;
  margin: 0.5rem 0;
}

.model-type-card--warned {
  border-color: #fca5a5;
  background: #fef2f2;
}

.model-type-card--warned h4 {
  color: #991b1b;
}

.tag-danger {
  font-size: 0.7rem;
  font-weight: 600;
  color: #991b1b;
}

/* ============================================================================
   SCENARIO SECTION
   ============================================================================ */

.scenario-controls__input {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.scenario-controls__input select {
  flex: 1;
  min-width: 250px;
}

.scenario-description {
  margin-top: 1.5rem;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 12px;
  padding: 1.5rem;
  border-left: 4px solid var(--app-accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.scenario-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #dee2e6;
  margin-bottom: 1rem;
}

.scenario-icon {
  font-size: 1.5rem;
}

.scenario-header h4 {
  margin: 0;
  color: #2c3e50;
  font-size: 1.1rem;
  flex-grow: 1;
}

.scenario-badge {
  background: var(--app-accent);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.scenario-intro {
  color: #495057;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.scenario-variables h5,
.scenario-context h5,
.scenario-insights h5,
.scenario-questions h5 {
  color: #2c3e50;
  font-size: 0.95rem;
  margin: 1rem 0 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.scenario-var-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.scenario-var-table td {
  padding: 0.5rem;
  border-bottom: 1px solid #e9ecef;
  vertical-align: middle;
}

.scenario-var-table td:first-child {
  width: 180px;
  white-space: nowrap;
}

.var-tag {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: 'Monaco', 'Consolas', monospace;
  font-weight: 600;
}

.var-tag.outcome {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.var-tag.predictor {
  background: #cce5ff;
  color: #004085;
  border: 1px solid #b8daff;
}

.var-tag.binary {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
}

.var-tag.categorical {
  background: #e2d9f3;
  color: #6f42c1;
  border: 1px solid #d4c4e8;
}

.var-tag.currency {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.context-item {
  background: white;
  padding: 0.75rem;
  border-radius: 6px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.context-item strong {
  display: block;
  font-size: 0.75rem;
  color: #6c757d;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.context-item span {
  color: #2c3e50;
  font-weight: 600;
}

.scenario-insights ul,
.scenario-questions ol {
  margin: 0;
  padding-left: 1.25rem;
  color: #495057;
}

.scenario-insights li,
.scenario-questions li {
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.scenario-tip {
  background: #e7f3ff;
  border-left: 3px solid var(--app-accent);
  padding: 0.75rem 1rem;
  border-radius: 0 6px 6px 0;
  font-size: 0.9rem;
  margin-top: 1rem;
}

.scenario-questions {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 8px;
  margin-top: 1rem;
}

/* ============================================================================
   DATA ENTRY & MODE PANELS
   ============================================================================ */

.mode-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.mode-button {
  padding: 0.6rem 1.2rem;
  border: 2px solid var(--app-border);
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.mode-button:hover {
  border-color: var(--app-accent);
  background: #f0f7ff;
}

.mode-button.active {
  border-color: var(--app-accent);
  background: var(--app-accent);
  color: white;
}

.mode-panel {
  display: none;
}

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

/* ============================================================================
   SIMULATED DATA CONTROLS
   ============================================================================ */

.param-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.param-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: var(--app-text);
}

.param-group input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--app-border);
  border-radius: 4px;
}

.simulation-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.status-text {
  color: var(--app-success);
  font-weight: 500;
}

.data-preview {
  margin-top: 1.5rem;
  border-top: 1px solid var(--app-border);
  padding-top: 1rem;
}

.preview-table-container {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--app-border);
  border-radius: 6px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th,
.data-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--app-border);
}

.data-table th {
  background: #f8f9fb;
  font-weight: 600;
  position: sticky;
  top: 0;
}

.data-table tbody tr:hover {
  background: #f8f9fb;
}

.data-summary {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

/* ============================================================================
   MANUAL ENTRY TABLE
   ============================================================================ */

.manual-table-container {
  margin-bottom: 1rem;
}

.data-table.editable input {
  width: 80px;
  padding: 0.35rem;
  border: 1px solid var(--app-border);
  border-radius: 4px;
  text-align: center;
}

.remove-row-btn {
  padding: 0.25rem 0.5rem;
  font-size: 1rem;
  line-height: 1;
}

.manual-actions {
  margin-top: 1rem;
}

/* ============================================================================
   MODEL SELECTION
   ============================================================================ */

.model-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.model-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border: 2px solid var(--app-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.model-option:hover {
  border-color: var(--app-accent);
  background: #f8fbff;
}

.model-option input[type="radio"] {
  margin-top: 0.25rem;
}

.model-option label {
  cursor: pointer;
  flex: 1;
}

.model-option label strong {
  display: block;
  margin-bottom: 0.25rem;
}

.model-option label p {
  margin: 0;
  font-size: 0.85rem;
}

.model-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-left: 0.5rem;
}

.model-tag.recommended {
  background: #d1fae5;
  color: #065f46;
}

.model-tag.naive {
  background: #fef3c7;
  color: #92400e;
}

.model-tag.danger {
  background: #fee2e2;
  color: #991b1b;
}

.model-option--warned {
  border: 1px solid #fca5a5;
  background: #fef2f2;
  border-radius: 6px;
  padding: 0.5rem;
  margin-top: 0.5rem;
}

.model-option--warned .warning-text {
  color: #991b1b;
  font-style: italic;
}

.advanced-options {
  margin-top: 1rem;
  padding: 1rem;
  background: #f8f9fb;
  border-radius: 6px;
}

.advanced-options summary {
  cursor: pointer;
  font-weight: 500;
}

.advanced-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.option-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

/* ============================================================================
   RUN ANALYSIS BUTTON
   ============================================================================ */

.run-analysis-container {
  margin-top: 1.5rem;
  text-align: center;
}

.run-analysis-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  background: linear-gradient(135deg, #2a7de1 0%, #1e5bb8 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(42, 125, 225, 0.3);
}

.run-analysis-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #1e5bb8 0%, #163d7a 100%);
  box-shadow: 0 6px 16px rgba(42, 125, 225, 0.4);
  transform: translateY(-2px);
}

.run-analysis-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(42, 125, 225, 0.3);
}

.run-analysis-btn:disabled {
  background: #95a5a6;
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.6;
}

.run-analysis-btn .btn-icon {
  font-size: 0.9rem;
}

.btn-note {
  margin: 0.5rem 0 0 0;
  font-size: 0.85rem;
  color: #6c757d;
  font-style: italic;
}

/* ============================================================================
   COVARIATE CONTROLS
   ============================================================================ */

.covariate-controls {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #dee2e6;
}

.covariate-controls h4 {
  margin: 0 0 0.25rem 0;
  font-size: 0.95rem;
  color: var(--app-text);
}

.covariate-controls .muted {
  margin: 0 0 0.75rem 0;
  font-size: 0.85rem;
}

.covariate-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.covariate-checkboxes label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  transition: background 0.2s;
}

.covariate-checkboxes label:hover {
  background: #f8f9fb;
}

.covariate-checkboxes input[type="checkbox"] {
  cursor: pointer;
}

/* ============================================================================
   PRICE TRANSFORMATION OPTIONS
   ============================================================================ */

.price-transform-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #dee2e6;
}

.price-transform-section h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.feature-tag {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  background: #e0e7ff;
  color: #3730a3;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.transform-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.transform-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.transform-option:hover {
  border-color: #6366f1;
}

.transform-option input[type="radio"] {
  margin-top: 0.15rem;
}

.transform-option label {
  cursor: pointer;
  flex: 1;
}

.transform-option label strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.15rem;
}

.transform-equation {
  font-size: 0.8rem;
  color: #6b7280;
  font-family: 'Courier New', monospace;
}

.auto-select-row {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
}

.auto-select-row label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.transform-comparison {
  margin-top: 1rem;
  padding: 0.75rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.transform-comparison h5 {
  margin: 0 0 0.5rem 0;
  font-size: 0.85rem;
  color: #374151;
}

.transform-comparison-table {
  width: 100%;
  font-size: 0.85rem;
  border-collapse: collapse;
}

.transform-comparison-table th,
.transform-comparison-table td {
  padding: 0.4rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid #f3f4f6;
}

.transform-comparison-table th {
  font-weight: 600;
  color: #6b7280;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.transform-comparison-table .best-row {
  background: #ecfdf5;
  font-weight: 600;
}

.transform-comparison-table .best-row td:first-child::before {
  content: '✓ ';
  color: #059669;
}

/* ============================================================================
   VISUALIZATION SECTION
   ============================================================================ */

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

.viz-controls {
  display: flex;
  gap: 1.5rem;
}

.viz-controls label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.plot-container {
  width: 100%;
  min-height: 350px;
  background: white;
  border-radius: 8px;
}

.plot-small {
  min-height: 250px;
}

.plot-strip {
  min-height: 120px;
}

.chart-note {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #f8f9fb;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #495057;
}

/* ============================================================================
   RESULTS SECTION
   ============================================================================ */

.results-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.result-block {
  padding: 1rem;
  background: #f8f9fb;
  border-radius: 8px;
}

.result-block h4 {
  margin: 0 0 0.75rem 0;
  color: #1e40af;
  font-size: 0.95rem;
}

.active-covariates-indicator {
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  background: #e0f2fe;
  border-left: 3px solid #0284c7;
  border-radius: 4px;
  font-size: 0.85rem;
}

.active-covariates-indicator .indicator-label {
  font-weight: 600;
  color: #0c4a6e;
  margin-right: 0.5rem;
}

.active-covariates-indicator .indicator-value {
  color: #0369a1;
  font-family: 'Courier New', monospace;
}

.equation-box {
  background: white;
  padding: 1rem;
  border-radius: 6px;
  border: 1px solid var(--app-border);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.results-table th,
.results-table td {
  padding: 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--app-border);
}

.results-table th {
  font-weight: 600;
  color: #6c757d;
}

.fit-stats {
  display: flex;
  flex-direction: row;
  gap: 2rem;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-label {
  color: #6c757d;
  font-size: 0.85rem;
}

.stat-value {
  font-weight: 600;
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 1.1rem;
}

.elasticity-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--app-border);
}

/* ============================================================================
   ECONOMICS SECTION
   ============================================================================ */

.economics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.econ-input-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.econ-input-group input {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  font-size: 1rem;
}

.econ-input-group .hint {
  font-size: 0.8rem;
  color: #6c757d;
  margin-top: 0.25rem;
}

/* Segment Market Allocation */
.segment-allocation-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--app-border);
}

.segment-allocation-section h4 {
  margin: 0 0 0.25rem 0;
  font-size: 1rem;
}

.allocation-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.allocation-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.allocation-option:hover {
  background: #f0f4ff;
}

.allocation-option input[type="radio"] {
  margin-top: 0.3rem;
}

.allocation-option span {
  font-size: 0.9rem;
  line-height: 1.4;
}

.shares-summary {
  margin-top: 0.5rem;
}

.custom-segment-shares {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: #f8f9fb;
  border-radius: 6px;
}

/* ============================================================================
   OBJECTIVE SELECTION
   ============================================================================ */

.objective-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.objective-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border: 2px solid var(--app-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.objective-option:hover {
  border-color: var(--app-accent);
  background: #f8fbff;
}

.objective-option input[type="radio"] {
  margin-top: 0.25rem;
}

.objective-option label {
  cursor: pointer;
  flex: 1;
}

.objective-option label strong {
  display: block;
  margin-bottom: 0.25rem;
}

.target-input,
.weighted-input {
  margin-top: 1rem;
  padding: 1rem;
  background: #f8f9fb;
  border-radius: 6px;
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

.slider-container input[type="range"] {
  flex: 1;
}

.optimize-actions {
  margin-top: 1.5rem;
  text-align: center;
}

.primary.large {
  padding: 0.85rem 2.5rem;
  font-size: 1.1rem;
}

/* ============================================================================
   CURVES SECTION
   ============================================================================ */

.curves-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
}

.curve-plot-wrapper h4 {
  margin: 0 0 0.5rem 0;
  color: #1e40af;
}

/* ============================================================================
   OPTIMIZATION RESULTS
   ============================================================================ */

.optimal-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.optimal-result {
  text-align: center;
  padding: 1rem;
  background: #f8f9fb;
  border-radius: 8px;
}

.optimal-result.primary-result {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border: 2px solid var(--app-accent);
}

.result-label {
  display: block;
  font-size: 0.8rem;
  color: #6c757d;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.result-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--app-text);
}

.optimal-result.primary-result .result-value {
  font-size: 2rem;
  color: #1e40af;
}

/* Segment-specific results */
.segment-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.segment-result-card {
  background: white;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.segment-result-card h4 {
  margin: 0 0 0.75rem 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.segment-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.segment-metrics .metric {
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
  background: #f8f9fb;
  border-radius: 4px;
}

.segment-metrics .metric-label {
  font-size: 0.7rem;
  color: #6c757d;
  text-transform: uppercase;
  margin-bottom: 0.15rem;
}

.segment-metrics .metric-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--app-text);
}

/* Segment-specific economics tables */
#segment-economics-tables {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.segment-economics-table {
  background: white;
  border-radius: 6px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.segment-economics-table h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  font-weight: 600;
}

.segment-economics-table .table-container {
  max-height: 350px;
  margin-top: 0.5rem;
}

.price-table-details {
  margin-top: 1rem;
}

.price-table-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--app-accent);
}

.table-container {
  max-height: 400px;
  overflow-y: auto;
  margin-top: 1rem;
  border: 1px solid var(--app-border);
  border-radius: 6px;
}

.economics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.economics-table th,
.economics-table td {
  padding: 0.5rem 0.75rem;
  text-align: right;
  border-bottom: 1px solid var(--app-border);
}

.economics-table th {
  background: #f8f9fb;
  font-weight: 600;
  position: sticky;
  top: 0;
  text-align: right;
}

.economics-table th:first-child,
.economics-table td:first-child {
  text-align: left;
}

.economics-table tbody tr:hover {
  background: #f8f9fb;
}

.economics-table tbody tr.optimal-row {
  background: #dbeafe;
  font-weight: 600;
}

/* Objective context callout */
.objective-context-callout {
  background: #f0f7ff;
  border-left: 3px solid var(--app-accent);
  padding: 0.6rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: #1e40af;
  border-radius: 0 6px 6px 0;
}

/* Primary metric highlight in segment cards */
.segment-metrics .metric-primary {
  background: #dbeafe;
  border: 1px solid #93c5fd;
}

/* Objective status badges */
.obj-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.obj-badge-ok {
  background: #dcfce7;
  color: #166534;
}
.obj-badge-warn {
  background: #fef2f2;
  color: #991b1b;
}

/* Segment totals bar */
.segment-totals-bar {
  display: flex;
  gap: 2rem;
  padding: 0.75rem 1rem;
  margin-top: 1rem;
  background: #f8f9fb;
  border-radius: 6px;
  border-top: 2px solid var(--app-border);
  font-size: 0.9rem;
  flex-wrap: wrap;
}
.segment-totals-bar .negative {
  color: #dc2626;
}

/* ============================================================================
   BENCHMARKS / STRATEGY COMPARISON SECTION
   ============================================================================ */

.benchmark-config-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #f8f9fb;
  border-radius: 8px;
}

.benchmark-config-item {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.benchmark-config-item label {
  font-size: 0.8rem;
  color: #374151;
}

.config-input-group {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.config-input-group input {
  width: 80px;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--app-border);
  border-radius: 4px;
  font-size: 0.9rem;
}

.config-unit {
  font-size: 0.85rem;
  color: #6b7280;
  font-weight: 600;
}

.config-result {
  font-weight: 700;
  color: var(--app-accent);
  font-size: 0.95rem;
}

.benchmarks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.benchmark-card {
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 1rem;
  background: white;
}

.benchmark-header {
  margin-bottom: 0.75rem;
}

.benchmark-header label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.benchmark-config {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.benchmark-config label {
  font-size: 0.85rem;
  color: #6c757d;
}

.benchmark-config input {
  width: 100%;
  padding: 0.4rem;
  border: 1px solid var(--app-border);
  border-radius: 4px;
}

.benchmark-result {
  font-weight: 600;
  color: var(--app-text);
  margin-top: 0.5rem;
}

.benchmark-comparison {
  margin: 2rem 0;
}

.benchmark-performance {
  margin-top: 1.5rem;
}

.benchmark-table {
  width: 100%;
  border-collapse: collapse;
}

.benchmark-table th,
.benchmark-table td {
  padding: 0.6rem 0.75rem;
  text-align: right;
  border-bottom: 1px solid var(--app-border);
}

.benchmark-table th {
  background: #f8f9fb;
  font-weight: 600;
}

.benchmark-table th:first-child,
.benchmark-table td:first-child {
  text-align: left;
}

.benchmark-table .optimal-row {
  background: #dbeafe;
  font-weight: 600;
}

.benchmark-table td.positive {
  color: #16a34a;
  font-weight: 600;
}
.benchmark-table td.negative {
  color: #dc2626;
  font-weight: 600;
}

.metric-value.negative {
  color: #dc2626 !important;
}

/* ============================================================================
   WHAT-IF SANDBOX
   ============================================================================ */

.whatif-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.whatif-slider-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.slider-with-value {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.slider-with-value input[type="range"] {
  flex: 1;
}

.slider-value {
  min-width: 80px;
  text-align: right;
  font-family: 'Monaco', 'Consolas', monospace;
  font-weight: 600;
}

.whatif-results {
  background: #f8f9fb;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.whatif-results h4 {
  margin: 0 0 1rem 0;
  color: #1e40af;
}

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

.whatif-result {
  text-align: center;
  padding: 1rem;
  background: white;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.result-delta {
  display: block;
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.result-delta.positive {
  color: var(--app-success);
}

.result-delta.negative {
  color: var(--app-danger);
}

.whatif-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* ============================================================================
   SEGMENT ANALYSIS
   ============================================================================ */

.segment-viz-controls {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.segment-viz-controls label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.segment-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
}

.segment-card {
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 1rem;
  background: white;
}

.segment-card h5 {
  margin: 0 0 0.75rem 0;
  color: #1e40af;
}

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

/* ============================================================================
   BUTTONS
   ============================================================================ */

.primary {
  background: var(--app-accent);
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.primary:hover {
  background: var(--app-accent-dark);
}

.secondary {
  background: white;
  color: var(--app-text);
  border: 1px solid var(--app-border);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.secondary:hover {
  border-color: var(--app-accent);
  color: var(--app-accent);
}

.small {
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
}

/* ============================================================================
   UTILITIES
   ============================================================================ */

.muted {
  color: #6c757d;
}

.hidden {
  display: none !important;
}

/* Estimation Warnings */
.estimation-warnings {
  max-width: 1100px;
  margin: 0 auto 1.5rem;
  padding: 0 1rem;
}

.warning-group {
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  font-size: 0.92rem;
  line-height: 1.55;
}

.warning-group--warn {
  background: #fff8e1;
  border-left: 4px solid #f9a825;
  color: #5d4e00;
}

.warning-group--info {
  background: #e8f4fd;
  border-left: 4px solid #42a5f5;
  color: #1a3a5c;
}

.warning-header {
  font-weight: 700;
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}

.warning-group ul {
  margin: 0.25rem 0 0;
  padding-left: 1.3rem;
}

.warning-group li {
  margin-bottom: 0.3rem;
}

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

.callout {
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin: 1rem 0;
}

.callout--info {
  background: #e7f3ff;
  border-left: 4px solid var(--app-accent);
}

.callout ul {
  margin: 0.5rem 0 0 0;
  padding-left: 1.25rem;
}

.callout li {
  margin-bottom: 0.25rem;
}

.additional-notes {
  margin-top: 1rem;
  padding: 1rem;
  background: #f8f9fb;
  border-radius: 8px;
}

.additional-notes summary {
  cursor: pointer;
  font-weight: 600;
}

.dropzone {
  border: 2px dashed var(--app-border);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--app-accent);
  background: #f8fbff;
}

.dropzone-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.dropzone-note {
  font-size: 0.85rem;
  color: #6c757d;
  margin-bottom: 1rem;
}

.upload-status {
  font-size: 0.9rem;
  margin-top: 0.75rem;
}

.upload-status.success {
  color: #2e7d32;
  font-weight: 500;
}

.upload-status-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.upload-status-row .upload-status {
  margin-top: 0;
  flex: 1;
}

/* Data Summary Panel */
.data-summary {
  background: #f0f7ff;
  border: 1px solid #b3d4fc;
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.data-summary p {
  margin: 0.25rem 0;
}

.data-summary details {
  margin-top: 0.5rem;
}

.data-summary details summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--app-accent);
}

.data-summary ul {
  margin: 0.5rem 0 0 1.5rem;
  padding: 0;
}

.data-summary li {
  margin: 0.25rem 0;
}

.column-mapping {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--app-border);
}

.mapping-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

.mapping-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mapping-row label {
  min-width: 160px;
  font-weight: 500;
}

.mapping-row select {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--app-border);
  border-radius: 4px;
}

.template-buttons {
  margin-top: 1rem;
}

.template-label {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.template-button-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.template-button-grid button {
  font-size: 0.85rem;
}

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */

@media (max-width: 768px) {
  .hero-header__top {
    flex-direction: column;
  }
  
  .curves-container {
    grid-template-columns: 1fr;
  }
  
  .optimal-results-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .benchmarks-grid {
    grid-template-columns: 1fr;
  }
  
  .whatif-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .mode-toggle {
    flex-direction: column;
  }
  
  .mode-button {
    text-align: center;
  }
  
  .optimal-results-grid {
    grid-template-columns: 1fr;
  }
}
