/* ═══════════════════════════════════════════
   ClauseGuard — Contract Red-Flag Scanner
   Design System & Styles
   ═══════════════════════════════════════════ */

/* ═══ RESET & BASE ═══ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #fafbfc;
  --bg-alt: #f0f2f5;
  --surface: #ffffff;
  --surface-card: #ffffff;
  --surface-hover: #f8f9fa;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f0f0f0;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.15);
  --gradient-1: linear-gradient(135deg, #6366f1, #8b5cf6);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --critical: #e74c3c;
  --high: #e67e22;
  --medium: #f1c40f;
  --info: #3498db;
  --success: #27ae60;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
  --topbar-h: 56px;
}

[data-theme="dark"] {
  --bg: #0f1117;
  --bg-alt: #161822;
  --surface: #1a1c2b;
  --surface-card: #1e2030;
  --surface-hover: #252840;
  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #2d3050;
  --border-light: #252840;
  --primary-glow: rgba(99, 102, 241, 0.1);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
  -webkit-font-smoothing: antialiased;
}

/* ═══ GRID BACKGROUND ═══ */
.bg-grid {
  position: fixed; inset: 0; z-index: -1;
  background-image:
    linear-gradient(var(--border-light) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-light) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.5;
  pointer-events: none;
}
[data-theme="dark"] .bg-grid { opacity: 0.25; }

/* ═══ TOPBAR ═══ */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
  transition: background 0.3s;
}
[data-theme="dark"] .topbar { background: rgba(15,17,23,0.85); }

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.topbar-logo { font-size: 20px; }
.topbar-title { font-weight: 700; font-size: 16px; }
.topbar-badge {
  background: var(--gradient-1); color: white;
  font-size: 10px; padding: 1px 5px; border-radius: 4px; font-weight: 600;
}

.topbar-tabs { display: flex; gap: 2px; flex: 1; justify-content: center; }

.tab-btn {
  background: none; border: none;
  padding: 8px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; cursor: pointer;
  color: var(--text-muted); transition: all 0.15s;
  font-family: var(--font); white-space: nowrap;
}
.tab-btn:hover { color: var(--text); background: var(--surface-hover); }
.tab-btn.active { background: var(--primary); color: white; }
.tab-btn:disabled { opacity: 0.4; cursor: default; }
.tab-btn:disabled:hover { background: none; color: var(--text-muted); }

.topbar-actions { display: flex; align-items: center; gap: 4px; }

.theme-toggle {
  background: none; border: 1px solid var(--border);
  padding: 5px 9px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 15px; transition: all 0.2s;
}
.theme-toggle:hover { background: var(--surface-hover); border-color: var(--text-muted); }

/* ═══ MAIN CONTENT ═══ */
.main-content { padding-top: var(--topbar-h); }

/* ═══ COMPACT HERO ═══ */
.hero-compact {
  padding: 32px 16px 8px;
}
.hero-compact-inner {
  max-width: 900px;
  margin: 0 auto;
}
.hero-compact-text { margin-bottom: 12px; }
.hero-compact-title {
  font-size: clamp(22px, 3.5vw, 36px);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}
.gradient-text {
  background: var(--gradient-1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-compact-sub {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ═══ TAB PANELS ═══ */
.tab-panel { display: none; padding: 8px 16px 40px; }
.tab-panel.active { display: block; }

.panel-inner {
  max-width: 900px;
  margin: 0 auto;
}

/* ═══ DISCLAIMERS ═══ */
.disclaimer-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  line-height: 1.5;
  background: rgba(243, 156, 18, 0.08);
  border: 1px solid rgba(243, 156, 18, 0.25);
  color: var(--text-secondary);
}
/* ═══ LIBRARY DETAIL ═══ */
.lib-card {
  cursor: pointer;
  transition: all 0.15s;
}
.lib-card:hover { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); transform: translateY(-1px); }

.library-detail {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.lib-detail-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
}
.lib-detail-close {
  background: none; border: none; cursor: pointer;
  font-size: 16px; color: var(--text-muted);
  padding: 2px 6px; border-radius: var(--radius-sm);
}
.lib-detail-close:hover { background: var(--surface-hover); color: var(--text); }
.lib-detail-list { padding: 8px; }
.lib-detail-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.4;
  transition: background 0.1s;
}
.lib-detail-item:hover { background: var(--surface-hover); }
.lib-detail-item .badge {
  flex-shrink: 0;
}
.lib-detail-item-text {
  color: var(--text-secondary);
}
.input-disclaimer { margin-bottom: 14px; }
.disclaimer-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.disclaimer-banner strong { color: var(--text); }

.results-disclaimer {
  background: rgba(231, 76, 60, 0.06);
  border: 1px solid rgba(231, 76, 60, 0.15);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}
.results-disclaimer strong { color: var(--critical); }

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 13px; cursor: pointer;
  transition: all 0.15s; font-family: var(--font);
  border: none; white-space: nowrap;
}
.btn-primary { background: var(--gradient-1); color: white; box-shadow: 0 2px 8px var(--primary-glow); }
.btn-primary:hover { transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--surface-hover); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-scan { padding: 10px 24px; font-size: 14px; }

/* ═══ INPUT CARD ═══ */
.input-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

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

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

.input-tab {
  background: none; border: none; padding: 5px 12px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 500; cursor: pointer;
  color: var(--text-muted); transition: all 0.2s; font-family: var(--font);
}
.input-tab:hover { color: var(--text); background: var(--surface-hover); }
.input-tab.active { background: var(--primary); color: white; }

.input-card-actions { display: flex; align-items: center; gap: 6px; }

.word-count { font-size: 11px; color: var(--text-muted); font-weight: 500; }

.input-tab-content { display: none; }
.input-tab-content.active { display: block; }

.contract-input {
  width: 100%;
  min-height: 280px;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
  border: none;
  resize: vertical;
  background: var(--bg-alt);
  color: var(--text);
  outline: none;
}
[data-theme="dark"] .contract-input { background: #12141f; }
.contract-input::placeholder { color: var(--text-muted); }

.input-card-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap; gap: 8px;
}

.input-hints { font-size: 11px; color: var(--text-muted); }
.input-hints kbd {
  padding: 1px 5px; border-radius: 3px;
  background: var(--surface-hover); border: 1px solid var(--border);
  font-family: var(--font); font-size: 11px;
}

/* ═══ PROGRESS ═══ */
.scan-progress { margin-bottom: 20px; }
.progress-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--gradient-1); border-radius: 2px; width: 0%; transition: width 0.3s ease; }
.progress-text { font-size: 12px; color: var(--text-secondary); margin-top: 6px; text-align: center; }

/* ═══ RESULTS ═══ */
.results-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: 8px; margin-bottom: 8px;
}
.results-title-group { display: flex; flex-direction: column; }
.results-subtitle { font-size: 11px; color: var(--text-muted); }
.results-actions { display: flex; gap: 4px; align-items: center; }

.section-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.3px;
  margin-bottom: 6px;
}
.section-desc {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ═══ SCORE DASHBOARD ═══ */
.score-dashboard {
  display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap;
}
.score-card {
  flex: 1; min-width: 80px;
  padding: 12px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
}
.score-icon { font-size: 16px; }
.score-num { font-size: 22px; font-weight: 800; }
.score-label { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.score-critical .score-num { color: var(--critical); }
.score-high .score-num { color: var(--high); }
.score-medium .score-num { color: var(--medium); }
.score-info .score-num { color: var(--info); }
.score-risk .score-num {
  background: var(--gradient-1); -webkit-background-clip: text;
  background-clip: text; -webkit-text-fill-color: transparent;
}

/* ═══ ANNOTATED ═══ */
.annotated-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 20px;
}
.annotated-title {
  padding: 12px 16px; font-size: 13px; font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.annotated-contract {
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-alt);
}
[data-theme="dark"] .annotated-contract { background: #12141f; }
.annotated-contract mark { padding: 1px 2px; border-radius: 2px; cursor: help; transition: opacity 0.15s; }
.annotated-contract mark:hover { opacity: 0.8; }
.mark-critical { background: rgba(231,76,60,0.2); border-bottom: 2px solid var(--critical); }
.mark-high { background: rgba(230,126,34,0.2); border-bottom: 2px solid var(--high); }
.mark-medium { background: rgba(241,196,15,0.2); border-bottom: 2px solid var(--medium); }
.mark-info { background: rgba(52,152,219,0.2); border-bottom: 2px solid var(--info); }

.annotated-legend {
  display: flex; gap: 12px; padding: 8px 16px;
  border-top: 1px solid var(--border); flex-wrap: wrap;
}
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-secondary); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }

/* ═══ RESULTS FILTER ═══ */
.results-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; flex-wrap: wrap; gap: 8px;
}
.results-filter { display: flex; gap: 4px; }
.filter-btn {
  background: none; border: 1px solid var(--border);
  padding: 5px 12px; border-radius: 20px;
  font-size: 11px; font-weight: 500; cursor: pointer;
  color: var(--text-secondary); transition: all 0.15s; font-family: var(--font);
}
.filter-btn:hover { background: var(--surface-hover); }
.filter-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.results-count { font-size: 12px; color: var(--text-muted); font-weight: 500; }

/* ═══ RESULTS CARDS ═══ */
.results-list { display: flex; flex-direction: column; gap: 8px; }

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.15s;
  opacity: 0;
  animation: slideUp 0.25s ease forwards;
}
.result-card:hover { border-color: var(--text-muted); }

.result-card-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; cursor: pointer; gap: 8px;
}

.result-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px; border-radius: 3px;
  font-size: 10px; font-weight: 600;
}
.badge-critical { background: rgba(231,76,60,0.1); color: var(--critical); }
.badge-high { background: rgba(230,126,34,0.1); color: var(--high); }
.badge-medium { background: rgba(241,196,15,0.12); color: #b8860b; }
.badge-info { background: rgba(52,152,219,0.1); color: var(--info); }
.badge-category { background: var(--surface-hover); color: var(--text-muted); }
.badge-match { background: var(--surface-hover); color: var(--text-secondary); }

.result-title { font-size: 14px; font-weight: 600; }

.result-card-toggle {
  font-size: 11px; color: var(--text-muted); flex-shrink: 0;
  transition: transform 0.15s;
}
.result-card.expanded .result-card-toggle { transform: rotate(180deg); }

.result-card-body { display: none; padding: 0 16px 14px; }
.result-card.expanded .result-card-body { display: block; }

.result-body-content { border-top: 1px solid var(--border-light); padding-top: 10px; }
.result-section { margin-bottom: 10px; }
.result-section:last-child { margin-bottom: 0; }
.result-section-label {
  font-size: 10px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 3px;
}
.result-section-text { font-size: 12px; line-height: 1.55; color: var(--text); }

.result-risk-meter {
  display: flex; align-items: center; gap: 8px;
}
.risk-bar { flex: 1; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.risk-fill { height: 100%; border-radius: 3px; }
.risk-fill-critical { background: var(--critical); }
.risk-fill-high { background: var(--high); }
.risk-fill-medium { background: var(--medium); }
.risk-fill-info { background: var(--info); }

/* ═══ EMPTY ═══ */
.empty-state { text-align: center; padding: 40px 16px; }
.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.empty-state p { color: var(--text-secondary); max-width: 420px; margin: 0 auto 16px; font-size: 14px; }

/* ═══ SAMPLE GRID ═══ */
.sample-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  padding: 16px;
}
.sample-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.sample-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
  transform: translateY(-2px);
}
.sample-card-icon { font-size: 28px; margin-bottom: 6px; }
.sample-card-name { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.sample-card-desc { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
.sample-card-tags { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.sample-tag {
  font-size: 9px; padding: 2px 6px; border-radius: 3px;
  background: var(--surface-hover); color: var(--text-muted);
}

/* ═══ LIBRARY ═══ */
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}
.lib-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  transition: all 0.15s;
}
.lib-card:hover { border-color: var(--text-muted); transform: translateY(-1px); }
.lib-card-icon { font-size: 16px; margin-bottom: 4px; }
.lib-card-title { font-size: 12px; font-weight: 600; margin-bottom: 1px; }
.lib-card-count { font-size: 11px; color: var(--text-muted); }

/* ═══ HOW IT WORKS ═══ */
.steps {
  display: flex; gap: 12px; align-items: flex-start;
  margin-bottom: 24px; flex-wrap: wrap;
}
.step {
  flex: 1; min-width: 180px; text-align: center;
  padding: 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.step-num {
  width: 30px; height: 30px; background: var(--gradient-1); color: white;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; margin: 0 auto 8px;
}
.step h3 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.step p { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.step-arrow { font-size: 20px; color: var(--text-muted); padding-top: 22px; flex-shrink: 0; }

.faq-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 20px;
}
.faq-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.faq-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 6px; }

/* ═══ FOOTER ═══ */
.footer {
  padding: 24px 16px;
  border-top: 1px solid var(--border);
}
.footer-inner {
  max-width: 900px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
}
.footer-brand { display: flex; flex-direction: column; gap: 1px; font-weight: 600; font-size: 13px; }
.footer-tag { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.footer-links { font-size: 12px; color: var(--text-muted); }
.footer-links a { color: var(--text); text-decoration: none; font-weight: 500; }
.footer-links a:hover { text-decoration: underline; }
.footer-sep { padding: 0 4px; }

/* ═══ ANIMATIONS ═══ */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
  .topbar { height: auto; min-height: 48px; }
  .topbar-inner { gap: 6px; padding: 0 8px; flex-wrap: nowrap; }
  .topbar-title { font-size: 14px; }
  .topbar-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 0; scrollbar-width: none; }
  .topbar-tabs::-webkit-scrollbar { display: none; }
  .tab-btn { padding: 6px 8px; font-size: 11px; white-space: nowrap; flex-shrink: 0; }
  
  .main-content { padding-top: 48px; }
  .hero-compact { padding: 16px 8px 4px; }
  .hero-compact-title { font-size: 18px; }
  .hero-compact-sub { font-size: 12px; }
  .hero-compact-inner { padding: 0; }
  
  .tab-panel { padding: 4px 8px 24px; }
  .panel-inner { padding: 0; }
  
  .section-title { font-size: 18px; }
  .section-desc { font-size: 13px; }
  
  .disclaimer-banner { font-size: 11px; padding: 8px 10px; }
  
  .contract-input { min-height: 200px; font-size: 12px; padding: 10px; }
  .input-card-header { padding: 8px 10px; flex-wrap: wrap; gap: 4px; }
  .input-tab { padding: 4px 8px; font-size: 11px; }
  .input-card-footer { padding: 8px 10px; flex-direction: column; align-items: stretch; }
  .input-hints { font-size: 10px; }
  .btn-scan { width: 100%; justify-content: center; padding: 12px 16px; }
  
  .sample-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; padding: 10px; }
  .sample-card { padding: 10px; }
  .sample-card-icon { font-size: 22px; }
  .sample-card-name { font-size: 11px; }
  .sample-card-desc { font-size: 10px; }
  .sample-tag { font-size: 8px; padding: 1px 4px; }
  
  .score-dashboard { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .score-card { padding: 8px 4px; min-width: 0; }
  .score-icon { font-size: 14px; }
  .score-num { font-size: 18px; }
  .score-label { font-size: 10px; }
  .score-risk { grid-column: 1 / -1; }
  
  .results-header { flex-direction: column; gap: 4px; }
  .results-actions { width: 100%; justify-content: flex-end; }
  .results-toolbar { flex-direction: column; align-items: stretch; gap: 4px; }
  .results-filter { justify-content: center; }
  .filter-btn { padding: 4px 10px; font-size: 10px; }
  
  .result-card-header { padding: 10px 12px; }
  .result-title { font-size: 13px; }
  .badge { font-size: 9px; padding: 1px 5px; }
  .result-card-body { padding: 0 12px 10px; }
  .result-section-text { font-size: 11px; }
  .risk-bar { height: 4px; }
  
  .annotated-contract { font-size: 11px; padding: 10px; max-height: 300px; }
  .annotated-title { font-size: 12px; padding: 8px 12px; }
  .annotated-contract mark { padding: 0 1px; }
  .annotated-legend { font-size: 10px; padding: 6px 12px; gap: 8px; }
  
  .library-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .lib-card { padding: 8px; }
  .lib-card-icon { font-size: 14px; }
  .lib-card-title { font-size: 11px; }
  .lib-card-count { font-size: 10px; }
  .lib-detail-header { padding: 8px 12px; font-size: 12px; }
  .lib-detail-item { padding: 6px 8px; font-size: 11px; }
  
  .steps { flex-direction: column; gap: 8px; }
  .step { padding: 14px; }
  .step-arrow { display: none; }
  .step h3 { font-size: 13px; }
  .step p { font-size: 11px; }
  
  .faq-card { padding: 14px; }
  .faq-card h3 { font-size: 14px; }
  .faq-card p { font-size: 12px; }
  
  .footer { padding: 16px 8px; }
  .footer-inner { flex-direction: column; text-align: center; gap: 4px; }
  .footer-links { font-size: 11px; }
  
  .btn { padding: 6px 12px; font-size: 12px; }
  .btn-sm { padding: 5px 8px; font-size: 11px; }
  .btn-lg { padding: 10px 20px; font-size: 13px; }
  
  .empty-state { padding: 24px 8px; }
  .empty-icon { font-size: 32px; }
  .empty-state h2 { font-size: 17px; }
}

@media (max-width: 480px) {
  .topbar-inner { gap: 4px; }
  .topbar-title { display: none; }
  .topbar-logo { font-size: 18px; }
  .tab-btn { padding: 5px 6px; font-size: 10px; }
  
  .sample-grid { grid-template-columns: 1fr; }
  .library-grid { grid-template-columns: 1fr; }
  .score-dashboard { grid-template-columns: repeat(2, 1fr); }
  .score-risk { grid-column: 1 / -1; }
  .hero-compact-title { font-size: 16px; }
  .contract-input { min-height: 160px; }
}

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
