@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  --primary: #2C3E50;
  --primary-light: #8E44AD;
  --primary-dark: #9B59B6;
  --accent: #F39C12;
  --accent-light: #ECF0F1;
  --bg: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-elevated: #F1F5F9;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --sev-mild: #6EE7B7;
  --sev-moderate: #FCD34D;
  --sev-significant: #FB923C;
  --sev-severe: #F87171;
  --sev-extreme: #DC2626;
  --heat-0: #F1F5F9;
  --heat-1: #D1FAE5;
  --heat-2: #FEF3C7;
  --heat-3: #FED7AA;
  --heat-4: #FECACA;
  --heat-5: #FCA5A5;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.06), 0 4px 6px -4px rgba(0,0,0,0.04);
}

::selection {
  background: var(--primary-light);
  color: white;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: 80px;
}

/* Header */
.app-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  padding: 28px 20px 24px;
  color: white;
  position: relative;
  overflow: hidden;
}

.app-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 60%);
  border-radius: 50%;
}

.app-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  position: relative;
}

.app-subtitle {
  font-size: 0.85rem;
  font-weight: 400;
  opacity: 0.8;
  margin-top: 4px;
  position: relative;
}

/* Tab Bar */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.04);
}

.tab-btn {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s ease;
  font-family: inherit;
}

.tab-btn:hover {
  color: var(--text-secondary);
}

.tab-active {
  color: var(--primary);
  background: rgba(79, 70, 229, 0.06);
}

.tab-icon {
  font-size: 1.2rem;
}

.tab-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Content */
.app-content {
  padding: 16px;
  max-width: 720px;
  margin: 0 auto;
}

/* Form Styles */
.logger-container {
  animation: fadeIn 0.3s ease;
}

.logger-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.type-grid, .trigger-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.type-chip, .trigger-chip {
  padding: 8px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.type-chip:hover, .trigger-chip:hover {
  border-color: var(--primary-light);
  color: var(--primary);
}

.type-chip-active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.type-chip-active:hover {
  color: white;
  border-color: var(--primary-dark);
}

.trigger-chip-active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.trigger-chip-active:hover {
  color: white;
  border-color: var(--accent);
}

.form-input, .form-textarea {
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg-card);
  color: var(--text-primary);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
  min-height: 48px;
}

.form-input:focus, .form-textarea:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-textarea {
  resize: vertical;
}

/* Severity */
.severity-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: none;
}

.severity-mild { background: var(--sev-mild); color: #065F46; }
.severity-moderate { background: var(--sev-moderate); color: #78350F; }
.severity-significant { background: var(--sev-significant); color: #7C2D12; }
.severity-severe { background: var(--sev-severe); color: #7F1D1D; }
.severity-extreme { background: var(--sev-extreme); color: white; }

.severity-slider-container {
  padding: 4px 0;
}

.severity-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--sev-mild), var(--sev-moderate), var(--sev-significant), var(--sev-severe), var(--sev-extreme));
  outline: none;
}

.severity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 3px solid var(--primary);
  cursor: pointer;
  box-shadow: var(--shadow);
}

.severity-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 3px solid var(--primary);
  cursor: pointer;
  box-shadow: var(--shadow);
}

.severity-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}

.severity-dot {
  font-size: 0.7rem;
  font-weight: 600;
  font-family: 'DM Mono', monospace;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.severity-dot.severity-mild { background: var(--sev-mild); color: #065F46; }
.severity-dot.severity-moderate { background: var(--sev-moderate); color: #78350F; }
.severity-dot.severity-significant { background: var(--sev-significant); color: #7C2D12; }
.severity-dot.severity-severe { background: var(--sev-severe); color: #7F1D1D; }
.severity-dot.severity-extreme { background: var(--sev-extreme); color: white; }

.submit-btn {
  padding: 14px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 48px;
}

.submit-btn:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Timeline */
.timeline-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.3s ease;
}

.timeline-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  font-family: 'DM Mono', monospace;
}

.stat-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: 16px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  font-family: inherit;
}

.filter-chip:hover {
  border-color: var(--primary-light);
}

.filter-chip-active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.date-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.date-header {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-left: 4px;
  border-left: 3px solid var(--primary-light);
  padding: 2px 0 2px 10px;
}

.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.timeline-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  animation: slideInUp 0.35s ease both;
}

.timeline-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.card-left {
  flex-shrink: 0;
}

.severity-indicator {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  font-family: 'DM Mono', monospace;
}

.card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.card-type {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.card-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  flex-shrink: 0;
}

.card-triggers {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.trigger-tag {
  font-size: 0.68rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.card-notes {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  font-style: italic;
}

.card-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
  flex-shrink: 0;
  align-self: flex-start;
}

.card-delete:hover {
  background: var(--danger-light);
  color: var(--danger);
}

.card-delete-confirm {
  background: var(--danger);
  color: white;
}

.card-delete-confirm:hover {
  background: var(--danger);
  color: white;
}

/* Heatmap */
.heatmap-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: fadeIn 0.3s ease;
}

.heatmap-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.toggle-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  background: transparent;
  color: var(--text-secondary);
}

.toggle-active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* Hour Grid */
.hour-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

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

.hour-cell {
  padding: 10px 6px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: transform 0.15s ease;
  border: 1px solid transparent;
}

.hour-cell:hover {
  transform: scale(1.05);
  border-color: var(--border);
}

.hour-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
}

.hour-value {
  font-size: 1rem;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
  color: var(--text-primary);
}

.hour-count {
  font-size: 0.6rem;
  color: var(--text-muted);
}

/* Heat Colors */
.heat-0 { background: var(--heat-0); }
.heat-1 { background: var(--heat-1); }
.heat-2 { background: var(--heat-2); }
.heat-3 { background: var(--heat-3); }
.heat-4 { background: var(--heat-4); }
.heat-5 { background: var(--heat-5); }

/* Day-Hour Matrix */
.day-hour-heatmap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.matrix-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.matrix-grid {
  display: grid;
  grid-template-columns: 40px repeat(12, 1fr);
  gap: 3px;
  min-width: 400px;
}

.matrix-corner {
  /* empty top-left */
}

.matrix-hour-label {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  font-family: 'DM Mono', monospace;
  padding: 2px 0;
}

.matrix-row-fragment {
  display: contents;
}

.matrix-day-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  font-family: 'DM Mono', monospace;
}

.matrix-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  min-height: 28px;
  transition: transform 0.15s ease;
  cursor: default;
  border: 1px solid rgba(0,0,0,0.04);
}

.matrix-cell:hover {
  transform: scale(1.15);
  z-index: 2;
}

.heat-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
}

.legend-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
}

.legend-cell {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.04);
}

/* Breakdown */
.breakdown-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.breakdown-row {
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInUp 0.3s ease both;
}

.breakdown-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 90px;
  flex-shrink: 0;
}

.breakdown-bar-track {
  flex: 1;
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 4px;
  overflow: hidden;
}

.breakdown-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
  min-width: 4px;
}

.breakdown-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  white-space: nowrap;
  flex-shrink: 0;
}

.no-data-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Empty & Loading States */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.empty-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.empty-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.skeleton-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-card {
  height: 80px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--border-light) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-wide {
  height: 200px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

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

/* Responsive */
@media (max-width: 640px) {
  .app-header {
    padding: 22px 16px 20px;
  }

  .app-content {
    padding: 12px;
  }

  .timeline-stats {
    gap: 8px;
  }

  .stat-card {
    padding: 10px 8px;
  }

  .stat-value {
    font-size: 1.2rem;
  }

  .breakdown-name {
    min-width: 70px;
    font-size: 0.75rem;
  }
}


<!-- WALKTHROUGH_SCRIPT:
[
  {"step": 1, "narration": "Welcome to your Symptom Tracker. This is your timeline — it shows all logged symptoms in chronological order with severity indicators, triggers, and notes.", "view": "user", "highlight_selector": ".timeline-container", "wait_for": "tap_to_continue"},
  {"step": 2, "narration": "Tap the Log tab at the bottom to record a new symptom. Select the symptom type from the list of common chronic condition symptoms.", "view": "user", "highlight_selector": ".tab-btn:nth-child(2)", "wait_for": "user_interaction"},
  {"step": 3, "narration": "Use the severity slider to rate your symptom from 1 to 10. The color changes from green (mild) to red (extreme) to give you instant visual feedback.", "view": "user", "highlight_selector": ".severity-slider-container", "wait_for": "tap_to_continue"},
  {"step": 4, "narration": "Select possible triggers that may have caused this symptom — stress, poor sleep, weather changes, and more. You can select multiple triggers.", "view": "user", "highlight_selector": ".trigger-grid", "wait_for": "tap_to_continue"},
  {"step": 5, "narration": "Add any notes for additional context, then tap Log Symptom. It will appear immediately in your timeline.", "view": "user", "highlight_selector": ".submit-btn", "wait_for": "user_interaction"},
  {"step": 6, "narration": "Back on the Timeline, you'll see summary stats at the top — total logs, unique symptom types, and average severity. Filter by symptom type using the chips.", "view": "user", "highlight_selector": ".timeline-stats", "wait_for": "tap_to_continue"},
  {"step": 7, "narration": "Tap the Heatmap tab to discover patterns. The hourly heatmap shows which times of day your symptoms are most severe.", "view": "user", "highlight_selector": ".tab-btn:nth-child(3)", "wait_for": "user_interaction"},
  {"step": 8, "narration": "Switch to Day × Hour view to see a full weekly heatmap matrix. Darker cells mean higher average severity — helping you spot recurring patterns.", "view": "user", "highlight_selector": ".heatmap-toggle", "wait_for": "tap_to_continue"},
  {"step": 9, "narration": "Below the heatmap, you'll find breakdowns of your most frequent symptoms and most common triggers — essential insights for managing your condition.", "view": "user", "highlight_selector": ".breakdown-section", "wait_for": "tap_to_continue"}
]
-->

.auth-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.auth-gate-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 28px 24px;
  text-align: center;
}

.auth-gate-guest .app-title {
  margin-bottom: 6px;
}

.auth-login-btn {
  width: 100%;
  margin-top: 20px;
}

.app-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.auth-logout-btn {
  background: rgba(255,255,255,0.14);
  color: white;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.auth-logout-btn:hover {
  background: rgba(255,255,255,0.2);
}

.auth-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  position: relative;
}

.auth-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255,255,255,0.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.auth-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-user-name {
  color: rgba(255,255,255,0.92);
  font-size: 0.9rem;
  font-weight: 600;
}

@media (max-width: 640px) {
  .app-header-row {
    align-items: center;
  }

  .auth-gate-card {
    padding: 24px 18px;
  }
}

.filter-panel {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 10px;
  align-items: end;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-search,
.filter-select {
  min-height: 44px;
}

.filter-select {
  appearance: none;
  padding-right: 40px;
}

.empty-state-compact {
  padding: 32px 20px;
}

@media (max-width: 640px) {
  .filter-panel {
    grid-template-columns: 1fr;
  }
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px;
}

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

.chart-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.chart-canvas-wrap {
  width: 100%;
  min-height: 240px;
}

.chart-canvas-wrap canvas {
  width: 100% !important;
  height: 240px !important;
}

@media (min-width: 641px) {
  .charts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .charts-grid .chart-card:last-child {
    grid-column: 1 / -1;
  }
}

.pdf-export-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pdf-export-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.pdf-export-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.pdf-export-btn {
  min-height: 44px;
  white-space: nowrap;
}

.pdf-export-note {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.pdf-report-container {
  position: absolute;
  left: 0;
  top: 0;
  width: 800px;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

.pdf-report-page {
  width: 800px;
  padding: 32px;
  background: white;
  color: #0F172A;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.pdf-report-header {
  margin-bottom: 20px;
}

.pdf-report-header h1 {
  font-size: 26px;
  margin-bottom: 6px;
}

.pdf-report-header p {
  color: #475569;
  font-size: 13px;
}

.pdf-report-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #E2E8F0;
}

.pdf-report-section h2 {
  font-size: 18px;
  margin-bottom: 8px;
}

.pdf-report-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: #475569;
  margin-bottom: 10px;
}

.pdf-report-list {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: #0F172A;
}

@media (max-width: 640px) {
  .pdf-export-grid {
    grid-template-columns: 1fr;
  }
}

.export-action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.export-data-btn {
  flex: 1;
  min-width: 140px;
}

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

.export-json-btn:hover:not(:disabled) {
  background: #0891B2;
}

@media (max-width: 640px) {
  .export-data-btn {
    min-width: 0;
  }
}
