/* ============================================
   PRISMA v2 — Answer-First Decision Intelligence
   Light Mode, Warm & Trustworthy
   ============================================ */

/* =============================================
   1. CSS VARIABLES — Light Mode
   ============================================= */

:root {
  /* Backgrounds — warm off-white */
  --bg:     #F5F0F0;
  --bg2:    #f9f1f1;
  --bg3:    #f4ecec;

  /* Text */
  --text:   #14141C;
  --text2:  #43394c;
  --text3:  #786065;

  /* Verdict colors */
  --strong:     #10B981;
  --solid:      #10B981;
  --uncertain:  #F59E0B;
  --risky:      #EF4444;

  /* Accent */
  --accent:  #2563EB;

  /* Borders — rose tint, increased opacity */
  --border:  rgba(245, 192, 192, 0.28);
  --border2: rgba(245, 192, 192, 0.35);

  /* Risk classification colors */
  --strong:        #10B981;
  --low-risk:      #10B981;
  --moderate-risk: #F59E0B;
  --high-risk:     #EF4444;

  /* Analysis accent */
  --analysis-accent: #C47A3A;
  --analysis-accent-light: rgba(196, 122, 58, 0.08);

  /* Fonts */
  --font-sans: 'Geist', system-ui, -apple-system, sans-serif;
  --font-mono: 'Geist Mono', 'SF Mono', monospace;
  --font-pixel: 'Geist Pixel Triangle', monospace;
}

/* =============================================
   1b. PIXEL FONT
   ============================================= */

@font-face {
  font-family: 'Geist Pixel Triangle';
  src: url('/fonts/GeistPixel-Triangle.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* =============================================
   2. RESET & BASE
   ============================================= */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

html, body {
  height: 100%;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-weight: 400;
  line-height: 1.6;
  position: relative;
}

/* Noise texture overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.35;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(200, 180, 170, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 80% 50%, rgba(180, 170, 190, 0.08) 0%, transparent 50%);
}

/* =============================================
   3. LAYOUT — SINGLE SCREEN, NO SCROLL
   ============================================= */

.prisma-app {
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: 100%;
}

/* HEADER BAR */
.prisma-header {
  height: 52px;
  flex-shrink: 0;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  text-transform: uppercase;
}

.logo-pixel {
  font-family: var(--font-pixel);
  font-weight: 400;
  font-size: 20px;
  letter-spacing: 0.06em;
}

/* Fade-in on app load */
.prisma-app {
  animation: appFadeIn 0.5s ease;
}

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

.tagline {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--text3);
  letter-spacing: 0.02em;
}

.header-right {
  display: flex;
  align-items: center;
}

.tier-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 12px;
  padding: 4px 12px;
  letter-spacing: 0.05em;
}

/* MAIN LAYOUT */
.prisma-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
}

/* =============================================
   4. CHAT PANEL (LEFT — 25%)
   ============================================= */

.chat-panel {
  width: 25%;
  min-width: 280px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* Before CSV upload: hide chat, drop zone takes full width */
.prisma-app.pre-upload .chat-panel {
  display: none;
}

.prisma-app.pre-upload .answer-panel {
  width: 100%;
}

.prisma-app.pre-upload .upload-landing {
  min-height: 100%;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Chat message bubbles */
.message {
  max-width: 92%;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  animation: messageSlideIn 0.3s ease;
}

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

.message.user-message {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
  margin-left: auto;
}

.message.prisma-message {
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  margin-right: auto;
}

.message.system-message {
  background: rgba(245, 158, 11, 0.08);
  color: var(--text2);
  border: 1px solid rgba(245, 158, 11, 0.15);
  border-radius: 8px;
  align-self: center;
  max-width: 95%;
  text-align: center;
  font-size: 12px;
}

.message.error-message {
  background: rgba(239, 68, 68, 0.08);
  color: var(--risky);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* -- Chat Option Chips -- */
.chat-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.chat-option-chip {
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 20px;
  padding: 6px 14px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.3;
}

.chat-option-chip:hover {
  background: var(--accent);
  color: #fff;
}

.chat-option-chip:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.chat-option-other {
  border-style: dashed;
  color: var(--text3);
  border-color: var(--text3);
}

.chat-option-other:hover {
  background: var(--bg2);
  color: var(--text);
  border-color: var(--text2);
}

/* Typing indicator */
.typing-indicator-msg {
  align-self: flex-start;
  margin-right: auto;
}

.typing-indicator {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}

.typing-indicator span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40%           { opacity: 1;   transform: scale(1); }
}

/* Chat input area */
.chat-input-area {
  flex-shrink: 0;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: #fff;
}

#chat-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  resize: none;
  outline: none;
  transition: border-color 0.2s ease;
}

#chat-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

#chat-input::placeholder {
  color: var(--text3);
}

.chat-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  align-items: center;
}

.btn-send {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 16px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.btn-send:hover { background: #1d4ed8; }
.btn-send:active { background: #1e40af; }
.btn-send:disabled { background: var(--text3); cursor: not-allowed; opacity: 0.5; }

.privacy-notice {
  padding: 6px 14px;
  font-size: 9px;
  color: var(--text3);
  line-height: 1.4;
  font-family: var(--font-sans);
  border-top: 1px solid var(--border);
  background: #fff;
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
.chat-messages::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* =============================================
   5. ANSWER PANEL (RIGHT — 55%)
   ============================================= */

.answer-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 32px;
  min-width: 0;
  max-width: 100%;
  background: var(--bg);
  position: relative;
}

.answer-panel::-webkit-scrollbar { width: 4px; }
.answer-panel::-webkit-scrollbar-track { background: transparent; }
.answer-panel::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

/* Dormant / waiting state */
.answer-panel-dormant {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.dormant-message {
  text-align: center;
  color: var(--text3);
}

.dormant-message .dormant-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.dormant-message p {
  font-size: 15px;
  font-family: var(--font-sans);
}

/* =============================================
   6. LAYER 1 — THE VERDICT (visible by default)
   ============================================= */

.layer-1 {
  display: none;
}

.layer-1.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

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

/* -- Simulation badge -- */
.simulation-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
  letter-spacing: 0.02em;
  margin-bottom: 20px;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: inline-block;
}

.simulation-badge strong {
  color: var(--text);
  font-weight: 600;
}

/* -- Score + Verdict Card -- */
.verdict-card {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 28px;
}

.score-circle-container {
  flex-shrink: 0;
}

.verdict-text {
  flex: 1;
  min-width: 0;
}

.verdict-context {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text3);
  line-height: 1.4;
  margin-bottom: 4px;
}

.verdict-headline {
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 10px;
}

.verdict-summary {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text2);
  line-height: 1.6;
  margin-bottom: 6px;
}

.verdict-risk {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text2);
  line-height: 1.6;
}

.verdict-risk strong {
  color: var(--risky);
  font-weight: 600;
}

/* -- Recommendation Triptych -- */
.rec-triptych {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 28px;
}

.rec-card {
  padding: 14px 16px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 3px solid;
  animation: recSlideIn 0.5s ease;
  position: relative;
  overflow: hidden;
}

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

.rec-card.rec-do    { border-left-color: var(--solid); }
.rec-card.rec-watch { border-left-color: var(--uncertain); }
.rec-card.rec-pivot { border-left-color: var(--accent); }

.rec-card h4 {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text3);
  margin-bottom: 6px;
}

.rec-card p {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 8;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: opacity 0.2s ease-in-out;
}

.rec-card p.fading {
  opacity: 0;
}

/* -- Shimmer / Refining State for Rec Cards -- */
@keyframes recShimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.rec-card.refining {
  border-color: rgba(37, 99, 235, 0.18);
  transition: border-color 0.3s ease;
}

.rec-card.refining p {
  opacity: 0.12;
  transition: opacity 0.3s ease;
}

.rec-card.refining::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(37, 99, 235, 0.03) 35%,
    rgba(37, 99, 235, 0.07) 50%,
    rgba(37, 99, 235, 0.03) 65%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: recShimmer 2s ease-in-out infinite;
}

.rec-card .refining-label {
  display: none;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent);
  opacity: 0.65;
  margin-top: 6px;
  text-align: center;
}

.rec-card.refining .refining-label {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* -- Simulation Count Toggle -- */
.sim-count-toggle {
  display: inline-flex;
  gap: 0;
  background: var(--bg3);
  border-radius: 8px;
  padding: 2px;
  margin-bottom: 6px;
}

.sim-count-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  background: none;
  border: none;
  border-radius: 6px;
  padding: 6px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sim-count-btn.active {
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.sim-count-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
}

.sim-count-btn.active .sim-count-num {
  color: var(--accent);
}

.sim-count-label {
  font-family: var(--font-sans);
  font-size: 10px;
  color: var(--text3);
}

.sim-count-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  margin-bottom: 20px;
  font-style: italic;
}

/* -- Front-Page What-If Sliders -- */
.front-sliders,
.front-sliders-more {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.front-slider {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  transition: box-shadow 0.2s ease;
}

.front-slider:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.front-slider.ai-suggested {
  border-color: rgba(37, 99, 235, 0.3);
  background: rgba(37, 99, 235, 0.02);
}

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

.front-slider-label {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.15);
  border-radius: 4px;
  padding: 1px 5px;
  letter-spacing: 0.05em;
}

.front-slider-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.front-slider-unit {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
  margin-left: 2px;
}

/* Delta badge */
.front-slider-delta {
  display: none;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  white-space: nowrap;
}

.front-slider-delta.visible {
  display: inline-block;
}

.front-slider-delta.positive {
  color: var(--strong);
  background: rgba(16, 185, 129, 0.08);
}

.front-slider-delta.negative {
  color: var(--risky);
  background: rgba(239, 68, 68, 0.08);
}

.front-slider-delta.neutral {
  color: var(--uncertain);
  background: rgba(245, 158, 11, 0.08);
}

/* Slider track wrapper with baseline marker */
.front-slider-track-wrap {
  position: relative;
  padding: 0 0 4px;
}

.front-slider-track-wrap input[type="range"] {
  width: 100%;
  position: relative;
  z-index: 1;
}

/* Baseline diamond marker */
.front-slider-baseline {
  position: absolute;
  top: -2px;
  width: 8px;
  height: 8px;
  background: var(--text3);
  transform: rotate(45deg);
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.front-slider:hover .front-slider-baseline {
  opacity: 0.8;
}

.front-slider-range {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  margin-top: 2px;
}

/* More variables button */
.more-vars-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(37, 99, 235, 0.04);
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--text3);
  cursor: pointer;
  transition: color 0.2s ease;
  margin-bottom: 8px;
}

.more-vars-btn:hover {
  color: var(--accent);
}

.more-vars-btn .chevron {
  transition: transform 0.3s ease;
  font-size: 10px;
}

.more-vars-btn.expanded .chevron {
  transform: rotate(180deg);
}

/* Reset sliders button */
.reset-sliders-btn {
  display: inline-block;
  background: none;
  border: none;
  padding: 4px 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--risky);
  cursor: pointer;
  transition: opacity 0.2s ease;
  margin-bottom: 16px;
}

.reset-sliders-btn:hover {
  opacity: 0.7;
}

/* -- "Show me why" button -- */
.show-why-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 4px;
}

.show-why-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(37, 99, 235, 0.04);
}

.show-why-btn .chevron {
  transition: transform 0.3s ease;
  font-size: 11px;
}

.show-why-btn.expanded .chevron {
  transform: rotate(180deg);
}

/* =============================================
   7. LAYER 2 — THE EVIDENCE (collapsed by default)
   ============================================= */

.layer-2 {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s ease,
              margin 0.3s ease;
  margin-top: 0;
}

.layer-2.expanded {
  max-height: 2000px;
  opacity: 1;
  margin-top: 20px;
  overflow: visible;
}

/* -- Outcome Range Bar -- */
.range-bar-section {
  margin-bottom: 28px;
}

.range-bar-section h3 {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.range-bar-container {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}

.range-bar-canvas-wrap {
  width: 100%;
  height: 60px;
  position: relative;
  margin-bottom: 8px;
}

.range-bar-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.range-bar-summary {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text2);
  line-height: 1.5;
}

/* -- Scenario Comparison -- */
.scenario-comparison {
  margin-bottom: 28px;
}

.scenario-comparison h3 {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.scenario-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
}

.scenario-row.best {
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.scenario-row.worst {
  opacity: 0.7;
}

.scenario-label-badge {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  min-width: 120px;
  flex-shrink: 0;
}

.scenario-bar-wrap {
  flex: 1;
  height: 28px;
  position: relative;
}

.scenario-bar-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.scenario-score-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  min-width: 36px;
  text-align: center;
  flex-shrink: 0;
}

/* -- What Matters Most -- */
.sensitivity-section {
  margin-bottom: 28px;
}

.sensitivity-section h3 {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.sensitivity-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sensitivity-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}

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

.sensitivity-name {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.sensitivity-impact {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.sensitivity-bar-track {
  height: 8px;
  background: var(--bg3);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

.sensitivity-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.sensitivity-description {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text2);
  line-height: 1.4;
}

/* -- "See full simulation" link -- */
.see-full-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 4px;
}

.see-full-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(37, 99, 235, 0.04);
}

/* =============================================
   8. LAYER 3 — THE ENGINE ROOM (slide-over)
   ============================================= */

.layer-3-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 55%;
  background: rgba(0, 0, 0, 0.3);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.layer-3-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.layer-3-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: calc(55% * 0.85);
  max-width: 900px;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  z-index: 101;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.layer-3-panel.open {
  transform: translateX(0);
}

.layer-3-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.layer-3-header h2 {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.layer-3-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 12px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.2s ease;
}

.layer-3-close:hover {
  color: var(--text);
  border-color: var(--text3);
}

.layer-3-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.layer-3-content::-webkit-scrollbar { width: 4px; }
.layer-3-content::-webkit-scrollbar-track { background: transparent; }
.layer-3-content::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

/* Engine Room Sections */
.engine-section {
  margin-bottom: 32px;
}

.engine-section-header {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text3);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* Monte Carlo canvas in Layer 3 */
.engine-monte-carlo {
  width: 100%;
  height: 300px;
  position: relative;
}

.engine-monte-carlo canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.engine-stats {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text2);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* Plotly charts in Layer 3 */
.engine-chart {
  width: 100%;
  height: 250px;
}

/* Causal graph in Layer 3 */
.engine-causal {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  padding: 16px;
  background: var(--bg);
  border-radius: 8px;
  overflow-x: auto;
  position: relative;
  min-height: 60px;
}

/* Sliders in Layer 3 */
.engine-sliders {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Raw stats table in Layer 3 */
.engine-raw-stats {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 12px;
}

.engine-raw-stats th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 2px solid var(--border);
  color: var(--text2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 10px;
}

.engine-raw-stats td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.engine-raw-stats tr:last-child td {
  border-bottom: none;
}

/* Taleb classification in Layer 3 */
.taleb-badge-l3 {
  padding: 12px 16px;
  border-radius: 8px;
  border-left: 3px solid;
  background: var(--bg);
  margin-bottom: 8px;
}

.taleb-badge-l3.high_risk { border-left-color: var(--high-risk); }
.taleb-badge-l3.moderate_risk { border-left-color: var(--moderate-risk); }
.taleb-badge-l3.low_risk { border-left-color: var(--low-risk); }
.taleb-badge-l3.strong { border-left-color: var(--strong); }

.taleb-badge-l3 .classification-word {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.taleb-badge-l3 .classification-word.high_risk { color: var(--high-risk); }
.taleb-badge-l3 .classification-word.moderate_risk { color: var(--moderate-risk); }
.taleb-badge-l3 .classification-word.low_risk { color: var(--low-risk); }
.taleb-badge-l3 .classification-word.strong { color: var(--strong); }

.taleb-badge-l3 .classification-reasoning {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
}

/* =============================================
   9. CAUSAL GRAPH NODE STYLES (shared)
   ============================================= */

.causal-node {
  padding: 4px 10px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--border2);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
  animation: nodeSlideIn 0.5s ease;
}

@keyframes nodeSlideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* =============================================
   10. SLIDER STYLES (shared for Layer 3)
   ============================================= */

.slider-container,
.slider-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 6px;
}

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

.slider-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text2);
}

.slider-value {
  color: var(--accent);
  font-weight: 600;
}

.slider-range {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  margin-top: 4px;
}

input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg3);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.3);
  transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 1px 8px rgba(37, 99, 235, 0.4);
  transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.3);
  transition: all 0.2s ease;
  border: none;
}

/* =============================================
   11. DISCOVERIES SECTION
   ============================================= */

#discoveries-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}

.discovery-card {
  padding: 16px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--border);
  margin-bottom: 8px;
}

.discovery-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 8px;
  font-weight: 600;
}

.discovery-pattern     { background: rgba(37, 99, 235, 0.1);  color: var(--accent); }
.discovery-risk        { background: rgba(239, 68, 68, 0.1);  color: var(--risky); }
.discovery-opportunity { background: rgba(16, 185, 129, 0.1); color: var(--solid); }

.discovery-card h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.discovery-card p {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
}

.discovery-impact {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--uncertain);
  display: block;
  margin-top: 8px;
}

/* =============================================
   12. FORMULA WARNING BANNER
   ============================================= */

.formula-warning-banner {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-left: 3px solid var(--uncertain);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  animation: fadeIn 0.4s ease;
}

.formula-warning-banner strong {
  color: var(--uncertain);
}

/* =============================================
   13. PRISMA 2.0 — UPLOAD LANDING
   ============================================= */

.upload-landing {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 48px 32px;
}

.upload-drop-zone {
  position: relative;
  width: 100%;
  max-width: 560px;
  padding: 72px 48px;
  text-align: center;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  border: 2px dashed var(--border2);
  border-radius: 20px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
  cursor: pointer;
}

.upload-drop-zone:hover {
  border-color: rgba(37, 99, 235, 0.3);
  box-shadow: 0 8px 32px rgba(37, 99, 235, 0.08);
  transform: translateY(-2px);
}

.upload-drop-zone.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1), 0 12px 40px rgba(37, 99, 235, 0.12);
  transform: translateY(-4px);
  background: rgba(37, 99, 235, 0.02);
}

.upload-icon {
  margin-bottom: 20px;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.upload-drop-zone:hover .upload-icon { opacity: 0.8; }

.upload-drop-zone h2 {
  font-family: var(--font-sans);
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.upload-drop-zone p {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text3);
  margin-bottom: 24px;
}

.btn-demo-data {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-demo-data:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(37, 99, 235, 0.04);
}

.upload-hint {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  margin-top: 12px;
}

/* =============================================
   14. PRISMA 2.0 — DATA OVERVIEW
   ============================================= */

#data-overview {
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: fadeIn 0.5s ease;
}

/* Summary Card */
.data-summary-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text2);
}

.summary-filename { font-weight: 600; color: var(--text); }
.summary-row-count { color: var(--accent); font-weight: 600; }
.summary-date-range { color: var(--text3); margin-left: auto; }
.summary-description { width: 100%; font-family: var(--font-sans); font-size: 13px; color: var(--text2); margin-top: 4px; }

/* KPI Strip */
.kpi-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.kpi-card {
  flex: 1;
  min-width: 150px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
  animation: fadeIn 0.5s ease;
}

.kpi-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

.kpi-value {
  font-family: var(--font-sans);
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 4px;
}

.kpi-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kpi-trend {
  position: absolute;
  top: 14px;
  right: 16px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
}

.kpi-trend.positive { color: #10B981; }
.kpi-trend.negative { color: #EF4444; }
.kpi-trend.neutral { color: var(--text3); }

.kpi-context {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--text3);
  margin-top: 8px;
  line-height: 1.3;
}

/* Chart Grid */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.chart-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  min-height: 280px;
  transition: box-shadow 0.2s ease;
}

.chart-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.chart-card-title {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.chart-plot { width: 100%; height: 240px; }

/* Skeleton Loading */
.skeleton-loading {
  position: relative;
  overflow: hidden;
}

.skeleton-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(37, 99, 235, 0.03) 35%, rgba(37, 99, 235, 0.06) 50%, rgba(37, 99, 235, 0.03) 65%, transparent 100%);
  background-size: 200% 100%;
  animation: recShimmer 2s ease-in-out infinite;
  border-radius: inherit;
}

.skeleton-bar {
  background: var(--bg3);
  border-radius: 4px;
  height: 16px;
  width: 100%;
}

/* =============================================
   15. PRISMA 2.0 — INSIGHT CARDS
   ============================================= */

.insights-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.insight-card {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 3px solid;
  border-radius: 10px;
  padding: 18px 20px;
  transition: box-shadow 0.2s ease;
}

.insight-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.insight-card[data-type="pattern"]     { border-left-color: var(--accent); }
.insight-card[data-type="risk"]        { border-left-color: #EF4444; }
.insight-card[data-type="opportunity"] { border-left-color: #10B981; }
.insight-card[data-type="anomaly"]     { border-left-color: #F59E0B; }

.insight-card-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 10px;
  margin-right: 8px;
}

.insight-card[data-type="pattern"] .insight-card-badge { background: rgba(37, 99, 235, 0.08); color: var(--accent); }
.insight-card[data-type="risk"] .insight-card-badge { background: rgba(239, 68, 68, 0.08); color: #EF4444; }
.insight-card[data-type="opportunity"] .insight-card-badge { background: rgba(16, 185, 129, 0.08); color: #10B981; }
.insight-card[data-type="anomaly"] .insight-card-badge { background: rgba(245, 158, 11, 0.08); color: #F59E0B; }

.insight-severity {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg2);
  color: var(--text3);
}

.insight-severity.high { background: rgba(239, 68, 68, 0.08); color: #EF4444; }

.insight-title {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.4;
}

.insight-description {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text2);
  line-height: 1.55;
  margin-bottom: 14px;
}

.insight-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.simulate-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.simulate-btn:hover { background: #1d4ed8; transform: translateY(-1px); }
.simulate-btn:active { transform: translateY(0); }
.simulate-btn .arrow { transition: transform 0.2s ease; }
.simulate-btn:hover .arrow { transform: translateX(3px); }

.probability-teaser {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text2);
}

.probability-teaser .prob-value {
  font-weight: 700;
  color: #10B981;
  font-size: 13px;
}

@keyframes insightPulse {
  0%   { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.3); }
  50%  { box-shadow: 0 0 0 8px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.insight-card.simulating { animation: insightPulse 0.6s ease; }

/* =============================================
   16. PRISMA 2.0 — SIMULATION HISTORY + CARDS
   ============================================= */

#simulation-history {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sim-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  animation: fadeIn 0.5s ease;
}
.sim-card:not(.sim-card-failed) {
  border-left: 3px solid #2563EB;
}

.sim-card-failed {
  border-left: 3px solid #F59E0B;
  opacity: 0.85;
}

.sim-card-failed .teaser-score {
  color: #F59E0B;
  font-size: 11px;
}

/* ---- Analysis History Cards ---- */
.analysis-card {
  border: none;
  border-left: 3px solid var(--analysis-accent);
  border-radius: 14px;
  background: var(--bg2);
  overflow: hidden;
  margin-bottom: 12px;
  animation: fadeIn 0.5s ease;
}

.analysis-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(196, 122, 58, 0.15);
  background: var(--analysis-accent-light);
}

.analysis-card-label {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text2);
  text-transform: none;
  letter-spacing: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 12px;
}

.analysis-card-toggle {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--analysis-accent);
  background: transparent;
  border: none;
  padding: 4px 8px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.analysis-card-toggle:hover {
  color: var(--text);
}

.analysis-card-content {
  padding: 16px;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}

.analysis-card-content.collapsed {
  max-height: 0;
  overflow: hidden;
  padding: 0 16px;
  opacity: 0;
}

/* ---- Type badges ---- */
.card-type-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  display: inline-block;
  margin-bottom: 4px;
}
.sim-badge { background: rgba(37, 99, 235, 0.08); color: #2563EB; }
.analysis-badge { background: rgba(196, 122, 58, 0.08); color: #C47A3A; }

/* ---- Section labels ---- */
.section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0 0 8px 4px;
  display: none;
}
.section-label.visible { display: block; }
.sim-section-label { color: #2563EB; margin-top: 24px; }
.analysis-section-label { color: var(--analysis-accent); margin-top: 16px; }

/* ---- Analysis header left wrapper (badge + label) ---- */
.analysis-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.simulation-teaser {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #fff;
}

.sim-card:has(.full-analysis.expanded) .simulation-teaser,
.sim-card.analysis-expanded .simulation-teaser {
  border-bottom: 1px solid var(--border);
}

.teaser-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.teaser-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.teaser-score {
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 800;
  color: #10B981;
  letter-spacing: -0.02em;
}

/* Full Analysis button with shine */
.full-analysis-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #2563EB, #7C3AED);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.full-analysis-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.3);
}

.full-analysis-btn.shine::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.15) 50%, transparent 100%);
  animation: btnShine 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes btnShine {
  0%   { left: -100%; }
  40%  { left: 150%; }
  100% { left: 150%; }
}

.full-analysis-btn.expanded {
  background: var(--text);
  animation: none;
}

.full-analysis-btn.expanded::after { display: none; }

/* Futures Cascade canvas overlay */
.histogram-canvas-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  transition: opacity 0.3s ease;
}

/* Full Analysis expandable section */
.full-analysis {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.4s ease 0.1s;
}

.full-analysis.expanded {
  max-height: 3000px;
  opacity: 1;
}

.full-analysis-inner {
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.full-analysis-top {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}

.full-analysis-histogram {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  min-height: 260px;
}

.full-analysis-stats {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-primary {
  font-family: var(--font-sans);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 8px;
}

.stat-primary.positive { color: #10B981; }
.stat-primary.negative { color: #EF4444; }

.stat-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text2);
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.stat-value { font-weight: 600; color: var(--text); }

/* =============================================
   17. PRISMA 2.0 — DATA TABLE
   ============================================= */

.data-table-toggle {
  background: none;
  border: none;
  padding: 8px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text3);
  cursor: pointer;
  transition: color 0.2s ease;
}

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

.data-table-wrap {
  margin-top: 12px;
  max-height: 400px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 11px;
}

.data-table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 2px solid var(--border);
  color: var(--text2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 10px;
  cursor: pointer;
  position: sticky;
  top: 0;
  background: var(--bg2);
  white-space: nowrap;
}

.data-table th:hover { background: var(--bg3); }

.data-table td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
}

.pagination-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.2s ease;
}

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

/* ---- Loading Facts (skeleton state) ---- */
.skeleton-fact-card {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  min-height: 200px;
}

.skeleton-analyzing-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 16px;
}

.skeleton-progress-bar {
  width: 200px;
  height: 2px;
  background: rgba(245, 192, 192, 0.3);
  border-radius: 1px;
  margin-bottom: 24px;
  overflow: hidden;
  position: relative;
}

.skeleton-progress-bar::after {
  content: '';
  position: absolute;
  left: 0; top: 0;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: progressSweep 3s ease-in-out infinite;
}

@keyframes progressSweep {
  0%   { left: -40%; }
  100% { left: 100%; }
}

.skeleton-fact-text {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text2);
  text-align: center;
  max-width: 380px;
  line-height: 1.6;
  transition: opacity 0.4s ease;
  margin: 0 auto;
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-progress-bar::after { animation: none; }
  .skeleton-fact-text { transition: none; }
}

/* =============================================
   18. UTILITY CLASSES
   ============================================= */

.hidden {
  display: none !important;
}

/* =============================================
   19. RESPONSIVE
   ============================================= */

@media (min-width: 1920px) {
  .answer-panel {
    padding: 32px 48px;
  }
}

@media (max-width: 1280px) {
  .chat-panel {
    width: 28%;
  }

  .tagline {
    display: none;
  }

  .rec-triptych {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .layer-3-panel {
    width: 70%;
  }

  .layer-3-overlay {
    width: 100%;
  }
}

@media (max-width: 1024px) {
  .prisma-main {
    flex-direction: column;
  }

  .chat-panel {
    width: 100%;
    height: 40%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .answer-panel {
    height: 60%;
  }

  .layer-3-panel {
    width: 90%;
  }

  .layer-3-overlay {
    width: 100%;
  }
}
