/* ============================================================
   TranscriptIQ — Premium Dark Editorial Design System
   Theme: Dark slate + warm cream + electric amber accent
   Font: Instrument Serif (display) + DM Sans (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,300&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --ink:        #0d0f14;
  --ink-2:      #1a1d27;
  --ink-3:      #252836;
  --ink-4:      #2e3245;
  --surface:    #f5f0e8;
  --surface-2:  #ede8df;
  --surface-3:  #e2dbd0;
  --accent:     #e8722a;
  --accent-2:   #f5954d;
  --accent-dim: rgba(232,114,42,0.15);
  --cream:      #f9f5ef;
  --muted:      #7a7f94;
  --muted-2:    #9da2b4;
  --white:      #ffffff;
  --border:     rgba(255,255,255,0.08);
  --border-light: rgba(13,15,20,0.1);
  --green:      #22c55e;
  --red:        #ef4444;
  --blue:       #3b82f6;
  --yellow:     #f59e0b;

  --nav-h: 64px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --shadow-glow: 0 0 40px rgba(232,114,42,0.12);
}

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

html { scroll-behavior: smooth; }

body {
  background-color: var(--ink);
  font-family: 'DM Sans', -apple-system, sans-serif;
  color: var(--surface);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ─────────────────────────────────────────────── */
.display {
  font-family: 'Instrument Serif', Georgia, serif;
  font-style: italic;
  line-height: 1.1;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  color: var(--surface);
}

a { color: var(--accent-2); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent); }

/* ── Noise texture overlay ──────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}

/* ── Auth Pages ─────────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  position: relative;
}

@media (max-width: 768px) {
  .auth-wrapper { grid-template-columns: 1fr; }
  .auth-left { display: none; }
}

.auth-left {
  background: var(--ink-2);
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--border);
}

.auth-left::before {
  content: '';
  position: absolute;
  bottom: -80px;
  left: -80px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(232,114,42,0.18) 0%, transparent 70%);
  pointer-events: none;
}

.auth-left-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--surface);
}

.auth-left-brand svg {
  width: 28px; height: 28px;
  stroke: var(--accent); fill: none; stroke-width: 2;
}

.auth-left-headline {
  font-family: 'Instrument Serif', serif;
  font-size: 3.2rem;
  line-height: 1.1;
  color: var(--surface);
  font-style: italic;
}

.auth-left-headline span { color: var(--accent); }

.auth-left-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.auth-stat {
  background: var(--ink-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.auth-stat-number {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
  font-family: 'Instrument Serif', serif;
}

.auth-stat-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.auth-right {
  background: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  animation: fadeUp 0.5s ease;
}

.auth-card-inner {
  background: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow);
}

.auth-logo-mark {
  width: 52px; height: 52px;
  background: var(--accent-dim);
  border: 1px solid rgba(232,114,42,0.3);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1.5rem;
}

.auth-logo-mark svg {
  width: 26px; height: 26px;
  stroke: var(--accent); fill: none; stroke-width: 2;
}

.auth-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--surface);
  margin-bottom: 0.25rem;
}

.auth-subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

/* ── Navbar ─────────────────────────────────────────────────── */
.tiq-navbar {
  height: var(--nav-h);
  background: rgba(13,15,20,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
}

.tiq-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--surface);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.tiq-brand svg {
  width: 22px; height: 22px;
  stroke: var(--accent); fill: none; stroke-width: 2.5;
}

.tiq-brand:hover { color: var(--surface); }

.tiq-nav-user {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.82rem;
}

.nav-email {
  color: var(--muted);
  font-size: 0.8rem;
}

.nav-back-link {
  color: var(--muted);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s;
}

.nav-back-link:hover { color: var(--surface); }

/* ── Page Layout ────────────────────────────────────────────── */
.tiq-page {
  max-width: 1160px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
  position: relative;
  z-index: 1;
}

/* ── Page Header ────────────────────────────────────────────── */
.page-header {
  margin-bottom: 2.5rem;
}

.page-eyebrow {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--surface);
  line-height: 1.2;
  font-family: 'Instrument Serif', serif;
  font-style: italic;
}

.page-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.3rem;
  font-family: 'SFMono-Regular', Consolas, monospace;
}

/* ── Cards ──────────────────────────────────────────────────── */
.tiq-card {
  background: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.tiq-card:hover {
  border-color: rgba(255,255,255,0.12);
  box-shadow: var(--shadow-sm);
}

.tiq-card-hoverable {
  cursor: pointer;
}

.tiq-card-hoverable:hover {
  border-color: rgba(232,114,42,0.3);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3), var(--shadow-glow);
  transform: translateY(-1px);
}

/* ── Project Cards ──────────────────────────────────────────── */
.project-card {
  background: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
  height: 100%;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0;
  transition: opacity 0.25s;
}

.project-card:hover {
  border-color: rgba(232,114,42,0.25);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  transform: translateY(-2px);
}

.project-card:hover::before { opacity: 1; }

.project-card-icon {
  width: 44px; height: 44px;
  background: var(--ink-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

.project-card-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--surface);
  margin-bottom: 0.2rem;
}

.project-card-domain {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.project-card-id {
  font-size: 0.66rem;
  color: var(--ink-4);
  font-family: 'SFMono-Regular', Consolas, monospace;
  color: var(--muted);
  opacity: 0.6;
}

.project-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.project-card-link {
  font-size: 0.8rem;
  color: var(--accent-2);
  font-weight: 500;
  transition: color 0.2s;
}

.project-card-link:hover { color: var(--accent); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn-brand {
  background: var(--accent);
  color: var(--white);
  border: none;
  padding: 0.55rem 1.4rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
  font-family: 'DM Sans', sans-serif;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-brand:hover {
  background: var(--accent-2);
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(232,114,42,0.35);
}

.btn-brand:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-outline-brand {
  background: transparent;
  color: var(--accent-2);
  border: 1.5px solid rgba(232,114,42,0.4);
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
  font-family: 'DM Sans', sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-outline-brand:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-2);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.82rem;
  font-family: 'DM Sans', sans-serif;
}

.btn-ghost:hover {
  color: var(--surface);
  border-color: rgba(255,255,255,0.15);
  background: var(--ink-3);
}

.btn-danger {
  background: transparent;
  color: #ef4444;
  border: 1px solid rgba(239,68,68,0.3);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-danger:hover {
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.5);
}

/* ── Form Inputs ────────────────────────────────────────────── */
.tiq-input {
  width: 100%;
  padding: 0.6rem 0.875rem;
  background: var(--ink-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--surface);
  font-size: 0.875rem;
  font-family: 'DM Sans', sans-serif;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

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

.tiq-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232,114,42,0.15);
}

.tiq-input option {
  background: var(--ink-2);
  color: var(--surface);
}

.form-label-dark {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.4rem;
}

/* ── Create Project Panel ───────────────────────────────────── */
.create-panel {
  background: var(--ink-2);
  border: 1px solid rgba(232,114,42,0.25);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
  animation: fadeDown 0.3s ease;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3), var(--shadow-glow);
}

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

/* ── Upload Zone ────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  padding: 3.5rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  background: var(--ink-2);
  position: relative;
  overflow: hidden;
}

.upload-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(232,114,42,0.05) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.25s;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: rgba(232,114,42,0.4);
  background: var(--ink-3);
}

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

.upload-icon {
  width: 52px; height: 52px;
  background: var(--ink-3);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
  transition: all 0.25s;
}

.upload-zone:hover .upload-icon,
.upload-zone.dragover .upload-icon {
  background: var(--accent-dim);
  border-color: rgba(232,114,42,0.3);
}

.upload-icon svg {
  width: 24px; height: 24px;
  stroke: var(--muted); fill: none; stroke-width: 1.5;
  transition: stroke 0.25s;
}

.upload-zone:hover .upload-icon svg,
.upload-zone.dragover .upload-icon svg { stroke: var(--accent); }

.upload-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--surface);
  margin-bottom: 0.3rem;
}

.upload-hint {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ── Transcript List ────────────────────────────────────────── */
.transcript-row {
  background: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
  transition: border-color 0.2s;
}

.transcript-row:hover { border-color: rgba(255,255,255,0.1); }

.transcript-file-icon {
  width: 36px; height: 36px;
  background: var(--ink-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.transcript-file-icon svg {
  width: 18px; height: 18px;
  stroke: var(--muted); fill: none; stroke-width: 1.5;
}

.transcript-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--surface);
}

.transcript-id-text {
  font-size: 0.65rem;
  color: var(--muted);
  opacity: 0.7;
  font-family: 'SFMono-Regular', Consolas, monospace;
}

/* ── Status Badges ──────────────────────────────────────────── */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.badge-status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}

.badge-uploaded    { background: rgba(122,127,148,0.15); color: var(--muted-2); border: 1px solid rgba(122,127,148,0.2); }
.badge-processing  { background: rgba(59,130,246,0.15);  color: #60a5fa; border: 1px solid rgba(59,130,246,0.2); }
.badge-complete    { background: rgba(34,197,94,0.15);   color: #4ade80; border: 1px solid rgba(34,197,94,0.2); }
.badge-failed      { background: rgba(239,68,68,0.15);   color: #f87171; border: 1px solid rgba(239,68,68,0.2); }
.badge-queued      { background: rgba(245,158,11,0.15);  color: #fbbf24; border: 1px solid rgba(245,158,11,0.2); }

/* ── Section Header ─────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-count {
  background: var(--ink-3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 0.7rem;
  color: var(--muted-2);
}

/* ── Pipeline Steps Modal ───────────────────────────────────── */
.modal-content {
  background: var(--ink-2) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  color: var(--surface);
}

.pipeline-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 1.5rem 0;
}

.step {
  flex: 1;
  text-align: center;
  position: relative;
}

.step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 17px;
  right: -50%;
  width: 100%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.step.done:not(:last-child)::after { background: var(--green); }

.step-dot {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--ink-3);
  border: 1px solid var(--border);
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 0.4rem;
  font-weight: 700;
  font-size: 0.8rem;
  position: relative;
  z-index: 1;
  transition: all 0.3s;
}

.step.done .step-dot   { background: var(--green); color: #fff; border-color: var(--green); }
.step.active .step-dot { background: var(--accent); color: #fff; border-color: var(--accent); animation: pulse 1.5s infinite; }
.step.failed .step-dot { background: var(--red); color: #fff; }

.step-label {
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.step.done .step-label   { color: var(--green); }
.step.active .step-label { color: var(--accent); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232,114,42,0.5); }
  50%       { box-shadow: 0 0 0 8px rgba(232,114,42,0); }
}

/* ── Stat Cards ─────────────────────────────────────────────── */
.stat-box {
  background: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.stat-box::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0.6;
}

.stat-number {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent-2);
  font-family: 'Instrument Serif', serif;
  line-height: 1;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* ── Tabs ───────────────────────────────────────────────────── */
.tiq-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.tiq-tab {
  padding: 0.75rem 1.25rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: 'DM Sans', sans-serif;
}

.tiq-tab:hover { color: var(--surface); }

.tiq-tab.active {
  color: var(--accent-2);
  border-bottom-color: var(--accent);
}

/* ── Bar Chart ──────────────────────────────────────────────── */
.bar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.bar-label {
  width: 240px;
  font-size: 0.8rem;
  color: var(--surface);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.bar-track {
  flex: 1;
  height: 8px;
  background: var(--ink-3);
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.22,1,0.36,1);
}

.bar-count {
  font-size: 0.78rem;
  color: var(--muted);
  width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── Group colour dots ──────────────────────────────────────── */
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Hierarchy Tree ─────────────────────────────────────────── */
.tree-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 0.6rem;
}

.tree-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  background: var(--ink-3);
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--surface);
  transition: background 0.15s;
}

.tree-group-header:hover { background: var(--ink-4); }

.tree-theme {
  padding: 0.65rem 1rem 0.65rem 2.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--surface);
  transition: background 0.15s;
}

.tree-theme:hover { background: var(--ink-3); }

.tree-codes {
  padding: 0.5rem 1rem 0.5rem 4rem;
  border-top: 1px solid var(--border);
  background: var(--ink-2);
}

.tree-code-item {
  font-size: 0.78rem;
  color: var(--muted-2);
  padding: 0.22rem 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tree-code-item::before { content: '—'; color: var(--ink-4); font-size: 0.65rem; }

/* ── Result Cards ───────────────────────────────────────────── */
.result-card {
  background: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.18s;
  margin-bottom: 0.5rem;
}

.result-card:hover {
  border-color: rgba(255,255,255,0.12);
  box-shadow: var(--shadow-sm);
}

.result-card.active {
  border-color: rgba(232,114,42,0.4);
  background: var(--ink-3);
  box-shadow: 0 0 0 1px rgba(232,114,42,0.15);
}

.result-quote {
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
  border-left: 2px solid var(--accent);
  padding-left: 0.7rem;
  margin-top: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  opacity: 0.8;
}

/* ── Detail Panel ───────────────────────────────────────────── */
.detail-panel {
  background: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: sticky;
  top: calc(var(--nav-h) + 1rem);
}

.detail-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 4px;
}

.detail-value {
  font-size: 0.875rem;
  color: var(--surface);
  margin-bottom: 1rem;
}

.justification-box {
  background: var(--ink-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.875rem;
  font-size: 0.78rem;
  color: var(--muted-2);
  line-height: 1.65;
  white-space: pre-wrap;
  max-height: 280px;
  overflow-y: auto;
}

/* ── Group Chips ────────────────────────────────────────────── */
.group-chip {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chip-facilitators    { background: rgba(34,197,94,0.15);  color: #4ade80;  border: 1px solid rgba(34,197,94,0.2); }
.chip-barriers-belief { background: rgba(239,68,68,0.15);  color: #f87171;  border: 1px solid rgba(239,68,68,0.2); }
.chip-barriers-system { background: rgba(245,158,11,0.15); color: #fbbf24;  border: 1px solid rgba(245,158,11,0.2); }
.chip-barriers-finance{ background: rgba(232,114,42,0.15); color: var(--accent-2); border: 1px solid rgba(232,114,42,0.2); }

/* ── Analytics Accuracy Dial ────────────────────────────────── */
.accuracy-ring {
  width: 130px; height: 130px;
  position: relative;
}

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

.accuracy-ring .ring-bg {
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 8;
}

.accuracy-ring .ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s cubic-bezier(0.22,1,0.36,1);
}

.accuracy-number {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-2);
  font-family: 'Instrument Serif', serif;
}

.accuracy-number span {
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
  font-family: 'DM Sans', sans-serif;
}

/* ── Confidence Bars ────────────────────────────────────────── */
.conf-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  width: 80px;
  justify-content: center;
}

.conf-high    { background: rgba(34,197,94,0.15);  color: #4ade80;  }
.conf-medium  { background: rgba(245,158,11,0.15); color: #fbbf24;  }
.conf-low     { background: rgba(239,68,68,0.15);  color: #f87171;  }
.conf-unknown { background: rgba(122,127,148,0.15);color: var(--muted-2); }

/* ── Toast ──────────────────────────────────────────────────── */
.toast-msg {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 9999;
  box-shadow: var(--shadow);
  animation: slideUp 0.3s ease;
  border: 1px solid rgba(255,255,255,0.1);
}

.toast-success { background: rgba(34,197,94,0.15);  color: #4ade80;  border-color: rgba(34,197,94,0.25); }
.toast-error   { background: rgba(239,68,68,0.15);  color: #f87171;  border-color: rgba(239,68,68,0.25); }
.toast-info    { background: rgba(59,130,246,0.15); color: #60a5fa;  border-color: rgba(59,130,246,0.25); }
.toast-hide    { opacity: 0; transition: opacity 0.4s; }

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

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 5rem 2rem;
  color: var(--muted);
}

.empty-state-icon {
  width: 64px; height: 64px;
  background: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.5rem;
}

.empty-state-icon svg {
  width: 28px; height: 28px;
  stroke: var(--muted); fill: none; stroke-width: 1.5;
}

.empty-state h5 { color: var(--surface); font-size: 1rem; margin-bottom: 0.4rem; }
.empty-state p  { font-size: 0.85rem; color: var(--muted); margin-bottom: 1.25rem; }

/* ── Spinner ────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

.spinner-accent {
  border-color: rgba(232,114,42,0.2);
  border-top-color: var(--accent);
}

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

/* ── Divider ────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ── Misc Utils ─────────────────────────────────────────────── */
.text-brand  { color: var(--accent-2); }
.text-muted  { color: var(--muted) !important; }
.text-accent { color: var(--accent); }
.mono { font-family: 'SFMono-Regular', Consolas, monospace; }

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-up { animation: fadeUp 0.4s ease both; }
.fade-up-1 { animation-delay: 0.05s; }
.fade-up-2 { animation-delay: 0.1s; }
.fade-up-3 { animation-delay: 0.15s; }
.fade-up-4 { animation-delay: 0.2s; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--ink-2); }
::-webkit-scrollbar-thumb { background: var(--ink-4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── Alert overrides ────────────────────────────────────────── */
.alert-danger {
  background: rgba(239,68,68,0.1) !important;
  border: 1px solid rgba(239,68,68,0.25) !important;
  color: #f87171 !important;
  border-radius: var(--radius-sm) !important;
}

/* ── Bootstrap overrides ────────────────────────────────────── */
.modal-backdrop { background: rgba(0,0,0,0.7); }

.pagination .page-link {
  background: var(--ink-2);
  border-color: var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
}

.pagination .page-link:hover {
  background: var(--ink-3);
  color: var(--surface);
  border-color: var(--border);
}

.pagination .page-item.active .page-link {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.pagination .page-item.disabled .page-link {
  background: var(--ink-2);
  color: var(--muted);
  opacity: 0.4;
}