/* =====================================================
   ChildSafe AI — Design System
   Theme: Dark premium with teal + purple accents
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;600&display=swap');

/* ── CSS Variables ───────────────────────────────── */
:root {
  --bg-primary:    #080C18;
  --bg-secondary:  #0D1326;
  --bg-card:       rgba(15, 22, 45, 0.8);
  --bg-card-hover: rgba(20, 30, 60, 0.9);
  --glass-border:  rgba(255, 255, 255, 0.07);
  --glass-border-active: rgba(0, 212, 184, 0.4);

  --teal:          #00D4B8;
  --teal-dim:      rgba(0, 212, 184, 0.15);
  --teal-glow:     rgba(0, 212, 184, 0.3);
  --purple:        #7C5CE7;
  --purple-dim:    rgba(124, 92, 231, 0.15);
  --purple-glow:   rgba(124, 92, 231, 0.3);
  --pink:          #E84393;

  --text-primary:  #F0F4FF;
  --text-secondary:#8896B3;
  --text-muted:    #4A5568;

  --red:           #FF5C5C;
  --amber:         #FFB020;
  --green:         #00D4B8;

  --radius-sm:     8px;
  --radius-md:     14px;
  --radius-lg:     20px;
  --radius-xl:     28px;

  --shadow-glow-teal:   0 0 40px rgba(0, 212, 184, 0.15);
  --shadow-glow-purple: 0 0 40px rgba(124, 92, 231, 0.2);
  --shadow-card:        0 8px 32px rgba(0, 0, 0, 0.4);

  --transition-fast: 0.15s ease;
  --transition-mid:  0.3s ease;
  --transition-slow: 0.5s ease;
}

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

html { scroll-behavior: smooth; }

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

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

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
  animation: orbFloat 12s ease-in-out infinite;
}

.orb-1 {
  width: 600px; height: 600px;
  background: var(--purple);
  top: -200px; left: -200px;
  animation-delay: 0s;
}
.orb-2 {
  width: 500px; height: 500px;
  background: var(--teal);
  bottom: -150px; right: -150px;
  animation-delay: -4s;
}
.orb-3 {
  width: 300px; height: 300px;
  background: var(--pink);
  top: 40%; left: 60%;
  animation-delay: -8s;
  opacity: 0.12;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(30px, -30px) scale(1.05); }
  66%       { transform: translate(-20px, 20px) scale(0.95); }
}

/* ── Layout ──────────────────────────────────────── */
.app-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

/* ── Header / Hero ───────────────────────────────── */
.header {
  padding: 32px 0 0;
  text-align: center;
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 212, 184, 0.1);
  border: 1px solid rgba(0, 212, 184, 0.25);
  border-radius: 50px;
  padding: 6px 18px 6px 10px;
  margin-bottom: 28px;
  animation: fadeSlideDown 0.6s ease both;
}

.logo-badge .shield-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--teal), var(--purple));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.logo-badge span {
  font-size: 13px;
  font-weight: 600;
  color: var(--teal);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
  animation: fadeSlideDown 0.7s ease both;
  animation-delay: 0.1s;
}

.hero-title .gradient-text {
  background: linear-gradient(135deg, var(--teal) 0%, var(--purple) 60%, var(--pink) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 620px;
  margin: 0 auto 16px;
  animation: fadeSlideDown 0.8s ease both;
  animation-delay: 0.2s;
}

.framework-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 40px;
  animation: fadeSlideDown 0.9s ease both;
  animation-delay: 0.3s;
}

.pill {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 50px;
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pill.active { border-color: rgba(0,212,184,0.4); color: var(--teal); background: var(--teal-dim); }

/* ── Glass Card ──────────────────────────────────── */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition-mid), box-shadow var(--transition-mid);
}

.glass-card:hover {
  border-color: rgba(255,255,255,0.12);
}

/* ── API Key Section ─────────────────────────────── */
.api-section {
  margin-bottom: 24px;
  animation: fadeSlideUp 0.6s ease both;
  animation-delay: 0.4s;
}

.api-section .card-inner {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.api-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.api-label .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background var(--transition-fast);
}

.api-label .dot.connected { background: var(--green); box-shadow: 0 0 8px var(--green); }

.api-input-wrapper { flex: 1; min-width: 200px; position: relative; }

.api-input {
  width: 100%;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 10px 44px 10px 14px;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.api-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-dim);
}

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

.toggle-visibility {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  transition: color var(--transition-fast);
}
.toggle-visibility:hover { color: var(--text-primary); }

.api-status {
  font-size: 12px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  white-space: nowrap;
}

.api-status.ok { color: var(--green); border-color: rgba(0,212,184,0.3); background: var(--teal-dim); }
.api-status.err { color: var(--red); border-color: rgba(255,92,92,0.3); background: rgba(255,92,92,0.1); }

.privacy-note {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  padding: 0 24px 16px;
}

/* ── Upload Zone ─────────────────────────────────── */
.upload-section {
  margin-bottom: 24px;
  animation: fadeSlideUp 0.6s ease both;
  animation-delay: 0.5s;
}

.upload-zone {
  border: 2px dashed var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 60px 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-mid);
  position: relative;
  overflow: hidden;
}

.upload-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--teal-dim), transparent, var(--purple-dim));
  opacity: 0;
  transition: opacity var(--transition-mid);
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--teal);
  box-shadow: 0 0 0 1px var(--teal), var(--shadow-glow-teal);
}

.upload-zone:hover::before, .upload-zone.drag-over::before { opacity: 1; }

.upload-zone.drag-over {
  transform: scale(1.01);
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
  animation: uploadBob 2s ease-in-out infinite;
}

@keyframes uploadBob {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

.upload-zone h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.upload-zone p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.upload-formats {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.format-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* File uploaded state */
.file-loaded {
  display: none;
  padding: 20px 24px;
  align-items: center;
  gap: 16px;
}

.file-loaded.visible { display: flex; }

.file-icon-wrap {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--teal-dim), var(--purple-dim));
  border: 1px solid var(--glass-border-active);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.file-info { flex: 1; min-width: 0; }
.file-name { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.btn-remove {
  background: none;
  border: 1px solid rgba(255,92,92,0.3);
  border-radius: var(--radius-sm);
  color: var(--red);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-remove:hover { background: rgba(255,92,92,0.1); }

/* ── Text Paste Area ─────────────────────────────── */
.paste-section {
  margin-bottom: 24px;
  animation: fadeSlideUp 0.6s ease both;
  animation-delay: 0.6s;
}

.section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

.paste-textarea {
  width: 100%;
  min-height: 140px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  resize: vertical;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  line-height: 1.7;
}

.paste-textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-dim);
}

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

/* ── Framework Selector ──────────────────────────── */
.frameworks-section {
  margin-bottom: 28px;
  animation: fadeSlideUp 0.6s ease both;
  animation-delay: 0.7s;
}

.framework-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.framework-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: all var(--transition-mid);
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: none;
}

.framework-card:hover {
  border-color: rgba(255,255,255,0.15);
  transform: translateY(-2px);
}

.framework-card.selected {
  border-color: var(--teal);
  background: rgba(0, 212, 184, 0.08);
  box-shadow: 0 0 0 1px rgba(0, 212, 184, 0.2);
}

.framework-card input[type="checkbox"] {
  display: none;
}

.fw-check {
  width: 20px; height: 20px;
  border-radius: 6px;
  border: 2px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  font-size: 11px;
}

.framework-card.selected .fw-check {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--bg-primary);
}

.fw-label { font-size: 0.8rem; font-weight: 600; line-height: 1.3; }
.fw-sub { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* ── Analyse Button ──────────────────────────────── */
.analyse-btn {
  width: 100%;
  padding: 18px;
  background: linear-gradient(135deg, var(--teal), var(--purple));
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 32px;
  animation: fadeSlideUp 0.6s ease both;
  animation-delay: 0.8s;
}

.analyse-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--purple), var(--teal));
  opacity: 0;
  transition: opacity var(--transition-mid);
}

.analyse-btn:hover::before { opacity: 1; }

.analyse-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 212, 184, 0.4);
}

.analyse-btn:active { transform: translateY(0); }

.analyse-btn span { position: relative; z-index: 1; }

.analyse-btn.loading {
  pointer-events: none;
  opacity: 0.8;
}

.btn-spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
  position: relative;
  z-index: 1;
}

.analyse-btn.loading .btn-spinner { display: block; }
.analyse-btn.loading .btn-label { opacity: 0.7; }

/* ── Loading Screen ──────────────────────────────── */
.loading-screen {
  display: none;
  text-align: center;
  padding: 60px 32px;
}

.loading-screen.visible { display: block; }

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

.ai-pulse-inner {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  animation: pulseGlow 1.5s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 20px var(--teal-glow), 0 0 40px var(--purple-glow); transform: scale(1); }
  50% { box-shadow: 0 0 40px var(--teal-glow), 0 0 80px var(--purple-glow); transform: scale(1.05); }
}

.loading-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  margin: 24px auto 0;
}

.loading-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--glass-border);
  font-size: 13px;
  color: var(--text-muted);
  transition: all var(--transition-mid);
}

.loading-step.active {
  color: var(--text-primary);
  border-color: var(--teal);
  background: var(--teal-dim);
}

.loading-step.done {
  color: var(--green);
  border-color: rgba(0,212,184,0.2);
}

.step-icon { font-size: 16px; }

/* ── Results Section ─────────────────────────────── */
.results-section {
  display: none;
  animation: fadeSlideUp 0.5s ease both;
}

.results-section.visible { display: block; }

/* Overall Score */
.score-hero {
  padding: 40px 32px;
  text-align: center;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.score-ring {
  width: 140px; height: 140px;
  margin: 0 auto 20px;
  position: relative;
}

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

.score-ring-bg { fill: none; stroke: rgba(255,255,255,0.05); stroke-width: 8; }
.score-ring-fill {
  fill: none;
  stroke: url(#scoreGradient);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.score-number {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 900;
  font-family: 'JetBrains Mono', monospace;
}

.score-number .score-pct { font-size: 0.7rem; font-weight: 600; color: var(--text-secondary); margin-top: -4px; }

.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.risk-badge.critical { background: rgba(255,92,92,0.15); border: 1px solid rgba(255,92,92,0.4); color: var(--red); }
.risk-badge.high { background: rgba(255,176,32,0.15); border: 1px solid rgba(255,176,32,0.4); color: var(--amber); }
.risk-badge.medium { background: rgba(124,92,231,0.15); border: 1px solid rgba(124,92,231,0.4); color: var(--purple); }
.risk-badge.low { background: var(--teal-dim); border: 1px solid var(--glass-border-active); color: var(--teal); }

.score-headline { font-size: 1.4rem; font-weight: 800; margin-bottom: 8px; }
.score-summary { font-size: 0.9rem; color: var(--text-secondary); max-width: 560px; margin: 0 auto; }

/* Framework Results Grid */
.fw-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.fw-result-card {
  padding: 24px;
  transition: all var(--transition-mid);
}

.fw-result-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}

.fw-result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.fw-result-title { font-size: 0.95rem; font-weight: 700; }
.fw-result-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.rag-badge {
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.rag-badge.red { background: rgba(255,92,92,0.15); border: 1px solid rgba(255,92,92,0.4); color: var(--red); }
.rag-badge.amber { background: rgba(255,176,32,0.15); border: 1px solid rgba(255,176,32,0.4); color: var(--amber); }
.rag-badge.green { background: var(--teal-dim); border: 1px solid rgba(0,212,184,0.4); color: var(--teal); }

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

.fw-score-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
}

.fw-score-fill.red { background: linear-gradient(90deg, #ff5c5c88, var(--red)); }
.fw-score-fill.amber { background: linear-gradient(90deg, #ffb02088, var(--amber)); }
.fw-score-fill.green { background: linear-gradient(90deg, #00d4b888, var(--teal)); }

.findings-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.finding-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.finding-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.finding-dot.issue { background: var(--red); }
.finding-dot.warn  { background: var(--amber); }
.finding-dot.ok    { background: var(--teal); }

.recommendations-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--purple);
  margin-bottom: 8px;
}

.recommendations-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rec-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.rec-item::before {
  content: '→';
  color: var(--purple);
  flex-shrink: 0;
  font-weight: 700;
}

/* ── Chat Section ────────────────────────────────── */
.chat-section {
  margin-bottom: 28px;
}

.chat-window {
  padding: 20px;
  min-height: 200px;
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-bottom: 1px solid var(--glass-border);
  scroll-behavior: smooth;
}

.chat-window::-webkit-scrollbar { width: 4px; }
.chat-window::-webkit-scrollbar-track { background: transparent; }
.chat-window::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 2px; }

.chat-msg {
  display: flex;
  gap: 10px;
  animation: fadeSlideUp 0.3s ease both;
}

.chat-msg.user { flex-direction: row-reverse; }

.chat-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.chat-avatar.ai { background: linear-gradient(135deg, var(--teal), var(--purple)); }
.chat-avatar.user-av { background: rgba(255,255,255,0.1); }

.chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  line-height: 1.6;
}

.chat-msg.ai .chat-bubble {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-bottom-left-radius: 4px;
  color: var(--text-primary);
}

.chat-msg.user .chat-bubble {
  background: linear-gradient(135deg, rgba(0,212,184,0.2), rgba(124,92,231,0.2));
  border: 1px solid rgba(0,212,184,0.2);
  border-bottom-right-radius: 4px;
  color: var(--text-primary);
}

.chat-input-row {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(0,0,0,0.2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.chat-input {
  flex: 1;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.chat-input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-dim);
}

.chat-send {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--purple), var(--teal));
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.chat-send:hover { transform: scale(1.08); box-shadow: 0 4px 16px var(--purple-glow); }

/* ── Export Section ──────────────────────────────── */
.export-section {
  margin-bottom: 28px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.export-label {
  font-size: 0.9rem;
  font-weight: 600;
}
.export-sublabel {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.export-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-export {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.btn-export.primary {
  background: linear-gradient(135deg, var(--teal), var(--purple));
  border: none;
  color: white;
}

.btn-export.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--teal-glow);
}

.btn-export.secondary {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}

.btn-export.secondary:hover {
  border-color: var(--purple);
  color: var(--purple);
}

/* ── Legal Disclaimer ────────────────────────────── */
.disclaimer {
  margin-bottom: 28px;
  padding: 16px 20px;
  border-left: 3px solid var(--amber);
}

.disclaimer p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.7;
}

.disclaimer strong { color: var(--amber); }

/* ── Footer ──────────────────────────────────────── */
.footer {
  padding: 32px 0;
  text-align: center;
  border-top: 1px solid var(--glass-border);
  margin-top: auto;
}

.footer p {
  font-size: 12px;
  color: var(--text-muted);
}

.footer a { color: var(--teal); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* ── Utilities ───────────────────────────────────── */
.hidden { display: none !important; }

@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

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

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 640px) {
  .api-section .card-inner { flex-direction: column; align-items: stretch; }
  .fw-results-grid { grid-template-columns: 1fr; }
  .export-section { flex-direction: column; align-items: flex-start; }
  .upload-zone { padding: 40px 20px; }
  .score-hero { padding: 32px 20px; }
}

/* ── Toast ───────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeSlideUp 0.3s ease both;
  max-width: 320px;
}

.toast.success { border-color: rgba(0,212,184,0.4); }
.toast.error   { border-color: rgba(255,92,92,0.4); }
.toast.info    { border-color: rgba(124,92,231,0.4); }

/* ── Context Tags (doc type + platform) ─────────────── */
.context-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 50px;
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  background: rgba(255,255,255,0.04);
  letter-spacing: 0.03em;
}

/* ── Scrollbar ───────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ═══════════════════════════════════════════════════════
   PHASE 2 — DPIA Generator + Remediation Roadmap
   ═══════════════════════════════════════════════════════ */

/* ── Phase 2 Card Shell ─────────────────────────────── */
.phase2-card {
  padding: 0;
  overflow: hidden;
  margin-bottom: 24px;
  border: 1px solid rgba(124,92,231,0.25);
  transition: border-color 0.3s;
}
.phase2-card:hover { border-color: rgba(124,92,231,0.45); }

.phase2-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(124,92,231,0.08) 0%, rgba(0,212,184,0.04) 100%);
  border-bottom: 1px solid var(--glass-border);
}
.phase2-icon {
  font-size: 28px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(124,92,231,0.5));
}
.phase2-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.phase2-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.4;
}
.phase2-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--purple);
  color: var(--purple);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex-shrink: 0;
  background: rgba(124,92,231,0.1);
}

/* ── Phase 2 Content Area ───────────────────────────── */
.phase2-content { padding: 24px; }

/* ── Empty State ────────────────────────────────────── */
.phase2-empty-state {
  text-align: center;
  padding: 16px 0 8px;
}
.phase2-empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
  filter: grayscale(0.3);
}
.phase2-empty-state p {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto 20px;
  line-height: 1.6;
}

/* ── Generate Button ────────────────────────────────── */
.phase2-generate-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  background: linear-gradient(135deg, var(--purple) 0%, var(--teal) 100%);
  color: #fff;
  letter-spacing: 0.01em;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(124,92,231,0.35);
}
.phase2-generate-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
}
.phase2-generate-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(124,92,231,0.5); }
.phase2-generate-btn:hover::after { opacity: 1; }
.phase2-generate-btn:active { transform: translateY(0); }
.phase2-btn-icon { font-size: 16px; }

/* ── Loading State ──────────────────────────────────── */
.phase2-loading {
  text-align: center;
  padding: 32px 0;
}
.phase2-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(124,92,231,0.2);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.phase2-loading-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.phase2-loading-sub {
  font-size: 12px;
  color: var(--text-secondary);
}
.phase2-dots::after {
  content: '';
  animation: dots 1.4s infinite;
}
@keyframes dots {
  0%   { content: ''; }
  33%  { content: '.'; }
  66%  { content: '..'; }
  100% { content: '...'; }
}

/* ── Phase 2 Action Buttons ─────────────────────────── */
.phase2-action-btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}
.phase2-action-btn:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.phase2-action-btn.primary {
  background: linear-gradient(135deg, var(--purple), var(--teal));
  border-color: transparent;
  color: #fff;
}
.phase2-action-btn.primary:hover { opacity: 0.9; }

/* ── DPIA Document Styles ───────────────────────────── */
.dpia-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}
.dpia-doc-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
}
.dpia-actions { display: flex; gap: 8px; }

.dpia-sections { display: flex; flex-direction: column; gap: 12px; }

.dpia-section {
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.dpia-section:hover { border-color: rgba(124,92,231,0.3); }

.dpia-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  background: rgba(255,255,255,0.02);
  user-select: none;
  transition: background 0.2s;
}
.dpia-section-header:hover { background: rgba(255,255,255,0.05); }

.dpia-section-num {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(124,92,231,0.15);
  color: var(--purple);
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.dpia-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}
.dpia-section-toggle {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.25s;
  flex-shrink: 0;
}
.dpia-section.open .dpia-section-toggle { transform: rotate(180deg); }

.dpia-section-body {
  display: none;
  padding: 16px 18px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  border-top: 1px solid var(--glass-border);
  background: rgba(0,0,0,0.15);
  white-space: pre-wrap;
}
.dpia-section.open .dpia-section-body { display: block; }

.dpia-section-status {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  flex-shrink: 0;
}
.dpia-section-status.red { background: rgba(255,92,92,0.15); color: var(--red); }
.dpia-section-status.amber { background: rgba(255,193,7,0.15); color: var(--amber); }
.dpia-section-status.green { background: rgba(0,212,184,0.15); color: var(--teal); }

/* ── Roadmap Styles ─────────────────────────────────── */
.roadmap-timeline-header {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 20px;
  padding: 0 4px;
}
.roadmap-phase {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 90px;
  text-align: center;
}
.roadmap-phase-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  margin-bottom: 2px;
}
.roadmap-phase.immediate { color: var(--red); }
.roadmap-phase.shortterm { color: var(--amber); }
.roadmap-phase.ongoing { color: var(--teal); }
.roadmap-phase-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
}
.roadmap-timeline-line {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, var(--red), var(--amber));
  margin-bottom: 16px;
  opacity: 0.4;
}
.roadmap-timeline-line:last-of-type {
  background: linear-gradient(90deg, var(--amber), var(--teal));
}

.roadmap-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.roadmap-column { display: flex; flex-direction: column; gap: 10px; }

.roadmap-col-header {
  font-size: 11px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 8px;
  letter-spacing: 0.03em;
  text-align: center;
}
.roadmap-col-header.immediate { background: rgba(255,92,92,0.1); color: var(--red); }
.roadmap-col-header.shortterm { background: rgba(255,193,7,0.1); color: var(--amber); }
.roadmap-col-header.ongoing   { background: rgba(0,212,184,0.1); color: var(--teal); }

/* ── Roadmap Action Card ────────────────────────────── */
.roadmap-action-card {
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.02);
  transition: transform 0.2s, border-color 0.2s;
}
.roadmap-action-card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.15); }

.roadmap-action-text {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 10px;
}
.roadmap-action-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.roadmap-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.04em;
}
.roadmap-tag.owner { background: rgba(124,92,231,0.15); color: var(--purple); }
.roadmap-tag.effort-low    { background: rgba(0,212,184,0.12); color: var(--teal); }
.roadmap-tag.effort-medium { background: rgba(255,193,7,0.12); color: var(--amber); }
.roadmap-tag.effort-high   { background: rgba(255,92,92,0.12); color: var(--red); }
.roadmap-tag.framework { background: rgba(255,255,255,0.06); color: var(--text-secondary); }

.roadmap-footer-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 8px;
  border-top: 1px solid var(--glass-border);
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 680px) {
  .roadmap-columns { grid-template-columns: 1fr; }
  .roadmap-timeline-header { display: none; }
  .phase2-card-header { flex-wrap: wrap; }
  .phase2-badge { margin-left: 0; }
}

/* ═══════════════════════════════════════════════════════
   ICO READINESS — Transparency Modal + Oversight Panel
   ═══════════════════════════════════════════════════════ */

/* ── Modal Overlay ──────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--bg-card);
  border: 1px solid rgba(124,92,231,0.3);
  border-radius: 20px;
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(124,92,231,0.1);
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  border-radius: 20px 20px 0 0;
  z-index: 1;
}
.modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.modal-close {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-family: inherit;
}
.modal-close:hover { background: rgba(255,92,92,0.2); color: var(--red); border-color: var(--red); }

.modal-body { padding: 20px 24px 24px; }

.modal-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--glass-border);
}
.modal-section:last-of-type { border-bottom: none; margin-bottom: 0; }

.modal-section-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--teal);
  letter-spacing: 0.03em;
  margin-bottom: 10px;
  text-transform: uppercase;
  font-size: 11px;
}
.modal-section p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0;
}
.modal-steps, .modal-list {
  margin: 10px 0 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.modal-steps li, .modal-list li {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.modal-steps li strong, .modal-list li strong { color: var(--text-primary); }
.modal-list a { color: var(--teal); }
.modal-list a:hover { text-decoration: underline; }

.modal-transparency-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-muted);
  padding: 12px 0 0;
  border-top: 1px solid var(--glass-border);
  margin-top: 4px;
}

/* ── Human Oversight Panel ──────────────────────────── */
.oversight-panel {
  margin-top: 20px;
  padding: 16px 18px;
  background: rgba(255,193,7,0.06);
  border: 1px solid rgba(255,193,7,0.25);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.oversight-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--amber);
  display: flex;
  align-items: center;
  gap: 8px;
}
.oversight-panel p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}
.oversight-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}
.oversight-checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--amber);
  flex-shrink: 0;
  cursor: pointer;
}
.oversight-checkbox-label {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  cursor: pointer;
}
.oversight-checkbox-label strong { color: var(--text-primary); }

/* ── Footer Link Button ─────────────────────────────── */
.footer-link-btn {
  background: none;
  border: none;
  color: var(--teal);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  transition: opacity 0.2s;
}
.footer-link-btn:hover { opacity: 0.7; text-decoration: underline; }

/* ── Report UUID badge ──────────────────────────────── */
.report-uuid {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* ═══════════════════════════════════════════════════════
   REPORT HISTORY — localStorage panel
   ═══════════════════════════════════════════════════════ */

/* ── Logo row (logo + history button) ──────────────── */
.logo-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 0;
}

/* ── History trigger button ─────────────────────────── */
.history-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  letter-spacing: 0.01em;
}
.history-btn:hover {
  background: rgba(0,212,184,0.1);
  border-color: var(--teal);
  color: var(--teal);
}

/* ── History modal wider box ────────────────────────── */
.history-modal-box {
  max-width: 780px;
}

/* ── Meta row: privacy note + clear button ──────────── */
.history-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.history-privacy-note {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
}
.history-clear-btn {
  background: rgba(255,92,92,0.1);
  border: 1px solid rgba(255,92,92,0.25);
  color: var(--red);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.history-clear-btn:hover { background: rgba(255,92,92,0.2); }

/* ── History list ───────────────────────────────────── */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}

/* ── Individual report card ─────────────────────────── */
.history-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  transition: border-color 0.2s;
}
.history-card:hover { border-color: rgba(124,92,231,0.4); }

.history-card-info { min-width: 0; }
.history-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.history-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.history-card-date {
  font-size: 11px;
  color: var(--text-muted);
}
.history-card-score {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.history-card-score.critical { background: rgba(255,92,92,0.15); color: var(--red); }
.history-card-score.high     { background: rgba(255,138,0,0.15);  color: #ff8a00; }
.history-card-score.medium   { background: rgba(255,193,7,0.15);  color: var(--amber); }
.history-card-score.low      { background: rgba(0,212,184,0.15);  color: var(--teal); }
.history-card-score.compliant{ background: rgba(0,200,100,0.15);  color: #00c864; }

.history-card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.history-card-tag {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(124,92,231,0.12);
  color: var(--text-muted);
  border: 1px solid rgba(124,92,231,0.2);
}

.history-card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.history-load-btn {
  background: linear-gradient(135deg, var(--teal), var(--purple));
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s;
}
.history-load-btn:hover { opacity: 0.85; }

.history-delete-btn {
  background: rgba(255,92,92,0.08);
  border: 1px solid rgba(255,92,92,0.2);
  color: var(--red);
  font-family: inherit;
  font-size: 11px;
  padding: 5px 14px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.history-delete-btn:hover { background: rgba(255,92,92,0.2); }

/* ── Empty state ────────────────────────────────────── */
.history-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.history-empty-icon { font-size: 40px; margin-bottom: 12px; }
.history-empty p { font-size: 13px; margin: 4px 0; }

/* ═══════════════════════════════════════════════════════
   SELF-CONTAINED HITL — Human Review Record
   ═══════════════════════════════════════════════════════ */

.hitl-card {
  padding: 0;
  overflow: hidden;
  margin-bottom: 24px;
  border: 1px solid rgba(124,92,231,0.25);
}
.hitl-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: rgba(124,92,231,0.06);
  border-bottom: 1px solid rgba(124,92,231,0.15);
  flex-wrap: wrap;
}
.hitl-icon { font-size: 28px; flex-shrink: 0; }
.hitl-title { font-size: 15px; font-weight: 800; color: var(--text-primary); }
.hitl-sub   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.hitl-badge {
  margin-left: auto;
  background: linear-gradient(135deg, rgba(124,92,231,0.2), rgba(0,212,184,0.2));
  border: 1px solid rgba(124,92,231,0.35);
  color: var(--purple);
  font-size: 11px; font-weight: 700;
  padding: 4px 12px; border-radius: 20px;
  letter-spacing: 0.02em; white-space: nowrap;
}
.hitl-body { padding: 22px 24px; }

.hitl-instruction {
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(124,92,231,0.07);
  border: 1px solid rgba(124,92,231,0.15);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 18px;
  line-height: 1.6;
}

.hitl-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
@media (max-width: 600px) { .hitl-fields-grid { grid-template-columns: 1fr; } }

.hitl-field { margin-bottom: 14px; }
.hitl-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.hitl-required { color: var(--red); }

.hitl-input {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  padding: 10px 13px;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.hitl-input:focus {
  outline: none;
  border-color: var(--purple);
  background: rgba(124,92,231,0.06);
}
.hitl-select { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}
.hitl-select option { background: #0f1020; color: var(--text-primary); }
.hitl-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.hitl-decision-group { display: flex; flex-direction: column; gap: 8px; }
.hitl-radio-option {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.hitl-radio-option:hover { border-color: rgba(124,92,231,0.4); background: rgba(124,92,231,0.04); }
.hitl-radio-option input[type="radio"] { display: none; }
.hitl-radio-option input[type="radio"]:checked ~ .hitl-radio-box { background: var(--purple); border-color: var(--purple); }
.hitl-radio-option:has(input:checked) { border-color: var(--purple); background: rgba(124,92,231,0.08); }
.hitl-radio-box {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--glass-border);
  flex-shrink: 0; margin-top: 1px;
  transition: all 0.15s;
}
.hitl-radio-label { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.hitl-radio-label strong { color: var(--text-primary); }

.hitl-meta-row {
  display: flex; gap: 20px; flex-wrap: wrap;
  padding: 12px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  margin-top: 4px; margin-bottom: 18px;
}
.hitl-meta-item { display: flex; flex-direction: column; gap: 2px; }
.hitl-meta-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.hitl-meta-value { font-size: 12px; color: var(--text-primary); font-weight: 600; }
.hitl-mono { font-family: 'JetBrains Mono', monospace; font-size: 10px; }

.hitl-confirmed-state {
  text-align: center; padding: 30px 20px;
}
.hitl-confirmed-check { font-size: 40px; margin-bottom: 10px; }
.hitl-confirmed-title { font-size: 16px; font-weight: 800; color: var(--text-primary); margin-bottom: 6px; }
.hitl-confirmed-detail { font-size: 12px; color: var(--text-secondary); line-height: 1.6; }

.hitl-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.hitl-btn {
  font-family: inherit; font-size: 13px; font-weight: 700;
  padding: 11px 22px; border-radius: 10px;
  cursor: pointer; transition: all 0.2s; border: none;
}
.hitl-btn.primary {
  background: linear-gradient(135deg, var(--purple), var(--teal));
  color: #fff;
}
.hitl-btn.primary:hover { opacity: 0.87; transform: translateY(-1px); }
.hitl-btn.secondary {
  background: rgba(0,212,184,0.1);
  border: 1px solid rgba(0,212,184,0.3);
  color: var(--teal);
}
.hitl-btn.secondary:hover { background: rgba(0,212,184,0.18); }

.hitl-legal-note {
  font-size: 11px; color: var(--text-muted);
  line-height: 1.6; margin-bottom: 12px;
  padding-top: 12px; border-top: 1px solid var(--glass-border);
}
.hitl-appeal-row {
  font-size: 11px; color: var(--text-muted);
}
.hitl-appeal-link {
  background: none; border: none; color: var(--purple);
  font-size: 11px; cursor: pointer; text-decoration: underline;
  font-family: inherit; padding: 0;
}
.hitl-appeal-link:hover { color: var(--teal); }

  padding: 0;
  overflow: hidden;
  margin-bottom: 24px;
  border: 1px solid rgba(0,212,184,0.2);
}
.expert-review-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: rgba(0,212,184,0.04);
  border-bottom: 1px solid rgba(0,212,184,0.15);
  flex-wrap: wrap;
}
.expert-review-icon { font-size: 28px; flex-shrink: 0; }
.expert-review-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.expert-review-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.expert-review-badge {
  margin-left: auto;
  background: linear-gradient(135deg, rgba(0,212,184,0.2), rgba(124,92,231,0.2));
  border: 1px solid rgba(0,212,184,0.3);
  color: var(--teal);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.expert-review-body { padding: 20px 24px; }
.expert-review-option {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.expert-review-option-icon {
  font-size: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}
.expert-review-option-content { flex: 1; }
.expert-review-option-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.expert-review-option-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}
.expert-review-btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 9px 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}
.expert-review-btn.primary {
  background: linear-gradient(135deg, var(--teal), var(--purple));
  color: #fff;
}
.expert-review-btn.primary:hover { opacity: 0.85; transform: translateY(-1px); }
.expert-review-btn.secondary {
  background: rgba(255,193,7,0.1);
  border: 1px solid rgba(255,193,7,0.3);
  color: var(--amber);
}
.expert-review-btn.secondary:hover { background: rgba(255,193,7,0.18); }
.expert-review-divider {
  height: 1px;
  background: var(--glass-border);
  margin: 20px 0;
}
.expert-review-sla {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--glass-border);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════
   REVIEWER REGISTRY
   ═══════════════════════════════════════════════════════ */

.header-btn-group { display: flex; gap: 8px; align-items: center; }

.reviewer-modal-box { max-width: 700px; max-height: 88vh; }

.reviewer-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }

.reviewer-card {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  transition: border-color 0.2s;
}
.reviewer-card:hover { border-color: rgba(124,92,231,0.3); }
.reviewer-card.expired { border-color: rgba(255,92,92,0.3); background: rgba(255,92,92,0.04); }

.reviewer-card-info { flex: 1; min-width: 0; }
.reviewer-card-name { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 2px; }
.reviewer-card-role { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }
.reviewer-card-quals { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.reviewer-card-ref   { font-size: 11px; color: var(--text-secondary); margin-top: 3px; }
.reviewer-card-ref.expired { color: var(--red); }

.qual-badge {
  font-size: 10px; font-weight: 700;
  background: rgba(124,92,231,0.15);
  border: 1px solid rgba(124,92,231,0.25);
  color: var(--purple);
  padding: 2px 8px; border-radius: 12px;
  white-space: nowrap;
}

.reviewer-add-section {
  border-top: 1px solid var(--glass-border);
  padding-top: 20px;
  margin-top: 4px;
}
.reviewer-add-title {
  font-size: 13px; font-weight: 700; color: var(--text-primary);
  margin-bottom: 16px;
}

.qual-checkbox-group {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 6px;
}
@media (max-width: 550px) { .qual-checkbox-group { grid-template-columns: 1fr; } }

.qual-checkbox {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-secondary);
  padding: 7px 10px;
  border: 1px solid var(--glass-border);
  border-radius: 7px; cursor: pointer;
  transition: all 0.15s;
}
.qual-checkbox:hover { border-color: rgba(124,92,231,0.35); background: rgba(124,92,231,0.05); }
.qual-checkbox input { accent-color: var(--purple); width: 14px; height: 14px; flex-shrink: 0; }
.qual-checkbox:has(input:checked) { border-color: var(--purple); background: rgba(124,92,231,0.08); color: var(--text-primary); }

/* HITL reviewer selector row */
.hitl-reviewer-select-row { display: flex; gap: 10px; align-items: stretch; }
.hitl-reviewer-select-row .hitl-select { flex: 1; }
.hitl-add-reviewer-btn {
  font-family: inherit; font-size: 12px; font-weight: 700;
  padding: 0 16px; border-radius: 8px;
  background: rgba(124,92,231,0.12);
  border: 1px solid rgba(124,92,231,0.3);
  color: var(--purple); cursor: pointer;
  white-space: nowrap; transition: all 0.2s;
}
.hitl-add-reviewer-btn:hover { background: rgba(124,92,231,0.22); }

/* Reviewer qualification summary card (shown after selection) */
.reviewer-qual-summary {
  background: rgba(124,92,231,0.06);
  border: 1px solid rgba(124,92,231,0.2);
  border-radius: 10px; padding: 14px 16px;
  margin-bottom: 14px;
}
.rqs-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.rqs-name   { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.rqs-role   { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.rqs-check  { font-size: 11px; font-weight: 700; color: var(--teal); }
.rqs-quals  { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.rqs-detail { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }
.rqs-detail.expired { color: var(--red); }

/* ═══════════════════════════════════════════════════════
   PIN AUTHENTICATION
   ═══════════════════════════════════════════════════════ */

/* PIN section in registration form */
.pin-section {
  margin-top: 16px;
  padding: 16px 18px;
  background: rgba(0,212,184,0.05);
  border: 1px solid rgba(0,212,184,0.2);
  border-radius: 10px;
  margin-bottom: 16px;
}
.pin-section-title {
  font-size: 13px; font-weight: 700; color: var(--teal);
  margin-bottom: 4px;
}
.pin-section-desc {
  font-size: 11px; color: var(--text-muted);
  line-height: 1.6; margin-bottom: 14px;
}

/* PIN input with show/hide toggle */
.pin-input-wrap { position: relative; display: flex; }
.pin-input-wrap .hitl-input { padding-right: 40px; }
.pin-toggle-btn {
  position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  font-size: 14px; color: var(--text-muted);
  padding: 0; line-height: 1;
}
.pin-toggle-btn:hover { color: var(--text-primary); }

/* PIN strength */
.pin-strength-bar {
  height: 4px; border-radius: 2px;
  background: var(--glass-border);
  margin-top: 6px; overflow: hidden;
}
.pin-strength-fill {
  height: 100%; border-radius: 2px;
  transition: width 0.3s, background 0.3s;
  width: 0;
}
.pin-strength-label {
  font-size: 10px; margin-top: 3px;
  font-weight: 600; transition: color 0.3s;
}

/* PIN Modal */
.pin-modal-box { max-width: 420px; padding: 0; overflow: hidden; }
.pin-modal-header {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 24px;
  background: rgba(0,212,184,0.07);
  border-bottom: 1px solid rgba(0,212,184,0.15);
}
.pin-modal-icon { font-size: 28px; }
.pin-modal-title { font-size: 15px; font-weight: 800; color: var(--text-primary); }
.pin-modal-sub   { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.pin-modal-reviewer { padding: 0 24px; }
.pin-reviewer-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: 8px; padding: 12px 14px;
  margin: 14px 0 4px;
}
.pin-reviewer-name { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 2px; }
.pin-reviewer-role { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }
.pin-reviewer-quals { display: flex; flex-wrap: wrap; gap: 4px; }

#pinModalForm { padding: 16px 24px 0; }

.pin-entry-input {
  font-size: 20px; letter-spacing: 0.3em;
  text-align: center; font-family: 'JetBrains Mono', monospace;
}

.pin-attempt-msg {
  font-size: 12px; font-weight: 600;
  padding: 8px 12px; border-radius: 6px;
  background: rgba(255,92,92,0.1);
  border: 1px solid rgba(255,92,92,0.2);
  margin-bottom: 10px;
}

.pin-modal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }

.pin-locked-out {
  text-align: center; padding: 30px 24px;
}

.pin-modal-footer {
  font-size: 11px; color: var(--text-muted);
  padding: 14px 24px;
  border-top: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.02);
}

