/* 
   ══════════════════════════════════════════════════════════════
   ExplainGrade — Executive UI System
   Theme: Midnight gradient · Precision grids · Expressive type
   Font Stack: Space Grotesk / IBM Plex Sans
   ══════════════════════════════════════════════════════════════
*/

:root {
  --font-display: 'Space Grotesk', 'IBM Plex Sans', sans-serif;
  --font-sans: 'IBM Plex Sans', 'Space Grotesk', sans-serif;

  --primary: #7668ff;
  --accent1: #5be49b;
  --accent2: #67b8ff;
  --accent3: #faae3d;
  --danger: #ff7070;

  --primary-glow: rgba(118, 104, 255, 0.35);
  --secondary-glow: rgba(91, 228, 155, 0.18);
  --bg-grad-start: #05061b;
  --bg-grad-end: #03030c;
  --blob-1-color: rgba(118, 104, 255, 0.18);
  --blob-2-color: rgba(91, 228, 155, 0.14);
  --blob-3-color: rgba(103, 184, 255, 0.12);

  --bg-dark: #040411;
  --bg-panel: rgba(10, 12, 24, 0.9);
  --bg-card: rgba(10, 12, 24, 0.72);
  --bg-card-alt: rgba(255, 255, 255, 0.02);
  --bg-secondary: rgba(15, 18, 35, 0.95);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(118, 104, 255, 0.7);
  --grid-line: rgba(255, 255, 255, 0.04);

  --matrix-bg: rgba(6, 8, 20, 0.85);
  --matrix-border: rgba(118, 104, 255, 0.25);
  --matrix-grid-gap: rgba(255, 255, 255, 0.08);
  --matrix-cell-base: #7668ff;
  --matrix-cell-highlight: #6dd3ff;
  --matrix-shadow: 0 20px 40px rgba(5, 6, 17, 0.4);
  --matrix-empty-bg: rgba(255, 255, 255, 0.03);

  --text: #f4f5fb;
  --text-dim: #a8b3c5;
  --text-muted: #6d7385;

  --radius-sm: 8px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --radius-xl: 36px;

  --container-w: 1240px;
  --gap: 2.5rem;

  --shadow-sm: 0 12px 30px rgba(3, 7, 18, 0.45);
  --shadow-lg: 0 30px 80px rgba(5, 6, 17, 0.6);
  --glass-blur: blur(18px);
  --transition: all 0.3s ease;
}

[data-theme="light"] {
  --bg-dark: #f5f7fb;
  --bg-panel: rgba(255, 255, 255, 0.9);
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-alt: rgba(15, 23, 42, 0.06);
  --bg-secondary: rgba(255, 255, 255, 0.95);
  --border-glass: rgba(15, 23, 42, 0.08);
  --grid-line: rgba(15, 23, 42, 0.08);
  --primary-glow: rgba(67, 56, 202, 0.2);
  --secondary-glow: rgba(14, 165, 233, 0.18);
  --bg-grad-start: #fdfefe;
  --bg-grad-end: #e6edf8;
  --blob-1-color: rgba(67, 56, 202, 0.12);
  --blob-2-color: rgba(16, 185, 129, 0.12);
  --blob-3-color: rgba(14, 165, 233, 0.12);
  --matrix-bg: rgba(255, 255, 255, 0.85);
  --matrix-border: rgba(15, 23, 42, 0.12);
  --matrix-grid-gap: rgba(15, 23, 42, 0.08);
  --matrix-cell-base: #4338ca;
  --matrix-cell-highlight: #0ea5e9;
  --matrix-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
  --matrix-empty-bg: rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 35px 60px rgba(15, 23, 42, 0.12);
  --text: #0f172a;
  --text-dim: #475569;
  --text-muted: #7c8aa3;
}

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

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  background-image: radial-gradient(circle at 20% 20%, var(--blob-1-color), transparent 35%),
    radial-gradient(circle at 80% 0%, var(--blob-2-color), transparent 30%),
    radial-gradient(circle at 50% 80%, var(--blob-3-color), transparent 40%),
    linear-gradient(135deg, var(--bg-grad-start), var(--bg-grad-end));
  color: var(--text);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    linear-gradient(0deg, var(--grid-line) 1px, transparent 1px);
  background-size: 120px 120px;
  opacity: 0.4;
  pointer-events: none;
}

h1,
h2,
h3,
h4,
h5,
h6,
.nav-logo {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}


.batch-table-card {
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: linear-gradient(120deg, rgba(10, 12, 24, 0.95), rgba(8, 9, 20, 0.95));
}

#batch-table-wrap > div:first-child {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
/* Background Gradients */
.bg-blobs {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  height: 50vw;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  filter: blur(80px);
  border-radius: 50%;
  animation: float 20s infinite alternate;
}

.blob-1 {
  top: -10%;
  left: -10%;
  background: radial-gradient(circle, var(--blob-1-color) 0%, transparent 70%);
}

.blob-2 {
  bottom: -10%;
  right: -10%;
  background: radial-gradient(circle, var(--blob-2-color) 0%, transparent 70%);
  animation-delay: -5s;
}

.blob-3 {
  top: 40%;
  left: 30%;
  width: 30vw;
  height: 30vw;
  background: radial-gradient(circle, var(--blob-3-color) 0%, transparent 70%);
  animation-delay: -10s;
}

@keyframes float {
  0% {
    transform: translate(0, 0) scale(1);
  }

  100% {
    transform: translate(100px, 50px) scale(1.1);
  }
}

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

/* ═══ LAYOUT ═══ */
.container {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: 6rem 0;
}

/* ═══ NAVBAR ═══ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 80px;
  z-index: 1000;
  display: flex;
  align-items: center;
  transition: var(--transition);
  border-bottom: 1px solid transparent;
}

.navbar.scrolled {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-glass);
  height: 70px;
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.nav-logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2rem;
  align-items: center;
}

.nav-link {
  text-decoration: none;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition);
  padding: 0.5rem 0;
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: var(--transition);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* ═══ CARDS & GLASS ═══ */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.glass-card:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 0.95rem;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 20px -6px var(--primary-glow);
}

.btn-primary:hover {
  transform: scale(1.02);
  filter: brightness(1.1);
  box-shadow: 0 12px 25px -6px var(--primary-glow);
}

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.row-replay-btn {
  min-width: 104px;
}

.row-replay-btn.loading {
  background: linear-gradient(120deg, var(--accent2), var(--primary));
  border-color: transparent;
  color: #fff;
  cursor: wait;
  pointer-events: none;
  box-shadow: 0 10px 24px -10px rgba(103, 184, 255, 0.8);
}

.row-replay-btn.loading::after {
  width: 12px;
  height: 12px;
  margin-left: 0.45rem;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn.loading {
  cursor: wait;
  opacity: 0.85;
}

.btn.loading::after {
  content: '';
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  margin-left: 0.75rem;
  animation: spin 0.8s linear infinite;
}

.btn-primary.loading {
  background: linear-gradient(120deg, var(--primary), var(--accent2));
  box-shadow: 0 12px 30px -6px rgba(118, 104, 255, 0.55);
  transform: translateY(1px) scale(0.995);
}

#run-script-eval-btn.loading {
  background: linear-gradient(120deg, var(--accent1), var(--accent2));
  box-shadow: 0 12px 30px -6px rgba(116, 90, 255, 0.45);
  transform: translateY(1px) scale(0.995);
}

.eval-status {
  margin-top: 0.9rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: color 0.2s ease, opacity 0.2s ease;
}

.eval-status.active {
  color: var(--accent1);
  font-weight: 600;
}

/* ═══ HERO SECTION ═══ */
.hero {
  min-height: 90vh;
  display: flex;
  align-items: center;
  padding-top: 140px;
  position: relative;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 3rem;
  align-items: center;
}

.hero-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.eyebrow,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(118, 104, 255, 0.12);
  border: 1px solid rgba(118, 104, 255, 0.4);
  color: var(--primary);
}

.hero-title {
  font-size: clamp(2.8rem, 6vw, 4.3rem);
  line-height: 1.05;
  margin: 0;
  font-weight: 700;
}

.hero-title .gradient-text {
  background: linear-gradient(135deg, var(--accent2), var(--primary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-dim);
  max-width: 560px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.btn-link {
  border: 1px solid transparent;
  color: var(--text);
  padding: 0.75rem 1.2rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
  font-weight: 600;
  box-shadow: none;
}

.btn-link:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.hero-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.metric-pill {
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  border: 1px solid var(--border-glass);
  background: var(--bg-card-alt);
  display: flex;
  flex-direction: column;
  min-width: 140px;
}

.metric-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.metric-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.hero-panel {
  display: grid;
  gap: 1.5rem;
}

.panel-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-sm);
}

.panel-label {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.hero-info-card {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.pipeline-steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pipeline-step {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.step-badge {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--bg-card-alt);
  border: 1px solid var(--border-glass);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  min-width: 70px;
  text-align: center;
}

.pipeline-step strong {
  font-size: 1rem;
}

.pipeline-step p {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.4;
}

.hero-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.hero-points li {
  display: flex;
  gap: 0.4rem;
  color: var(--text-dim);
  font-size: 0.95rem;
}

.hero-points li::before {
  content: "•";
  color: var(--primary);
}


.panel-grade {
  font-size: 2.8rem;
  font-weight: 700;
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.panel-grade span {
  font-size: 1rem;
  color: var(--text-muted);
}

.score-meta {
  list-style: none;
  margin-top: 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.impact-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.impact-row strong {
  color: var(--accent1);
}

.panel-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 1rem;
}

/* ═══ FORMS ═══ */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

.form-control {
  width: 100%;
  padding: 1rem;
  background: var(--bg-card-alt);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(118, 104, 255, 0.25);
}

textarea.form-control {
  resize: vertical;
  min-height: 120px;
}

/* ═══ UPLOAD ZONES ═══ */
.upload-zone {
  position: relative;
  transition: var(--transition);
}

.upload-zone.has-file {
  border-color: var(--accent1) !important;
  background: rgba(74, 222, 128, 0.08);
  box-shadow: 0 12px 30px -15px rgba(74, 222, 128, 0.7);
}

.upload-file-name {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-dim);
  word-break: break-word;
  min-height: 1.2rem;
}

.upload-zone.has-file .upload-file-name {
  color: var(--text);
  font-weight: 600;
}

/* ═══ XAI DASHBOARD ═══ */
.xai-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--gap);
  margin-top: 3rem;
}

.xai-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.xai-card .viz-header {
  margin-bottom: 1rem;
}

.xai-card .viz-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.viz-footnote {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
}

.viz-description {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin: 0;
}

.xai-text-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  line-height: 1.7;
  font-size: 0.95rem;
}

.xai-scroll-body {
  max-height: 420px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.xai-scroll-body::-webkit-scrollbar {
  width: 6px;
}

.xai-scroll-body::-webkit-scrollbar-thumb {
  background: var(--border-glass);
  border-radius: 10px;
}

.shap-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#shap-body .ex-bar-wrap {
  width: 100%;
  height: 8px;
}

#sentence-attribution-body .ex-row {
  align-items: flex-start;
}

.cluster-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  justify-content: center;
  margin-top: 1rem;
}

.concept-card canvas {
  width: 100%;
  height: auto;
  display: block;
}

.waterfall-canvas {
  width: 100%;
  height: 340px;
  display: block;
}

.waterfall-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.25rem;
  margin-top: 0.9rem;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.waterfall-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.waterfall-swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
}

.waterfall-swatch-pos {
  background: var(--accent1);
}

.waterfall-swatch-neg {
  background: var(--danger);
}

.waterfall-swatch-base {
  background: rgba(255, 255, 255, 0.25);
}

.radar-canvas,
.timeline-canvas {
  width: 100%;
  display: block;
}

.radar-canvas {
  height: 280px;
}

.timeline-canvas {
  height: 200px;
}

.timeline-strip {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.02), rgba(118, 104, 255, 0.04));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: relative;
}

.timeline-empty {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 1rem;
}

.timeline-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 0.75rem;
}

.timeline-meta strong {
  color: var(--accent2);
  font-size: 1rem;
}

.sentence-heatmap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.sentence-chip {
  border: 1px solid var(--border-glass);
  border-left-width: 4px;
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.02);
  transition: transform 0.2s ease;
}

.sentence-chip.pos {
  border-left-color: var(--accent1);
  background: linear-gradient(90deg, rgba(91, 228, 155, 0.08), rgba(91, 228, 155, var(--heat-intensity, 0.4)));
}

.sentence-chip.neg {
  border-left-color: var(--danger);
  background: linear-gradient(90deg, rgba(255, 112, 112, 0.08), rgba(255, 112, 112, var(--heat-intensity, 0.4)));
}

.sentence-chip:hover {
  transform: translateY(-2px);
}

.sentence-chip__text {
  flex: 1;
  color: var(--text);
}

.sentence-chip__score {
  font-weight: 700;
  color: var(--text);
  min-width: 64px;
  text-align: right;
}

.dual-bar-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dual-bar-row {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.dual-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.dual-bar-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}

.dual-bar-caption {
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.35;
  max-width: 38ch;
}

.dual-bar-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.dual-bar-chip--student {
  background: rgba(215, 107, 255, 0.12);
  color: #d89bff;
  border-color: rgba(215, 107, 255, 0.22);
}

.dual-bar-track {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  position: relative;
  overflow: hidden;
}

.dual-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: inherit;
}

.dual-bar--baseline {
  background: linear-gradient(90deg, #4cb0ff, #1e7dff);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.15);
}

.dual-bar--student {
  background: linear-gradient(90deg, #d76bff, #a855f7);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.15);
}

.dual-bar-footer {
  display: flex;
  justify-content: flex-end;
  font-size: 0.78rem;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .waterfall-canvas {
    height: 300px;
  }

  .dual-bar-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .dual-bar-caption {
    max-width: none;
  }

  .dual-bar-footer {
    justify-content: flex-start;
  }
}

@media (min-width: 1100px) {
  .xai-card.span-2 {
    grid-column: span 2;
  }
}

/* ═══ SCORING DASHBOARD ═══ */
.score-main {
  text-align: center;
  padding: 3rem;
}

.score-circle {
  width: 180px;
  height: 180px;
  margin: 0 auto 2rem;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  background: conic-gradient(var(--primary) var(--pct), var(--border-glass) 0);
}

.score-circle::before {
  content: '';
  position: absolute;
  inset: 10px;
  background: var(--bg-dark);
  border-radius: 50%;
  z-index: 1;
}

.score-value-wrap {
  position: relative;
  z-index: 2;
}

.score-value {
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
}

.score-max {
  font-size: 1rem;
  color: var(--text-dim);
  font-weight: 600;
}

/* Metrics Grid */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.metric-item {
  background: rgba(255, 255, 255, 0.03);
  padding: 1rem;
  border-radius: var(--radius-md);
  text-align: center;
  border: 1px solid var(--border-glass);
}

.metric-name {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}

.metric-val {
  font-weight: 700;
  font-size: 1.1rem;
}

/* ═══ VISUALIZATIONS ═══ */
.viz-card {
  margin-bottom: var(--gap);
}

.viz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.viz-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.1rem;
  font-weight: 700;
}

/* Advanced Semantic Drift Matrix */
.drift-matrix-container {
  overflow-x: auto;
  padding: 1.25rem;
  background: linear-gradient(135deg, var(--matrix-bg), rgba(255, 255, 255, 0.02));
  border-radius: var(--radius-lg);
  border: 1px solid var(--matrix-border);
  box-shadow: var(--matrix-shadow);
}

.drift-matrix {
  min-width: 760px;
}

.matrix-cell {
  aspect-ratio: 1;
  border-radius: 6px;
  background: hsl(var(--cell-hue, 212) 88% calc(14% + var(--sim) * 34%) / calc(0.18 + var(--sim) * 0.82));
  border: 1px solid hsl(var(--cell-hue, 212) 88% 60% / calc(0.15 + var(--sim) * 0.5));
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.08), 0 6px 15px rgba(8, 9, 20, 0.2);
  transition: transform 0.2s ease, filter 0.2s ease, opacity 0.2s ease;
}

.matrix-cell:hover {
  transform: translateY(-2px) scale(1.02);
  filter: brightness(1.1);
}

.drift-matrix-empty {
  padding: 1.25rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
}

.drift-matrix-shell {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.drift-matrix-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
}

.drift-stat {
  padding: 0.85rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.02);
}

.drift-stat-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
}

.drift-stat strong {
  font-size: 1.15rem;
  color: var(--text);
}

.drift-axis {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.drift-column-labels {
  display: grid;
  gap: 0.35rem;
  padding-left: 4.5rem;
}

.drift-col-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  padding: 0 0.25rem;
}

.drift-heatmap-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.drift-row {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: 0.5rem;
  align-items: center;
}

.drift-row-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drift-row-cells {
  display: grid;
  gap: 0.28rem;
  min-width: 0;
}

.drift-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.drift-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.legend-swatch {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 4px;
  display: inline-block;
}

.legend-low {
  background: hsl(212 88% 35% / 0.55);
}

.legend-mid {
  background: hsl(180 88% 42% / 0.7);
}

.legend-high {
  background: hsl(145 78% 45% / 0.8);
}

.drift-caption {
  font-size: 0.78rem;
  color: var(--text-dim);
}

#batch-table-wrap table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
  min-width: 720px;
}

#batch-table-wrap {
  border-radius: var(--radius-lg);
  overflow: hidden;
  padding-bottom: 0.5rem;
}

#batch-table-wrap thead th {
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-glass);
}

#batch-table-wrap tbody td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

#batch-table-wrap tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* ═══ EXPLAINABLE AI BITS ═══ */
.ex-row {
  display: flex;
  gap: 1.5rem;
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-glass);
  align-items: center;
}

.ex-text {
  flex: 1;
  font-size: 0.95rem;
}

.ex-bar-wrap {
  width: 120px;
  height: 8px;
  background: var(--border-glass);
  border-radius: 100px;
  overflow: hidden;
}

.ex-bar {
  height: 100%;
  border-radius: 100px;
}

.ex-bar-pos {
  background: var(--accent1);
}

.ex-bar-neg {
  background: var(--danger);
}

/* ═══ FOOTER ═══ */
.footer {
  padding: 4rem 0;
  border-top: 1px solid var(--border-glass);
  margin-top: 4rem;
  color: var(--text-muted);
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.footer-link {
  color: var(--text-dim);
  text-decoration: none;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 992px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .section-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .xai-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .section {
    padding: 4rem 0;
  }

  .heading-actions {
    width: 100%;
  }

  .heading-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .drift-matrix {
    min-width: 700px;
  }

  .drift-matrix-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .drift-row {
    grid-template-columns: 3.75rem minmax(0, 1fr);
  }

  .drift-column-labels {
    padding-left: 3.75rem;
  }
}

/* ═══ UTILITIES ═══ */
.hidden {
  display: none !important;
}

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

.text-accent1 {
  color: var(--accent1);
}

.text-accent2 {
  color: var(--accent2);
}

.text-accent3 {
  color: var(--accent3);
}

.mt-4 {
  margin-top: 1rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.section-heading h2 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin: 0;
}

.section-subtitle {
  margin-top: 0.75rem;
  color: var(--text-dim);
  max-width: 540px;
}

.heading-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.heading-actions .btn {
  width: max-content;
}

.text-center {
  text-align: center;
}

.section-heading.text-center {
  justify-content: center;
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
}

.results-placeholder {
  border: 1px dashed var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
}

.results-placeholder span {
  font-size: 3rem;
  opacity: 0.35;
}

.batch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
}