/* styles.css - Substack Analytics Dashboard */

:root {
  --bg: #f7f5f2;
  --card-bg: #ffffff;
  --card-border: #e8e4df;
  --accent: #c85d3b;
  --accent-hover: #b04e30;
  --heading: #1a1a1a;
  --body: #4a4a4a;
  --muted: #8a8a8a;
  --green: #059669;
  --red: #dc2626;
  --amber: #d97706;
  --grid-line: #f0f0f0;
  --font-heading: 'Charter', 'Georgia', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--heading);
  line-height: 1.3;
}

.section {
  min-height: 100vh;
}

/* Onboarding Layout */
.onboarding-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 60px 20px 40px;
}

.onboarding-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 32px;
}

.onboarding-heading {
  font-size: 1.8rem;
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.onboarding-sub {
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 28px;
}

.onboarding-below {
  text-align: center;
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* Progress Dots */
.progress-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 28px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d4cfc8;
}

.dot.active {
  background: var(--accent);
}

.dot.done {
  background: var(--heading);
}

.dot-line {
  width: 32px;
  height: 1px;
  background: #d4cfc8;
}

/* Input Row */
.input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.input-field {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.2s;
}

.input-field:focus {
  border-color: var(--accent);
}

.helper-text {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.2s, transform 0.1s;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-accent {
  background: var(--accent);
  color: white;
}

.btn-accent:hover {
  background: var(--accent-hover);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-outline:hover {
  background: #fdf8f6;
}

.btn-sm {
  padding: 8px 20px;
  font-size: 0.85rem;
}

.btn-text {
  background: none;
  border: none;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  padding: 8px 16px;
  font-size: 0.9rem;
}

.btn-text:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Instructions Box */
.instructions-box {
  background: #faf9f7;
  border-radius: 8px;
  padding: 20px 20px 20px 24px;
  margin-bottom: 24px;
}

.instructions-box ol {
  margin: 0;
  padding-left: 18px;
  font-size: 0.9rem;
  color: var(--body);
}

.instructions-box li {
  padding: 3px 0;
}

/* Upload Zone */
.upload-zone {
  border: 2px dashed var(--card-border);
  border-radius: 8px;
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: #fdf8f6;
}

.upload-zone svg {
  width: 40px;
  height: 40px;
  color: var(--muted);
  margin-bottom: 12px;
}

.upload-zone h3 {
  font-size: 1rem;
  margin-bottom: 6px;
}

.upload-zone p {
  font-size: 0.85rem;
  color: var(--muted);
}

.upload-zone input[type="file"] {
  display: none;
}

.upload-zone > * {
  pointer-events: none;
}

/* Error Message */
.error-message {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--red);
  margin-top: 12px;
}

/* Screen 3 Specific */
.screen3-top-bar {
  background: #faf9f7;
  border-radius: 8px 8px 0 0;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--heading);
  margin: 16px 32px 0;
  border-bottom: 1px solid var(--card-border);
}

.green-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.screen3-quick-stats {
  display: flex;
  justify-content: space-around;
  padding: 16px 32px;
  border-bottom: 1px solid var(--card-border);
  margin: 0 32px;
}

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

.quick-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--heading);
}

.quick-stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.screen3-heading {
  font-size: 1.3rem;
  margin: 24px 0 8px;
}

.screen3-subtext {
  font-size: 0.9rem;
  color: var(--body);
  margin-bottom: 4px;
}

.screen3-muted {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 16px;
}

/* Download Items */
.download-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid #f0eeeb;
  gap: 12px;
}

.download-item:last-child {
  border-bottom: none;
}

.download-item-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.download-num {
  color: var(--muted);
  font-size: 0.85rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.download-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--heading);
}

.download-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
}

.download-tag.recommended {
  background: #ecfdf5;
  color: var(--green);
}

.download-tag.optional {
  background: #f5f5f4;
  color: var(--muted);
}

.download-hook {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.5;
}

.download-hook em {
  font-style: italic;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.2s;
  flex-shrink: 0;
}

.download-btn:hover {
  border-color: var(--accent);
}

/* Welcome Banner */
.welcome-banner-card {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.welcome-banner-card p {
  font-size: 0.9rem;
  color: #1e40af;
}

.welcome-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Dashboard Layout */
.dashboard-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Dashboard Nav */
.dashboard-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 32px;
}

.dashboard-nav h2 {
  font-size: 1.2rem;
}

.dashboard-home-link {
  color: #1a1a1a;
  text-decoration: none;
}
.dashboard-home-link:hover {
  color: #c85d3b;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Sample Banner */
.sample-banner {
  background: #fef3cd;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.sample-banner p {
  font-size: 0.9rem;
  color: #92400e;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
  align-items: stretch;
}

.kpi-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.kpi-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 20px;
}

.kpi-card .kpi-label {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.kpi-card .kpi-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--heading);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.kpi-card .kpi-sub {
  font-size: 0.76rem;
  color: var(--muted);
  margin-top: 4px;
}

.kpi-value.green { color: var(--green); }
.kpi-value.red { color: var(--red); }
.kpi-value.amber { color: var(--amber); }

/* Secondary Metrics Row */
.secondary-metrics {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f0eeeb;
  border-radius: 8px;
  padding: 10px 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 8px;
}

.secondary-metric {
  font-size: 0.82rem;
  color: var(--muted);
}

.secondary-metric strong {
  color: var(--heading);
  font-weight: 600;
}

/* Chart Cards */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.chart-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 20px;
  opacity: 0;
  animation: fadeIn 0.6s ease forwards;
}

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

.chart-card h3 {
  font-size: 0.95rem;
  margin-bottom: 14px;
}

.chart-card canvas {
  width: 100% !important;
  max-height: 300px;
}

/* Engagement segment chart is a single stacked bar - shorter */
#engagement-chart { max-height: 80px; }

.engagement-explanation {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 8px;
  columns: 2;
  column-gap: 16px;
}
.engagement-explanation p { margin: 0 0 4px 0; break-inside: avoid; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
@media (max-width: 768px) { .engagement-explanation { columns: 1; } }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.chart-card:nth-child(1) { animation-delay: 0s; }
.chart-card:nth-child(2) { animation-delay: 0.1s; }
.chart-card:nth-child(3) { animation-delay: 0.15s; }
.chart-card:nth-child(4) { animation-delay: 0.2s; }
.chart-card:nth-child(5) { animation-delay: 0.25s; }

/* Insight Cards */
.insight-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.insight-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 20px;
}

.insight-card h3 {
  font-size: 0.92rem;
  margin-bottom: 4px;
}

.insight-card .insight-value {
  font-size: 1.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--heading);
}

.insight-card .insight-desc {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
}

.insight-card .section-list {
  list-style: none;
  margin-top: 8px;
}

.insight-card .section-list li {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 4px 0;
  border-bottom: 1px solid var(--grid-line);
}

.insight-card .section-list li:last-child {
  border-bottom: none;
}

.insight-card .section-list .count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Health Score Badge (KPI card) */
.health-score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  line-height: 1;
}

.health-score-badge.health-good { background: var(--green); }
.health-score-badge.health-fair { background: var(--amber); }
.health-score-badge.health-poor { background: var(--red); }

/* Health Score Detail Card */
.health-detail-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 32px;
}

.health-detail-card h3 {
  font-size: 0.95rem;
  margin-bottom: 14px;
}

.health-components {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.health-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.health-bar-label {
  font-size: 0.82rem;
  color: var(--body);
  width: 120px;
  flex-shrink: 0;
}

.health-bar-track {
  flex: 1;
  height: 8px;
  background: #f0eeeb;
  border-radius: 4px;
  overflow: hidden;
}

.health-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s;
}

.health-bar-value {
  font-size: 0.82rem;
  font-weight: 600;
  text-align: right;
  width: 40px;
  flex-shrink: 0;
}

/* Benchmark Labels */
.benchmark-label {
  font-size: 0.78rem;
  display: inline;
}

.benchmark-above { color: var(--green); }
.benchmark-avg { color: var(--amber); }
.benchmark-below { color: var(--red); }

.insight-value.green { color: var(--green); }
.insight-value.amber { color: var(--amber); }
.insight-value.red { color: var(--red); }

/* Data Sections */
.data-section {
  margin-bottom: 32px;
  padding-top: 12px;
  border-top: 1px solid var(--card-border);
}

.data-section h2 {
  font-size: 1.3rem;
  margin-bottom: 16px;
}

/* Delta Badges */
.delta-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-top: 6px;
}

.delta-badge.positive {
  background: #ecfdf5;
  color: #059669;
}

.delta-badge.negative {
  background: #fef2f2;
  color: #dc2626;
}

.delta-badge.neutral {
  background: #f5f5f5;
  color: #8a8a8a;
}

/* Changes Summary */
.changes-summary {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 32px;
}

.changes-summary h3 {
  font-size: 0.95rem;
  margin-bottom: 14px;
}

.changes-grid {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.change-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.change-label {
  font-size: 0.78rem;
  color: var(--muted);
}

.change-value {
  font-size: 1.1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--heading);
}

.change-value.positive { color: var(--green); }
.change-value.negative { color: var(--red); }

.change-date {
  font-style: italic;
}

/* Inline Upload Area */
.inline-upload {
  display: none;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}

.inline-upload.visible {
  display: block;
}

.inline-upload .upload-zone {
  margin: 0;
  padding: 28px 20px;
}

/* Teaser Cards */
.teaser-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.teaser-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.teaser-card .teaser-mock {
  height: 100px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 80'%3E%3Cpolyline points='10,70 40,50 70,55 100,30 130,35 160,15 190,25' fill='none' stroke='%232563eb' stroke-width='3' opacity='0.5'/%3E%3Crect x='30' y='50' width='16' height='30' rx='2' fill='%23059669' opacity='0.35'/%3E%3Crect x='60' y='35' width='16' height='45' rx='2' fill='%23059669' opacity='0.35'/%3E%3Crect x='90' y='40' width='16' height='40' rx='2' fill='%23059669' opacity='0.35'/%3E%3Crect x='120' y='25' width='16' height='55' rx='2' fill='%23059669' opacity='0.35'/%3E%3Crect x='150' y='45' width='16' height='35' rx='2' fill='%23059669' opacity='0.35'/%3E%3C/svg%3E") center/cover no-repeat,
    linear-gradient(135deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  border-radius: 8px;
  margin-bottom: 16px;
  filter: blur(3px);
  opacity: 0.6;
}

.teaser-card h3 {
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.teaser-card p {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.teaser-slim {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.teaser-slim p {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
}

.teaser-icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--muted);
  transition: border-color 0.2s, color 0.2s;
}

.teaser-icon-only:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.nudge-dismiss {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1rem;
  padding: 2px 6px;
  line-height: 1;
}

.nudge-dismiss:hover {
  color: var(--heading);
}

/* History Section */
.history-section {
  margin-bottom: 24px;
  padding-top: 12px;
  border-top: 1px solid var(--card-border);
}

.history-section h2 {
  font-size: 1.3rem;
  margin-bottom: 14px;
}

.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.history-row .history-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-row .history-date {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--heading);
}

.history-row .history-count {
  font-size: 0.78rem;
  color: var(--muted);
}

.history-row .history-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-row .history-actions-row button,
.history-row .history-actions-row select {
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--body);
}

.history-row .history-actions-row button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.history-row .history-actions-row .delete-btn {
  color: var(--red);
  border-color: transparent;
  background: none;
}

.history-row .history-actions-row .delete-btn:hover {
  background: #fef2f2;
}

.history-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* Data Info Section */
.data-info-section {
  margin-bottom: 32px;
}

.data-info-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-heading);
  font-size: 0.92rem;
  color: var(--heading);
  padding: 8px 0;
}

.data-info-toggle:hover {
  color: var(--accent);
}

.data-info-arrow {
  font-size: 0.65rem;
  transition: transform 0.2s;
}

.data-info-arrow.expanded {
  transform: rotate(90deg);
}

.data-info-content p {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.6;
  max-width: 640px;
  padding-top: 8px;
}

/* Footer */
.dashboard-footer {
  text-align: center;
  padding: 24px 0 16px;
  margin-top: 32px;
  border-top: 1px solid #e8e4df;
  font-size: 13px;
  color: #94a3b8;
}
.dashboard-footer a {
  color: #64748b;
  text-decoration: none;
}
.dashboard-footer a:hover {
  color: #c85d3b;
}

.site-footer {
  padding: 28px 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
  border-top: 1px solid var(--card-border);
}

.site-footer a {
  color: var(--accent);
  text-decoration: none;
}

/* Confirmation card */
.url-confirmation {
  background: #faf9f7;
  border: 1px solid #e8e4df;
  border-radius: 8px;
  padding: 16px;
  margin: 12px 0;
}

.url-confirmation .pub-name {
  font-family: 'Charter', 'Georgia', serif;
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.url-confirmation .pub-latest {
  font-size: 14px;
  color: #4a4a4a;
  margin-bottom: 2px;
}

.url-confirmation .pub-date {
  font-size: 12px;
  color: #8a8a8a;
}

/* URL status messages */
.url-error {
  color: #c85d3b;
  font-size: 13px;
  margin-top: 6px;
}

.url-checking {
  color: #8a8a8a;
  font-size: 13px;
  margin-top: 6px;
}

/* Upload zone pulse animation */
@keyframes pulse-border {
  0% { border-color: #d4cfc8; }
  50% { border-color: #c85d3b; }
  100% { border-color: #d4cfc8; }
}

.upload-zone-pulse {
  animation: pulse-border 1s ease-in-out;
}

/* Download item done state */
.dl-item.done {
  background: #f0fdf4;
  border-radius: 8px;
  padding: 12px;
  margin: -4px -12px;
}

.dl-item.done .dl-num {
  color: #059669;
}

.dl-item.done .dl-btn {
  color: #059669;
  border-color: #a7f3d0;
}

/* Download item states */
.dl-item.downloading .dl-btn {
  color: #8a8a8a;
  border-color: #e8e4df;
  pointer-events: none;
}

.dl-item.downloaded .dl-btn {
  color: #059669;
  border-color: #a7f3d0;
  background: #f0fdf4;
}

.dl-item.uploaded {
  background: #f0fdf4;
  border-radius: 8px;
  margin-left: -12px;
  margin-right: -12px;
  padding-left: 12px;
  padding-right: 12px;
}

.dl-item.uploaded .dl-num {
  color: #059669;
}

/* Full dashboard ready prompt */
.all-uploaded-prompt {
  background: #f0fdf4;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  margin-top: 16px;
}

.all-uploaded-prompt p {
  font-size: 14px;
  color: #065f46;
  margin-bottom: 12px;
}

/* Welcome banner */
.welcome-banner {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.welcome-banner .wb-text {
  flex: 1;
  font-size: 14px;
  color: #1e40af;
}

.welcome-banner .wb-text strong {
  color: #1e40af;
}

/* Instructions */
.instructions {
  background: #faf9f7;
  border-radius: 8px;
  padding: 20px 20px 20px 24px;
  margin-bottom: 24px;
}

.instructions ol {
  margin: 0;
  padding-left: 20px;
  font-size: 0.9rem;
  color: #4a4a4a;
  line-height: 1.6;
}

.instructions a {
  color: #c85d3b;
  text-decoration: none;
  font-weight: 600;
}

.instructions a:hover {
  text-decoration: underline;
}

/* Landing page sections */
.landing-hero {
  text-align: center;
  max-width: 960px;
  margin: 0 auto;
  padding: 80px 0 40px;
}

.landing-hero h1 {
  font-family: 'Charter', 'Georgia', serif;
  font-size: 2.5rem;
  color: #1a1a1a;
  margin-bottom: 16px;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.landing-hero .subtitle {
  font-size: 1.15rem;
  color: #4a4a4a;
  margin-bottom: 12px;
  line-height: 1.5;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.landing-hero .trust-line {
  font-size: 0.9rem;
  color: #8a8a8a;
  margin-bottom: 32px;
}

.url-input-section {
  max-width: 520px;
  margin: 0 auto 40px;
  text-align: center;
}

.url-input-section label {
  display: block;
  font-family: 'Charter', 'Georgia', serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: #1a1a1a;
}

.url-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.url-input-row input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #e8e4df;
  border-radius: 8px;
  font-size: 15px;
  outline: none;
}

.url-input-row input:focus {
  border-color: #c85d3b;
}

.how-it-works {
  max-width: 960px;
  margin: 0 auto;
  padding: 60px 0;
  text-align: center;
}

.how-it-works h2 {
  font-family: 'Charter', 'Georgia', serif;
  font-size: 1.8rem;
  margin-bottom: 40px;
}

.steps-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 32px;
  text-align: center;
}

.step-item h3 {
  font-family: 'Charter', 'Georgia', serif;
  font-size: 1rem;
  margin-bottom: 8px;
}

.step-item p {
  font-size: 0.85rem;
  color: #8a8a8a;
}

.step-icon {
  width: 56px;
  height: 56px;
  background: #fdf0ec;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin: 0 auto 12px;
}

.features-section {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 0 60px;
}

.features-section h2 {
  font-family: 'Charter', 'Georgia', serif;
  font-size: 1.8rem;
  text-align: center;
  margin-bottom: 40px;
}

.features-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
}

.feature-card {
  background: white;
  border: 1px solid #e8e4df;
  border-radius: 12px;
  padding: 24px;
}

.feature-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.feature-title {
  font-family: Charter, Georgia, serif;
  font-size: 17px;
  margin: 0 0 6px;
}

.feature-desc {
  font-size: 14px;
  color: #64748b;
  margin: 0;
  line-height: 1.5;
}

.feature-pro-badge {
  background: #c85d3b;
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  vertical-align: middle;
  margin-left: 6px;
}

.feature-card h3 {
  font-family: 'Charter', 'Georgia', serif;
  font-size: 1rem;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 0.85rem;
  color: #8a8a8a;
  line-height: 1.5;
}

.privacy-section {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 0 60px;
  text-align: center;
}

.privacy-section h2 {
  font-family: 'Charter', 'Georgia', serif;
  font-size: 1.5rem;
  margin-bottom: 16px;
}

.privacy-section p {
  font-size: 0.95rem;
  color: #4a4a4a;
  line-height: 1.7;
  max-width: 640px;
  margin: 0 auto;
}

.privacy-section a {
  color: #c85d3b;
  text-decoration: none;
}

.landing-footer {
  text-align: center;
  padding: 32px 0;
  border-top: 1px solid #e8e4df;
  font-size: 0.85rem;
  color: #8a8a8a;
}

.landing-footer a {
  color: #c85d3b;
  text-decoration: none;
}

/* Shared dashboard table styles */
.post-table-container,
.sq-table-wrap,
.cr-table-wrap { overflow-x: auto; margin-top: 16px; }

.post-table,
.quality-table,
.cohort-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  font-family: var(--font-body);
}

.post-table th,
.quality-table th,
.cohort-table th {
  background: var(--bg);
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--heading);
  border-bottom: 2px solid var(--card-border);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.post-table th:hover,
.quality-table th:hover,
.cohort-table th:hover { background: #f0eeeb; }

.post-table th .sort-arrow,
.quality-table th .sort-arrow,
.cohort-table th .sort-arrow { margin-left: 4px; font-size: 0.7rem; opacity: 0.4; }

.post-table th.active .sort-arrow,
.quality-table th.active .sort-arrow,
.cohort-table th.active .sort-arrow { opacity: 1; }

.post-table td,
.quality-table td,
.cohort-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f0ece7;
  vertical-align: middle;
}

.post-table tr:nth-child(even),
.quality-table tr:nth-child(even),
.cohort-table tr:nth-child(even) { background: #faf9f7; }

.post-table .col-num,
.quality-table .col-num,
.cohort-table .col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Rate coloring (shared) */
.rate-above { color: var(--green); font-weight: 600; }
.rate-below { color: var(--red); font-weight: 600; }
.rate-amber { color: var(--amber); font-weight: 600; }

/* Post table specifics */
.post-table .col-title { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-table .audience-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.72rem; font-weight: 600;
}
.audience-everyone { background: #eff6ff; color: #1e40af; }
.audience-paid { background: #fef3cd; color: #92400e; }


/* Source quality specifics */
.retention-cell { padding: 6px 12px; border-radius: 4px; font-weight: 600; text-align: center; min-width: 60px; display: inline-block; }
.engagement-bar-cell { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.engagement-bar-cell .bar { width: 40px; height: 6px; border-radius: 3px; flex-shrink: 0; background: var(--grid-line); overflow: hidden; display: inline-block; }
.engagement-bar-cell .bar-inner { display: block; height: 100%; border-radius: 3px; }
.engagement-bar-cell > span:last-child { font-variant-numeric: tabular-nums; min-width: 24px; text-align: right; font-size: 0.82rem; }

/* Insight explanation and health interpretation */
.insight-explanation { margin-top: 8px; font-size: 0.78rem; color: var(--muted); line-height: 1.4; }
.insight-explanation .insight-action { margin-top: 4px; color: var(--body); }
.insight-benchmark { font-size: 0.78rem; margin-top: 4px; }
.health-interpretation { font-size: 0.82rem; color: var(--body); line-height: 1.5; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--card-border); }

/* Chart time filter buttons */
.chart-time-filter { display: flex; gap: 4px; margin-bottom: 8px; justify-content: flex-end; }
.time-btn { padding: 4px 10px; border: 1px solid var(--card-border); border-radius: 4px; background: white; color: var(--body); font-size: 0.75rem; font-weight: 600; cursor: pointer; font-family: var(--font-body); }
.time-btn:hover { background: var(--bg); }
.time-btn.active { background: var(--heading); color: white; border-color: var(--heading); }

/* Section subtitle and note */
.section-subtitle { font-size: 0.88rem; color: var(--body); margin-top: -8px; margin-bottom: 16px; }
.section-note { font-size: 0.78rem; color: var(--muted); margin-bottom: 12px; }
.show-all-toggle { display: inline-block; margin-top: 8px; font-size: 0.82rem; color: var(--accent); cursor: pointer; border: none; background: none; padding: 0; }
.show-all-toggle:hover { text-decoration: underline; }

/* Revenue KPI grid */
.kpi-grid-revenue {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
  align-items: stretch;
}

/* Conversion funnel */
.conversion-funnel {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.funnel-stat { display: flex; flex-direction: column; align-items: center; }
.funnel-num { font-size: 1.5rem; font-weight: 700; color: var(--heading); font-variant-numeric: tabular-nums; }
.funnel-label { font-size: 0.78rem; color: var(--muted); }
.funnel-arrow { font-size: 1.2rem; color: var(--muted); }
.funnel-highlight {
  padding: 12px 20px;
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--card-border);
}
.funnel-benchmark { font-size: 0.75rem; font-weight: 600; margin-top: 2px; }

/* Responsive */
@media (max-width: 768px) {
  .onboarding-heading {
    font-size: 1.4rem;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .kpi-grid-3,
  .kpi-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .post-table .col-delivered,
  .post-table .col-comments,
  .post-table .col-shares,
  .post-table .col-score { display: none; }
  .post-table .col-title { max-width: 120px; }

  .quality-table .col-revenue,
  .quality-table .col-activity { display: none; }

  .conversion-funnel { flex-direction: column; align-items: stretch; text-align: center; }
  .funnel-arrow { transform: rotate(90deg); }

  .chart-grid {
    grid-template-columns: 1fr;
  }

  .insight-grid {
    grid-template-columns: 1fr;
  }

  .teaser-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-nav {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .sample-banner {
    flex-direction: column;
    text-align: center;
  }

  .secondary-metrics {
    justify-content: center;
    text-align: center;
  }

  .screen3-quick-stats {
    flex-wrap: wrap;
    gap: 12px;
  }

  .download-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .steps-grid,
  .features-grid {
    grid-template-columns: 1fr;
  }

  .welcome-banner {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .kpi-grid,
  .kpi-grid-3,
  .kpi-grid-4,
  .kpi-grid-revenue {
    grid-template-columns: 1fr;
  }

  .kpi-card { padding: 16px; }
  .chart-card { padding: 16px; }
  .insight-card { padding: 16px; }

  .input-row {
    flex-direction: column;
  }

  .onboarding-container {
    padding: 40px 16px 24px;
  }

  .upload-zone {
    padding: 28px 16px;
  }
}

/* Upload modal */
.upload-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.upload-modal-overlay.hidden {
  display: none;
}

.upload-modal {
  background: white;
  border-radius: 12px;
  padding: 28px;
  max-width: 480px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

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

.upload-modal-header h3 {
  font-family: 'Charter', 'Georgia', serif;
  font-size: 1.1rem;
  color: #1a1a1a;
}

.upload-modal-header .btn-text {
  font-size: 24px;
  color: #8a8a8a;
  cursor: pointer;
  padding: 0 4px;
  background: none;
  border: none;
}

.upload-modal-desc {
  font-size: 13px;
  color: #6a6a6a;
  margin-bottom: 16px;
  line-height: 1.5;
}

.upload-modal-zone {
  border-radius: 12px;
}

.source-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e8e4df;
  color: #64748b;
  font-size: 9px;
  font-weight: 700;
  font-style: normal;
  margin-left: 4px;
  cursor: help;
  vertical-align: middle;
}

.source-info:hover {
  background: #c85d3b;
  color: white;
}

/* Pro launch banner */
.pro-launch-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fef9f0;
  border: 1px solid #e8e4df;
  border-left: none;
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 16px;
  margin-bottom: 20px;
  font-size: 14px;
  color: #1a1a1a;
}
.pro-launch-banner p {
  margin: 0;
  flex: 1;
}
.pro-banner-link {
  color: #c85d3b;
  text-decoration: underline;
  font-weight: 600;
}
.pro-banner-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #94a3b8;
  cursor: pointer;
  padding: 0 0 0 12px;
  line-height: 1;
}
.pro-banner-close:hover {
  color: #64748b;
}

/* Dashboard footer extras */
.dashboard-footer-dot {
  margin: 0 6px;
}
.dashboard-footer-privacy {
  color: #94a3b8;
  font-style: italic;
}

/* Sample report text link */
.sample-report-link {
  color: #64748b;
  text-decoration: underline;
  font-size: 14px;
  cursor: pointer;
  display: inline-block;
  margin-top: 12px;
}
.sample-report-link:hover {
  color: #c85d3b;
}

.feedback-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  color: #374151;
  border: 1px solid #e8e4df;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.2s, border-color 0.2s;
  z-index: 1000;
}
.feedback-fab:hover {
  border-color: #c85d3b;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  color: #c85d3b;
}
.feedback-fab svg {
  flex-shrink: 0;
}
.feedback-fab-text {
  white-space: nowrap;
}
@media (max-width: 600px) {
  .feedback-fab-text { display: none; }
  .feedback-fab { padding: 12px; border-radius: 50%; }
}

/* Tooltip system */
[data-tooltip] {
  position: relative;
  cursor: help;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: #2a2a2a;
  color: #f7f5f2;
  padding: 7px 11px;
  border-radius: 6px;
  font-size: 0.77rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 400;
  line-height: 1.45;
  white-space: normal;
  width: 230px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 200;
  text-align: left;
}
[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #2a2a2a;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 200;
}
[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
  opacity: 1;
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e8e4df;
  color: #8a8a8a;
  font-size: 0.65rem;
  font-style: normal;
  font-weight: 600;
  cursor: help;
  margin-left: 4px;
  vertical-align: middle;
  flex-shrink: 0;
  position: relative;
}
