/* ================================================================
   SOCRATE — Design System v4
   "Quiet premium. Knowledge machine."
   Ref: Linear.app + Stripe Dashboard aesthetic.
   Font: Sora (display) + Inter (body)
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&display=swap');

/* ── Custom Properties ─────────────────────────────────────────── */
:root {
  /* Brand */
  --brand-50:  #EEF2FF;
  --brand-100: #E0E7FF;
  --brand-200: #C7D2FE;
  --brand-300: #A5B4FC;
  --brand-400: #818CF8;
  --brand-500: #6366F1;
  --brand-600: #4F46E5;
  --brand-700: #4338CA;
  --brand-800: #3730A3;
  --brand-900: #312E81;
  --brand-950: #1E1B4B;

  /* Neutrals */
  --n-0:   #FFFFFF;
  --n-50:  #F9FAFB;
  --n-100: #F3F4F6;
  --n-200: #E5E7EB;
  --n-300: #D1D5DB;
  --n-400: #9CA3AF;
  --n-500: #6B7280;
  --n-600: #4B5563;
  --n-700: #374151;
  --n-800: #1F2937;
  --n-900: #111827;

  /* Status */
  --green-50:  #F0FDF4; --green-100: #DCFCE7; --green-600: #16A34A; --green-700: #15803D;
  --amber-50:  #FFFBEB; --amber-100: #FEF3C7; --amber-600: #D97706; --amber-700: #B45309;
  --red-50:    #FFF1F2; --red-100:   #FFE4E6; --red-600:   #DC2626; --red-700:   #B91C1C;
  --blue-50:   #EFF6FF; --blue-100:  #DBEAFE; --blue-600:  #2563EB; --blue-700:  #1D4ED8;

  /* Typography */
  --font-display: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-body:    'IBM Plex Sans', system-ui, -apple-system, sans-serif;

  /* Spacing (4px grid) */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px; --sp-20: 80px;

  /* Radius */
  --r-sm: 6px;  --r-md: 8px;   --r-lg: 12px;
  --r-xl: 16px; --r-2xl: 20px; --r-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.08), 0 4px 8px rgba(0,0,0,0.04);
  --shadow-xl: 0 24px 48px rgba(0,0,0,0.10), 0 8px 16px rgba(0,0,0,0.06);
  --shadow-brand: 0 4px 16px rgba(79,70,229,0.20);

  /* Transitions */
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-out: cubic-bezier(0.0, 0.0, 0.2, 1);
  --t-fast: 120ms var(--ease);
  --t-base: 200ms var(--ease);
  --t-slow: 320ms var(--ease-out);
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  color: var(--n-900);
  background: var(--n-50);
}

/* ── Typography ────────────────────────────────────────────────── */
.font-display { font-family: var(--font-display); }
.text-xs  { font-size: 12px; line-height: 1.5; }
.text-sm  { font-size: 13px; line-height: 1.6; }
.text-base{ font-size: 14px; line-height: 1.6; }
.text-md  { font-size: 16px; line-height: 1.5; }
.text-lg  { font-size: 18px; line-height: 1.4; }
.text-xl  { font-size: 20px; line-height: 1.3; }
.text-2xl { font-size: 24px; line-height: 1.3; }
.text-3xl { font-size: 30px; line-height: 1.25; }
.text-4xl { font-size: 36px; line-height: 1.2; }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold   { font-weight: 700; }

.text-primary   { color: var(--n-900); }
.text-secondary { color: var(--n-500); }
.text-muted     { color: var(--n-400); }
.text-brand     { color: var(--brand-600); }

/* ── Layout: App Shell ─────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

/* ── Sidebar ────────────────────────────────────────────────────── */
.sidebar {
  width: 232px;
  min-width: 232px;
  background: var(--brand-950);
  display: flex;
  flex-direction: column;
  padding: var(--sp-6) var(--sp-4);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-2) var(--sp-6);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  margin-bottom: var(--sp-4);
}
.sidebar-brand-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}
.sidebar-brand-tag {
  font-size: 10px;
  font-weight: 500;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 1px;
}
.sidebar-logo {
  width: 34px; height: 34px;
  border-radius: var(--r-lg);
  background: rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-display);
  font-size: 14px; font-weight: 700; color: #fff;
}

.sidebar-section {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.25);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: var(--sp-3) var(--sp-3) var(--sp-2);
  margin-top: var(--sp-3);
}

.nav-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  color: rgba(255,255,255,0.58);
  font-size: 13.5px; font-weight: 500;
  text-decoration: none;
  transition: all var(--t-fast);
  cursor: pointer;
  border: none; background: none;
  width: 100%; text-align: left;
  line-height: 1.4;
}
.nav-item:hover  { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.9); }
.nav-item.active { background: rgba(255,255,255,0.11); color: #fff; }
.nav-item .nav-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.8; }
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--brand-600);
  color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--r-full);
  min-width: 18px;
  text-align: center;
}
.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
  margin-top: auto;
  padding-top: var(--sp-4);
  border-top: 1px solid rgba(255,255,255,0.07);
}
.sidebar-user {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
}
.sidebar-avatar {
  width: 30px; height: 30px;
  border-radius: var(--r-full);
  background: rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 12.5px; color: rgba(255,255,255,0.8); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: rgba(255,255,255,0.35); text-transform: capitalize; }

.token-pill {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: 5px 10px;
  border-radius: var(--r-full);
  background: rgba(99,102,241,0.18);
  color: var(--brand-300);
  font-size: 12px; font-weight: 600;
  white-space: nowrap;
}
.token-pill svg { width: 12px; height: 12px; }

/* ── Main Content ───────────────────────────────────────────────── */
.main-content { margin-left: 232px; flex: 1; min-height: 100vh; }

/* ── Page Header ────────────────────────────────────────────────── */
.page-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(249,250,251,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--n-200);
  padding: var(--sp-4) var(--sp-8);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4);
  min-height: 64px;
}
.page-header-title {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 600; color: var(--brand-950);
  letter-spacing: -0.02em;
}
.page-header-sub { font-size: 13px; color: var(--n-400); margin-top: 1px; }
.page-header-actions { display: flex; align-items: center; gap: var(--sp-3); }

/* Breadcrumbs */
.breadcrumbs { display: flex; align-items: center; gap: var(--sp-2); font-size: 13px; margin-bottom: var(--sp-1); }
.breadcrumbs a { color: var(--n-400); text-decoration: none; }
.breadcrumbs a:hover { color: var(--brand-600); }
.breadcrumbs span { color: var(--n-300); }

/* ── Page Body ──────────────────────────────────────────────────── */
.page-body { padding: var(--sp-8); max-width: 1200px; }
.page-body-wide { padding: var(--sp-8); }

/* ── Card ───────────────────────────────────────────────────────── */
.card {
  background: var(--n-0);
  border: 1px solid var(--n-200);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  transition: box-shadow var(--t-base);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-flat  { background: var(--n-0); border: 1px solid var(--n-200); border-radius: var(--r-xl); padding: var(--sp-6); }

.card-sm    { padding: var(--sp-4); border-radius: var(--r-lg); }
.card-lg    { padding: var(--sp-8); border-radius: var(--r-2xl); }

/* ── Stat Card ──────────────────────────────────────────────────── */
.stat-card {
  background: var(--n-0);
  border: 1px solid var(--n-200);
  border-radius: var(--r-xl);
  padding: var(--sp-5) var(--sp-6);
}
.stat-card .stat-label { font-size: 12px; font-weight: 500; color: var(--n-400); letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: var(--sp-2); }
.stat-card .stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--n-900); letter-spacing: -0.03em; line-height: 1; }
.stat-card .stat-delta { font-size: 12px; color: var(--n-400); margin-top: var(--sp-1); }
.stat-card .stat-icon  { width: 36px; height: 36px; border-radius: var(--r-lg); background: var(--brand-50); display: flex; align-items: center; justify-content: center; color: var(--brand-600); }
.stat-card.stat-alert  { border-color: var(--red-100); background: var(--red-50); }
.stat-card.stat-alert .stat-value { color: var(--red-600); }
.stat-card.stat-alert .stat-icon  { background: var(--red-100); color: var(--red-600); }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn-primary, .btn-secondary, .btn-ghost, .btn-danger {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-body); font-weight: 500; font-size: 13.5px;
  padding: 9px 18px;
  border-radius: var(--r-md);
  border: none; cursor: pointer;
  text-decoration: none;
  transition: all var(--t-fast);
  white-space: nowrap;
  line-height: 1;
  letter-spacing: -0.01em;
}
.btn-primary  { background: var(--brand-600); color: #fff; }
.btn-primary:hover   { background: var(--brand-700); box-shadow: var(--shadow-brand); }
.btn-primary:active  { background: var(--brand-800); transform: translateY(0.5px); }
.btn-secondary { background: var(--n-0); color: var(--n-700); border: 1px solid var(--n-300); }
.btn-secondary:hover { background: var(--n-50); border-color: var(--n-400); }
.btn-ghost    { background: transparent; color: var(--n-500); }
.btn-ghost:hover { background: var(--n-100); color: var(--n-700); }
.btn-danger   { background: var(--red-600); color: #fff; }
.btn-danger:hover { background: var(--red-700); }

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-ghost:disabled,
.btn-danger:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-lg { padding: 13px 28px; font-size: 15px; border-radius: var(--r-lg); }
.btn-xl { padding: 16px 36px; font-size: 16px; border-radius: var(--r-lg); }
.btn-icon { padding: 8px; width: 34px; height: 34px; justify-content: center; }
.btn-icon-sm { padding: 6px; width: 28px; height: 28px; justify-content: center; }
.btn-loading { pointer-events: none; opacity: 0.75; }

/* ── Forms ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: var(--sp-5); }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--n-700); margin-bottom: var(--sp-2); }
.form-label .required { color: var(--red-600); margin-left: 2px; }
.form-hint  { font-size: 12px; color: var(--n-400); margin-top: var(--sp-1); }
.form-error { font-size: 12px; color: var(--red-600); margin-top: var(--sp-1); }

.input, .textarea, .select {
  width: 100%;
  border: 1px solid var(--n-300);
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--n-900);
  background: var(--n-0);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--n-400); }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.input.error, .textarea.error, .select.error { border-color: var(--red-500); }
.input.error:focus, .textarea.error:focus { box-shadow: 0 0 0 3px rgba(220,38,38,0.12); }

.textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 24 24'%3E%3Cpath stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; cursor: pointer; }

.char-count { font-size: 11px; color: var(--n-400); text-align: right; margin-top: 4px; }
.char-count.warn { color: var(--amber-600); }
.char-count.over { color: var(--red-600); }

/* ── Toggle ─────────────────────────────────────────────────────── */
.toggle {
  position: relative; width: 44px; height: 24px;
  border-radius: var(--r-full);
  background: var(--n-300);
  cursor: pointer;
  transition: background var(--t-base);
  flex-shrink: 0;
}
.toggle.on { background: var(--brand-600); }
.toggle.danger.on { background: var(--red-600); }
.toggle-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: #fff; border-radius: var(--r-full);
  transition: transform var(--t-base);
  box-shadow: var(--shadow-sm);
}
.toggle.on .toggle-thumb { transform: translateX(20px); }

/* ── File Upload ────────────────────────────────────────────────── */
.file-drop-zone {
  border: 2px dashed var(--n-300);
  border-radius: var(--r-lg);
  padding: var(--sp-8) var(--sp-5);
  text-align: center;
  cursor: pointer;
  transition: all var(--t-base);
  background: var(--n-50);
}
.file-drop-zone:hover, .file-drop-zone.drag-over {
  border-color: var(--brand-400);
  background: var(--brand-50);
}
.file-list { margin-top: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2); }
.file-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--n-50); border: 1px solid var(--n-200);
  border-radius: var(--r-md);
  font-size: 13px;
}
.file-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--n-700); }
.file-item-size { color: var(--n-400); font-size: 12px; white-space: nowrap; }
.file-item-remove { color: var(--n-400); cursor: pointer; flex-shrink: 0; }
.file-item-remove:hover { color: var(--red-600); }

/* ── Badges ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 600;
  white-space: nowrap; letter-spacing: 0.01em;
}
.badge-dot { width: 6px; height: 6px; border-radius: var(--r-full); flex-shrink: 0; }

/* Status badges */
.badge-queued    { background: var(--brand-50);  color: var(--brand-700); }
.badge-queued .badge-dot { background: var(--brand-400); }
.badge-assigned  { background: var(--blue-50);   color: var(--blue-700); }
.badge-assigned .badge-dot { background: var(--blue-600); }
.badge-in_review { background: var(--amber-50);  color: var(--amber-700); }
.badge-in_review .badge-dot { background: var(--amber-600); }
.badge-delivered { background: var(--green-50);  color: var(--green-700); }
.badge-delivered .badge-dot { background: var(--green-600); }
.badge-closed    { background: var(--n-100);     color: var(--n-500); }
.badge-closed .badge-dot { background: var(--n-400); }

/* Service level badges */
.badge-verify  { background: var(--brand-50);   color: var(--brand-700); border: 1px solid var(--brand-200); }
.badge-clarify { background: #EDE9FE;            color: #5B21B6;          border: 1px solid #DDD6FE; }
.badge-author  { background: #FCE7F3;            color: #9D174D;          border: 1px solid #FBCFE8; }

/* Generic */
.badge-green  { background: var(--green-50);  color: var(--green-700); }
.badge-amber  { background: var(--amber-50);  color: var(--amber-700); }
.badge-red    { background: var(--red-50);    color: var(--red-700); }
.badge-blue   { background: var(--blue-50);   color: var(--blue-700); }
.badge-gray   { background: var(--n-100);     color: var(--n-600); }
.badge-brand  { background: var(--brand-50);  color: var(--brand-700); }

/* ── SLA Badge ──────────────────────────────────────────────────── */
.sla-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--r-full);
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.sla-green  { background: var(--green-50); color: var(--green-700); }
.sla-amber  { background: var(--amber-50); color: var(--amber-700); }
.sla-red    { background: var(--red-50);   color: var(--red-700);   }
.sla-pulse  { animation: sla-pulse 2s ease-in-out infinite; }
@keyframes sla-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

/* ── Data Table ─────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
  text-align: left; font-size: 11.5px; font-weight: 600;
  color: var(--n-400); text-transform: uppercase; letter-spacing: 0.06em;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--n-200);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.data-table thead th:hover { color: var(--n-600); }
.data-table tbody tr {
  border-bottom: 1px solid var(--n-100);
  transition: background var(--t-fast);
}
.data-table tbody tr:hover { background: var(--n-50); }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody td { padding: var(--sp-3) var(--sp-4); font-size: 13.5px; color: var(--n-700); vertical-align: middle; }
.data-table .col-title { font-weight: 500; color: var(--n-900); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table .col-actions { text-align: right; white-space: nowrap; }

/* ── Skeleton / Loading ─────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--n-100) 25%, var(--n-50) 50%, var(--n-100) 75%);
  background-size: 400% 100%;
  border-radius: var(--r-md);
  animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.skeleton-text { height: 14px; }
.skeleton-text-sm { height: 12px; }
.skeleton-title { height: 20px; }
.skeleton-btn  { height: 38px; border-radius: var(--r-md); }

/* ── Empty State ────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--sp-20) var(--sp-8);
}
.empty-state-icon {
  width: 56px; height: 56px;
  border-radius: var(--r-2xl);
  background: var(--n-100);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto var(--sp-5);
  color: var(--n-400);
}
.empty-state-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; color: var(--n-700); margin-bottom: var(--sp-2); }
.empty-state-sub   { font-size: 13.5px; color: var(--n-400); max-width: 340px; margin: 0 auto var(--sp-6); line-height: 1.6; }

/* ── Timeline ───────────────────────────────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-step { display: flex; gap: var(--sp-4); position: relative; padding-bottom: var(--sp-5); }
.timeline-step:last-child { padding-bottom: 0; }
.timeline-step::before {
  content: ''; position: absolute;
  left: 15px; top: 28px; bottom: 0;
  width: 1px; background: var(--n-200);
}
.timeline-step:last-child::before { display: none; }
.timeline-dot {
  width: 32px; height: 32px; border-radius: var(--r-full);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-size: 13px; z-index: 1;
}
.timeline-dot-default  { background: var(--n-100);    color: var(--n-400); border: 2px solid var(--n-200); }
.timeline-dot-active   { background: var(--brand-600); color: #fff; }
.timeline-dot-complete { background: var(--green-50);  color: var(--green-600); border: 2px solid var(--green-100); }
.timeline-dot-pending  { background: var(--n-50);      color: var(--n-300);  border: 2px dashed var(--n-200); }
.timeline-content { flex: 1; padding-top: 5px; }
.timeline-title { font-size: 13.5px; font-weight: 500; color: var(--n-800); }
.timeline-meta  { font-size: 12px; color: var(--n-400); margin-top: 2px; }

/* ── Answer Card ────────────────────────────────────────────────── */
.answer-card {
  background: var(--n-0);
  border: 1px solid var(--n-200);
  border-radius: var(--r-2xl);
  overflow: hidden;
}
.answer-card-header {
  background: linear-gradient(135deg, var(--brand-950) 0%, #2D2A6E 100%);
  padding: var(--sp-5) var(--sp-6);
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4);
}
.answer-card-expert { display: flex; align-items: center; gap: var(--sp-3); }
.answer-card-avatar {
  width: 40px; height: 40px; border-radius: var(--r-full);
  background: rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600; color: #fff;
  flex-shrink: 0;
}
.answer-card-expert-name { font-size: 14px; font-weight: 600; color: #fff; }
.answer-card-expert-hl   { font-size: 12px; color: rgba(255,255,255,0.55); margin-top: 2px; }
.answer-card-meta { text-align: right; }
.answer-card-time { font-size: 12px; color: rgba(255,255,255,0.4); }

.answer-section { padding: var(--sp-5) var(--sp-6); border-bottom: 1px solid var(--n-100); }
.answer-section:last-child { border-bottom: none; }
.answer-section-title { font-size: 11px; font-weight: 600; color: var(--n-400); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: var(--sp-3); }

.verdict-pill {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 8px 16px; border-radius: var(--r-full);
  font-size: 13.5px; font-weight: 600; margin-bottom: var(--sp-3);
}
.verdict-confirmed      { background: var(--green-50); color: var(--green-700); border: 1px solid var(--green-100); }
.verdict-partially_correct { background: var(--amber-50); color: var(--amber-700); border: 1px solid var(--amber-100); }
.verdict-incorrect      { background: var(--red-50);   color: var(--red-700);   border: 1px solid var(--red-100); }
.verdict-insufficient_info { background: var(--n-100); color: var(--n-600);     border: 1px solid var(--n-200); }

.confidence-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: var(--r-full);
  font-size: 12px; font-weight: 600;
}
.confidence-high   { background: var(--green-50);  color: var(--green-700); }
.confidence-medium { background: var(--amber-50);  color: var(--amber-700); }
.confidence-low    { background: var(--red-50);    color: var(--red-700); }

.source-item {
  display: flex; align-items: baseline; gap: var(--sp-3);
  padding: var(--sp-2) 0;
  font-size: 13.5px; border-bottom: 1px solid var(--n-50);
}
.source-item:last-child { border-bottom: none; }
.source-num { color: var(--n-400); font-size: 12px; min-width: 20px; }
.source-link { color: var(--brand-600); text-decoration: none; }
.source-link:hover { text-decoration: underline; }

.bullet-list { list-style: none; display: flex; flex-direction: column; gap: var(--sp-2); }
.bullet-item { display: flex; align-items: flex-start; gap: var(--sp-3); font-size: 13.5px; color: var(--n-700); line-height: 1.55; }
.bullet-item::before { content: '→'; color: var(--brand-400); font-size: 12px; margin-top: 2px; flex-shrink: 0; }

/* ── Service Level Cards ────────────────────────────────────────── */
.service-card {
  padding: var(--sp-5);
  border: 2px solid var(--n-200);
  border-radius: var(--r-xl);
  cursor: pointer;
  transition: all var(--t-base);
  position: relative;
}
.service-card:hover   { border-color: var(--brand-300); background: var(--brand-50); }
.service-card.selected { border-color: var(--brand-600); background: var(--brand-50); }
.service-card .service-name  { font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--n-900); }
.service-card .service-cost  { font-size: 13px; color: var(--brand-600); font-weight: 600; margin-top: 4px; }
.service-card .service-sla   { font-size: 12px; color: var(--n-400); }
.service-card .service-desc  { font-size: 13px; color: var(--n-500); margin-top: var(--sp-3); line-height: 1.55; }
.service-card .service-check {
  position: absolute; top: var(--sp-4); right: var(--sp-4);
  width: 20px; height: 20px; border-radius: var(--r-full);
  background: var(--brand-600); color: #fff;
  display: none; align-items: center; justify-content: center;
}
.service-card.selected .service-check { display: flex; }

/* ── Modal ──────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(17,24,39,0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-4);
  animation: fade-in 200ms var(--ease);
}
.modal {
  background: var(--n-0);
  border-radius: var(--r-2xl);
  padding: var(--sp-8);
  max-width: 520px; width: 100%;
  box-shadow: var(--shadow-xl);
  animation: scale-up 200ms var(--ease);
  max-height: 90vh; overflow-y: auto;
}
.modal-lg { max-width: 700px; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-6); }
.modal-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--n-900); letter-spacing: -0.02em; }
.modal-close { color: var(--n-400); cursor: pointer; flex-shrink: 0; background: none; border: none; padding: 4px; border-radius: var(--r-sm); }
.modal-close:hover { background: var(--n-100); color: var(--n-700); }
.modal-body  { margin-bottom: var(--sp-6); }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-3); }

@keyframes fade-in   { from { opacity: 0; } }
@keyframes scale-up  { from { opacity: 0; transform: scale(0.96) translateY(8px); } }

/* ── Toast ──────────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: var(--sp-6); right: var(--sp-6); z-index: 9999; display: flex; flex-direction: column; gap: var(--sp-2); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 13px 18px;
  border-radius: var(--r-lg);
  background: var(--n-900); color: #fff;
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-xl);
  pointer-events: auto;
  min-width: 260px; max-width: 380px;
  opacity: 0; transform: translateY(8px) scale(0.98);
  transition: opacity 200ms var(--ease), transform 200ms var(--ease);
}
.toast.show { opacity: 1; transform: none; }
.toast.success { background: var(--n-900); }
.toast.error   { background: var(--red-600); }
.toast.info    { background: var(--blue-600); }
.toast.warning { background: var(--amber-600); }
.toast-icon { width: 16px; height: 16px; flex-shrink: 0; }
.toast-msg  { flex: 1; }

/* ── Tabs ───────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--n-200); }
.tab {
  padding: var(--sp-3) var(--sp-5);
  font-size: 13.5px; font-weight: 500; color: var(--n-500);
  cursor: pointer; border: none; background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--t-fast);
  white-space: nowrap;
  display: flex; align-items: center; gap: var(--sp-2);
}
.tab:hover  { color: var(--n-700); }
.tab.active { color: var(--brand-600); border-bottom-color: var(--brand-600); }
.tab .tab-count {
  background: var(--n-100); color: var(--n-500);
  font-size: 11px; font-weight: 700;
  padding: 2px 6px; border-radius: var(--r-full);
}
.tab.active .tab-count { background: var(--brand-100); color: var(--brand-700); }

/* ── Search & Filter bar ────────────────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.search-input-wrap { position: relative; }
.search-input-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--n-400); width: 15px; height: 15px; }
.search-input-wrap .input { padding-left: 36px; }

/* ── Onboarding / Welcome Modal ─────────────────────────────────── */
.onboarding-step { text-align: center; padding: var(--sp-4) 0; }
.onboarding-number {
  width: 48px; height: 48px;
  border-radius: var(--r-full);
  background: var(--brand-50);
  color: var(--brand-600);
  font-family: var(--font-display);
  font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto var(--sp-4);
}

/* ── Token balance widget ───────────────────────────────────────── */
.token-widget {
  background: linear-gradient(135deg, var(--brand-950), #2D2A6E);
  border-radius: var(--r-xl);
  padding: var(--sp-5) var(--sp-6);
  color: #fff;
}
.token-widget-label { font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.45); letter-spacing: 0.07em; text-transform: uppercase; }
.token-widget-value { font-family: var(--font-display); font-size: 36px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; margin: var(--sp-2) 0; }
.token-widget-sub { font-size: 12px; color: rgba(255,255,255,0.5); }

/* ── Notification dot ───────────────────────────────────────────── */
.notif-dot {
  width: 8px; height: 8px;
  border-radius: var(--r-full);
  background: var(--red-600);
  display: inline-block;
}

/* ── Divider ────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--n-100); margin: var(--sp-6) 0; }
.divider-label { display: flex; align-items: center; gap: var(--sp-3); color: var(--n-400); font-size: 12px; margin: var(--sp-5) 0; }
.divider-label::before, .divider-label::after { content: ''; flex: 1; height: 1px; background: var(--n-200); }

/* ── Rating stars ───────────────────────────────────────────────── */
.star-rating { display: flex; gap: 2px; }
.star-rating .star { width: 20px; height: 20px; cursor: pointer; color: var(--n-300); transition: color var(--t-fast); }
.star-rating .star.filled, .star-rating .star:hover ~ .star { color: var(--amber-400); }
.star-rating:hover .star { color: var(--amber-400); }
.star-rating .star:hover ~ .star { color: var(--n-300); }

/* ── Dynamic source list (answer composer) ──────────────────────── */
.dynamic-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.dynamic-list-item { display: flex; align-items: center; gap: var(--sp-2); }
.dynamic-list-item .input { flex: 1; }
.dynamic-list-item .remove-btn { flex-shrink: 0; }
.add-row-btn {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 13px; color: var(--brand-600);
  background: none; border: none; cursor: pointer;
  padding: var(--sp-2) 0;
}
.add-row-btn:hover { color: var(--brand-700); }

/* ── Spinner ────────────────────────────────────────────────────── */
.spinner { display: inline-block; width: 18px; height: 18px; border-radius: var(--r-full); border: 2px solid var(--n-200); border-top-color: var(--brand-600); animation: spin 0.7s linear infinite; }
.spinner-sm { width: 14px; height: 14px; }
.spinner-white { border-color: rgba(255,255,255,0.3); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Cookie banner ──────────────────────────────────────────────── */
.cookie-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 8888;
  background: var(--brand-950); border-top: 1px solid rgba(255,255,255,0.08);
  padding: var(--sp-4) var(--sp-8);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap;
  transform: translateY(100%); transition: transform var(--t-slow);
}
.cookie-banner.show { transform: translateY(0); }
.cookie-banner-text { color: rgba(255,255,255,0.6); font-size: 13px; flex: 1; min-width: 200px; }
.cookie-banner-text strong { color: #fff; }
.cookie-banner-actions { display: flex; gap: var(--sp-2); flex-shrink: 0; }

/* ── Site Footer ────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--n-100); padding: var(--sp-8) 0; background: #fff; }
.site-footer-inner { max-width: 1100px; margin: 0 auto; padding: 0 var(--sp-8); display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-6); }
.site-footer-brand { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--brand-950); letter-spacing: -0.02em; }
.site-footer-links { display: flex; gap: var(--sp-6); flex-wrap: wrap; }
.site-footer-links a { font-size: 13px; color: var(--n-400); text-decoration: none; transition: color var(--t-fast); }
.site-footer-links a:hover { color: var(--brand-600); }
.site-footer-copy { font-size: 12px; color: var(--n-300); text-align: center; padding-top: var(--sp-5); border-top: 1px solid var(--n-100); margin-top: var(--sp-5); }

/* ── Prose (legal) ──────────────────────────────────────────────── */
.prose h2 { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--n-900); margin: var(--sp-10) 0 var(--sp-3); }
.prose h3 { font-size: 15px; font-weight: 600; color: var(--n-700); margin: var(--sp-6) 0 var(--sp-2); }
.prose p  { font-size: 14px; line-height: 1.8; color: var(--n-500); margin: 0 0 var(--sp-4); }
.prose ul { padding-left: var(--sp-5); margin: 0 0 var(--sp-4); }
.prose li { font-size: 14px; line-height: 1.8; color: var(--n-500); margin-bottom: var(--sp-1); }
.prose a  { color: var(--brand-600); }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform var(--t-base); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-body { padding: var(--sp-5); }
  .page-header { padding: var(--sp-4) var(--sp-5); }
  .modal { padding: var(--sp-5); border-radius: var(--r-xl); }
  .tabs { overflow-x: auto; }
}

/* ── Token UI ────────────────────────────────────────────────────── */
.token-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md);
  background: var(--brand-50); border: 1px solid var(--brand-100);
  margin-bottom: var(--sp-5); font-size: 13px; font-weight: 500;
  transition: background var(--t-base), border-color var(--t-base);
}
.token-bar.warn {
  background: var(--red-50); border-color: var(--red-100);
}
.token-chip {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: 12px; font-weight: 600; color: var(--brand-700);
  background: var(--brand-50); border: 1px solid var(--brand-100);
  padding: 4px 10px; border-radius: var(--r-full);
}

/* ── Service Level labels ────────────────────────────────────────── */
.sl-verify  { color: var(--brand-700); }
.sl-clarify { color: #5B21B6; }
.sl-author  { color: #9D174D; }

/* ── Badge default fallback ─────────────────────────────────────── */
.badge-default { background: var(--n-100); color: var(--n-600); }
