:root {
  /* Modern SaaS Color Palette */
  --primary: #6366f1;
  /* Indigo 500 */
  --primary-hover: #4f46e5;
  /* Indigo 600 */
  --secondary: #ec4899;
  /* Pink 500 */
  --bg-color: #f8fafc;
  /* Slate 50 */
  --card-bg: #ffffff;
  --text-main: #0f172a;
  /* Slate 900 */
  --text-muted: #64748b;
  /* Slate 500 */
  --border-color: #e2e8f0;
  /* Slate 200 */

  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

main {
  flex: 1;
}

html {
  scroll-behavior: smooth;
}

/* Global link styling (in-body links like email) */
a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Top nav + hero */
.page-header {
  position: relative;
}

.page-header::before {
  content: '';
  position: absolute;
  top: -160px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 520px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.18) 0%, rgba(255, 255, 255, 0) 70%);
  filter: blur(50px);
  z-index: -1;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 1.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 700;
}

.brand-mark {
  width: 14px;
  height: 14px;
  border-radius: 6px;
  background: var(--gradient-primary);
  box-shadow: var(--shadow-sm);
}

.brand-name {
  letter-spacing: -0.01em;
}

.nav-links {
  display: none;
  gap: 1rem;
  align-items: center;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.35rem 0.4rem;
  border-radius: 10px;
}

.nav-links a:hover {
  color: var(--text-main);
  background: rgba(99, 102, 241, 0.08);
}

.nav-cta {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-link-muted {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}

.nav-link-muted:hover {
  color: var(--text-main);
}

.btn-ghost {
  border: 1px solid var(--border-color);
  background: white;
  color: var(--text-main);
  padding: 0.55rem 1rem;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.btn-ghost:hover {
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding: 3rem 0 1.5rem;
}

.hero-copy h1 {
  font-size: 3.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 1rem;
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.15rem;
  max-width: 640px;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  margin: 1.5rem 0 1rem;
  flex-wrap: wrap;
}

.btn-secondary {
  background: white;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  transform: translateY(-1px);
  border-color: rgba(99, 102, 241, 0.35);
}

.hero-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pill {
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-muted);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  font-size: 0.9rem;
  box-shadow: var(--shadow-sm);
}

.hero-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  padding: 1.25rem;
}

.mini-doc {
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
}

.mini-doc-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(to right, #f8fafc, #ffffff);
  border-bottom: 1px solid var(--border-color);
}

.mini-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #e2e8f0;
}

.mini-title {
  margin-left: 0.4rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.mini-doc-body {
  padding: 1rem;
  display: grid;
  gap: 0.65rem;
}

.mini-line {
  height: 10px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.18);
}

.mini-block {
  height: 120px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.10);
  border: 1px solid rgba(99, 102, 241, 0.15);
}

.w-55 { width: 55%; }
.w-60 { width: 60%; }
.w-70 { width: 70%; }
.w-75 { width: 75%; }
.w-85 { width: 85%; }

/* Sections */
.section {
  padding: 4rem 0;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.10em;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.section h2 {
  font-size: 2.1rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.section-subtitle {
  color: var(--text-muted);
  margin-top: 0.5rem;
  max-width: 720px;
}

.section-subtitle a {
  font-weight: 600;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

/* Allow grid children to shrink; prevents wide tables from expanding the page */
.grid-two > * {
  min-width: 0;
}

/* Card Styles */
.card {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  padding: 2.5rem;
  border: 1px solid var(--border-color);
  min-width: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-soft {
  background: linear-gradient(to bottom right, rgba(99, 102, 241, 0.06), rgba(255, 255, 255, 0.85));
}

/* File Upload Zone */
.form-group {
  margin-bottom: 2rem;
}

.file-input-wrapper {
  position: relative;
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  padding: 4rem 2rem;
  text-align: center;
  transition: all 0.3s ease;
  background: #f8fafc;
  cursor: pointer;
  overflow: hidden;
  min-width: 0;
}

.file-input-wrapper:hover,
.file-input-wrapper.drag-active {
  border-color: var(--primary);
  background: #eef2ff;
  transform: scale(1.005);
}

input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-icon {
  font-size: 3rem;
  color: var(--primary);
  margin-bottom: 1rem;
  display: block;
}

.file-label-text strong {
  display: block;
  font-size: 1.2rem;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

/* Try Sample Hint */
.try-sample-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 1rem;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(168, 85, 247, 0.05) 100%);
  border-radius: 8px;
  border: 1px dashed var(--border-color);
}

.try-sample-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s;
  font-family: inherit;
}

.try-sample-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.try-sample-link:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  text-decoration: none;
}

/* Inputs & Buttons */
label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-main);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

textarea {
  width: 100%;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
  min-height: 120px;
  transition: all 0.2s;
  background: #f8fafc;
}

textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1.1rem;
  cursor: pointer;
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.4);
}

#submit-btn.btn-primary {
  width: 100%;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.5);
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.file-hint {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0.85;
}

/* Status & feedback */
#status {
  margin: 1.5rem 0;
  padding: 1rem;
  border-radius: 12px;
  display: none;
  text-align: center;
  font-weight: 500;
  animation: slideDown 0.3s ease;
}

.actions {
  display: none;
  margin-bottom: 2rem;
  text-align: right;
}

.actions .btn-secondary {
  width: auto;
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.status-loading {
  background-color: #eef2ff;
  color: var(--primary);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.status-error {
  background-color: #fef2f2;
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.status-success {
  background-color: #f0fdf4;
  color: #16a34a;
  border: 1px solid rgba(22, 163, 74, 0.2);
}

/* Data Preview */
#preview-container {
  margin-top: 2.5rem;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  display: none;
  max-width: 100%;
  background: white;
  box-shadow: var(--shadow-md);
  animation: slideDown 0.4s ease;
}

#preview-content {
  max-width: 100%;
  overflow-x: auto;
}

#preview-header {
  background: linear-gradient(to right, #f8fafc, #ffffff);
  padding: 1.25rem 2rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-main);
}

#preview-info {
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.preview-table-wrapper {
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: block;
  max-height: 400px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.preview-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  /* Allows border-radius on rows if needed */
  border-spacing: 0;
  font-size: 0.95rem;
  color: var(--text-main);
}

.preview-table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  padding: 1.25rem 1.5rem;
  /* Spacious padding */
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.preview-table td {
  padding: 1.25rem 1.5rem;
  /* Spacious padding */
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  transition: background-color 0.1s;
}

.preview-table tr:last-child td {
  border-bottom: none;
}

.preview-table tr:hover td {
  background-color: #f1f5f9;
}

/* Scrollbar styling for Webkit */
.preview-table-wrapper::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.preview-table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.preview-table-wrapper::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 4px;
}

/* Report Grid Layout */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

/* Chart actions (Sparkle + Drawer) */
.chart-card {
  background: white;
  border-radius: 16px;
  overflow: visible;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: relative;
  cursor: pointer;
}

.chart-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.chart-card-inner {
  border-radius: 16px;
  overflow: hidden;
  background: white;
  width: 100%;
  min-width: 0;
}

.chart-card-inner .vega-embed,
.chart-card-inner canvas {
  pointer-events: none;
}

.chart-card-inner .vega-embed {
  width: 100%;
}

.chart-card-inner canvas {
  max-width: 100%;
}

.chart-rendering {
  padding: 0.9rem 1rem;
  margin: 0.75rem;
  border-radius: 12px;
  border: 1px dashed var(--border-color);
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 700;
}

.chart-rendering.is-error {
  border-color: rgba(239, 68, 68, 0.35);
  background: #fef2f2;
  color: #ef4444;
}

.chart-card.is-fading {
  opacity: 0.15;
  transition: opacity 200ms ease;
}

.chart-sparkle {
  position: absolute;
  top: 14px;
  z-index: 20;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.16), rgba(255, 255, 255, 0.95));
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: opacity 160ms ease, transform 160ms ease;
}

.chart-sparkle:hover {
  border-color: rgba(99, 102, 241, 0.35);
  transform: scale(1.04);
}

/* Chart card actions - always visible */
.chart-card-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 20;
  display: flex;
  gap: 8px;
}

.chart-card-actions .chart-sparkle {
  position: static;
}

.chart-edit-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.14), rgba(255, 255, 255, 0.95));
  color: #16a34a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: opacity 160ms ease, transform 160ms ease;
  font-size: 1rem;
}

.chart-edit-btn:hover {
  border-color: rgba(34, 197, 94, 0.35);
  transform: scale(1.04);
}

/* Chart flyout editor */
.chart-flyout {
  position: fixed;
  width: min(460px, 92vw);
  max-height: min(680px, 86vh);
  overflow: auto;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 1200;
  display: none;
}

.chart-flyout.is-open {
  display: block;
}

.chart-flyout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(to right, #f8fafc, #ffffff);
}

.chart-flyout-title {
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

.chart-flyout-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: white;
  color: var(--text-muted);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  font-size: 1.1rem;
  line-height: 1;
}

.chart-flyout-close:hover {
  color: var(--text-main);
  border-color: rgba(99, 102, 241, 0.35);
}

.chart-flyout-body {
  padding: 1rem 1.1rem 1.1rem;
  display: grid;
  gap: 1.1rem;
}

.chart-flyout-section-title {
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.chart-flyout-subtitle {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.65rem;
}

.chart-flyout-list {
  display: grid;
  gap: 0.9rem;
}

.chart-flyout-empty {
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.85rem 0.9rem;
  border-radius: 12px;
  border: 1px dashed var(--border-color);
  background: #f8fafc;
}

.chart-flyout-form {
  display: grid;
  gap: 0.8rem;
}

.chart-flyout-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.chart-flyout-label {
  display: grid;
  gap: 0.35rem;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.chart-flyout-input,
.chart-flyout-select {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.6rem 0.7rem;
  background: white;
  color: var(--text-main);
  font-weight: 600;
}

.chart-flyout-select:disabled {
  opacity: 0.6;
}

.chart-flyout-primary {
  border: 1px solid rgba(99, 102, 241, 0.25);
  background: rgba(99, 102, 241, 0.10);
  color: var(--primary);
  font-weight: 800;
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
}

.chart-flyout-primary:hover {
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.14);
}

.chart-flyout-secondary {
  border: 1px solid var(--border-color);
  background: white;
  color: var(--text-muted);
  font-weight: 700;
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
}

.chart-flyout-secondary:hover {
  border-color: rgba(99, 102, 241, 0.25);
  color: var(--text-main);
}

.chart-flyout-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.chart-flyout-download-target {
  margin-bottom: 0.6rem;
}

.chart-alt-tile-current {
  border-color: rgba(99, 102, 241, 0.28);
  background: rgba(99, 102, 241, 0.04);
}

.chart-alt-tile-original {
  border-style: dashed;
}

.chart-flyout-btn {
  border: 1px solid var(--border-color);
  background: white;
  color: var(--text-main);
  font-weight: 700;
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
}

.chart-flyout-btn:hover {
  border-color: rgba(99, 102, 241, 0.35);
  color: var(--primary);
}

.chart-flyout-note {
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
}

.chart-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(2px);
  z-index: 1000;
}

.chart-drawer {
  position: fixed;
  top: 0;
  height: 100vh;
  width: min(420px, 92vw);
  background: white;
  border-left: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  transform: translateX(0);
  display: flex;
  flex-direction: column;
}

.chart-drawer.chart-drawer-right {
  right: 0;
  border-left: 1px solid var(--border-color);
  border-right: none;
}

.chart-drawer.chart-drawer-left {
  left: 0;
  border-right: 1px solid var(--border-color);
  border-left: none;
}

.chart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(to right, #f8fafc, #ffffff);
}

.chart-drawer-title {
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

.chart-drawer-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: white;
  color: var(--text-muted);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  font-size: 1.1rem;
  line-height: 1;
}

.chart-drawer-close:hover {
  color: var(--text-main);
  border-color: rgba(99, 102, 241, 0.35);
}

.chart-drawer-subtitle {
  padding: 0.85rem 1.25rem 0;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
}

.chart-drawer-body {
  padding: 1rem 1.25rem 1.25rem;
  overflow-y: auto;
  min-height: 0;
}

.chart-drawer-list {
  display: grid;
  gap: 1rem;
}

.chart-alt-tile {
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: white;
  box-shadow: var(--shadow-sm);
  padding: 0.75rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.chart-alt-tile.is-hovered,
.chart-alt-tile:hover,
.chart-alt-tile:focus {
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  outline: none;
}

.chart-alt-preview {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.9);
  min-height: 170px;
  background: #ffffff;
}

.chart-alt-preview .vega-embed {
  width: 100%;
}

.chart-alt-preview canvas,
.chart-alt-preview svg {
  display: block;
  max-width: 100%;
}

.chart-alt-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.6rem;
}

.chart-alt-badge {
  display: inline-flex;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.chart-alt-action {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
}

.chart-drawer-empty {
  margin-top: 1rem;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.85rem 0.9rem;
  border-radius: 12px;
  border: 1px dashed var(--border-color);
  background: #f8fafc;
}

@media (max-width: 520px) {
  .chart-card-actions { top: 8px; right: 8px; gap: 6px; }
  .chart-sparkle, .chart-edit-btn { width: 34px; height: 34px; font-size: 0.95rem; }
}

/* Report typography */
.report-shell {
  margin-top: 2rem;
}

.report-wrapper {
  display: grid;
  gap: 2rem;
}

.report-render-error {
  border: 1px solid rgba(239, 68, 68, 0.25);
  background: #fef2f2;
  color: #991b1b;
  font-weight: 700;
  border-radius: 14px;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
}

.report-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 1.75rem;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: white;
  box-shadow: var(--shadow-sm);
}

.report-title h1 {
  font-size: 1.8rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-top: 0.5rem;
}

.report-badge {
  display: inline-flex;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.25);
  background: rgba(99, 102, 241, 0.08);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
}

.generated-at {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
}

.report-section {
  padding: 1.5rem 1.75rem;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: white;
  box-shadow: var(--shadow-sm);
}

.section-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  font-weight: 800;
  font-size: 0.75rem;
  margin-bottom: 0.5rem;
}

.report-section h2 {
  font-size: 1.35rem;
  letter-spacing: -0.015em;
}

.chart-highlight {
  margin-top: 1rem;
}

.summary-card {
  margin-top: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.25rem 1.25rem;
  background: var(--bg-color);
}

.summary-body {
  color: var(--text-main);
}

.summary-body p {
  color: var(--text-main);
  margin: 0.5rem 0;
}

.summary-body ul {
  padding-left: 1.25rem;
  margin-top: 0.5rem;
  color: var(--text-main);
}

.chart-toolbar {
  padding: 1rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
}

.refine-btn {
  background: white;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.refine-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Modal */
.modal {
  backdrop-filter: blur(4px);
  background-color: rgba(15, 23, 42, 0.6) !important;
}

.modal-content {
  border-radius: 16px !important;
  box-shadow: var(--shadow-lg) !important;
  border: none !important;
  padding: 2.5rem !important;
}

/* Footer / Contact */
/* Flow stepper/log */
.flow-title {
  font-size: 1.25rem;
  margin-top: 0.25rem;
}

.flow-subtitle {
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.steps {
  list-style: none;
  margin-top: 1.25rem;
  display: grid;
  gap: 0.9rem;
}

.step {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 0.75rem;
  align-items: start;
  padding: 0.75rem 0.75rem;
  border-radius: 14px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  background: rgba(255, 255, 255, 0.8);
}

.step-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #e2e8f0;
  margin-top: 0.25rem;
}

.step-title {
  font-weight: 700;
}

.step-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.15rem;
}

.step.is-active {
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.06);
}

.step.is-active .step-dot {
  background: var(--primary);
}

.step.is-done .step-dot {
  background: #16a34a;
}

.flow-log {
  margin-top: 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  background: white;
  box-shadow: var(--shadow-sm);
}

.flow-log-title {
  padding: 0.9rem 1.1rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(to right, #f8fafc, #ffffff);
}

.flow-log-body {
  padding: 1rem 1.1rem;
  max-height: 220px;
  overflow: auto;
  display: grid;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.flow-log-item {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}

.flow-log-time {
  color: rgba(100, 116, 139, 0.7);
  font-variant-numeric: tabular-nums;
  min-width: 3.5rem;
}

.flow-log-msg {
  color: var(--text-main);
}

/* Feature/blog/about grids */
.feature-grid,
.about-grid,
.blog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.feature-card,
.about-card,
.blog-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.feature-kicker {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(99, 102, 241, 0.10);
  color: var(--primary);
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.feature-card h3,
.about-card h3,
.blog-card h3 {
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.feature-card p,
.about-card p,
.blog-card p {
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.blog-meta {
  display: inline-flex;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border-color);
  background: white;
}

.footer-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  padding-top: 2.25rem;
  padding-bottom: 2.25rem;
}

.footer-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
}

.footer-links a:hover {
  color: var(--text-main);
}

.footer-muted {
  color: var(--text-muted);
}

/* Responsive */
@media (min-width: 760px) {
  .nav-links { display: flex; }
  .hero { grid-template-columns: 1.15fr 0.85fr; align-items: center; }
  .grid-two { grid-template-columns: 1.1fr 0.9fr; }
  .feature-grid,
  .about-grid,
  .blog-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-inner { grid-template-columns: 1.4fr 1fr 0.6fr; align-items: start; }
}

@media (max-width: 520px) {
  .hero-copy h1 { font-size: 2.5rem; }
  .btn-secondary { width: 100%; }
  .section-header { flex-direction: column; align-items: flex-start; }
}

.spinner {
  border: 3px solid rgba(99, 102, 241, 0.1);
  border-top-color: var(--primary);
}

/* ─── Lightbox ─────────────────────────────────────────────────────────────── */
.chart-lightbox {
  display: none;
}

.chart-lightbox.is-open {
  display: block;
}

.chart-lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  animation: lightboxFadeIn 200ms ease;
}

@keyframes lightboxFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.chart-lightbox-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90vw;
  max-width: 1100px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
  z-index: 2001;
  padding: 24px;
  animation: lightboxScaleIn 200ms ease;
}

@keyframes lightboxScaleIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.chart-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: white;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-lightbox-close:hover {
  color: var(--text-main);
  border-color: rgba(99, 102, 241, 0.35);
}

.chart-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: white;
  color: var(--text-main);
  font-size: 1.8rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}

.chart-lightbox-nav:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.chart-lightbox-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.chart-lightbox-nav-prev {
  left: -64px;
}

.chart-lightbox-nav-next {
  right: -64px;
}

.chart-lightbox-main {
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  border-radius: 12px;
  overflow: hidden;
}

.chart-lightbox-loading,
.chart-lightbox-error {
  color: var(--text-muted);
  font-weight: 600;
  padding: 2rem;
}

.chart-lightbox-error {
  color: #ef4444;
}

.chart-lightbox-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.chart-lightbox-indicator {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.chart-lightbox-actions {
  display: flex;
  gap: 8px;
}

.chart-lightbox-dl-btn {
  border: 1px solid var(--border-color);
  background: white;
  color: var(--text-main);
  font-weight: 700;
  border-radius: 10px;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.chart-lightbox-dl-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}