/* ═══════════════════════════════════════════════════════════
   ContractCheck — Premium Dark Theme
   ═══════════════════════════════════════════════════════════ */

/* ── Reset & Variables ──────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Base palette */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-card-hover: rgba(24, 34, 56, 0.8);
  --bg-elevated: rgba(30, 41, 59, 0.6);
  --bg-input: rgba(15, 23, 42, 0.8);

  /* Borders */
  --border-subtle: rgba(99, 102, 241, 0.12);
  --border-default: rgba(99, 102, 241, 0.2);
  --border-focus: rgba(99, 102, 241, 0.5);

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #a5b4fc;

  /* Accent colors */
  --accent-indigo: #818cf8;
  --accent-blue: #60a5fa;
  --accent-cyan: #22d3ee;
  --accent-emerald: #34d399;
  --accent-amber: #fbbf24;
  --accent-rose: #fb7185;
  --accent-purple: #c084fc;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #818cf8 0%, #60a5fa 100%);
  --gradient-success: linear-gradient(135deg, #34d399 0%, #22d3ee 100%);
  --gradient-warning: linear-gradient(135deg, #fbbf24 0%, #fb923c 100%);
  --gradient-danger: linear-gradient(135deg, #fb7185 0%, #f472b6 100%);
  --gradient-card: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(96, 165, 250, 0.05) 100%);

  /* Spacing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

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

/* ── Ambient Background ─────────────────────────────────── */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.4;
  animation: float 20s ease-in-out infinite;
}

.glow-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, transparent 70%);
  top: -200px;
  left: -100px;
}

.glow-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.15) 0%, transparent 70%);
  bottom: -150px;
  right: -100px;
  animation-delay: -7s;
}

.glow-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.12) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -14s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -20px) scale(1.05); }
  50% { transform: translate(-20px, 30px) scale(0.95); }
  75% { transform: translate(20px, 20px) scale(1.02); }
}

/* ── Header ─────────────────────────────────────────────── */
#app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 26, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--gradient-card);
  border: 1px solid var(--border-default);
}

.logo-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.logo-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 100px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* ── Main ───────────────────────────────────────────────── */
#app-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px;
}

.section { margin-bottom: 40px; }

.section-header {
  margin-bottom: 24px;
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ── Input Grid ─────────────────────────────────────────── */
.input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .input-grid { grid-template-columns: 1fr; }
}

.input-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}

.input-card:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-glow);
}

.input-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.input-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.challenge-icon {
  background: rgba(251, 191, 36, 0.15);
  color: var(--accent-amber);
}

.proposal-icon {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-indigo);
}

.input-card-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

/* ── Upload Zone ────────────────────────────────────────── */
.upload-zone {
  position: relative;
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-md);
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  overflow: hidden;
}

.upload-zone:hover {
  border-color: var(--accent-indigo);
  background: rgba(99, 102, 241, 0.04);
}

.upload-zone.drag-over {
  border-color: var(--accent-blue);
  background: rgba(96, 165, 250, 0.08);
  transform: scale(1.01);
}

.upload-zone.has-file {
  border-color: var(--accent-emerald);
  border-style: solid;
  background: rgba(52, 211, 153, 0.06);
}

.upload-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.upload-icon {
  color: var(--text-muted);
  margin-bottom: 4px;
  transition: color 0.3s, transform 0.3s var(--ease-spring);
}

.upload-zone:hover .upload-icon {
  color: var(--accent-indigo);
  transform: translateY(-2px);
}

.upload-text {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.upload-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.upload-btn {
  margin-top: 8px;
  padding: 6px 18px;
  border: 1px solid var(--border-default);
  border-radius: 100px;
  background: transparent;
  color: var(--text-accent);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-btn:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--accent-indigo);
}

.upload-zone-active {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(96, 165, 250, 0.1);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.upload-zone.drag-over .upload-zone-active { opacity: 1; }
.upload-zone.drag-over .upload-zone-content { opacity: 0.3; }

.upload-zone-active-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent-blue);
}

.upload-filename {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--accent-emerald);
  font-weight: 500;
}

/* ── Divider ────────────────────────────────────────────── */
.divider-or {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.divider-or::before,
.divider-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* ── Text Input ─────────────────────────────────────────── */
.text-input {
  width: 100%;
  min-height: 180px;
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  line-height: 1.7;
  resize: vertical;
  transition: border-color 0.3s, box-shadow 0.3s;
}

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

.text-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.char-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.clear-btn {
  padding: 4px 12px;
  border: none;
  border-radius: 100px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.clear-btn:hover {
  color: var(--accent-rose);
  background: rgba(251, 113, 133, 0.1);
}

/* ── Analyze Button ─────────────────────────────────────── */
.analyze-bar {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}

.analyze-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 40px;
  border: none;
  border-radius: 100px;
  background: var(--gradient-primary);
  color: white;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
  position: relative;
  overflow: hidden;
}

.analyze-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255,255,255,0.1), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s;
}

.analyze-btn:not(:disabled):hover::before {
  transform: translateX(100%);
}

.analyze-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(99, 102, 241, 0.4);
}

.analyze-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.analyze-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

/* ── Loading ────────────────────────────────────────────── */
.loading-card {
  max-width: 500px;
  margin: 80px auto;
  text-align: center;
  padding: 48px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(12px);
}

.loading-spinner {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
}

.spinner-ring {
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-top-color: var(--accent-indigo);
  border-radius: 50%;
  animation: spin 1.2s linear infinite;
}

.spinner-ring-2 {
  inset: 8px;
  border-top-color: var(--accent-blue);
  animation-duration: 1.8s;
  animation-direction: reverse;
}

.spinner-ring-3 {
  inset: 16px;
  border-top-color: var(--accent-cyan);
  animation-duration: 2.4s;
}

.spinner-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-muted);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.loading-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 28px;
}

.loading-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.loading-step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: color 0.3s;
}

.loading-step.active {
  color: var(--text-primary);
}

.loading-step.done {
  color: var(--accent-emerald);
}

.step-indicator {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-default);
  position: relative;
  flex-shrink: 0;
  transition: all 0.3s;
}

.loading-step.active .step-indicator {
  border-color: var(--accent-indigo);
  background: rgba(99, 102, 241, 0.2);
  animation: pulse 1.5s ease-in-out infinite;
}

.loading-step.done .step-indicator {
  border-color: var(--accent-emerald);
  background: var(--accent-emerald);
}

.loading-step.done .step-indicator::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.6rem;
  color: var(--bg-primary);
  font-weight: 700;
}

/* ── Results Header ─────────────────────────────────────── */
.results-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.results-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.results-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.new-analysis-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 8px 18px;
  border: 1px solid var(--border-default);
  border-radius: 100px;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.new-analysis-btn:hover {
  border-color: var(--accent-indigo);
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.08);
}

/* ── Tabs ───────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin-bottom: 24px;
}

.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
}

.tab:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
}

.tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.tab svg {
  opacity: 0.6;
  transition: opacity 0.3s;
}

.tab.active svg {
  opacity: 1;
}

.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn 0.3s var(--ease-out); }

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

/* ── Score Gauge ────────────────────────────────────────── */
.gauge-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.gauge-svg {
  transform: rotate(-90deg);
}

.gauge-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
}

.gauge-fill {
  fill: none;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.5s var(--ease-out);
}

.gauge-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.gauge-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.8rem;
  font-weight: 700;
}

/* ── Result Cards ───────────────────────────────────────── */
.result-grid {
  display: grid;
  gap: 20px;
}

.result-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

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

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

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.result-card:hover {
  border-color: var(--border-default);
}

.result-card-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

.result-card-wide {
  grid-column: 1 / -1;
}

/* ── Score Badge ────────────────────────────────────────── */
.score-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

.score-badge.score-high { background: rgba(251, 113, 133, 0.15); color: var(--accent-rose); }
.score-badge.score-medium { background: rgba(251, 191, 36, 0.15); color: var(--accent-amber); }
.score-badge.score-low { background: rgba(52, 211, 153, 0.15); color: var(--accent-emerald); }

/* For match scores (inverted — high is good) */
.score-badge.match-high { background: rgba(52, 211, 153, 0.15); color: var(--accent-emerald); }
.score-badge.match-medium { background: rgba(251, 191, 36, 0.15); color: var(--accent-amber); }
.score-badge.match-low { background: rgba(251, 113, 133, 0.15); color: var(--accent-rose); }

/* ── Paragraph Heat Map ─────────────────────────────────── */
.paragraph-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.paragraph-item {
  display: flex;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid transparent;
  transition: all 0.3s;
  cursor: default;
}

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

.paragraph-number {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

.paragraph-body {
  flex: 1;
  min-width: 0;
}

.paragraph-preview {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.paragraph-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.paragraph-reasoning {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.paragraph-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.flag-tag {
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 500;
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-indigo);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

/* ── Requirement List ───────────────────────────────────── */
.requirement-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.requirement-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid transparent;
  transition: all 0.3s;
}

.requirement-item:hover {
  border-color: var(--border-default);
}

.req-status-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  margin-top: 2px;
}

.req-status-icon.fully_addressed { background: rgba(52, 211, 153, 0.2); color: var(--accent-emerald); }
.req-status-icon.partially_addressed { background: rgba(251, 191, 36, 0.2); color: var(--accent-amber); }
.req-status-icon.mentioned { background: rgba(96, 165, 250, 0.2); color: var(--accent-blue); }
.req-status-icon.not_addressed { background: rgba(251, 113, 133, 0.2); color: var(--accent-rose); }

.req-body {
  flex: 1;
}

.req-text {
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.req-notes {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.req-category {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.req-coverage {
  flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ── Gap / Strength Cards ───────────────────────────────── */
.detail-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-item {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border-left: 3px solid;
  background: var(--bg-elevated);
}

.detail-item.gap-critical { border-color: var(--accent-rose); }
.detail-item.gap-major { border-color: var(--accent-amber); }
.detail-item.gap-minor { border-color: var(--accent-blue); }
.detail-item.strength { border-color: var(--accent-emerald); }

.detail-item-title {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.detail-item-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.severity-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

/* ── Improvement Cards ──────────────────────────────────── */
.improvement-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
  transition: border-color 0.3s;
}

.improvement-card:hover {
  border-color: var(--border-default);
}

.improvement-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.improvement-card-header:hover {
  background: rgba(255, 255, 255, 0.02);
}

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

.improvement-card-toggle {
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform 0.3s var(--ease-out);
}

.improvement-card.open .improvement-card-toggle {
  transform: rotate(90deg);
}

.improvement-card-body {
  padding: 0 20px 20px;
  display: none;
}

.improvement-card.open .improvement-card-body {
  display: block;
  animation: fadeIn 0.3s var(--ease-out);
}

.quality-bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  margin-bottom: 16px;
}

.quality-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 1s var(--ease-out);
}

.improvement-section {
  margin-bottom: 16px;
}

.improvement-section:last-child {
  margin-bottom: 0;
}

.improvement-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.suggestion-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  margin-bottom: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.suggestion-type {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.type-content { background: rgba(99, 102, 241, 0.15); color: var(--accent-indigo); }
.type-clarity { background: rgba(96, 165, 250, 0.15); color: var(--accent-blue); }
.type-specificity { background: rgba(192, 132, 252, 0.15); color: var(--accent-purple); }
.type-compliance { background: rgba(251, 191, 36, 0.15); color: var(--accent-amber); }
.type-persuasion { background: rgba(52, 211, 153, 0.15); color: var(--accent-emerald); }
.type-expansion { background: rgba(34, 211, 238, 0.15); color: var(--accent-cyan); }

.priority-indicator {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 8px;
}

.priority-high { background: var(--accent-rose); }
.priority-medium { background: var(--accent-amber); }
.priority-low { background: var(--accent-blue); }

/* ── Overall Assessment ─────────────────────────────────── */
.overall-card {
  background: var(--gradient-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 32px;
  margin-top: 24px;
}

.overall-header {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.overall-grade {
  font-size: 3rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
}

.overall-summary {
  flex: 1;
  min-width: 200px;
}

.overall-summary-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.overall-summary-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.priorities-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.priority-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

.priority-rank {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
}

.priority-content {
  flex: 1;
}

.priority-area {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.priority-action {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.priority-impact {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2px;
}

/* ── Win Probability ────────────────────────────────────── */
.win-probability {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  margin-top: 20px;
}

.win-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.win-value {
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
}

.win-value.high { color: var(--accent-emerald); }
.win-value.medium { color: var(--accent-amber); }
.win-value.low { color: var(--accent-rose); }

.win-notes {
  flex: 1;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
}

/* ── Error State ────────────────────────────────────────── */
.error-card {
  background: rgba(251, 113, 133, 0.08);
  border: 1px solid rgba(251, 113, 133, 0.2);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
}

.error-card h3 {
  color: var(--accent-rose);
  margin-bottom: 8px;
}

.error-card p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ── Footer ─────────────────────────────────────────────── */
#app-footer {
  text-align: center;
  padding: 24px 32px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ── Scroll ─────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ── Utilities ──────────────────────────────────────────── */
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }

.text-center { text-align: center; }
.text-emerald { color: var(--accent-emerald); }
.text-amber { color: var(--accent-amber); }
.text-rose { color: var(--accent-rose); }
.text-indigo { color: var(--accent-indigo); }

/* ── Header Actions ─────────────────────────────────────── */
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 100px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.825rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}

.header-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent-indigo);
  color: white;
}

.history-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 100px;
  background: var(--gradient-primary);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
}

/* ── History Drawer & Backdrop ─────────────────────────── */
.history-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
}

.history-backdrop:not([hidden]) {
  opacity: 1;
}

.history-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 440px;
  max-width: 100vw;
  z-index: 201;
  background: #0f172a;
  border-left: 1px solid var(--border-default);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s var(--ease-out);
}

.history-drawer:not([hidden]) {
  transform: translateX(0);
}

.history-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.8);
}

.history-drawer-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.close-btn:hover {
  background: rgba(251, 113, 133, 0.15);
  color: var(--accent-rose);
  border-color: var(--accent-rose);
}

.history-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.history-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 40px 20px;
}

/* History Card */
.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: all 0.2s var(--ease-out);
  cursor: pointer;
  position: relative;
}

.history-card:hover {
  border-color: var(--border-focus);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

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

.history-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.history-card-date {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
}

.history-card-snippet {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-card-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.history-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.history-load-btn {
  padding: 4px 12px;
  border-radius: 100px;
  background: var(--gradient-primary);
  color: white;
  border: none;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.history-load-btn:hover {
  opacity: 0.9;
}

.history-delete-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}

.history-delete-btn:hover {
  color: var(--accent-rose);
  background: rgba(251, 113, 133, 0.1);
}
