/* ============================================
   Carbon Footprint AI — Claude-inspired Light Theme
   ============================================ */

:root {
  /* Claude-style warm palette */
  --bg-deep: #F5F4EE;
  --bg-primary: #FAF9F5;
  --bg-secondary: #F0EEE6;
  --bg-card: #FFFFFF;
  --bg-hover: #EBE9E0;

  --border: rgba(60, 50, 40, 0.08);
  --border-strong: rgba(60, 50, 40, 0.14);
  --border-glow: rgba(217, 119, 87, 0.25);

  --text-primary: #2B2621;
  --text-secondary: #6B6158;
  --text-muted: #9A9289;

  --accent: #D97757;         /* Claude coral */
  --accent-hover: #C4613D;
  --accent-soft: rgba(217, 119, 87, 0.08);
  --accent-green: #6E8C5F;
  --accent-amber: #B8874A;

  --user-bubble: #E8E4D8;
  --user-border: rgba(60, 50, 40, 0.12);
  --user-text: #3D362E;

  --radius: 12px;
  --radius-sm: 8px;

  --shadow-sm: 0 1px 2px rgba(60, 50, 40, 0.04);
  --shadow-md: 0 2px 8px rgba(60, 50, 40, 0.06);
  --shadow-lg: 0 8px 24px rgba(60, 50, 40, 0.08);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Hide particle canvas (too noisy for light theme) */
#particleCanvas { display: none; }

/* ---- Layout ---- */
#app {
  display: flex;
  height: 100vh;
  position: relative;
  z-index: 1;
}

/* ---- Sidebar ---- */
.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  flex-shrink: 0;
  transition: transform 0.3s;
}

.sidebar-header { margin-bottom: 20px; padding: 0 4px; }

.logo {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 15px; font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0;
}

.logo em {
  font-style: normal;
  color: var(--accent);
}

.logo-icon {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
  border: 1px solid var(--border-glow);
  border-radius: 10px;
  color: var(--accent);
}

@keyframes pulse-glow { 0%, 100% { opacity: 1; } 50% { opacity: 1; } }

/* Generation loading animation */
.gen-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 40px; height: 100%;
}
.gen-loading-text {
  font-family: 'Inter', sans-serif; font-size: 13px; letter-spacing: 1px;
  font-weight: 500;
  animation: genPulse 1.5s ease-in-out infinite;
}
.gen-loading-text.cyan { color: var(--accent); }
.gen-loading-text.green { color: var(--accent-green); }
.gen-loading-bar {
  width: 200px; height: 3px; background: var(--bg-hover);
  border-radius: 3px; overflow: hidden;
}
.gen-loading-bar-inner {
  height: 100%; width: 40%; border-radius: 3px;
  animation: genSlide 1.2s ease-in-out infinite;
}
.gen-loading-bar-inner.cyan { background: var(--accent); }
.gen-loading-bar-inner.green { background: var(--accent-green); }
@keyframes genPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
@keyframes genSlide {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(250%); }
  100% { transform: translateX(-100%); }
}

.new-chat-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.new-chat-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent);
}

.history-label {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 16px 8px 8px;
  font-weight: 600;
  text-transform: uppercase;
}

.chat-history {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}

.chat-history::-webkit-scrollbar { width: 6px; }
.chat-history::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.history-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.15s;
  border: 1px solid transparent;
  position: relative;
}

.history-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.history-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

.history-item .hist-text {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.history-item .hist-delete {
  display: none; background: none; border: none;
  color: var(--text-muted); cursor: pointer; padding: 2px;
  font-size: 16px; line-height: 1;
}

.history-item:hover .hist-delete { display: block; }
.history-item .hist-delete:hover { color: #C4442F; }

.sidebar-footer {
  padding-top: 12px; border-top: 1px solid var(--border); margin-top: 12px;
}

.db-badge {
  display: flex; align-items: center; gap: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 11px; letter-spacing: 0.3px; font-weight: 500;
  color: var(--accent-green);
  padding: 8px 10px;
  background: rgba(110, 140, 95, 0.08);
  border: 1px solid rgba(110, 140, 95, 0.2);
  border-radius: var(--radius-sm);
}

/* ---- Main Chat ---- */
.chat-main {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0;
  background: var(--bg-primary);
}

.chat-header {
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
  display: flex; align-items: center; gap: 12px;
}

.menu-btn {
  display: none;
  background: none; border: none;
  color: var(--text-secondary);
  cursor: pointer; padding: 4px;
}

.header-title h1 {
  font-family: 'Inter', sans-serif;
  font-size: 15px; font-weight: 600; letter-spacing: 0;
  color: var(--text-primary);
}

.header-title h1 em {
  font-style: normal;
  color: var(--accent);
}

.header-status {
  display: flex; align-items: center; gap: 6px;
  margin-top: 2px;
  font-size: 11px;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.3px;
  color: var(--accent-green);
  font-weight: 500;
}

.status-dot {
  width: 6px; height: 6px;
  background: var(--accent-green);
  border-radius: 50%;
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---- Messages ---- */
.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 24px 8%;
  display: flex; flex-direction: column; gap: 20px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 8px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

/* Welcome */
.welcome-screen {
  display: flex; flex-direction: column; align-items: center;
  padding: 80px 20px 20px;
  text-align: center;
  position: relative;
}

.welcome-glow { display: none; }

.welcome-icon {
  width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
  border-radius: 16px;
  color: var(--accent);
  margin-bottom: 20px;
}

.welcome-screen h2 {
  font-size: 26px; font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.welcome-sub {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 32px;
}

.suggestion-chips {
  display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: center; max-width: 700px;
}

.chip {
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 13px; font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg-card);
}

/* Message */
.message {
  display: flex; gap: 12px;
  max-width: 75%;
  animation: msgIn 0.3s ease;
}

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

.message.assistant { margin-right: auto; }
.message.user { flex-direction: row-reverse; margin-left: auto; max-width: 60%; }

.message.assistant:has(.chat-chart-container) { max-width: 92%; }
.message.assistant:has(table) { max-width: 92%; }

.message-avatar {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-family: 'Inter', sans-serif;
  font-size: 10px; font-weight: 600; letter-spacing: 0.5px;
}

.message.assistant .message-avatar {
  background: var(--accent-soft);
  border: 1px solid var(--border-glow);
  color: var(--accent);
}

.message.user .message-avatar {
  background: var(--user-bubble);
  border: 1px solid var(--user-border);
  color: var(--user-text);
}

.message-content {
  padding: 12px 16px;
  border-radius: var(--radius);
  line-height: 1.65;
  font-size: 14px;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  min-width: 0;
}

.message.assistant .message-content {
  max-width: 100%;
  min-width: 0;
  white-space: normal;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.message.assistant .message-content:has(.chat-chart-container) { flex: 1; }
.message.assistant .message-content .response-content { white-space: pre-wrap; }

.message.user .message-content {
  background: var(--user-bubble);
  border: 1px solid var(--user-border);
  border-bottom-right-radius: 4px;
  color: var(--user-text);
}

.message-content strong, .message-content b { font-weight: 600; color: var(--text-primary); }
.message-content ul, .message-content ol { padding-left: 20px; margin: 4px 0; }
.message-content h1 {
  font-size: 20px; font-weight: 700; color: var(--text-primary);
  margin: 16px 0 8px; letter-spacing: -0.2px;
}
.message-content h2 {
  font-size: 17px; font-weight: 600; color: var(--text-primary);
  margin: 14px 0 6px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.1px;
}
.message-content h3 {
  font-size: 15px; font-weight: 600; color: var(--text-primary);
  margin: 12px 0 4px;
}
.message-content h4 {
  font-size: 14px; font-weight: 600; color: var(--text-secondary);
  margin: 10px 0 4px;
}
.message-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 12px;
  margin: 8px 0;
  color: var(--text-secondary);
  font-style: italic;
  background: var(--accent-soft);
  border-radius: 0 6px 6px 0;
}

.message-content code {
  background: var(--bg-hover);
  padding: 2px 6px; border-radius: 4px;
  font-size: 13px; color: var(--accent);
  font-family: 'SF Mono', Monaco, Consolas, monospace;
}

.message-content pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 12px; border-radius: 8px;
  overflow-x: auto; margin: 8px 0;
}

.message-content pre code { background: none; padding: 0; }

.message-content table {
  border-collapse: collapse;
  width: max-content;
  min-width: 50%;
  margin: 12px 0;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
}

.message-content th, .message-content td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  white-space: nowrap;
}

.message-content th {
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 12px;
}

.message-content td {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.message-content tr:hover td { background: var(--bg-hover); }
.message-content tr:nth-child(even) td { background: var(--bg-secondary); }
.message-content tr:nth-child(even):hover td { background: var(--bg-hover); }

/* ---- Thinking Block ---- */
.thinking-block {
  margin-bottom: 10px;
  border-left: 2px solid var(--border-glow);
  padding: 6px 12px;
  background: var(--accent-soft);
  border-radius: 0 6px 6px 0;
}
.thinking-summary {
  font-size: 12px; color: var(--text-secondary);
  cursor: pointer; font-weight: 500;
  list-style: none;
}
.thinking-summary::-webkit-details-marker { display: none; }
.thinking-summary::before {
  content: '▸ '; color: var(--accent);
}
.thinking-block[open] .thinking-summary::before { content: '▾ '; }
.thinking-steps { margin-top: 6px; padding-left: 4px; }
.thinking-step {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 3px 0;
  line-height: 1.5;
}

/* Typing indicator */
.typing-indicator {
  display: inline-flex; gap: 4px; padding: 6px 0;
}
.typing-indicator span {
  width: 6px; height: 6px; background: var(--text-muted);
  border-radius: 50%;
  animation: typeBounce 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typeBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ---- Input ---- */
.chat-input-area {
  padding: 16px 8% 20px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
}

.input-wrapper {
  max-width: 900px;
  margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 12px;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-wrapper textarea {
  flex: 1;
  background: transparent; border: none; outline: none;
  color: var(--text-primary);
  font-size: 14px; font-family: inherit;
  resize: none; max-height: 150px; line-height: 1.5;
}

.input-wrapper textarea::placeholder { color: var(--text-muted); }

.send-btn {
  width: 32px; height: 32px;
  background: var(--accent);
  border: none; border-radius: 8px;
  color: #FFFFFF;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

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

.send-btn:disabled {
  opacity: 0.4; cursor: not-allowed;
  background: var(--text-muted);
}

/* ---- Inline Charts ---- */
.chat-chart-container {
  width: 100%;
  min-width: 500px;
  aspect-ratio: 16 / 10;
  margin-top: 12px;
  padding: 20px 16px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

/* ---- Header Action Buttons ---- */
.header-actions {
  display: flex; gap: 8px; margin-left: auto;
}

.header-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; min-width: 100px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 12px; font-weight: 500; letter-spacing: 0.3px;
  cursor: pointer; transition: color 0.2s, border-color 0.2s, background 0.2s;
  white-space: nowrap;
}
.header-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.header-btn.btn-green { color: var(--accent-green); border-color: rgba(110,140,95,0.3); }
.header-btn.btn-green:hover { border-color: var(--accent-green); background: rgba(110,140,95,0.06); }

.lang-toggle {
  background: var(--bg-card);
  border: 1px solid rgba(184, 135, 74, 0.3);
  color: var(--accent-amber);
  font-family: 'Inter', sans-serif;
  font-size: 12px; font-weight: 600;
  padding: 7px 14px; border-radius: var(--radius-sm);
  cursor: pointer; letter-spacing: 0.3px;
  transition: all 0.2s;
  min-width: 40px; text-align: center; white-space: nowrap;
}
.lang-toggle:hover {
  border-color: var(--accent-amber);
  background: rgba(184, 135, 74, 0.06);
}

/* ---- Report Overlay ---- */
.report-overlay {
  position: fixed; inset: 0;
  background: rgba(245, 244, 238, 0.85);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
}
.report-overlay.active { display: flex; }

.report-container {
  width: 100%; max-width: 1400px; height: 100%; max-height: 900px;
  background: var(--bg-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
}

.report-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  background: var(--bg-card);
}

.report-tabs { display: flex; gap: 4px; }

.report-tab {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 12px; font-weight: 500; letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.2s;
}
.report-tab:hover { color: var(--text-primary); }
.report-tab.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.report-info {
  font-family: 'Inter', sans-serif;
  font-size: 11px; font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-left: auto;
}

.report-actions { display: flex; gap: 6px; }

.report-action-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 11px; font-weight: 500; letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.2s;
}
.report-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.report-body {
  flex: 1; display: flex; overflow: auto;
}

.report-main {
  flex: 1; display: flex; flex-direction: column;
  align-items: stretch; justify-content: flex-start;
  overflow: auto; padding: 24px 32px;
  position: relative;
}

/* Slide pages */
.slide-page {
  display: none; flex-direction: column; justify-content: flex-start;
  width: 100%; height: 100%; padding: 40px 48px;
  animation: slideFade 0.3s ease; overflow-y: auto;
}
.slide-page.active { display: flex; }

@keyframes slideFade {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

.slide-page.title-slide { align-items: center; align-self: center; text-align: center; justify-content: center; }

.slide-page h1 {
  font-family: 'Inter', sans-serif; font-size: 32px; font-weight: 700;
  letter-spacing: -0.5px; color: var(--text-primary);
  margin-bottom: 14px;
}
.slide-page .slide-subtitle { font-size: 17px; color: var(--text-secondary); font-weight: 400; }
.slide-page h2 {
  font-family: 'Inter', sans-serif; font-size: 22px; font-weight: 600;
  color: var(--text-primary); letter-spacing: -0.2px;
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.slide-page ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.slide-page li {
  font-size: 15px; color: var(--text-primary);
  padding-left: 20px; position: relative; line-height: 1.6;
}
.slide-page li::before {
  content: ''; position: absolute;
  left: 0; top: 9px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}
.slide-page p { font-size: 14px; line-height: 1.7; color: var(--text-primary); margin: 4px 0; }
.slide-page .slide-note {
  font-size: 13px; color: var(--text-secondary); font-style: italic;
  border-left: 2px solid var(--border-glow); padding-left: 10px; margin: 8px 0;
}
.slide-page strong { color: var(--accent); font-weight: 600; }

/* Hero layout: chart is the primary visual, table is compact reference */
.slide-layout-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 32px;
  align-items: center;
  width: 100%;
  margin: 16px 0;
}
.slide-layout-hero .slide-chart-placeholder { min-height: 360px; }
.slide-table-compact {
  max-height: 420px; overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 4px;
}
.slide-table-compact .slide-table {
  width: 100%; border: none; border-radius: 0; font-size: 12px;
}
.slide-table-compact .slide-table th { padding: 8px 10px; font-size: 11px; }
.slide-table-compact .slide-table td { padding: 6px 10px; font-size: 12px; }

/* KPI cards grid: premium big-number display for metric tables */
.slide-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  width: 100%;
  margin: 24px 0;
}
.slide-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 28px 24px;
  position: relative;
  transition: all 0.25s;
  overflow: hidden;
}
.slide-kpi-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; background: var(--accent);
  border-radius: var(--radius) 0 0 var(--radius);
}
.slide-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}
.slide-kpi-value {
  font-size: 36px; font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
}
.slide-kpi-unit {
  font-size: 14px; font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0;
}
.slide-kpi-label {
  margin-top: 8px;
  font-size: 13px; font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

.slide-table-centered {
  display: flex; justify-content: center; width: 100%; margin: 20px 0;
}

.slide-chart-placeholder { min-height: 320px; width: 100%; }

/* Slide table */
.slide-table {
  border-collapse: collapse; width: max-content; margin: 12px 0; font-size: 13px;
  border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden;
}
.slide-table th {
  background: var(--bg-secondary); color: var(--text-primary); font-weight: 600;
  padding: 8px 14px; text-align: center; font-size: 12px;
  border: 1px solid var(--border); white-space: nowrap;
}
.slide-table td {
  padding: 7px 14px; text-align: center; color: var(--text-primary);
  border: 1px solid var(--border); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.slide-table tr:nth-child(even) td { background: var(--bg-secondary); }
.slide-table tr:hover td { background: var(--bg-hover); }

/* Table view inside report */
.table-view { width: 100%; min-width: max-content; height: 100%; overflow: visible; padding: 16px 32px 24px; }
.table-view h3 {
  font-family: 'Inter', sans-serif; font-size: 16px; font-weight: 600;
  color: var(--text-primary); letter-spacing: -0.2px; margin: 24px 0 12px;
}
.table-view h3:first-child { margin-top: 0; }
.table-view table {
  width: max-content; min-width: 60%; border-collapse: collapse;
  margin-bottom: 30px; font-size: 13px;
  border: 1px solid var(--border-strong); border-radius: 6px;
}
.table-view th {
  background: var(--bg-secondary); color: var(--text-primary); font-weight: 600;
  padding: 10px 16px; border: 1px solid var(--border);
  text-align: left; white-space: nowrap;
}
.table-view td {
  padding: 9px 16px; border: 1px solid var(--border);
  color: var(--text-primary); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.table-view tr:nth-child(even) td { background: var(--bg-secondary); }
.table-view tr:hover td { background: var(--bg-hover); }

/* ---- Report Nav ---- */
.report-nav {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 12px; border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.report-nav.hidden { display: none; }

.slide-nav-btn {
  width: 32px; height: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.slide-nav-btn:hover {
  border-color: var(--accent); color: var(--accent);
}

.slide-dots { display: flex; gap: 6px; }
.slide-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--border-strong);
  cursor: pointer; transition: all 0.2s;
}
.slide-dot:hover { background: var(--text-muted); }
.slide-dot.active { background: var(--accent); width: 18px; border-radius: 3px; }

/* ---- Report Chat (Edit) ---- */
.report-chat {
  width: 0; overflow: hidden; transition: width 0.3s;
  border-left: 1px solid var(--border);
  background: var(--bg-secondary);
}
.report-chat.open { width: 320px; }

.rchat-header {
  padding: 14px 16px;
  font-family: 'Inter', sans-serif;
  font-size: 12px; font-weight: 600; letter-spacing: 0.3px;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
}

.rchat-messages {
  flex: 1; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  overflow-y: auto; height: calc(100% - 120px);
}

.rchat-msg {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px; line-height: 1.5;
  max-width: 90%;
}
.rchat-msg.user {
  align-self: flex-end;
  background: var(--user-bubble);
  color: var(--user-text);
}
.rchat-msg.ai {
  align-self: flex-start;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.rchat-input {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px;
  background: var(--bg-card);
}
.rchat-input input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px; font-family: inherit;
  outline: none;
}
.rchat-input input:focus { border-color: var(--accent); }
.rchat-input input:disabled { opacity: 0.5; cursor: not-allowed; }
.rchat-input button {
  width: 32px; height: 32px;
  background: var(--accent);
  border: none; border-radius: var(--radius-sm);
  color: #FFFFFF; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.rchat-input button:hover { background: var(--accent-hover); }

/* ---- Toast ---- */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 10px 18px;
  background: var(--text-primary);
  color: var(--bg-primary);
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
}

/* ---- Header Icon Button (e.g. About / Intro) ---- */
.icon-btn {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* =====================================================
   Intro Overlay (first-visit AI introduction)
   ===================================================== */
.intro-overlay {
  position: fixed; inset: 0;
  background: rgba(43, 38, 33, 0.32);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 200;
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.intro-overlay.active {
  display: flex;
  opacity: 1;
}

.intro-modal {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-primary) 100%);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  box-shadow:
    0 20px 60px rgba(60, 50, 40, 0.18),
    0 8px 24px rgba(60, 50, 40, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  padding: 44px 44px 32px;
  transform: scale(0.96) translateY(8px);
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.35s ease;
}
.intro-overlay.active .intro-modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.intro-modal::-webkit-scrollbar { width: 6px; }
.intro-modal::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

/* Subtle decorative glow ring behind logo */
.intro-glow-ring {
  position: absolute;
  top: -120px; left: 50%; transform: translateX(-50%);
  width: 380px; height: 380px;
  background: radial-gradient(circle, rgba(217, 119, 87, 0.16) 0%, rgba(217, 119, 87, 0) 65%);
  pointer-events: none;
  z-index: 0;
}

.intro-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  z-index: 2;
  transition: all 0.2s;
}
.intro-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border);
}

.intro-hero {
  position: relative;
  z-index: 1;
  text-align: center;
  margin-bottom: 24px;
}

.intro-logo {
  position: relative;
  width: 72px; height: 72px;
  margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
  border: 1px solid var(--border-glow);
  border-radius: 20px;
  color: var(--accent);
  box-shadow: 0 4px 16px rgba(217, 119, 87, 0.12);
}
.intro-logo-pulse {
  position: absolute; inset: -6px;
  border-radius: 22px;
  border: 1px solid var(--accent);
  opacity: 0;
  animation: introPulse 2.4s ease-out infinite;
}
@keyframes introPulse {
  0% { opacity: 0.55; transform: scale(0.94); }
  100% { opacity: 0; transform: scale(1.18); }
}

.intro-greeting {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
  margin-bottom: 6px;
}

.intro-title {
  font-family: 'Inter', sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.2;
}
.intro-title em {
  font-style: normal;
  color: var(--accent);
  background: linear-gradient(135deg, var(--accent) 0%, #B8874A 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.intro-tagline {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: 0.1px;
}

.intro-desc {
  position: relative; z-index: 1;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
  text-align: center;
  max-width: 560px;
  margin: 0 auto 28px;
}

.intro-section-label {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 4px 0 14px;
}
.intro-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-strong), transparent);
}

/* Feature grid */
.intro-features {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 26px;
}

.intro-feature {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  opacity: 0;
  transform: translateY(8px);
  animation: introFeatureIn 0.5s ease forwards;
  animation-delay: calc(0.12s + var(--i) * 0.06s);
}
@keyframes introFeatureIn {
  to { opacity: 1; transform: translateY(0); }
}

.intro-feature:hover {
  transform: translateY(-2px);
  border-color: var(--border-glow);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  width: 36px; height: 36px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
  border-radius: 10px;
  color: var(--accent);
}
.intro-feature:nth-child(2) .feature-icon { background: rgba(110, 140, 95, 0.10); color: var(--accent-green); }
.intro-feature:nth-child(4) .feature-icon { background: rgba(110, 140, 95, 0.10); color: var(--accent-green); }
.intro-feature:nth-child(5) .feature-icon { background: rgba(184, 135, 74, 0.10); color: var(--accent-amber); }

.feature-text { min-width: 0; flex: 1; }
.feature-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
  letter-spacing: 0;
}
.feature-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Example chips */
.intro-examples {
  position: relative; z-index: 1;
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 28px;
}

.intro-example {
  padding: 8px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}
.intro-example:hover {
  background: var(--bg-card);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.intro-footer {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}

.intro-start-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 28px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #FFFFFF;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(217, 119, 87, 0.28);
}
.intro-start-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(217, 119, 87, 0.36);
}
.intro-start-btn:hover svg { transform: translateX(3px); }
.intro-start-btn svg { transition: transform 0.2s; }

.intro-tip {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.2px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    z-index: 50; transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: block; }
  .chat-messages { padding: 16px; }
  .message { max-width: 100%; }
  .chat-input-area { padding: 12px; }
  .header-btn { min-width: 70px; padding: 7px 10px; }
  .header-btn span { display: none; }

  .intro-modal { padding: 36px 22px 24px; border-radius: 16px; }
  .intro-title { font-size: 22px; }
  .intro-features { grid-template-columns: 1fr; }
  .intro-glow-ring { width: 280px; height: 280px; top: -90px; }
}
