/* === CSS Variables — Claude / Anthropic Theme === */
:root {
  --primary: #d97757;
  --primary-dark: #c0513f;
  --primary-light: #f5e6df;
  --secondary: #6a9bcc;
  --tertiary: #788c5d;
  --positive: #788c5d;
  --positive-light: #e8f0df;
  --neutral: #b0aea5;
  --neutral-light: #e8e6dc;
  --negative: #d97757;
  --negative-light: #f5e6df;
  --bg: #faf9f5;
  --card-bg: #ffffff;
  --text: #141413;
  --text-secondary: #6b6960;
  --border: #e8e6dc;
  --shadow: 0 1px 3px rgba(20,20,19,0.08), 0 1px 2px rgba(20,20,19,0.06);
  --shadow-lg: 0 10px 25px rgba(20,20,19,0.1), 0 4px 10px rgba(20,20,19,0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --rating-1: #c0513f;
  --rating-2: #d97757;
  --rating-3: #b0aea5;
  --rating-4: #788c5d;
  --rating-5: #5a7a42;
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* === Header === */
header {
  text-align: center;
  padding: 40px 20px 20px;
}
header h1 {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
header .subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-top: 4px;
}

/* === Main Container === */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

/* === Upload Section === */
.upload-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
  max-width: 600px;
  margin: 20px auto;
}
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}
.drop-zone svg { margin-bottom: 12px; }
.drop-text { font-size: 1rem; font-weight: 500; margin-bottom: 4px; }
.drop-subtext { font-size: 0.85rem; margin-bottom: 12px; }
.file-input-label {
  display: inline-block;
  padding: 8px 24px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
}
.file-input-label:hover { background: var(--primary-dark); }
.selected-file-name {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 500;
  min-height: 20px;
}

.separator {
  text-align: center;
  margin: 24px 0;
  position: relative;
}
.separator::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
}
.separator span {
  position: relative;
  background: var(--card-bg);
  padding: 0 16px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
}

.file-selector-wrapper {
  margin-bottom: 24px;
}
.file-selector-wrapper label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.file-selector-wrapper select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text);
  background: white;
  cursor: pointer;
}

.analyze-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.2s, transform 0.1s;
}
.analyze-btn:hover { opacity: 0.9; }
.analyze-btn:active { transform: scale(0.98); }

/* === Loading === */
.hidden { display: none !important; }
.loading-card {
  text-align: center;
  padding: 60px 20px;
}
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loadingText { color: var(--text-secondary); font-size: 1rem; }

/* === Report Section === */
#report-container {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* Report Header */
#report-header {
  background: linear-gradient(135deg, #141413, #3d3929);
  color: white;
  padding: 32px 40px;
}
.report-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.company-info {
  display: flex;
  align-items: center;
  gap: 16px;
}
.company-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: white;
  object-fit: contain;
  padding: 4px;
}
.company-info h2 { font-size: 1.5rem; font-weight: 700; }
.company-info a { color: rgba(255,255,255,0.8); font-size: 0.85rem; text-decoration: none; }
.company-info a:hover { color: white; }
.report-meta {
  text-align: right;
  font-size: 0.8rem;
  opacity: 0.85;
}

/* Executive Summary */
#executive-summary {
  padding: 32px 40px;
}
.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.stat-card {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
}
.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}
.star-display {
  margin-top: 6px;
  font-size: 1.2rem;
}
.sentiment-card .stat-value { font-size: 1.3rem; }
.sentiment-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 12px;
}
.sentiment-positive { background: var(--positive); }
.sentiment-neutral { background: var(--neutral); }
.sentiment-negative { background: var(--negative); }
.sentiment-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.7rem;
  font-weight: 500;
}
.positive-label { color: var(--positive); }
.neutral-label { color: var(--neutral); }
.negative-label { color: var(--negative); }

/* Charts Grid */
#charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding: 0 40px 32px;
}
.chart-card {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 20px;
}
.chart-card h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  text-align: center;
}
.chart-card canvas {
  max-height: 300px;
}

/* Detailed Analysis */
#detailed-analysis {
  padding: 0 40px 40px;
}

/* Analysis sections generated by JS */
.analysis-section {
  margin-bottom: 32px;
}
.analysis-section h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
  color: var(--text);
}

/* Recommendation cards */
.recommendation-card {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 12px;
  border-left: 4px solid var(--negative);
}
.rec-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.rec-area {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}
.rec-count {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--negative-light);
  padding: 2px 10px;
  border-radius: 12px;
}
.rec-suggestion {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Review quotes */
.review-quotes {
  margin-bottom: 32px;
}
.review-quotes h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.quote-card {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 10px;
  border-left: 4px solid var(--border);
}
.quote-card.negative { border-left-color: var(--negative); }
.quote-card.positive { border-left-color: var(--positive); }
.quote-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.quote-title {
  font-weight: 600;
  font-size: 0.9rem;
}
.quote-rating {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
}
.quote-rating.low { background: var(--negative-light); color: var(--negative); }
.quote-rating.high { background: var(--positive-light); color: var(--positive); }
.quote-content {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.5;
}
.quote-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* Keyword tags */
/* Service Pitch Section */
.pitch-section {
  background: linear-gradient(135deg, #141413, #3d3929);
  color: white;
  padding: 48px 40px;
  text-align: center;
  margin-top: 32px;
  border-radius: var(--radius-sm);
}
.pitch-section h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.pitch-tagline {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 24px;
}
.pitch-insights {
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 24px;
  margin: 24px auto;
  max-width: 700px;
  text-align: left;
}
.pitch-insights h4 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: #d9a48c;
}
.pitch-insights ul {
  list-style: none;
  padding: 0;
}
.pitch-insights li {
  padding: 8px 0;
  padding-left: 24px;
  position: relative;
  font-size: 0.9rem;
  opacity: 0.9;
  line-height: 1.5;
}
.pitch-insights li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  color: var(--positive);
  font-weight: bold;
}
.pitch-description {
  font-size: 0.9rem;
  opacity: 0.8;
  margin: 24px auto;
  max-width: 600px;
  line-height: 1.6;
}
.pitch-cta {
  display: inline-block;
  padding: 14px 40px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
}
.pitch-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
}
.pitch-website {
  margin-top: 16px;
  font-size: 0.85rem;
  opacity: 0.6;
}

/* API Key Input */
.api-key-wrapper {
  margin-bottom: 24px;
}
.api-key-wrapper > label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.api-key-input-row {
  display: flex;
  gap: 8px;
}
.api-key-input-row input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text);
}
.api-key-input-row input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.toggle-key-btn {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
}
.toggle-key-btn:hover { border-color: var(--primary); color: var(--primary); }
.api-key-hint {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 6px;
}
.api-key-hint a { color: var(--primary); text-decoration: none; }
.api-key-hint a:hover { text-decoration: underline; }

/* AI Analysis Section */
#ai-analysis {
  padding: 0 40px 32px;
}
.ai-loading {
  text-align: center;
  padding: 32px;
  background: linear-gradient(135deg, #faf9f5, #f5e6df);
  border-radius: var(--radius-sm);
  border: 1px solid #e8c9b8;
}
.ai-loading .spinner {
  border-top-color: var(--primary);
}
.ai-loading p {
  color: #c0513f;
  font-weight: 500;
  margin-top: 12px;
}
.ai-error {
  padding: 20px;
  background: var(--negative-light);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--negative);
  color: var(--text);
}
.ai-error h3 { margin-bottom: 8px; font-size: 1rem; }
.ai-error p { font-size: 0.85rem; color: var(--text-secondary); margin-top: 4px; }

.ai-analysis-content { }
.ai-header {
  margin-bottom: 20px;
}
.ai-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-badge {
  display: inline-block;
  padding: 3px 10px;
  background: linear-gradient(135deg, #d97757, #c0513f);
  color: white;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.ai-summary-box {
  background: linear-gradient(135deg, #faf9f5, #f5e6df);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  margin-bottom: 20px;
  border: 1px solid #e8c9b8;
}
.ai-summary-box h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #c0513f;
  margin-bottom: 8px;
}
.ai-summary-box p {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
}

.ai-section {
  margin-bottom: 20px;
}
.ai-section h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid #f5e6df;
}
.ai-section ul {
  list-style: none;
  padding: 0;
}
.ai-section li {
  padding: 6px 0 6px 20px;
  position: relative;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-secondary);
}
.ai-section li::before {
  content: '\2022';
  position: absolute;
  left: 4px;
  color: var(--primary);
  font-weight: bold;
}
.ai-urgent { background: #fef2f2; border-radius: var(--radius-sm); padding: 16px 20px; border-left: 4px solid var(--negative); }
.ai-urgent h4 { color: var(--negative); border-bottom-color: #fecaca; }
.ai-urgent li::before { color: var(--negative); }

/* AI Theme Cards */
.ai-theme-card {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 10px;
  border-left: 4px solid #94a3b8;
}
.ai-theme-card.severity-critical { border-left-color: var(--negative); }
.ai-theme-card.severity-high { border-left-color: #c0513f; }
.ai-theme-card.severity-medium { border-left-color: var(--neutral); }
.ai-theme-card.severity-low { border-left-color: var(--positive); }
.ai-theme-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.ai-theme-name { font-weight: 600; font-size: 0.9rem; }
.ai-theme-severity {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 10px;
  border-radius: 12px;
  background: var(--bg);
}
.severity-critical .ai-theme-severity { background: var(--negative-light); color: var(--negative); }
.severity-high .ai-theme-severity { background: #f5e6df; color: #c0513f; }
.severity-medium .ai-theme-severity { background: var(--neutral-light); color: #6b6960; }
.severity-low .ai-theme-severity { background: var(--positive-light); color: var(--positive); }
.ai-theme-card p { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; }
.ai-theme-count { font-size: 0.75rem; color: var(--text-secondary); margin-top: 4px; display: inline-block; }

/* AI Improvement Cards */
.ai-improvement-card {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 12px;
  border-left: 4px solid var(--neutral);
}
.ai-improvement-card.priority-critical { border-left-color: var(--negative); }
.ai-improvement-card.priority-high { border-left-color: #c0513f; }
.ai-improvement-card.priority-medium { border-left-color: var(--neutral); }
.ai-imp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.ai-imp-area { font-weight: 600; font-size: 0.95rem; }
.ai-imp-priority {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 10px;
  border-radius: 12px;
}
.priority-critical .ai-imp-priority { background: var(--negative-light); color: var(--negative); }
.priority-high .ai-imp-priority { background: #f5e6df; color: #c0513f; }
.priority-medium .ai-imp-priority { background: var(--neutral-light); color: #6b6960; }
.ai-imp-problem, .ai-imp-rec, .ai-imp-impact {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 6px;
}
.ai-imp-rec { color: var(--text); }

/* AI Patterns Grid */
.ai-patterns-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.ai-pattern-col {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
}
.ai-pattern-col.negative { border-left: 4px solid var(--negative); }
.ai-pattern-col.positive { border-left: 4px solid var(--positive); }
.ai-pattern-col h4 { border-bottom: none; padding-bottom: 0; margin-bottom: 8px; }
.ai-pattern-col.negative h4 { color: var(--negative); }
.ai-pattern-col.positive h4 { color: var(--positive); }
.ai-pattern-col li::before { color: inherit; }
.ai-pattern-col.negative li::before { color: var(--negative); }
.ai-pattern-col.positive li::before { color: var(--positive); }

/* AI Strengths */
.ai-strengths li::before { content: '\2713'; color: var(--positive); }

/* Export Controls */
#export-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  flex-wrap: wrap;
}
.export-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.export-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.pdf-btn { background: #c0513f; color: white; }
.image-btn { background: var(--primary); color: white; }
.new-btn { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.recompute-btn { background: #6a9bcc; color: white; }

/* Footer */
footer {
  text-align: center;
  padding: 24px;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

/* === Responsive === */
@media (max-width: 768px) {
  header h1 { font-size: 1.5rem; }
  .upload-card { padding: 24px; }
  #report-header { padding: 24px; }
  .report-header-content { flex-direction: column; text-align: center; }
  .report-meta { text-align: center; }
  .company-info { flex-direction: column; text-align: center; }
  #executive-summary { padding: 24px; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  #charts-grid { grid-template-columns: 1fr; padding: 0 24px 24px; }
  #detailed-analysis { padding: 0 24px 24px; }
  #ai-analysis { padding: 0 24px 24px; }
  .ai-patterns-grid { grid-template-columns: 1fr; }
  .pitch-section { padding: 32px 24px; }
}

@media (max-width: 480px) {
  .summary-grid { grid-template-columns: 1fr; }
  #export-controls { flex-direction: column; align-items: stretch; }
}

/* === Customer Experience Gap Analysis Section === */
#gap-analysis {
  padding: 0 40px 32px;
}

#gap-charts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding: 0 40px 32px;
}

#gap-charts .chart-card.full-width {
  grid-column: 1 / -1;
}

/* Gap Summary Box */
.gap-summary-box {
  display: flex;
  align-items: center;
  gap: 24px;
  background: linear-gradient(135deg, #faf9f5, #f5e6df);
  border-radius: var(--radius-sm);
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid #e8c9b8;
}

.gap-score-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 90px;
  height: 90px;
  min-width: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  flex-shrink: 0;
  text-align: center;
}

.gap-score-value {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
}

.gap-score-label {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 3px;
  opacity: 0.9;
  white-space: nowrap;
}

.gap-summary-text {
  flex: 1;
}

.gap-summary-text h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #c0513f;
  margin-bottom: 8px;
}

.gap-summary-text p {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
}

/* Gap Priority List */
.gap-priority-list {
  padding-left: 20px;
}

.gap-priority-list li {
  padding: 4px 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Gap Stats Grid */
.gap-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.gap-stat-card {
  text-align: center;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.gap-stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  display: block;
}

.gap-stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 4px;
  display: block;
}

.gap-detail-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 8px;
}

.gap-section-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-style: italic;
}

/* Self-Service Cards */
.self-service-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 12px;
  border-left: 4px solid var(--neutral);
  box-shadow: var(--shadow);
}

.self-service-card.complexity-low {
  border-left-color: var(--positive);
}

.self-service-card.complexity-medium {
  border-left-color: var(--neutral);
}

.self-service-card.complexity-high {
  border-left-color: var(--negative);
}

.self-service-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.self-service-category {
  font-weight: 600;
  font-size: 0.95rem;
}

.self-service-badges {
  display: flex;
  gap: 6px;
}

.self-service-potential {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
}

.complexity-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
  text-transform: uppercase;
}

.complexity-badge.complexity-low {
  background: var(--positive-light);
  color: #5a7a42;
}

.complexity-badge.complexity-medium {
  background: var(--neutral-light);
  color: #8b6f47;
}

.complexity-badge.complexity-high {
  background: var(--negative-light);
  color: var(--negative);
}

.self-service-bar {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  margin-bottom: 10px;
  overflow: hidden;
}

.self-service-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #788c5d, #5a7a42);
  transition: width 0.8s ease;
}

.complexity-high .self-service-fill {
  background: linear-gradient(90deg, #c0513f, #9a3d30);
}

.complexity-medium .self-service-fill {
  background: linear-gradient(90deg, #d97757, #b0aea5);
}

.self-service-reasoning {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
}

.common-questions {
  font-size: 0.85rem;
  color: var(--text);
  margin-top: 6px;
}

.common-questions ul {
  list-style: none;
  padding: 0;
  margin-top: 4px;
}

.common-questions li {
  padding: 3px 0 3px 20px;
  position: relative;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.common-questions li::before {
  content: '?';
  position: absolute;
  left: 4px;
  color: var(--primary);
  font-weight: bold;
}

/* Effort Indicator Cards */
.effort-indicator {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 12px;
  border-left: 4px solid var(--neutral);
  box-shadow: var(--shadow);
}

.effort-indicator.severity-critical {
  border-left-color: var(--negative);
}

.effort-indicator.severity-high {
  border-left-color: #c0513f;
}

.effort-indicator.severity-medium {
  border-left-color: var(--neutral);
}

.effort-indicator.severity-low {
  border-left-color: var(--positive);
}

.effort-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.effort-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.effort-badges {
  display: flex;
  gap: 6px;
}

.effort-count {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
  background: var(--bg);
  color: var(--text-secondary);
}

.effort-severity {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
  text-transform: uppercase;
}

.severity-badge-critical {
  background: var(--negative-light);
  color: var(--negative);
}

.severity-badge-high {
  background: #f5e6df;
  color: #c0513f;
}

.severity-badge-medium {
  background: var(--neutral-light);
  color: #6b6960;
}

.severity-badge-low {
  background: var(--positive-light);
  color: var(--positive);
}

.effort-quotes {
  margin-top: 6px;
}

.effort-quote {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.5;
  padding: 4px 0;
}

@media (max-width: 768px) {
  #gap-analysis { padding: 0 24px 24px; }
  #gap-charts { grid-template-columns: 1fr; padding: 0 24px 24px; }
  .gap-summary-box { flex-direction: column; text-align: center; }
  .self-service-header { flex-direction: column; align-items: flex-start; }
  .effort-header { flex-direction: column; align-items: flex-start; }
  .gap-stats-grid { grid-template-columns: 1fr; }
}

/* Export button groups */
.export-group {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.export-group-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.export-group .export-btn {
  padding: 8px 16px;
  font-size: 0.8rem;
}

.ai-pdf-btn { background: #c0513f; color: white; }
.ai-image-btn { background: #d97757; color: white; }

/* AI Themes Chart Container */
#ai-themes-chart-container {
  padding: 0 40px 20px;
}

/* Report AI section */
#report-ai {
  border-top: 3px solid #d97757;
  margin-top: 8px;
}

@media (max-width: 768px) {
  .capability-table th,
  .capability-table td {
    padding: 8px 10px;
    font-size: 0.75rem;
  }
  .cap-how { max-width: 150px; }
  #ai-themes-chart-container { padding: 0 24px 20px; }
}

/* === Advanced Analysis Section === */
#advanced-analysis {
  padding: 0 40px 32px;
}

#advanced-charts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding: 0 40px 32px;
}

#advanced-charts .chart-card.full-width {
  grid-column: 1 / -1;
}

.advanced-analysis-content { }

/* Friction Stage Cards */
.friction-stage-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 12px;
  border-left: 4px solid var(--secondary);
  box-shadow: var(--shadow);
}

.friction-stage-card.stage-worst {
  border-left-color: var(--negative);
  background: #fef8f6;
}

.friction-stage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.friction-stage-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.friction-stage-badges {
  display: flex;
  gap: 6px;
}

.friction-count-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
  background: var(--negative-light);
  color: var(--negative);
}

.friction-rating-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
  background: var(--neutral-light);
  color: var(--text-secondary);
}

.friction-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.friction-keyword-tag {
  display: inline-block;
  padding: 3px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Financial Summary Badge */
.financial-summary-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 90px;
  height: 90px;
  min-width: 90px;
  border-radius: 50%;
  color: white;
  flex-shrink: 0;
  text-align: center;
}

.financial-summary-badge.impact-critical {
  background: linear-gradient(135deg, #c0513f, #9a3d30);
}

.financial-summary-badge.impact-high {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.financial-summary-badge.impact-medium {
  background: linear-gradient(135deg, var(--neutral), #8b8577);
}

.financial-summary-badge.impact-low {
  background: linear-gradient(135deg, var(--positive), #5a7a42);
}

/* Escalation Review Cards */
.escalation-review-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 10px;
  border-left: 4px solid var(--negative);
  box-shadow: var(--shadow);
}

.escalation-review-card.unreplied {
  border-left-color: #c0513f;
  background: #fef8f6;
}

/* Risk Type Tags */
.risk-type-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.risk-type-tag.legal {
  background: #fde2e2;
  color: #c0513f;
}

.risk-type-tag.chargeback {
  background: var(--negative-light);
  color: var(--negative);
}

.risk-type-tag.social_media,
.risk-type-tag.socialMedia {
  background: #e0ecf7;
  color: #4a7ab5;
}

.risk-type-tag.regulatory {
  background: #f5f0e0;
  color: #8b6f47;
}

/* Churn Buckets Grid */
.churn-buckets-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.churn-bucket-card {
  text-align: center;
  padding: 20px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.churn-bucket-card.high {
  background: var(--negative-light);
  border-color: var(--negative);
}

.churn-bucket-card.medium {
  background: #fef5e7;
  border-color: #d9a348;
}

.churn-bucket-card.low {
  background: var(--positive-light);
  border-color: var(--positive);
}

.churn-bucket-card .gap-stat-value {
  font-size: 1.8rem;
}

.churn-bucket-card.high .gap-stat-value { color: var(--negative); }
.churn-bucket-card.medium .gap-stat-value { color: #d9a348; }
.churn-bucket-card.low .gap-stat-value { color: var(--positive); }

/* Expectation Cards */
.expectation-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 12px;
  border-left: 4px solid var(--secondary);
  box-shadow: var(--shadow);
}

.expectation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.expectation-col {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
}

.expectation-col.expected {
  background: #e8f0df;
  border: 1px solid #c5d9ae;
}

.expectation-col.reality {
  background: var(--negative-light);
  border: 1px solid #e8c9b8;
}

.expectation-col-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.expectation-col.expected .expectation-col-label {
  color: var(--positive);
}

.expectation-col.reality .expectation-col-label {
  color: var(--negative);
}

.expectation-col p {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.5;
  margin: 0;
}

/* Emotion Tags */
.emotion-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 500;
  margin: 3px 4px;
}

.emotion-tag.negative {
  background: var(--negative-light);
  color: var(--negative);
}

.emotion-tag.positive {
  background: var(--positive-light);
  color: var(--positive);
}

/* Recovery approach text */
.effort-indicator .gap-detail-text {
  margin-top: 6px;
}

/* Advanced Analysis Responsive */
@media (max-width: 768px) {
  #advanced-analysis { padding: 0 24px 24px; }
  #advanced-charts { grid-template-columns: 1fr; padding: 0 24px 24px; }
  .friction-stage-header { flex-direction: column; align-items: flex-start; }
  .churn-buckets-grid { grid-template-columns: 1fr; }
  .expectation-grid { grid-template-columns: 1fr; }
}

/* === Print Styles === */
@media print {
  header, #upload-section, #loading-section, #export-controls, footer { display: none; }
  #report-section { display: block !important; }
  #report-container { box-shadow: none; }
  .pitch-section { break-before: page; }
}
