/* ═══════════════════════════════════════════════════════════
   Unified Design System — Luxury/Refined
   Shared across MuleIntel + DF-Vault
   ═══════════════════════════════════════════════════════════ */

/* Fonts */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=JetBrains+Mono:wght@400;500;600&display=swap');
@import url('https://api.fontshare.com/v2/css?f[]=satoshi@400,500,700&display=swap');

:root {
  /* ─── Background ─────────────────────────────────────── */
  --bg-primary: #09090B;
  --bg-card: #0F0F12;
  --bg-elevated: #18181B;
  --bg-input: #1C1C20;

  /* ─── Borders ────────────────────────────────────────── */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-active: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(212, 168, 83, 0.4);

  /* ─── Text ───────────────────────────────────────────── */
  --text-primary: #FAFAFA;
  --text-secondary: #A1A1AA;
  --text-muted: #52525B;
  --text-inverse: #09090B;

  /* ─── Accent ─────────────────────────────────────────── */
  --accent-gold: #D4A853;
  --accent-gold-muted: rgba(212, 168, 83, 0.15);

  /* ─── Tiers ──────────────────────────────────────────── */
  --tier-hot: #D4A853;
  --tier-hot-bg: rgba(212, 168, 83, 0.12);
  --tier-warm: #A1A1AA;
  --tier-warm-bg: rgba(161, 161, 170, 0.12);
  --tier-nurture: #52525B;
  --tier-nurture-bg: rgba(82, 82, 91, 0.12);

  /* ─── Signals ────────────────────────────────────────── */
  --signal-trigger: #F87171;
  --signal-trigger-bg: rgba(248, 113, 113, 0.12);
  --signal-hiring: #60A5FA;
  --signal-hiring-bg: rgba(96, 165, 250, 0.12);
  --signal-quickwin: #4ADE80;
  --signal-quickwin-bg: rgba(74, 222, 128, 0.12);

  /* ─── Source Badges ──────────────────────────────────── */
  --source-hiring: #60A5FA;
  --source-webintel: #A78BFA;
  --source-scrape: #4ADE80;
  --source-known: #D4A853;
  --source-search: #FB923C;
  --source-llm: #71717A;

  /* ─── Spacing ────────────────────────────────────────── */
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 8px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* ─── Typography ─────────────────────────────────────── */
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'Satoshi', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.875rem;
  --text-lg: 1rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.75rem;
  --text-display: 2.25rem;

  /* ─── Transitions ────────────────────────────────────── */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease-out;
  --transition-expand: 250ms ease-out;

  /* ─── Legacy Compat (mapped from old tokens) ─────────── */
  --mule-blue: var(--accent-gold);
  --mule-purple: #A78BFA;
  --mule-blue-dark: #B8922E;
  --sf-blue: var(--accent-gold);
  --accent-green: var(--signal-quickwin);
  --accent-amber: var(--accent-gold);
  --accent-red: var(--signal-trigger);
  --accent-cyan: #60A5FA;
  --bg-secondary: var(--bg-elevated);
  --bg-card-hover: var(--bg-elevated);
  --border-glow: var(--border-focus);
  --shadow-card: none;
  --shadow-glow: none;
}

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

/* ═══════════════════════════════════════════════════════════
   Briefing Card
   ═══════════════════════════════════════════════════════════ */

.briefing-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  animation: briefingFadeIn 300ms ease-out;
}

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

.briefing-card .tier-border {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
}

.tier-border.tier-1 { background: var(--tier-hot); }
.tier-border.tier-2 { background: var(--tier-warm); }
.tier-border.tier-3 { background: var(--tier-nurture); }

/* Header */
.briefing-header {
  padding: var(--space-lg);
  padding-right: 80px;
  position: relative;
}

.briefing-company-name {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: var(--space-xs);
}

.briefing-meta {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
}

.briefing-meta .separator {
  margin: 0 var(--space-sm);
  color: var(--text-muted);
}

.briefing-tier-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-md);
}

.briefing-tier-label.tier-1 {
  background: var(--tier-hot-bg);
  color: var(--tier-hot);
}

.briefing-tier-label.tier-2 {
  background: var(--tier-warm-bg);
  color: var(--tier-warm);
}

.briefing-tier-label.tier-3 {
  background: var(--tier-nurture-bg);
  color: var(--tier-nurture);
}

/* Score Arc */
.score-arc {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
  width: 48px;
  height: 48px;
}

.score-arc svg {
  width: 100%;
  height: 100%;
}

.score-arc-bg {
  fill: none;
  stroke: var(--border-subtle);
  stroke-width: 2.5;
}

.score-arc-fill {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  transition: stroke-dashoffset 600ms ease-out;
}

.score-arc-fill.tier-1 { stroke: var(--tier-hot); }
.score-arc-fill.tier-2 { stroke: var(--tier-warm); }
.score-arc-fill.tier-3 { stroke: var(--tier-nurture); }

.score-arc-value {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  fill: var(--text-primary);
  text-anchor: middle;
  dominant-baseline: central;
}

/* Signal Pills */
.signal-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding: 0 var(--space-lg);
  margin-bottom: var(--space-md);
}

.signal-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 3px 10px;
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 500;
  font-family: var(--font-body);
  line-height: 1.4;
}

.signal-pill.trigger {
  background: var(--signal-trigger-bg);
  color: var(--signal-trigger);
}

.signal-pill.hiring {
  background: var(--signal-hiring-bg);
  color: var(--signal-hiring);
}

.signal-pill.quickwin {
  background: var(--signal-quickwin-bg);
  color: var(--signal-quickwin);
}

.signal-pill.neutral {
  background: var(--tier-warm-bg);
  color: var(--text-secondary);
}

/* Executive Summary */
.briefing-summary {
  padding: 0 var(--space-lg) var(--space-lg);
  font-size: var(--text-base);
  font-family: var(--font-body);
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Drill-down Sections */
.briefing-sections {
  border-top: 1px solid var(--border-subtle);
}

.drill-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--transition-fast);
  user-select: none;
}

.drill-section:last-of-type {
  border-bottom: none;
}

.drill-section:hover {
  background: var(--bg-elevated);
}

.drill-section-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.drill-section-title {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-primary);
}

.drill-section-meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.drill-section-chevron {
  color: var(--text-muted);
  transition: transform var(--transition-expand);
  font-size: 12px;
  flex-shrink: 0;
}

.drill-section.expanded .drill-section-chevron {
  transform: rotate(90deg);
}

.drill-section-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-expand);
  border-bottom: 1px solid var(--border-subtle);
}

.drill-section-content.expanded {
  max-height: 2000px;
}

.drill-section-content-inner {
  padding: var(--space-md) var(--space-lg) var(--space-lg);
}

/* ═══════════════════════════════════════════════════════════
   Progress Stepper
   ═══════════════════════════════════════════════════════════ */

.progress-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) var(--space-lg);
}

.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-active);
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.step-dot.active {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  box-shadow: 0 0 8px var(--accent-gold-muted);
  animation: stepPulse 1.5s ease-in-out infinite;
}

@keyframes stepPulse {
  0%, 100% { box-shadow: 0 0 8px var(--accent-gold-muted); }
  50% { box-shadow: 0 0 16px var(--accent-gold-muted); }
}

.step-dot.done {
  background: var(--signal-quickwin);
  border-color: var(--signal-quickwin);
}

.step-connector {
  width: 48px;
  height: 1px;
  background: var(--border-subtle);
  transition: background var(--transition-base);
  flex-shrink: 0;
}

.step-connector.done {
  background: var(--signal-quickwin);
}

.stepper-status {
  text-align: center;
  padding: 0 var(--space-lg) var(--space-lg);
}

.stepper-message {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.stepper-timer {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-left: var(--space-sm);
}

.stepper-total {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-align: center;
  padding-bottom: var(--space-md);
}

/* ═══════════════════════════════════════════════════════════
   Log Panel
   ═══════════════════════════════════════════════════════════ */

.log-panel {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.log-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: var(--space-xs) var(--space-sm);
  cursor: pointer;
  margin: 0 auto;
  transition: all var(--transition-base);
}

.log-toggle:hover {
  color: var(--text-secondary);
  border-color: var(--border-active);
}

.log-toggle svg {
  transition: transform var(--transition-base);
}

.log-panel.open .log-toggle svg {
  transform: rotate(90deg);
}

.log-count {
  background: var(--bg-elevated);
  border-radius: 9px;
  padding: 1px 6px;
  font-size: 10px;
  min-width: 18px;
  text-align: center;
}

.log-count.has-errors {
  background: var(--accent-danger, #e74c3c);
  color: #fff;
}

.log-body {
  display: none;
  margin-top: var(--space-sm);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  overflow: hidden;
}

.log-panel.open .log-body {
  display: block;
}

.log-entries {
  max-height: 240px;
  overflow-y: auto;
  padding: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
}

.log-entry {
  padding: 2px 0;
  color: var(--text-muted);
  word-break: break-word;
  border-bottom: 1px solid var(--border-subtle);
}

.log-entry:last-child {
  border-bottom: none;
}

.log-entry .log-time {
  color: var(--text-muted);
  opacity: 0.5;
  margin-right: var(--space-xs);
}

.log-entry.log-warn {
  color: var(--accent-gold);
}

.log-entry.log-error {
  color: var(--accent-danger, #e74c3c);
}

.log-entry.log-info {
  color: var(--text-secondary);
}

.log-actions {
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}

.log-copy-btn,
.log-clear-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-primary);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-base);
}

.log-copy-btn:hover,
.log-clear-btn:hover {
  color: var(--text-secondary);
  border-color: var(--border-active);
}

/* ═══════════════════════════════════════════════════════════
   Skeleton Loader
   ═══════════════════════════════════════════════════════════ */

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 25%,
    rgba(255, 255, 255, 0.04) 50%,
    var(--bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
}

.skeleton-text.wide { width: 80%; }
.skeleton-text.medium { width: 60%; }
.skeleton-text.narrow { width: 40%; }

.skeleton-heading {
  height: 28px;
  width: 50%;
  margin-bottom: 12px;
}

.skeleton-meta {
  height: 14px;
  width: 35%;
  margin-bottom: 16px;
}

.skeleton-pill {
  height: 22px;
  width: 80px;
  border-radius: 4px;
  display: inline-block;
  margin-right: 8px;
}

.skeleton-row {
  height: 44px;
  margin-bottom: 1px;
}

.skeleton-arc {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
}
