/**
 * Kairos Showcase JSX Theme
 * Earth-tone portfolio detail page styling
 * Matched exactly to SleepWellFourDetail_preview.html JSX reference
 */

/* ============================================================================
   CSS Custom Properties — Matched to JSX colors object
   ========================================================================== */

:root {
  /* Page & Surface */
  --bg-page: #FDFBF7;
  --bg-card: #FFFFFF;
  --bg-surface: #F5F1EA;
  --bg-surface-alt: #F0EBE3;

  /* Text */
  --text-primary: #3D3229;
  --text-secondary: #6B5B4F;
  --text-muted: #8C7D70;

  /* Borders */
  --border: #E8E2D9;
  --border-light: #E8E2D9;
  --border-dark: #D4CCC0;

  /* Sage (primary accent / positive) */
  --sage: #5D7F6E;
  --sage-light: #E8F0EC;
  --sage-dark: #4A6659;

  /* Terracotta (warning / accent) */
  --terracotta: #C4956A;
  --terracotta-light: #FAF0E6;
  --terracotta-dark: #A67B52;

  /* Slate (info / neutral) */
  --slate: #6B7D8A;
  --slate-light: #EEF1F3;
  --slate-dark: #566572;

  /* Clay (negative / danger) */
  --clay: #A65D57;
  --clay-light: #F9EEEC;
  --clay-dark: #8B4E49;

  /* Semantic aliases */
  --positive: #5D7F6E;
  --positive-light: #E8F0EC;
  --negative: #A65D57;
  --negative-light: #F9EEEC;
  --warning: #C4956A;
  --warning-light: #FAF0E6;
  --info: #6B7D8A;
  --info-light: #EEF1F3;

  /* Heatmap — 6 tiers from JSX getHeatmapClass */
  --heatmap-strong-pos-bg: #5D7F6E;
  --heatmap-strong-pos-text: #FFFFFF;
  --heatmap-pos-bg: #E8F0EC;
  --heatmap-pos-text: #4A6659;
  --heatmap-neutral-bg: #F0EBE3;
  --heatmap-neutral-text: #6B5B4F;
  --heatmap-neg-low-bg: #F9F0EE;
  --heatmap-neg-low-text: #A65D57;
  --heatmap-neg-bg: #F9EEEC;
  --heatmap-neg-text: #A65D57;
  --heatmap-strong-neg-bg: #A65D57;
  --heatmap-strong-neg-text: #FFFFFF;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  /* Border Radius */
  --radius-sm: 0.25rem;  /* 4px — Tailwind rounded */
  --radius-md: 0.5rem;   /* 8px — rounded-lg */
  --radius-lg: 0.75rem;  /* 12px — rounded-xl */
  --radius-xl: 1rem;     /* 16px — rounded-2xl */

  /* Shadows — Tailwind equivalents */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);

  /* Key Takeaways gradient */
  --takeaways-bg-start: #5D7F6E;
  --takeaways-bg-end: #4A6659;
}

/* ============================================================================
   Layout
   ========================================================================== */

.page-container {
  max-width: calc(64rem + 3rem);
  margin: 0 auto;
  padding: 1.5rem;
}

/* ============================================================================
   Header Card — shadow-md, NO border, p-6
   ========================================================================== */

.header-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--space-6);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-6);
}

.header-title {
  font-size: 1.875rem;
  font-weight: 700;
  margin-bottom: var(--space-2);
  color: var(--text-primary);
}

.header-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  line-height: 1.5;
}

.ticker-badges {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-4);
}

.ticker-badge {
  display: inline-flex;
  padding: 0.25rem 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.header-return {
  text-align: right;
  flex-shrink: 0;
}

.header-return-value {
  font-family: var(--font-mono);
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1;
}

.header-return-value--positive {
  color: var(--positive);
}

.header-return-value--negative {
  color: var(--negative);
}

.header-return-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* ============================================================================
   Stats Row
   ========================================================================== */

.stats-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-4);
  border-top: 1px solid var(--border);
  padding-top: var(--space-6);
  text-align: center;
}

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

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-value--positive {
  color: var(--positive);
}

.stat-value--negative {
  color: var(--negative);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  margin-top: var(--space-1);
}

/* ============================================================================
   Tab Navigation — full-width flex, buttons stretch
   ========================================================================== */

.tab-nav {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-2);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-6);
}

.tab-button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.75rem 1rem;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-button:hover {
  background: var(--bg-surface);
}

.tab-button--active {
  background: var(--sage);
  color: white;
}

.tab-button svg {
  width: 18px;
  height: 18px;
}

.tab-panel {
  display: none;
}

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

/* ============================================================================
   Content Card — shadow-md, NO border
   ========================================================================== */

.content-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
}

.content-card--animate {
  animation: fadeIn 0.3s ease;
}

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

.content-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--space-1);
  color: var(--text-primary);
}

.content-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: var(--space-5);
}

.section-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

/* ============================================================================
   Holdings Grid — uniform sand bg, 4px left border accent
   ========================================================================== */

.holdings-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.holding-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: center;
  border-left: 4px solid var(--border);
  transition: transform 0.15s ease;
}

.holding-card:hover {
  transform: translateY(-0.25rem);
}

.holding-card--sage {
  border-left-color: var(--sage);
}

.holding-card--terracotta {
  border-left-color: var(--terracotta);
}

.holding-card--slate {
  border-left-color: var(--slate);
}

.holding-card--clay {
  border-left-color: var(--clay);
}

.holding-ticker {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.holding-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 0.25rem;
}

.holding-return {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: 0.25rem;
}

.holding-return--positive {
  color: var(--positive);
}

.holding-return--negative {
  color: var(--negative);
}

.holding-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
  font-family: var(--font-mono);
}

/* ============================================================================
   Insight Boxes — 4px left border, earth-tone colors
   ========================================================================== */

.insight-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-6);
}

.insight-box {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  border-left: 4px solid var(--border);
  font-size: 0.875rem;
  line-height: 1.625;
}

.insight-box--positive {
  background: var(--sage-light);
  border-left-color: var(--sage);
}

.insight-box--negative {
  background: var(--clay-light);
  border-left-color: var(--clay);
}

.insight-box--warning {
  background: var(--terracotta-light);
  border-left-color: var(--terracotta);
}

.insight-box--info {
  background: var(--slate-light);
  border-left-color: var(--slate);
}

.insight-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.insight-title--positive {
  color: var(--sage-dark);
}

.insight-title--negative {
  color: var(--clay);
}

.insight-title--warning {
  color: var(--terracotta-dark);
}

.insight-title--info {
  color: var(--slate-dark);
}

.insight-text {
  color: var(--text-primary);
}

.insight-attribution {
  margin-top: var(--space-3);
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

.insight-attribution a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
}

.insight-attribution a:hover {
  color: var(--sage);
}

/* ============================================================================
   Bar Chart
   ========================================================================== */

.bar-chart {
  margin-bottom: var(--space-6);
}

.bar-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
}

.bar-label {
  width: 4rem;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.85rem;
  text-align: right;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.bar-track {
  flex: 1;
  background: #F0EBE3;
  border-radius: var(--radius-md);
  height: 2.25rem;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: var(--space-3);
  min-width: 80px;
  transition: width 0.7s ease;
}

.bar-fill--sage {
  background: var(--sage);
}

.bar-fill--terracotta {
  background: var(--terracotta);
}

.bar-fill--slate {
  background: var(--slate);
}

.bar-fill--clay {
  background: var(--clay);
}

.bar-fill-text {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: white;
}

/* ============================================================================
   Data Table — header bg, row hover
   ========================================================================== */

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

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  color: var(--text-muted);
  background: var(--bg-surface);
}

.data-table th.right {
  text-align: right;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

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

.data-table td.right {
  text-align: right;
  font-family: var(--font-mono);
}

.data-table td.mono {
  font-family: var(--font-mono);
  font-weight: 600;
}

/* ============================================================================
   Heatmap Table — earth-tone 6-tier colors
   ========================================================================== */

.heatmap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  font-family: var(--font-mono);
}

.heatmap-table th {
  padding: var(--space-3);
  text-align: center;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  background: var(--bg-surface);
}

.heatmap-table th:first-child {
  text-align: left;
}

.heatmap-table td {
  padding: var(--space-3);
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.heatmap-table td:first-child {
  text-align: left;
  font-weight: 500;
  background: var(--bg-card);
  font-family: var(--font-sans);
}

.heatmap-table tfoot td {
  font-weight: 600;
  border-top: 2px solid var(--border-dark);
  border-bottom: none;
}

.heatmap-table tfoot td:first-child {
  background: var(--bg-surface-alt);
}

.heatmap-cell--strong-positive {
  background: var(--heatmap-strong-pos-bg);
  color: var(--heatmap-strong-pos-text);
}

.heatmap-cell--positive {
  background: var(--heatmap-pos-bg);
  color: var(--heatmap-pos-text);
}

.heatmap-cell--neutral {
  background: var(--heatmap-neutral-bg);
  color: var(--heatmap-neutral-text);
}

.heatmap-cell--negative-low {
  background: var(--heatmap-neg-low-bg);
  color: var(--heatmap-neg-low-text);
}

.heatmap-cell--negative {
  background: var(--heatmap-neg-bg);
  color: var(--heatmap-neg-text);
}

.heatmap-cell--strong-negative {
  background: var(--heatmap-strong-neg-bg);
  color: var(--heatmap-strong-neg-text);
}

/* ============================================================================
   Summary Cards — filled background, NO border
   ========================================================================== */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-8);
}

.summary-card {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  text-align: center;
}

.summary-card--positive {
  background: var(--sage-light);
}

.summary-card--negative {
  background: var(--clay-light);
}

.summary-card--info {
  background: var(--slate-light);
}

.summary-card-label {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.summary-card-label--positive {
  color: var(--sage-dark);
}

.summary-card-label--negative {
  color: var(--clay);
}

.summary-card-label--info {
  color: var(--slate-dark);
}

.summary-card-value {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.summary-card-detail {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* ============================================================================
   Key Takeaways
   ========================================================================== */

.key-takeaways {
  background: linear-gradient(135deg, var(--takeaways-bg-start), var(--takeaways-bg-end));
  color: white;
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-top: var(--space-6);
}

.key-takeaways-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--space-4);
}

.key-takeaways-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-8);
  margin-bottom: var(--space-4);
}

.key-takeaways-section h3 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.key-takeaways-list {
  list-style: none;
  padding: 0;
}

.key-takeaways-list li {
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: var(--space-2);
}

.key-takeaways-thesis {
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding-top: var(--space-4);
  margin-top: 1.5rem;
}

.key-takeaways-thesis strong {
  font-weight: 700;
}

.key-takeaways-thesis p {
  font-size: 1rem;
  line-height: 1.5;
  opacity: 0.95;
}

.key-takeaways-timestamp {
  font-size: 0.7rem;
  opacity: 0.5;
  margin-top: var(--space-3);
  text-align: right;
}

/* ============================================================================
   Income Cards — sand bg, centered, no border
   ========================================================================== */

.income-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.income-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: center;
}

.income-ticker {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.income-amount {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--positive);
  margin-top: 0.25rem;
}

.income-detail {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: var(--space-1);
  font-family: var(--font-mono);
}

/* ============================================================================
   Frequency & Stress
   ========================================================================== */

.frequency-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.frequency-box {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.frequency-box h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-primary);
}

.frequency-tickers {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.stress-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  text-align: center;
}

.stress-ticker {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: var(--space-1);
  color: var(--text-secondary);
}

.stress-value {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--negative);
}

.protection-dots {
  display: inline-flex;
  gap: 2px;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  color: var(--terracotta);
}

/* ============================================================================
   Utilities
   ========================================================================== */

.text-positive {
  color: var(--positive);
}

.text-negative {
  color: var(--negative);
}

.text-warning {
  color: var(--warning);
}

.text-muted {
  color: var(--text-muted);
}

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

.font-bold {
  font-weight: 700;
}

.font-mono {
  font-family: var(--font-mono);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.mb-6 {
  margin-bottom: var(--space-6);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mt-6 {
  margin-top: var(--space-6);
}

.overflow-x-auto {
  overflow-x: auto;
}

/* ============================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: var(--space-4);
  }

  .header-return {
    text-align: left;
  }

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

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

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

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

  .key-takeaways-grid {
    grid-template-columns: 1fr;
  }

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

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

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

/* ============================================================================
   DASHBOARD COMPONENTS
   ============================================================================
   Ported from showcase_v3.css — all hex colors remapped to CSS variables.
   Regime gauge retains its bright semantic colors.
   ========================================================================== */

/* --- Additional variables for dashboard compatibility --- */
:root {
  --primary: var(--sage);
  --primary-light: var(--sage-light);
  --primary-dark: var(--sage-dark);
  --bg-dark: #2D2A26;
  --bg-muted: var(--bg-surface-alt);
  --text-inverse: #FFFFFF;
  --positive-dark: var(--sage-dark);
  --negative-dark: var(--clay-dark);
  --warning-dark: var(--terracotta-dark);
  --neutral: var(--slate);
  --neutral-light: var(--slate-light);
  --neutral-dark: var(--slate-dark);
  --accent: var(--terracotta);
  --accent-light: var(--terracotta-light);
  --shadow-lg: 0 8px 24px rgba(61, 50, 41, 0.12);
  --radius-full: 9999px;
}

/* --- Regime Bar (always bright semantic colors) --- */
.regime-bar {
  --regime-contraction: #E53935;
  --regime-recovery: #FB8C00;
  --regime-expansion: #43A047;
  --regime-peak: #1E88E5;
}

/* --- Dashboard Header --- */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--sage);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.header-nav {
  display: flex;
  gap: 24px;
}

.header-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}

.header-nav a:hover {
  color: var(--sage);
}

/* --- Stats Bar --- */
.stats-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.regime-gauge {
  position: relative;
  min-width: 380px;
}

.regime-gauge-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.regime-gauge-bar {
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  overflow: hidden;
  position: relative;
}

.regime-gauge-segment {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: 600;
}

.regime-gauge-segment.contraction { background: var(--regime-contraction); }
.regime-gauge-segment.recovery { background: var(--regime-recovery); }
.regime-gauge-segment.expansion { background: var(--regime-expansion); }
.regime-gauge-segment.peak { background: var(--regime-peak); }

.regime-gauge-segment small {
  font-size: 10px;
  font-weight: 400;
  opacity: 0.85;
}

.regime-gauge-marker {
  position: absolute;
  top: 64px;
  transform: translateX(-50%);
  z-index: 10;
}

.regime-gauge-marker::before {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 10px solid var(--positive);
  filter: drop-shadow(0 -2px 4px rgba(0, 0, 0, 0.2));
}

.regime-gauge-scale {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 16px;
  padding: 0 4px;
}

.regime-vix {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
}

.regime-vix strong {
  color: var(--positive);
  font-weight: 700;
}

.stats-divider {
  width: 1px;
  height: 48px;
  background: var(--border);
}

/* Dashboard stat overrides (use .positive/.negative class pattern) */
.stat-value.positive { color: var(--positive); }
.stat-value.negative { color: var(--negative); }

/* --- Cards & Containers --- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-padded {
  padding: 20px 24px;
}

.surface {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
}

/* --- Portfolio Cards --- */
.portfolio-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.portfolio-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

.portfolio-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.portfolio-card-tickers {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.portfolio-return {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 15px;
}

.portfolio-return.positive {
  background: var(--positive-light);
  color: var(--positive);
}

.portfolio-return.negative {
  background: var(--negative-light);
  color: var(--negative);
}

.portfolio-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 12px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
}

.portfolio-stat-value {
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.portfolio-stat-value.income {
  color: var(--positive);
}

.portfolio-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- Dashboard Tabs (uses .tab-btn / .tabs-nav class names) --- */
.tabs-nav {
  display: inline-flex;
  gap: 4px;
  padding: 6px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover {
  background: var(--bg-surface);
}

.tab-btn.active {
  background: var(--sage);
  color: white;
}

.tab-btn svg {
  width: 18px;
  height: 18px;
}

/* --- Activity Feed --- */
.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
}

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.activity-icon.premium {
  background: var(--positive-light);
  color: var(--positive);
}

.activity-icon.assigned {
  background: var(--warning-light);
  color: var(--warning);
}

.activity-icon.expired {
  background: var(--neutral-light);
  color: var(--neutral);
}

.activity-content {
  flex: 1;
}

.activity-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.activity-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* --- Footer --- */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 24px 32px;
  margin-top: 48px;
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-brand {
  font-weight: 600;
  color: var(--text-primary);
}

.footer-tagline {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.footer-disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  max-width: 400px;
  text-align: right;
}

/* --- Typography Utilities --- */
.text-xs { font-size: 11px; }
.text-sm { font-size: 13px; }
.text-base { font-size: 15px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 24px; }
.text-2xl { font-size: 32px; }
.text-primary { color: var(--text-primary); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }

.uppercase {
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- Layout Utilities --- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mb-2 { margin-bottom: 8px; }
.p-4 { padding: 16px; }
.p-6 { padding: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); }

/* --- Dashboard Responsive --- */
@media (max-width: 768px) {
  .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .stats-bar { gap: 16px; }
  .stat-item { min-width: 80px; }
}

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

/* =============================================================================
   TIER GATING STYLES
   ============================================================================= */

/* FREE Badge on portfolio cards */
.badge--free {
  display: inline-block;
  background: #FB8C00;
  color: var(--text-primary);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  vertical-align: middle;
  margin-left: 8px;
}

/* Locked Tab Button */
.tab-button--locked {
  color: var(--text-muted) !important;
  cursor: not-allowed !important;
  opacity: 0.5;
}

.tab-button--locked:hover {
  background: transparent !important;
  color: var(--text-muted) !important;
}

.tab-button--locked svg {
  width: 16px;
  height: 16px;
  opacity: 0.5;
}

/* Locked Content Overlay */
.locked-overlay {
  position: relative;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-card) 100%);
  border-radius: 16px;
  border: 2px dashed var(--border);
}

.locked-content {
  text-align: center;
  padding: 32px;
}

.locked-content svg {
  margin-bottom: 16px;
  opacity: 0.4;
}

.locked-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.locked-content p {
  color: var(--text-secondary);
  margin: 0 0 20px 0;
  font-size: 0.9rem;
}

/* Upgrade button */
.btn-upgrade {
  display: inline-block;
  padding: 10px 24px;
  background: var(--sage);
  color: white;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  transition: opacity 0.15s ease;
}

.btn-upgrade:hover {
  opacity: 0.9;
}

/* Key Takeaways Locked State */
.key-takeaways--locked {
  background: var(--bg-surface);
  border-radius: 16px;
  margin-top: 24px;
}

/* =============================================================================
   DISTRIBUTION CALENDAR
   ============================================================================= */

.distribution-calendar {
  margin-top: 16px;
}

.distribution-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg-surface);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.distribution-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.distribution-table tr:hover {
  background: var(--bg-surface);
}

/* Distribution Status Badges */
.dist-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.dist-badge--upcoming {
  background: var(--slate-light);
  color: var(--slate-dark);
}

.dist-badge--ex-passed {
  background: var(--terracotta-light);
  color: var(--terracotta-dark);
}

.dist-badge--paid {
  background: var(--sage-light);
  color: var(--sage-dark);
}

/* Distribution Summary Bar */
.dist-summary {
  display: flex;
  gap: 24px;
  margin-top: 16px;
  padding: 16px 20px;
  background: var(--sage-light);
  border-radius: 12px;
}

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

.dist-summary-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.dist-summary-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

@media (max-width: 640px) {
  .dist-summary {
    flex-direction: column;
    gap: 12px;
  }
}

/* =============================================================================
   QUANTK TACTICAL ROTATION
   ============================================================================= */

/* Momentum Table */
.momentum-table .row--held {
  background: var(--sage-light);
}

.momentum-table .row--held:hover {
  background: var(--sage-light);
  filter: brightness(0.97);
}

/* Rank Badge */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  font-weight: 600;
  font-size: 0.875rem;
  background: var(--bg-surface);
  color: var(--text-secondary);
}

.rank-badge--top {
  background: var(--sage);
  color: white;
}

.rank-badge--fail {
  background: var(--bg-surface);
  color: var(--text-muted);
}

/* Filter Badge */
.filter-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.filter-badge--pass {
  background: var(--sage-light);
  color: var(--sage-dark);
}

.filter-badge--fail {
  background: var(--clay-light);
  color: var(--clay);
}

/* Status Badge */
.status-badge--held {
  display: inline-block;
  background: var(--sage);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Action Badges */
.action-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.action-badge--initial {
  background: var(--slate-light);
  color: var(--slate-dark);
}

.action-badge--rotate {
  background: var(--terracotta-light);
  color: var(--terracotta-dark);
}

.action-badge--hold {
  background: var(--bg-surface);
  color: var(--text-secondary);
}

/* Ticker In/Out */
.ticker-badge--out {
  background: var(--clay-light);
  color: var(--clay);
  text-decoration: line-through;
}

.ticker-badge--in {
  background: var(--sage-light);
  color: var(--sage-dark);
}

/* Next Rebalance Bar */
.next-rebalance {
  margin-top: 20px;
  padding: 14px 20px;
  background: var(--terracotta-light);
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.next-rebalance-label {
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--terracotta-dark);
}

.next-rebalance-date {
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--terracotta-dark);
}

/* Filter Explanation Box */
.filter-explanation {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--bg-surface);
  border-radius: 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Holdings Grid — 4-column */
.holdings-grid--4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

/* Holding Momentum Value */
.holding-momentum {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-mono);
  margin-top: 8px;
}

.holding-detail {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Rotation History Table */
.rotation-history-table td {
  vertical-align: middle;
}

.rotation-history-table .ticker-badge {
  margin-right: 4px;
  margin-bottom: 2px;
}

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

  .next-rebalance {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}

/* =============================================================================
   FORWARD GUIDANCE
   ============================================================================= */

.forward-guidance {
  margin-top: 2rem;
}

.guidance-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.guidance-item {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  border-left: 4px solid var(--border);
}

.guidance-item--ready {
  border-left-color: var(--sage);
  background: var(--sage-light);
}

.guidance-item--watching {
  border-left-color: var(--terracotta);
}

.guidance-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.guidance-action {
  font-weight: 500;
  flex: 1;
}

.status-badge--ready {
  background: var(--sage);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge--watching {
  background: var(--terracotta-light);
  color: var(--terracotta);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.guidance-details {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

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

.guidance-stat .label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.guidance-stat .value {
  font-family: var(--font-mono);
  font-weight: 600;
}

.guidance-reasoning {
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-light);
}

@media (max-width: 768px) {
  .guidance-details {
    flex-wrap: wrap;
  }

  .guidance-stat {
    min-width: 80px;
  }
}

/* =============================================================================
   PRICING PAGE
   ============================================================================= */

.pricing-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 48px 24px;
}

.pricing-header {
    text-align: center;
    margin-bottom: 48px;
}

.pricing-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.pricing-subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-bottom: 24px;
}

.billing-toggle {
    display: inline-flex;
    background: var(--bg-surface);
    border-radius: 10px;
    padding: 4px;
    gap: 4px;
    border: 1px solid var(--border);
}

.toggle-btn {
    padding: 8px 20px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.toggle-btn--active {
    background: var(--sage);
    color: white;
}

.toggle-save {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--sage);
    margin-left: 4px;
}

.toggle-btn--active .toggle-save {
    color: rgba(255, 255, 255, 0.85);
}

.pricing-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 48px;
}

.pricing-card {
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 32px 28px;
    position: relative;
}

.pricing-card--featured {
    border-color: var(--sage);
}

.pricing-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--sage);
    color: white;
    padding: 2px 16px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pricing-card-header {
    margin-bottom: 24px;
}

.plan-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.plan-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.plan-period {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-muted);
}

.plan-annual-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.plan-equivalent {
    font-size: 0.875rem;
    color: var(--sage);
    font-weight: 500;
    margin-top: 4px;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 0 0 24px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.feature-item--included {
    color: var(--text-secondary);
}

.feature-item--excluded {
    color: var(--text-muted);
}

.feature-check {
    color: var(--sage);
    font-weight: 700;
    flex-shrink: 0;
}

.feature-x {
    color: var(--text-muted);
    flex-shrink: 0;
}

.plan-cta {
    display: block;
    width: 100%;
    padding: 12px 20px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s;
}

.plan-cta--current {
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: default;
    border: 1px solid var(--border);
}

.plan-cta--current-pro {
    background: var(--sage-light);
    color: var(--sage);
    cursor: default;
}

.plan-cta--upgrade {
    background: var(--sage);
    color: white;
}

.plan-cta--upgrade:hover {
    opacity: 0.9;
}

.plan-cta--manage {
    background: var(--bg-surface);
    color: var(--sage);
    border: 2px solid var(--sage);
}

.plan-cta--manage:hover {
    background: var(--sage-light);
}

.plan-cta--coming-soon {
    background: var(--bg-surface);
    color: var(--text-muted);
    cursor: default;
    border: 1px solid var(--border);
}

/* Email prompt overlay */
.pricing-email-prompt {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.email-prompt-card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    position: relative;
}

.email-prompt-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.email-prompt-close:hover {
    color: var(--text-primary);
    background: var(--bg-surface);
}

.email-prompt-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.email-prompt-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.email-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.email-input {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--bg-surface);
    color: var(--text-primary);
}

.email-input:focus {
    outline: none;
    border-color: var(--sage);
}

.email-submit {
    padding: 10px 20px;
    background: var(--sage);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
}

.email-submit:hover {
    opacity: 0.9;
}

.pricing-back {
    text-align: center;
}

.back-link {
    color: var(--sage);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

@media (max-width: 768px) {
    .pricing-cards {
        grid-template-columns: 1fr;
    }

    .pricing-page {
        padding: 32px 16px;
    }
}
