/**
 * Dashboard Shared Styles
 * Unified design system for all diverse document dashboards
 * Matches the Literature Dashboard aesthetic with document-type personality
 */

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
  /* Brand Colors — canonical, match tailwind.config.js */
  --brand-gold: #FFD700;           /* bright Doksa gold */
  --brand-dark-gold: #B8860B;      /* deep Doksa gold */
  --brand-gold-deep: #8B6914;      /* used for hover / pressed states */

  /* Brand Navy + extended ink/paper tokens */
  --brand-navy: #152257;           /* canonical brand navy (tailwind) */
  --brand-navy-light: #2D4A7C;     /* navy-light for gradients */
  --brand-navy-deep: #0E1A45;      /* deepest navy, body backdrop */
  --brand-purple: #682076;         /* canonical brand purple (tailwind) */
  --brand-fuchsia: #B0247F;
  --brand-pink: #E4227B;

  /* Surface / ink tokens for the editorial system */
  --paper: #FFFFFF;                /* stark light surface */
  --paper-soft: #F7F4EC;           /* warm ivory card, gold-adjacent */
  --ink: #111827;                  /* body copy on light */
  --ink-soft: #4B5563;             /* secondary copy on light */
  --hairline-gold: rgba(184,134,11,0.20);  /* gold-tinted divider */

  /* Legacy primary palette (kept for non-dashboard callers) */
  --primary-indigo: #4f46e5;
  --primary-indigo-dark: #4338ca;
  --primary-indigo-light: #6366f1;

  /* Document Type Accents — aligned with the Doksa brand palette.
     Each type is a muted, desaturated hue that sits alongside gold
     without competing with it. */
  --resume-primary: #D4A017;       /* mid-gold, between bright and deep */
  --resume-dark: #B8860B;          /* brand-dark-gold */
  --resume-light: #FFD700;         /* brand-gold */

  --business-primary: #2A9D8F;     /* muted teal */
  --business-dark: #1F6F5C;        /* forest teal, gold-adjacent */
  --business-light: #5FB3A3;

  --news-primary: #3D5A8C;         /* navy-light +1 step */
  --news-dark: #2D4A7C;            /* brand-navy-light */
  --news-light: #5D7BAE;

  --legal-primary: #8A3698;        /* lightened purple */
  --legal-dark: #682076;           /* brand-purple (tailwind) */
  --legal-light: #A04DB0;

  /* Accent semantic aliases (what components should reference going forward) */
  --accent-resume: var(--resume-dark);
  --accent-business: var(--business-dark);
  --accent-news: var(--news-dark);
  --accent-legal: var(--legal-dark);

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-navy-light) 100%);
  --gradient-gold: linear-gradient(135deg, var(--brand-gold) 0%, var(--brand-dark-gold) 100%);
  --gradient-resume: linear-gradient(135deg, var(--resume-primary) 0%, var(--resume-dark) 100%);
  --gradient-business: linear-gradient(135deg, var(--business-primary) 0%, var(--business-dark) 100%);
  --gradient-news: linear-gradient(135deg, var(--news-primary) 0%, var(--news-dark) 100%);
  --gradient-legal: linear-gradient(135deg, var(--legal-primary) 0%, var(--legal-dark) 100%);

  /* Neutral Colors */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 9999px;
}

/* ============================================
   Keyframe Animations
   ============================================ */

/* Fade In */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

/* Slide In from Right (for toasts) */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide Out to Right (for toasts) */
@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* Scale In */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Pulse */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Shimmer (for loading states) */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* ============================================
   Animation Utility Classes
   ============================================ */
.animate-fade-in {
  animation: fadeIn var(--transition-base) ease-out forwards;
}

.animate-slide-up {
  animation: slideUp var(--transition-slow) ease-out forwards;
}

.animate-scale-in {
  animation: scaleIn var(--transition-base) ease-out forwards;
}

/* Staggered animation delays */
.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }

/* Initially hidden for animations */
.animate-on-load {
  opacity: 0;
}

/* ============================================
   Doksa Hero Banner
   One canonical pattern for "top candidate / top answer / top policy"
   surfaces. Ivory card + gold-tinted hairline + type-colored left border
   + gold label. Reads as "Doksa says:" across every dashboard.
   ============================================ */
.doksa-hero {
  background: var(--paper-soft);
  border: 1px solid var(--hairline-gold);
  border-left: 4px solid var(--accent-resume);
  border-radius: var(--radius-xl);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(21, 34, 87, 0.08);
}

.dark .doksa-hero {
  background: #1a2740;
  border-color: rgba(184, 134, 11, 0.35);
}

.doksa-hero__row {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
}

.doksa-hero__plate {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: var(--gradient-resume);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.doksa-hero__plate i {
  font-size: 1.125rem;
}

.doksa-hero__body {
  flex: 1;
  min-width: 0;
}

.doksa-hero__tag {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-dark-gold);
  margin: 0 0 0.15rem 0;
}

.dark .doksa-hero__tag {
  color: var(--brand-gold);
}

/* Subject line — the named entity the synthesis is *about*
   (candidate name, report title, policy document). Sits between the
   tag and the copy so readers know who/what "this candidate / report"
   refers to before they read the synthesis. */
.doksa-hero__subject {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.4rem 0;
  line-height: 1.3;
}

.doksa-hero__subject-context {
  font-weight: 400;
  color: var(--ink-soft);
  font-style: italic;
}

.dark .doksa-hero__subject {
  color: #f3f4f6;
}

.dark .doksa-hero__subject-context {
  color: #9ca3af;
}

.doksa-hero__copy {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  margin: 0;
}

.dark .doksa-hero__copy {
  color: #f3f4f6;
}

.doksa-hero__attribution {
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin: 0.5rem 0 0 0;
  font-style: italic;
}

.dark .doksa-hero__attribution {
  color: #9ca3af;
}

.doksa-hero--resume   { border-left-color: var(--accent-resume); }
.doksa-hero--resume   .doksa-hero__plate { background: var(--gradient-resume); }
.doksa-hero--business { border-left-color: var(--accent-business); }
.doksa-hero--business .doksa-hero__plate { background: var(--gradient-business); }
.doksa-hero--news     { border-left-color: var(--accent-news); }
.doksa-hero--news     .doksa-hero__plate { background: var(--gradient-news); }
.doksa-hero--legal    { border-left-color: var(--accent-legal); }
.doksa-hero--legal    .doksa-hero__plate { background: var(--gradient-legal); }

/* Muted variant — used when the best match score falls below
   WEAK_MATCH_THRESHOLD (0.35). Signals "no strong match found" with
   neutral gray accent + cooler tag color, so we don't dress up a
   least-irrelevant result as "top". */
.doksa-hero--muted {
  border-left-color: #9CA3AF;
  background: #FBFAF6;
}
.doksa-hero--muted .doksa-hero__plate {
  background: linear-gradient(135deg, #9CA3AF 0%, #6B7280 100%);
}
.doksa-hero--muted .doksa-hero__tag {
  color: #6B7280;
}
.dark .doksa-hero--muted {
  background: #1c2a3f;
  border-left-color: #6B7280;
}
.dark .doksa-hero--muted .doksa-hero__tag {
  color: #9CA3AF;
}

/* Score pill — small badge at the foot of the hero reporting the
   actual match percentage and which doc it came from. Shown in the
   muted variant so the reader sees the weak number without digging. */
.doksa-hero__score {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(156, 163, 175, 0.15);
  color: var(--ink-soft);
  border: 1px solid rgba(156, 163, 175, 0.35);
  border-radius: var(--radius-full);
}
.doksa-hero__score strong {
  font-weight: 700;
  color: var(--ink);
}
.doksa-hero__score-source {
  font-weight: 400;
  font-style: italic;
  color: var(--ink-soft);
}
.dark .doksa-hero__score {
  background: rgba(255, 255, 255, 0.06);
  color: #D1D5DB;
  border-color: rgba(255, 255, 255, 0.12);
}
.dark .doksa-hero__score strong {
  color: #f3f4f6;
}
.dark .doksa-hero__score-source {
  color: #9CA3AF;
}

/* --- Pending hero (synthesis still generating) --- */
.doksa-hero--pending .doksa-hero__plate {
  background: linear-gradient(135deg, #E5E7EB 0%, #CBD5E1 100%);
  color: #475569;
}
.dark .doksa-hero--pending .doksa-hero__plate {
  background: linear-gradient(135deg, #334155 0%, #1E293B 100%);
  color: #CBD5E1;
}
.doksa-hero__pending-dots {
  display: inline-flex;
  gap: 0.28rem;
  align-items: center;
  margin-right: 0.2rem;
}
.doksa-hero__pending-dots span {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
  animation: doksa-hero-dot-pulse 1.4s ease-in-out infinite;
}
.doksa-hero__pending-dots span:nth-child(2) { animation-delay: 0.2s; }
.doksa-hero__pending-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes doksa-hero-dot-pulse {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1); }
}

/* --- Confidence pill (synthesis mode) --- */
.doksa-hero__confidence {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.15rem 0.55rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: var(--radius-full);
  vertical-align: middle;
  background: rgba(156, 163, 175, 0.18);
  color: var(--ink-soft);
  border: 1px solid rgba(156, 163, 175, 0.35);
}
.doksa-hero__confidence--high {
  background: rgba(16, 185, 129, 0.14);
  color: #065F46;
  border-color: rgba(16, 185, 129, 0.35);
}
.doksa-hero__confidence--moderate {
  background: rgba(245, 158, 11, 0.14);
  color: #92400E;
  border-color: rgba(245, 158, 11, 0.35);
}
.doksa-hero__confidence--low {
  background: rgba(239, 68, 68, 0.12);
  color: #991B1B;
  border-color: rgba(239, 68, 68, 0.3);
}
.dark .doksa-hero__confidence--high {
  background: rgba(16, 185, 129, 0.22);
  color: #6EE7B7;
  border-color: rgba(16, 185, 129, 0.45);
}
.dark .doksa-hero__confidence--moderate {
  background: rgba(245, 158, 11, 0.22);
  color: #FCD34D;
  border-color: rgba(245, 158, 11, 0.45);
}
.dark .doksa-hero__confidence--low {
  background: rgba(239, 68, 68, 0.22);
  color: #FCA5A5;
  border-color: rgba(239, 68, 68, 0.45);
}

/* --- The literature answer (15 Nov 2026, slop check L2-L4): a heading,
   the answer and plain sentences; no stripe, pills or icon. --- */
.doksa-hero--answer { border-left: 1px solid var(--hairline-gold); }
.doksa-hero__heading {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  margin: 0 0 0.5rem 0;
}
.doksa-hero__subheading {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  margin: 1rem 0 0.35rem 0;
}
.doksa-hero__text {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink);
  margin: 0;
}
.doksa-hero__note {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0.85rem 0 0 0;
}
.doksa-hero--answer .doksa-hero__supporting-note { display: block; }
.dark :is(.doksa-hero__heading, .doksa-hero__subheading, .doksa-hero__text) { color: #f3f4f6; }
.dark .doksa-hero__note { color: #D1D5DB; }

/* --- Competing views strip --- */
.doksa-hero__competing {
  margin-top: 0.75rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.85rem;
  color: var(--ink);
  background: rgba(251, 191, 36, 0.08);
  border-left: 3px solid rgba(251, 191, 36, 0.55);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.doksa-hero__competing i {
  margin-right: 0.35rem;
  color: rgba(180, 83, 9, 0.85);
}
.dark .doksa-hero__competing {
  background: rgba(251, 191, 36, 0.08);
  color: #F3F4F6;
}
.dark .doksa-hero__competing i {
  color: rgba(252, 211, 77, 0.9);
}

/* --- Supporting papers list --- */
.doksa-hero__supporting {
  margin-top: 0.9rem;
}
.doksa-hero__supporting-label {
  margin: 0 0 0.35rem 0;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}
.doksa-hero__supporting-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.35rem;
}
.doksa-hero__supporting-list li {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--ink);
  padding-left: 1rem;
  position: relative;
}
.doksa-hero__supporting-list li::before {
  content: "›";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--ink-soft);
  font-weight: 600;
}
.doksa-hero__supporting-title {
  font-weight: 600;
}
.doksa-hero__supporting-note {
  color: var(--ink-soft);
  font-weight: 400;
}
.dark .doksa-hero__supporting-label {
  color: #9CA3AF;
}
.dark .doksa-hero__supporting-list li {
  color: #E5E7EB;
}
.dark .doksa-hero__supporting-list li::before {
  color: #9CA3AF;
}
.dark .doksa-hero__supporting-note {
  color: #9CA3AF;
}

/* ============================================
   Doksa Chip
   Single unified component for keyword + location chips across every
   dashboard. Per-type tint by setting custom properties — no Tailwind
   color utilities in the critical path, so it cannot silently wash
   out if a utility class isn't in the compiled bundle.
   ============================================ */
.doksa-chip {
  --chip-fill-start: #FDF6E3;
  --chip-fill-end: #F5E7B8;
  --chip-ink: #78350F;
  --chip-stroke: rgba(184, 134, 11, 0.45);
  --chip-count-ink: #B8860B;

  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.375rem 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.2;
  background: linear-gradient(135deg, var(--chip-fill-start) 0%, var(--chip-fill-end) 100%);
  color: var(--chip-ink);
  border: 1px solid var(--chip-stroke);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.doksa-chip__icon {
  font-size: 0.7rem;
  color: var(--chip-count-ink);
  margin-right: -0.125rem;
}

.doksa-chip__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.375rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  background: #FFFFFF;
  color: var(--chip-count-ink);
  border: 1px solid var(--chip-stroke);
}

/* Per-type chip accents — change only the CSS custom properties. */
.doksa-chip--resume {
  --chip-fill-start: #FDF6E3;
  --chip-fill-end: #F5E7B8;
  --chip-ink: #78350F;
  --chip-stroke: rgba(184, 134, 11, 0.45);
  --chip-count-ink: #B8860B;
}
.doksa-chip--business {
  --chip-fill-start: #E8F3EF;
  --chip-fill-end: #CFE4DB;
  --chip-ink: #0F3B30;
  --chip-stroke: rgba(31, 111, 92, 0.45);
  --chip-count-ink: #1F6F5C;
}
.doksa-chip--news {
  --chip-fill-start: #EEF1F8;
  --chip-fill-end: #D9E0EF;
  --chip-ink: #152257;
  --chip-stroke: rgba(45, 74, 124, 0.45);
  --chip-count-ink: #2D4A7C;
}
.doksa-chip--legal {
  --chip-fill-start: #F3E8F5;
  --chip-fill-end: #E4CDE9;
  --chip-ink: #3A0F44;
  --chip-stroke: rgba(104, 32, 118, 0.45);
  --chip-count-ink: #682076;
}

.dark .doksa-chip {
  background: rgba(255, 255, 255, 0.04);
  color: #f3f4f6;
}
.dark .doksa-chip__count {
  background: rgba(255, 255, 255, 0.08);
  color: #f3f4f6;
}

/* ============================================
   Doksa Rank Badge
   Gold medal circle used for Top 3 rankings (top candidates, top
   reports, etc.). Solid fill + white numeral so the rank reads clearly
   at a glance — no Tailwind color utilities in the critical path.
   ============================================ */
.doksa-rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #FFD700 0%, #B8860B 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1;
  letter-spacing: -0.02em;
  box-shadow: 0 2px 4px rgba(184, 134, 11, 0.35),
              inset 0 1px 0 rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(184, 134, 11, 0.6);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
}

.doksa-rank-badge--silver {
  background: linear-gradient(135deg, #E5E4E2 0%, #A8A8A8 100%);
  border-color: rgba(120, 120, 120, 0.6);
  box-shadow: 0 2px 4px rgba(120, 120, 120, 0.35),
              inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.doksa-rank-badge--bronze {
  background: linear-gradient(135deg, #CD7F32 0%, #8C5420 100%);
  border-color: rgba(140, 84, 32, 0.6);
  box-shadow: 0 2px 4px rgba(140, 84, 32, 0.35),
              inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* ============================================
   Shortlist Banner
   Appears on the resume dashboard only when the user has starred one
   or more candidates. Signals persistence + provides a direct route
   to the export flow.
   ============================================ */
.doksa-shortlist-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, #FDF6E3 0%, #F5E7B8 100%);
  border: 1px solid rgba(184, 134, 11, 0.45);
  border-left: 4px solid #B8860B;
  border-radius: var(--radius-xl);
  box-shadow: 0 1px 3px rgba(184, 134, 11, 0.15);
}

.doksa-shortlist-banner__label {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  color: #3f2a04;
  font-size: 0.925rem;
  flex: 1 1 auto;
  min-width: 16rem;
}

.doksa-shortlist-banner__label i {
  color: #B8860B;
  font-size: 1rem;
  margin-top: 0.2rem;
}

.doksa-shortlist-banner__label strong {
  color: #78350F;
  font-weight: 700;
}

.doksa-shortlist-banner__hint {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: #78350F;
  opacity: 0.75;
}

.dark .doksa-shortlist-banner {
  background: linear-gradient(135deg, #2a2110 0%, #33260e 100%);
  border-color: rgba(255, 215, 0, 0.25);
}

.dark .doksa-shortlist-banner__label,
.dark .doksa-shortlist-banner__label strong,
.dark .doksa-shortlist-banner__hint {
  color: #F5E7B8;
}

.dark .doksa-shortlist-banner__label i {
  color: #FFD700;
}

/* ============================================
   Doksa Score Bar
   Horizontal relevance bar used across dashboards (ranked candidates,
   ranked reports, policy score rows, article relevance). Inline-styled
   track + fill so contrast is guaranteed regardless of Tailwind's
   compiled utility set. Traffic-light fill colour set via inline
   style on the .doksa-score-bar__fill element — use hex, not classes.
   ============================================ */
.doksa-score-bar {
  flex: 1;
  height: 0.5rem;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: #e5e7eb;           /* light-mode track */
}
.doksa-score-bar--lg {
  height: 1.25rem;               /* 5 → lg variant used in ranked lists */
}
.dark .doksa-score-bar {
  background: #4B5563;           /* visible against #1f2937 card bg */
}
.doksa-score-bar__fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s ease-out;
}
.doksa-score-bar__score {
  font-size: 0.75rem;
  font-weight: 600;
  color: #374151;
  min-width: 3rem;
  text-align: right;
}
.dark .doksa-score-bar__score {
  color: #D1D5DB;
}

/* Ranked row: the clickable row wrapping a score bar + title */
.doksa-ranked-title {
  color: var(--ink);
}
.dark .doksa-ranked-title {
  color: #f3f4f6;
}
.doksa-ranked-row:hover {
  background: rgba(0, 0, 0, 0.035);
}
.dark .doksa-ranked-row:hover {
  background: rgba(255, 255, 255, 0.045);
}

/* ============================================
   Doksa Research Dossier
   Editorial card that reframes the Excel as the primary deliverable
   the user commissioned. Sits between the hero and the summary cards
   on every diverse dashboard. Stylized document cover on the left +
   serif numeric callout + direct download CTA. Intentionally distinct
   from the hero (different background treatment, document visual, and
   typography escalation) so it reads as "the artifact" rather than
   "another card."
   ============================================ */
.doksa-dossier {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2rem;
  align-items: center;
  padding: 1.75rem 2rem;
  margin-bottom: 1.5rem;
  background: linear-gradient(145deg, #FFFAE8 0%, #FFF4D0 55%, #FBE59E 100%);
  border: 1px solid rgba(184, 134, 11, 0.28);
  border-radius: var(--radius-xl);
  box-shadow:
    0 10px 30px -10px rgba(21, 34, 87, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  overflow: hidden;
}

/* Gold foil highlight along the top edge — signals "premium" without
   being shouty. A single 2px gradient line. */
.doksa-dossier::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    #FFD700 18%,
    #FFEFA0 40%,
    #FFD700 60%,
    #B8860B 82%,
    transparent 100%
  );
  opacity: 0.9;
}

/* Watermark grid on the right — subtle "spreadsheet" texture that
   fades into the card. Reinforces the Excel/data metaphor without
   needing an image asset. */
.doksa-dossier::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 45%;
  background-image:
    linear-gradient(to right, rgba(184, 134, 11, 0.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(184, 134, 11, 0.07) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to left, black 0%, transparent 100%);
          mask-image: linear-gradient(to left, black 0%, transparent 100%);
}

.dark .doksa-dossier {
  background: linear-gradient(145deg, #2a2110 0%, #33260e 60%, #3a2a0a 100%);
  border-color: rgba(255, 215, 0, 0.22);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.55);
}

/* Stylized document cover — CSS-only, no image asset.
   Gold-spined volume, tilted slightly in 3D, row/column grid inside,
   gold wax seal in the corner. Hover lifts the volume gently. */
.doksa-dossier__cover {
  position: relative;
  width: 118px;
  height: 148px;
  flex-shrink: 0;
  transform: rotateY(-6deg) rotateX(2deg);
  transform-style: preserve-3d;
  perspective: 900px;
  transition: transform 0.45s cubic-bezier(0.25, 0.1, 0.25, 1);
}
.doksa-dossier:hover .doksa-dossier__cover {
  transform: rotateY(-10deg) rotateX(3deg) translateY(-3px);
}

.doksa-dossier__cover-page {
  position: absolute;
  inset: 0;
  background: #FFFCF0;
  border: 1px solid rgba(184, 134, 11, 0.38);
  border-radius: 4px 10px 10px 4px;
  box-shadow:
    2px 4px 14px rgba(21, 34, 87, 0.22),
    inset -3px 0 8px rgba(184, 134, 11, 0.1);
}
.dark .doksa-dossier__cover-page {
  background: #F5E7B8;
  border-color: rgba(184, 134, 11, 0.5);
}

.doksa-dossier__cover-grid {
  position: absolute;
  top: 18px;
  right: 10px;
  bottom: 18px;
  left: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 10px repeat(5, 1fr);
  gap: 3px;
}
.doksa-dossier__cover-cell {
  background: rgba(21, 34, 87, 0.09);
  border-radius: 1px;
}
.doksa-dossier__cover-cell--header {
  background: rgba(184, 134, 11, 0.4);
}

/* Wax seal — small gold disc with dashed inset, top-right of cover */
.doksa-dossier__seal {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 28px;
  height: 28px;
  background: radial-gradient(
    circle at 32% 28%,
    #FFEFA0 0%,
    #FFD700 38%,
    #B8860B 100%
  );
  border-radius: 50%;
  box-shadow:
    0 2px 5px rgba(184, 134, 11, 0.55),
    inset 0 -1px 2px rgba(139, 105, 20, 0.45);
}
.doksa-dossier__seal::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1.5px dashed rgba(255, 255, 255, 0.55);
  border-radius: 50%;
}

/* Content column */
.doksa-dossier__content {
  position: relative;
  z-index: 1;        /* above the watermark grid */
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}
.doksa-dossier__tag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-dark-gold);
  margin: 0;
}
.dark .doksa-dossier__tag {
  color: var(--brand-gold);
}
.doksa-dossier__title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.dark .doksa-dossier__title {
  color: #f5e7b8;
}
.doksa-dossier__lead {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.55;
}
.dark .doksa-dossier__lead {
  color: #c7b88a;
}
.doksa-dossier__lead strong {
  color: var(--brand-navy);
  font-weight: 600;
}
.dark .doksa-dossier__lead strong {
  color: #FFD700;
}

/* The editorial callout: huge serif numeral + inline caption */
.doksa-dossier__callout {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-top: 0.15rem;
}
.doksa-dossier__number {
  font-family: 'Fraunces', 'Poppins', Georgia, serif;
  font-size: 2.6rem;
  font-weight: 700;
  font-feature-settings: 'ss01', 'ss02', 'lnum';
  line-height: 1;
  color: var(--brand-navy);
  letter-spacing: -0.03em;
}
.dark .doksa-dossier__number {
  color: #FFD700;
}
.doksa-dossier__breakdown {
  font-size: 0.82rem;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
  line-height: 1.4;
}
.dark .doksa-dossier__breakdown {
  color: #c7b88a;
}
.doksa-dossier__breakdown-label {
  font-weight: 600;
  color: var(--brand-navy);
  display: block;
  font-size: 0.85rem;
}
.dark .doksa-dossier__breakdown-label {
  color: #FFD700;
}
.doksa-dossier__breakdown-note {
  display: block;
}

.doksa-dossier__actions {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}
.doksa-dossier__secondary {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.2s;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0.35rem 0;
}
.doksa-dossier__secondary:hover {
  color: var(--brand-dark-gold);
}
.dark .doksa-dossier__secondary {
  color: #c7b88a;
}
.dark .doksa-dossier__secondary:hover {
  color: #FFD700;
}

/* Stack on narrow screens: document visual sits above content, centered. */
@media (max-width: 640px) {
  .doksa-dossier {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 1.5rem 1.25rem;
  }
  .doksa-dossier__cover {
    margin: 0 auto;
  }
  .doksa-dossier__callout,
  .doksa-dossier__actions {
    justify-content: center;
  }
  .doksa-dossier__breakdown-label {
    display: inline;
  }
}

/* ============================================
   Floating Action Button (FAB)
   ============================================ */
.fab-export {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: var(--gradient-gold);
  color: var(--gray-900);
  border: none;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: var(--shadow-xl);
  transition: all var(--transition-base);
}

.fab-export:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-2xl);
}

.fab-export:active {
  transform: translateY(0) scale(0.98);
}

.fab-export i {
  font-size: 1.125rem;
}

/* Document-type specific FAB colors */
.fab-export.resume {
  background: var(--gradient-resume);
  color: white;
}

.fab-export.business {
  background: var(--gradient-business);
  color: white;
}

.fab-export.news {
  background: var(--gradient-news);
  color: white;
}

.fab-export.legal {
  background: var(--gradient-legal);
  color: white;
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  min-width: 320px;
  max-width: 420px;
  pointer-events: auto;
  animation: slideInRight var(--transition-slow) ease-out forwards;
}

.toast.toast-exit {
  animation: slideOutRight var(--transition-slow) ease-out forwards;
}

.toast-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 0.25rem;
}

.toast-message {
  font-size: 0.875rem;
  color: var(--gray-600);
  line-height: 1.4;
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 0.25rem;
  transition: color var(--transition-fast);
}

.toast-close:hover {
  color: var(--gray-600);
}

/* Toast Progress Bar */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  animation: progressShrink linear forwards;
}

@keyframes progressShrink {
  from { width: 100%; }
  to { width: 0%; }
}

/* Toast Types */
.toast-success {
  border-left: 4px solid var(--business-primary);
}
.toast-success .toast-icon {
  background: rgba(16, 185, 129, 0.1);
  color: var(--business-primary);
}
.toast-success .toast-progress {
  background: var(--business-primary);
}

.toast-error {
  border-left: 4px solid var(--legal-primary);
}
.toast-error .toast-icon {
  background: rgba(239, 68, 68, 0.1);
  color: var(--legal-primary);
}
.toast-error .toast-progress {
  background: var(--legal-primary);
}

.toast-warning {
  border-left: 4px solid var(--resume-primary);
}
.toast-warning .toast-icon {
  background: rgba(245, 158, 11, 0.1);
  color: var(--resume-primary);
}
.toast-warning .toast-progress {
  background: var(--resume-primary);
}

.toast-info {
  border-left: 4px solid var(--news-primary);
}
.toast-info .toast-icon {
  background: rgba(59, 130, 246, 0.1);
  color: var(--news-primary);
}
.toast-info .toast-progress {
  background: var(--news-primary);
}

/* Dark mode toasts */
.dark .toast {
  background: var(--gray-800);
}
.dark .toast-title {
  color: var(--gray-100);
}
.dark .toast-message {
  color: var(--gray-400);
}

/* ============================================
   Enhanced Card Styles
   ============================================ */
.dashboard-card {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
  overflow: hidden;
}

.dashboard-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.dark .dashboard-card {
  background: var(--gray-800);
}

.dashboard-card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dark .dashboard-card-header {
  border-bottom-color: var(--gray-700);
}

.dashboard-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dark .dashboard-card-title {
  color: var(--gray-100);
}

.dashboard-card-body {
  padding: 1.5rem;
}

/* ============================================
   Enhanced Modal Styles
   ============================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn var(--transition-fast) ease-out;
}

.modal-panel {
  background: white;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-2xl);
  animation: scaleIn var(--transition-base) ease-out;
}

.modal-panel.modal-lg {
  max-width: 900px;
}

.modal-panel.modal-xl {
  max-width: 1200px;
}

.dark .modal-panel {
  background: var(--gray-800);
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.dark .modal-header {
  border-bottom-color: var(--gray-700);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
}

.dark .modal-title {
  color: var(--gray-100);
}

.modal-close {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--gray-100);
  color: var(--gray-600);
}

.dark .modal-close:hover {
  background: var(--gray-700);
  color: var(--gray-300);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  /* Anchor the default modal-body text colour so any descendant that
     relies on an uncompiled Tailwind utility (text-gray-800, etc.)
     still inherits a readable colour instead of falling back to the
     page-level light ink. Elements that DO specify their own colour
     (amber-900 callout headings via compiled utilities, etc.) keep
     their explicit colour — this rule only affects descendants that
     did not land a colour of their own. */
  color: var(--ink);
  line-height: 1.6;
}
.dark .modal-body {
  color: #E5E7EB;
}

.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.dark .modal-footer {
  border-top-color: var(--gray-700);
}

/* ============================================
   Enhanced Badge Styles
   ============================================ */
.badge-enhanced {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  transition: all var(--transition-fast);
}

.badge-enhanced.badge-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--business-dark);
}

.badge-enhanced.badge-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--resume-dark);
}

.badge-enhanced.badge-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--legal-dark);
}

.badge-enhanced.badge-info {
  background: rgba(59, 130, 246, 0.1);
  color: var(--news-dark);
}

/* ============================================
   Loading States
   ============================================ */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--gray-200) 25%,
    var(--gray-100) 50%,
    var(--gray-200) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

.dark .skeleton {
  background: linear-gradient(
    90deg,
    var(--gray-700) 25%,
    var(--gray-600) 50%,
    var(--gray-700) 75%
  );
  background-size: 200% 100%;
}

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
}

.skeleton-text:last-child {
  width: 75%;
}

/* ============================================
   Chart Container Enhancements
   ============================================ */
.chart-wrapper {
  position: relative;
  padding: 1rem;
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
}

.dark .chart-wrapper {
  background: var(--gray-900);
}

.chart-wrapper:hover {
  background: white;
  box-shadow: var(--shadow-md);
}

.dark .chart-wrapper:hover {
  background: var(--gray-800);
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 640px) {
  .fab-export {
    bottom: 1rem;
    right: 1rem;
    padding: 0.875rem 1.25rem;
    font-size: 0.875rem;
  }

  .fab-export span {
    display: none;
  }

  .toast-container {
    top: auto;
    bottom: 5rem;
    right: 1rem;
    left: 1rem;
  }

  .toast {
    min-width: auto;
    max-width: none;
  }

  .modal-panel {
    max-height: 85vh;
    margin: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }
}
