/* DocuDigest SaaS Design System & Styles */
:root {
  /* Brand */
  --brand-50: #eef2ff;
  --brand-100: #e0e7ff;
  --brand-200: #c7d2fe;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;
  --brand-800: #3730a3;
  --brand-900: #312e81;
  --brand-fg: var(--brand-600);
  --brand-bg-subtle: var(--brand-50);

  /* Neutrals (slate) */
  --neutral-0: #ffffff;
  --neutral-50: #f8fafc;
  --neutral-100: #f1f5f9;
  --neutral-200: #e2e8f0;
  --neutral-300: #cbd5e1;
  --neutral-400: #94a3b8;
  --neutral-500: #64748b;
  --neutral-600: #475569;
  --neutral-700: #334155;
  --neutral-800: #1e293b;
  --neutral-900: #0f172a;
  --neutral-950: #020617;

  /* Surfaces */
  --bg-canvas: #f8fafc;
  --bg-surface: #ffffff;
  --bg-elevated: #ffffff;
  --bg-hover: #f1f5f9;

  --text-primary: #0f172a;
  --text-muted: #475569;
  --text-subtle: #94a3b8;

  --border-default: #e2e8f0;
  --border-strong: #cbd5e1;

  /* Semantics */
  --success-fg: #15803d;
  --success-bg: #dcfce7;
  --success-border: #86efac;

  --warning-fg: #b45309;
  --warning-bg: #fef3c7;
  --warning-border: #fde68a;

  --error-fg: #b91c1c;
  --error-bg: #fee2e2;
  --error-border: #fca5a5;

  --info-fg: #1d4ed8;
  --info-bg: #dbeafe;
  --info-border: #93c5fd;

  --price-fg: #047857;
  --price-bg: #ecfdf5;
  --price-border: #a7f3d0;

  /* Typography */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

  /* Spacing */
  --space-unit: 4px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05), 0 1px 3px 0 rgba(15, 23, 42, 0.06);
  --shadow-md: 0 2px 4px -1px rgba(15, 23, 42, 0.06), 0 4px 6px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 4px 6px -2px rgba(15, 23, 42, 0.05), 0 10px 15px -3px rgba(15, 23, 42, 0.08);
  --shadow-xl: 0 8px 10px -4px rgba(15, 23, 42, 0.06), 0 20px 25px -5px rgba(15, 23, 42, 0.10);
  --ring-focus: 0 0 0 3px rgba(79, 70, 229, 0.22);
}

html.dark {
  --bg-canvas: #090d16;
  --bg-surface: #111726;
  --bg-elevated: #1a2236;
  --bg-hover: rgba(255, 255, 255, 0.05);

  --text-primary: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;

  --border-default: #1e293b;
  --border-strong: #334155;

  --brand-fg: #818cf8;
  --brand-bg-subtle: rgba(99, 102, 241, 0.15);

  --success-fg: #4ade80;
  --success-bg: rgba(34, 197, 94, 0.16);
  --success-border: rgba(34, 197, 94, 0.3);

  --warning-fg: #fbbf24;
  --warning-bg: rgba(245, 158, 11, 0.16);
  --warning-border: rgba(245, 158, 11, 0.3);

  --error-fg: #f87171;
  --error-bg: rgba(239, 68, 68, 0.16);
  --error-border: rgba(239, 68, 68, 0.3);

  --info-fg: #60a5fa;
  --info-bg: rgba(59, 130, 246, 0.16);
  --info-border: rgba(59, 130, 246, 0.3);

  --price-fg: #34d399;
  --price-bg: rgba(16, 185, 129, 0.16);
  --price-border: rgba(16, 185, 129, 0.3);

  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 8px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 20px -6px rgba(0, 0, 0, 0.55);
  --shadow-xl: 0 20px 32px -10px rgba(0, 0, 0, 0.6);
}

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

body {
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* App Shell Structure */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Topbar */
.topbar {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  z-index: 30;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
}

.logo-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);
}

.price-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--price-bg);
  color: var(--price-fg);
  border: 1px solid var(--price-border);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.topbar-center {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 440px;
  margin: 0 16px;
}

.search-bar {
  position: relative;
  width: 100%;
}

.search-bar svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 32px;
  padding: 0 10px 0 32px;
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 12px;
  transition: all 0.15s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--brand-fg);
  box-shadow: var(--ring-focus);
  background: var(--bg-surface);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wallet-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.wallet-badge:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.wallet-amount {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--brand-fg);
}

/* Layout Main Body */
.main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 290px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-default);
}

.sidebar-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--text-muted);
}

.sidebar-doc-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.doc-card {
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 10px 10px;
  cursor: pointer;
  transition: all 0.12s ease;
  width: 100%;
}

.doc-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-default);
}

.doc-card.active {
  background: var(--brand-bg-subtle);
  border-color: rgba(99, 102, 241, 0.3);
}

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

.doc-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.doc-card.active .doc-title {
  color: var(--brand-fg);
}

.doc-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.doc-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  font-size: 10px;
  color: var(--text-muted);
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-default);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pricing-notice {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
}

/* Content Area */
.content-area {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--bg-canvas);
}

/* Document Top Header Banner */
.doc-header-banner {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  padding: 16px 24px;
}

.doc-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.doc-header-info {
  flex: 1;
  min-width: 280px;
}

.doc-badge-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
}

.badge-brand {
  background: var(--brand-bg-subtle);
  color: var(--brand-fg);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.badge-success {
  background: var(--success-bg);
  color: var(--success-fg);
  border: 1px solid var(--success-border);
}

.badge-neutral {
  background: var(--bg-canvas);
  color: var(--text-muted);
  border: 1px solid var(--border-default);
}

.badge-price {
  background: var(--price-bg);
  color: var(--price-fg);
  border: 1px solid var(--price-border);
  font-weight: 600;
}

.doc-main-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.doc-subtitle-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.doc-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Nav Tabs */
.tab-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 14px;
  border-bottom: 1px solid var(--border-default);
  padding-bottom: 0;
  overflow-x: auto;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

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

.tab-btn.active {
  color: var(--brand-fg);
  border-bottom-color: var(--brand-fg);
  font-weight: 600;
}

.tab-count {
  background: var(--bg-canvas);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.tab-btn.active .tab-count {
  background: var(--brand-bg-subtle);
  color: var(--brand-fg);
}

/* Main Viewport Container */
.viewport-body {
  padding: 20px 24px 60px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* KPI Strip */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}

.kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.kpi-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Surface Cards */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 16px;
}

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

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Executive Summary Box */
.executive-summary-text {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  border-left: 3px solid var(--brand-fg);
}

/* Highlights List */
.highlights-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.highlight-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  transition: all 0.15s ease;
}

.highlight-item:hover {
  border-color: var(--border-strong);
}

.citation-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--brand-bg-subtle);
  color: var(--brand-fg);
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid rgba(99, 102, 241, 0.2);
  transition: all 0.12s ease;
  margin-left: 6px;
}

.citation-chip:hover {
  background: var(--brand-100);
}

/* Chapter Breakdown Accordion */
.chapter-accordion {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chapter-item {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.chapter-item:hover {
  border-color: var(--border-strong);
}

.chapter-item.expanded {
  border-color: var(--brand-fg);
  box-shadow: var(--shadow-sm);
}

.chapter-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: var(--bg-surface);
  user-select: none;
}

.chapter-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.chapter-number {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-muted);
}

.chapter-item.expanded .chapter-number {
  background: var(--brand-fg);
  color: white;
  border-color: var(--brand-fg);
}

.chapter-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.chapter-pages {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.chapter-body {
  padding: 14px 16px 18px;
  border-top: 1px solid var(--border-default);
  background: var(--bg-canvas);
}

.chapter-gist {
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.5;
  font-style: italic;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border-default);
}

.chapter-points {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chapter-point {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-primary);
}

.chapter-point-bullet {
  color: var(--brand-fg);
  font-weight: bold;
}

/* Audio Player Widget */
.audio-player-card {
  background: linear-gradient(145deg, var(--bg-surface), var(--bg-canvas));
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 20px;
}

.audio-player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.play-btn-large {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--brand-fg);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.35);
  transition: transform 0.15s ease;
}

.play-btn-large:hover {
  transform: scale(1.05);
}

.play-btn-large:active {
  transform: scale(0.97);
}

.scrubber-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.scrubber-bar {
  width: 100%;
  height: 6px;
  background: var(--border-strong);
  border-radius: var(--radius-full);
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.scrubber-fill {
  height: 100%;
  background: var(--brand-fg);
  border-radius: var(--radius-full);
  transition: width 0.1s linear;
}

.scrubber-times {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.audio-transcript-box {
  margin-top: 14px;
  padding: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 12px;
  line-height: 1.6;
  max-height: 140px;
  overflow-y: auto;
}

/* Chat Q&A View */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 220px);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 85%;
}

.chat-msg.user {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-msg.assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.chat-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  line-height: 1.5;
}

.chat-msg.user .chat-bubble {
  background: var(--brand-fg);
  color: white;
  border-bottom-right-radius: 2px;
}

.chat-msg.assistant .chat-bubble {
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  border-bottom-left-radius: 2px;
}

.chat-prompt-pills {
  padding: 8px 16px;
  border-top: 1px solid var(--border-default);
  background: var(--bg-canvas);
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

.prompt-pill {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  color: var(--text-muted);
  font-size: 11.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s ease;
}

.prompt-pill:hover {
  background: var(--brand-bg-subtle);
  border-color: var(--brand-fg);
  color: var(--brand-fg);
}

.chat-input-bar {
  padding: 12px 16px;
  border-top: 1px solid var(--border-default);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-input {
  flex: 1;
  height: 36px;
  padding: 0 12px;
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
}

.chat-input:focus {
  outline: none;
  border-color: var(--brand-fg);
  box-shadow: var(--ring-focus);
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.data-table th {
  text-align: left;
  padding: 8px 12px;
  background: var(--bg-canvas);
  border-bottom: 1px solid var(--border-default);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

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

.data-table tr:hover td {
  background: var(--bg-hover);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background: var(--brand-fg);
  color: #ffffff;
}

.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-sm {
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.btn-lg {
  height: 38px;
  padding: 0 16px;
  font-size: 13.5px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.15s ease;
}

.modal-dialog {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 540px;
  overflow: hidden;
  animation: dialogEnter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-default);
  background: var(--bg-canvas);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* Drag & Drop Upload Zone */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  text-align: center;
  background: var(--bg-canvas);
  cursor: pointer;
  transition: all 0.15s ease;
}

.dropzone:hover, .dropzone.drag-active {
  border-color: var(--brand-fg);
  background: var(--brand-bg-subtle);
}

/* Pipeline Progress */
.pipeline-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.pipeline-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  font-size: 12px;
}

.pipeline-step.active {
  border-color: var(--brand-fg);
  background: var(--brand-bg-subtle);
  color: var(--brand-fg);
  font-weight: 500;
}

.pipeline-step.done {
  border-color: var(--success-border);
  color: var(--success-fg);
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
  color: var(--text-primary);
  animation: slideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

@keyframes dialogEnter {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

/* Responsive adjustments */
@media (max-width: 900px) {
  .sidebar {
    width: 250px;
  }
}

@media (max-width: 768px) {
  .main-layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: 180px;
    border-right: none;
    border-bottom: 1px solid var(--border-default);
  }
  .viewport-body {
    padding: 14px;
  }
}
