:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', var(--font-sans);

  /* Color Palette - Earthy Birch, Roots & Bedrock */
  --bg-dark: #0c120e;
  --bg-card: rgba(18, 27, 22, 0.88);
  --bg-card-hover: rgba(25, 38, 30, 0.96);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --border-color: rgba(143, 163, 130, 0.16);
  --border-focus: rgba(74, 222, 128, 0.45);

  --text-main: #fbf9f4;
  --text-muted: #9aa89f;
  --text-dim: #6c7c72;

  --primary: #3e7d58;
  --primary-light: #4ade80;
  --primary-glow: rgba(74, 222, 128, 0.25);

  --emerald: #4ade80;
  --emerald-bg: rgba(74, 222, 128, 0.12);
  --amber: #c49a6c;
  --amber-bg: rgba(196, 154, 108, 0.14);
  --rose: #f43f5e;
  --rose-bg: rgba(244, 63, 94, 0.12);
  --cyan: #2dd4bf;
  --cyan-bg: rgba(45, 212, 191, 0.12);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 25px -3px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 35px -5px var(--primary-glow);
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(62, 125, 88, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(196, 154, 108, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(12, 18, 14, 0.8) 0%, transparent 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* Container */
.container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 24px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-badge {
  background: linear-gradient(135deg, var(--primary), #a855f7);
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-glow);
  letter-spacing: -0.5px;
}

.brand-text h1 {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-tag {
  font-size: 0.72rem;
  background: var(--primary-glow);
  color: var(--primary-light);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
  text-transform: uppercase;
}

.brand-text p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--bg-glass);
}

.pill-badge.live {
  background: var(--emerald-bg);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

/* Nav Steps */
.step-nav {
  display: flex;
  gap: 8px;
  background: rgba(15, 23, 42, 0.6);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
  overflow-x: auto;
}

.nav-btn {
  flex: 1;
  min-width: 170px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-btn .step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.nav-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.nav-btn.active .step-num {
  background: rgba(255, 255, 255, 0.25);
  border-color: transparent;
  color: #fff;
}

/* Main Content Views */
.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Cards & Grid */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(460px, 1fr));
  gap: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, transform 0.2s;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

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

.card-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Stat Box */
.stat-box {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-glass);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
}

/* Drop Zones & File Upload */
.upload-zones-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}

.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px 18px;
  text-align: center;
  background: var(--bg-glass);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
  transform: translateY(-2px);
}

.drop-zone input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 10;
}

.drop-zone > :not(input) {
  pointer-events: none;
}

.drop-zone-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.drop-zone-icon.green {
  background: var(--emerald-bg);
  color: #34d399;
}

.drop-zone-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  margin-bottom: 4px;
}

.drop-zone-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.file-status-badge {
  margin-top: 10px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.file-status-badge.loaded {
  background: var(--emerald-bg);
  border-color: rgba(16, 185, 129, 0.4);
  color: #a7f3d0;
}

.template-download-row {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.btn-template {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-template:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

/* Agent Log Stream */
.log-stream {
  background: #060911;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: 'JetBrains Mono', Consolas, Monaco, monospace;
  font-size: 0.82rem;
  max-height: 280px;
  overflow-y: auto;
}

.log-entry {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  line-height: 1.4;
}

.log-time {
  color: var(--text-dim);
  white-space: nowrap;
}

.log-agent {
  color: var(--primary-light);
  font-weight: 600;
  white-space: nowrap;
}

.log-msg {
  color: #cbd5e1;
}

/* 5-Box Why Statement Layout */
.five-boxes-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
  margin-top: 16px;
}

.box-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
}

.box-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), transparent);
}

.box-1 { grid-column: span 6; border-left: 3px solid #6366f1; }
.box-2 { grid-column: span 6; border-left: 3px solid #8b5cf6; }
.box-3 { grid-column: span 12; border-left: 3px solid #06b6d4; }
.box-4 { grid-column: span 6; border-left: 3px solid #10b981; }
.box-5 { grid-column: span 6; border-left: 3px solid #f59e0b; }

.box-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.box-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.box-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.box-body {
  font-size: 0.93rem;
  color: #cbd5e1;
  line-height: 1.6;
}

.citation-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary-light);
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 10px;
}

.sponsor-pledge-callout {
  margin-top: 14px;
  padding: 12px 16px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  color: #fde68a;
  font-size: 0.88rem;
  font-weight: 600;
}

/* Readiness Scale Meter */
.meter-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.meter-label {
  width: 220px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #cbd5e1;
}

.meter-bar-container {
  flex: 1;
  height: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.meter-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.meter-fill.danger { background: var(--rose); }
.meter-fill.warning { background: var(--amber); }
.meter-fill.good { background: var(--emerald); }

.meter-score {
  width: 45px;
  text-align: right;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
}

/* Action Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 14px 16px;
  font-size: 0.9rem;
  color: #cbd5e1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Human Checkpoint & Stage-Gate Station */
.human-gate-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  gap: 16px;
  transition: all 0.3s ease;
}

.human-gate-banner.approved {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.4);
}

.human-gate-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.human-gate-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.gate-status-pill {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.82rem;
  white-space: nowrap;
}

.gate-status-pill.draft {
  background: var(--amber-bg);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.gate-status-pill.approved {
  background: var(--emerald-bg);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.gate-decision-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.gate-decision-card {
  border: 1px solid var(--border-color);
  background: var(--bg-glass);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gate-decision-card:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.06);
}

.gate-decision-card.selected {
  border-color: #34d399;
  background: rgba(16, 185, 129, 0.12);
  color: #fff;
}

.gate-decision-title {
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 2px;
}

.gate-decision-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.human-sign-box {
  background: #070a12;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-top: 16px;
}

.human-sign-box label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.demo-highlight-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(16, 185, 129, 0.06));
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 18px;
}

/* Modal Window for Quick Edit */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 580px;
  padding: 26px;
  box-shadow: var(--shadow-md);
}

/* Print View Styles */
@media print {
  body {
    background: #fff;
    color: #111;
  }
  .app-header, .step-nav, .no-print {
    display: none !important;
  }
  .card, .box-card {
    border: 1px solid #ccc;
    background: #fff;
    color: #111;
    box-shadow: none;
  }
  .view-panel {
    display: block !important;
  }
}
