/* ================================================================
   MAKEBI ZULU PRESIDENTIAL CAMPAIGN — MEDIA OPERATIONS COMMAND
   Design System & Layout
   ================================================================ */

/* ── DESIGN TOKENS ──────────────────────────────────────────── */
:root {
  /* Brand Colors */
  --navy-950:  #050E1A;
  --navy-900:  #0A1628;
  --navy-800:  #0F1F3A;
  --navy-700:  #162B52;
  --navy-600:  #1E3A6E;
  --navy-500:  #2952A3;
  --navy-400:  #4A7AC8;
  --navy-200:  #A8C4E8;
  --navy-100:  #D6E4F5;

  --gold-700:  #92620A;
  --gold-600:  #B8790C;
  --gold-500:  #D4900F;
  --gold-400:  #E8A820;
  --gold-300:  #F0C050;
  --gold-100:  #FBF0D0;

  /* Semantic Colors */
  --color-success:     #059669;
  --color-success-bg:  #D1FAE5;
  --color-warning:     #D97706;
  --color-warning-bg:  #FEF3C7;
  --color-danger:      #DC2626;
  --color-danger-bg:   #FEE2E2;
  --color-info:        #2563EB;
  --color-info-bg:     #DBEAFE;
  --color-purple:      #7C3AED;
  --color-purple-bg:   #EDE9FE;
  --color-slate:       #64748B;
  --color-slate-bg:    #F1F5F9;

  /* Surface Colors */
  --bg-page:    #F0F4F9;
  --bg-card:    #FFFFFF;
  --bg-elevated:#FFFFFF;
  --border:     #E2E8F0;
  --border-strong: #CBD5E1;

  /* Text Colors */
  --text-primary:   #0F172A;
  --text-secondary: #334155;
  --text-muted:     #64748B;
  --text-subtle:    #94A3B8;
  --text-inverse:   #FFFFFF;

  /* Sidebar */
  --sidebar-bg:     #0A1628;
  --sidebar-border: rgba(255,255,255,0.07);
  --sidebar-text:   #E2E8F0;
  --sidebar-active-bg: rgba(232,168,32,0.12);
  --sidebar-active-text: #E8A820;
  --sidebar-hover-bg: rgba(255,255,255,0.05);
  --sidebar-width:  280px;
  --sidebar-collapsed: 72px;

  /* Topbar */
  --topbar-height: 56px;

  /* Spacing Scale */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-7:  28px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Border Radius */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --radius-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.05);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.05);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-xl:  0 20px 25px -5px rgba(0,0,0,0.10), 0 10px 10px -5px rgba(0,0,0,0.04);

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;

  --text-xs:   14px;
  --text-sm:   14px;
  --text-base: 14px;
  --text-md:   15px;
  --text-lg:   16px;
  --text-xl:   18px;
  --text-2xl:  22px;
  --text-3xl:  28px;
  --text-4xl:  36px;

  /* Transitions */
  --transition: 150ms ease;
  --transition-md: 250ms ease;
}

/* ================================================================
   AUTH UI
   ================================================================ */

.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--navy-900);
  background: radial-gradient(circle at center, var(--navy-800) 0%, var(--navy-900) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: white;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  animation: slideInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo {
  margin: 0 auto 16px;
  width: 80px;
  height: 80px;
}

.auth-header h2 {
  font-family: var(--font-heading, var(--font-sans));
  color: var(--navy-900);
  margin-bottom: 8px;
  font-size: 24px;
}

.auth-header p {
  color: var(--navy-500);
  font-size: 15px;
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--navy-600);
}

.auth-footer a {
  color: var(--gold-600);
  font-weight: 600;
  text-decoration: none;
}

.status-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  background: var(--navy-50);
  color: var(--navy-600);
  border-radius: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-icon.info {
  background: var(--color-info-bg);
  color: var(--color-info);
}

#pending-state {
  text-align: center;
}

#pending-state h3 {
  margin-bottom: 12px;
}

#pending-state p {
  color: var(--navy-600);
  line-height: 1.6;
  margin-bottom: 32px;
}

/* ================================================================
   COMMENTS & FEEDBACK
   ================================================================ */

.comments-container {
  background: var(--bg-card);
  border: 1px border var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.comments-list {
  max-height: 400px;
  overflow-y: auto;
  padding: 20px;
  background: var(--bg-page);
}

.comment-item {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  transition: var(--transition);
}

.comment-item.resolved {
  opacity: 0.7;
  border-left: 4px solid var(--color-success);
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.comment-author {
  font-weight: 600;
  font-size: 14px;
  color: var(--navy-900);
}

.comment-date {
  font-size: 14px;
  color: var(--text-muted);
}

.comment-body {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.comment-actions {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.comment-form {
  padding: 20px;
  border-top: 1px solid var(--border);
  background: white;
}

.comment-form textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}

.empty-state-sm {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-style: italic;
  font-size: 13px;
}

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

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

html { height: 100%; font-size: 14px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  height: 100%;
  overflow: hidden;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; }

/* ── APP SHELL ───────────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  overflow: hidden;
  transition: width var(--transition-md);
  position: relative;
  z-index: 100;
  border-right: 1px solid var(--sidebar-border);
  min-width: 64px; /* Maintain collapsed width if needed */
}

body.is-resizing,
body.is-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

body.is-resizing .sidebar {
  transition: none !important;
}

.sidebar-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 1000;
  transition: background 150ms ease;
}

.sidebar-resizer:hover,
.sidebar.is-resizing .sidebar-resizer {
  background: var(--gold-500);
  opacity: 0.3;
}

.sidebar.collapsed .sidebar-resizer {
  display: none;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--sidebar-border);
  min-height: 72px;
  flex-shrink: 0;
}

.campaign-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  overflow: hidden;
}

.campaign-logo {
  width: 48px;
  height: 48px;
  background: white;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.campaign-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.campaign-text {
  overflow: hidden;
  transition: opacity var(--transition-md), width var(--transition-md);
}

.sidebar.collapsed .campaign-text { opacity: 0; width: 0; }

.campaign-name {
  display: block;
  color: #FFFFFF;
  font-size: var(--text-base);
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: -0.2px;
}

.campaign-sub {
  display: block;
  color: var(--gold-400);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--sidebar-text);
  padding: var(--sp-2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color var(--transition), background var(--transition);
}

.sidebar-toggle:hover { color: #FFF; background: var(--sidebar-hover-bg); }

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--sp-3) 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.nav-group { margin-bottom: var(--sp-2); }

.nav-group-label {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.4);
  padding: var(--sp-3) var(--sp-4) var(--sp-1);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition-md);
}

.sidebar.collapsed .nav-group-label { opacity: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 9px var(--sp-4);
  color: var(--sidebar-text);
  border-radius: 0;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  position: relative;
  white-space: nowrap;
  border-left: 3px solid transparent;
  margin: 1px 0;
}

.nav-item:hover {
  background: var(--sidebar-hover-bg);
  color: #E2E8F0;
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  border-left-color: var(--gold-400);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 1.8;
}

.nav-item span:not(.nav-badge) {
  font-size: var(--text-md);
  font-weight: 600;
  flex: 1;
  transition: opacity var(--transition-md);
}

.sidebar.collapsed .nav-item span:not(.nav-badge) { opacity: 0; width: 0; overflow: hidden; }
.sidebar.collapsed .nav-badge { display: none; }

.nav-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  line-height: 1.6;
  min-width: 18px;
  text-align: center;
}

.nav-badge.danger  { background: var(--color-danger); color: #FFF; }
.nav-badge.warn    { background: var(--color-warning); color: #FFF; }
.nav-badge.info    { background: var(--color-info); color: #FFF; }
.nav-badge:empty   { display: none; }

/* Sidebar Footer */
.sidebar-footer {
  border-top: 1px solid var(--sidebar-border);
  padding: var(--sp-4);
  flex-shrink: 0;
}

.user-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  overflow: hidden;
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--navy-700);
  border: 2px solid var(--gold-600);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--gold-300);
  flex-shrink: 0;
}

.user-info { overflow: hidden; transition: opacity var(--transition-md); }
.sidebar.collapsed .user-info { opacity: 0; width: 0; }

.user-name {
  display: block;
  color: #E2E8F0;
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}

.user-role {
  display: block;
  color: var(--sidebar-text);
  font-size: var(--text-xs);
  white-space: nowrap;
}

/* ── MAIN WRAPPER ────────────────────────────────────────────── */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── TOPBAR ──────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-6);
  flex-shrink: 0;
  gap: var(--sp-4);
}

.topbar-left { display: flex; align-items: center; gap: var(--sp-4); }
.topbar-right { display: flex; align-items: center; gap: var(--sp-3); }

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: var(--sp-2);
  border-radius: var(--radius-sm);
}

.page-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.breadcrumb-campaign { font-weight: 600; color: var(--text-secondary); }
.breadcrumb-page { color: var(--text-primary); font-weight: 600; }
.page-breadcrumb svg { color: var(--text-subtle); }

.readiness-badge {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3);
  background: var(--color-slate-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
}

.readiness-label { color: var(--text-muted); font-weight: 500; }
.readiness-value { color: var(--text-primary); font-weight: 700; }

.topbar-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 12px 28px;
  background: var(--navy-800);
  color: #FFF;
  border: none;
  border-radius: var(--radius-md);
  font-size: 24px;
  font-weight: 700;
  transition: all var(--transition);
  cursor: pointer;
}

.topbar-btn:hover { background: var(--navy-700); }

/* ── PAGE CONTENT ────────────────────────────────────────────── */
.page-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--sp-6);
  scroll-behavior: smooth;
}

/* ── PAGE HEADER ─────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--sp-6);
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.page-header-left h1 {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.page-header-left p {
  margin-top: var(--sp-1);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

/* ── SECTION ─────────────────────────────────────────────────── */
.section { margin-bottom: var(--sp-8); }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-4); }
.section-title { font-size: var(--text-md); font-weight: 700; color: var(--text-primary); }
.section-subtitle { font-size: var(--text-sm); color: var(--text-muted); margin-top: 2px; }
.section-actions { display: flex; gap: var(--sp-2); }

/* ── GRID LAYOUTS ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

.stats-grid-5 { grid-template-columns: repeat(5, 1fr); }
.stats-grid-4 { grid-template-columns: repeat(4, 1fr); }
.stats-grid-3 { grid-template-columns: repeat(3, 1fr); }
.stats-grid-2 { grid-template-columns: repeat(2, 1fr); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-5); }
.main-aside { display: grid; grid-template-columns: 1fr 340px; gap: var(--sp-5); }

/* ── CARDS ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-xs);
}

.card-lg { padding: var(--sp-6); }
.card-sm { padding: var(--sp-4); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border);
}

.card-title { font-size: var(--text-md); font-weight: 700; color: var(--text-primary); }
.card-subtitle { font-size: var(--text-sm); color: var(--text-muted); margin-top: 2px; }
.card-actions { display: flex; gap: var(--sp-2); }

/* Stat Card */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--stat-accent, var(--navy-600));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: var(--sp-2);
}

.stat-value {
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: var(--sp-2);
}

.stat-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.stat-trend-up   { color: var(--color-success); }
.stat-trend-down { color: var(--color-danger); }

.stat-icon {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.15;
}

/* Alert/Callout Cards */
.alert-card {
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  border-left: 4px solid;
  margin-bottom: var(--sp-3);
}

.alert-card.danger  { background: var(--color-danger-bg);  border-color: var(--color-danger);  }
.alert-card.warning { background: var(--color-warning-bg); border-color: var(--color-warning); }
.alert-card.success { background: var(--color-success-bg); border-color: var(--color-success); }
.alert-card.info    { background: var(--color-info-bg);    border-color: var(--color-info);    }
.alert-card.purple  { background: var(--color-purple-bg);  border-color: var(--color-purple);  }

.alert-title { font-size: var(--text-sm); font-weight: 700; margin-bottom: 3px; }
.alert-body  { font-size: var(--text-sm); color: var(--text-secondary); }

/* ── READINESS SCORE ─────────────────────────────────────────── */
.readiness-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  text-align: center;
}

.readiness-ring {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto var(--sp-4);
}

.readiness-ring svg { width: 120px; height: 120px; transform: rotate(-90deg); }
.readiness-ring-track { stroke: var(--border); fill: none; stroke-width: 8; }
.readiness-ring-fill  { fill: none; stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 1s ease; }
.readiness-ring-fill.good { stroke: var(--color-success); }
.readiness-ring-fill.warn { stroke: var(--color-warning); }
.readiness-ring-fill.low  { stroke: var(--color-danger); }

.readiness-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.readiness-pct { font-size: var(--text-2xl); font-weight: 800; color: var(--text-primary); }
.readiness-txt { font-size: var(--text-xs); font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.readiness-factors { list-style: none; text-align: left; }
.readiness-factors li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
}
.readiness-factors li:last-child { border-bottom: none; }
.readiness-factor-label { color: var(--text-muted); }
.readiness-factor-val { font-weight: 700; }

/* ── PROGRESS BARS ───────────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: var(--sp-2);
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
  background: var(--color-info);
}

.progress-fill.success { background: var(--color-success); }
.progress-fill.warning { background: var(--color-warning); }
.progress-fill.danger  { background: var(--color-danger); }
.progress-fill.gold    { background: var(--gold-500); }
.progress-fill.navy    { background: var(--navy-600); }

/* ── BADGES / STATUS PILLS ───────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.2px;
}

.badge-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* Status Colors */
.badge-not-started     { background: #F1F5F9; color: #475569; }
.badge-needs-def       { background: #F0F9FF; color: #0369A1; }
.badge-awaiting-buy-in { background: var(--color-purple-bg); color: var(--color-purple); }
.badge-awaiting-fund   { background: var(--color-warning-bg); color: var(--gold-700); }
.badge-awaiting-hire   { background: #FFF7ED; color: #C2410C; }
.badge-awaiting-vendor { background: #F5F3FF; color: #6D28D9; }
.badge-awaiting-appr   { background: #FFF7ED; color: #C2410C; }
.badge-ready           { background: #F0FDF4; color: #15803D; }
.badge-in-progress     { background: var(--color-info-bg); color: var(--color-info); }
.badge-under-review    { background: #F5F3FF; color: #6D28D9; }
.badge-completed       { background: var(--color-success-bg); color: var(--color-success); }
.badge-blocked         { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-cancelled       { background: #F8FAFC; color: #94A3B8; }
.badge-deferred        { background: #F8FAFC; color: #94A3B8; }
.badge-draft           { background: #F8FAFC; color: #64748B; }
.badge-approved        { background: var(--color-success-bg); color: var(--color-success); }
.badge-rejected        { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-active          { background: var(--color-success-bg); color: var(--color-success); }
.badge-high            { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-medium          { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-low             { background: var(--color-success-bg); color: var(--color-success); }
.badge-critical        { background: #450A0A; color: #FCA5A5; }
.badge-gold            { background: var(--gold-100); color: var(--gold-700); }
.badge-navy            { background: var(--navy-100); color: var(--navy-700); }

/* Priority Indicators */
.priority-critical { color: var(--color-danger); }
.priority-high     { color: #EA580C; }
.priority-medium   { color: var(--color-warning); }
.priority-low      { color: var(--color-success); }

/* ── TABLES ──────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}

thead { background: #F8FAFC; }

th {
  padding: 10px var(--sp-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

th:hover { color: var(--text-primary); }
th .sort-icon { margin-left: 4px; opacity: 0.4; }
th.sort-asc .sort-icon, th.sort-desc .sort-icon { opacity: 1; color: var(--color-info); }

td {
  padding: 12px var(--sp-4);
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tbody tr {
  transition: background var(--transition);
  cursor: pointer;
}

tbody tr:hover { background: #F8FAFC; }

.td-strong { font-weight: 600; color: var(--text-primary); }
.td-muted  { color: var(--text-muted); font-size: var(--text-sm); }
.td-mono   { font-family: var(--font-mono); font-size: var(--text-sm); }

/* Table Actions */
.td-actions { text-align: right; white-space: nowrap; opacity: 0; transition: opacity var(--transition); }
tr:hover .td-actions { opacity: 1; }

/* ── KANBAN BOARD ────────────────────────────────────────────── */
.kanban-board {
  display: flex;
  gap: var(--sp-4);
  overflow-x: auto;
  padding-bottom: var(--sp-4);
}

.kanban-col {
  min-width: 280px;
  max-width: 320px;
  flex-shrink: 0;
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 250px);
}

.kanban-col-header {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.kanban-col-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.kanban-col-count {
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 1px 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

.kanban-col-body {
  padding: var(--sp-3);
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-3);
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
  border-left: 3px solid var(--border);
}

.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kanban-card.blocked { border-left-color: var(--color-danger); }
.kanban-card.high-priority { border-left-color: var(--color-warning); }
.kanban-card.critical { border-left-color: #7F1D1D; }

.kanban-card-title { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.kanban-card-ws { font-size: var(--text-xs); color: var(--text-muted); margin-bottom: var(--sp-2); }
.kanban-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: var(--sp-2); }
.kanban-card-owner { font-size: var(--text-xs); color: var(--text-muted); }
.kanban-card-date  { font-size: var(--text-xs); color: var(--text-muted); }
.kanban-card-date.overdue { color: var(--color-danger); font-weight: 600; }

/* ── FUNDING BAR ─────────────────────────────────────────────── */
.funding-bar-wrap { margin: var(--sp-3) 0; }
.funding-bar-labels { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--text-muted); margin-bottom: 4px; }
.funding-bar-track { height: 10px; background: var(--color-danger-bg); border-radius: var(--radius-full); overflow: hidden; position: relative; }
.funding-bar-secured { height: 100%; background: var(--color-success); border-radius: var(--radius-full); }
.funding-bar-pending { height: 100%; background: var(--color-warning); border-radius: var(--radius-full); display: inline-block; }

.funding-overview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.funding-stat {
  padding: var(--sp-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.funding-stat-label { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); margin-bottom: 4px; }
.funding-stat-value { font-size: var(--text-xl); font-weight: 800; color: var(--text-primary); }
.funding-stat-value.success { color: var(--color-success); }
.funding-stat-value.danger  { color: var(--color-danger); }
.funding-stat-value.warning { color: var(--color-warning); }

/* ── TIMELINE ────────────────────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: var(--sp-8);
}

.timeline::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: var(--sp-5);
}

.timeline-dot {
  position: absolute;
  left: -32px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border);
  z-index: 1;
}

.timeline-dot.complete { border-color: var(--color-success); background: var(--color-success); }
.timeline-dot.active   { border-color: var(--color-info);    background: var(--color-info); }
.timeline-dot.at-risk  { border-color: var(--color-warning); background: var(--color-warning); }
.timeline-dot.blocked  { border-color: var(--color-danger);  background: var(--color-danger); }

.timeline-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
}

.timeline-date { font-size: var(--text-xs); color: var(--text-muted); margin-bottom: 2px; }
.timeline-title { font-size: var(--text-base); font-weight: 600; color: var(--text-primary); }
.timeline-body  { font-size: var(--text-sm); color: var(--text-muted); margin-top: 4px; }

/* ── FORMS ───────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: var(--sp-3); }
.form-group-row { display: flex; gap: var(--sp-4); }

label {
  font-size: 19px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

input,
select,
textarea,
.form-input,
.form-select,
.form-textarea {
  padding: 15px 20px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 24px;
  line-height: 1.2;
  color: var(--text-primary);
  background: var(--bg-card);
  width: 100%;
  min-height: 68px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--navy-500);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

.form-textarea { min-height: 80px; resize: vertical; }

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: var(--sp-8);
}

.form-hint { font-size: var(--text-xs); color: var(--text-muted); }
.form-error { font-size: var(--text-xs); color: var(--color-danger); }

/* Currency Input */
.input-prefix-wrap { position: relative; }
.input-prefix {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: var(--text-base);
  pointer-events: none;
  font-weight: 600;
}
.input-prefix-wrap .form-input { padding-left: 28px; }

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 14px 28px;
  border-radius: var(--radius-md);
  font-size: 22px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  outline: none;
}

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

.btn svg { width: 15px; height: 15px; }

.btn-primary {
  background: var(--navy-800);
  color: #FFF;
  border-color: var(--navy-800);
}
.btn-primary:hover:not(:disabled) { background: var(--navy-700); }

.btn-gold {
  background: var(--gold-500);
  color: var(--navy-900);
  border-color: var(--gold-500);
}
.btn-gold:hover:not(:disabled) { background: var(--gold-400); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-strong);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-page); }

.btn-danger {
  background: var(--color-danger);
  color: #FFF;
  border-color: var(--color-danger);
}
.btn-danger:hover:not(:disabled) { background: #B91C1C; }

.btn-sm { padding: 6px 12px; font-size: var(--text-xs); }
.btn-lg { padding: 14px 28px; font-size: var(--text-md); }
.btn-icon svg { width: 16px; height: 16px; }
.btn-icon-danger { color: var(--color-danger); opacity: 0.6; }
.btn-icon-danger:hover { opacity: 1; background: var(--color-danger-bg); }

/* ── FILTER BAR ──────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}

.search-input-wrap { position: relative; }
.search-icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 15px; height: 15px;
  pointer-events: none;
}
.search-input {
  padding: 8px var(--sp-3) 8px 32px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--bg-card);
  width: 220px;
  outline: none;
  transition: border-color var(--transition);
}
.search-input:focus { border-color: var(--navy-500); }

.view-toggle {
  display: flex;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.view-toggle-btn {
  padding: 7px var(--sp-3);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all var(--transition);
}
.view-toggle-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}
.view-toggle-btn svg { width: 14px; height: 14px; }

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.filter-chip.active { background: var(--navy-800); color: #FFF; border-color: var(--navy-800); }
.filter-chip:hover { border-color: var(--border-strong); }

/* ── MODAL ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 40, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
}

.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 1088px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-box.modal-lg { max-width: 1200px; }
.modal-box.modal-sm { max-width: 600px; }
.modal-box.modal-full { max-width: 1400px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title { font-size: 27px; font-weight: 700; color: var(--text-primary); }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: var(--sp-2);
  border-radius: var(--radius-sm);
  display: flex;
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-page); }

.modal-body {
  padding: var(--sp-6);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  flex-shrink: 0;
}

.modal-footer.hidden { display: none; }

/* Detail Modal Sections */
.detail-section { margin-bottom: var(--sp-6); }
.detail-section-title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border);
}

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.detail-field label { font-size: var(--text-xs); color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.detail-field .val  { font-size: var(--text-base); color: var(--text-primary); font-weight: 500; margin-top: 2px; }

/* ── TOAST NOTIFICATIONS ─────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--navy-900);
  color: #E2E8F0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  min-width: 280px;
  max-width: 380px;
  animation: slideIn 0.3s ease;
  border-left: 4px solid var(--navy-400);
}

.toast.success { border-left-color: var(--color-success); }
.toast.error   { border-left-color: var(--color-danger); }
.toast.warning { border-left-color: var(--color-warning); }

.toast-icon { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.toast-text { flex: 1; line-height: 1.4; }
.toast-title { font-weight: 700; }
.toast-msg { color: var(--navy-200); font-size: var(--text-xs); margin-top: 2px; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── EMPTY STATE ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--sp-12) var(--sp-8);
  color: var(--text-muted);
}

.empty-state svg { width: 48px; height: 48px; margin: 0 auto var(--sp-4); opacity: 0.3; }
.empty-state h3 { font-size: var(--text-lg); font-weight: 700; color: var(--text-secondary); margin-bottom: var(--sp-2); }
.empty-state p  { font-size: var(--text-sm); max-width: 360px; margin: 0 auto var(--sp-5); }

/* ── LEADERSHIP SNAPSHOT ─────────────────────────────────────── */
.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
}

.snapshot-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--bg-page);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

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

.snapshot-icon.danger  { background: var(--color-danger-bg); color: var(--color-danger); }
.snapshot-icon.warning { background: var(--color-warning-bg); color: var(--color-warning); }
.snapshot-icon.success { background: var(--color-success-bg); color: var(--color-success); }
.snapshot-icon.info    { background: var(--color-info-bg); color: var(--color-info); }

.snapshot-text h4 { font-size: var(--text-sm); font-weight: 700; color: var(--text-primary); }
.snapshot-text p  { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }

/* ── PIPELINE STAGES ─────────────────────────────────────────── */
.stage-pipeline {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding-bottom: var(--sp-4);
}

.stage-col {
  min-width: 160px;
  flex: 1;
}

.stage-header {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-size: var(--text-xs);
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stage-body {
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: var(--sp-2);
  min-height: 100px;
}

.pipeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--sp-2) var(--sp-3);
  margin-bottom: 4px;
  font-size: var(--text-xs);
}

.pipeline-card-title { font-weight: 600; color: var(--text-primary); }
.pipeline-card-sub   { color: var(--text-muted); margin-top: 2px; }

/* ── WORKSTREAM CARD ─────────────────────────────────────────── */
.ws-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--sp-4);
}

.ws-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
  border-top: 4px solid var(--border);
  position: relative;
}

.ws-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.ws-card.print    { border-top-color: #2563EB; }
.ws-card.digital  { border-top-color: #7C3AED; }
.ws-card.radio    { border-top-color: #059669; }
.ws-card.tv       { border-top-color: #DC2626; }
.ws-card.outdoor  { border-top-color: #D97706; }
.ws-card.music    { border-top-color: #DB2777; }
.ws-card.ops      { border-top-color: #0891B2; }
.ws-card.podcast  { border-top-color: #7C3AED; }

.ws-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: var(--sp-3); }
.ws-card-title  { font-size: var(--text-base); font-weight: 700; color: var(--text-primary); }
.ws-card-cat    { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }
.ws-card-body   { margin-bottom: var(--sp-3); }
.ws-card-desc   { font-size: var(--text-sm); color: var(--text-muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.ws-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}

.ws-card-owner { font-size: var(--text-xs); color: var(--text-muted); }
.ws-progress-label { font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--sp-2); display: flex; justify-content: space-between; }

/* ── RISK MATRIX ─────────────────────────────────────────────── */
.risk-matrix {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: var(--sp-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.risk-cell {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
}

.risk-cell.low    { background: #D1FAE5; }
.risk-cell.medium { background: #FEF3C7; }
.risk-cell.high   { background: #FFEDD5; }
.risk-cell.crit   { background: #FEE2E2; }

/* ── LOADING ─────────────────────────────────────────────────── */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: var(--sp-4);
  color: var(--text-muted);
}

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

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

.loading-text { font-size: var(--text-sm); font-weight: 600; }

/* ── SUPABASE CONNECTION STATUS ──────────────────────────────── */
.db-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
}

.db-status.connected    { background: var(--color-success-bg); color: var(--color-success); }
.db-status.disconnected { background: var(--color-danger-bg);  color: var(--color-danger); }
.db-status.connecting   { background: var(--color-warning-bg); color: var(--color-warning); }

.db-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ── MISC UTILITIES ──────────────────────────────────────────── */
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.flex-1 { flex: 1; }
.text-sm  { font-size: var(--text-sm); }
.text-xs  { font-size: var(--text-xs); }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.mt-1 { margin-top: var(--sp-1); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── TABS ────────────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: var(--sp-5); gap: 0; }

.tab-btn {
  padding: var(--sp-3) var(--sp-4);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: -1px;
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--navy-600); border-bottom-color: var(--navy-600); }

/* ── GANTT / TIMELINE CHART ──────────────────────────────────── */
.gantt-wrap {
  overflow-x: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.gantt-header {
  display: grid;
  background: #F8FAFC;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
}

.gantt-row {
  display: grid;
  border-bottom: 1px solid var(--border);
  min-height: 42px;
  align-items: center;
}

.gantt-label {
  padding: 10px var(--sp-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  border-right: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: sticky;
  left: 0;
  background: inherit;
  z-index: 1;
}

.gantt-bar-cell { position: relative; padding: 4px; }

.gantt-bar {
  position: absolute;
  height: 24px;
  border-radius: var(--radius-sm);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: #FFF;
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity var(--transition);
}

.gantt-bar:hover { opacity: 0.85; }
.gantt-bar.planning  { background: var(--navy-500); }
.gantt-bar.active    { background: var(--color-success); }
.gantt-bar.blocked   { background: var(--color-danger); }
.gantt-bar.complete  { background: #94A3B8; }

/* ── DATA CONNECTION BANNER ──────────────────────────────────── */
.connection-banner {
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.connection-banner p { font-size: var(--text-sm); color: var(--text-secondary); }
.connection-banner strong { color: var(--text-primary); }

/* ── RESPONSIVE: iPad Portrait ─────────────────────────────────── */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 220px;
  }

  .stats-grid-5 { grid-template-columns: repeat(3, 1fr); }
  .stats-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .main-aside   { grid-template-columns: 1fr; }
  .three-col    { grid-template-columns: 1fr 1fr; }
  .funding-overview { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --topbar-height: 52px; }

  .app-shell { position: relative; }

  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform var(--transition-md);
    width: var(--sidebar-width) !important;
    box-shadow: var(--shadow-xl);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-toggle { display: none; }
  .mobile-menu-btn { display: flex; }

  .main-wrapper { width: 100%; }
  .page-content { padding: var(--sp-4); }

  .stats-grid    { grid-template-columns: repeat(2, 1fr); }
  .stats-grid-5  { grid-template-columns: repeat(2, 1fr); }
  .stats-grid-4  { grid-template-columns: repeat(2, 1fr); }
  .three-col     { grid-template-columns: 1fr; }
  .two-col       { grid-template-columns: 1fr; }
  .form-grid     { grid-template-columns: 1fr; }
  .snapshot-grid { grid-template-columns: 1fr; }
  .ws-grid       { grid-template-columns: 1fr; }
  .funding-overview { grid-template-columns: repeat(2, 1fr); }
  .detail-grid   { grid-template-columns: 1fr; }

  .topbar { padding: 0 var(--sp-4); }
  .breadcrumb-campaign { display: none; }
  .page-breadcrumb svg { display: none; }
  .readiness-badge .readiness-label { display: none; }

  .search-input { width: 160px; }

  table { font-size: var(--text-xs); }
  th, td { padding: 8px var(--sp-3); }

  .modal-box { margin: var(--sp-2); max-height: 95vh; }
  .modal-body { padding: var(--sp-4); }
  .modal-header { padding: var(--sp-4); }
  .modal-footer { padding: var(--sp-3) var(--sp-4); }

  /* iPad touch targets - spacious professional scale */
  .btn { min-height: 60px; }
  .nav-item { min-height: 56px; }
  .form-input, .form-select, .form-textarea { min-height: 64px; }
}

/* Mobile overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
}
.sidebar-overlay.active { display: block; }

/* ── PRINT STYLES ────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .topbar-btn, .btn, .filter-bar { display: none !important; }
  .main-wrapper { display: block; }
  .page-content { padding: 0; overflow: visible; }
  body { overflow: visible; }
  .app-shell { display: block; height: auto; }
}

/* ── CAMPAIGN HIERARCHY & NAVIGATOR ──────────────────────────── */

.phase-tabs-container {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-6);
  padding: var(--sp-2);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow-x: auto;
}

.phase-tab {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-6);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
}

.phase-tab:hover {
  background: var(--color-slate-bg);
  color: var(--text-primary);
}

.phase-tab.active {
  background: var(--navy-800);
  color: #FFF;
  border-color: var(--navy-700);
  box-shadow: var(--shadow-md);
}

.phase-num {
  width: 20px;
  height: 20px;
  background: rgba(0,0,0,0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
}

.phase-tab.active .phase-num {
  background: var(--gold-500);
  color: var(--navy-900);
}

/* Navigator Grid */
.navigator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--sp-5);
}

.navigator-area-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition);
}

.navigator-area-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.area-header {
  padding: var(--sp-4) var(--sp-5);
  background: var(--navy-950);
  color: #FFF;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.area-title { font-size: 14px; font-weight: 700; letter-spacing: 0.5px; }
.area-count { font-size: var(--text-base); font-weight: 600; opacity: 0.6; }

.area-projects {
  flex: 1;
  padding: var(--sp-2);
  min-height: 100px;
}

.empty-area {
  padding: var(--sp-10);
  text-align: center;
  color: var(--text-subtle);
  font-size: 12px;
}

.nav-project-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  margin-bottom: 2px;
  cursor: pointer;
  transition: background var(--transition);
}

.nav-project-row:hover { background: var(--bg-page); }

.proj-name { font-size: var(--text-base); font-weight: 700; color: var(--text-primary); }
.proj-type { font-size: var(--text-base); color: var(--text-muted); margin-top: 2px; }

/* Operational Ledger (Project Detail) */
.function-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--sp-4);
  overflow: hidden;
}

.function-header {
  padding: var(--sp-4) var(--sp-5);
  background: #F8FAFC;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.func-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.func-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: flex; gap: 12px; }

.func-actions { display: flex; align-items: center; gap: 12px; }
.func-cost { font-weight: 800; color: var(--navy-800); font-size: 14px; }

.function-entries { padding: var(--sp-2); }

.entries-table td { padding: 8px 16px; border-bottom: 1px dashed var(--border); }
.entries-table tr:last-child td { border-bottom: none; }

.empty-entries {
  padding: var(--sp-6);
  text-align: center;
  color: var(--text-subtle);
  font-size: 12px;
  font-style: italic;
}

/* Readiness Visualization */
.readiness-score-lg {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.score-val { font-size: 32px; font-weight: 900; color: var(--gold-600); line-height: 1; }
.score-label { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); letter-spacing: 1px; }

.mini-stat {
  display: flex;
  flex-direction: column;
}

.mini-stat label { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-bottom: 2px; }
.mini-stat span { font-size: 14px; font-weight: 700; color: var(--text-primary); }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-600);
  margin-bottom: var(--sp-3);
  cursor: pointer;
  transition: color var(--transition);
}

.back-link:hover { color: var(--gold-700); }
