/* ============================================
   1Rally7 — Design System
   Women's sports partnerships, powered by AI
   ============================================ */

:root {
  --bg: #0a0f14;
  --bg-card: #0f1419;
  --bg-elevated: #141b21;
  --bg-hover: #1a232b;
  --border: #1e2a35;
  --border-light: #18242f;
  --text: #f0f4f8;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #0a4d7a;
  --accent-light: #1a7aad;
  --accent-glow: rgba(10, 77, 122, 0.12);
  --green: #1a5d4f;
  --green-bg: rgba(26, 93, 79, 0.1);
  --teal: #0d5569;
  --teal-bg: rgba(13, 85, 105, 0.1);
  --orange: #fb923c;
  --orange-bg: rgba(251, 146, 60, 0.1);
  --red: #f87171;
  --blue: #0a4d7a;
  --gradient-1: linear-gradient(135deg, #1a5d4f 0%, #0a4d7a 100%);
  --gradient-2: linear-gradient(135deg, #0a4d7a 0%, #0d5569 100%);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.4);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: 'Syne', 'Space Grotesk', sans-serif;
  letter-spacing: -0.02em;
}

/* ---- Navigation ---- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-light);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.logo-mark {
  width: 36px;
  height: 36px;
  background: var(--gradient-1);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.1rem;
  color: white;
}

.logo-text {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
}

.nav-link {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.nav-link:hover { color: var(--text); background: var(--bg-elevated); }
.nav-link.active { color: var(--text); background: var(--accent-glow); }

/* ---- Hero ---- */
.hero {
  padding: 5rem 1.5rem 3rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 600px;
  background: radial-gradient(ellipse, rgba(124, 92, 252, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 1.25rem;
  position: relative;
}

.gradient-text {
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
  position: relative;
}

/* ---- Container ---- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

/* ---- Stats Grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 3rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--border);
  transform: translateY(-2px);
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--gradient-2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

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

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.filter-bar {
  display: flex;
  gap: 0.75rem;
}

.filter-bar select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
}

.filter-bar select:focus { border-color: var(--accent); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--gradient-1);
  color: white;
  box-shadow: 0 2px 12px rgba(124, 92, 252, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(124, 92, 252, 0.4);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

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

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.btn-back {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.5rem 0;
  transition: var(--transition);
}

.btn-back:hover { color: var(--text); }

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
}

/* ---- Match Cards ---- */
.matches-preview, .matches-grid {
  display: grid;
  gap: 1rem;
}

.matches-preview { grid-template-columns: repeat(3, 1fr); }
.matches-grid { grid-template-columns: repeat(2, 1fr); }

.match-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.match-card:hover {
  border-color: var(--border);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.match-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.match-score-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
}

.score-high { background: var(--green-bg); color: var(--green); }
.score-mid { background: var(--orange-bg); color: var(--orange); }

.match-sport-tag {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.match-pairing {
  margin-bottom: 1rem;
}

.match-entity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.entity-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
}

.entity-icon.brand {
  background: linear-gradient(135deg, #0a4d7a 0%, #062e4d 100%);
  color: white;
}

.entity-icon.property {
  background: linear-gradient(135deg, #1a5d4f 0%, #0d3d2f 100%);
  color: white;
}

.entity-info h4 {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
}

.entity-info span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.match-divider {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
  padding-left: 1rem;
}

.match-divider .x {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-glow);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.match-divider .line {
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

.match-reasoning {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.match-scores-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.mini-score {
  flex: 1;
  text-align: center;
}

.mini-score-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.mini-score-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mini-score-bar {
  height: 3px;
  background: var(--bg-elevated);
  border-radius: 2px;
  margin-top: 0.3rem;
  overflow: hidden;
}

.mini-score-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.8s ease;
}

.fill-green { background: var(--green); }
.fill-blue { background: var(--blue); }
.fill-accent { background: var(--accent); }

.match-card-actions {
  display: flex;
  gap: 0.5rem;
}

.match-card-actions .btn { flex: 1; justify-content: center; }

.brief-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--green);
  background: var(--green-bg);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

/* ---- Brief View ---- */
.view-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  overflow-y: auto;
}

.brief-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
}

.brief-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.brief-actions { display: flex; gap: 0.5rem; }

.brief-body { animation: fadeIn 0.3s ease; }

.brief-title-section {
  text-align: center;
  margin-bottom: 3rem;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
}

.brief-logo-pair {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.brief-entity-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.3rem;
  color: white;
}

.brief-x {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent);
}

.brief-title-section h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.brief-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.brief-score-row {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 1.5rem;
}

.brief-score-item {
  text-align: center;
}

.brief-score-num {
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--gradient-2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brief-score-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Brief Sections */
.brief-section {
  margin-bottom: 2rem;
}

.brief-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-light);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brief-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

.brief-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.brief-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
}

.brief-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.fit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.fit-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.fit-card h4 {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.fit-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Deal Tiers */
.tiers-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.tier-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: var(--transition);
}

.tier-card:hover { border-color: var(--border); }

.tier-card.featured {
  border-color: var(--accent);
  box-shadow: 0 0 24px var(--accent-glow);
}

.tier-name {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.tier-price {
  font-size: 1.25rem;
  font-weight: 800;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
}

.tier-list {
  list-style: none;
  margin-bottom: 0.75rem;
}

.tier-list li {
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 0.3rem 0;
  padding-left: 1.2rem;
  position: relative;
}

.tier-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.65rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.tier-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-top: 1rem;
  margin-bottom: 0.35rem;
}

/* Comparable Deals Table */
.comps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.comps-table th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.comps-table td {
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
}

.comps-table tr:last-child td { border-bottom: none; }
.comps-table td:first-child { color: var(--text); font-weight: 600; }

/* Talking Points */
.talking-points-list {
  list-style: none;
  display: grid;
  gap: 0.75rem;
}

.talking-point {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.talking-point-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: var(--accent-glow);
  color: var(--accent-light);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.75rem;
}

/* ---- Generating Overlay ---- */
.generating-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(10, 10, 15, 0.9);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.generating-modal {
  text-align: center;
  padding: 3rem;
}

.generating-animation {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 2rem;
}

.pulse-ring {
  position: absolute;
  inset: 0;
  border: 2px solid var(--accent);
  border-radius: 50%;
  animation: pulse 2s ease-out infinite;
  opacity: 0;
}

.pulse-ring.delay-1 { animation-delay: 0.5s; }
.pulse-ring.delay-2 { animation-delay: 1s; }

.generating-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.1rem;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.generating-modal h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.generating-sub {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.generating-steps {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 280px;
  margin: 0 auto;
}

.gen-step {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.4rem 0;
  text-align: left;
  padding-left: 1.5rem;
  position: relative;
  transition: var(--transition);
}

.gen-step::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  transition: var(--transition);
}

.gen-step.active {
  color: var(--accent-light);
}

.gen-step.active::before {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.gen-step.done {
  color: var(--green);
}

.gen-step.done::before {
  background: var(--green);
  border-color: var(--green);
}

/* ---- Loading State ---- */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-muted);
  gap: 1rem;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ---- View Management ---- */
.view { display: none; }
.view.active { display: block; }

/* ---- Error/Empty ---- */
.error-state {
  text-align: center;
  padding: 3rem;
  color: var(--red);
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

/* ---- Animations ---- */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(2.5); opacity: 0; }
}

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

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

.animate-in {
  animation: slideUp 0.4s ease forwards;
  opacity: 0;
}

/* ---- Print Styles ---- */
@media print {
  .no-print { display: none !important; }
  .nav { display: none !important; }
  body { background: white; color: #1a1a1a; }
  .brief-container { padding: 0; max-width: none; }
  .view-overlay { position: static; background: white; }
  .brief-title-section, .brief-card, .fit-card, .tier-card, .talking-point {
    background: white;
    border-color: #e5e7eb;
    box-shadow: none;
  }
  .brief-score-num, .stat-value, .gradient-text, .tier-price {
    -webkit-text-fill-color: #7c5cfc;
  }
  .comps-table th, .comps-table td { color: #1a1a1a; }
  .fit-card p, .brief-card p, .talking-point { color: #374151; }
}

/* ---- Responsive ---- */
/* ============================================
   Campaign Designer
   ============================================ */

/* Campaign list */
.campaigns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.campaign-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
}

.campaign-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(124, 92, 252, 0.08);
}

.campaign-card h4 { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.3rem; }
.campaign-card .camp-meta { font-size: 0.8rem; color: var(--text-muted); display: flex; gap: 0.75rem; }

.camp-status {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.camp-status-draft { background: rgba(96,165,250,0.1); color: var(--blue); }
.camp-status-active { background: var(--green-bg); color: var(--green); }

/* Stepper */
.campaign-stepper {
  display: flex;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.cstep {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 0.75rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  min-width: 110px;
}

.cstep:hover { color: var(--text); background: var(--bg-elevated); }

.cstep.active {
  color: var(--accent-light);
  background: var(--accent-glow);
  font-weight: 600;
}

.cstep.done { color: var(--green); }

.cstep-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  flex-shrink: 0;
}

.cstep.active .cstep-num { background: var(--accent); color: #fff; }
.cstep.done .cstep-num { background: var(--green); color: #fff; }

/* Panels */
.cpanel { display: none; }
.cpanel.active { display: block; }

.cpanel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.cpanel-header h3 { font-size: 1.1rem; font-weight: 700; }
.cpanel-sub { color: var(--text-secondary); font-size: 0.8rem; margin-top: 0.2rem; }

.cpanel-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}

/* Campaign form */
.campaign-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.cfield { display: flex; flex-direction: column; gap: 0.3rem; }
.cfield.full { grid-column: 1 / -1; }

.cfield label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.cfield input, .cfield textarea, .cfield select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.55rem 0.65rem;
}

.cfield input:focus, .cfield textarea:focus, .cfield select:focus {
  outline: none;
  border-color: var(--accent);
}

.cfield textarea { resize: vertical; min-height: 60px; }

/* Activation cards */
.act-category { margin-bottom: 1.25rem; }

.act-cat-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.act-card {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 0.4rem;
  transition: var(--transition);
}

.act-card:hover { border-color: var(--border); }
.act-card.deselected { opacity: 0.35; border-style: dashed; }

.act-toggle {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.act-toggle.on { background: var(--accent); border-color: var(--accent); }
.act-toggle.on::after { content: '\2713'; color: #fff; font-size: 11px; font-weight: 700; }

.act-info { flex: 1; }
.act-info h4 { font-size: 0.85rem; font-weight: 600; }
.act-info p { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.45; margin-top: 0.15rem; }
.act-meta { display: flex; gap: 0.6rem; margin-top: 0.3rem; font-size: 0.72rem; }
.act-meta .cost { color: var(--green); font-weight: 600; }
.act-meta .pri-high { color: var(--red); }
.act-meta .pri-medium { color: var(--orange); }
.act-meta .pri-low { color: var(--blue); }

.cat-pill {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 20px;
  font-size: 0.65rem;
  font-weight: 700;
}

.cat-in-venue { background: var(--green-bg); color: var(--green); }
.cat-digital { background: rgba(96,165,250,0.1); color: var(--blue); }
.cat-social { background: rgba(167,139,250,0.1); color: #a78bfa; }
.cat-experiential { background: var(--orange-bg); color: var(--orange); }

/* Timeline phases */
.phase-group { margin-bottom: 1.5rem; }
.phase-label {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 0.6rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.phase-label .pline { flex: 1; height: 1px; background: var(--border-light); }
.phase-pre-season .phase-label { color: var(--blue); }
.phase-in-season .phase-label { color: var(--green); }
.phase-post-season .phase-label { color: #a78bfa; }

.ms-item {
  display: flex; gap: 0.75rem; align-items: flex-start;
  padding: 0.6rem 0.85rem; background: var(--bg-card);
  border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  margin-bottom: 0.35rem; transition: var(--transition);
}
.ms-item:hover { border-color: var(--border); }

.ms-check {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border); cursor: pointer;
  flex-shrink: 0; margin-top: 2px; display: flex;
  align-items: center; justify-content: center; transition: var(--transition);
}
.ms-check.on { background: var(--green); border-color: var(--green); }
.ms-check.on::after { content: '\2713'; color: #fff; font-size: 9px; font-weight: 700; }

.ms-info { flex: 1; }
.ms-info h4 { font-size: 0.8rem; font-weight: 600; }
.ms-info p { font-size: 0.72rem; color: var(--text-secondary); margin-top: 0.1rem; }
.ms-date { font-size: 0.68rem; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.ms-item.done h4 { text-decoration: line-through; color: var(--text-muted); }

/* Assets */
.asset-group { margin-bottom: 1rem; }
.asset-group-label { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.4rem; }

.asset-row {
  display: flex; gap: 0.75rem; align-items: flex-start;
  padding: 0.55rem 0.85rem; background: var(--bg-card);
  border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  margin-bottom: 0.25rem; transition: var(--transition);
}
.asset-row:hover { border-color: var(--border); }
.asset-row.done h4 { text-decoration: line-through; color: var(--text-muted); }

.asset-chk {
  width: 16px; height: 16px; border-radius: 4px;
  border: 2px solid var(--border); cursor: pointer;
  flex-shrink: 0; margin-top: 1px; display: flex;
  align-items: center; justify-content: center; transition: var(--transition);
}
.asset-chk.on { background: var(--green); border-color: var(--green); }
.asset-chk.on::after { content: '\2713'; color: #fff; font-size: 9px; font-weight: 700; }
.asset-row h4 { font-size: 0.8rem; font-weight: 600; }
.asset-row p { font-size: 0.72rem; color: var(--text-secondary); margin-top: 0.1rem; }

/* Budget table */
.budget-tbl {
  width: 100%; border-collapse: separate; border-spacing: 0;
  border: 1px solid var(--border-light); border-radius: var(--radius); overflow: hidden;
}
.budget-tbl th {
  background: var(--bg-card); padding: 0.6rem 0.85rem; text-align: left;
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-muted); border-bottom: 1px solid var(--border);
}
.budget-tbl td { padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--border-light); font-size: 0.82rem; }
.budget-tbl tr:last-child td { border-bottom: none; }
.budget-bar { height: 5px; background: var(--bg-elevated); border-radius: 3px; overflow: hidden; min-width: 50px; }
.budget-fill { height: 100%; border-radius: 3px; background: var(--accent); transition: width 0.5s ease; }
.budget-total-row {
  display: flex; justify-content: space-between; padding: 0.85rem 1rem;
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--radius); margin-top: 0.75rem; font-weight: 700;
}
.budget-total-row .amt { font-size: 1.1rem; background: var(--gradient-1); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* Review summary cards */
.review-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem; margin-bottom: 1.5rem;
}
.review-card {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 1rem;
}
.review-card .rlabel { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 0.3rem; }
.review-card .rval { font-size: 1.15rem; font-weight: 800; }
.review-card .rsub { font-size: 0.72rem; color: var(--text-secondary); margin-top: 0.15rem; }

.review-sect { margin-bottom: 1.25rem; }
.review-sect h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.5rem; }

.rpill {
  display: inline-flex; align-items: center; gap: 0.2rem;
  padding: 0.15rem 0.5rem; background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: 20px; font-size: 0.7rem; color: var(--text-secondary);
}

/* Campaign AI loading */
.camp-loading {
  display: flex; flex-direction: column; align-items: center;
  padding: 3rem; gap: 1rem;
}
.camp-loading p { color: var(--text-muted); font-size: 0.85rem; }

@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .matches-preview, .matches-grid { grid-template-columns: 1fr; }
  .fit-grid { grid-template-columns: 1fr; }
  .tiers-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.75rem; }
  .brief-score-row { gap: 1rem; }
  .filter-bar { flex-wrap: wrap; }
  .brief-logo-pair { gap: 1rem; }
  .brief-entity-logo { width: 44px; height: 44px; font-size: 1rem; }
  .campaign-stepper { overflow-x: auto; }
  .cstep { min-width: 100px; font-size: 0.72rem; }
  .campaigns-grid { grid-template-columns: 1fr; }
  .campaign-form-grid { grid-template-columns: 1fr; }
  .cpanel-header { flex-direction: column; align-items: flex-start; }
  .inventory-grid { grid-template-columns: 1fr; }
  .add-grid { grid-template-columns: 1fr; }
  .result-card { flex-direction: column; }
  .result-scores { flex-direction: column; align-items: stretch; }
  .engine-summary { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================
   Matching Engine
   ============================================ */

.engine-hero {
  text-align: center;
  padding: 3rem 1.5rem 2rem;
  position: relative;
}

.engine-hero::before {
  content: '';
  position: absolute;
  top: -30%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(124, 92, 252, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.engine-icon-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.engine-icon {
  width: 56px;
  height: 56px;
  background: var(--accent-glow);
  border: 1px solid rgba(124, 92, 252, 0.3);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-light);
}

.engine-hero h2 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
  position: relative;
}

.engine-sub {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 520px;
  margin: 0 auto 1.5rem;
  position: relative;
}

.btn-lg {
  padding: 0.75rem 2rem;
  font-size: 0.95rem;
  border-radius: var(--radius);
  position: relative;
}

/* Engine Tabs */
.engine-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 1.5rem;
}

.etab {
  flex: 1;
  padding: 0.55rem 1rem;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.etab:hover { color: var(--text); background: var(--bg-elevated); }
.etab.active { color: var(--accent-light); background: var(--accent-glow); font-weight: 600; }

.engine-panel { display: none; }
.engine-panel.active { display: block; animation: fadeIn 0.25s ease; }

/* Inventory Grid */
.inventory-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.inv-section {}

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

.inv-header h3 {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.inv-count {
  background: var(--accent-glow);
  color: var(--accent-light);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
}

.inv-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 520px;
  overflow-y: auto;
}

.inv-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.inv-card:hover {
  border-color: var(--accent);
  transform: translateX(3px);
  box-shadow: 0 4px 16px rgba(124, 92, 252, 0.06);
}

.inv-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
  color: white;
}

.inv-card-icon.brand { background: linear-gradient(135deg, #0a4d7a, #062e4d); }
.inv-card-icon.property { background: linear-gradient(135deg, #1a5d4f, #0d3d2f); }

.inv-card-info { flex: 1; min-width: 0; }
.inv-card-info h4 { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-card-info span { font-size: 0.72rem; color: var(--text-muted); }

.inv-tags { display: flex; gap: 0.3rem; margin-top: 0.25rem; flex-wrap: wrap; }
.inv-tag {
  font-size: 0.6rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
}
.inv-tag.type-tag { background: var(--accent-glow); color: var(--accent-light); }
.inv-tag.reach-tag { background: var(--green-bg); color: var(--green); }

.inv-card-action { flex-shrink: 0; }
.inv-find-btn {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-light);
  opacity: 0;
  transition: var(--transition);
}
.inv-card:hover .inv-find-btn { opacity: 1; }

/* Engine Results */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.results-header h3 { font-size: 1.1rem; font-weight: 700; }

.results-list { display: flex; flex-direction: column; gap: 0.75rem; }

.result-card {
  display: flex;
  gap: 1rem;
  align-items: stretch;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  transition: var(--transition);
  flex-wrap: wrap;
}

.result-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow);
}

.result-rank {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
  background: var(--bg-elevated);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: flex-start;
}

.result-pairing {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 260px;
}

.result-entity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.result-entity h4 { font-size: 0.85rem; font-weight: 700; line-height: 1.2; }
.result-entity span { font-size: 0.7rem; color: var(--text-muted); }

.result-x {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--accent);
  flex-shrink: 0;
}

.result-scores {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.result-main-score {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.result-main-score.score-high { background: var(--green-bg); border: 1px solid rgba(52, 211, 153, 0.2); }
.result-main-score.score-mid { background: var(--orange-bg); border: 1px solid rgba(251, 146, 60, 0.2); }
.result-main-score.score-low { background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248, 113, 113, 0.2); }

.rms-value { font-size: 1.15rem; font-weight: 800; }
.score-high .rms-value { color: var(--green); }
.score-mid .rms-value { color: var(--orange); }
.score-low .rms-value { color: var(--red); }

.rms-label { font-size: 0.55rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }

.result-sub-scores { display: flex; flex-direction: column; gap: 0.35rem; min-width: 140px; }

.rss-item { display: flex; align-items: center; gap: 0.4rem; }
.rss-bar { flex: 1; height: 4px; background: var(--bg-elevated); border-radius: 2px; overflow: hidden; min-width: 50px; }
.rss-fill { height: 100%; border-radius: 2px; transition: width 0.6s ease; }
.rss-val { font-size: 0.7rem; font-weight: 700; min-width: 28px; text-align: right; }
.rss-lbl { font-size: 0.6rem; color: var(--text-muted); min-width: 42px; }

.result-reasoning {
  width: 100%;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 0.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
}

/* Engine Summary */
.engine-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.es-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.es-card.accent { border-color: rgba(124, 92, 252, 0.3); background: var(--accent-glow); }

.es-val {
  font-size: 1.75rem;
  font-weight: 800;
  background: var(--gradient-2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.es-card.accent .es-val {
  background: var(--gradient-1);
  -webkit-background-clip: text;
  background-clip: text;
}

.es-lbl {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Add New Grid */
.add-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.add-section h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.add-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.add-form .full { grid-column: 1 / -1; }

.add-form .btn {
  grid-column: 1 / -1;
  justify-self: end;
  margin-top: 0.5rem;
}
